00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #ifndef INC_GRE_LRMAPGRD_H
00078 #define INC_GRE_LRMAPGRD_H
00079
00080 #ifndef INC_MI32_GRE_H
00081 #include <mi32/gre.h>
00082 #endif
00083
00084
00085
00086
00087
00088 class GRE_LAYER_MAPGRID : public GRE_LAYER {
00089 public:
00090
00091 class DISPPARM : public GRE_LAYER::DISPPARM {
00092 public:
00093
00094 class DLG;
00095
00096 TEXTSTYLE CoordLabelStyle;
00097 TEXTSTYLE AxisLabelStyle;
00098 double xinterval;
00099 double yinterval;
00100 double zinterval;
00101 double xdegrees;
00102 double ydegrees;
00103 SPATREF::COORDREFSYS IntervalCRS;
00104 SPATREF::COORDREFSYS ExtentsCRS;
00105 DRECT3D MapExtents;
00106 UINT8 IntervalUnitsXY;
00107 UINT8 IntervalUnitsZ;
00108 UINT8 IntervalLatLonFormat;
00109 UINT8 ExtentsUnits;
00110 UINT8 ExtentsLatLonFormat;
00111 LINESTYLE StyleGrid;
00112 LINESTYLE StyleBorder;
00113 LINESTYLE StyleBorderTickExt;
00114 LINESTYLE StyleInteriorTick;
00115 COLOR BorderTickIntColor1;
00116 COLOR BorderTickIntColor2;
00117 COLOR InteriorTickColor2;
00118 double GridWidth;
00119 double BorderWidth;
00120 double BorderTickExtWidth;
00121 double BorderTickExtLength;
00122 double BorderTickIntWidth;
00123 double BorderTickIntLength;
00124 double InteriorTickWidth;
00125 double InteriorTickLength;
00126 double BorderTextOffset;
00127 double GraphicMapScale;
00128 UINT8 GridWidthUnits;
00129 UINT8 BorderWidthUnits;
00130 UINT8 BorderTickExtWidthUnits;
00131 UINT8 BorderTickExtLengthUnits;
00132 UINT8 BorderTickIntWidthUnits;
00133 UINT8 BorderTickIntLengthUnits;
00134 UINT8 InteriorTickLengthUnits;
00135 UINT8 InteriorTickWidthUnits;
00136 UINT8 BorderTextOffsetUnits;
00137 UINT32 CoordFormatLatLon;
00138 UINT32 CoordFormatProj;
00139 UINT8 OldProjUnits;
00140 UINT8 VerticalAxes;
00141 UINT8 CoordOrient;
00142 MIUNICODE CoordUnitNameXY[32];
00143 MIUNICODE CoordUnitNameZ[32];
00144 MIUNICODE AxisLabelX[64];
00145 MIUNICODE AxisLabelY[64];
00146 MIUNICODE AxisLabelZ[64];
00147 DOUBLE_ARRAY<DPOINT2D> m_ToggledTickCoords;
00148
00149 DISPPARM ();
00150 DISPPARM (const DISPPARM& rhs) { Copy(rhs); }
00151 virtual ~DISPPARM () { Free(); }
00152
00153 DISPPARM& operator= (
00154 const DISPPARM& rhs
00155 ) { if (this != &rhs) { Free(); Copy(rhs); } return (*this); }
00156
00157
00158
00159
00160 void InitExtents (
00161 const GRE_LAYER_MAPGRID *layer
00162 );
00163
00164 virtual ERRVALUE Validate ();
00165
00166 protected:
00167 virtual const SERIALIZER::ITEMDEF* SerialGetItemDef (SERIALIZER& serializer) const;
00168 static int SerializerCB_TickToggledCoords (SERIALIZER& serializer, const SERIALIZER::ITEMDEF *itemdef, void *cbdata, SERIALIZER::ITEMDEF::ACTION action);
00169
00170 private:
00171 #ifndef GENERATING_DOXYGEN_OUTPUT
00172 void Copy (const DISPPARM&);
00173 void Free ();
00174 #endif
00175 };
00176
00177
00178 static void RegisterType (
00179 );
00180
00181
00182 static void SMLClassInstall (
00183 SMLCONTEXT *context
00184 );
00185
00186
00187 explicit GRE_LAYER_MAPGRID (
00188 GRE_GROUP *group,
00189 CREATEFLAGS createflags = CREATEFLAG_None,
00190 GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00191 GRE_LAYER *reflayer = 0
00192 );
00193
00194
00195 virtual ~GRE_LAYER_MAPGRID ();
00196
00197
00198 const DISPPARM& GetDispParm (
00199 ) const { return (m_dispparm); }
00200
00201
00202
00203
00204
00205
00206
00207
00208 ERRVALUE SetDispParm (
00209 const DISPPARM& dispparm
00210 );
00211
00212 protected:
00213
00214 DISPPARM m_dispparm;
00215
00216 private:
00217 #ifndef GENERATING_DOXYGEN_OUTPUT
00218
00219 class PRIVDRAWDATA;
00220 friend class PRIVDRAWDATA;
00221
00222 struct TICK {
00223 enum TYPE {
00224 TYPE_Interior = 0,
00225 TYPE_MinX = 1,
00226 TYPE_MaxX = 2,
00227 TYPE_MinY = 3,
00228 TYPE_MaxY = 4
00229 };
00230 enum FLAGS {
00231 FLAG_None = 0x00,
00232 FLAG_Lowest = 0x01,
00233 FLAG_AltColor = 0x02,
00234 FLAG_Corner = 0x04
00235 };
00236 DPOINT2D m_pt;
00237 DPOINT2D m_pt2;
00238 double m_label;
00239 TYPE m_type;
00240 FLAGS m_flags;
00241
00242 TICK (
00243 const DPOINT2D& pt,
00244 const DPOINT2D& pt2,
00245 TYPE type,
00246 FLAGS flags = FLAG_None,
00247 double label = 0
00248 );
00249 };
00250
00251 TRANS2D_MAPGEN m_TransMapToExt;
00252 DRECT2D m_GridRect;
00253 DPOINT2D m_GridInterval;
00254 SIMPLE_ARRAY<TICK> m_Ticks;
00255 int m_ActiveTick;
00256 void *m_LabelList;
00257
00258 #if defined(X_NATIVE)
00259 static void CB_ToggleTickColor (Widget, void*, void*);
00260 #endif
00261 static void SMLGET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00262 static void SMLSET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00263
00264 ERRVALUE OnToggleTickColor ();
00265 void ReadDefaultsIni ();
00266 void SaveDefaultsIni ();
00267 ERRVALUE TickAddCornerPoints ();
00268 ERRVALUE TickAddEdgePoint (const DPOINT2D& label, const DPOINT2D& pt, const DPOINT2D& pt2, TICK::TYPE type, TICK::FLAGS flags);
00269 ERRVALUE TickCalcPoints ();
00270 ERRVALUE TickLoadToggledCoords ();
00271 ERRVALUE TickSaveToggledCoords ();
00272
00273
00274 #if defined(X_NATIVE)
00275 virtual void v_AppendPopupMenuItems (Widget widget, const DPOINT2D *point, MENUITEMARRAY& menuitems);
00276 #endif
00277 virtual void v_ComputeMargins (double& tmargin, double& bmargin, double& lmargin, double& rmargin);
00278 #if defined(X_NATIVE) || defined(WIN32_MFC)
00279 virtual int v_ControlPanel (MDLGPARENT dlgparent, UINT32 flags = 0);
00280 #endif
00281 virtual GRE_LAYER* v_Copy (GRE_GROUP *group) const;
00282 virtual ERRVALUE v_Draw (GRE_LAYERDC& layerdc);
00283 virtual const char* v_SerialGetTagName () const;
00284 virtual ERRVALUE v_SerialRead (SERIALIZER& serializer);
00285 virtual void v_SetDftName (bool ReplaceExisting);
00286 virtual int v_UpdateExtents (bool forceupdate);
00287 virtual bool v_IsAntialiased ()const;
00288 virtual bool v_IsLineWidthHinted () const;
00289 virtual bool v_NeedsMEM24 (bool isHirez) const;
00290 virtual void v_SetAntialiased (bool antialias);
00291 virtual void v_SetHintThinLines (bool hint);
00292 GRE_LAYER_MAPGRID (const GRE_LAYER_MAPGRID&);
00293 GRE_LAYER_MAPGRID& operator= (const GRE_LAYER_MAPGRID&);
00294
00295 #endif
00296 };
00297
00298 #define MAPGRIDDISPFLAG_SizeRelative (0x00000001)
00299 #define MAPGRIDDISPFLAG_ShowBorderTicksExt (0x00000002)
00300 #define MAPGRIDDISPFLAG_ShowBorderTicksInt (0x00000004)
00301 #define MAPGRIDDISPFLAG_ShowGrid (0x00000010)
00302 #define MAPGRIDDISPFLAG_ShowBorderTicks (0x00000020)
00303 #define MAPGRIDDISPFLAG_ShowCoordText2D (0x00000040)
00304 #define MAPGRIDDISPFLAG_ShowBorder (0x00000080)
00305 #define MAPGRIDDISPFLAG_ShowInteriorTicks (0x00000100)
00306 #define MAPGRIDDISPFLAG_ShowCoordText3D (0x00000200)
00307 #define MAPGRIDDISPFLAG_ShowBorderBottom3D (0x00000400)
00308 #define MAPGRIDDISPFLAG_ShowBorderTop3D (0x00000800)
00309 #define MAPGRIDDISPFLAG_BorderRelative (0x00001000)
00310 #define MAPGRIDDISPFLAG_ShowVerticalTicks (0x00002000)
00311 #define MAPGRIDDISPFLAG_LayoutScale (0x00004000)
00312 #define MAPGRIDDISPFLAG_ShowVerticalScale (0x00008000)
00313 #define MAPGRIDDISPFLAG_ShowMinSec0 (0x00010000)
00314 #define MAPGRIDDISPFLAG_ShowDegOnlyIfMin0 (0x00020000)
00315 #define MAPGRIDDISPFLAG_ShowCornerText2D (0x00040000)
00316 #define MAPGRIDDISPFLAG_ShowCornerText3D (0x00080000)
00317 #define MAPGRIDDISPFLAG_Antialias (0x00100000)
00318 #define MAPGRIDDISPFLAG_HintThinLines (0x00200000)
00319
00320 #define MAPGRIDDISPFLAGS_ShowBorderTicksAny (MAPGRIDDISPFLAG_ShowBorderTicks | MAPGRIDDISPFLAG_ShowBorderTicksExt | MAPGRIDDISPFLAG_ShowBorderTicksInt)
00321
00322 #define MAPGRID_COORDFMTLATLON_MASK 0x000F
00323 #define MAPGRID_COORDFMTLATLON_DDMMSS 0x0000
00324 #define MAPGRID_COORDFMTLATLON_DDdddd 0x0001
00325 #define MAPGRID_COORDFMTLATLON_DDMMmmm 0x0002
00326 #define MAPGRID_COORDFMTLATLON_DDMMSSss 0x0003
00327 #define MAPGRID_COORDFMTLATLON_DDMMSSs 0x0004
00328 #define MAPGRID_COORDFMTLATLON_None 0x000F
00329 #define MAPGRID_COORDFMTLATLON_NoSymbol 0x0020
00330 #define MAPGRID_COORDFMTLATLON_AddSpace 0x0040
00331 #define MAPGRID_COORDFMTLATLON_Leading0Deg 0x0080
00332 #define MAPGRID_COORDFMTLATLON_Leading0MS 0x0100
00333 #define MAPGRID_COORDFMTLATLON_DirFirst 0x0200
00334 #define MAPGRID_COORDFMTLATLON_DirLast 0x0400
00335
00336 #define MAPGRID_COORDFMTPROJ_Space 0
00337 #define MAPGRID_COORDFMTPROJ_Comma 1
00338 #define MAPGRID_COORDFMTPROJ_Period 2
00339 #define MAPGRID_COORDFMTPROJ_NoSpace 3
00340 #define MAPGRID_COORDFMTPROJ_xXXxxxN 4
00341 #define MAPGRID_COORDFMTPROJ_xXXxxx 5
00342 #define MAPGRID_COORDFMTPROJ_xXXxxx_XX 6
00343 #define MAPGRID_COORDFMTPROJ_xXXxxxN_XX 7
00344 #define MAPGRID_COORDFMTPROJ_xXXxxxNp_XX 8
00345 #define MAPGRID_COORDFMTPROJ_xXXN 9
00346 #define MAPGRID_COORDFMTPROJ_xXX 10
00347
00348 #define MAPGRID_COORDORIENT_Horizontal 0
00349 #define MAPGRID_COORDORIENT_Parallel 1
00350 #define MAPGRID_COORDORIENT_Perpendicular 2
00351 #define MAPGRID_COORDORIENT_AlongTick 3
00352 #define MAPGRID_COORDORIENT_Vertical 4
00353
00354 #define MAPGRID_VERTICALAXES_None 0
00355 #define MAPGRID_VERTICALAXES_Farthest1 1
00356 #define MAPGRID_VERTICALAXES_Farthest2 2
00357 #define MAPGRID_VERTICALAXES_Farthest3 3
00358 #define MAPGRID_VERTICALAXES_All 4
00359
00360
00361
00362
00363 #endif