This file is indexed.

/usr/include/OTB-5.8/otbGlView.h is in libotb-dev 5.8.0+dfsg-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef otb_GlView_h
#define otb_GlView_h


#include "otbGeoInterface.h"
#include "otbGlActor.h"
#include "otbViewSettings.h"

#include <map>
#include <vector>
#include <cassert>

namespace otb
{

template< typename T >
void
assert_quiet_NaN( T val )
{
  assert( !std::numeric_limits< T >::has_quiet_NaN ||
	  ( std::numeric_limits< T >::has_quiet_NaN &&
	    val!=std::numeric_limits< T >::quiet_NaN() ) );
  // make production build happy
  ((void)val);
}

template< typename T >
void
assert_signaling_NaN( T val )
{
  assert( !std::numeric_limits< T >::has_signaling_NaN ||
	  ( std::numeric_limits< T >::has_signaling_NaN &&
	    val!=std::numeric_limits< T >::signaling_NaN() ) );
  // make production build happy
  ((void)val);
}

template< typename T >
void
assert_NaN( T val )
{
  assert_quiet_NaN( val );
  assert_signaling_NaN( val );
  // make production build happy
  ((void)val);
}

/** 
 * The GlView class acts like an OpenGl scene where actors deriving
 * from the GlActor class can be rendered. The GlView class contains the
 * OpenGl viewport and manages:
 * - The size of the viewport,
 * - The entire refresh loop, including light or heavy rendering of
 * all actors and all OpenGl specific stuff needed before and after
 * the actors update,
 * - The actors stack (order in which actors are rendered).
 * 
 * All parameters related to scene description (origin, spacing, angle
 * ...) are stored and managed by the ViewSettings class.
 */
class OTBIce_EXPORT GlView 
  : public itk::Object
{
public:
  typedef GlView                                          Self;
  typedef itk::Object                                     Superclass;
  typedef itk::SmartPointer<Self>                         Pointer;
  typedef itk::SmartPointer<const Self>                   ConstPointer;

  typedef otb::GlActor                                    ActorType;
  typedef std::map<std::string,ActorType::Pointer>        ActorMapType;
  typedef std::vector<std::string>                        StringVectorType;

  /**
   * Type definition for otb::GlActor storage key.
   */
  typedef StringVectorType::value_type KeyType;

  itkNewMacro(Self);

  /**
   * The Initialize method will reset the OpenGl viewport to the given
   * size, clear view settings and remove any existing actor.
   * \param sx Width of the viewport
   * \param sy Height of the viewport
   */ 
  void Initialize(unsigned int sx, unsigned int sy);

  /**
   * This method allows adding a new actor (deriving from GlActor) to
   * the GlView. The actor can be identified by an optional key. If
   * not provided, and the default value is used, the method will
   * generate a key to identify the actor. In both case, the key is
   * returned by the method.  
   * \param actor The actor to be added
   * \param key The key to be used to identify the actor (default to
   * empty string)
   * \return The key identifying the actor (either passed to the
   * method or generated by it).
   */
  std::string AddActor(ActorType * actor, const std::string & key = "");

  /** 
   * This method will try to remove the actor identified by the given
   * key.
   * \param key The key identifying the actor to remove
   * \return True if the actor has been found and removed, false
   * otherwise
   */
  bool RemoveActor(const std::string & key);

  /**
   * This method will remove all existing actors at once.
   */
  void ClearActors();

  /**
   * This method allows retrieving a pointer to the actor identified
   * by the given key.
   * \param key The key identifying the actor to retrieve
   * \return A pointer to the retrieved actor. This pointer will be
   * null if no actor could be found with this key.
   */  
  ActorType::Pointer GetActor(const std::string & key) const;

  /**
   * Tells whether an otb::GlActor is contained given its storage key.
   *
   * @param key otb::GlActor storage key.
   *
   * @return true if an otb::GlActor is contained given storage key.
   */
  bool ContainsActor( const KeyType & key ) const;

  /**
   * This method will return a vector containing the keys of all
   * actors.
   * \return A vector of string containing the keys of all actors.
   */ 
  std::vector<std::string> GetActorsKeys() const;

  /**
   * This method handles all the things that should be done before
   * rendering.
   */
  void BeforeRendering();

  /**
   * This method handles all the things that should be after before
   * rendering.
   */
  void AfterRendering();

  /**
   * This method will update the rendering of the OpenGl viewport,
   * taking into account all parameters in the ViewSettings, without
   * fetching any missing data from disk or RAM. It is therefore very
   * fast.
   */
  void LightRender();

  /**
   * This method will update the rendering of the OpenGl viewport,
   * taking into account all parameters in the ViewSettings, but will
   * first compute and load any missing data for a complete
   * rendering. As such, this update routine can be time consuming.
   */
  void HeavyRender();

  // Resize viewport
  void Resize(unsigned int sx, unsigned int sy);

  itkSetObjectMacro(Settings,ViewSettings);
  itkGetObjectMacro(Settings,ViewSettings);
  itkGetConstObjectMacro(Settings,ViewSettings);

  //comment this macro (not compiling with OTB 3.X)
  // Get Rendering order
  const StringVectorType & GetRenderingOrder() const
  {
    return m_RenderingOrder;
  };

  /**
   * Arbitrary set the rendering order of some or all of contained
   * otb::GlActor instances.
   *
   * Keys which are not contained will be ignored.
   *
   * @param keys The ordered sequence of keys.
   * @param front <code>true</code> to order selected otb::GlActor
   *              instances in front of non-selected ones.
   */
  void SetRenderingOrder( const StringVectorType & keys,
                          bool front );

  // This will rotate the rendering order (without modifying the order)
  void RotateRenderingOrder(bool down = false);

  // Move actor in rendering order
  void MoveActorInRenderingOrder(std::string key, bool down = false);

  // Move actor to the end of rendering order (either front if front
  // is set to true or back if front is set to false)
  void MoveActorToEndOfRenderingOrder(std::string key, bool front = false);

  /**
   * Reproject point and spacing expressed in viewport coordinate
   * system into given actor coordinate system.
   */
  template< typename P, typename S, typename P2, typename S2 >
  bool ReprojectFromView( P & center,
			  S & spacing,
			  const KeyType & key,
			  const P2 & vcenter,
			  const S2 & vspacing,
			  double norm = 1000.0 ) const;

  /**
   */
  template< typename P >
  size_t GetExtent( P & origin, P & extent, bool isOverlay =false ) const;

  /**
   */
  template< typename Point, typename Spacing >
  bool ZoomToExtent( const Spacing & native,
		     Point & center,
		     Spacing & spacing ) const;

  /**
   */
  template< typename Point, typename Spacing >
  bool ZoomToLayer( const KeyType & key,
		    const Spacing & native,
		    Point & center,
		    Spacing & spacing ) const;

  /**
   */
  template< typename Point, typename Spacing >
  bool ZoomToRegion( const Point & origin,
		     const Point & extent,
		     const Spacing & native,
		     Point & center,
		     Spacing & spacing ) const;

  /**
   */
  template< typename Point, typename Spacing >
  bool ZoomToFull( const KeyType & key,
		   Point & center,
		   Spacing & spacing,
		   double units = 1000.0 ) const;

  /**
   */
  void SaveScreenshot( const std::string & filename ) const;

protected:
  GlView();

  ~GlView() ITK_OVERRIDE;

private:
  // prevent implementation
  GlView(const Self&);
  void operator=(const Self&);

  ViewSettings::Pointer m_Settings;

  ActorMapType          m_Actors;

  StringVectorType      m_RenderingOrder;

}; // End class GlView


template< typename P, typename S, typename P2, typename S2 >
bool
GlView
::ReprojectFromView( P & center,
		     S & spacing,
		     const KeyType & key,
		     const P2 & vcenter,
		     const S2 & vspacing,
		     double norm ) const
{
  // std::cout << "otb::GlView@" << std::hex << this << std::endl << "{" << std::endl;

  assert_NaN( vcenter[ 0 ] );
  assert_NaN( vcenter[ 1 ] );

  assert_NaN( vspacing[ 0 ] );
  assert_NaN( vspacing[ 1 ] );


  //
  // Reference actor has not been found.
  otb::GlActor::Pointer actor( GetActor( key ) );

  if( actor.IsNull() )
    return false;


  //
  // Reference actor does not implement geo-interface.
  const otb::GeoInterface * geo =
    dynamic_cast< const GeoInterface * >( actor.GetPointer() );

  if( geo==ITK_NULLPTR )
    return false;


  //
  // Compute transform origin.
  if( !geo->TransformFromViewport( center, vcenter, true ) )
    return false;

  //
  // Compute transformed X-axis extremity.
  GeoInterface::Point2d x( vcenter );

  x[ 0 ] += norm * vspacing[ 0 ]; 

  // std::cout << "X {" << std::endl;

  if( !geo->TransformFromViewport( x, x, true ) )
    return false;

  // std::cout << "x: " << x[ 0 ] << ", " << x[ 1 ] << std::endl;

  // assert_NaN( x[ 0 ] );
  // assert_NaN( x[ 1 ] );

  // std::cout << "}" << std::endl;

  //
  // Compute transformed Y-axis extremity.
  GeoInterface::Point2d y( vcenter );

  y[ 1 ] += norm * vspacing[ 1 ];

  // std::cout << "Y {" << std::endl;

  if( !geo->TransformFromViewport( y, y, true ) )
    return false; 

  // std::cout << "y: " << y[ 0 ] << ", " << y[ 1 ] << std::endl;

  // assert_NaN( y[ 0 ] );
  // assert_NaN( y[ 1 ] );

  // std::cout << "}" << std::endl;

  //
  // Compute transformed spacing.
  //
  // Note SAT:
  //     Formula has been taken from IceViewer::key_callback(). I think
  // that the norm of the transformed X and Y axises is not
  // the new spacing if transform contains a rotation.
  //     To correct this, transformed X and Y vectors should be
  // projected against reference actor X and Y axises (using vectorial
  // dot product).

  x[ 0 ] -= center[ 0 ];
  x[ 1 ] -= center[ 1 ];

  y[ 0 ] -= center[ 0 ];
  y[ 1 ] -= center[ 1 ];

  spacing[ 0 ] = vcl_sqrt( x[ 0 ] * x[ 0 ] + x[ 1 ] * x[ 1 ] ) / norm;
  spacing[ 1 ] = vcl_sqrt( y[ 0 ] * y[ 0 ] + y[ 1 ] * y[ 1 ] ) / norm;

  // Sign of x-spacing is done by sign( x . (1, 0) ) which is sign( x[ 0 ] )
  // Sign of y-spacing is done by sign( y . (0, 1) ) which is sign[ y[ 1 ] )

  if( x[ 0 ]<0.0 )
    spacing[ 0 ] = -spacing[ 0 ];

  if( y[ 1 ]<0.0 )
    spacing[ 1 ] = -spacing[ 1 ];

  //
  // Chech outputs.
  assert_NaN( center[ 0 ] );
  assert_NaN( center[ 1 ] );

  assert_NaN( spacing[ 0 ] );
  assert_NaN( spacing[ 1 ] );

  // std::cout << "} otb::GlView@" << std::hex << this << std::endl;

  //
  // Ok.
  return true;
}


template< typename P >
size_t
GlView
::GetExtent( P & origin, P & extent, bool isOverlay ) const
{
  if( m_Actors.empty() )
    {
    origin.Fill( 0 );
    extent.Fill( 0 );

    return 0;
    }


  origin[ 0 ] = std::numeric_limits< typename P::ValueType >::infinity();
  origin[ 1 ] = std::numeric_limits< typename P::ValueType >::infinity();

  extent[ 0 ] = -std::numeric_limits< typename P::ValueType >::infinity();
  extent[ 1 ] = -std::numeric_limits< typename P::ValueType >::infinity();

  size_t count = 0;

  for( ActorMapType::const_iterator it( m_Actors.begin() );
       it!=m_Actors.end();
       ++it )
    {
    assert( !it->second.IsNull() );

    if( it->second->GetOverlay()==isOverlay )
      {
      P o;
      P e;

      o.Fill( 0 );
      e.Fill( 0 );

      it->second->GetExtent( o[ 0 ], o[ 1 ], e[ 0 ], e[ 1 ] );


      if( o[ 0 ]<origin[ 0 ] )
	origin[ 0 ] = o[ 0 ];

      if( o[ 1 ]<origin[ 1 ] )
	origin[ 1 ] = o[ 1 ];

      if( o[ 0 ]>extent[ 0 ] )
	extent[ 0 ] = o[ 0 ];

      if( o[ 1 ]>extent[ 1 ] )
	extent[ 1 ] = o[ 1 ];


      if( e[ 0 ]<origin[ 0 ] )
	origin[ 0 ] = e[ 0 ];

      if( e[ 1 ]<origin[ 1 ] )
	origin[ 1 ] = e[ 1 ];

      if( e[ 0 ]>extent[ 0 ] )
	extent[ 0 ] = e[ 0 ];

      if( e[ 1 ]>extent[ 1 ] )
	extent[ 1 ] = e[ 1 ];

      ++ count;
      }
    }

  if( count==0 )
    {
    origin.Fill( 0 );
    extent.Fill( 0 );
    }

  return count;
}


template< typename Point, typename Spacing >
bool
GlView
::ZoomToExtent( const Spacing & native, Point & center, Spacing & spacing ) const
{
  Point o;
  Point e;

  o.Fill( 0 );
  e.Fill( 0 );

  // Get origin and extent of all layers in viewport system.
  if( GetExtent( o, e )==0 )
    return false;

  // std::cout << "origin: [ " << o[ 0 ] << ", " << o[ 1 ] << " ]" << std::endl;
  // std::cout << "extent: [ " << e[ 0 ] << ", " << e[ 1 ] << " ]" << std::endl;

  // Zoom to overall region.
  return ZoomToRegion( o, e, native, center, spacing );
}


template< typename Point, typename Spacing >
bool
GlView
::ZoomToLayer( const KeyType & key,
	       const Spacing & native,
	       Point & center,
	       Spacing & spacing ) const
{
  Point o;
  Point e;

  // Get layer actor.
  GlActor::Pointer actor( GetActor( key ) );

  // If not found...
  if( actor.IsNull() )
    return false;

  // Get origin and extent of layer.
  actor->GetExtent( o[ 0 ], o[ 1 ], e[ 0 ], e[ 1 ] );

  // Zoom layer region.
  return ZoomToRegion( o, e, native, center, spacing );
}


template< typename Point, typename Spacing >
bool
GlView
::ZoomToRegion( const Point & origin,
		const Point & extent,
		const Spacing & native,
		Point & center,
		Spacing & spacing ) const
{
  // std::cout
  //   << std::hex << this << std::dec
  //   << "::ZoomToRegion( "
  //   << "[" << origin[ 0 ] << ", " << origin[ 1 ] << "], "
  //   << "[" << extent[ 0 ] << ", " << extent[ 1 ] << "], "
  //   << "[" << native[ 0 ] << ", " << native[ 1 ] << "] )"
  //   << std::endl;

  // Compute center point.
  center.SetToMidPoint( origin, extent );

  // std::cout << "-> center: " << center[ 0 ] << ", " << center[ 1 ] << std::endl;

  // Get scale of (o, e) in viewport.
  assert( !m_Settings.IsNull() );
  double scale = m_Settings->GetScale( origin, extent, true );

  // std::cout << "-> scale: " << scale << std::endl;

  /*
  assert( !std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() ||
	  ( std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() &&
	    native[ 0 ]!=std::numeric_limits< typename Spacing::ValueType >::quiet_NaN()
	  )
  );
  assert( !std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() ||
	  ( std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() &&
	  native[ 1 ]!=std::numeric_limits< typename Spacing::ValueType >::quiet_NaN()
	  )
  );

  assert( !std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() ||
	  ( std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() &&
	    native[ 0 ]!=std::numeric_limits< typename Spacing::ValueType >::quiet_NaN()
	  )
  );
  assert( !std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() ||
	  ( std::numeric_limits< typename Spacing::ValueType >::has_quiet_NaN() &&
	  native[ 1 ]!=std::numeric_limits< typename Spacing::ValueType >::quiet_NaN()
	  )
  );
  */

  // Apply signed scale.
  spacing[ 0 ] = ( native[ 0 ]<0.0 ? -1 : +1 ) * scale;
  spacing[ 1 ] = ( native[ 1 ]<0.0 ? -1 : +1 ) * scale;

  // std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;

  // Ok.
  return true;
}


template< typename Point, typename Spacing >
bool
GlView
::ZoomToFull( const KeyType & key,
	      Point & center,
	      Spacing & spacing,
	      double units ) const
{
  // std::cout
  //   << std::hex << this << std::dec
  //   << "::ZoomToFull();"
  //   << std::endl;

  // Get layer actor.
  GlActor::Pointer actor( GetActor( key ) );

  // If not found...
  if( actor.IsNull() )
    return false;

  // Get geo-interface.
  const GeoInterface * geo =
    dynamic_cast< const GeoInterface * >( actor.GetPointer() );

  if( geo==ITK_NULLPTR )
    return false;

  // Get viewport current center and spacing.
  assert( !m_Settings.IsNull() );

  center = m_Settings->GetViewportCenter();
  spacing = m_Settings->GetSpacing();

  // std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;

  // Get native spacing.
  GeoInterface::Spacing2 n_spacing( geo->GetSpacing() );

  // std::cout << "-> n_spacing: " << n_spacing[ 0 ] << ", " << n_spacing[ 1 ] << std::endl;

  // Transform center point to image space.
  Point o;

  if( !geo->TransformFromViewport( o, center, true ) )
    return false;

  //
  // Consider arbitrary point on the X-axis.
  Point e;

  e[ 0 ] = center[ 0 ] + units * spacing[ 0 ];
  e[ 1 ] = center[ 1 ];

  // Transform considered point.
  if( !geo->TransformFromViewport( e, e, true ) )
    return false;

  // Compute extent vector.
  e[ 0 ] -= o[ 0 ];
  e[ 1 ] -= o[ 1 ];

  // Apply extent vector length to view spacing.
  //
  // MANTIS-1178: Length of vector e must be divided by native
  // spacing.
  //
  // MANTIS-1203: absolute value of native spacing should be
  // considered (to avoid flipping effects).
  spacing[ 0 ] =
    vcl_abs( n_spacing[ 0 ] ) * units * spacing[ 0 ] /
    vcl_sqrt( e[ 0 ] * e[ 0 ] + e[ 1 ] * e[ 1 ] );

  //
  // Consider arbitrary point on the Y-axis.
  e[ 0 ] = center[ 0 ];
  e[ 1 ] = center[ 1 ] + units * spacing[ 1 ];

  // Transform considered point.
  if( !geo->TransformFromViewport( e, e, true ) )
    return false;

  // Compute extent vector.
  e[ 0 ] -= o[ 0 ];
  e[ 1 ] -= o[ 1 ];

  // Apply extent vector length to view spacing.
  //
  // MANTIS-1178: Length of vector e must be divided by native
  // spacing.
  //
  // MANTIS-1203: absolute value of native spacing should be
  // considered (to avoid flipping effects).
  spacing[ 1 ] =
    vcl_abs( n_spacing[ 1 ] ) * units * spacing[ 1 ] /
    vcl_sqrt( e[ 0 ] * e[ 0 ] + e[ 1 ] * e[ 1 ] );

  // std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;

  //
  // Compute aspect-ratio corrected spacing (smallest pixel is chosen
  // as 1:1 reference).
  //
  // MANTIS-1202
  //
  // MANTIS-1203: restore sign of axis when applying isotrop spacing.
  // {
  if( vcl_abs( spacing[ 0 ] ) < vcl_abs( spacing[ 1 ] ) )
    spacing[ 1 ] = ( spacing[ 1 ]<0.0 ? -1 : +1 ) * vcl_abs( spacing[ 0 ] );
  else
    spacing[ 0 ] = ( spacing[ 0 ]<0.0 ? -1 : +1 ) * vcl_abs( spacing[ 1 ] );
  // }
  // MANTIS-1202

  // std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;

  //
  // Ok.
  return true;
}

} // End namespace otb

#endif