lrmapgrd.h

Go to the documentation of this file.
00001 /**
00002  * \file lrmapgrd.h <gre/lrmapgrd.h>
00003  * \brief GRE_LAYER_MAPGRID class definitions.
00004  *
00005  * \if NODOC
00006  * $Id: lrmapgrd.h_v 1.18 2004/10/15 21:26:19 ldyas Exp $
00007  *
00008  * $Log: lrmapgrd.h_v $
00009  * Revision 1.18  2004/10/15 21:26:19  ldyas
00010  * added needsmem24 method
00011  *
00012  * Revision 1.17  2004/10/15 14:36:15  ldyas
00013  * *** empty log message ***
00014  *
00015  * Revision 1.16  2004/10/14 22:02:13  ldyas
00016  * isantialiased now nonconst.
00017  *
00018  * Revision 1.15  2004/10/06 14:23:02  ldyas
00019  * *** empty log message ***
00020  *
00021  * Revision 1.14  2004/10/01 22:38:57  ldyas
00022  * added new mapgriddispflags for antialiasing and thin line width hinting.
00023  *
00024  * Revision 1.13  2004/06/28 17:53:48  mju
00025  * Convert to spatref system.
00026  *
00027  * Revision 1.12  2004/03/05 18:06:10  mju
00028  * Use virtual dtor if have virtual fns.
00029  *
00030  * Revision 1.11  2003/09/15 13:48:59  fileserver!dwilliss
00031  * Doxygen
00032  *
00033  * Revision 1.10  2003/07/30 15:24:23  mju
00034  * Ignore private sections.
00035  *
00036  * Revision 1.9  2003/03/10 16:09:52  mju
00037  * Save toggled tick coords.
00038  *
00039  * Revision 1.8  2003/03/10 14:34:57  mju
00040  * Use ifdef for appendpopup.
00041  *
00042  * Revision 1.7  2003/03/07 23:20:25  mju
00043  * Add ability to toggle tick colors.
00044  * Add more UTM label formats.
00045  *
00046  * Revision 1.6  2002/11/04 21:01:03  mju
00047  * Add separate control for corner coords in 2D/3D.
00048  *
00049  * Revision 1.5  2002/10/15 22:01:42  mju
00050  * Add more text formatting options.
00051  * Add option to show corner labels.
00052  * Add field for border text offset.
00053  *
00054  * Revision 1.4  2002/09/23 17:20:53  mju
00055  * Add InitExtents to DISPPARM.
00056  *
00057  * Revision 1.3  2002/09/20 17:03:19  mju
00058  * Only declare v_ControlPanel if X or MFC.
00059  *
00060  * Revision 1.1  2002/09/10 14:24:51  mju
00061  * Initial revision
00062  * \endif
00063 **/
00064 
00065 #ifndef  INC_GRE_LRMAPGRD_H
00066 #define  INC_GRE_LRMAPGRD_H
00067 
00068 #ifndef  INC_MI32_GRE_H
00069 #include <mi32/gre.h>
00070 #endif
00071 
00072 
00073 //===================================================================================================================
00074 
00075 //! GRE layer class for viewing Map Grid.
00076 class GRE_LAYER_MAPGRID : public GRE_LAYER {
00077    public:
00078 
00079       class DISPPARM : public GRE_LAYER::DISPPARM {
00080          public:
00081 
00082             class DLG;                             //!< Layer settings dialog, defined in <gre/uimapgrd.h>
00083 
00084             TEXTSTYLE CoordLabelStyle;
00085             TEXTSTYLE AxisLabelStyle;
00086             double xinterval;             //!< Interval in meters for non lat/lon projections
00087             double yinterval;
00088             double zinterval;
00089             double xdegrees;              //!< Interval to use for lat/lon (in degrees)
00090             double ydegrees;
00091             SPATREF::COORDREFSYS IntervalCRS;   //!< CRS of grid interval
00092             SPATREF::COORDREFSYS ExtentsCRS;    //!< CRS of grid extents
00093             DRECT3D MapExtents;           //!< Extents (sans ticks/text) in ExtentsProj
00094             UINT8 IntervalUnitsXY;        //!< X-Y interval units (if not lat-lon)
00095             UINT8 IntervalUnitsZ;         //!< Z interval units
00096             UINT8 IntervalLatLonFormat;   //!< Format for interval lat/lon prompts
00097             UINT8 ExtentsUnits;           //!< Units for entering extents if not lat-lon
00098             UINT8 ExtentsLatLonFormat;    //!< Format for extents lat/lon prompts
00099             LINESTYLE StyleGrid;          //!< Style for grid lines
00100             LINESTYLE StyleBorder;        //!< Style for border/neatline
00101             LINESTYLE StyleBorderTickExt; //!< Style for ticks outside border
00102             LINESTYLE StyleInteriorTick;  //!< Style for interior ticks
00103             COLOR BorderTickIntColor1;    //!< Primary color for border tick interior
00104             COLOR BorderTickIntColor2;    //!< Alternate color for border tick interior
00105             COLOR InteriorTickColor2;     //!< Alternate color for interior ticks
00106             double GridWidth;             //!< Thickness of grid lines
00107             double BorderWidth;           //!< Thickness of border
00108             double BorderTickExtWidth;    //!< Thickness of exterior border ticks
00109             double BorderTickExtLength;   //!< Outside length of border ticks
00110             double BorderTickIntWidth;    //!< Thickness of interior border ticks
00111             double BorderTickIntLength;   //!< Inside length of border ticks
00112             double InteriorTickWidth;     //!< Thickness of interior ticks
00113             double InteriorTickLength;    //!< Size of interior ticks
00114             double BorderTextOffset;      //!< Offset to border text from edge/tick endpoint
00115             double GraphicMapScale;       //!< Scale for graphics
00116             UINT8 GridWidthUnits;
00117             UINT8 BorderWidthUnits;
00118             UINT8 BorderTickExtWidthUnits;
00119             UINT8 BorderTickExtLengthUnits;
00120             UINT8 BorderTickIntWidthUnits;
00121             UINT8 BorderTickIntLengthUnits;
00122             UINT8 InteriorTickLengthUnits;
00123             UINT8 InteriorTickWidthUnits;
00124             UINT8 BorderTextOffsetUnits;
00125             UINT32 CoordFormatLatLon;     //!< Coordinate format for lat-lon
00126             UINT32 CoordFormatProj;       //!< Coordinate format for projection other than lat/lon
00127             UINT8 OldProjUnits;           //!< For old map grids used in conversion
00128             UINT8 VerticalAxes;
00129             UINT8 CoordOrient;            //!< Coordinate orientation
00130             UNICODE CoordUnitNameXY[32];
00131             UNICODE CoordUnitNameZ[32];
00132             UNICODE AxisLabelX[64];
00133             UNICODE AxisLabelY[64];
00134             UNICODE AxisLabelZ[64];
00135             DOUBLE_ARRAY<DPOINT2D> m_ToggledTickCoords;  //!< Coordinates of toggled ticks in 'extents' projection
00136 
00137             DISPPARM ();
00138             DISPPARM (const DISPPARM& rhs) { Copy(rhs); }
00139             virtual ~DISPPARM () { Free(); }
00140 
00141             DISPPARM& operator= (
00142                const DISPPARM& rhs
00143                ) { if (this != &rhs) { Free(); Copy(rhs); } return (*this); }
00144 
00145             //! Initialize extents based on current projection and layer's group extents.
00146             //! The specified layer's group will be used to determine the extents,
00147             //! ignoring the layer itself.
00148             void InitExtents (
00149                const GRE_LAYER_MAPGRID *layer
00150                );
00151             //! Validate dispparm, adjusting if necessary.
00152             virtual ERRVALUE Validate ();
00153 
00154          protected:
00155             virtual const SERIALIZER::ITEMDEF* SerialGetItemDef (SERIALIZER& serializer) const;
00156             static int SerializerCB_TickToggledCoords (SERIALIZER& serializer, const SERIALIZER::ITEMDEF *itemdef, void *cbdata, SERIALIZER::ITEMDEF::ACTION action);
00157 
00158          private:
00159             #ifndef GENERATING_DOXYGEN_OUTPUT
00160             void Copy (const DISPPARM&);
00161             void Free ();
00162             #endif //!< GENERATING_DOXYGEN_OUTPUT
00163          };
00164 
00165       //! Construct instance of this layer type
00166       static int Construct (
00167          GRE_GROUP *group,                      //!< Group to contain layer
00168          GRE_LAYER **retlayer,                  //!< Layer returned
00169          GRE_LAYER *reflayer,                   //!< Reference layer for insertion
00170          UINT32 flags                           //!< Creation flags
00171          );
00172 
00173       //! Register this layer type
00174       static void RegisterType (
00175          );
00176 
00177       //! Install SML class, called by internal SML function.
00178       static void SMLClassInstall (
00179          SMLCONTEXT *context
00180          );
00181 
00182       //! Construct layer and insert into list
00183       explicit GRE_LAYER_MAPGRID (
00184          GRE_GROUP *group,                      //!< Group to contain layer
00185          GRE_LAYER *reflayer = 0,               //!< Reference layer for insertion
00186          UINT32 flags = MDISPCREATE_InsertAfter //!< MDISPCREATE flags
00187          );
00188 
00189       //! Destructor.
00190       virtual ~GRE_LAYER_MAPGRID ();
00191 
00192       //! Retrieve layer-specific display parameters.
00193       const DISPPARM& GetDispParm (
00194          ) const { return (m_dispparm); }
00195 
00196       //! Set layer-specific display parameters.
00197       //! This is the recommended method for changing how an existing layer is to be
00198       //! rendered.  Validation will be performed on the specified parameters and
00199       //! adjustments made to the layer's copy if necessary.  Use of this method
00200       //! usually result in a ChangeBegin / ChangeEnd message pair, and will also
00201       //! generate a ChangeObject message if the spatial object used in the layer
00202       //! is changed.
00203       ERRVALUE SetDispParm (
00204          const DISPPARM& dispparm               //!< Parameters to set
00205          );
00206 
00207    protected:
00208 
00209       DISPPARM m_dispparm;                      //!< Layer-specific display parameters
00210 
00211    private:
00212       #ifndef GENERATING_DOXYGEN_OUTPUT
00213 
00214       class PRIVDRAWDATA;
00215       friend class PRIVDRAWDATA;
00216 
00217       struct TICK {
00218          enum TYPE {
00219             TYPE_Interior =   0,
00220             TYPE_MinX =       1,
00221             TYPE_MaxX =       2,
00222             TYPE_MinY =       3,
00223             TYPE_MaxY =       4
00224             };
00225          enum FLAGS {
00226             FLAG_None =       0x00,
00227             FLAG_Lowest =     0x01,
00228             FLAG_AltColor =   0x02,
00229             FLAG_Corner =     0x04
00230             };
00231          DPOINT2D m_pt;                //!< Coordinates in "extents" projection
00232          DPOINT2D m_pt2;               //!< Secondary point for determining orientation
00233          double m_label;               //!< X or Y map coordinate for tick point label
00234          TYPE m_type;
00235          FLAGS m_flags;
00236 
00237          TICK (
00238             const DPOINT2D& pt,
00239             const DPOINT2D& pt2,
00240             TYPE type,
00241             FLAGS flags = FLAG_None,
00242             double label = 0
00243             );
00244          };
00245 
00246       TRANS2D_MAPGEN m_TransMapToExt;
00247       DRECT2D m_GridRect;
00248       DPOINT2D m_GridInterval;
00249       SIMPLE_ARRAY<TICK> m_Ticks;
00250       int m_ActiveTick;
00251       void *m_LabelList;
00252 
00253    #if defined(X_NATIVE)
00254       static void CB_ToggleTickColor (Widget, void*, void*);
00255    #endif
00256       static void SMLGET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00257       static void SMLSET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00258 
00259       ERRVALUE OnToggleTickColor ();
00260       void ReadDefaultsIni ();
00261       void SaveDefaultsIni ();
00262       ERRVALUE TickAddCornerPoints ();
00263       ERRVALUE TickAddEdgePoint (const DPOINT2D& label, const DPOINT2D& pt, const DPOINT2D& pt2, TICK::TYPE type, TICK::FLAGS flags);
00264       ERRVALUE TickCalcPoints ();
00265       ERRVALUE TickLoadToggledCoords ();
00266       ERRVALUE TickSaveToggledCoords ();
00267 
00268       //! Overrides from GRE_LAYER
00269    #if defined(X_NATIVE)
00270       virtual void v_AppendPopupMenuItems (Widget widget, const DPOINT2D *point, MENUITEMARRAY& menuitems);
00271    #endif
00272       virtual void v_ComputeMargins (double& tmargin, double& bmargin, double& lmargin, double& rmargin);
00273    #if defined(X_NATIVE) || defined(WIN32_MFC)
00274       virtual int v_ControlPanel (MDLGPARENT dlgparent, UINT32 flags = 0);
00275    #endif
00276       virtual ERRVALUE v_Draw (GRE_LAYERDC& layerdc);
00277       virtual const char* v_SerialGetTagName () const;
00278       virtual ERRVALUE v_SerialRead (SERIALIZER& serializer);
00279       virtual void v_SetDftName (bool ReplaceExisting);
00280       virtual int v_UpdateExtents (bool forceupdate);
00281       virtual bool v_IsAntialiased ()const;
00282       virtual bool v_IsLineWidthHinted () const;
00283       virtual bool v_NeedsMEM24 (bool isHirez) const; 
00284       virtual void v_SetAntialiased (bool antialias);
00285       virtual void v_SetHintThinLines (bool hint);
00286       GRE_LAYER_MAPGRID (const GRE_LAYER_MAPGRID&);
00287       GRE_LAYER_MAPGRID& operator= (const GRE_LAYER_MAPGRID&);
00288 
00289       #endif //!< GENERATING_DOXYGEN_OUTPUT
00290    };
00291 
00292 #define  MAPGRIDDISPFLAG_SizeRelative        (0x00000001)   //! Sizes relative to TickScale
00293 #define  MAPGRIDDISPFLAG_ShowBorderTicksExt  (0x00000002)   //! Show tick marks outside border
00294 #define  MAPGRIDDISPFLAG_ShowBorderTicksInt  (0x00000004)   //! Show tick marks inside border
00295 #define  MAPGRIDDISPFLAG_ShowGrid            (0x00000010)   //! Show grid
00296 #define  MAPGRIDDISPFLAG_ShowBorderTicks     (0x00000020)   //! Show tick marks at border (OLD)
00297 #define  MAPGRIDDISPFLAG_ShowCoordText2D     (0x00000040)   //! Show coordinate text in 2D
00298 #define  MAPGRIDDISPFLAG_ShowBorder          (0x00000080)   //! Show border
00299 #define  MAPGRIDDISPFLAG_ShowInteriorTicks   (0x00000100)   //! Show interior tick marks
00300 #define  MAPGRIDDISPFLAG_ShowCoordText3D     (0x00000200)   //! Show coordinate text in 3D
00301 #define  MAPGRIDDISPFLAG_ShowBorderBottom3D  (0x00000400)   //! Show border at Z = zmin in 3D
00302 #define  MAPGRIDDISPFLAG_ShowBorderTop3D     (0x00000800)   //! Show border at Z = zmax in 3D
00303 #define  MAPGRIDDISPFLAG_BorderRelative      (0x00001000)   //! Interval is relative to borders, not 0
00304 #define  MAPGRIDDISPFLAG_ShowVerticalTicks   (0x00002000)   //! Show ticks on vertical axes
00305 #define  MAPGRIDDISPFLAG_LayoutScale         (0x00004000)   //! Use layout mapscale
00306 #define  MAPGRIDDISPFLAG_ShowVerticalScale   (0x00008000)   //! Show scale on vertical axes
00307 #define  MAPGRIDDISPFLAG_ShowMinSec0         (0x00010000)   //! Show minutes/seconds in lat-lon even if 0
00308 #define  MAPGRIDDISPFLAG_ShowDegOnlyIfMin0   (0x00020000)   //! Show degrees in lat-lon only if minutes = 0
00309 #define  MAPGRIDDISPFLAG_ShowCornerText2D    (0x00040000)   //! Show coordinates at corners
00310 #define  MAPGRIDDISPFLAG_ShowCornerText3D    (0x00080000)   //! Show coordinates at corners
00311 #define  MAPGRIDDISPFLAG_Antialias     (0x00100000)   //! Antialias
00312 #define  MAPGRIDDISPFLAG_HintThinLines    (0x00200000)   //! Hint Thin Lines via Transparency
00313 
00314 #define  MAPGRIDDISPFLAGS_ShowBorderTicksAny (MAPGRIDDISPFLAG_ShowBorderTicks | MAPGRIDDISPFLAG_ShowBorderTicksExt | MAPGRIDDISPFLAG_ShowBorderTicksInt)
00315 
00316 #define  MAPGRID_COORDFMTLATLON_MASK         0x000F
00317 #define  MAPGRID_COORDFMTLATLON_DDMMSS       0x0000
00318 #define  MAPGRID_COORDFMTLATLON_DDdddd       0x0001
00319 #define  MAPGRID_COORDFMTLATLON_DDMMmmm      0x0002
00320 #define  MAPGRID_COORDFMTLATLON_DDMMSSss     0x0003
00321 #define  MAPGRID_COORDFMTLATLON_DDMMSSs      0x0004
00322 #define  MAPGRID_COORDFMTLATLON_None         0x000F
00323 #define  MAPGRID_COORDFMTLATLON_NoSymbol     0x0020
00324 #define  MAPGRID_COORDFMTLATLON_AddSpace     0x0040
00325 #define  MAPGRID_COORDFMTLATLON_Leading0Deg  0x0080
00326 #define  MAPGRID_COORDFMTLATLON_Leading0MS   0x0100
00327 #define  MAPGRID_COORDFMTLATLON_DirFirst     0x0200
00328 #define  MAPGRID_COORDFMTLATLON_DirLast      0x0400
00329 
00330 #define  MAPGRID_COORDFMTPROJ_Space          0
00331 #define  MAPGRID_COORDFMTPROJ_Comma          1
00332 #define  MAPGRID_COORDFMTPROJ_Period         2
00333 #define  MAPGRID_COORDFMTPROJ_NoSpace        3
00334 #define  MAPGRID_COORDFMTPROJ_xXXxxxN        4
00335 #define  MAPGRID_COORDFMTPROJ_xXXxxx         5
00336 #define  MAPGRID_COORDFMTPROJ_xXXxxx_XX      6
00337 #define  MAPGRID_COORDFMTPROJ_xXXxxxN_XX     7
00338 #define  MAPGRID_COORDFMTPROJ_xXXxxxNp_XX    8
00339 
00340 #define  MAPGRID_COORDORIENT_Horizontal      0
00341 #define  MAPGRID_COORDORIENT_Parallel        1
00342 #define  MAPGRID_COORDORIENT_Perpendicular   2
00343 #define  MAPGRID_COORDORIENT_AlongTick       3
00344 #define  MAPGRID_COORDORIENT_Vertical        4
00345 
00346 #define  MAPGRID_VERTICALAXES_None           0
00347 #define  MAPGRID_VERTICALAXES_Farthest1      1
00348 #define  MAPGRID_VERTICALAXES_Farthest2      2
00349 #define  MAPGRID_VERTICALAXES_Farthest3      3
00350 #define  MAPGRID_VERTICALAXES_All            4
00351 
00352 
00353 //===================================================================================================================
00354 
00355 #endif   //!< INC_GRE_LRMAPGRD_H

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