00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // oaBox.h 00004 // 00005 // This file contains the definition for the oaBox class. This class implements 00006 // a 2D rectangle in integer coordiantes. 00007 // 00008 // ***************************************************************************** 00009 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00010 // Integration Initiative, this material may not be copied, modified, 00011 // re-published, uploaded, executed, or distributed in any way, in any medium, 00012 // in whole or in part, without prior written permission from Cadence. 00013 // 00014 // Copyright 2002-2005 Cadence Design Systems, Inc. 00015 // All Rights Reserved. 00016 // 00017 // $Author: icftcm $ 00018 // $Revision: #1 $ 00019 // $Date: 2010/08/09 $ 00020 // $State: Exp $ 00021 // ***************************************************************************** 00022 // ***************************************************************************** 00023 00024 00025 00026 #if !defined(oaBox_P) 00027 #define oaBox_P 00028 00029 00030 00031 // ***************************************************************************** 00032 // Nested includes 00033 // ***************************************************************************** 00034 #include "oaSegment.h" 00035 00036 00037 00038 // ***************************************************************************** 00039 // Declare and define types in the OpenAccess namespace. 00040 // ***************************************************************************** 00041 BEGIN_OA_NAMESPACE 00042 00043 00044 00045 // ***************************************************************************** 00046 // Forward Public Class Declarations 00047 // ***************************************************************************** 00048 class oaTransform; 00049 class oaSegment; 00050 00051 template <class T> 00052 class oaChecker; 00053 00054 00055 00056 // ***************************************************************************** 00057 // oaBox 00058 // ***************************************************************************** 00059 class OA_BASE_DLL_API oaBox { 00060 public: 00061 oaBox(); 00062 oaBox(oaCoord leftIn, 00063 oaCoord bottomIn, 00064 oaCoord rightIn, 00065 oaCoord topIn); 00066 oaBox(const oaPoint &lowerLeftIn, 00067 const oaPoint &upperRightIn); 00068 oaBox(const oaPoint ¢er, 00069 const oaUInt4 size); 00070 oaBox(const oaBox &box, 00071 const oaTransform &xform); 00072 00073 oaPoint &lowerLeft(); 00074 oaPoint &upperRight(); 00075 oaCoord &left(); 00076 oaCoord &bottom(); 00077 oaCoord &right(); 00078 oaCoord &top(); 00079 const oaPoint &lowerLeft() const; 00080 const oaPoint &upperRight() const; 00081 oaCoord left() const; 00082 oaCoord bottom() const; 00083 oaCoord right() const; 00084 oaCoord top() const; 00085 00086 void set(oaCoord leftIn = INT_MAX, 00087 oaCoord bottomIn = INT_MAX, 00088 oaCoord rightIn = INT_MIN, 00089 oaCoord topIn = INT_MIN); 00090 void set(const oaPoint &lowerLeftIn, 00091 const oaPoint &upperRightIn); 00092 void set(const oaPoint ¢er, 00093 const oaUInt4 size); 00094 void set(const oaBox &box, 00095 const oaTransform &xform); 00096 00097 oaUInt4 getWidth() const; 00098 oaUInt4 getHeight() const; 00099 void getCenter(oaPoint &result) const; 00100 void getLowerRight(oaPoint &result) const; 00101 void getUpperLeft(oaPoint &result) const; 00102 00103 oaBoolean hasNoArea() const; 00104 oaBoolean isInverted() const; 00105 oaBoolean overlaps(const oaBox &box, 00106 oaBoolean incEdges = true) const; 00107 oaBoolean overlaps(const oaSegment &seg, 00108 oaBoolean incEdges = true) const; 00109 oaBoolean contains(const oaBox &box, 00110 oaBoolean incEdges = true) const; 00111 oaBoolean contains(const oaPoint &point, 00112 oaBoolean incEdges = true) const; 00113 oaDouble distanceFrom2(const oaPoint &point) const; 00114 00115 void fix(oaBox &result) const; 00116 void fix(); 00117 00118 void transform(const oaTransform &xform, 00119 oaBox &result) const; 00120 void transform(const oaTransform &xform); 00121 void transform(const oaPoint &offset, 00122 oaBox &result) const; 00123 void transform(const oaPoint &offset); 00124 void transform(oaDouble scale, 00125 oaDouble angle, 00126 oaBox &result) const; 00127 void transform(oaDouble scale, 00128 oaDouble angle); 00129 00130 void scale(oaFloat scale); 00131 00132 void merge(const oaBox &box, 00133 oaBox &result) const; 00134 void merge(const oaBox &box); 00135 void merge(const oaPoint &point, 00136 oaBox &result) const; 00137 void merge(const oaPoint &point); 00138 00139 void intersection(const oaBox &box, 00140 oaBox &result) const; 00141 void intersection(const oaBox &box); 00142 00143 void makeZero(); 00144 void makeInvertedZero(); 00145 void init(); 00146 00147 void toPoints(oaPoint *points) const; 00148 00149 oaBoolean operator==(const oaBox &bBox) const; 00150 oaBoolean operator!=(const oaBox &bBox) const; 00151 00152 private: 00153 oaPoint lowerLeftVal; 00154 oaPoint upperRightVal; 00155 00156 friend class oaChecker<oaBox>; 00157 00158 public: 00159 static const oaBox inverted; 00160 static const oaBox ptAtOrigin; 00161 }; 00162 00163 00164 00165 END_OA_NAMESPACE 00166 00167 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.