00001 /** 00002 * \file region2d.h <mi32/region2d.h> 00003 * \brief Functions and structure for regions 00004 * 00005 * \if NODOC 00006 * $Id: region2d.h_v 1.23 2004/03/30 22:01:29 scowan Exp $ 00007 * 00008 * $Log: region2d.h_v $ 00009 * Revision 1.23 2004/03/30 22:01:29 scowan 00010 * Added get numislands method. 00011 * 00012 * Revision 1.22 2003/11/28 16:52:25 scowan 00013 * Added threshold to is equiv to method. 00014 * 00015 * Revision 1.21 2003/11/25 00:30:28 scowan 00016 * Added is equivalent to methods. 00017 * 00018 * Revision 1.20 2003/09/26 21:52:25 scowan 00019 * Added flag to convert legacy region dest to new region. 00020 * 00021 * Revision 1.19 2003/09/15 13:49:56 fileserver!dwilliss 00022 * Doxygen 00023 * 00024 * Revision 1.18 2003/09/09 17:56:39 scowan 00025 * Added another convert to long method. 00026 * 00027 * Revision 1.17 2003/08/27 21:31:04 scowan 00028 * Removed map proj param from assign method. 00029 * 00030 * Revision 1.16 2003/06/12 19:45:15 scowan 00031 * More const. 00032 * 00033 * Revision 1.15 2003/06/11 16:03:36 scowan 00034 * nc. 00035 * 00036 * Revision 1.14 2003/06/06 21:34:56 scowan 00037 * Added methods. 00038 * 00039 * Revision 1.13 2003/05/08 22:27:01 scowan 00040 * Chagned to use a 3d rect. 00041 * 00042 * Revision 1.12 2003/05/07 15:26:22 scowan 00043 * *** empty log message *** 00044 * 00045 * Revision 1.11 2003/05/07 15:24:56 scowan 00046 * Added test and assignment methods. 00047 * 00048 * Revision 1.10 2003/04/23 21:59:00 scowan 00049 * Added methods. 00050 * 00051 * Revision 1.9 2002/12/10 18:16:21 scowan 00052 * Added more friends. 00053 * 00054 * Revision 1.8 2002/11/26 21:30:17 dwilliss 00055 * never mind... 00056 * 00057 * Revision 1.7 2002/11/21 18:59:48 dwilliss 00058 * Added constructor taking MILIST<POLYLINE>& 00059 * 00060 * Revision 1.6 2002/11/13 18:22:28 scowan 00061 * Added begin and end iterators for both classes. 00062 * 00063 * Revision 1.5 2002/10/23 16:27:58 scowan 00064 * Code completed, not tested. 00065 * 00066 * Revision 1.4 2002/10/22 22:24:29 scowan 00067 * Added parameters. 00068 * 00069 * Revision 1.3 2002/10/11 21:47:06 scowan 00070 * Added intersect code. 00071 * 00072 * Revision 1.2 2002/10/11 17:07:41 scowan 00073 * Allowed vector interface class as a friend. 00074 * 00075 * Revision 1.1 2002/10/09 22:32:03 scowan 00076 * Initial revision 00077 * 00078 * \endif 00079 **/ 00080 00081 #ifndef INC_MI32_REGION2D_H 00082 #define INC_MI32_REGION2D_H 00083 00084 #ifndef INC_MI32_POLYLINE_H 00085 #include <mi32/polyline.h> 00086 #endif 00087 00088 #ifndef INC_MI32_RECT_H 00089 #include <mi32/rect.h> 00090 #endif 00091 00092 #ifndef INC_MI32_MILIST_H 00093 #include <mi32/milist.h> 00094 #endif 00095 00096 #ifndef GENERATING_DOXYGEN_OUTPUT 00097 class TRANS2D_AFFINE; //!< Forward declarations 00098 class TRANS2D_MAPGEN; 00099 struct DREGION; 00100 class REGION2D; 00101 namespace RVC { 00102 class VECTOR; 00103 class REGION; 00104 } 00105 #endif //!< GENERATING_DOXYGEN_OUTPUT 00106 00107 //! SUBREGION2D class - Definitions and methods to support a generic 2D sub-region object in memory. 00108 //! The sub-region can be represented by either a single rectangle or as a polygon and a list of zero 00109 //! or more islands. The polygon in the sub-region is stored in ORIENTATION_Clockwise and all islands 00110 //! are stored ORIENTATION_CounterClockwise. 00111 00112 class SUBREGION2D { 00113 public: 00114 00115 typedef MILIST<POLYLINE>::CONST_ITERATOR CONST_ITERATOR; 00116 00117 //! Default Constructor 00118 SUBREGION2D ( 00119 ); 00120 00121 //! Copy Constructor 00122 SUBREGION2D ( 00123 const SUBREGION2D& rhs 00124 ); 00125 00126 //! Constructor from DRECT2D 00127 SUBREGION2D ( 00128 const DRECT2D& rect 00129 ); 00130 00131 //! Destructor 00132 ~SUBREGION2D ( 00133 ); 00134 00135 //! Assignment operator 00136 SUBREGION2D& operator= ( 00137 const SUBREGION2D& rhs 00138 ); 00139 00140 //! Assignment operator from rectangle 00141 SUBREGION2D& operator= ( 00142 const DRECT2D& rhs 00143 ); 00144 00145 //! Assigns the sub-region to the passed in polygon 00146 //! This will clear any existing information in 'this' 00147 ERRVALUE Assign ( 00148 const POLYLINE& Polygon 00149 ); 00150 00151 //! Assigns the sub-region to the passed in polygon. 00152 //! A validated polygon is a polygon that does not intersect itself. 00153 //! This will clear any existing information in 'this' 00154 void AssignValidated ( 00155 const POLYLINE& Polygon 00156 ); 00157 00158 //! Get the beginning of the list of POLYLINE's. 00159 //! The first item is the shell polygon, the rest following are islands. 00160 //! If the sub-region is a rectangle, the list will be empty 00161 //! @return Iterator to the beginning of the POLYLINE list 00162 CONST_ITERATOR Begin ( 00163 ) const { return (m_ItemList.Begin()); } 00164 00165 //! Clear the sub-region 00166 void Clear ( 00167 ); 00168 00169 //! Clip a polyline to a sub-region, call the ClipTarget for each segment 00170 //! @return TRUE if part of the line is clipped, FALSE if not, < 0 error 00171 int ClipLine ( 00172 POLYLINE& PolyLine, 00173 POLYLINE::CLIP& ClipTarget, 00174 CLIPMODE ClipMode = CLIPMODE_Inside 00175 ) const; 00176 00177 //! Compute the sub-region area in sub-region units 00178 double ComputeArea ( 00179 ) const; 00180 00181 //! Compute the sub-region area in sub-region units but do not exclude islands in the calculation 00182 double ComputeAreaNoIslands ( 00183 ) const; 00184 00185 //! Compute the sub-region perimeter in sub-region units 00186 double ComputePerimeter ( 00187 ) const; 00188 00189 //! Compute the sub-region perimeter in sub-region units but do not include islands in the calculation 00190 double ComputePerimeterNoIslands ( 00191 ) const; 00192 00193 //! Translate the sub-region using an affine transformation 00194 void ConvertForward ( 00195 const TRANS2D_AFFINE& taf 00196 ); 00197 00198 //! Translate the sub-region using a mapgen transformation 00199 ERRVALUE ConvertForward ( 00200 const TRANS2D_MAPGEN& tmg 00201 ); 00202 00203 //! Translate the sub-region using a mapgen transformation with densification 00204 //! If the sub-region is the extents only, this will convert it to a polygon sub-region 00205 //! before doing the transformation 00206 ERRVALUE ConvertForwardDense ( 00207 const TRANS2D_MAPGEN& tmg 00208 ); 00209 00210 //! Translate the sub-region using an affine transformation 00211 void ConvertInverse ( 00212 const TRANS2D_AFFINE& taf 00213 ); 00214 00215 //! Translate the sub-region using a mapgen transformation 00216 ERRVALUE ConvertInverse ( 00217 const TRANS2D_MAPGEN& tmg 00218 ); 00219 00220 //! Translate the sub-region using a mapgen transformation with densification 00221 //! If the sub-region is the extents only, this will convert it to a polygon sub-region 00222 //! before doing the transformation 00223 ERRVALUE ConvertInverseDense ( 00224 const TRANS2D_MAPGEN& tmg 00225 ); 00226 00227 //! Convert subregion from double's to INT32's with rounding, removes duplicate points 00228 ERRVALUE ConvertToLongRound ( 00229 SIMPLE_ARRAY<LPOLYGON>& PolygonArray, 00230 SIMPLE_ARRAY<LPOINT2D>& PointArray 00231 ) const; 00232 00233 //! Get the end of the list of POLYLINE's 00234 //! @return End of POLYLINE list, see Begin() for details 00235 CONST_ITERATOR End ( 00236 ) const { return (m_ItemList.End()); } 00237 00238 //! Get sub-region extents 00239 //! @return Extents of the sub-region 00240 const DRECT3D& GetExtents ( 00241 ) const { return (m_Extents); } 00242 00243 //! Get sub-region extents 00244 //! @return Extents of the sub-region 00245 const DRECT2D& GetExtents2D ( 00246 ) const { return (m_Extents); } 00247 00248 //! Get number of islands in the sub-region 00249 //! @return Number of islands in the sub-region 00250 INT32 GetNumIslands ( 00251 ) const { return (m_ItemList.GetNumItems()-1); } 00252 00253 //! Intersect an specified rectangle area with the sub-region 00254 //! If the rectangle does not intersect with the sub-region area, 'this' will be set to empty 00255 ERRVALUE Intersect ( 00256 const DRECT2D& Rect, 00257 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00258 ); 00259 00260 //! Intersect an specified area against the sub-region 00261 //! If the polygon does not intersect the sub-region area, 'this' will be set to empty 00262 //! If the "PolyLine" passed in is invalid, this method will only use one of the 00263 //! valid polygons it finds, otherwise the results will be in error. 00264 ERRVALUE Intersect ( 00265 const POLYLINE& PolyLine, 00266 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00267 ); 00268 00269 //! Intersect an specified area against the sub-region 00270 //! If the "SubRegion" does not intersect with the sub-region area, 'this' will be set to empty 00271 ERRVALUE Intersect ( 00272 const SUBREGION2D& SubRegion, 00273 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00274 ); 00275 00276 //! Intersect an specified area from the sub-region known to be valid 00277 //! A validated polygon is a polygon that does not intersect itself. 00278 //! If the polygon does not intersect the sub-region area, 'this' will be set to empty 00279 ERRVALUE IntersectValidated ( 00280 const POLYLINE& PolyLine, 00281 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00282 ); 00283 00284 //! Determine if the two subregions are equivalent 00285 //! This method uses "Fuzzy" vertex comparisons and the direction and order of the elements are not relevant 00286 //! Specify a different threshold to allow greater distances 00287 //! @return 'True' if they are, 'False' if not 00288 bool IsEquivalentTo ( 00289 const SUBREGION2D& rhs, 00290 double threshold = 0.0 //!< Default threshold is max absolute value of rectangle coordinate * 1.0E-13 00291 ) const; 00292 00293 //! Determine if the point falls inside the sub-region 00294 //! @return 'True' if point is inside the sub-region, 'false' if not 00295 bool IsPointInside ( 00296 const DPOINT2D& point 00297 ) const; 00298 00299 //! Is the sub-region an empty sub-region 00300 bool IsEmpty ( 00301 ) const { return (!m_Extents.IsValid()); } 00302 00303 //! Is the sub-region a simple rectangle region? 00304 bool IsRectangle ( 00305 ) const { return (m_ItemList.GetNumItems() == 0); } 00306 00307 //! Remove an specified area from the sub-region 00308 //! If the island removes the entire sub-region area, 'this' will be set to empty 00309 //! If the "Island" passed in is invalid, this method will only use one of the 00310 //! valid polygons it finds, otherwise the results will be in error. 00311 ERRVALUE Subtract ( 00312 const POLYLINE& Island, 00313 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00314 ); 00315 00316 //! Remove an specified area from the sub-region 00317 //! If the "SubRegion" removes the entire sub-region area, 'this' will be set to empty 00318 ERRVALUE Subtract ( 00319 const SUBREGION2D& SubRegion, 00320 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00321 ); 00322 00323 //! Remove an specified rectangle area from the sub-region 00324 //! If the island removes the entire sub-region area, 'this' will be set to empty 00325 ERRVALUE Subtract ( 00326 const DRECT2D& IslandRect, 00327 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00328 ); 00329 00330 //! Remove an specified area from the sub-region known to be valid 00331 //! A validated polygon is a polygon that does not intersect itself. 00332 //! If the island removes the entire sub-region area, 'this' will be set to empty 00333 ERRVALUE SubtractValidated ( 00334 const POLYLINE& Island, 00335 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00336 ); 00337 00338 //! Test the line given the test criteria against the sub-region 00339 //! @return "True" if the line meets the criteria, "false" if not 00340 bool TestLine ( 00341 const POLYLINE& PolyLine, 00342 TESTCRITERIA TestCriteria 00343 ) const; 00344 00345 //! Test the line against the sub-region 00346 //! @return POLYLINE::COMPRESULT 00347 POLYLINE::COMPRESULT TestLine ( 00348 const POLYLINE& PolyLine 00349 ) const; 00350 00351 //! Test the point given the test criteria against the sub-region 00352 //! @return "True" if the point meets the criteria, "false" if not 00353 bool TestPoint ( 00354 const DPOINT2D& Point, 00355 TESTCRITERIA TestCriteria 00356 ) const; 00357 00358 //! Test the polygon given the test criteria against the sub-region 00359 //! @return "True" if the polygon meets the criteria, "false" if not 00360 bool TestPolygon ( 00361 const POLYLINE& PolyLine, 00362 TESTCRITERIA TestCriteria 00363 ) const; 00364 00365 //! Test the polygon against the sub-region 00366 //! @return POLYLINE::COMPRESULT 00367 POLYLINE::COMPRESULT TestPolygon ( 00368 const POLYLINE& PolyLine 00369 ) const; 00370 00371 //! Test the subregion given the test criteria against 'this' 00372 //! @return "True" if the subregion meets the criteria, "false" if not 00373 bool TestSubRegion ( 00374 const SUBREGION2D& SubRegion, 00375 TESTCRITERIA TestCriteria 00376 ) const; 00377 00378 //! Test the subregion against 'this' 00379 //! @return POLYLINE::COMPRESULT 00380 POLYLINE::COMPRESULT TestSubRegion ( 00381 const SUBREGION2D& SubRegion 00382 ) const; 00383 00384 //! Union (ADD) a rectangle to the sub-region 00385 ERRVALUE Union ( 00386 const DRECT2D& Rect, 00387 MILIST<SUBREGION2D>& SubRegionList, //!< Filled in if operation creates more than one sub-region 00388 POLYLINE::COMBINERESULT& CombineResult 00389 ); 00390 00391 //! Union (ADD) a Polygon to the sub-region 00392 ERRVALUE Union ( 00393 const POLYLINE& PolyLine, 00394 MILIST<SUBREGION2D>& SubRegionList //!< Filled in if operation creates more than one sub-region 00395 ); 00396 00397 //! Union (ADD) a sub-region to the sub-region 00398 ERRVALUE Union ( 00399 const SUBREGION2D& SubRegion, 00400 MILIST<SUBREGION2D>& SubRegionList, //!< Filled in if operation creates more than one sub-region 00401 POLYLINE::COMBINERESULT& CombineResult 00402 ); 00403 00404 //! Union (ADD) a polygon to the sub-region 00405 ERRVALUE UnionValidated ( 00406 const POLYLINE& PolyLine, 00407 MILIST<SUBREGION2D>& SubRegionList, //!< Filled in if operation creates more than one sub-region 00408 POLYLINE::COMBINERESULT& CombineResult 00409 ); 00410 00411 private: 00412 #ifndef GENERATING_DOXYGEN_OUTPUT 00413 00414 MILIST<POLYLINE> m_ItemList; 00415 DRECT3D m_Extents; 00416 00417 ERRVALUE UpdateFromShells (MILIST<POLYLINE>& PolyLineList, MILIST<SUBREGION2D>& SubRegionList); 00418 00419 friend class RVC::VECTOR; //!< For RVC::VECTOR::ReadSubRegion() and RVC::VECTOR::ReadRegion() 00420 friend class RVC::REGION; //!< For RVC::REGION::GetRegion() and RVC::REGION::SetRegion() 00421 friend class REGION2D; //!< For RVC::REGION::Assign() 00422 #endif // GENERATING_DOXYGEN_OUTPUT 00423 }; 00424 00425 00426 //! REGION2D class - Definitions and methods to support a generic 2D region object in memory. 00427 //! The region can be represented by either a single rectangle or as a list of sub-regions. 00428 00429 class REGION2D { 00430 public: 00431 00432 typedef MILIST<SUBREGION2D>::CONST_ITERATOR CONST_ITERATOR; 00433 00434 //! Default constructor, initializes to an invalid region 00435 REGION2D ( 00436 ); 00437 00438 //! Copy constructor 00439 REGION2D ( 00440 const REGION2D& rhs 00441 ); 00442 00443 //! Constructor from DRECT2D 00444 REGION2D ( 00445 const DRECT2D& rhs 00446 ); 00447 00448 //! Constructor from a list of polylines 00449 REGION2D ( 00450 const MILIST<POLYLINE>& 00451 ); 00452 00453 //! Destructor 00454 ~REGION2D ( 00455 ); 00456 00457 //! Assignment 00458 REGION2D& operator= ( 00459 const REGION2D& rhs 00460 ); 00461 00462 //! Assignment 00463 REGION2D& operator= ( 00464 const DRECT2D& rhs 00465 ); 00466 00467 //! Assign a legacy region to REGION2D. Will only assign the Source region part, not the destination 00468 ERRVALUE Assign ( 00469 const DREGION& region, 00470 bool UseDest = false 00471 ); 00472 00473 //! Assign from a POLYLINE and an index array defining how the polyline is formatted 00474 ERRVALUE Assign ( 00475 const POLYLINE& PolyLine, 00476 const SIMPLE_ARRAY<INT32>& Index //!< Each entry is the number of points >0 is shell <0 is island 00477 ); 00478 00479 //! Get the beginning of the list of SUBREGION's. 00480 //! If the region is a rectangle, the list will be empty 00481 //! @return Iterator to the beginning of the subregion list 00482 CONST_ITERATOR Begin ( 00483 ) const { return (m_SubList.Begin()); } 00484 00485 //! Clear the region 00486 void Clear ( 00487 ); 00488 00489 //! Clip a polyline to a region, call the ClipTarget for each segment 00490 //! @return TRUE if part of the line is clipped, FALSE if not, < 0 error 00491 int ClipLine ( 00492 POLYLINE& PolyLine, 00493 POLYLINE::CLIP& ClipTarget, 00494 CLIPMODE ClipMode = CLIPMODE_Inside 00495 ) const; 00496 00497 //! Compute the region area in region units 00498 double ComputeArea ( 00499 ) const; 00500 00501 //! Compute the region area in region units but do not exclude islands in the calculation 00502 double ComputeAreaNoIslands ( 00503 ) const; 00504 00505 //! Compute the region perimeter in region units 00506 double ComputePerimeter ( 00507 ) const; 00508 00509 //! Compute the region perimeter in region units but do not include sub-region islands in the calculation 00510 double ComputePerimeterNoIslands ( 00511 ) const; 00512 00513 //! Translate the region using an affine transformation 00514 void ConvertForward ( 00515 const TRANS2D_AFFINE& taf 00516 ); 00517 00518 //! Translate the region using a mapgen transformation 00519 ERRVALUE ConvertForward ( 00520 const TRANS2D_MAPGEN& tmg 00521 ); 00522 00523 //! Translate the region using a mapgen transformation with densification 00524 //! If the region is the extents only, this will convert it to a proper sub-region 00525 //! before doing the transformation 00526 ERRVALUE ConvertForwardDense ( 00527 const TRANS2D_MAPGEN& tmg 00528 ); 00529 00530 //! Translate the region using an affine transformation 00531 void ConvertInverse ( 00532 const TRANS2D_AFFINE& taf 00533 ); 00534 00535 //! Translate the region using a mapgen transformation 00536 ERRVALUE ConvertInverse ( 00537 const TRANS2D_MAPGEN& tmg 00538 ); 00539 00540 //! Translate the region using a mapgen transformation with densification 00541 //! If the region is the extents only, this will convert it to a proper sub-region 00542 //! before doing the transformation 00543 ERRVALUE ConvertInverseDense ( 00544 const TRANS2D_MAPGEN& tmg 00545 ); 00546 00547 //! Get the end of the list of SUBREGION's 00548 //! @return End of SUBREGION list, see Begin() for details 00549 CONST_ITERATOR End ( 00550 ) const { return (m_SubList.End()); } 00551 00552 //! Exclusive Union (XOR) RegionB with 'this' 00553 ERRVALUE ExclusiveUnion ( 00554 const REGION2D& RegionB 00555 ); 00556 00557 //! Exclusive Union (XOR) RegionB with RegionA and place in 'this' 00558 ERRVALUE ExclusiveUnion ( 00559 const REGION2D& RegionA, 00560 const REGION2D& RegionB 00561 ); 00562 00563 //! Get region extents 00564 //! @return Extents of the entire region 00565 const DRECT3D& GetExtents ( 00566 ) const { return (m_Extents); } 00567 00568 //! Get region extents 00569 //! @return Extents of the entire region 00570 const DRECT2D& GetExtents2D ( 00571 ) const { return (m_Extents); } 00572 00573 //! Get number of sub-regions 00574 //! @return Number of sub-regions 00575 INT32 GetNumSubRegions ( 00576 ) const; 00577 00578 //! Intersect rectangle with 'this' 00579 ERRVALUE Intersect ( 00580 const DRECT2D& Rect 00581 ); 00582 00583 //! Intersect a polygon with 'this' 00584 ERRVALUE Intersect ( 00585 const POLYLINE& PolyLine 00586 ); 00587 00588 //! Intersect a sub-region with 'this' 00589 ERRVALUE Intersect ( 00590 const SUBREGION2D& SubRegion 00591 ); 00592 00593 //! Intersect RegionB with 'this' 00594 ERRVALUE Intersect ( 00595 const REGION2D& RegionB 00596 ); 00597 00598 //! Intersect RegionB with RegionA and place in 'this' 00599 ERRVALUE Intersect ( 00600 const REGION2D& RegionA, 00601 const REGION2D& RegionB 00602 ); 00603 00604 //! Intersect a validated polygon with 'this' 00605 ERRVALUE IntersectValidated ( 00606 const POLYLINE& PolyLine 00607 ); 00608 00609 //! Is the region an empty region 00610 bool IsEmpty ( 00611 ) const { return (!m_Extents.IsValid()); } 00612 00613 //! Determine if the two regions are equivalent 00614 //! This method uses "Fuzzy" vertex comparisons and the direction and order of the elements are not relevant 00615 //! Specify a different threshold to allow greater distances 00616 //! @return 'True' if they are, 'False' if not 00617 bool IsEquivalentTo ( 00618 const REGION2D& rhs, 00619 double threshold = 0.0 //!< Default threshold is max absolute value of rectangle coordinate * 1.0E-13 00620 ) const; 00621 00622 //! Determine if the point falls inside the region 00623 //! @return 'True' if point is inside region, 'false' if not 00624 bool IsPointInside ( 00625 const DPOINT2D& point 00626 ) const; 00627 00628 //! Is the region a simple rectangle region? 00629 bool IsRectangle ( 00630 ) const { return (m_SubList.GetNumItems() == 0); } 00631 00632 //! Subtract rectangle from 'this' 00633 ERRVALUE Subtract ( 00634 const DRECT2D& Rect 00635 ); 00636 00637 //! Subtract a polygon from 'this' 00638 ERRVALUE Subtract ( 00639 const POLYLINE& PolyLine 00640 ); 00641 00642 //! Subtract a sub-region from 'this' 00643 ERRVALUE Subtract ( 00644 const SUBREGION2D& SubRegion 00645 ); 00646 00647 //! Subtract RegionB from 'this' 00648 ERRVALUE Subtract ( 00649 const REGION2D& RegionB 00650 ); 00651 00652 //! Subtract RegionB from RegionA and place in 'this' 00653 ERRVALUE Subtract ( 00654 const REGION2D& RegionA, 00655 const REGION2D& RegionB 00656 ); 00657 00658 //! Subtract a validated polygon from 'this' 00659 ERRVALUE SubtractValidated ( 00660 const POLYLINE& PolyLine 00661 ); 00662 00663 //! Test the line given the test criteria against the region 00664 //! @return "True" if the line meets the criteria, "false" if not 00665 bool TestLine ( 00666 const POLYLINE& PolyLine, 00667 TESTCRITERIA TestCriteria 00668 ) const; 00669 00670 //! Test the point given the test criteria against the sub-region 00671 //! @return "True" if the point meets the criteria, "false" if not 00672 bool TestPoint ( 00673 const DPOINT2D& Point, 00674 TESTCRITERIA TestCriteria 00675 ) const; 00676 00677 //! Test the polygon given the test criteria against the region 00678 //! @return "True" if the polygon meets the criteria, "false" if not 00679 bool TestPolygon ( 00680 const POLYLINE& PolyLine, 00681 TESTCRITERIA TestCriteria 00682 ) const; 00683 00684 //! Test the sub-region given the test criteria against the region 00685 //! @return "True" if the sub-region meets the criteria, "false" if not 00686 bool TestSubRegion ( 00687 const SUBREGION2D& SubRegion, 00688 TESTCRITERIA TestCriteria 00689 ) const; 00690 00691 //! Union (ADD) rectangle to 'this' 00692 ERRVALUE Union ( 00693 const DRECT2D& Rect 00694 ); 00695 00696 //! Union (ADD) a polygon to 'this' 00697 ERRVALUE Union ( 00698 const POLYLINE& PolyLine 00699 ); 00700 00701 //! Union (ADD) a sub-region to the region 00702 ERRVALUE Union ( 00703 const SUBREGION2D& SubRegion 00704 ); 00705 00706 //! Union (ADD) RegionB to RegionA and place in 'this' 00707 ERRVALUE Union ( 00708 const REGION2D& RegionA, 00709 const REGION2D& RegionB 00710 ); 00711 00712 //! Union (ADD) RegionB to 'this' 00713 ERRVALUE Union ( 00714 const REGION2D& RegionB 00715 ); 00716 00717 //! Union (ADD) a validated polygon to 'this' 00718 ERRVALUE UnionValidated ( 00719 const POLYLINE& PolyLine 00720 ); 00721 00722 private: 00723 #ifndef GENERATING_DOXYGEN_OUTPUT 00724 00725 MILIST<SUBREGION2D> m_SubList; 00726 DRECT3D m_Extents; 00727 00728 void AppendDisjointRegion (const REGION2D& rhs); 00729 void AppendDisjointSubRegion (const SUBREGION2D& rhs); 00730 00731 class INTERSECTREGION; 00732 friend class INTERSECTREGION; 00733 friend class RVC::VECTOR; //!< For RVC::VECTOR::ReadRegion() 00734 friend class RVC::REGION; //!< For RVC::REGION::GetRegion() and RVC::REGION::SetRegion() 00735 #endif // GENERATING_DOXYGEN_OUTPUT 00736 }; 00737 00738 #endif //!< INC_MI32_REGION2D_H
1.3.4-20031026