rvc/geometrc.h

Go to the documentation of this file.
00001 /**
00002  * \file rvc/geometrc.h 
00003  * \brief interface for the RVC::GEOMETRIC class.
00004  *
00005  * \if NODOC
00006  * $Id: geometrc.h_v 1.57 2003/11/21 22:17:04 scowan Exp $
00007  *
00008  * $Log: geometrc.h_v $
00009  * Revision 1.57  2003/11/21 22:17:04  scowan
00010  * Support new Capabilities system.
00011  *
00012  * Revision 1.56  2003/10/22 16:31:07  mju
00013  * Add GETOBJFILTER_HASNOIMPLIEDGEOREF.
00014  *
00015  * Revision 1.55  2003/10/22 16:17:20  scowan
00016  * Added get objtype set static method.
00017  *
00018  * Revision 1.54  2003/09/30 16:52:06  dwilliss
00019  * Doxygen
00020  *
00021  * Revision 1.53  2003/09/25 21:56:37  dwilliss
00022  * doxygen
00023  *
00024  * Revision 1.52  2003/09/15 13:49:45  fileserver!dwilliss
00025  * Doxygen
00026  *
00027  * Revision 1.51  2003/09/11 20:09:31  scowan
00028  * Added is geometric function.
00029  *
00030  * Revision 1.50  2003/06/25 14:49:56  scowan
00031  * Added set array.
00032  *
00033  * Revision 1.49  2003/06/24 21:03:48  scowan
00034  * Added more capability flags.
00035  *
00036  * Revision 1.48  2003/06/19 17:45:27  scowan
00037  * Added virtual method and enum.
00038  *
00039  * Revision 1.47  2003/06/04 23:34:55  scowan
00040  * Added find element draw set.
00041  *
00042  * Revision 1.46  2003/05/30 21:33:19  scowan
00043  * Added is selectable filter.
00044  *
00045  * Revision 1.45  2003/05/27 16:36:30  scowan
00046  * Added new filters and un-inlined a method.
00047  *
00048  * Revision 1.44  2003/05/12 23:32:59  scowan
00049  * Changes to virtual methods.
00050  *
00051  * Revision 1.43  2003/03/07 18:44:07  scowan
00052  * Added on poin type change callback.
00053  *
00054  * Revision 1.42  2003/02/19 20:13:49  scowan
00055  * Added extract flag.
00056  *
00057  * Revision 1.41  2003/02/06 21:26:40  scowan
00058  * *** empty log message ***
00059  *
00060  * Revision 1.40  2003/02/06 21:25:06  scowan
00061  * Added another combine styles.
00062  *
00063  * Revision 1.39  2003/02/06 16:03:31  scowan
00064  * Added new standard empty object filter class.
00065  *
00066  * Revision 1.38  2002/12/06 16:49:03  scowan
00067  * More const.
00068  *
00069  * Revision 1.37  2002/11/06 20:52:26  scowan
00070  * More const.
00071  *
00072  * Revision 1.36  2002/10/23 21:06:55  scowan
00073  * Added another get element set.
00074  *
00075  * Revision 1.35  2002/09/30 23:21:31  scowan
00076  * Made element search code const.
00077  *
00078  * Revision 1.34  2002/09/26 15:02:03  mju
00079  * Fix SEARCHRESULT iterator initialization/increment for ranges case.
00080  *
00081  * Revision 1.33  2002/09/17 22:48:56  scowan
00082  * More virtual method adjustment.
00083  *
00084  * Revision 1.32  2002/09/12 22:10:07  mju
00085  * Add addl ctor for searchfilter_bitset.
00086  *
00087  * Revision 1.31  2002/09/12 21:28:11  mju
00088  * Add SEARCHFILTER_BITSET.
00089  *
00090  * Revision 1.30  2002/09/03 22:17:59  scowan
00091  * More virtual method moves.
00092  *
00093  * Revision 1.29  2002/08/29 22:12:50  scowan
00094  * Virtual method adjustment.
00095  *
00096  * Revision 1.28  2002/08/19 15:05:05  scowan
00097  * Fixed g++3.1 warnings.
00098  *
00099  * Revision 1.27  2002/06/19 22:23:59  scowan
00100  * More methods changes.
00101  *
00102  * Revision 1.26  2002/06/18 22:15:09  scowan
00103  * Added extract interface.
00104  *
00105  * Revision 1.25  2002/05/01 17:42:40  scowan
00106  * Method change.
00107  *
00108  * Revision 1.24  2002/04/30 17:33:43  scowan
00109  * Changed makr parm class name.
00110  *
00111  * Revision 1.23  2002/04/26 22:44:20  scowan
00112  * Added more virtual methods.
00113  *
00114  * Revision 1.22  2002/03/01 16:19:05  scowan
00115  * Added virtual methods.
00116  *
00117  * Revision 1.21  2002/02/28 18:56:23  scowan
00118  * Added sort search restul.
00119  *
00120  * Revision 1.20  2002/02/27 23:24:07  scowan
00121  * Added get geometric and get element extents methods.
00122  *
00123  * Revision 1.19  2002/01/30 15:56:41  scowan
00124  * Added sml context creation method.
00125  *
00126  * Revision 1.18  2002/01/29 17:26:47  scowan
00127  * Added inline method to get the object dimension.
00128  *
00129  * Revision 1.17  2002/01/07 20:24:46  scowan
00130  * Fixed access to observer class.
00131  * Arranged classes for genator docs.
00132  *
00133  * Revision 1.16  2002/01/03 22:56:56  scowan
00134  * Added extents management methods and an exttents changed callback.
00135  *
00136  * Revision 1.15  2001/10/08 20:49:39  scowan
00137  * Added element region method.
00138  *
00139  * Revision 1.14  2001/09/28 15:32:54  scowan
00140  * Add observer class.
00141  *
00142  * Revision 1.13  2001/07/31 16:40:23  scowan
00143  * Added new interface methods.
00144  *
00145  * Revision 1.12  2001/06/13 21:51:33  scowan
00146  * Added to RVC namespace.
00147  *
00148  * Revision 1.10  2001/05/24 17:37:14  scowan
00149  * Added vurtual methods for finding elements.
00150  *
00151  * Revision 1.9  2001/04/23 22:52:04  scowan
00152  * Added find closest methods.
00153  *
00154  * Revision 1.8  2001/04/23 17:40:48  scowan
00155  * Fixed const stuff.
00156  *
00157  * Revision 1.7  2001/04/23 17:38:33  scowan
00158  * Added update extents method.
00159  *
00160  * Revision 1.6  2001/01/18 23:17:57  scowan
00161  * Removed inline constructor / destructor calls.
00162  *
00163  * Revision 1.5  2001/01/16 16:51:52  scowan
00164  * Must have virtual destructor body.
00165  *
00166  * Revision 1.4  2000/12/01 15:57:30  scowan
00167  * Fixed MAC errors.
00168  *
00169  * Revision 1.3  2000/11/24 22:53:23  scowan
00170  * Added set extents pure virtual method.
00171  *
00172  * Revision 1.2  2000/10/19 17:55:45  scowan
00173  * Checked in for vacation.
00174  *
00175  * Revision 1.1  2000/10/02 17:39:43  scowan
00176  * Initial revision
00177  *
00178  * \endif
00179 **/
00180 
00181 //!   \class RVC::GEOMETRIC rvc/geometrc.h
00182 //!   \brief Interface for RVC objects that support line work paradigm.
00183 //!
00184 //!   RVC Object Types that this class supports: Derived class
00185 //!
00186 //!   Default RVC Object Type for this class: Derived class
00187 //!
00188 //!   Valid parents for this class: Derived class
00189 
00190 #ifndef INC_RVC_GEOMETRC_H
00191 #define INC_RVC_GEOMETRC_H
00192 
00193 #ifndef INC_RVC_GEOSPATL_H
00194    #include <rvc/geospatl.h>
00195 #endif
00196 
00197 #ifndef INC_RVC_STYLE_H
00198    #include <rvc/style.h>
00199 #endif
00200 
00201 #ifndef INC_MI32_ELEMTYPE_H
00202    #include <mi32/elemtype.h>
00203 #endif
00204 
00205 #ifndef INC_MI32_SIMPLEAR_H
00206    #include <mi32/simplear.h>
00207 #endif
00208 
00209 #ifndef INC_MI32_RANGE_H
00210    #include <mi32/range.h>
00211 #endif
00212 
00213 #ifndef INC_RVC_GETOBJF_H
00214    #include <rvc/getobjf.h>
00215 #endif
00216 
00217 #ifndef INC_MI32_REGION_H
00218    #include <mi32/region.h>
00219 #endif
00220 
00221 #ifndef INC_MI32_REGION2D_H
00222    #include <mi32/region2d.h>
00223 #endif
00224 
00225 #ifndef INC_MI32_BITSET_H
00226    #include <mi32/bitset.h>
00227 #endif
00228 
00229 #ifndef GENERATING_DOXYGEN_OUTPUT
00230 struct SMLCONTEXT;      //!< Forward Declarations
00231 class TRANS2D_MAPGEN;
00232 #endif // GENERATING_DOXYGEN_OUTPUT
00233 
00234 namespace RVC {
00235 
00236 #ifndef GENERATING_DOXYGEN_OUTPUT
00237 class ELEMENT;          //!< Forward Declarations
00238 class QSEARCHTREE;
00239 class SPATIALTREE;
00240 #endif // GENERATING_DOXYGEN_OUTPUT
00241 
00242 class GEOMETRIC : public GEOSPATIAL {
00243    public:
00244 
00245       //Ignore
00246       class ELEMSELECTFILTER;
00247       class ELEMSELECTPARMS;
00248       class ELEMTRANSLIST;
00249       class GETOBJFILTER_HASNOIMPLIEDGEOREF;
00250       class GETOBJFILTER_ISDISPLAYABLE;
00251       class GETOBJFILTER_ISNOTEMPTY;
00252       class GETOBJFILTER_ISSELECTABLE;
00253       class MAKEPARMSBASE;
00254       class OBSERVER;
00255       class SEARCHFILTER;
00256       class SEARCHFILTER_BITSET;
00257       class SEARCHRESULT;
00258       //End Ignore
00259       
00260       enum CAPABILITY {
00261          CAPABILITY_None =             0,
00262          CAPABILITY_OwnSearchMethods = 512,  //!< Object has its own search methods (Oracle, MySQL, ...)
00263          CAPABILITY_CanAddToEnd,             //!< Object can be modified by adding elements to the end of the object
00264          CAPABILITY_CanChangeElements,       //!< Existing object elements can be modified 
00265          CAPABILITY_HasStyleByElement,       //!< Each element can have its own style settings
00266          CAPABILITY_ElementHasExtents,       //!< Each element has extents stored with it, except labels
00267          CAPABILITY_HasLabels,               //!< Object has labels
00268          CAPABILITY_LabelHasExtents          //!< Each label has extents stored with it
00269          };
00270 
00271       enum EXTRACTFLAGS {
00272          EXTRACTFLAG_None =                  0,
00273          EXTRACTFLAG_RegionMethod =          0x00000001,    //!< SelectMethod is a DREGION
00274          EXTRACTFLAG_RemExRecords =          0x00000002,    //!< Remove Excess (Unattached) database records
00275          EXTRACTFLAG_RemStdAttTables =       0x00000004,    //!< Remove Standard Attribute database tables
00276          EXTRACTFLAG_IgnoreMissingLines =    0x00000008,    //!< Ignore missing lines from extraction operation, polygon and node line lists
00277          EXTRACTFLAG_TableJoinNameStruct =   0x00000010,    //!< Join tables in Append functions if names alike and compatable structures
00278          EXTRACTFLAG_TableJoinStruct =       0x00000020,    //!< Join tables in Append functions if compatable structures
00279          EXTRACTFLAG_TableRemoveDupRec =     0x00000040,    //!< Do not copy over records if exists in dest table
00280          EXTRACTFLAG_IgnorePolygonTables =   0x00000080,    //!< Do not copy over polygon databases
00281          EXTRACTFLAG_RemoveTables =          0x00000100,    //!< Remove destination tables
00282          EXTRACTFLAG_CopyHyperIndexSub =     0x00000200     //!< Copy Hyper index subobjects
00283          };
00284 
00285       enum POINTTYPE {
00286          POINTTYPE_2DXY = 1,           //!< 2-D coordinates, X and Y given (default)
00287          POINTTYPE_3DXY = 4,           //!< 3-D coordinates, X, Y given, Z constant
00288          POINTTYPE_3DXYZ = 7           //!< 3-D coordinates, X, Y and Z given
00289          };
00290 
00291       //! Default constructor
00292       GEOMETRIC (
00293          );
00294 
00295       //! Copy constructor
00296       GEOMETRIC (
00297          const RVC::GEOMETRIC& rhs
00298          );
00299       
00300       //! Destructor
00301       virtual ~GEOMETRIC (
00302          ) = 0;
00303 
00304       //! Assignment
00305       RVC::GEOMETRIC& operator= (
00306          const RVC::GEOMETRIC& rhs
00307          );
00308 
00309       //! Add an element to the search tree
00310       ERRVALUE AddSearchTreeElement (
00311          INT32 elemnum,
00312          ELEMTYPE ElemType,
00313          const DRECT2D& Extents
00314          ) { return (v_AddSearchTreeElement(elemnum, ElemType, Extents)); }
00315 
00316       //! Populate a search tree given existing elements
00317       ERRVALUE BuildSearchTree (
00318          INT32 InitialNumElements,
00319          ELEMTYPE ElemType,
00320          const DRECT2D& Extents
00321          ) { return (v_BuildSearchTree(InitialNumElements, ElemType, Extents)); }
00322          
00323       //! Re-Initialize search tree to a state with no elements
00324       ERRVALUE ClearSearchTree (
00325          INT32 InitialNumElements,
00326          ELEMTYPE ElemType,
00327          const DRECT2D& Extents
00328          ) { return (v_ClearSearchTree(InitialNumElements, ElemType, Extents)); }
00329 
00330       //! Combine styles from source object 'this' to the destination object 'DestObj'.
00331       //! this method deals with style links from source tables
00332       ERRVALUE CombineStylesTo (
00333          RVC::GEOMETRIC& DestObj
00334          ) const;
00335 
00336       //! Combine styles from source object 'this' to the destination object 'DestObj'.
00337       //! this method deals with style links from source tables
00338       //! Used for objects with direct style attachments (a.k.a CAD)
00339       ERRVALUE CombineStylesTo (
00340          RVC::GEOMETRIC& DestObj,
00341          SIMPLE_ARRAY<INT32>& FontTrans,
00342          SIMPLE_ARRAY<INT32> PattTrans[STYLE::PATTERN_NumTypes]
00343          ) const;
00344 
00345       //! Copy an element from one part of the search tree to another (atomic method)
00346       ERRVALUE CopySearchTreeElement (
00347          INT32 SourceElement,
00348          INT32 DestElement,
00349          ELEMTYPE ElemType,
00350          const DRECT2D& Extents
00351          ) { return (v_CopySearchTreeElement(SourceElement, DestElement, ElemType, Extents)); }
00352          
00353       //! Create an SML context for the given derived class instance
00354       ERRVALUE CreateSMLContext (
00355          SMLCONTEXT **pcontext               //!< SML context allocated and RETURNED
00356          ) const;
00357 
00358       //! Delete an element from the search tree
00359       ERRVALUE DeleteSearchTreeElement (
00360          INT32 elemnum,
00361          ELEMTYPE ElemType
00362          ) { return (v_DeleteSearchTreeElement(elemnum, ElemType)); }
00363 
00364       //! Extract elements from source 'this' object to existing destination object
00365       //! Deals with database attachments and element transfers
00366       //! Not implemented for CAD or TIN yet
00367       ERRVALUE ExtractTo (
00368          RVC::GEOMETRIC& DestObj,
00369          RVC::GEOMETRIC::ELEMTRANSLIST& TransList,
00370          const TRANS2D_MAPGEN& tmg,
00371          RVC::GEOMETRIC::EXTRACTFLAGS ExtractFlags = EXTRACTFLAG_None
00372          ) const { return (v_ExtractTo(DestObj, TransList, tmg, ExtractFlags)); }
00373          
00374       //! Determine closest element based on point and search distance
00375       //! @return Element found, -1 if no elements are close enough, < -1 if error
00376       INT32 FindClosestElement (
00377          ELEMTYPE ElemType,
00378          const DPOINT2D& SearchPt,
00379          double SearchDist,
00380          double* DistFromElem
00381          ) const { return (v_FindClosestElementLow(ElemType, SearchPt, 0, SearchDist, DistFromElem)); }
00382       
00383       //! Determine closest element based on point and search distance with filter
00384       //! @return Element found, -1 if no elements are close enough, < -1 if error
00385       INT32 FindClosestElement (
00386          ELEMTYPE ElemType,
00387          const DPOINT2D& SearchPt,
00388          SEARCHFILTER& SearchFilter,
00389          double SearchDist,
00390          double* DistFromElem
00391          ) const { return (v_FindClosestElementLow(ElemType, SearchPt, &SearchFilter, SearchDist, DistFromElem)); }
00392       
00393       //! Obtain set of elements that fall within the rectangle, return list in 'SearchResult'
00394       //! This method will NOT build search trees to determine the elements that fall within the rectangle.
00395       //! If a search or spatial tree is not available to limit the search, all elements will be returned
00396       ERRVALUE FindElementDrawSet (
00397          ELEMTYPE ElemType,
00398          const DRECT2D& SearchExtents,
00399          SEARCHRESULT& SearchResult
00400          ) const;
00401          
00402       //! Obtain set of elements that fall within the rectangle, return list in 'SearchResult'
00403       //! This method will build search trees, if needed, to determine the elements that fall within the rectangle.
00404       ERRVALUE FindElementSearchSet (
00405          ELEMTYPE ElemType,
00406          const DRECT2D& SearchExtents,
00407          SEARCHRESULT& SearchResult
00408          ) const;
00409 
00410       //! Obtain DIMENSION type
00411       //! @return DIMENSION type
00412       DIMENSION GetDimension (
00413          ) const { return ((GetPointType() == POINTTYPE_3DXYZ) ? DIMENSION_3D : DIMENSION_2D); }
00414          
00415       //! Obtain element extents using element type and element number
00416       ERRVALUE GetElementExtents (
00417          ELEMTYPE ElemType,
00418          INT32 ElemNum,
00419          DRECT3D& Extents              //!< Element extents RETURNED, set to invalid if error or element is deleted
00420          ) const { return (v_GetElementExtents(ElemType, ElemNum, Extents)); }
00421 
00422       //! Get geometric object referred to by 'object'
00423       //! @return Allocated instance of RVC::GEOMETRIC object (must be 'delete'd) or 0 if error
00424       static RVC::GEOMETRIC* GetGeometric (
00425          const RVC::OBJECT& object
00426          );
00427          
00428       //! Get geometric object referred to by 'ObjItem'
00429       //! @return Allocated instance of RVC::GEOMETRIC object (must be 'delete'd) or 0 if error
00430       static RVC::GEOMETRIC* GetGeometric (
00431          const RVC::OBJITEM& ObjItem
00432          );
00433          
00434       //! Obtain next element ID depending on element type
00435       //! @return Element ID to be used for the next element
00436       INT32 GetNextElementID (
00437          ELEMTYPE ElemType
00438          ) const { return (v_GetNextElementID(ElemType)); }
00439 
00440       //! Obtain number of elements based on element type
00441       //! Specifying ELEMTYPE_All will return the total combination of elements in the object
00442       //! @return Number of elements if valid ELEMTYPE for object, -1 if not
00443       INT32 GetNumElements (
00444          ELEMTYPE ElemType
00445          ) const { return (v_GetNumElements(ElemType)); }
00446       
00447       //! Get correct OBJTYPESET for all geometric OBJTYPE's
00448       //! @return OBJTYPESET for all geometric OBJTYPE's
00449       static RVC::OBJTYPESET GetObjTypeSet (
00450          );
00451          
00452       //! Obtain number of point coordinate dimensions
00453       //! @return Number of dimensions
00454       INT32 GetPointDimension (
00455          ) const { return (GetPointSize() / sizeof(double)); }
00456          
00457       //! Obtain point coordinate type
00458       //! @return POINTTYPE coordinate type
00459       POINTTYPE GetPointType (
00460          ) const { return (v_GetPointType()); }
00461 
00462       //! Obtain size of point coordinate
00463       //! @return Size of point in bytes
00464       INT32 GetPointSize (
00465          ) const { return (v_GetPointSize()); }
00466          
00467       //! Determine if the element in this object is deleted.
00468       //! @return 'true' if the element is deleted, 'false' if not.
00469       bool IsElementDeleted (
00470          const RVC::ELEMENT& Element
00471          ) const { return (v_IsElementDeleted(Element)); }
00472 
00473       //! Determine if the object has any elements.
00474       //! @return 'true' if the object is empty, 'false' if not.
00475       bool IsEmpty (
00476          ) const { return (v_IsEmpty()); }
00477 
00478       //! Determine if the object type is a geometric object
00479       static bool IsGeometric (
00480          RVC::OBJTYPE ObjType
00481          );
00482 
00483       //! Save search tree objects
00484       ERRVALUE SaveSearchTrees (
00485          ) { return (v_SaveSearchTrees()); }
00486          
00487       //! Set the extents of an object
00488       //! Only use if you have a write lock on the entire object
00489       ERRVALUE SetExtents (
00490          const DRECT3D &extents
00491          ) { return (v_SetExtents(extents)); }
00492          
00493       //! Set next element ID depending on element type
00494       ERRVALUE SetNextElementID (
00495          ELEMTYPE ElemType,
00496          INT32 NextElementID
00497          ) { return (v_SetNextElementID(ElemType, NextElementID)); }
00498 
00499       //! Set search tree handle for all open instances of this object
00500       bool SetSearchTree (
00501          ELEMTYPE ElemType,
00502          RVC::QSEARCHTREE* SearchTree,
00503          bool ReplaceExisting = false
00504          ) { return (v_SetSearchTree(ElemType, SearchTree, ReplaceExisting)); }
00505          
00506       //! Generate element translation lists dependent on the selection parameters.
00507       //! @return > 0 if elements are found to meet the selection parameters, '0' if no elements found, < 0 error 
00508       int SetupElemTransList (
00509          const RVC::GEOMETRIC::ELEMSELECTPARMS& SelectParms,
00510          RVC::GEOMETRIC::ELEMTRANSLIST& TransList
00511          ) const { return (SetupElemTransList(SelectParms, TransList, 0)); }
00512          
00513       //! Generate element translation lists dependent on the selection parameters.
00514       //! @return > 0 if elements are found to meet the selection parameters, '0' if no elements found, < 0 error 
00515       int SetupElemTransList (
00516          const RVC::GEOMETRIC::ELEMSELECTPARMS& SelectParms,
00517          RVC::GEOMETRIC::ELEMTRANSLIST& TransList,
00518          RVC::GEOMETRIC::ELEMSELECTFILTER& SelectFilter
00519          ) const { return (SetupElemTransList(SelectParms, TransList, &SelectFilter)); }
00520          
00521       //! Test element against region
00522       //! @return True if test against region was sucessful
00523       bool TestElementAgainstRegion (
00524          const RVC::ELEMENT& Element, 
00525          const REGION2D& region,
00526          TESTCRITERIA TestMode
00527          ) const { return (v_TestElementAgainstRegion(Element, region, TestMode)); }
00528       
00529       //! Test element against region
00530       //! @return True if test against region was sucessful
00531       bool TestElementAgainstRegion (
00532          ELEMTYPE ElemType,
00533          INT32 ElemNum,
00534          const GEOREGION& region,
00535          GEOREGION::TESTMODE TestMode
00536          ) const { return (v_TestElementAgainstRegion(ElemType, ElemNum, region, TestMode)); }
00537       
00538       //! Update the extents of an object, this is a thread safe method
00539       ERRVALUE UpdateExtents (
00540          const DRECT3D &extents
00541          ) { return (v_UpdateExtents(extents)); }
00542          
00543    protected:
00544 
00545       #ifndef GENERATING_DOXYGEN_OUTPUT
00546       static void GeometricCallbackFunc (MfAnyCallbackStruct *cb, void *data);
00547       #endif // GENERATING_DOXYGEN_OUTPUT
00548 
00549    private:
00550       // Pure virtual methods
00551    
00552       virtual ERRVALUE v_AddSearchTreeElement (INT32 elemnum, ELEMTYPE ElemType, const DRECT2D& Extents) = 0;
00553       virtual ERRVALUE v_BuildSearchTree (INT32 InitialNumElements, ELEMTYPE ElemType, const DRECT2D& Extents) = 0;
00554       virtual ERRVALUE v_ClearSearchTree (INT32 InitialNumElements, ELEMTYPE ElemType, const DRECT2D& Extents) = 0;
00555       virtual ERRVALUE v_CopySearchTreeElement (INT32 SourceElement, INT32 DestElement, ELEMTYPE ElemType, const DRECT2D& Extents) = 0;
00556       virtual ERRVALUE v_DeleteSearchTreeElement (INT32 elemnum, ELEMTYPE ElemType) = 0;
00557       virtual ERRVALUE v_ExtractTo (RVC::GEOMETRIC& DestObj, RVC::GEOMETRIC::ELEMTRANSLIST& TransList, const TRANS2D_MAPGEN& tmg, RVC::GEOMETRIC::EXTRACTFLAGS ExtractFlags) const = 0;
00558       virtual INT32 v_FindClosestElementLow (ELEMTYPE ElemType, const DPOINT2D& SearchPt, SEARCHFILTER* SearchFilter, double SearchDist, double* DistFromElem) const = 0;
00559       virtual ERRVALUE v_FindElementDrawSet (ELEMTYPE ElemType, const DRECT2D& SearchExtents, SEARCHRESULT& SearchResult) const = 0;
00560       virtual ERRVALUE v_FindElementSearchSet (ELEMTYPE ElemType, const DRECT2D& SearchExtents, SEARCHRESULT& SearchResult) const = 0;
00561       virtual ERRVALUE v_GetElementExtents (ELEMTYPE ElemType, INT32 ElemNum, DRECT3D& Extents) const = 0;
00562       virtual INT32 v_GetNextElementID (ELEMTYPE ElemType) const = 0;
00563       virtual INT32 v_GetNumElements (ELEMTYPE ElemType) const = 0;
00564       virtual POINTTYPE v_GetPointType () const = 0;
00565       virtual INT32 v_GetPointSize () const = 0;
00566       virtual bool v_IsElementDeleted (const RVC::ELEMENT& Element) const = 0;
00567       virtual bool v_IsEmpty () const = 0;
00568       virtual ERRVALUE v_SaveSearchTrees () = 0;
00569       virtual ERRVALUE v_SetExtents (const DRECT3D &extents) = 0;
00570       virtual ERRVALUE v_SetNextElementID (ELEMTYPE ElemType, INT32 NextElementID) = 0;
00571       virtual bool v_SetSearchTree (ELEMTYPE ElemType, RVC::QSEARCHTREE* SearchTree, bool ReplaceExisting) = 0;
00572       virtual int v_SetupElemTransList (const RVC::GEOMETRIC::ELEMSELECTPARMS& SelectParms, RVC::GEOMETRIC::ELEMTRANSLIST& TransList, RVC::GEOMETRIC::ELEMSELECTFILTER* SelectFilter) const = 0;
00573       virtual bool v_TestElementAgainstRegion (const RVC::ELEMENT& Element, const REGION2D& region, TESTCRITERIA TestMode) const = 0;
00574       virtual bool v_TestElementAgainstRegion (ELEMTYPE ElemType, INT32 ElemNum, const GEOREGION& region, GEOREGION::TESTMODE TestMode) const = 0;
00575       virtual ERRVALUE v_UpdateExtents (const DRECT3D &extents) = 0;
00576 
00577       #ifndef GENERATING_DOXYGEN_OUTPUT
00578       int SetupElemTransList (const RVC::GEOMETRIC::ELEMSELECTPARMS& SelectParms, RVC::GEOMETRIC::ELEMTRANSLIST& TransList, RVC::GEOMETRIC::ELEMSELECTFILTER* SelectFilter) const;
00579       #endif // GENERATING_DOXYGEN_OUTPUT
00580    };
00581 
00582 DEFINE_ENUM_OP_BITWISE(GEOMETRIC::EXTRACTFLAGS);
00583 
00584 
00585 class GEOMETRIC::ELEMSELECTFILTER {
00586    public:
00587       ELEMSELECTFILTER () {}
00588 
00589       //! Filter elements based on some external criteria
00590       //! @return '1' for element acceptance, '0' to reject element, < 0 for an error     
00591       int FilterElement (
00592          RVC::ELEMENT& Element
00593          ) { return (v_FilterElement(Element)); }
00594          
00595    private:
00596       // Pure virtual
00597       virtual int v_FilterElement (RVC::ELEMENT& element) = 0;
00598    };
00599 
00600 
00601 class GEOMETRIC::ELEMSELECTPARMS {
00602    public:
00603    
00604       enum EXTRACT {
00605          EXTRACT_All,
00606          EXTRACT_PartInside,
00607          EXTRACT_FullInside,
00608          EXTRACT_ClipInside,
00609          EXTRACT_PartOutside,
00610          EXTRACT_FullOutside,
00611          EXTRACT_ClipOutside
00612          };
00613    
00614       struct ITEM {
00615          enum SELECT {
00616             SELECT_None = 0,
00617             SELECT_All,
00618             SELECT_ByRecord,
00619             SELECT_ByScript,
00620             SELECT_ByElement,
00621             SELECT_Last
00622             };
00623             
00624          ITEM (
00625             );
00626       
00627          SELECT m_SelectType;
00628          MISTRING m_QueryStr;
00629          RVC::OBJECTNAME m_TableName;     //!< Table that 'RecordList' is selected from
00630          BITSET m_RecordList;             //!< List of records in 'TableNum' that the user has selected (bit array)
00631          BITSET m_ElemList;               //!< List of elements (bit array)
00632          };
00633    
00634       ELEMSELECTPARMS (
00635          );
00636       
00637       const GEOREGION& GetRegion (
00638          ) const { return (m_GeoRegion); }
00639       
00640       GEOREGION::TESTMODE GetRegionTestMode (
00641          ) const { return (m_TestMode); }
00642       
00643       const ITEM& GetSelectParmItem (
00644          ELEMTYPE ElemType
00645          ) const;    
00646    
00647       ITEM& GetSelectParmItem (
00648          ELEMTYPE ElemType
00649          );
00650          
00651       bool HasRegion (
00652          ) const { return (m_HasRegion); }
00653    
00654       void SetRegion (
00655          const GEOREGION& GeoRegion
00656          ) { m_GeoRegion = GeoRegion; m_HasRegion = true; }
00657       
00658       void SetRegionExtractMode (
00659          EXTRACT ExtractMode
00660          );
00661       
00662       void SetRegionTestMode (
00663          GEOREGION::TESTMODE TestMode
00664          ) { m_TestMode = TestMode; }
00665       
00666       void SetSelectParmItem (
00667          ELEMTYPE ElemType,
00668          const ITEM& item
00669          );    
00670    
00671    private:
00672       #ifndef GENERATING_DOXYGEN_OUTPUT
00673       ITEM m_SelectParm[6];
00674       GEOREGION m_GeoRegion;
00675       GEOREGION::TESTMODE m_TestMode;
00676       bool m_HasRegion;
00677       #endif // GENERATING_DOXYGEN_OUTPUT
00678    };
00679 
00680 
00681 //! Class to manage element translation lists from source to destination elements
00682 //! Eg: 'DestElemNum = TransList[SourceElemNum]' where 'TransList' is an array of INT32's
00683 //! The value '-1' states that the source element does not translate to a destination number.
00684 class GEOMETRIC::ELEMTRANSLIST {
00685    public:
00686 
00687       //! Constructor   
00688       ELEMTRANSLIST (
00689          ) {}
00690    
00691       //! Copy Constructor 
00692       ELEMTRANSLIST (
00693          const ELEMTRANSLIST& rhs
00694          );
00695    
00696       //! Destructor 
00697       ~ELEMTRANSLIST (
00698          ) {}
00699          
00700       //! Assignment Operator
00701       ELEMTRANSLIST& operator= (
00702          const ELEMTRANSLIST& rhs
00703          );
00704    
00705       //! Obtain the element translation array for a particular element type (ELEMTYPE)
00706       //! @return Element Translation List
00707       const SIMPLE_ARRAY<INT32>& GetElementTransList (
00708          ELEMTYPE ElemType
00709          ) const;
00710          
00711       //! Obtain the element translation array for a particular element type (ELEMTYPE)
00712       //! @return Element Translation List
00713       SIMPLE_ARRAY<INT32>& GetElementTransList (
00714          ELEMTYPE ElemType
00715          );
00716          
00717       ERRVALUE GetReverseTransList (
00718          ELEMTYPE ElemType,
00719          SIMPLE_ARRAY<INT32>& ReverseTrans,
00720          INT32 NumDestElems
00721          ) const;
00722          
00723       //! Set an element translation list entry to a pre-built list
00724       void SetElementTransList (
00725          const SIMPLE_ARRAY<INT32>& TransList,
00726          ELEMTYPE ElemType
00727          );
00728          
00729       //! Set an element translation list entry to a pre-built list
00730       ERRVALUE SetElementTransList (
00731          INT32* TransList,
00732          INT32 NumItems,
00733          ELEMTYPE ElemType
00734          );
00735 
00736       //! Set translation list to a one-to-one (Identity) mapping
00737       ERRVALUE SetIdentity (
00738          const RVC::GEOMETRIC& GeoObj
00739          );
00740    
00741       //! Set an element translation list entry to a one-to-one (Identity) mapping 
00742       ERRVALUE SetIdentity (
00743          const RVC::GEOMETRIC& GeoObj,
00744          ELEMTYPE ElemType
00745          );
00746    
00747    private:
00748       #ifndef GENERATING_DOXYGEN_OUTPUT
00749       SIMPLE_ARRAY<INT32> m_TransList[6];
00750       #endif // GENERATING_DOXYGEN_OUTPUT
00751    };
00752 
00753 
00754 //! Geometric object selection filter to disallow selection of geometric objects already having implied georeference.
00755 class GEOMETRIC::GETOBJFILTER_HASNOIMPLIEDGEOREF : public GETOBJFILTER {
00756    public:
00757       GETOBJFILTER_HASNOIMPLIEDGEOREF () {}
00758    private:
00759       #ifndef GENERATING_DOXYGEN_OUTPUT
00760       virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position);
00761       #endif // GENERATING_DOXYGEN_OUTPUT
00762    };
00763    
00764 //! Geometric object selection filter to disallow selection of empty and invalid extent geometric objects
00765 class GEOMETRIC::GETOBJFILTER_ISDISPLAYABLE : public GETOBJFILTER {
00766    public:
00767       GETOBJFILTER_ISDISPLAYABLE () {}
00768    private:
00769       #ifndef GENERATING_DOXYGEN_OUTPUT
00770       virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position);
00771       #endif // GENERATING_DOXYGEN_OUTPUT
00772    };
00773    
00774 //! Geometric object selection filter to disallow selection of empty geometric objects
00775 class GEOMETRIC::GETOBJFILTER_ISNOTEMPTY : public GETOBJFILTER {
00776    public:
00777       GETOBJFILTER_ISNOTEMPTY () {}
00778    private:
00779       #ifndef GENERATING_DOXYGEN_OUTPUT
00780       virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position);
00781       #endif // GENERATING_DOXYGEN_OUTPUT
00782    };
00783    
00784 //! Geometric object selection filter to disallow selection of non geometric objects
00785 class GEOMETRIC::GETOBJFILTER_ISSELECTABLE : public GETOBJFILTER {
00786    public:
00787       GETOBJFILTER_ISSELECTABLE () {}
00788    private:
00789       #ifndef GENERATING_DOXYGEN_OUTPUT
00790       virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position);
00791       #endif // GENERATING_DOXYGEN_OUTPUT
00792    };
00793    
00794       
00795 //! Make parameter base class for RVC::GEOMETRIC objects.
00796 class GEOMETRIC::MAKEPARMSBASE {
00797    public:
00798    
00799       //! Default constructor
00800       MAKEPARMSBASE (
00801          POINTTYPE PointType
00802          ) :
00803          m_PointType(PointType),
00804          m_XScale(1.0),
00805          m_YScale(1.0),
00806          m_ZScale(1.0)
00807          {}
00808          
00809       //! Get vector object extents
00810       //! @return Extents of the vector object
00811       const DRECT3D& GetExtents (
00812          ) const {return (m_Extents);}
00813    
00814       //! Obtain point coordinate type for vector creation
00815       //! @return RVCGEOMETRIC::POINTTYPE coordinate type
00816       POINTTYPE GetPointType (
00817          ) const {return (m_PointType);}
00818 
00819       //! Get vector x scale value
00820       //! @return Vector X scale value
00821       double GetXScale (
00822          ) const {return (m_XScale);}
00823          
00824       //! Get vector y scale value
00825       //! @return Vector Y scale value
00826       double GetYScale (
00827          ) const {return (m_YScale);}
00828          
00829       //! Get vector z scale value
00830       //! @return Vector Z scale value
00831       double GetZScale (
00832          ) const {return (m_ZScale);}
00833 
00834       //! Set vector object extents
00835       void SetExtents (
00836          const DRECT3D& rect
00837          ) {m_Extents = rect;}
00838       
00839       //! Set coordinate point type for vector creation
00840       void SetPointType (
00841          POINTTYPE PointType
00842          ) {m_PointType = PointType;}
00843 
00844       //! Set vector x scale value
00845       void SetXScale (
00846          double xscale
00847          ) {m_XScale = xscale;}
00848          
00849       //! Set vector y scale value
00850       void SetYScale (
00851          double xscale
00852          ) {m_XScale = xscale;}
00853          
00854       //! Set vector x scale value
00855       void SetZScale (
00856          double xscale
00857          ) {m_XScale = xscale;}
00858          
00859    protected:
00860    
00861       DRECT3D m_Extents;
00862       POINTTYPE m_PointType;
00863       double m_XScale;
00864       double m_YScale;
00865       double m_ZScale;
00866    };
00867 
00868 //! OBSERVER class for RVC::GEOMETRIC objects.
00869 class GEOMETRIC::OBSERVER : public RVC::OBJECTOBSERVER {
00870    public:  
00871       enum TYPE {
00872          TYPE_ExtentsChange = 0x00000108,
00873          TYPE_PointTypeChange = 0x00000110
00874 //!         TYPE_AddElement = 0x00000201
00875          };
00876 
00877       explicit OBSERVER (
00878          RVC::GEOMETRIC& object
00879          ) : OBJECTOBSERVER(object) {}
00880          
00881       virtual ~OBSERVER (
00882          ) {}
00883          
00884 //!      virtual void OnAddElement (
00885 //!         ELEMTYPE ElemType,
00886 //!         INT32 ElemNum
00887 //!         ) { return; }
00888       
00889       //! Called when the geoemtric object extents has changed
00890       virtual void OnExtentsChanged (
00891          const DRECT3D& NewExtents
00892          ) { return; }
00893 
00894       //! Called when the geoemtric object extents has changed
00895       virtual void OnPointTypeChanged (
00896          GEOMETRIC::POINTTYPE NewPointType
00897          ) { return; }
00898 
00899    private:
00900       #ifndef GENERATING_DOXYGEN_OUTPUT
00901       virtual void OnNotifyRaw (UINT32 reason, void *data);
00902       #endif // GENERATING_DOXYGEN_OUTPUT
00903    };
00904 
00905 
00906 //! Filter search class for FindClosestElement() method
00907 class GEOMETRIC::SEARCHFILTER {
00908    public:
00909       //! Element filter for locating correct elements.
00910       //! @return True to use element in search, False to not use element in search
00911       virtual bool Filter (
00912          const RVC::GEOMETRIC& object,
00913          ELEMTYPE ElemType,
00914          INT32 ElemNum
00915          ) = 0;
00916          
00917    protected:
00918       //! Destructor 
00919       virtual ~SEARCHFILTER () {}
00920    };
00921    
00922 
00923 //! Filter search class for FindClosestElement() method supporting bit-set.
00924 class GEOMETRIC::SEARCHFILTER_BITSET : public GEOMETRIC::SEARCHFILTER {
00925    public:
00926 
00927       //! Construct from BITSET_UNOWNED.
00928       SEARCHFILTER_BITSET (
00929          const BITSET_UNOWNED& bitset
00930          ) : m_bitset(bitset) { }
00931 
00932       //! Construct from bit array and count.
00933       SEARCHFILTER_BITSET (
00934          const UINT8 *set,
00935          UINT32 NumEntries
00936          ) : m_bitset(const_cast<UINT8*>(set),NumEntries) { }
00937 
00938       //! Destructor 
00939       virtual ~SEARCHFILTER_BITSET () {}
00940 
00941    protected:
00942 
00943       //! Element filter for locating correct elements.
00944       //! @return True if element in set, false if not.
00945       virtual bool Filter (
00946          const RVC::GEOMETRIC& object,
00947          ELEMTYPE ElemType,
00948          INT32 ElemNum
00949          );
00950          
00951    private:
00952       #ifndef GENERATING_DOXYGEN_OUTPUT
00953       BITSET_UNOWNED m_bitset;
00954       #endif // GENERATING_DOXYGEN_OUTPUT
00955    };
00956    
00957 
00958 class GEOMETRIC::SEARCHRESULT {
00959    public:
00960    
00961       class CONST_ITERATOR;
00962       friend class CONST_ITERATOR;
00963 
00964       class CONST_ITERATOR {
00965          public:
00966          
00967             //! Default constructor
00968             CONST_ITERATOR (
00969                ) :
00970                m_IsRange(false),
00971                m_CurElemNum(0),
00972                m_CurIndex(0),
00973                m_sr(0)
00974                {}
00975 
00976             //! Internal constructor, used by container.
00977             CONST_ITERATOR (
00978                const SEARCHRESULT* sr,
00979                bool CreateEnd = false
00980                );
00981 
00982             //! Copy constructor
00983             CONST_ITERATOR (
00984                const CONST_ITERATOR& rhs
00985                ) : 
00986                m_IsRange(rhs.m_IsRange),
00987                m_CurElemNum(rhs.m_CurElemNum),
00988                m_CurIndex(rhs.m_CurIndex),
00989                m_sr(rhs.m_sr)
00990                {}
00991 
00992             //! Dereference operator, returns current element number.
00993             const INT32& operator* (
00994                ) const { return (m_CurElemNum); }
00995 
00996             //! Pre-increment operator.
00997             CONST_ITERATOR& operator++ (
00998                );
00999 
01000             //! Post-increment operator.
01001             CONST_ITERATOR operator++(int
01002                ) {
01003                CONST_ITERATOR temp = *this;
01004                ++*this;
01005                return (temp);
01006                }
01007 
01008             bool operator== (          //! Equality operator
01009                const CONST_ITERATOR& rhs
01010                ) const { return (m_CurElemNum == rhs.m_CurElemNum); }
01011 
01012             bool operator!= (          //! Inequality operator
01013                const CONST_ITERATOR& rhs
01014                ) const { return (!(*this == rhs)); }
01015          
01016          private:
01017             #ifndef GENERATING_DOXYGEN_OUTPUT
01018             bool m_IsRange;
01019             INT32 m_CurElemNum;
01020             INT32 m_CurIndex;
01021             const SEARCHRESULT* m_sr;
01022             #endif // GENERATING_DOXYGEN_OUTPUT
01023          };
01024       
01025       SEARCHRESULT (
01026          );
01027    
01028       SEARCHRESULT (
01029          const SEARCHRESULT& rhs
01030          );
01031    
01032       ~SEARCHRESULT (
01033          );
01034          
01035       SEARCHRESULT& operator= (
01036          const SEARCHRESULT& rhs
01037          );
01038          
01039       CONST_ITERATOR Begin (
01040          ) const {return (CONST_ITERATOR(this));}
01041          
01042       void Clear (
01043          );
01044          
01045       CONST_ITERATOR End (
01046          ) const {return (CONST_ITERATOR(this, true));}
01047          
01048       ERRVALUE FindElements (
01049          ELEMTYPE ElemType,
01050          const DRECT2D& SearchExtents,
01051          RVC::QSEARCHTREE& QTreeObj
01052          );
01053    
01054       ERRVALUE FindElements (
01055          ELEMTYPE ElemType,
01056          const DRECT2D& SearchExtents,
01057          RVC::SPATIALTREE& STreeObj
01058          );
01059          
01060       ERRVALUE GetElementSet (
01061          BITSET& SelectSet
01062          ) const;
01063          
01064       ERRVALUE GetElementSet (
01065          SIMPLE_ARRAY<INT32>& SelectList
01066          ) const;
01067          
01068       INT32 GetNumItems (
01069          ) const;
01070          
01071       bool IsEmpty (
01072          ) const;
01073          
01074       //! Set the search result for the all elements set
01075       void SetAll (
01076          INT32 NumElements
01077          );
01078          
01079       //! Set the search result for array passed in
01080       void SetArray (
01081          const SIMPLE_ARRAY<INT32>& ElemSet
01082          );
01083          
01084       //! Sort the elements in the list using the elements extents from smallest to largest
01085       void SortItemsByExtentArea (
01086          const RVC::GEOMETRIC& GeoObj,
01087          ELEMTYPE ElemType
01088          );
01089    
01090    private:
01091       #ifndef GENERATING_DOXYGEN_OUTPUT
01092       SIMPLE_ARRAY<INT32> m_list;
01093       SIMPLE_ARRAY<INT32_RANGE> m_range;
01094       #endif // GENERATING_DOXYGEN_OUTPUT
01095    };
01096    
01097       
01098 }     //! End of RVC namespace
01099 
01100 #endif   //!< INC_RVC_GEOMETRC_H

Generated on Thu Aug 12 06:19:40 2004 for TNTsdk by doxygen 1.3.4-20031026