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

Generated on Tue Dec 14 13:18:12 2004 for TNTsdk by  doxygen 1.3.8-20040913