This file is indexed.

/usr/include/ossim/base/ossimIrect.h is in libossim-dev 1.7.21-3ubuntu2.

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
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
//*******************************************************************
//
// License:  See top level LICENSE.txt file.
//
// Author:  David Burken
//
// Description:
//
// Contains class declaration for ossimIrect.
// Container class for four integer points representing a rectangle.
//
//*******************************************************************
//  $Id: ossimIrect.h 14789 2009-06-29 16:48:14Z dburken $

#ifndef ossimIrect_HEADER
#define ossimIrect_HEADER 1
#include <iosfwd>
#include <vector>

#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimCommon.h>

//***
// NOTE:  A word on corner points...
//
// There is the concept of "pixel is area" and "pixel is point".
// - Pixel is area means the (x,y) pixel coordinate refers to the upper left
//   corner of the pixel, NOT the center of the pixel.
// - Pixel is point means the (x,y) pixel coordinate refers to the center
//   of the pixel, NOT the upper left corner.
//
// For the uniformity purposes, all pixel points  should be in the
// "pixel is point" form; therefore, the (x,y) point should represent the
// CENTER of the pixel.
//***


//***
// Forward class declarations.
//***
class ossimDrect;
class ossimKeywordlist;

//*******************************************************************
// CLASS:  ossimIrect
//*******************************************************************

class OSSIMDLLEXPORT ossimIrect
{
public:
   enum
   {
      UPPER_LEFT  = 1,
      LOWER_LEFT  = 2,
      LOWER_RIGHT = 4,
      UPPER_RIGHT = 8
   };

   ossimIrect()
      :
         theUlCorner(0, 0),
         theUrCorner(0, 0),
         theLrCorner(0, 0),
         theLlCorner(0, 0),
         theOrientMode(OSSIM_LEFT_HANDED)
      {}

   ossimIrect(ossimIpt ul_corner,
              ossimIpt lr_corner,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED)
      :
         theUlCorner(ul_corner),
         theUrCorner(lr_corner.x, ul_corner.y),
         theLrCorner(lr_corner),
         theLlCorner(ul_corner.x, lr_corner.y),
         theOrientMode(mode)
      {}

   ossimIrect(ossim_int32 ul_corner_x,
              ossim_int32 ul_corner_y,
              ossim_int32 lr_corner_x,
              ossim_int32 lr_corner_y,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED)
      :
         theUlCorner(ul_corner_x, ul_corner_y),
         theUrCorner(lr_corner_x, ul_corner_y),
         theLrCorner(lr_corner_x, lr_corner_y),
         theLlCorner(ul_corner_x, lr_corner_y),
         theOrientMode(mode)
      {}
   
   ossimIrect(const ossimIrect& rect)
      :
         theUlCorner(rect.ul()),
         theUrCorner(rect.ur()),
         theLrCorner(rect.lr()),
         theLlCorner(rect.ll()),
         theOrientMode(rect.orientMode())
      {}

   ossimIrect(const ossimDrect& rect);

   /*!
    * Must compute a bounding rect given these image
    * points.
    */
   ossimIrect(const std::vector<ossimIpt>& points,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);

   ossimIrect(const ossimIpt& p1,
              const ossimIpt& p2,
              const ossimIpt& p3,
              const ossimIpt& p4,
              ossimCoordSysOrientMode=OSSIM_LEFT_HANDED);

   /** destructor */
   ~ossimIrect();
   
   const ossimIrect& operator=  (const ossimIrect& rect);
   const ossimIrect& operator=  (const ossimDrect& rect);
   bool         operator!= (const ossimIrect& rect) const;
   bool         operator== (const ossimIrect& rect) const;

   friend ossimIrect operator*(double scalar, const ossimIrect& rect)
      {
         return ossimIrect((int)floor(rect.theUlCorner.x*scalar),
                           (int)floor(rect.theUlCorner.y*scalar),
                           (int)ceil(rect.theUlCorner.x*scalar+rect.width()*scalar-1),
                           (int)ceil(rect.theUlCorner.y*scalar+rect.height()*scalar-1),
                           rect.theOrientMode);
      }

   const ossimIrect& operator*=(ossim_int32 scalar)
   {
      *this = ossimIrect((theUlCorner.x*scalar),
                         (theUlCorner.y*scalar),
                         (theUlCorner.x*scalar+width()*scalar-1),
                         (theUlCorner.y*scalar+height()*scalar-1),
                         theOrientMode);
      return *this;
   }
   
