hypermgr.h

Go to the documentation of this file.
00001 /**
00002  * \file hypermgr.h <gre/hypermgr.h>
00003  * \brief GRE HyperIndex Link Manager definitions
00004  *
00005  * \if NODOC
00006  * $Id: hypermgr.h_v 1.8 2005/03/31 16:57:05 fileserver!dwilliss Exp $
00007  *
00008  * $Log: hypermgr.h_v $
00009  * Revision 1.8  2005/03/31 16:57:05  fileserver!dwilliss
00010  * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00011  *
00012  * Revision 1.7  2004/06/28 17:53:17  mju
00013  * Convert to spatref.
00014  *
00015  * Revision 1.6  2003/11/12 13:21:29  mju
00016  * Add HyperShapeTypeToElemType.
00017  *
00018  * Revision 1.5  2003/09/15 13:48:59  fileserver!dwilliss
00019  * Doxygen
00020  *
00021  * Revision 1.4  2003/07/30 15:00:09  mju
00022  * Ignore stuff we don't want doc'd.
00023  *
00024  * Revision 1.3  2003/05/14 21:24:21  mju
00025  * Add HasLinks using viewable.
00026  *
00027  * Revision 1.2  2003/05/01 20:55:00  mju
00028  * Move MFC GTOOL defn to implementatiaon file.
00029  *
00030  * Revision 1.1  2003/04/30 21:40:24  mju
00031  * Initial revision
00032  * \endif
00033 **/
00034 
00035 #ifndef  INC_GRE_HYPERMGR_H
00036 #define  INC_GRE_HYPERMGR_H
00037 
00038 #ifndef  INC_MI32_GRE_H
00039    #include <mi32/gre.h>
00040 #endif
00041 
00042 #ifndef  INC_MI32_RVCHYPER_H
00043    #include <mi32/rvchyper.h>
00044 #endif
00045 
00046 //===================================================================================================================
00047 
00048 namespace GRE {
00049 
00050 class HYPERIDXMGR {
00051    public:
00052       enum FINDFLAGS {
00053          FINDFLAG_Default =         0x00,
00054          FINDFLAG_SearchAllElem =   0x01,
00055          FINDFLAG_FirstOnly =       0x02
00056          };
00057    };
00058 DEFINE_ENUM_OP_BITWISE(HYPERIDXMGR::FINDFLAGS);
00059 
00060 }  //! End namespace GRE
00061 
00062 //===================================================================================================================
00063 // Legacy definitions - Begin
00064 
00065 #define  HYPERDRAWFLAG_Highlight          0x01
00066 #define  HYPERDRAWFLAG_Unhighlight        0x02
00067 #define  HYPERDRAWFLAG_ShowTransparent    0x04
00068 #define  HYPERDRAWFLAG_NoDraw             0x08
00069 
00070 struct MDISPHYPERSHAPE {
00071    DPOINT2D min;                       //!< Minimum extents in object coordinates
00072    DPOINT2D max;                       //!< Maximum extents in object coordinates
00073    COLOR color;                        //!< Color to draw shape in
00074    INT32 elem;                         //!< Element number for vector links
00075    UINT32 NumPoints;                   //!< Number of points used to define shape
00076    INT32 NumLinks;                     //!< Number of links to this shape
00077    INT16 ShapeType;                    //!< HYPERSHAPE_...
00078    UINT8 Highlighted;                  //!< Set if shape is currently highlighted
00079    DPOINT2D *points;                   //!< Array of points if appropriate
00080    HYPERLINK *Links;                   //!< Array of links (defined in rvchyper.h)
00081    };
00082 
00083 struct MDISPHYPERSHAPELIST {
00084    int NumShapes;                      //!< Number of shapes in array
00085    int NumAllocated;                   //!< Number of shapes allocated
00086    MDISPHYPERSHAPE *Shapes;            //!< Array of shapes
00087    };
00088 
00089 struct MDISPHYPERLINKLIST {
00090    int NumLinks;                       //!< Number of links in array
00091    int NumAllocated;                   //!< Number of links allocated
00092    HYPERLINK *Links;                   //!< Array of links (defined in rvchyper.h)
00093    MDISPHYPERLINKLIST ()
00094       { memset(this,0,sizeof(*this)); }
00095    };
00096 
00097 
00098 //===================================================================================================================
00099 // Legacy definitions - Begin
00100 
00101 #ifndef GENERATING_DOXYGEN_OUTPUT
00102 #if defined(WIN32_MFC)
00103 //! HyperIndex Navigator tool (MFC only).
00104 class GRE_MFC_TOOL_HYPERNAV : public GRE_TOOL {
00105    public:
00106 
00107       //! Constructor.
00108       explicit GRE_MFC_TOOL_HYPERNAV (
00109          GRE_MFC_VIEW *view
00110          );
00111 
00112       //! Destructor.
00113       virtual ~GRE_MFC_TOOL_HYPERNAV ();
00114 
00115       //! Get setting for 'verify selection' option.
00116       bool GetVerifySelection (
00117          ) const { return (m_VerifySelection); }
00118 
00119       //! Back up to previous level.
00120       ERRVALUE GoBack ();
00121 
00122       //! Return to home level.
00123       ERRVALUE GoHome ();
00124 
00125       //! Set whether to verify selection.
00126       void SetVerifySelection (
00127          bool VerifySelection
00128          ) { m_VerifySelection = VerifySelection; }
00129 
00130    private:
00131 
00132       struct ARROWSHAPE {
00133          INT32 num;              //!< Index into array of sibling shapes
00134          double dist;            //!< Distance for sorting
00135          };
00136 
00137       struct ARROWLIST {
00138          int NumShapes;
00139          int NumAllocated;
00140          ARROWSHAPE *Shapes;
00141          void *ToolTip; 
00142          };
00143 
00144       struct HYPERSTACK {
00145          MIUNICODE filename[FILENAME_MAX];      //!< File containing saved layout/group for previous level
00146          INT32 inode;                        //!< Inode of saved layout/group for previous level
00147          HYPERLINK link;                     //!< Link that was used for _this_ level
00148          MDISPHYPERSHAPELIST SiblingList;    //!< List of siblings to current level
00149          INT32 CurrentSiblingNum;            //!< Current sibling shape number (for center button ToolTip)
00150          MIUNICODE layoutfname[FILENAME_MAX];   //!< Filename from MDISP...->savefilename
00151          INT32 layoutinode;                  //!< Inode from MDISP...->saveinode
00152          HYPERSTACK *prev;
00153          };
00154 
00155       class GTOOL;
00156 
00157       GRE_MFC_VIEW *m_mfcview;
00158       GTOOL *m_pgtool;
00159       HYPERSTACK *m_Stack;
00160       MDISPHYPERLINKLIST m_LinkList;
00161 //!      MDISPHYPERLINKLIST m_LateralList;
00162       DPOINT2D m_MapPoint;
00163       SPATREF::COORDREFSYS m_MapCoordRefSys;
00164 //!      ARROWLIST m_ArrowList[9];
00165       bool m_ShowLinks;
00166       bool m_ShowHiddenLinks;
00167       bool m_VerifySelection;
00168 
00169       void Apply ();
00170       int CreateSiblingList (GRE_GROUP*);
00171       virtual bool DoActivate ();
00172       virtual void DoDeactivate ();
00173       virtual void DoResume ();
00174       virtual void DoSuspend ();
00175       void FindNeighbors ();
00176       void FreeList ();
00177       void FreeStackTop ();
00178       void ReplaceLevel (const HYPERLINK& link, bool push = true);
00179       void SelectLink ();
00180       void UpdatePosition ();
00181 
00182       friend class GRE_MFC_TOOL_HYPERNAV::GTOOL;
00183    };
00184 #endif
00185 #endif //!< GENERATING_DOXYGEN_OUTPUT
00186 
00187 //===================================================================================================================
00188 
00189 //! Draw specified HyperIndex shape for layer.
00190 ERRVALUE MdispHyperDrawShape (
00191    GRE_VIEW *view, 
00192    GRE_LAYER *layer, 
00193    int obj, 
00194    const TRANS2D_MAPGEN& LayerToDisp,
00195    INT32 shapenum, 
00196    UINT32 drawflags
00197    );
00198 
00199 //! Draw specified HyperIndex shape for layer.
00200 ERRVALUE MdispHyperDrawShape (
00201    GRE_VIEW *view, 
00202    GRE_LAYER *layer, 
00203    int obj, 
00204    INT32 shapenum, 
00205    UINT32 drawflags
00206    );
00207 
00208 //! Draw all HyperIndex link shapes for view.
00209 int MdispHyperDrawShapes (
00210    GRE_VIEW *view, 
00211    UINT32 drawflags
00212    );
00213 
00214 //! Convert ellipse to rectangle corner points.
00215 void MdispHyperEllipseToRect (
00216    DPOINT2D *pt, 
00217    double rx, 
00218    double ry, 
00219    double theta, 
00220    DPOINT2D *c
00221    );
00222 
00223 //! Find shape corresponding to given layer element.
00224 //!
00225 //! @return Shape number, -1 if no shape, < -1 if error.
00226 int MdispHyperFindLayerElemShape (
00227    GRE_LAYER *layer, 
00228    int ShapeType, 
00229    INT32 ElemNum
00230    );
00231 
00232 //! Return list of shape numbers for given layer object.
00233 //!
00234 //! @return Number of shapes or error < 0.
00235 int MdispHyperFindLayerObjShapes (
00236    GRE_VIEW *view, 
00237    GRE_LAYER *layer, 
00238    int obj,                            //!< Layer object number
00239    const DPOINT2D& lpoint,             //!< Point in layer's object coordinates 
00240    INT32 **ShapeList,                  //!< Shape numbers (within HyperIndex object) returned 
00241    GRE::HYPERIDXMGR::FINDFLAGS flags = GRE::HYPERIDXMGR::FINDFLAG_Default
00242    );
00243 
00244 //! Find hyper links for view given point.
00245 int MdispHyperFindLinks (
00246    GRE_VIEW *view, 
00247    const DPOINT2D *spoint,             //!< Point in "screen" coordinates
00248    MDISPHYPERLINKLIST *linklist,
00249    GRE::HYPERIDXMGR::FINDFLAGS flags = GRE::HYPERIDXMGR::FINDFLAG_Default
00250    );
00251 
00252 //! Find hyper links for view given point.
00253 int MdispHyperFindLinksView (
00254    GRE_VIEW *view, 
00255    const DPOINT2D *lpoint,             //!< Point in "view" coordinates
00256    MDISPHYPERLINKLIST *linklist, 
00257    GRE::HYPERIDXMGR::FINDFLAGS flags = GRE::HYPERIDXMGR::FINDFLAG_Default
00258    );
00259 
00260 //! Free linked list.
00261 void MdispHyperFreeLinkList (
00262    MDISPHYPERLINKLIST *linkedlist
00263    );
00264 
00265 //! Find neighbor links/shapes for given layout.
00266 int MdispHyperFindNeighbors (
00267    GRE_LAYOUT *layout,                 //!< Layout, NULL if point is in Lat-Lon
00268    GRE_LAYOUT *playout, 
00269    const DPOINT2D& point,              //!< Point in layout or Lat-Lon coordinates
00270    const FILEPATH& parentfilename,     //!< Name of parent file (previous navigation step)
00271    const MIUNICODE *parentobjname,     //!< Name of parent object
00272    const FILEPATH& curfilename,        //!< Name of current file to exclude from neighbor list
00273    const MIUNICODE *curobjname,        //!< Name of current object to exclude from neighbor list
00274    HYPERLINK neighbors[8]              //!< Array of neighbors returned
00275    );
00276 
00277 //! Free shape list.
00278 void MdispHyperFreeShapeList (
00279    MDISPHYPERSHAPELIST *shapelist
00280    );
00281 
00282 //! Get shape list for specified layer.
00283 int MdispHyperGetLayerObjShapeList (
00284    GRE_LAYER *layer, 
00285    int obj, 
00286    MDISPHYPERSHAPE **pShapes,          //!< Pointer returned, DO NOT FREE
00287    INT32 *pNumShapes
00288    );
00289 
00290 //! Get RVC object type for HyperIndex link type.
00291 int MdispHyperGetLinkObjType (
00292    int linktype
00293    );
00294 
00295 //! Determine if has any hyperlinks for specified viewable.
00296 bool MdispHyperHasLinks (
00297    GRE_VIEWABLE *viewable
00298    );
00299 
00300 //! Determine if has any hyperlinks for specified point.
00301 bool MdispHyperHasLinks (
00302    GRE_VIEW *view, 
00303    const DPOINT2D& spoint,             //!< Point in "screen" coordinates
00304    GRE::HYPERIDXMGR::FINDFLAGS flags = GRE::HYPERIDXMGR::FINDFLAG_Default
00305    );
00306 
00307 //! Initialize HyperIndex module.
00308 void MdispHyperInit (void);
00309 
00310 //! Close HyperIndex object for specified layer object.
00311 int MdispHyperObjectClose (
00312    GRE_LAYER *layer, 
00313    int obj, 
00314    int CloseFile
00315    );
00316 
00317 //! Return HyperIndex object handle for specified layer object.
00318 int MdispHyperObjectGetHandle (
00319    GRE_LAYER *layer, 
00320    int obj
00321    );
00322 
00323 //! Open HyperIndex object for specified layer object.
00324 //!
00325 //! @return TRUE if opened file, FALSE if file was already open, < 0 if error.
00326 int MdispHyperObjectOpen (
00327    GRE_LAYER *layer, 
00328    int obj, 
00329    RVCHYPERINFO *hyperinfo, 
00330    int writemode
00331    );
00332 
00333 //! Convert rectangle (corner points) to ellipse.
00334 void MdispHyperRectToEllipse (
00335    DPOINT2D *pt,                       //!< Center of ellipse returned
00336    double *rx,                         //!< X Radius returned
00337    double *ry,                         //!< Y Radius returned
00338    double *theta,                      //!< Rotation angle returned
00339    DPOINT2D *c                         //!< Rectangle corners
00340    );
00341    
00342 //! Add HyperIndex shape to array of shapes for layer.
00343 int MdispHyperShapeAddToLayer (
00344    GRE_LAYER *layer, 
00345    int obj,                            //!< Layer object
00346    INT32 shapenum
00347    );
00348 
00349 //! Delete HyperIndex shape from layer.
00350 int MdispHyperShapeDelete (
00351    GRE_LAYER *layer, 
00352    int obj,                            //!< Layer object
00353    INT32 shapenum
00354    );
00355 
00356 //! Determine ELEMTYPE for HyperIndex ShapeType (HYPERSHAPE...)
00357 //! @return Element type, ELEMTYPE_Empty if can't convert.
00358 ELEMTYPE MdispHyperShapeTypeToElemType (
00359    GRE_LAYER *layer,                   //!< Layer
00360    INT16 ShapeType                     //!< HYPERSHAPE_... shape type
00361    );
00362 
00363 //! Update after any change to shape (except deletion)/
00364 int MdispHyperShapeUpdate (
00365    GRE_LAYER *layer, 
00366    int obj,                            //!< Layer object
00367    INT32 shapenum
00368    );
00369 
00370 //===================================================================================================================
00371 
00372 #endif   //!< INC_GRE_HYPERMGR_H

Generated on Wed May 31 15:26:39 2006 for TNTsdk by  doxygen 1.3.8-20040913