logical_box.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 #if !defined LOGICAL_BOX_HEADER
00019 #define LOGICAL_BOX_HEADER
00020 
00024 
00026 class WHIPTK_API WT_Logical_Box
00027 {
00028         
00029 public:
00030     WT_Logical_Point    m_min; 
00031     WT_Logical_Point    m_max; 
00033 
00034     WT_Logical_Box()
00035     { }
00036 
00038     WT_Logical_Box(WT_Logical_Point min, WT_Logical_Point max)
00039         : m_min (min)
00040         , m_max (max)
00041     { }
00042 
00044     WT_Logical_Box(WT_Integer32 minx, WT_Integer32 miny, WT_Integer32 maxx, WT_Integer32 maxy)
00045     {
00046         m_min.m_x = minx;
00047         m_min.m_y = miny;
00048         m_max.m_x = maxx;
00049         m_max.m_y = maxy;
00050     }
00051 
00053     virtual ~WT_Logical_Box()
00054     { }
00055 public:
00057     WT_Logical_Point & maxpt()
00058     {   return m_max;   }
00059 
00061     WT_Logical_Point & minpt()
00062     {   return m_min;   }
00063 
00065     WT_Boolean    operator== (WT_Logical_Box const & lb) const
00066     {
00067     if (m_min == lb.m_min && m_max == lb.m_max)
00068         return WD_True;
00069     else
00070         return WD_False;
00071     }
00072 
00073     // Operator += is used grow the Logical_Box 
00074     WT_Logical_Box& operator+= ( const WT_Logical_Box& rhlb ) 
00075     {
00076         if( rhlb.m_min.m_x < m_min.m_x )
00077         {
00078             m_min.m_x = rhlb.m_min.m_x;
00079         }
00080         if( rhlb.m_min.m_y < m_min.m_y )
00081         {
00082             m_min.m_y = rhlb.m_min.m_y;
00083         }
00084         if( rhlb.m_max.m_x > m_max.m_x )
00085         {
00086             m_max.m_x = rhlb.m_max.m_x;
00087         }
00088         if( rhlb.m_max.m_y > m_max.m_y )
00089         {
00090             m_max.m_y = rhlb.m_max.m_y;
00091         }
00092         return *this;
00093     }
00094 };
00095 
00096 #endif // LOGICAL_BOX_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5