   ossimIrect operator*(ossim_int32 scalar)const
   {
      return ossimIrect((theUlCorner.x*scalar),
                        (theUlCorner.y*scalar),
                        (theUlCorner.x*scalar+width()*scalar-1),
                        (theUlCorner.y*scalar+height()*scalar-1),
                        theOrientMode);
   }
   
   const ossimIrect& operator *=(double scalar)
      {
         *this = ossimIrect((int)floor(theUlCorner.x*scalar),
                            (int)floor(theUlCorner.y*scalar),
                            (int)ceil(theUlCorner.x*scalar+width()*scalar-1),
                            (int)ceil(theUlCorner.y*scalar+height()*scalar-1),
                            theOrientMode);
         return *this;
      }
   
   ossimIrect operator *(double scalar)const
      {
         return ossimIrect((int)floor(theUlCorner.x*scalar),
                           (int)floor(theUlCorner.y*scalar),
                           (int)ceil(theUlCorner.x*scalar+width()*scalar-1),
                           (int)ceil(theUlCorner.y*scalar+height()*scalar-1),
                           theOrientMode);
      }

   const ossimIrect& operator *=(const ossimDpt& scalar)
      {
         *this = ossimIrect((int)floor(theUlCorner.x*scalar.x),
                            (int)floor(theUlCorner.y*scalar.y),
                            (int)ceil(theUlCorner.x*scalar.x+width()*scalar.x-1),
                            (int)ceil(theUlCorner.y*scalar.y+height()*scalar.y-1),
                            theOrientMode);
         return *this;
      }
   
   ossimIrect operator *(const ossimDpt& scalar)const
      {
         return  ossimIrect((int)floor(theUlCorner.x*scalar.x),
                            (int)floor(theUlCorner.y*scalar.y),
                            (int)ceil(theUlCorner.x*scalar.x+width()*scalar.x-1),
                            (int)ceil(theUlCorner.y*scalar.y+height()*scalar.y-1),
                            theOrientMode);
      }
   const ossimIrect& operator +=(const ossimIpt& shift)
      {
         *this = ossimIrect(theUlCorner.x+shift.x,
                            theUlCorner.y+shift.y,
                            theLrCorner.x+shift.x,
                            theLrCorner.y+shift.y,
                            theOrientMode);
         return *this;
      }
   
   const ossimIrect& operator -=(const ossimIpt& shift)
      {
         *this = ossimIrect(theUlCorner.x-shift.x,
                            theUlCorner.y-shift.y,
                            theLrCorner.x-shift.x,
                            theLrCorner.y-shift.y,
                            theOrientMode);
         return *this;
      }
   
   ossimIrect operator +(const ossimIpt& shift)const
      {
         return ossimIrect(theUlCorner.x+shift.x,
                           theUlCorner.y+shift.y,
                           theLrCorner.x+shift.x,
                           theLrCorner.y+shift.y,
                           theOrientMode);
      }

   ossimIrect operator -(const ossimIpt& shift)const
      {
         return ossimIrect(theUlCorner.x-shift.x,
                           theUlCorner.y-shift.y,
                           theLrCorner.x-shift.x,
                           theLrCorner.y-shift.y,
                           theOrientMode);
      }


   const ossimIrect& operator +=(const ossimDpt& shift)
      {
         *this = ossimIrect((int)floor(theUlCorner.x+shift.x),
                            (int)floor(theUlCorner.y+shift.y),
                            (int)ceil(theUlCorner.x+shift.x+width()-1),
                            (int)ceil(theUlCorner.y+shift.y+height()-1),
                            theOrientMode);
         return *this;
      }
   
   const ossimIrect& operator -=(const ossimDpt& shift)
      {
         *this = ossimIrect((int)floor(theUlCorner.x-shift.x),
                            (int)floor(theUlCorner.y-shift.y),
                            (int)ceil(theUlCorner.x-shift.x+width()-1),
                            (int)ceil(theUlCorner.y-shift.y+height()-1),
                            theOrientMode);
         return *this;
      }
   
   ossimIrect operator +(const ossimDpt& shift)const
      {
         return ossimIrect((int)floor(theUlCorner.x+shift.x),
                           (int)floor(theUlCorner.y+shift.y),
                           (int)ceil(theUlCorner.x+shift.x+width()-1),
                           (int)ceil(theUlCorner.y+shift.y+height()-1),
                           theOrientMode);
      }

