00001
00134 #ifndef INC_GRE_LAYOUT_H
00135 #define INC_GRE_LAYOUT_H
00136
00137 #ifndef INC_GRE_GROUP_H
00138 #include <gre/group.h>
00139 #endif
00140
00141 #ifndef INC_MI32_MPLAYOUT_H
00142 #include <mi32/mplayout.h>
00143 #endif
00144
00145
00146 #define POSNMODE_Tiled 0
00147 #define POSNMODE_Overlapped 1
00148 #define POSNMODE_MapLayout 2
00149
00150 #define GRE_WorldRangeFP 1000000.0
00151
00152 namespace GRE {
00153
00154
00155 class LAYOUT : public GRE::VIEWABLE, public SERIALIZABLE {
00156
00157 public:
00158
00160 enum CREATEFLAGS {
00161 CREATEFLAG_None = 0x0000,
00162 CREATEFLAG_NoCallCreateCB = 0x0001,
00163 CREATEFLAG_Temporary = 0x0002,
00164 CREATEFLAG_Hardcopy = 0x0010,
00165 CREATEFLAG_DeferCreate = 0x0020
00166 };
00167
00169 static void SMLClassInstall (
00170 SML::CONTEXT *context
00171 );
00172
00174 explicit LAYOUT (
00175 CREATEFLAGS flags = CREATEFLAG_None
00176 );
00177
00179 virtual ~LAYOUT ();
00180
00181 #ifdef USE_MGUI
00184 ERRVALUE AddGroupLayer (
00185 MDLGPARENT dlgparent,
00186 GRE::LAYER::TYPE layertype,
00187 GRE::LAYER **player = 0
00188 );
00189 #endif
00190
00191 #ifdef USE_MGUI
00193 ERRVALUE AddGroupMulti (
00194 MDLGPARENT dlgparent
00195 );
00196 #endif
00197
00198 #ifdef USE_MGUI
00200 int AddGroupSaved (
00201 MDLGPARENT dlgparent,
00202 bool fromtext
00203 );
00204 #endif
00205
00207 void Create (
00208 CREATEFLAGS createflags = CREATEFLAG_None
00209 );
00210
00212 ERRVALUE CreateGroup (
00213 GRE::GROUP **retgroup = 0,
00214 GRE::GROUP::CREATEFLAGS createflags = GRE::GROUP::CREATEFLAG_None,
00215 GRE::LISTPOS listpos = GRE::LISTPOS_After,
00216 GRE::GROUP *refgroup = 0
00217 );
00218
00221 void DestroyAllGroups (
00222 );
00223
00225 virtual GRE::LAYER *FindLayerByID (
00226 UINT32 LayerID
00227 ) const;
00228
00230 GRE::GROUP* FindPointGroup (
00231 const DPOINT2D& point,
00232 GRE::FINDFLAGS findflags,
00233 const SPATREF::COORDREFSYS *pPointCRS = NULL
00234 ) const;
00235
00237 GRE::GROUP* GetActiveGroup (
00238 ) const { return (m_ActiveGroup); }
00239
00241 GRE::GROUP* GetFirstGroup (
00242 ) const { return (m_FirstGroup); }
00243
00245 virtual void GetFullName (
00246 MISTRING& name
00247 ) const;
00248
00250 double GetHardcopyDPI (
00251 ) const { return (m_HardcopyLayout.dpi); }
00252
00254 DRECT2D GetHardcopyMarginRect (
00255 ) const;
00256
00258 DRECT2D GetHardcopyPageRect (
00259 ) const;
00260
00262 DRECT2D GetHardcopyPrintableRect (
00263 ) const;
00264
00266 double GetHardcopyScale (
00267 ) const { return (m_HardcopyLayout.Scale); }
00268
00270 const LAYOUTPARMS& GetHardcopyValues (
00271 ) const { return (m_HardcopyLayout); }
00272
00274 double GetHardcopyZoom (
00275 ) const { return (m_HardcopyLayout.Zoom); }
00276
00278 GRE::GROUP* GetLastGroup (
00279 ) const { return (m_LastGroup); }
00280
00282 MATTE& GetMatte (
00283 ) { return (m_Matte); }
00284
00286 const MISTRING& GetName (
00287 ) const { return (m_name); }
00288
00290 LAYOUT* GetNext (
00291 ) const { return (m_NextLayout); }
00292
00294 virtual UINT32 GetNextLayerID (
00295 ) const;
00296
00298 UINT8 GetPosnMode (
00299 ) const { return (m_PosnMode); }
00300
00302 const MISTRING& GetSavedLocations (
00303 ) const { return (m_SavedLocations); }
00304
00306 virtual ERRVALUE GetSizeMeters (
00307 DPOINT2D& sizemeters
00308 );
00309
00311 bool GroupControlsGetAutoRedraw (
00312 ) const;
00313
00315 int GroupControlsGetLayoutUnits (
00316 ) const;
00317
00319 bool GroupControlsIsOpen (
00320 ) const;
00321
00325 void GroupControlsOpen (
00326 MDLGPARENT dlgparent = 0,
00327 GRE::GROUP* group = 0,
00328 UINT32 flags = 0
00329 );
00330
00340 void GroupControlsSetPrompts (
00341 double hoffset,
00342 double hsize,
00343 double voffset,
00344 double vsize,
00345 double relscale
00346 );
00347
00349 void GroupControlsSetTabLayout (
00350 );
00351
00353 virtual bool HasLayers (
00354 ) const;
00355
00357 bool HasTempLayers (
00358 ) const;
00359
00361 void InvalidateAllViews (
00362 );
00363
00365 bool IsBeingLoaded (
00366 ) const { return (m_pSerializer != 0); }
00367
00370 bool IsCreated (
00371 ) const { return (m_IsCreated); }
00372
00374 bool IsHardcopy (
00375 ) const { return (m_PosnMode == POSNMODE_MapLayout); }
00376
00378 bool IsSortLegendNatural (
00379 ) const { return (m_SortLegendNatural); }
00380
00382 bool IsValid (
00383 ) const;
00384
00386 bool KeepInTNTserverCache (
00387 ) const { return (m_KeepInTNTserverCache); }
00388
00390 virtual ERRVALUE SerialRead (
00391 SERIALIZER& serializer
00392 );
00393
00395 virtual ERRVALUE SerialWrite (
00396 SERIALIZER& serializer,
00397 const char *tagname = 0
00398 ) const;
00399
00401 void SetActiveGroup (
00402 GRE::GROUP *group
00403 );
00404
00406 void SetHardcopyValues (
00407 const LAYOUTPARMS& values,
00408 bool notify = true
00409 );
00410
00412 void SetKeepInTNTserverCache (
00413 bool keepInTNTserverCache
00414 ) {
00415 if (m_KeepInTNTserverCache != keepInTNTserverCache) m_IsModified = true;
00416 m_KeepInTNTserverCache = keepInTNTserverCache;
00417 }
00418
00420 void SetMatte (
00421 const MATTE& matte,
00422 bool notify = true
00423 );
00424
00426 void SetModified (
00427 bool notify = true,
00428 bool ViewsNeedRedraw = true
00429 );
00430
00432 ERRVALUE SetName (
00433 const MISTRING& newname
00434 );
00435
00437 void SetNeedUpdatePositions (
00438 ) { m_NeedUpdatePositions = 1; }
00439
00441 void SetPosnMode (
00442 UINT8 posnmode
00443 );
00444
00446 void SetSavedLocations (
00447 const MISTRING& string
00448 ) { m_SavedLocations = string; }
00449
00451 int SetZoomToFitPage (
00452 );
00453
00455 ERRVALUE TemplateRead (
00456 SERIALIZER& serializer
00457 );
00458
00460 ERRVALUE TemplateWrite (
00461 SERIALIZER& serializer
00462 );
00463
00465 int UpdatePositions (
00466 bool ForceUpdate = true
00467 );
00468
00470 void ValidateGroupAttachments (
00471 );
00472
00473 #ifndef GENERATING_DOXYGEN_OUTPUT
00474 protected:
00475 static const SML::CLASSMEMBER* GetSMLClassMembers (
00476 );
00477
00478 private:
00479
00480 static const SERIALIZERITEM* SerialGetItemDef (
00481 SERIALIZER& serializer
00482 );
00483
00484 static ERRVALUE SerializerCB_Group (
00485 SERIALIZER& serializer,
00486 const SERIALIZERITEM*,
00487 void *vlayout,
00488 SERIALIZERITEM::ACTION action
00489 );
00490
00491 static ERRVALUE TemplateCB_Group (
00492 SERIALIZER& serializer,
00493 const SERIALIZERITEM*,
00494 void *vlayout,
00495 SERIALIZERITEM::ACTION action
00496 );
00497
00498 static const SERIALIZERITEM* TemplateGetItemDef (
00499 );
00500
00501 GRE::GROUP *m_FirstGroup;
00502 GRE::GROUP *m_LastGroup;
00503 UINT8 m_PosnMode;
00504 LAYOUTPARMS m_HardcopyLayout;
00505 double m_PosnScale;
00506 DRECT2D m_FullExtents;
00507 GRE::GROUP* m_ActiveGroup;
00508 LAYOUT *m_PrevLayout;
00509 LAYOUT *m_NextLayout;
00510 bool m_IsCreated;
00511 bool m_NeedUpdatePositions;
00512 bool m_KeepInTNTserverCache;
00513 bool m_SortLegendNatural;
00514 SERIALIZER *m_pSerializer;
00515 INT32 m_tilecols;
00516 INT32 m_tilerows;
00517 MISTRING m_name;
00518 mutable MISTRING m_activegroupname;
00519 MATTE m_Matte;
00520 MISTRING m_SavedLocations;
00521
00522
00523 ERRVALUE CreateGroupNoNotify (
00524 GRE::GROUP **retgroup = 0,
00525 GRE::GROUP::CREATEFLAGS createflags = GRE::GROUP::CREATEFLAG_None,
00526 GRE::LISTPOS listpos = GRE::LISTPOS_After,
00527 GRE::GROUP *refgroup = 0
00528 );
00529
00530
00531 virtual bool v_Destroy (bool NotifyParent);
00532 virtual MICONSTRUCT* v_GetIcon () const;
00533 virtual const char* v_GetTypeName () const;
00534
00535
00536 virtual void v_Clear ();
00537 virtual ERRVALUE v_DrawAllViews (GRE::DRAWCONDITION condition);
00538 virtual GRE::LAYER* v_GetActiveLayer () const;
00539 virtual double v_GetDesignScale () const;
00540 virtual const DRECT2D& v_GetExtents () const;
00541 virtual double v_GetMaxScaleVisibleAny () const;
00542 virtual double v_GetMinScaleVisibleAny () const;
00543 virtual void v_SetDesignScale (double DesignScale, bool notify);
00544 virtual void v_UnhighlightAllElements (bool redraw);
00545
00546 LAYOUT (const LAYOUT&);
00547 LAYOUT& operator= (const LAYOUT&);
00548
00549 friend class GRE::GROUP;
00550
00551 #endif // GENERATING_DOXYGEN_OUTPUT
00552 };
00553
00554 #ifndef GENERATING_DOXYGEN_OUTPUT
00555 DEFINE_ENUM_OP_BITWISE(LAYOUT::CREATEFLAGS);
00556 #endif
00557
00559 ERRVALUE DlgEditLayoutSettings (
00560 MDLGPARENT dlgparent,
00561 LAYOUT *layout
00562 );
00563
00564
00565 }
00566
00567 #endif // INC_GRE_LAYOUT_H