gre/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.16 2007/04/11 20:10:18 mju Exp $
00007  *
00008  * $Log: hypermgr.h_v $
00009  * Revision 1.16  2007/04/11 20:10:18  mju
00010  * Remove getDesc method.
00011  *
00012  * Revision 1.15  2006/06/15 16:33:53  scowan
00013  * Uses changes to hyper index interface classes.
00014  * Moved all functions into hyperidxmgr class.
00015  *
00016  * Revision 1.14  2005/11/02 21:32:27  mju
00017  * Move mfc stuff to atlaswin projet.
00018  *
00019  * Revision 1.13  2005/11/01 22:26:10  mju
00020  * Include gre view hdr for mfc.
00021  *
00022  * Revision 1.12  2005/10/27 12:53:46  mju
00023  * Use gre namespace instead of legacy types.
00024  *
00025  * Revision 1.11  2005/10/14 17:30:13  mju
00026  * GRE namespace.
00027  *
00028  * Revision 1.10  2005/09/26 16:50:49  scowan
00029  * Changed type of hyper link type function return.
00030  *
00031  * Revision 1.9  2005/09/12 15:49:39  scowan
00032  * Changed parameters of findNeighbors.
00033  *
00034  * Revision 1.8  2005/03/31 16:57:05  fileserver!dwilliss
00035  * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00036  *
00037  * Revision 1.7  2004/06/28 17:53:17  mju
00038  * Convert to spatref.
00039  *
00040  * Revision 1.6  2003/11/12 13:21:29  mju
00041  * Add HyperShapeTypeToElemType.
00042  *
00043  * Revision 1.5  2003/09/15 13:48:59  fileserver!dwilliss
00044  * Doxygen
00045  *
00046  * Revision 1.4  2003/07/30 15:00:09  mju
00047  * Ignore stuff we don't want doc'd.
00048  *
00049  * Revision 1.3  2003/05/14 21:24:21  mju
00050  * Add HasLinks using viewable.
00051  *
00052  * Revision 1.2  2003/05/01 20:55:00  mju
00053  * Move MFC GTOOL defn to implementatiaon file.
00054  *
00055  * Revision 1.1  2003/04/30 21:40:24  mju
00056  * Initial revision
00057  * \endif
00058 **/
00059 
00060 #ifndef  INC_GRE_HYPERMGR_H
00061 #define  INC_GRE_HYPERMGR_H
00062 
00063 #ifndef  INC_GRE_BASE
00064    #include <gre/base.h>
00065 #endif
00066 
00067 #if !defined(INC_GRE_VIEW_H) && defined(WIN32_MFC)
00068    #include <gre/view.h>
00069 #endif
00070 
00071 #ifndef  INC_RVC_HYPERIDX_H
00072    #include <rvc/hyperidx.h>
00073 #endif
00074 
00075 #ifndef  INC_MI32_POLYLINE_H
00076    #include <mi32/polyline.h>
00077 #endif
00078 
00079 //===================================================================================================================
00080 
00081 namespace GRE {
00082 
00083 class HYPERLINK : public RVC::HYPERINDEX::LINK {
00084    public:
00085       HYPERLINK (
00086          ) :
00087          LINK(),
00088          m_ShapeNum(0),
00089          m_Layer(0)
00090          {}
00091          
00092       void Clear (
00093          ) {
00094          m_ShapeNum = 0;
00095          m_Layer = 0;
00096          LINK::Clear();
00097          return;
00098          }
00099          
00100       LAYER* GetLayer (
00101          ) const { return (m_Layer); }
00102          
00103       UINT32 GetShapeNum (
00104          ) const { return (m_ShapeNum); }
00105          
00106       void SetLayer (
00107          LAYER* layer
00108          ) { m_Layer = layer; }
00109          
00110       void SetShapeNum (
00111          UINT32 ShapeNum
00112          ) { m_ShapeNum = ShapeNum; }
00113          
00114    private:
00115       UINT32 m_ShapeNum;                  //!< Shape number that link is referenced by
00116       LAYER* m_Layer;                        //!< Layer that this link is referenced by
00117    };
00118    
00119 
00120 class HYPERSHAPE : public RVC::HYPERINDEX::SHAPE {
00121    public:
00122    
00123       HYPERSHAPE (
00124          ) :
00125          SHAPE(),
00126          m_ShapeNum(-1),
00127          m_Highlighted(false)
00128          {}
00129          
00130       void Clear (
00131          ) {
00132          m_Points.Clear();
00133          m_Links.Clear();
00134          m_Highlighted = false;
00135          SetExtents(DRECT3D());
00136          return;
00137          }
00138          
00139       ERRVALUE DeleteShape (
00140          RVC::HYPERINDEX& HyperObj
00141          );
00142          
00143       const MILIST<GRE::HYPERLINK>& GetLinks (
00144          ) const { return (m_Links); }
00145          
00146       const POLYLINE& GetPoints (
00147          ) const { return (m_Points); }
00148          
00149       bool IsHighlighted (
00150          ) const { return (m_Highlighted); }
00151          
00152       ERRVALUE ReadShape (
00153          RVC::HYPERINDEX& HyperObj,
00154          INT32 ShapeNum,
00155          GRE::LAYER *layer
00156          );
00157       
00158       void SetHighlighted (
00159          bool value
00160          ) { m_Highlighted = value; }
00161          
00162       void SetLinks (
00163          const MILIST<GRE::HYPERLINK>& Links
00164          ) { m_Links = Links; }
00165          
00166    private:
00167       #ifndef GENERATING_DOXYGEN_OUTPUT
00168       INT32 m_ShapeNum;
00169       bool m_Highlighted;                       //!< Set if shape is currently highlighted
00170       POLYLINE m_Points;                        //!< Array of points if appropriate
00171       MILIST<GRE::HYPERLINK> m_Links;           //!< Array of links
00172       #endif // GENERATING_DOXYGEN_OUTPUT
00173    };
00174 
00175 
00176 class HYPERIDXMGR {
00177    public:
00178       enum FINDFLAGS {
00179          FINDFLAG_Default =         0x00,
00180          FINDFLAG_SearchAllElem =   0x01,
00181          FINDFLAG_FirstOnly =       0x02
00182          };
00183 
00184       //! Draw specified HyperIndex shape for layer.
00185       static ERRVALUE DrawShape (
00186          VIEW *view, 
00187          LAYER *layer, 
00188          int obj, 
00189          const TRANS2D_MAPGEN& LayerToDisp,
00190          INT32 shapenum, 
00191          UINT32 drawflags
00192          );
00193 
00194       //! Draw specified HyperIndex shape for layer.
00195       static ERRVALUE DrawShape (
00196          VIEW *view, 
00197          LAYER *layer, 
00198          int obj, 
00199          INT32 shapenum, 
00200          UINT32 drawflags
00201          );
00202 
00203       //! Draw all HyperIndex link shapes for view.
00204       static int DrawShapes (
00205          VIEW *view, 
00206          UINT32 drawflags
00207          );
00208 
00209       //! Find shape corresponding to given layer element.
00210       //!
00211       //! @return Shape number, -1 if no shape, < -1 if error.
00212       static int FindLayerElemShape (
00213          LAYER *layer, 
00214          RVC::HYPERINDEX::SHAPE::TYPE ShapeType,
00215          INT32 ElemNum
00216          );
00217 
00218       //! Return list of shape numbers for given layer object.
00219       //!
00220       //! @return Number of shapes or error < 0.
00221       static int FindLayerObjShapes (
00222          VIEW *view, 
00223          LAYER *layer, 
00224          int obj,                            //!< Layer object number
00225          const DPOINT2D& lpoint,             //!< Point in layer's object coordinates 
00226          SIMPLE_ARRAY<INT32>& ShapeList,     //!< Shape numbers (within HyperIndex object) returned
00227          FINDFLAGS flags = FINDFLAG_Default
00228          );
00229 
00230       //! Find hyper links for view given point.
00231       static int FindLinks (
00232          VIEW *view, 
00233          const DPOINT2D& spoint,             //!< Point in "screen" coordinates
00234          MILIST<HYPERLINK>& linklist,
00235          FINDFLAGS flags = FINDFLAG_Default
00236          );
00237 
00238       //! Find hyper links for view given point.
00239       static int FindLinksView (
00240          VIEW *view, 
00241          const DPOINT2D& lpoint,             //!< Point in "view" coordinates
00242          MILIST<HYPERLINK>& linklist,
00243          FINDFLAGS flags = FINDFLAG_Default
00244          );
00245 
00246       //! Find neighbor links/shapes for given layout.
00247       static int FindNeighbors (
00248          LAYOUT *layout,                     //!< Layout, NULL if point is in Lat-Lon
00249          LAYOUT *playout, 
00250          const DPOINT2D& point,                 //!< Point in layout or Lat-Lon coordinates
00251          const FILEPATH& parentfilename,        //!< Name of parent file (previous navigation step)
00252          const RVC::OBJECTNAME& parentobjname,  //!< Name of parent object
00253          const FILEPATH& curfilename,           //!< Name of current file to exclude from neighbor list
00254          const RVC::OBJECTNAME& curobjname,     //!< Name of current object to exclude from neighbor list
00255          HYPERLINK neighbors[8]           //!< Array of neighbors returned
00256          );
00257 
00258       //! Return HyperIndex object handle for specified layer object.
00259       static ERRVALUE GetHyperObjItem (
00260          LAYER *layer, 
00261          int obj,
00262          RVC::OBJITEM& HyperObjItem
00263          );
00264 
00265       //! Get shape list for specified layer.
00266       static int GetLayerObjShapeList (
00267          LAYER *layer, 
00268          int obj, 
00269          MILIST<HYPERSHAPE>& ShapeList
00270          );
00271 
00272       //! Determine if has any hyperlinks for specified viewable.
00273       static bool HasLinks (
00274          VIEWABLE *viewable
00275          );
00276 
00277       //! Determine if has any hyperlinks for specified point.
00278       static bool HasLinks (
00279          VIEW *view, 
00280          const DPOINT2D& spoint,             //!< Point in "screen" coordinates
00281          FINDFLAGS flags = FINDFLAG_Default
00282          );
00283 
00284       static void Init (
00285          );
00286          
00287       //! Open HyperIndex object for specified layer object.
00288       //! If one does not exist it will be created if OpenMode == OPENMODE_Write
00289       //!
00290       //! @return TRUE if opened file, FALSE if file was already open, < 0 if error.
00291       static ERRVALUE OpenHyperObject (
00292          LAYER *layer, 
00293          int obj, 
00294          RVC::HYPERINDEX& HyperObj,
00295          RVC::OBJECT::OPENMODE OpenMode
00296          );
00297 
00298       //! Add HyperIndex shape to array of shapes for layer.
00299       static int ShapeAddToLayer (
00300          LAYER *layer, 
00301          int obj,                            //!< Layer object
00302          RVC::HYPERINDEX& HyperObj,
00303          INT32 shapenum
00304          );
00305 
00306       //! Delete HyperIndex shape from layer.
00307       static int ShapeDelete (
00308          LAYER *layer, 
00309          int obj,                            //!< Layer object
00310          RVC::HYPERINDEX& HyperObj,
00311          INT32 shapenum
00312          );
00313 
00314       //! Determine ELEMTYPE for HyperIndex ShapeType (HYPERSHAPE...)
00315       //! @return Element type, ELEMTYPE_Empty if can't convert.
00316       static ELEMTYPE ShapeTypeToElemType (
00317          LAYER *layer,                    //!< Layer
00318          RVC::HYPERINDEX::SHAPE::TYPE ShapeType                   //!< HYPERSHAPE_... shape type
00319          );
00320 
00321       //! Update after any change to shape (except deletion)/
00322       static int ShapeUpdate (
00323          LAYER *layer, 
00324          int obj,                            //!< Layer object
00325          RVC::HYPERINDEX& HyperObj,
00326          INT32 shapenum
00327          );
00328 
00329    };
00330 DEFINE_ENUM_OP_BITWISE(HYPERIDXMGR::FINDFLAGS);
00331 
00332 
00333 }  //! End namespace GRE
00334 
00335 //===================================================================================================================
00336 // Legacy definitions - Begin
00337 
00338 #define  HYPERDRAWFLAG_Highlight          0x01
00339 #define  HYPERDRAWFLAG_Unhighlight        0x02
00340 #define  HYPERDRAWFLAG_ShowTransparent    0x04
00341 #define  HYPERDRAWFLAG_NoDraw             0x08
00342 
00343 //===================================================================================================================
00344 
00345 #endif   // INC_GRE_HYPERMGR_H

Generated on Thu Apr 26 04:03:32 2007 for TNTsdk by  doxygen 1.5.2