   ossimIrect operator -(const ossimDpt& shift)const
      {
         return ossimIrect((int)floor(theUlCorner.x-shift.x),
                           (int)floor(theUlCorner.y-shift.y),
                           (int)ceil(theUlCorner.x-shift.x+width()-1),
                           (int)ceil(theUlCorner.y-shift.y+height()-1),
                           theOrientMode);
         return *this;
      }

   
   ossimIpt ul() const { return theUlCorner; }
   ossimIpt ur() const { return theUrCorner; }
   ossimIpt lr() const { return theLrCorner; }
   ossimIpt ll() const { return theLlCorner; }

   const ossimIrect& changeOrientationMode(ossimCoordSysOrientMode mode)
   {
      // if we are already in the orientation then return
      //
      if(mode == theOrientMode) return *this;
      if(mode == OSSIM_LEFT_HANDED)
      {
         // we must be right handed so change to left handed
         *this = ossimIrect(theUlCorner.x,
                            theLlCorner.y,
                            theLrCorner.x,
                            theUlCorner.y,
                            OSSIM_LEFT_HANDED);
      }
      else
      {
         // we must be left handed so change to RIGHT handed
         *this = ossimIrect(theUlCorner.x,
                            theLlCorner.y,
                            theLrCorner.x,
                            theUlCorner.y,
                            OSSIM_RIGHT_HANDED);
      }
      theOrientMode = mode;
      
      return *this;
   }
   void getBounds(ossim_int32& minx, ossim_int32& miny,
                  ossim_int32& maxx, ossim_int32& maxy)const
      {
         minx = theUlCorner.x;
         maxx = theLrCorner.x;
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            miny = theUlCorner.y;
            maxy = theLrCorner.y;
         }
         else
         {
            maxy = theUlCorner.y;
            miny = theLrCorner.y;
         }
      }

   /*!
    * Initializes center_point with center of the rectangle.
    * Makes center_point nan if this rectangle has nans.
    */
   void getCenter(ossimDpt& center_point) const;
   
   void makeNan()
   {
      theUlCorner.makeNan();
      theLlCorner.makeNan();
      theLrCorner.makeNan();
      theUrCorner.makeNan();
   }
   
   bool hasNans()const{ return (theUlCorner.hasNans() ||
                                theLlCorner.hasNans() ||
                                theLrCorner.hasNans() ||
                                theUrCorner.hasNans());}
   
   bool isNan()const{ return (theUlCorner.isNan() &&
                              theLlCorner.isNan() &&
                              theLrCorner.isNan() &&
                              theUrCorner.isNan());}

   //***
   // This class supports both left and right-handed coordinate systems. For
   // both, the positive x-axis extends to the "right".
   //***
   ossimCoordSysOrientMode orientMode() const { return theOrientMode; }
   void setOrientMode(ossimCoordSysOrientMode mode) { theOrientMode = mode; }

   void stretchToTileBoundary(const ossimIpt& tileWidthHeight);

   const ossimIrect& expand(const ossimIpt& padding);
   ossim_uint32 area()const
      {
         return width()*height();
      }

   /*!
    * Sets the upper left corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   void set_ul(const ossimIpt& pt);

   /*!
    * Sets the upper right corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   void set_ur(const ossimIpt& pt);

   /*!
    * Sets the lower right corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   void set_lr(const ossimIpt& pt);

   /*!
    * Sets the lower left corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   void set_ll(const ossimIpt& pt);

   /*!
    * Sets the upper left x.  Adjusts the remaining corners accordingly.
    */
   void set_ulx(ossim_int32 x);

   /*!
    * Sets the upper left y.  Adjusts the remaining corners accordingly.
    */
   void set_uly(ossim_int32 y);

   /*!
    * Sets the upper right x.  Adjusts the remaining corners accordingly.
    */
   void set_urx(ossim_int32 x);

   /*!
    * Sets the upper right y.  Adjusts the remaining corners accordingly.
    */
   void set_ury(ossim_int32 y);

   /*!
    * Sets the lower right x.  Adjusts the remaining corners accordingly.
    */
   void set_lrx(ossim_int32 x);

   /*!
    * Sets the lower right y.  Adjusts the remaining corners accordingly.
    */
   void set_lry(ossim_int32 y);

   /*!
    * Sets the lower left x.  Adjusts the remaining corners accordingly.
    */
   void set_llx(ossim_int32 x);

   /*!
    * Sets the lower left y.  Adjusts the remaining corners accordingly.
    */
   void set_lly(ossim_int32 y);

   /*!
    * Returns true if "pt" falls within rectangle.  Fall on an edge is also
    * considered to be within.
    */
   bool pointWithin(const ossimIpt& pt) const;

   /*!
    * Returns true if any portion of an input rectangle "rect" intersects
    * "this" rectangle.  
    */
   bool intersects(const ossimIrect& rect) const;

   /*!
    * Returns true if "this" rectangle is contained completely within
    * the input rectangular "rect".
    */
   bool completely_within(const ossimIrect& rect) const;

   ossimCoordSysOrientMode orientationMode()const{return theOrientMode;}
   /*!
    * Returns the height of the rectangle.
    */
   ossim_uint32 height() const
   {
      ossim_int32 h = theLlCorner.y - theUlCorner.y;
      if (h < 0)
      {
         h = -h;
      }
      return static_cast<ossim_uint32>( h + 1 );
   }

   /*!
    * Returns the width of a rectangle.
    */
   ossim_uint32 width()  const
   {
      ossim_int32 w = theLrCorner.x - theLlCorner.x;
      if (w < 0)
      {
         w = -w;
      }
      return static_cast<ossim_uint32>( w + 1 );
   }
 
   ossimIrect clipToRect(const ossimIrect& rect)const;

   inline ossimIpt midPoint()const;

   void print(std::ostream& os) const;

   ossimIrect combine(const ossimIrect& rect)const;
   
   friend OSSIMDLLEXPORT std::ostream& operator<<(std::ostream& os,
                                                  const ossimIrect& rect);

   bool saveState(ossimKeywordlist& kwl,
                  const char* prefix=0)const;
   bool loadState(const ossimKeywordlist& kwl,
                  const char* prefix=0);
