mi32/vecfuncs.h

Go to the documentation of this file.
00001 /****
00002 *  mi32/vecfuncs.h - Vector manipulation functions include file
00003 *
00004 *  \if NODOC
00005 *  $Id: vecfuncs.h_v 1.130 2003/09/15 13:49:56 fileserver!dwilliss Exp $
00006 *
00007 *  $Log: vecfuncs.h_v $
00008 *  Revision 1.130  2003/09/15 13:49:56  fileserver!dwilliss
00009 *  Doxygen
00010 *
00011 *  Revision 1.129  2003/06/05 21:13:38  dwilliss
00012 *  Never mind.  Wrong include file.
00013 *
00014 *  Revision 1.128  2002/10/04 21:47:41  scowan
00015 *  nc.
00016 *
00017 *  Revision 1.127  2002/06/27 15:10:03  scowan
00018 *  Parameter chagne./
00019 *
00020 *  Revision 1.126  2002/05/10 20:27:20  scowan
00021 *  Added another member.
00022 *
00023 *  Revision 1.125  2001/10/23 15:20:34  scowan
00024 *  Added parameters to add snap points function.
00025 *
00026 *  Revision 1.124  2001/02/22 15:27:22  scowan
00027 *  Check bound conditions on legacy flags.
00028 *
00029 *  Revision 1.123  2001/02/14 17:37:07  scowan
00030 *  Parameter change to auto generate label baseline.
00031 *
00032 *  Revision 1.122  2001/02/07 23:01:02  scowan
00033 *  Yet more functions.
00034 *
00035 *  Revision 1.121  2001/02/06 20:52:02  scowan
00036 *  Added snap parameters class and functions to deal with them.
00037 *  Added snop object class and functions to deal with them.
00038 *
00039 *  Revision 1.120  2001/01/18 17:06:02  scowan
00040 *  Added node to point function.
00041 *
00042 *  Revision 1.119  2001/01/17 18:37:56  scowan
00043 *  Added functions for std attrbi and elem id table management.
00044 *
00045 *  Revision 1.118  2001/01/16 21:29:40  scowan
00046 *  Added save flag.
00047 *
00048 *  Revision 1.117  2000/08/31 14:25:27  vdronov
00049 *  changed set to bitset
00050 *
00051 *  Revision 1.116  2000/08/30 20:01:25  msmith
00052 *  Genitor documentation
00053 *
00054 *  Revision 1.115  2000/08/24 20:55:45  scowan
00055 *  Added recover from undo.
00056 *
00057 *  Revision 1.113  2000/08/18 17:26:48  scowan
00058 *  Uses new standard attribute handle.
00059 *
00060 *  Revision 1.110  2000/02/14 18:55:27  SBC
00061 *  Added flags and fields.
00062 *
00063 *  Revision 1.109  2000/01/27 23:26:11  scowan
00064 *  Create do not mess with topology type flag.
00065 *
00066 *  Revision 1.106  1999/10/20 20:02:03  mju
00067 *  const filename in MfvNew/Open.
00068 *
00069  * Revision 1.105  1999/10/04  20:16:42  scowan
00070  * Fixed elem type change.
00071  *
00072 *  Revision 1.104  1999/08/04 20:33:32  scowan
00073 *  Added flags.
00074 *
00075 *  Revision 1.103  1999/06/11 16:24:00  scowan
00076 *  Added stub 3d add line function.
00077 *
00078 *  Revision 1.102  1999/05/07 21:25:53  mju
00079 *  Hdr restruct.
00080 *
00081  * Revision 1.101  1999/04/08  16:04:19  mju
00082  * Add inclusion guard for mcb.h.
00083  *
00084  * Revision 1.100  1999/01/05  19:12:47  scowan
00085  * Swapped multiple keywords
00086  *
00087  * Revision 1.97  1998/05/22  16:38:28  scowan
00088  * Changed a flag.
00089  *
00090  * Revision 1.94  1998/04/24  19:53:40  scowan
00091  * Added a flag.
00092  *
00093  * Revision 1.93  1998/04/03  16:22:31  scowan
00094  * Removed calls.
00095  *
00096  * Revision 1.92  1998/04/02  21:32:56  scowan
00097  * Added toolkit line splining functions.
00098  *
00099  * Revision 1.88  1998/02/20  17:27:41  scowan
00100  * Added callback reasons.
00101  *
00102  * Revision 1.87  1998/02/18  20:39:22  scowan
00103  * Added 3D editing capabilities.
00104  *
00105  * Revision 1.83  1998/02/09  18:22:26  scowan
00106  * Added a flag.
00107  *
00108  * Revision 1.82  1998/02/04  23:31:08  scowan
00109  * Added fields for element id's.
00110  *
00111  * Revision 1.81  1998/01/29  16:43:13  scowan
00112  * Update prototype.
00113  *
00114  * Revision 1.80  1998/01/29  00:08:39  scowan
00115  * Added stuff for planar and network object types.
00116  *
00117  * Revision 1.79  1997/10/30  23:39:31  scowan
00118  * Added prototype.
00119  *
00120  * Revision 1.78  1997/10/15  15:53:11  scowan
00121  * Added MFVSnap_ToVertex.
00122  *
00123  * Revision 1.77  1997/08/28  23:05:08  scowan
00124  * Added flag for removing excess nodes when deleting lines.
00125  *
00126  * Revision 1.76  1997/08/28  17:01:55  scowan
00127  * Added GetSnapOptions.
00128  *
00129  * Revision 1.75  1997/08/26  19:53:20  scowan
00130  * Add flags for line end snapping.
00131  *
00132  * Revision 1.74  1997/08/15  17:00:30  scowan
00133  * Added SplitLineAtMaxPoints.
00134  *
00135  * Revision 1.73  1997/08/14  17:22:38  scowan
00136  * Changed filename to UNICODE.
00137  *
00138  * Revision 1.72  1997/07/01  16:52:39  scowan
00139  * Added callbak field.
00140  *
00141  * Revision 1.71  1997/06/04  20:33:46  scowan
00142  * Added new internal function.
00143  *
00144  * Revision 1.71  1997/06/04  20:33:46  scowan
00145  * Added new internal function.
00146  *
00147  * Revision 1.70  1997/05/23  22:43:32  scowan
00148  * Removed some flags.
00149  *
00150  * Revision 1.69  1997/05/22  22:15:44  scowan
00151  * Added polygon island support.
00152  *
00153  * Revision 1.67  1997/02/14  22:22:54  scowan
00154  * Added flag.
00155  *
00156  * Revision 1.66  1996/12/30  21:20:28  scowan
00157  * Added MfvUpdate function.
00158  *
00159  * Revision 1.65  1996/12/18  21:09:30  scowan
00160  * Added islelist field and another save flag.
00161  *
00162  * Revision 1.64  1996/12/02  21:37:15  scowan
00163  * Added save flag for excess node removal.
00164  *
00165  * Revision 1.63  1996/11/25  23:37:08  scowan
00166  * Removed use of status handle, uses new status functions.
00167  *
00168  * Revision 1.62  1996/11/20  21:46:40  scowan
00169  * Added TestEndSnap field.
00170  *
00171  * Revision 1.61  1996/11/14  17:09:26  scowan
00172  * Added DontCrossLines flag.
00173  *
00174  * Revision 1.59  1996/10/14  16:50:48  scowan
00175  * Added NoStdAttrib flag for validate.
00176  *
00177  * Revision 1.58  1996/07/29  19:48:46  scowan
00178  * Added new notify reason.
00179  *
00180  * Revision 1.57  1996/06/19  15:46:06  scowan
00181  * Prototype addition for vectutil.c
00182  *
00183  * Revision 1.56  1996/06/17  16:10:38  scowan
00184  * Added ExtractToRegion.
00185  *
00186  * Revision 1.55  1996/06/14  19:12:33  scowan
00187  * Added ClipToRegion prototype.
00188  *
00189  * Revision 1.54  1996/04/02  20:52:05  scowan
00190  * Added MfvVerifyStdAttrib().
00191  *
00192  * Revision 1.53  1996/03/27  22:47:17  scowan
00193  * Added function prototypes.
00194  *
00195  * Revision 1.52  1996/02/29  20:42:24  scowan
00196  * API change for MfvSnapLines().
00197  *
00198  * Revision 1.51  1996/01/12  00:05:42  scowan
00199  * Made MfvRemoveOvershoots() static.
00200  *
00201  * Revision 1.50  1996/01/11  01:04:18  scowan
00202  * Added SnapBackAngle field.
00203  *
00204  * Revision 1.49  1996/01/04  17:42:39  scowan
00205  * Added stat manager handle field.
00206  * Removed old attempt at managing stat table fields.
00207  *
00208  * Revision 1.48  1995/12/22  16:33:26  scowan
00209  * Added prototype for MfvGetIntsHandle().
00210  *
00211  * Revision 1.47  1995/12/14  16:04:30  scowan
00212  * Added flags for multi-line snapping.
00213  *
00214  * Revision 1.46  1995/12/13  22:00:15  scowan
00215  * Added INTSHANDLE and element bit arrays.
00216  *
00217  * Revision 1.45  1995/12/13  20:00:58  scowan
00218  * Added MFVFLAG_AttemptAllElem flag.
00219  * Changed MfvSnapLines() API.
00220  *
00221  * Revision 1.44  1995/11/13  23:41:57  scowan
00222  * Added prototype for MfvCopyElemDBRecords().
00223  *
00224  * Revision 1.43  1995/11/08  21:30:21  scowan
00225  * Added prototype for MfvSnapLines().
00226  *
00227  * Revision 1.42  1995/10/24  19:04:49  scowan
00228  * Removed many database variables which are no longer needed.
00229  * Add recursion test field.
00230  *
00231  * Revision 1.41  1995/09/15  16:25:40  scowan
00232  * Added PointSize field to VEDITINFO.
00233  *
00234  * Revision 1.40  1995/09/14  20:58:18  scowan
00235  * Added prototype for _MfvChangeNodeRaw().
00236  *
00237  * Revision 1.39  1995/08/28  16:59:38  scowan
00238  * Removed FontTrans functions and variable.
00239  *
00240  * Revision 1.38  1995/08/11  20:39:15  scowan
00241  * Added prototype for MfvUpdateFontTrans().
00242  *
00243  * Revision 1.37  1995/08/11  18:58:48  scowan
00244  * Added FontTrans field to VEDITINFO.
00245  *
00246  * Revision 1.36  1995/05/18  22:14:06  scowan
00247  * Added prototype for MfvRemoveExcessNodesEx().
00248  *
00249  * Revision 1.35  1995/05/02  22:36:47  scowan
00250  * Added prototypes for polygon deletion functions.
00251  *
00252  * Revision 1.34  1995/03/16  22:34:29  scowan
00253  * Changed flag to KeepAttachedLabels.
00254  *
00255  * Revision 1.33  1995/02/24  00:40:12  scowan
00256  * Added fields to handle label to element attachments.
00257  *
00258  * Revision 1.32  1995/02/23  18:30:04  scowan
00259  * Added prototype for MfvSnapLine().
00260  *
00261  * Revision 1.31  1995/02/22  23:00:32  scowan
00262  * Added prototype for MfvGetStyleHandle().
00263  *
00264  * Revision 1.30  1995/02/22  20:46:53  scowan
00265  * Added prototype for MfvGetDBHandle().
00266  *
00267  * Revision 1.1  1994/02/18  21:53:37  scowan
00268  * Initial revision
00269  *
00270 *  \endif
00271 ****/
00272 
00273 #ifndef  INC_MI32_VECFUNCS_H
00274 #define  INC_MI32_VECFUNCS_H
00275 
00276 #ifndef  INC_MI32_MCB_H
00277    #include <mi32/mcb.h>
00278 #endif
00279 
00280 #ifndef  INC_MI32_RVCVECT_H
00281    #include <mi32/rvcvect.h>
00282 #endif
00283 
00284 #ifndef  INC_MI32_RVCDBASE_H
00285    #include <mi32/rvcdbase.h>
00286 #endif
00287 
00288 #ifndef  INC_MI32_INTSEC2_H
00289    #include <mi32/intsec2.h>
00290 #endif
00291 
00292 #ifndef  INC_MI32_GEOM2D_H
00293    #include <mi32/geom2d.h>
00294 #endif
00295 
00296 #ifndef  INC_MI32_RVCQTREE_H
00297    #include <mi32/rvcqtree.h>
00298 #endif
00299 
00300 #ifndef  INC_MI32_ELEMTYPE_H
00301    #include <mi32/elemtype.h>
00302 #endif
00303 
00304 #ifndef  INC_MI32_STATOBJ_H
00305    #include <mi32/statobj.h>
00306 #endif
00307 
00308 #ifndef  INC_MI32_TRANS2DC_H
00309    #include <mi32/trans2dc.h>
00310 #endif
00311 
00312 struct VNODELINEANGLE {
00313    double angle;                 //!<  Angle going out from the node 
00314    INT32 linenum;                //!<  Line coming to/from the node 
00315    int orient;                   //!<  1 = To the node, 0 = From the node 
00316    };
00317 
00318 struct VEDITINFO;
00319 
00320 struct VELEMINFO {
00321    ELEMTYPE ElemType;
00322    int dbid;
00323    INT32 *NumElements;           //!< Pointer to field that contains number of elements
00324    unsigned HasDftZValue:1,      //!< Add default Z Value to element that is added
00325             HasBitArray:1,       //!< Has a valid bit array
00326             ExternalQTree:1,
00327             unused:29;
00328    STATOBJ *m_sdh;               //!< Standard attribute manager handle
00329    UINT8 *dbbuf;                 //!< Work buffer for database record maintenence
00330    INT32 dbbufsize;
00331    double CurZValue;             //!< Current 3DXY Z value to assign to the element
00332    QTREEHANDLE qtree;
00333    VEDITINFO *ved;
00334    UINT8 *elemlist;              //!< Bit array of selected elements, used for multi-line snap for now
00335    UINT32 ElemListSize;          //!< Size of bit array in bytes
00336    INT32 ElemIDTableNum;         //!< Element ID table number
00337    INT32 *ElemIDCount;           //!< Pointer to header element ID counter
00338    };
00339 
00340 #define ELEMLISTALLOC   (64)
00341 #define STATLISTALLOC   (64)
00342 
00343 //! Vector toolkit snap object parameters structure
00344 
00345 class VTKSNAPOBJECT {
00346 public:
00347    int m_VectorID;
00348    QTREEHANDLE m_LineQTree;
00349    QTREEHANDLE m_NodeQTree;
00350    QTREEHANDLE m_PointQTree;
00351    INT32 m_MaxPoints;
00352    bool m_SameAsEditor;
00353    TRANS2D_MAPGEN m_VectorToObject;
00354    
00355    VTKSNAPOBJECT (
00356       ) {
00357       memset(this, 0, sizeof(*this));
00358       }
00359       
00360    VTKSNAPOBJECT (
00361       VEDITINFO* ved
00362       ) {
00363       SetValues(ved);
00364       }
00365       
00366    void SetValues (
00367       VEDITINFO* ved
00368       );
00369       
00370    };
00371    
00372 
00373 /*****
00374 *  Main vector editing structure definition
00375 *****/
00376 
00377 typedef void *VEHANDLE;
00378 
00379 struct MfvAnyCallbackStruct {
00380    VEHANDLE vh;
00381    UINT32 reason;
00382    INT32 ElemNum;
00383    INT32 OtherElemNum;        //!<  Set if reason is a SplitEnd or Delete 
00384    ELEMTYPE ElemType;
00385    };
00386 
00387 struct MfvAddLineOverlapCallbackStruct {
00388    UINT32 reason;
00389    VEHANDLE vh;
00390    INT32 NumOverlaps;
00391    OVERLAPREC *overlap;
00392    };
00393 
00394 #define MfvCR_Add             0x00000001
00395 #define MfvCR_Delete          0x00000002
00396 #define MfvCR_SplitBegin      0x00000004
00397 #define MfvCR_SplitEnd        0x00000008
00398 #define MfvCR_MoveBegin       0x00000010
00399 #define MfvCR_MoveEnd         0x00000020
00400 #define MfvCR_JoinBegin       0x00000040
00401 #define MfvCR_JoinEnd         0x00000080
00402 #define MfvCR_ValSplitLine    0x00000100           //!<  MfvValidateTopology() line splitting callback 
00403 #define MfvCR_AddLineOverlap  0x00000200           //!<  Overlap detected in MfvAddLine() 
00404 #define MfvCR_NodeToPtBegin   0x00000400
00405 #define MfvCR_NodeToPtEnd     0x00000800
00406 #define MfvCR_PtToNodeBegin   0x00001000
00407 #define MfvCR_PtToNodeEnd     0x00002000
00408 #define MfvCR_NodeLineAdd     0x00004000           //!<  Number of lines attached to this node has changed, mainly for drawing 
00409 #define MfvCR_NodeLineDelete  0x00008000           //!<  Number of lines attached to this node has changed, mainly for drawing 
00410 
00411 
00412 #ifndef GENERATING_DOXYGEN_OUTPUT
00413 struct VEDCBL {
00414    void (*NotifyCB)(MfvAnyCallbackStruct*, void*);
00415    void *NotifyUserData;
00416    VEDCBL *next;
00417    };
00418 
00419 
00420 struct VEDITINFO {
00421    UNICODE filename[FILENAME_MAX];
00422    RVCVECTINFO *vinfo;              //!<  Pointer to vector header to be modified 
00423    VELEMINFO line_d;
00424    VELEMINFO point_d;
00425    VELEMINFO poly_d;
00426    VELEMINFO node_d;
00427    VELEMINFO label_d;
00428    INT32 *linelist;                 //!<  Work buffer for node and polygon line lists 
00429    INT32 llistsize;
00430    DPOINT2D *ptbuff;                //!<  Work buffer for line points 
00431    INT32 ptbsize;
00432    DBLISTELMT *elist;               //!<  Work buffer for database lists 
00433    INT32 elistsize;
00434    int findex;                      //!<  Handle to open RVC file 
00435    int vid;                         //!<  Handle to open vector object 
00436    int hyperid;
00437    int stylefindex;
00438    int styleid;
00439    UINT32 flags;
00440    UINT32 SnapOpt;
00441    double SnapDist;
00442    unsigned HasMinMax:1,
00443             IsContour:1,
00444             WasPreOpened:1,
00445             InValidateFunc:1,
00446             HasAttachedLabels:1,
00447             IgnoreAddDBList:1,
00448             MultiLineSnap:1,
00449             TestEndLine:1,
00450             SnappedSelfLine:1,
00451             UseAddLineOverlapCallback:1,
00452             NoCombinePolyAttrib:1,
00453             unused:21;
00454    VEDCBL *NotifyCBList;
00455    int LabelTransFile;
00456    int ToLabelID[ELEMTYPE_NumTypes];
00457    RVCINODENUM ToLabelInodes[ELEMTYPE_NumTypes];
00458    int PointSize;
00459    UINT32 RecursiveCount;
00460    INT32 ModifyLineNum;
00461    INT32 ModifyNodeNum;
00462    INTSHANDLE ihp;                     //!<  Handle to Ints...() routines 
00463    double SnapBackAngle;               //!<  Allowable variation of angle of snap point to differ with the line segment 
00464    INT32 *islelist;                    //!<  Work buffer for polygon island lists 
00465    INT32 ilistsize;
00466    McbLIST CallbackList;
00467    INT32 MaxLinePoints;                //!<  Maximum number of points a line can have, 0 = infinite 
00468    INT32 DeletePolyNum;
00469    VTKSNAPOBJECT m_SnapObject;
00470    };
00471 
00472 
00473 /*****
00474 *  Internal flags
00475 *****/
00476 
00477 #define MFVADD_ForceNode         0x00000001
00478 
00479 #define MFVELEMID_SetInvalid     0x00000001
00480 
00481 
00482 /*****
00483 *  Local utility functions
00484 *****/
00485 
00486 #if defined(__cplusplus)
00487 extern "C" {
00488 #endif
00489 
00490 int         _MfvAddElemDBList (VELEMINFO *elem_d, INT32 elemnum);
00491 int         _MfvAddLineRaw (VEHANDLE vh, DPOLYGON *dpoly);
00492 int         _MfvAddNodeRaw (VEHANDLE vh, DPOINT3D *point);
00493 int         _MfvAddNodeLine (VEHANDLE vh, INT32 nodenum, INT32 linenum);
00494 int         _MfvAddPolyIsland (VEHANDLE vh, INT32 polynum, INT32 islenum);
00495 int         _MfvAddQTreeElem (VELEMINFO *elemdb, INT32 elemnum, void *data);
00496 int         _MfvBuildNodeLineList (VEHANDLE vh);
00497 int         _MfvBuildQTreeElem (VELEMINFO *elem_d);
00498 void        _MfvCallNotifyCallback (VEDITINFO *ved, UINT32 reason, ELEMTYPE ElemType, INT32 ElemNum, INT32 OtherElemNum);
00499 int         _MfvChangeElemInHyperShape (VELEMINFO *elemdb, INT32 oldnum, INT32 newnum);
00500 int         _MfvChangeLabelAttach (VEHANDLE vh, ELEMTYPE ElemType, INT32 OldElemNum, INT32 NewElemNum);
00501 int         _MfvChangeLabelAttachPosn (VEHANDLE vh, ELEMTYPE ElemType, INT32 ElemNum, DPOINT3D *pt);
00502 int         _MfvChangeLineRaw (VEHANDLE vh, INT32 linenum, DPOLYGON *dpoly);
00503 int         _MfvChangeNodeLine (VEHANDLE vh, INT32 nodenum, INT32 oldlinenum, INT32 newlinenum);
00504 int         _MfvChangeNodeRaw (VEHANDLE vh, INT32 nodenum, DPOINT3D *pt);
00505 int         _MfvChangePolyLine (VEHANDLE vh, INT32 polynum, INT32 oldlinenum, INT32 newlinenum);
00506 int         _MfvChangePolyIsland (VEHANDLE vh, INT32 polynum, INT32 oldislenum, INT32 newislenum);
00507 int         _MfvChangeTypeInHyperShape (VELEMINFO *elem_d, INT32 elemnum, int newtype);
00508 int         _MfvCheckIfIntersect (VEHANDLE vh, INT32 linenum, DPOLYGON *dpoly);
00509 void        _MfvCheckLabelAttach (VEHANDLE vh, RVCVECTLABEL *vlabel);
00510 int         _MfvCleanupElemToLabelTrans (VEHANDLE vh);
00511 int         _MfvCombineDBLists (VELEMINFO *elem_d, INT32 source, INT32 dest);
00512 int         _MfvCombineHyperLinks (VELEMINFO *elem_d, INT32 source, INT32 dest);
00513 int         _MfvCompareDBLists (VELEMINFO *elem_d, INT32 elem1,   INT32 elem2,   UINT32 flags);
00514 int         _MfvCompareHyperShapes (VELEMINFO *elem_d, INT32 elem1, INT32 elem2, UINT32 flags);
00515 void        _MfvComputeLineRect (DRECT2D *rect, DPOINT2D *pt, INT32 NumPoints);
00516 void        _MfvComputeLineRect3D (DRECT3D *rect, DPOINT3D *pt, INT32 NumPoints);
00517 int         _MfvCopyElemDBRecords (VELEMINFO *elem_d, INT32 source, INT32 dest, UINT32 flags);
00518 int         _MfvCopyHyperLinks (VELEMINFO *elem_d, INT32 source, INT32 dest);
00519 int         _MfvCopyQTreeElem (VELEMINFO *elemdb, INT32 source, INT32 dest, void *data);
00520 int         _MfvDeleteElemHyperShape (VELEMINFO *elem_d, INT32 elemnum);
00521 int         _MfvDeleteLineRaw (VEHANDLE vh, INT32 linenum);
00522 int         _MfvDeleteNodeRaw (VEHANDLE vh, INT32 nodenum);
00523 int         _MfvDeleteNodeLine (VEHANDLE vh, INT32 nodenum, INT32 linenum);
00524 int         _MfvDeletePolygonRaw (VEHANDLE vh, INT32 polynum);
00525 int         _MfvDeletePolyLine (VEHANDLE vh, INT32 polynum, INT32 linenum);
00526 int         _MfvDeletePolyIsland (VEHANDLE vh, INT32 polynum, INT32 islenum);
00527 int         _MfvDeleteQTreeElem (VELEMINFO *elem_d, INT32 elemnum);
00528 int         _MfvDoubleEqual(double, double, double);
00529 int         _MfvElementIDTableValidate (VELEMINFO *elem_d);
00530 double      _MfvFindDist (DPOINT2D *p1, DPOINT2D *p2);
00531 int         _MfvMakeElementIDTable (VELEMINFO *elem_d, UINT32 flags);
00532 int         _MfvFindLineAndSplit (VEHANDLE vh, DPOINT3D *point, DPOINT3D *retpt);
00533 INT32       _MfvFindNodeLineAngles (VEHANDLE vh, INT32 nodenum, VNODELINEANGLE *list);
00534 int         _MfvFindPolygons (VEDITINFO *ved, INT32 startline, INT32 PolyInside);
00535 int         _MfvGenerateIntersectionsRaw (VEDITINFO *ved, DPOLYGON *dpoly, INTERSECTINFO *ints, INT32 MaxIntersection, VTKSNAPOBJECT& SnapObject);
00536 int         _MfvGetElementGroupExtents (VELEMINFO *elem_d, DRECT2D *GroupRect);
00537 VELEMINFO  *_MfvGetElementPtr (VEHANDLE vh, ELEMTYPE ElemType);
00538 int         _MfvGetQTreeRect (VELEMINFO *elem_d, INT32 elemnum, DRECT2D *rect);
00539 int         _MfvJoinLines (VEDITINFO *ved, INT32 nodenum, INT32 RepLineNum, INT32 DelLineNum);
00540 int         _MfvMergePolygons (VEHANDLE vh, INT32 leftpolynum, INT32 rightpolynum, INT32 linenum);
00541 int         _MfvOpenElement (VELEMINFO *elem_d, INT32 *NumElem, INT32 *ElemIDCount);
00542 int         _MfvPickLineLabelAttach (VEHANDLE vh, INT32 OldLine, INT32 NewLine);
00543 int         _MfvPickPolyLabelAttach (VEHANDLE vh, INT32 OldPoly, INT32 NewPoly);
00544 int         _MfvPointAddRaw (VEHANDLE vh, RVCVECTPOINT *point);
00545 int         _MfvQTreeFilt (int fhandle, INT32 inode, RVCGENINFO *ginfo, void *filtdata, char *msg);
00546 ERRVALUE    _MfvRecoverFromUndoLabelTrans (VEHANDLE vhandle);
00547 int         _MfvRemoveDupDBListEntries (DBLISTELMT *buf, int NumList1, int NumList2);
00548 int         _MfvRemoveIslandInfo (VEHANDLE vh);
00549 int         _MfvRemovePolygon (VEHANDLE vh, INT32 polynum);
00550 int         _MfvRemovePolygonInfo (VEHANDLE vh, bool IsPolyRebuild);
00551 int         _MfvResizeLabelAttach (VEHANDLE vh, ELEMTYPE ElemType, INT32 NumItems);
00552 int         _MfvSetupElemToLabelTrans (VEHANDLE vh);
00553 int         _MfvSplitLineInPolygons (VEHANDLE vh, INT32 origlinenum, RVCVECTLINE *origvline, INT32 newlinenum);
00554 INT32       _MfvSplitLineNearPoint (VEHANDLE vh, INT32 linenum, DPOINT2D *point, INT32& NewLineNum);
00555 int         _MfvSwapElemLabelAttach (VEHANDLE vh, ELEMTYPE ElemType, INT32 FirstElem, INT32 LastElem);
00556 int         _MfvSwapDBRecords (VELEMINFO *elem_d, INT32 elem1, INT32 elem2, UINT32 flags);
00557 int         _MfvUpdateCurrentElemID (VELEMINFO *elem_d, INT32 elemnum);
00558 int         _MfvUpdatePolygon (VEDITINFO *ved, INT32 polynum);
00559 int         _MfvValidateNodes (VEHANDLE vh);
00560 int         _MfvValidatePolyInside (VEHANDLE vh);
00561 
00562 /*****
00563 *  Local utility defines
00564 *****/
00565 
00566 #define  _MfvChangeQTreeElem(e,f,d) _MfvCopyQTreeElem((e),(f),(f),(d))
00567 
00568 #endif //!< GENERATING_DOXYGEN_OUTPUT
00569 
00570 /*****
00571 *  Snap Option values and flags
00572 *****/
00573 
00574 #define MFVSNAP_ElemMask         0x0000000F
00575 #define MFVSNAP_ToAnyElement     0x00000000
00576 #define MFVSNAP_ToLine           0x00000001
00577 #define MFVSNAP_ToPoint          0x00000002
00578 #define MFVSNAP_ToNode           0x00000003
00579 #define MFVSNAP_ToNothing        0x00000004
00580 #define MFVSNAP_ToVertex         0x00000005
00581 
00582 #define MFVSNAP_SnapMask         0x000000F0
00583 #define MFVSNAP_AddVertexSnap    0x00000000
00584 #define MFVSNAP_DirectSnap       0x00000010
00585 #define MFVSNAP_ContinueSnap     0x00000020
00586 
00587 #define MFVSNAP_RemOvershoots    0x00000100
00588 #define MFVSNAP_DontCrossLines   0x00000200
00589 #define MFVSNAP_DontSnapToSelf   0x00000400
00590 
00591 #define MFVSNAP_BothEnds         0x00000000
00592 #define MFVSNAP_StartPtOnly      0x00000800        //!<  Mutually exclusive with MFVSNAP_EndPtOnly 
00593 #define MFVSNAP_EndPtOnly        0x00001000        //!<  Mutually exclusive with MFVSNAP_StartPtOnly 
00594 
00595    
00596 class VTKSNAPPARMS {
00597 public:
00598 
00599    // ENUMERATIONS
00600    
00601    enum SNAPTOELEM {
00602       SNAPTOELEM_AnyElement = 0,
00603       SNAPTOELEM_Line,
00604       SNAPTOELEM_Point,
00605       SNAPTOELEM_Node,
00606       SNAPTOELEM_Nothing,
00607       SNAPTOELEM_Vertex
00608       };
00609 
00610    enum SNAPTYPE {
00611       SNAPTYPE_AddVertexSnap = 0,
00612       SNAPTYPE_DirectSnap,
00613       SNAPTYPE_ContinueSnap
00614       };
00615       
00616    enum SNAPEND {
00617       SNAPEND_Both = 0,
00618       SNAPEND_Start,
00619       SNAPEND_End
00620       };
00621       
00622    // CONSTRUCTORS / DESTRUCTOR
00623    
00624    //! Default constructor
00625    VTKSNAPPARMS (
00626       ) :
00627       m_SnapToElem(SNAPTOELEM_AnyElement),
00628       m_SnapType(SNAPTYPE_AddVertexSnap),
00629       m_SnapEnd(SNAPEND_Both),
00630       m_SnapDist(1.0),
00631       m_SnapBackAngle(PI / 2.0),
00632       m_RemOvershoots(false),
00633       m_DontCrossLines(false),
00634       m_DontSnapToSelf(false)
00635       {}
00636       
00637    // METHODS
00638 
00639    bool CanCrossLines (
00640       ) const {
00641       return (!m_DontCrossLines);
00642       }
00643 
00644    bool CanRemoveOvershoots (
00645       ) const {
00646       return (m_RemOvershoots);
00647       }
00648 
00649    bool CanSnapToSelf (
00650       ) const {
00651       return (!m_DontSnapToSelf);
00652       }
00653 
00654    SNAPTOELEM GetElementSnap (
00655       ) const {
00656       return (m_SnapToElem);
00657       }
00658       
00659    UINT32 GetLegacyFlags (
00660       ) const {
00661       UINT32 retval = 0;
00662       if (m_RemOvershoots) retval |= MFVSNAP_RemOvershoots;
00663       if (m_DontCrossLines) retval |= MFVSNAP_DontCrossLines;
00664       if (m_DontSnapToSelf) retval |= MFVSNAP_DontSnapToSelf;
00665       retval |= static_cast<UINT32>(m_SnapToElem);
00666       retval |= static_cast<UINT32>(m_SnapType) << 4; 
00667       if (m_SnapEnd == SNAPEND_Start) retval |= MFVSNAP_StartPtOnly;
00668       else if (m_SnapEnd == SNAPEND_End) retval |= MFVSNAP_EndPtOnly;
00669       return (retval);
00670       }
00671       
00672    double GetSnapBackAngle (
00673       ) const {
00674       return (m_SnapBackAngle);
00675       }
00676       
00677    double GetSnapDist (
00678       ) const {
00679       return (m_SnapDist);
00680       }
00681       
00682    SNAPEND GetSnapEnd (
00683       ) const {
00684       return (m_SnapEnd);
00685       }
00686       
00687    SNAPTYPE GetSnapType (
00688       ) const {
00689       return (m_SnapType);
00690       }
00691       
00692    void SetCrossLines (
00693       bool CrossLines
00694       ) {
00695       m_DontCrossLines = !CrossLines;
00696       return;
00697       }
00698 
00699    void SetElementSnap (
00700       SNAPTOELEM element
00701       ) {
00702       m_SnapToElem = element;
00703       return;
00704       }
00705       
00706    void SetFromLegacyFlags (
00707       UINT32 flags
00708       ) {
00709       m_RemOvershoots = ((flags & MFVSNAP_RemOvershoots) != 0);
00710       m_DontCrossLines = ((flags & MFVSNAP_DontCrossLines) != 0);
00711       m_DontSnapToSelf = ((flags & MFVSNAP_DontSnapToSelf) != 0);
00712       m_SnapToElem = static_cast<SNAPTOELEM>(flags & MFVSNAP_ElemMask);
00713       if (m_SnapToElem > SNAPTOELEM_Vertex) m_SnapToElem = SNAPTOELEM_AnyElement;
00714       m_SnapType = static_cast<SNAPTYPE>((flags & MFVSNAP_SnapMask) >> 4);
00715       if (m_SnapType > SNAPTYPE_ContinueSnap) m_SnapType = SNAPTYPE_AddVertexSnap;
00716       if ((flags & MFVSNAP_StartPtOnly) != 0) m_SnapEnd = SNAPEND_Start;
00717       else if ((flags & MFVSNAP_EndPtOnly) != 0) m_SnapEnd = SNAPEND_End;
00718       else m_SnapEnd = SNAPEND_Both;
00719       return;
00720       }
00721       
00722    void SetRemoveOvershoots (
00723       bool RemoveOvershoots
00724       ) {
00725       m_RemOvershoots = RemoveOvershoots;
00726       return;
00727       }
00728 
00729    void SetSnapBackAngle (
00730       double angle
00731       ) {
00732       m_SnapBackAngle = bound(angle, 0.0, PI);
00733       return;
00734       }
00735       
00736    void SetSnapDist (
00737       double dist
00738       ) {
00739       m_SnapDist = dist;
00740       return;
00741       }
00742       
00743    void SetSnapEnd (
00744       SNAPEND SnapEnd
00745       ) {
00746       m_SnapEnd = SnapEnd;
00747       return;
00748       }
00749       
00750    void SetSnapToSelf (
00751       bool SnapToSelf
00752       ) {
00753       m_DontSnapToSelf = !SnapToSelf;
00754       return;
00755       }
00756 
00757    void SetSnapType (
00758       SNAPTYPE SnapType
00759       ) {
00760       m_SnapType = SnapType;
00761       return;
00762       }
00763       
00764 private:
00765    #ifndef GENERATING_DOXYGEN_OUTPUT
00766    SNAPTOELEM m_SnapToElem;   
00767    SNAPTYPE m_SnapType; 
00768    SNAPEND m_SnapEnd;
00769    double m_SnapDist;
00770    double m_SnapBackAngle;             //!<  Allowable variation of angle of snap point to differ with the line segment 
00771    bool m_RemOvershoots;
00772    bool m_DontCrossLines;
00773    bool m_DontSnapToSelf;
00774    #endif // GENERATING_DOXYGEN_OUTPUT
00775    
00776 };
00777 
00778 /*****
00779 *  MfvOpen - MfvNew flags
00780 *****/
00781 
00782 #define MFVFLAG_NoQtree             0x00000001  //!<  Do not maintain qtrees 
00783 #define MFVFLAG_NoDBStatTable       0x00000002  //!<  Do not update Database Statistics tables 
00784 #define MFVFLAG_KeepAttachedLabels  0x00000004  //!<  Keep labels that become unattached 
00785 #define MFVFLAG_IsContour           0x00000008  //!<  Vector data is a contour set 
00786 #define MFVFLAG_NoStyle             0x00000010  //!<  Do not open/create a style table 
00787 #define MFVFLAG_NoConvIfElemID      0x00000020  //!<  Do not convert node to point if element ID attachment only 
00788 #define MFVFLAG_NoDatabase          0x00000040  //!<  Do not maintain databases 
00789 #define MFVFLAG_RemExNodesDelLine   0x00000080  //!<  Delete excess nodes when deleting lines 
00790 #define MFVFLAG_NoHyper             0x00000100  //!<  Do not update hyper object 
00791 #define MFVFLAG_NoCreateTables      0x00000200  //!<  Do not create databases 
00792 #define MFVFLAG_NoCreateStyle       0x00000400  //!<  Do not create a style object 
00793 #define MFVFLAG_NoCreateElemID      0x00000800  //!<  Do not create element ID tables 
00794 #define MFVFLAG_IgnoreBadMinMax     0x00001000  //!<  Ignore bad min/max values (Should be used only by validate topo) 
00795 #define MFVFLAG_NoValidateNodes     0x00002000  //!<  Do not execute _MfvValidateNodes in MfvOpen() 
00796 #define MFVFLAG_NoSaveQTree         0x00004000  //!<  Do not save search tree in MfvClose() or MfvStop() 
00797 #define MFVFLAG_NoStatusText        0x00008000  //!<  Do not show status text 
00798 #define MFVFLAG_NoCreatePolyID      0x00010000  //!<  Do not create polygon element ID tables 
00799 #define MFVFLAG_NoChangeTopoType    0x00020000  //!<  Do not change / fix vector topology type 
00800 
00801 #define MFVFLAG_NoPolyQTree         0x01000000  //!<  Do not generate a polygon qtree 
00802 #define MFVFLAG_NoLineQTree         0x02000000  //!<  Do not generate a line qtree 
00803 #define MFVFLAG_NoPointQTree        0x04000000  //!<  Do not generate a point qtree 
00804 #define MFVFLAG_NoLabelQTree        0x08000000  //!<  Do not generate a label qtree 
00805 #define MFVFLAG_NoNodeQTree         0x10000000  //!<  Do not generate a node qtree 
00806 #define MFVFLAG_NoElemQTree         0x1F000000  //!<  Do not generate an element qtree 
00807 
00808 /*****
00809 *  Validate Topo, Build Polygon and Build Islands flags
00810 *****/
00811 
00812 #define MFVFLAG_RebuildPolys     0x00000001  //!<  Force rebuild polygons (Validate Topo) 
00813 #define MFVFLAG_RebuildIslands   0x00000002  //!<  Force rebuild polygon islands (Validate Topo) 
00814 #define MFVFLAG_RebuildNodeLL    0x00000004  //!<  Force rebuild node line lists (Validate Topo) 
00815 #define MFVTOPO_DontValidateZ    0x00000008  //!<  Do not validate Z values 
00816 #define MFVFLAG_GoodLeftRight    0x00000010  //!<  Vector Left/Right fields correct, do not rebuild 
00817 #define MFVFLAG_NoCheckHyper     0x00000020  //!<  Do not check hyper links in removing excess nodes 
00818 #define MFVFLAG_NoCheckDatabase  0x00000040  //!<  Do not check database attributes in removing excess nodes 
00819 #define MFVFLAG_NoRemoveNodes    0x00000080  //!<  Do not execute MfvRemoveExcessNodes() in topology validation 
00820 #define MFVFLAG_AttemptAllElem   0x00000100  //!<  In a multi-elem operation, attempt rest of elements if an error occurs 
00821 #define MFVFLAG_ForceClipBorder  0x00000200  //!<  Force the clip routine to add a border 
00822 #define MFVFLAG_NoClipBorder     0x00000400  //!<  Force the clip routine to not add any border 
00823 #define MFVFLAG_OnlyClipLines    0x00000800  //!<  Do not bother with the points and labels 
00824 #define MFVFLAG_NoStdAttrib      0x00001000  //!<  Avoid standard attribute rebuild in validate 
00825 #define MFVFLAG_RemUnusedDBRec   0x00002000  //!<  Removed unattached database records 
00826 #define MFVFLAG_NoValTopoType    0x00004000  //!<  Do not change / fix vector topology type 
00827 
00828 /*****
00829 *  MfvSave() flags
00830 *****/
00831 
00832 #define MFVSAVE_RemExNodes       0x00000001  //!< Remove excess nodes on destination object
00833 #define MFVSAVE_RemExRecords     0x00000002  //!< Remove excess database records on destination object
00834 #define MFVSAVE_Optimize         0x00000004  //!< Insert vector optimization code
00835 
00836 /*****
00837 *  MfvLine...() flags
00838 *****/
00839 
00840 #define MFVLINE_AverageZValue    0x00000001  //!<  Average line z coordinates when truncating 
00841 #define MFVLINE_SetMaxPoints     0x00000002  //!<  Set max points for toolkit in MfvLineSplitAtMaxPoints 
00842 
00843 /*****
00844 *  MfvPolygon...() flags
00845 *****/
00846 
00847 #define MFVPOLY_LongLineDelete   0x00000001  //!<  Delete longest line for deleting polygon 
00848 #define MFVPOLY_NoDeleteSpurs    0x00000002  //!<  Do not delete polygon spurs when deleting polygons 
00849 #define MFVPOLY_PolyCntCollapse  0x00000004  //!<  Collapse polygon to its centroid method of deleting polygons 
00850 #define MFVPOLY_RemoveAllIslands 0x00000008  //!<  Remove all islands 
00851 #define MFVPOLY_NoCombineAttrib  0x00000010  //!< Do not combine attributes from the deleted polygon to the new merged polygon
00852 
00853 /*****
00854 *  MfvPoint...() flags
00855 *****/
00856 
00857 #define MFVPOINT_IsNodePoint     0x00000001  //!<  Point to modify is a node point 
00858 
00859 /*****
00860 *  Vector toolkit API
00861 *****/
00862 
00863 //! Add a label to a vector.
00864 //!
00865 //! @return Error code or 0 if succussful.
00866 //! Description of RVCVECTLABEL:
00867 //! typedef struct _VECTLLDATA {
00868 //!   RVCLEADERLINE LeaderLine;        Leader Line structure
00869 //!   RVCLABELSTYLE LStyleIndex;       Leader Style structure
00870 //!   void *LeaderPts;                 Leader Line point buffer
00871 //!   LONG NumLeaderPts;               Number of leader line points
00872 //!   } VECTLEADERINFO;                Vector Leader Line Data
00873 //! typedef struct _VECTLABEL {
00874 //!   RVCLABELDESC desc;               Label descrition structure
00875 //!   void *LabelStr;                  String or query
00876 //!   LONG LabelStrSize;               Size of label string
00877 //!   void *BasePts;                   Array of label base points, 2D or 3D
00878 //!   LONG NumBasePts;                 Number of base points in array
00879 //!   VECTLEADERINFO *LLines;          Leader Line Data buffer
00880 //!   LONG NumLLines;                  Number of leader lines allocated
00881 //!   int PointSize;                   Size of the points in bytes
00882 //!   } RVCVECTLABEL;
00883 int            MfvAddLabel (
00884    VEHANDLE vhandl,                    //!< Handle created by MfvInit()
00885    RVCVECTLABEL *vlabel                //!< Pointer to label structure
00886    );
00887 
00888 //! Add a line to a vector.
00889 //!
00890 //! @return Error code or 0 if successful
00891 //! This function will resolve all topological issues that occur when adding this line.  This function
00892 //! assumes that the point array is large enough to handle adding at least two more points for snapping
00893 //! purposes.
00894 int            MfvAddLine (
00895    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00896    DPOLYGON *dpoly                     //!< Pointer to structure containing the line coordinates
00897    );
00898 
00899 //! API call to add a 3D line to a vector object.
00900 int            MfvAddLine3D (
00901    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00902    DPOLYLINE3D *dpoly                  //!< Pointer to structure containing the line coordinates
00903    );
00904 
00905 //! Append points to the end of a vector line according to snap options and return the line.
00906 //!
00907 //! @return Error if < 0
00908 //! The 'dpoly.point' field is allocated in this function, it must be freed by the caller.
00909 //! The dpoly.numpts field is the number of points after snapping.  The MfvAddSnapPoints() 
00910 //! function will not work for generating the snap points because that function assumes that
00911 //! the line being passed does not exist in the vector.
00912 int            MfvAddLineSnapPoints (
00913    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00914    INT32 LineNum,                      //!< The vector line to snap and return
00915    DPOLYGON *dpoly                     //!< Pointer to structure to return the snapped line in
00916    );
00917 
00918 //! Add a node to a vector splitting the line if necessary.
00919 //!
00920 //! @return Error code or 0 if successful
00921 //! This routine may or may not add the node.  It depends on whether or
00922 //! not the routine finds a line close enough to split.  If it finds a
00923 //! node that is close enough and snap to node is enabled, then it will
00924 //! not create the node.  The actual place of the node will be returned
00925 //! in the point parameter.
00926 int            MfvAddNode (
00927    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00928    DPOINT2D *point                     //!< Place to try to add the node
00929    );
00930 
00931 //! Add a point to a vector.
00932 //!
00933 //! @return Error code or 0 if successful
00934 int            MfvAddPoint (
00935    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00936    RVCVECTPOINT *point                 //!< Point coordinate structure
00937    );
00938 
00939 //! Add a polygon to a vector.
00940 //!
00941 //! @return Error code or 0 if successful
00942 //! This function calls MfvAddLine() to add the polygon.  The node that exists at the closure of the
00943 //! polygon is tested and removed if possible using MfvDeleteNode().
00944 int            MfvAddPolygon (
00945    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00946    DPOLYGON *dpoly                     //!< Pointer to structure containing the polygon coordinates
00947    );
00948 
00949 //! Append points to the end of a non vector line according to snap options.
00950 //!
00951 //! @return Error code or 0 if successful
00952 int            MfvAddSnapPoints (
00953    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00954    DPOLYGON *dpoly,                    //!< Line to append snap points to
00955    bool& SnappedStart,                 //!< Set to 'true' if start point can be snapped
00956    bool& SnappedEnd                    //!< Set to 'true' if end point can be snapped
00957    );
00958 
00959 //! Generate a place to put a label along a vector element.
00960 //!
00961 //! @return Error code or 0 if successful
00962 //! You must free dpoly.point after this function is called
00963 int            MfvAutoGenLabelPosn (
00964    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00965    INT32 elemnum,                      //!< Element number to generate label position from
00966    ELEMTYPE ElemType,                  //!< ELEMTYPE_,.. (Point, Poly, Line)
00967    DPOLYGON *dpoly,                    //!< Baseline for label RETURNED
00968    double length                       //!< Length of label in vector units
00969    );
00970 
00971 //! Find all polygons in a vector object.
00972 //!
00973 //! @return Error code or 0 if successful
00974 //! This function rebuilds the polygons from scratch.  Any reattachment of polygon attributes must be 
00975 //! done outside of this code since the first thing this function does is to remove the polygons from 
00976 //! the vector object.  This routine is Mstatus enabled.
00977 int            MfvBuildPolygons (
00978    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00979    UINT32 flags                        //!< Flags, none defined yet
00980    );
00981 
00982 //! Changes a vector label
00983 //!
00984 //! @return Error code or 0 if successful
00985 int            MfvChangeLabel (
00986    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
00987    INT32 labelnum,                     //!< Number of label to change
00988    RVCVECTLABEL *vlabel                //!< Vector label structure
00989    );
00990 
00991 //! Changes a vector line.
00992 //!
00993 //! @return Error code or WCantChangeLine or 0
00994 //! If this function returns WCantChangeLine as an error code, it means that the change request would
00995 //! intersect other lines and therefore the operation cannot be completed.  The start and end points
00996 //! of the line must not be modified unless either the start or end of the line is a dangling end, i.e. no
00997 //! other lines connected to that node on that end.
00998 int            MfvChangeLine (
00999    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01000    INT32 linenum,                      //!< Number of the line to change
01001    DPOLYGON *dpoly                     //!< PointList to change to line to
01002    );
01003 
01004 //! Changes the position of a node and all lines attached.
01005 //!
01006 //! @return Error code or WCantChangeLine or 0
01007 //! The pllist array is used to determine the new shape of the lines
01008 //! that are attached to the node being moved.  The array is in the
01009 //! same order as the node line list, i.e. each element in the pllist
01010 //! array cooresponds with the line in the node line list.  The start
01011 //! or end point in the pllist[i].point list must be the same as the 
01012 //! point variable passed.  Determine the start or end point based on
01013 //! the start/end of the line.
01014 //! WCantChangeLine is issued if the lines are moved in such a way as
01015 //! to cross other lines, the lines and node are returned to the
01016 //! previous state before the function call.
01017 int            MfvChangeNode (
01018    VEHANDLE vhandle,                   //!< Handle create by MfvInit()
01019    INT32 nodenum,                      //!< Number of the node to change
01020    DPOINT3D *point,                    //!< New location of the node
01021    DPOLYGON *pllist,                   //!< Array of line points to move
01022    INT32 numpllist                     //!< Number of lines to manipulate
01023    );
01024 
01025 //! Changes a vector point.
01026 //!
01027 //! @return Error code or 0 if successful
01028 //! See also: MfvAddPoint, MfvDeletePoint
01029 int            MfvChangePoint (
01030    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01031    INT32 pointnum,                     //!< Number of the point to change
01032    RVCVECTPOINT *point,                //!< Vector point structure
01033    UINT32 flags
01034    );
01035 
01036 //! Clip a vector object to a region.
01037 //!
01038 //! @return Error code or 0 if successful
01039 //! Flags:
01040 //!   MFVFLAG_ForceClipBorder          Force the clip routine to add a border
01041 //!   MFVFLAG_NoClipBorder             Force the clip routine to not add any border
01042 //!   MFVFLAG_OnlyClipLines            Do not bother with the points and labels
01043 //! The default action with regards to the region border is to add the segment only if the
01044 //! segment divides a polygon.  The PolySet bit array can control which polygons are considered
01045 //! int for region segment addition.  This function is more efficient if the target vector is
01046 //! thinned using the extraction routines.
01047 //! See also: MregionClipLine, MfvExtractToRegion
01048 int            MfvClipToRegion (
01049    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01050    DREGION *region,                    //!< Region to clip to
01051    UINT32 RegionTest,                  //!< REGIONTEST_CompInside or REGIONTEST_CompOutside
01052    UINT8 *PolySet,                     //!< Bit array of polygons to clip in, NULL for all.
01053    UINT32 flags                        //!< Flags
01054    );
01055 
01056 //! Close an open vector object opened via MfvOpen or MfvNew.
01057 //!
01058 //! @return Error code
01059 //! This function will save the search trees under the vector object
01060 //! unless MFVFLAG_NoSaveQTree is specified in MfvOpen(), MfvSetup() or
01061 //! MfvNew().
01062 int            MfvClose (
01063    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01064    UINT32 flags                        //!< 1 to rebuild polygon islands
01065    );
01066 
01067 //! API call to collapse multiple nodes into one node.
01068 //!
01069 //! @return Error code
01070 //! Any lines that are attached at both ends to the nodes to be removed will also be removed.
01071 //! Any polygons that have all of their line removed will also be removed.  This function
01072 //! is used by _MfvFindPolygons() to remove zero area polygons.
01073 int            MfvCombineNodes (
01074    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01075    INT32 NodeNum,
01076    DPOINT3D *pt,
01077    INT32 *nodelist,                    //!< List of node to combine
01078    INT32 NumNodes,                     //!< Number of nodes in the list
01079    UINT32 flags                        //!< Flags
01080    );
01081 
01082 //! Change vector point type from 2D -> 3D or 3D -> 2D.
01083 int            MfvConvertPointType (
01084    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01085    UINT32 NewPointType,                //!< VPOINT_2DXY, VPOINT_3DXY, or VPOINT_3DXYZ
01086    UINT32 flags                        //!< MfvFLAG_...
01087    );
01088 
01089 //! Convert node element to a pseudo point element by adding a database record to it
01090 ERRVALUE MfvConvertNodeToPoint (
01091    VEHANDLE vh,
01092    INT32 NodeNum
01093    );
01094    
01095 //! Delete a vector label.
01096 //!
01097 //! @return Error code
01098 //! This function will reduce the number of labels in the vector
01099 //! object.  If you intend to delete multiple labels, use
01100 //! MfvDeleteLabels() instead.
01101 int            MfvDeleteLabel (
01102    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01103    INT32 labelnum                      //!< Label to delete
01104    );
01105 
01106 //! Delete vector labels.
01107 //!
01108 //! @return Error code
01109 //! This function properly deletes multiple vector labels.  The labellist must be sorted in 
01110 //! accending order for the function to work properly.  This routine is Mstatus enabled.
01111 int            MfvDeleteLabels (
01112    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01113    INT32 *labellist,                   //!< List of labels to delete
01114    INT32 numlabels                     //!< Number of labels to delete
01115    );
01116 
01117 //! Delete a vector line.
01118 //!
01119 //! @return Error code
01120 //! This function properly deletes a line from a vector object maintaining
01121 //! topology.  Do not call this function to delete multiple lines, call
01122 //! MfvDeleteLines().
01123 int            MfvDeleteLine (
01124    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01125    INT32 linenum                       //!< Line to delete
01126    );
01127 
01128 //! Delete vector lines.
01129 //!
01130 //! @return Error code
01131 //! This function properly deletes multiple vector lines.  The linelist must be sorted in 
01132 //! ascending order for the function to work properly.  This routine is Mstatus enabled.
01133 int            MfvDeleteLines (
01134    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01135    INT32 *linelist,                    //!< List of lines to delete
01136    INT32 numlines                      //!< Number of lines in the list
01137    );
01138 
01139 //! Delete a vector node.
01140 //!
01141 //! @return 1 if node is removed, 0 if not, or Error code
01142 //! Flags:
01143 //!   MFVFLAG_NoCheckHyper             To not check differences between hyper links
01144 //!   MFVFLAG_NoCheckDatabase          To not check differences between database attachments
01145 //! This function properly deletes a node from a vector object maintaining
01146 //! topology.  Do not call this function to delete multiple nodes, call
01147 //! MfvDeleteNodes().  This function determines if the node is safe to
01148 //! remove, if it is, it will do so and join the lines together, if not,
01149 //! it will do nothing.
01150 int            MfvDeleteNode (
01151    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01152    INT32 nodenum,                      //!< Node to delete
01153    UINT32 flags                        //!< Flags
01154    );
01155 
01156 //! Delete vector nodes.
01157 //!
01158 //! @return Error code
01159 //! Flags:
01160 //!   MFVFLAG_NoCheckHyper             To not check differences between hyper links
01161 //!      MFVFLAG_NoCheckDatabase          To not check differences between database attachments
01162 //! This function properly deletes multiple vector nodes.  The nodelist must be sorted in 
01163 //! ascending order for the function to work properly.  This routine is Mstatus enabled.
01164 //! See MfvDeleteNode() for node removal behavior.
01165 int            MfvDeleteNodes (
01166    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01167    INT32 *nodelist,                    //!< List of nodes to delete
01168    INT32 numnodes,                     //!< Number of nodes in the list
01169    UINT32 flags                        //!< Flags
01170    );
01171 
01172 //! Delete a vector point.
01173 //!
01174 //! @return Error code
01175 //! This function properly deletes a point from a vector object.  Do not
01176 //! call this function to delete multiple points, call MfvDeletePoints().
01177 int            MfvDeletePoint (
01178    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01179    INT32 pointnum                      //!< Point to delete
01180    );
01181 
01182 //! Delete vector points.
01183 //!
01184 //! @return Error code
01185 //! This function properly deletes multiple vector points.  The ptlist must be sorted in accending 
01186 //! order for the function to work properly.  This routine is Mstatus enabled.
01187 int            MfvDeletePoints (
01188    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01189    INT32 *ptlist,                      //!< List of points to delete
01190    INT32 numpts                        //!< Number of points to delete
01191    );
01192 
01193 //! Attempt to delete polygon by deleting lines.
01194 //!
01195 //! @return 1 if polygon removed, 0 if not, or Error code
01196 //! Flags:
01197 //!      MFVPOLY_LongLineDelete           Delete longest line for deleting polygon, will always delete polygon
01198 //!      MFVPOLY_NoDeleteSpurs            Do not delete polygon spurs when deleting polygons
01199 //!      MFVPOLY_PolyCntCollapse          Collapse polygon to its centroid method of deleting polygons
01200 //! This function searches the lines that make up the polygon to find a line that is not part of another 
01201 //! polygon if no flags are set.  If such a line is found, the routine then searches for all of the lines 
01202 //! that can be removed that form the polygon and deletes them.  If MFVPOLY_LongLineDelete is used, the
01203 //! routine will delete the polygon by deleting the longest line.  Do not call this function to delete multiple 
01204 //! polygons, call MfvDeletePolygons().
01205 int            MfvDeletePolygon (
01206    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01207    INT32 polynum,                      //!< Polygon to attempt to delete
01208    UINT32 flags                        //!< Flags
01209    );
01210 
01211 //! Attempt to delete multiple polygons.
01212 //!
01213 //! @return Error code
01214 //! This function properly deletes multiple polygons.  The polylist must be sorted in accending 
01215 //! order for the function to work properly.  This routine is Mstatus enabled.
01216 int            MfvDeletePolygons (
01217    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01218    INT32 *polylist,                    //!< List of polygons to attempt to delete
01219    INT32 numpolys,                     //!< Number of polygons in the list
01220    UINT32 flags                        //!< Flags
01221    );
01222 
01223 //! Remove all elements that fail the region test.
01224 //!
01225 //! @return Error code
01226 //! Region test values:
01227 //!   REGIONTEST_CompInside            Is the line completely inside the region
01228 //!   REGIONTEST_PartInside            Is the line partially inside the region
01229 //!   REGIONTEST_CompOutside           Is the line completely outside the region
01230 //!   REGIONTEST_PartOutside           Is the line partially outside the region
01231 //! Flags:
01232 //!   MFVFLAG_OnlyClipLines   Do not bother with the points and labels
01233 //! See also: MregionClipLine, MfvClipToRegion
01234 int            MfvExtractToRegion (
01235    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01236    DREGION *region,                    //!< Region to clip to
01237    UINT32 RegionTest,                  //!< Region test values
01238    UINT32 flags                        //!< Flags
01239    );
01240 
01241 //! Given a line number, return the closest point and segment on the line.
01242 //!
01243 //! @return Segment number that point was found or Error if < 0
01244 INT32          MfvFindClosestLineVertex (
01245    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01246    INT32 linenum,                      //!< Line to find closest point on
01247    DPOINT2D *testpt,                   //!< Point to search with
01248    DPOINT3D *retpt                     //!< Closest point RETURNED
01249    );
01250 
01251 //! Search and record polygon islands.
01252 //!
01253 //! @return Error code
01254 //! This function rebuilds polygons from scratch.  Any recovery of polygon attributes must be
01255 //! done elsewhere.  This routine is Mstatus enabled.
01256 //! Flag definitions:
01257 //!   MFVFLAG_GoodLeftRight            Vector line Left/Right fields
01258 //!                                       are correct, do not rebuild
01259 int            MfvFindPolygonIslands (
01260    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01261    UINT32 flags                        //!< Flags
01262    );
01263 
01264 //! Generate Element ID tables
01265 ERRVALUE MfvGenerateElementIDTables (
01266    VEHANDLE vhandle                    //!< Handle created by MfvInit()
01267    );
01268    
01269 //! API call to generate an INTERSECTINFO data of the intersections.
01270 //!
01271 //! @return Error code
01272 //! This is made by the line passed into the function with respect to
01273 //! the vector object with a limit on the number found.
01274 //! It will not resolve topology.
01275 //! See use in MfvClipToRegion for an example.
01276 int            MfvGenerateIntersectionsExt (
01277    VEHANDLE vhandle,                   //!< Handle created by MfvInit()
01278    DPOLYGON *dpoly,                    //!< Line to generate intersections on
01279    INTERSECTINFO *ints,                //!< Structure for intersection information
01280    INT32 MaxIntersections              //!< Maximum number of intersections
01281    );
01282 
01283 //! Given a polyline, return the intersection list.
01284 //!
01285 //! @return Error code
01286 //! This function determines the intersections between the line and the
01287 //! vector object.  It does not modify the vector or the line itself, but
01288 //! generates intersection data that can be used elsewhere (see IntsSplitLine()).
01289 inline int     MfvGenerateInt