HiRISE
 PDS_JP2

Dimensions.hh

Go to the documentation of this file.
00001 /*  Dimensions
00002 
00003 HiROC CVS ID: Dimensions.hh,v 1.5 2009/07/16 07:13:30 castalia Exp
00004 
00005 Copyright (C) 2007  Arizona Board of Regents on behalf of the
00006 Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
00007 the University of Arizona.
00008 
00009 This library is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU Lesser General Public License, version 2.1,
00011 as published by the Free Software Foundation.
00012 
00013 This library is distributed in the hope that it will be useful, but
00014 WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public License
00019 along with this library; if not, write to the Free Software Foundation,
00020 Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00021 */
00022 
00023 #ifndef _Dimensions_
00024 #define _Dimensions_
00025 
00026 #include    <iosfwd>
00027 
00028 
00029 namespace UA
00030 {
00031 namespace HiRISE
00032 {
00033 //******************************************************************************
00039 struct Point_2D
00040 {
00042 int
00043     X;
00045 int
00046     Y;
00047 
00048 /*==============================================================================
00049     Constructors:
00050 */
00052 Point_2D ();
00053 
00055 Point_2D (const int& x,const int& y);
00056 
00061 Point_2D (const Point_2D& point);
00062 
00067 Point_2D& operator= (const Point_2D& point);
00068 
00069 /*==============================================================================
00070     Accessors:
00071 */
00076 inline int x () const
00077     {return X;}
00078 
00084 inline Point_2D& x (const int& x_position)
00085     {X = x_position; return *this;}
00086 
00091 inline int y () const
00092     {return Y;}
00093 
00099 inline Point_2D& y (const int& y_position)
00100     {Y = y_position; return *this;}
00101 
00102 };  //  End of Point_2D class.
00103 
00110 std::ostream& operator<< (std::ostream& stream, const Point_2D& point);
00111 
00112 //******************************************************************************
00118 struct Size_2D
00119 {
00121 unsigned int
00122     Width;
00124 unsigned int
00125     Height;
00126 
00127 /*==============================================================================
00128     Constructors:
00129 */
00134 Size_2D ();
00135 
00141 Size_2D (const unsigned int& width, const unsigned int& height);
00142 
00148 Size_2D (const unsigned int& side);
00149 
00154 Size_2D (const Size_2D& size);
00155 
00160 Size_2D& operator= (const Size_2D& size);
00161 
00162 /*==============================================================================
00163     Accessors:
00164 */
00169 inline unsigned int width () const
00170     {return Width;}
00171 
00177 inline Size_2D& width (const unsigned int& width)
00178     {Width = width; return *this;}
00179 
00184 inline unsigned int height () const
00185     {return Height;}
00186 
00192 inline Size_2D& height (const unsigned int& height)
00193     {Height = height; return *this;}
00194 
00199 inline unsigned long area () const
00200     {return Width * Height;}
00201 
00202 };  //  End of Size_2D class.
00203 
00210 std::ostream& operator<< (std::ostream& stream, const Size_2D& size);
00211 
00212 //******************************************************************************
00220 struct Rectangle
00221 :   public Point_2D,
00222     public Size_2D
00223 {
00224 /*==============================================================================
00225     Constructors:
00226 */
00231 Rectangle ();
00232 
00238 Rectangle (const Point_2D& position, const Size_2D& size);
00239 
00244 Rectangle (const Size_2D& size);
00245 
00253 Rectangle
00254     (
00255     const int           x,
00256     const int           y,
00257     const unsigned int  width = 0,
00258     const unsigned int  height = 0
00259     );
00260 
00265 Rectangle (const Rectangle& rectangle);
00266 
00273 Rectangle& operator= (const Rectangle& rectangle);
00274 
00275 /*==============================================================================
00276     Accessors:
00277 */
00283 inline Point_2D position () const
00284     {return Point_2D (X, Y);}
00285 
00291 inline Rectangle& position
00292     (
00293     const Point_2D& point
00294     )
00295 {
00296 X = point.X;
00297 Y = point.Y;
00298 }
00299 
00306 inline Rectangle& position
00307     (
00308     const int   x,
00309     const int   y
00310     )
00311 {
00312 X = x;
00313 Y = y;
00314 return *this;
00315 }
00316 
00322 inline Size_2D size () const
00323     {return Size_2D (Width, Height);}
00324 
00330 inline Rectangle& size
00331     (
00332     const Size_2D&  size
00333     )
00334 {
00335 Width  = size.Width;
00336 Height = size.Height;
00337 return *this;
00338 }
00339 
00346 inline Rectangle& size
00347     (
00348     const unsigned int  width,
00349     const unsigned int  height
00350     )
00351 {
00352 Width = width;
00353 Height = height;
00354 return *this;
00355 }
00356 
00357 /*==============================================================================
00358     Manipulators:
00359 */
00368 Rectangle& operator&= (const Rectangle& rectangle);
00369 
00370 };  //  End of Rectangle class.
00371 
00378 std::ostream& operator<< (std::ostream& stream, const Rectangle& rectangle);
00379 
00380 }   //  namespace HiRISE
00381 }   //  namespace UA
00382 #endif

Generated on Wed Sep 30 23:48:18 2009 for UA::HiRISE::PDS_JP2 by  doxygen 1.5.3