private:

   //***
   // Private data members representing the rectangle corners.
   //***
   ossimIpt theUlCorner;
   ossimIpt theUrCorner;
   ossimIpt theLrCorner;
   ossimIpt theLlCorner;

   ossimCoordSysOrientMode  theOrientMode;
};

//*******************************************************************
// Inline Method: ossimIrect::operator=(ossimIrect)
//*******************************************************************
inline const ossimIrect& ossimIrect::operator=(const ossimIrect& rect)
{
   if (this != &rect)
   {
      theUlCorner   = rect.ul();
      theUrCorner   = rect.ur();
      theLrCorner   = rect.lr();
      theLlCorner   = rect.ll();
      theOrientMode = rect.theOrientMode;

      if(rect.hasNans())
      {
         makeNan();
      }
   }

   return *this;
}

//*******************************************************************
// Inline Method: ossimIrect::operator!=
//*******************************************************************
inline bool ossimIrect::operator!=(const ossimIrect& rect) const
{
   return ( (theUlCorner   != rect.ul()) ||
            (theUrCorner   != rect.ur()) ||
            (theLrCorner   != rect.lr()) ||
            (theLlCorner   != rect.ll()) ||
            (theOrientMode != rect.theOrientMode));
}

//*******************************************************************
// Inline Method: ossimIrect::operator==
//*******************************************************************
inline bool ossimIrect::operator==(const ossimIrect& rect) const
{
   return ( (theUlCorner   == rect.ul()) &&
            (theUrCorner   == rect.ur()) &&
            (theLrCorner   == rect.lr()) &&
            (theLlCorner   == rect.ll()) &&
            (theOrientMode == rect.theOrientMode) );
}

//*******************************************************************
// Inline Method: ossimIrect::set_ul
//*******************************************************************
inline void ossimIrect::set_ul(const ossimIpt& pt)
{
   if(pt.hasNans())
   {
      makeNan();
   }
   else
   {
      theUlCorner   = pt;
      theUrCorner.y = pt.y;
      theLlCorner.x = pt.x;
   }
}

//*******************************************************************
// Inline Method: ossimIrect::set_ur
//*******************************************************************
inline void ossimIrect::set_ur(const ossimIpt& pt)
{
   if(pt.hasNans())
   {
      makeNan();
   }
   else
   {
      theUrCorner   = pt;
      theUlCorner.y = pt.y;
      theLrCorner.x = pt.x;
   }
}

//*******************************************************************
// Inline Method: ossimIrect::set_lr
//*******************************************************************
inline void ossimIrect::set_lr(const ossimIpt& pt)
{
   if(pt.hasNans())
   {
      makeNan();
   }
   else
   {
      theLrCorner   = pt;
      theUrCorner.x = pt.x;
      theLlCorner.y = pt.y;
   }
}

//*******************************************************************
// Inline Method: ossimIrect::set_ll
//*******************************************************************
inline void ossimIrect::set_ll(const ossimIpt& pt)
{
   if(pt.hasNans())
   {
      makeNan();
   }
   else
   {
      theLlCorner   = pt;
      theUlCorner.x = pt.x;
      theLrCorner.y = pt.y;
   }
}

//*******************************************************************
// Inline Method: ossimIrect::set_ulx
//*******************************************************************
inline void ossimIrect::set_ulx(ossim_int32 x)
{
   theUlCorner.x = x;
   theLlCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimIrect::set_uly
//*******************************************************************
inline void ossimIrect::set_uly(ossim_int32 y)
{
   theUlCorner.y = y;
   theUrCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimIrect::set_urx
//*******************************************************************
inline void ossimIrect::set_urx(ossim_int32 x)
{
   theUrCorner.x = x;
   theLrCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimIrect::set_ury
//*******************************************************************
inline void ossimIrect::set_ury(ossim_int32 y)
{
   theUrCorner.y = y;
   theUlCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimIrect::set_lrx
//*******************************************************************
inline void ossimIrect::set_lrx(ossim_int32 x)
{
   theLrCorner.x = x;
   theUrCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimIrect::set_lry
//*******************************************************************
inline void ossimIrect::set_lry(ossim_int32 y)
{
   theLrCorner.y = y;
   theLlCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimIrect::set_llx
//*******************************************************************
inline void ossimIrect::set_llx(ossim_int32 x)
{
   theLlCorner.x = x;
   theUlCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimIrect::set_lly
//*******************************************************************
inline void ossimIrect::set_lly(ossim_int32 y)
{
   theLlCorner.y = y;
   theLrCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimIrect::pointWithin
//*******************************************************************
inline bool ossimIrect::pointWithin(const ossimIpt& pt) const
{
   if(hasNans())
   {
      return false;
   }
   if (theOrientMode == OSSIM_LEFT_HANDED)
      return ((pt.x >= ul().x) &&
              (pt.x <= ur().x) &&
              (pt.y >= ul().y) &&
              (pt.y <= ll().y));
   else
      return ((pt.x >= ul().x) &&
              (pt.x <= ur().x) &&
              (pt.y <= ul().y) &&
              (pt.y >= ll().y));
}

//*******************************************************************
// Inline Method: ossimIrect::midPoint
//*******************************************************************
inline ossimIpt ossimIrect::midPoint()const
{
   if(hasNans())
   {
      return ossimIpt(OSSIM_INT_NAN, OSSIM_INT_NAN);
   }
   double x = (ul().x + ur().x + ll().x + lr().x) * 0.25;
   double y = (ul().y + ur().y + ll().y + lr().y) * 0.25;
   
   return ossimIpt(ossim::round<int>(x),
                   ossim::round<int>(y));
}

//*******************************************************************
// Inline Method: ossimIrect::combine
//*******************************************************************
inline ossimIrect ossimIrect::combine(const ossimIrect& rect)const
{
   if(rect.hasNans() || hasNans())
   {
      ossimIrect result;

      result.makeNan();

      return result;
   }
   if (theOrientMode != rect.theOrientMode)
      return(*this);
   
   ossimIpt ulCombine;
   ossimIpt lrCombine;

   if(theOrientMode == OSSIM_LEFT_HANDED)
   {
      ulCombine.x = ((ul().x <= rect.ul().x)?ul().x:rect.ul().x);
      ulCombine.y = ((ul().y <= rect.ul().y)?ul().y:rect.ul().y);
      lrCombine.x = ((lr().x >= rect.lr().x)?lr().x:rect.lr().x);
      lrCombine.y = ((lr().y >= rect.lr().y)?lr().y:rect.lr().y);
   }
   else
   {
      ulCombine.x = ((ul().x <= rect.ul().x)?ul().x:rect.ul().x);
      ulCombine.y = ((ul().y >= rect.ul().y)?ul().y:rect.ul().y);
      lrCombine.x = ((lr().x >= rect.lr().x)?lr().x:rect.lr().x);
      lrCombine.y = ((lr().y <= rect.lr().y)?lr().y:rect.lr().y);
   }

   return ossimIrect(ulCombine, lrCombine, theOrientMode);
/*    if(rect.hasNans() || hasNans()) */
/*    { */
/*       ossimIrect result; */

/*       result.makeNan(); */

/*       return result; */
/*    } */
/*    if (theOrientMode != rect.theOrientMode) */
/*       return(*this); */
   
/*    int ulx = ((ul().x <= rect.ul().x)?ul().x:rect.ul().x); */
/*    int uly = ((ul().y <= rect.ul().y)?ul().y:rect.ul().y); */
/*    int lrx = ((lr().x >= rect.lr().x)?lr().x:rect.lr().x); */
/*    int lry = ((lr().y >= rect.lr().y)?lr().y:rect.lr().y); */

/*    return ossimIrect(ulx, uly, lrx, lry, theOrientMode); */
}

#endif