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
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 #ifndef INC_GRE_GROUP_H
00167 #define INC_GRE_GROUP_H
00168
00169 #ifndef INC_GRE_VIEWABLE_H
00170 #include <gre/viewable.h>
00171 #endif
00172
00173 #ifndef INC_GRE_LAYER_H
00174 #include <gre/layer.h>
00175 #endif
00176
00177 #ifndef INC_MI32_MATTE_H
00178 #include <mi32/matte.h>
00179 #endif
00180
00181 #ifndef INC_MI32_REGION2D_H
00182 #include <mi32/region2d.h>
00183 #endif
00184
00185 class GEOCAT_DIALOG;
00186 struct SMLCLASSMEMBER;
00187
00188 namespace GRE {
00189
00190
00191 #define GROUPFLAG_None 0x00000000
00192 #define GROUPFLAG_Ignore 0x00000001
00193 #define GROUPFLAG_NoFixAspectLL 0x00000002
00194 #define GROUPFLAG_SingleLayer 0x00000004
00195 #define GROUPFLAG_Clip 0x00000008
00196 #define GROUPFLAG_OrientMatchRasterOnly 0x00000010
00197 #define GROUPFLAG_OrientMatchRasterOther 0x00000020
00198 #define GROUPFLAG_OrientMatchLayer 0x00000040
00199 #define GROUPFLAG_3D 0x00000200
00200 #define GROUPFLAG_ShowLatLonCoords 0x00001000
00201 #define GROUPFLAG_NoLockZoom 0x00004000
00202 #define GROUPFLAG_ShowLayerList 0x00008000
00203 #define GROUPFLAG_NoClipToAttachedGroup 0x00010000
00204 #define GROUPFLAG_CombineLayersInLegend 0x00020000
00205 #define GROUPFLAG_TemplateSaveLayersAsIs 0x00040000
00206 #define GROUPFLAG_NoClipToRectOnly 0x00080000
00207 #define GROUPFLAG_NoLegacyRectExtents 0x00100000
00208 #define GROUPFLAG_CreatedBySML 0x00200000
00209
00210 #define GROUPFLAG_OrientMask 0x00000070
00211 #define GROUPFLAG_NoNotifyMask GROUPFLAG_TemplateSaveLayersAsIs
00212 #define GROUPFLAG_Mask_NoRedraw (GROUPFLAG_ShowLatLonCoords | GROUPFLAG_NoLockZoom | GROUPFLAG_ShowLayerList | GROUPFLAG_CombineLayersInLegend | GROUPFLAG_TemplateSaveLayersAsIs)
00213
00214 #define ATTACHMENT_None 0
00215 #define ATTACHMENT_Left 1
00216 #define ATTACHMENT_Bottom 1
00217 #define ATTACHMENT_Center 2
00218 #define ATTACHMENT_Right 3
00219 #define ATTACHMENT_Top 3
00220 #define ATTACHMENT_Geographic 4
00221
00222 #define ATTACHREF_None 0
00223 #define ATTACHREF_Group 1
00224 #define ATTACHREF_Page 2
00225 #define ATTACHREF_Margin 3
00226
00227
00228 class GROUP : public GRE::VIEWABLE, public SERIALIZABLE {
00229
00230 public:
00231
00232
00233 enum CREATEFLAGS {
00234 CREATEFLAG_None = 0x0000,
00235 CREATEFLAG_NoCallCreateCB = 0x0001,
00236 CREATEFLAG_Temporary = 0x0002,
00237 CREATEFLAG_3D = 0x0004,
00238 CREATEFLAG_NoAutoMatch = 0x0008,
00239 CREATEFLAG_NoSetActive = 0x0010,
00240 CREATEFLAG_DeferCreate = 0x0020,
00241 CREATEFLAG_SML = 0x0040
00242 };
00243
00244 enum ORIENTATION_BASE {
00245 ORIENTATION_BASE_Projection = 0,
00246 ORIENTATION_BASE_North = 1
00247 };
00248
00249 enum LABEL_MANAGEMENT_MODE {
00250 LABEL_MANAGEMENT_MODE_RenderWithLayer = 0,
00251 LABEL_MANAGEMENT_MODE_RenderLast
00252 };
00253
00254
00255 enum EXTENTCOORD {
00256 EXTENTCOORD_Group,
00257 EXTENTCOORD_Layout,
00258 EXTENTCOORD_View
00259 };
00260
00261
00262 struct POSN {
00263 GROUP *refgroup;
00264 UINT8 AttachRefType;
00265 UINT8 AttachmentThis;
00266 UINT8 AttachmentRef;
00267 UINT8 PosnSet;
00268 double offset;
00269 mutable MISTRING m_RefGroupName;
00270 POSN ();
00271 ~POSN ();
00272 void Clear ();
00273 };
00274
00275 GRE::LAYER *firstlayer;
00276 GRE::LAYER *lastlayer;
00277 GRE::LAYER *activelayer;
00278 GRE::LAYER *matchedlayer;
00279 UINT8 RotBase;
00280 double AspectX;
00281 double AspectY;
00282 double RotAngle;
00283 double zinit;
00284 double zlast;
00285 GROUP *prevgroup;
00286 GROUP *nextgroup;
00287 GRE::LAYOUT *layout;
00288 UINT32 groupflags;
00289 POSN xposn, yposn;
00290 GRE::VIEWPOINT3D *m_ViewPoint3D;
00291 UINT32 VisibleViewLayout;
00292
00293 #ifdef X_NATIVE
00294
00295 static GROUP* GetFromWidget (
00296 Widget w
00297 );
00298 #endif
00299
00300
00301 static void SMLClassInstall (
00302 SMLCONTEXT *context
00303 );
00304
00305
00306 explicit GROUP (
00307 CREATEFLAGS createflags = CREATEFLAG_None
00308 );
00309
00310
00311 GROUP (
00312 GRE::LAYOUT *layout,
00313 CREATEFLAGS createflags = CREATEFLAG_None,
00314 GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00315 GROUP *refgroup = 0
00316 );
00317
00318
00319 virtual ~GROUP ();
00320
00321
00322 bool AdjLatLon (
00323 );
00324
00325
00326 bool AdjLatLonCanSet (
00327 );
00328
00329
00330 bool ChangeListPos (
00331 GROUP* refgroup,
00332 GRE::LISTPOS listpos
00333 );
00334
00335
00336 ERRVALUE CheckAddLayer (
00337 GRE::LAYER::TYPE layertype = GRE::LAYER::TYPE_None
00338 ) const;
00339
00340
00341 void CheckGeorefCompatible (
00342 ) const;
00343
00344
00345 void ComputeLayoutExtents (
00346 );
00347
00348
00349 ERRVALUE ComputeMapExtents (
00350 );
00351
00352 ERRVALUE ComputeRegionFromLayers (
00353 REGION2D& region,
00354 bool IncludeMargins,
00355 GRE::LAYER::FILTER *filter = 0
00356 ) const;
00357
00358 #ifndef GENERATING_DOXYGEN_OUTPUT
00359
00360 GRE::GROUPVIEW* ConstructGroupView (
00361 GRE::VIEW *view
00362 );
00363 #endif
00364
00365
00366 void Create (
00367 CREATEFLAGS createflags = CREATEFLAG_None
00368 );
00369
00370
00371 void DestroyAllLayers (
00372 );
00373
00374
00375 void DestroyLayer (
00376 GRE::LAYER* layer
00377 );
00378
00379
00380 ERRVALUE DrawActiveOverlay (
00381 GRE::DRAWFLAGS DrawFlags = GRE::DRAWFLAG_UpdateScreen,
00382 GRE::VIEW *view = 0
00383 );
00384
00385 #if defined(X_NATIVE) || defined(WIN32_MFC)
00386
00387 ERRVALUE DlgGetClipSettings (
00388 MDLGPARENT dlgparent
00389 );
00390 #endif
00391
00392
00393 virtual GRE::LAYER *FindLayerByID (
00394 UINT32 LayerID
00395 ) const;
00396
00397
00398 ERRVALUE GeoCatDlgOpen (
00399 MDLGPARENT dlgparent
00400 );
00401
00402
00403 void GeoCatDlgSetSearchPoint (
00404 const DPOINT2D& SearchPoint,
00405 const SPATREF::COORDREFSYS& PointCRS
00406 ) const;
00407
00408
00409
00410 GRE::LAYER* GetActiveLayer (
00411 ) const { return (activelayer); }
00412
00413
00414 const REGION2D& GetClipRegion (
00415 ) const;
00416
00417
00418 bool GetClipToMatchedLayer (
00419 ) const { return (m_ClipToMatchedLayer); }
00420
00421
00422 ERRVALUE GetExtents (
00423 DRECT2D& extents,
00424 EXTENTCOORD coords
00425 );
00426
00427
00428 GRE::LAYER* GetFirstLayer (
00429 ) const { return (firstlayer); }
00430
00431
00432 UINT32 GetFlags (
00433 ) const { return (groupflags); }
00434
00435
00436 virtual void GetFullName (
00437 MISTRING& name
00438 ) const;
00439
00440 const REGION2D& GetFullRegion (
00441 ) const { return (m_FullRegion); }
00442
00443 LABEL_MANAGEMENT_MODE GetLabelManagementMode (
00444 ) const { return (m_LabelManagementMode); }
00445
00446
00447 GRE::LAYER* GetLastLayer (
00448 ) const { return (lastlayer); }
00449
00450
00451 GRE::LAYER* GetLayerZoom1X (
00452 bool PreferredOnly
00453 ) const;
00454
00455
00456
00457 GRE::LAYOUT * GetLayout (
00458 ) const { return (layout); }
00459
00460 const DRECT2D& GetLayoutExtents (
00461 ) const { return (m_LayoutExtents); }
00462
00463
00464
00465 int GetListPos (
00466 );
00467
00468
00469 GROUP* GetMatchedGroup (
00470 bool firstonly = false
00471 ) const;
00472
00473 MATTE& GetMatte (
00474 ) { return (m_Matte); }
00475
00476
00477 UINT32 GetMutualExclusiveGroupSet (
00478 ) const { return (m_MutualExclusiveGroupSet); }
00479
00480
00481 const MISTRING& GetName (
00482 ) const { return (m_name); }
00483
00484
00485 bool GetNeedUpdateExtents (
00486 ) const { return (m_NeedUpdateExtents); }
00487
00488
00489 GROUP* GetNext (
00490 ) const { return (nextgroup); }
00491
00492
00493 virtual UINT32 GetNextLayerID (
00494 ) const;
00495
00496
00497 GROUP* GetPrevious (
00498 ) const { return (prevgroup); }
00499
00500
00501 double GetRelativeScale (
00502 ) const { return (m_RelativeScale); }
00503
00504
00505 double GetRotationAngle (
00506 ) const { return (RotAngle); }
00507
00508
00509
00510 SERIALIZER* GetSerializer (
00511 ) const { return (m_pSerializer); }
00512
00513
00514 virtual ERRVALUE GetSizeMeters (
00515 DPOINT2D& sizemeters
00516 );
00517
00518
00519 const TRANS2D_AFFINE& GetTransViewToGroup (
00520 ) const { return (m_ViewToGroup); }
00521
00522
00523 const SPATREF::COORDREFSYS& GetUsedCoordRefSys (
00524 ) const;
00525
00526 GRE::VIEWPOINT3D* GetViewPoint3D (
00527 ) const { return (m_ViewPoint3D); }
00528
00529
00530 UINT32 GetVisible (
00531 ) const { return (this->VisibleViewLayout); }
00532
00533
00534 void GetVisibleScaleRange (
00535 double& MinScaleVisible,
00536 double& MaxScaleVisible
00537 ) { MinScaleVisible = m_MinScaleVisible; MaxScaleVisible = m_MaxScaleVisible; return; }
00538
00539
00540 bool HasAttachedGroups (
00541 ) const;
00542
00543
00544 bool HasHighlightableLayer (
00545 GRE::VIEW *view = 0
00546 ) const;
00547
00548
00549 virtual bool HasLayers (
00550 ) const;
00551
00552
00553 bool HasLegend (
00554 ) const { return ((this->groupflags & GROUPFLAG_CombineLayersInLegend) != 0); }
00555
00556
00557 bool HasMutuallyExclusiveLayers (
00558 ) const { return (m_HasMutuallyExclusiveLayers); }
00559
00560
00561 bool HasTempLayers (
00562 ) const;
00563
00564
00565 void HighlightSetupDefault (
00566 GRE::VIEW *view = 0
00567 );
00568
00569
00570 void InvalidateAllViews (
00571 GRE::RENDERTARGET Target = GRE::RENDERTARGET_GroupAll | GRE::RENDERTARGET_LayerAll
00572 );
00573
00574
00575 bool Is3D (
00576 ) const { return (!layout || (groupflags & GROUPFLAG_3D)); }
00577
00578 bool IsBeingLoaded (
00579 ) const { return (m_pSerializer != 0); }
00580
00581
00582 bool IsClipped (
00583 ) const;
00584
00585
00586 bool IsClippedToMatchedLayer (
00587 ) const { return (m_ClipToMatchedLayer && GetMatchedLayer() != 0); }
00588
00589
00590
00591 bool IsCreated (
00592 ) const { return (m_IsCreated); }
00593
00594
00595 bool IsIgnored (
00596 ) const;
00597
00598
00599 bool IsSingleLayer (
00600 ) const { return ((groupflags & GROUPFLAG_SingleLayer) != 0); }
00601
00602
00603 bool IsValid (
00604 ) const;
00605
00606
00607 bool IsVisibleAtScale (
00608 double scale
00609 ) const { return (!layout || (scale >= m_MinScaleVisible && (m_MaxScaleVisible <= 0.0 || scale <= m_MaxScaleVisible))); }
00610
00611
00612 bool IsVisibleInView (
00613 const GRE::VIEW *view
00614 ) const;
00615
00616
00617 virtual ERRVALUE SerialRead (
00618 SERIALIZER& serializer
00619 );
00620
00621
00622 virtual ERRVALUE SerialWrite (
00623 SERIALIZER& serializer,
00624 const char *tagname = 0
00625 ) const;
00626
00627
00628 void Set2D (
00629 );
00630
00631
00632 void SetActiveLayer (
00633 GRE::LAYER *layer
00634 );
00635
00636
00637 void SetClipRect (
00638 const DRECT2D& ClipRect,
00639 const SPATREF::COORDREFSYS& RectCRS,
00640 bool notify = true
00641 );
00642
00643
00644
00645
00646
00647
00648
00649
00650 void SetClipToMatchedLayer (
00651 bool ClipToMatchedLayer,
00652 bool notify = true
00653 );
00654
00655
00656 void SetFlags (
00657 UINT32 flags,
00658 UINT32 mask
00659 );
00660
00661 void SetLabelManagementMode (
00662 LABEL_MANAGEMENT_MODE mode
00663 ) { m_LabelManagementMode = mode; }
00664
00665
00666 void SetListPos (
00667 int newpos
00668 );
00669
00670
00671 void SetMatte (
00672 const MATTE& matte,
00673 bool notify = true
00674 );
00675
00676
00677 void SetModified (
00678 bool notify = true,
00679 bool ViewsNeedRedraw = true
00680 );
00681
00682
00683 void SetMutualExclusiveGroupSet (
00684 UINT32 GroupSet
00685 );
00686
00687
00688 void SetMutuallyExclusiveLayers (
00689 bool LayersMutuallyExclusive = true
00690 );
00691
00692
00693 ERRVALUE SetName (
00694 const MISTRING& newname
00695 );
00696
00697
00698 void SetNeedUpdateExtents (
00699 ) { m_NeedUpdateExtents = true; }
00700
00701
00702 void SetOrientation (
00703 UINT8 NewRotBase,
00704 double NewRotAngle
00705 ) { RotBase = NewRotBase; RotAngle = NewRotAngle; }
00706
00707
00708 void SetProjView (
00709 const GRE::LAYER *layer
00710 );
00711
00712
00713 void SetRelativeScale (
00714 double RelativeScale,
00715 bool notify = true
00716 );
00717
00718
00719 ERRVALUE SetRenderCoordRefSys (
00720 const SPATREF::COORDREFSYS& RenderCRS
00721 );
00722
00723
00724 ERRVALUE SetupEquirectangular (
00725 SPATREF::COORDREFSYS& CoordRefSys,
00726 const DPOINT2D& center
00727 ) const;
00728
00729
00730 void SetVisible (
00731 UINT32 flags,
00732 bool set
00733 );
00734
00735
00736 void SetVisibleScaleRange (
00737 double MinScaleVisible,
00738 double MaxScaleVisible
00739 ) { m_MinScaleVisible = MinScaleVisible; m_MaxScaleVisible = MaxScaleVisible; }
00740
00741
00742 void SetVisibleView (
00743 GRE::VIEW *view,
00744 bool visible
00745 );
00746
00747
00748 ERRVALUE TemplateWrite (
00749 SERIALIZER& serializer,
00750 const char *tagname = 0
00751 );
00752
00753 protected:
00754 #ifndef GENERATING_DOXYGEN_OUTPUT
00755 static const SMLCLASSMEMBER* GetSMLClassMembers();
00756 #endif
00757
00758 private:
00759
00760 #ifndef GENERATING_DOXYGEN_OUTPUT
00761
00762 #ifdef X_NATIVE
00763 GEOCAT_DIALOG *m_GeoCatDlg;
00764 #endif
00765
00766 SERIALIZER *m_pSerializer;
00767 bool m_IsCreated;
00768 bool m_NeedUpdateExtents;
00769 double m_MinScaleVisible;
00770 double m_MaxScaleVisible;
00771 double m_DesignScale;
00772 double m_RelativeScale;
00773 mutable MISTRING m_ActiveLayerName;
00774 bool m_ClipToMatchedLayer;
00775 bool m_HasMutuallyExclusiveLayers;
00776 GRE::HIGHLIGHTMODE m_ElemHighlightMode;
00777 UINT32 m_MutualExclusiveGroupSet;
00778 MATTE m_Matte;
00779 MISTRING m_name;
00780 SPATREF::COORDREFSYS m_RenderCRS;
00781 REGION2D m_ClipRegion;
00782 REGION2D m_FullRegion;
00783 TRANS2D_AFFINE m_ViewToGroup;
00784 DRECT2D m_LayoutExtents;
00785 LABEL_MANAGEMENT_MODE m_LabelManagementMode;
00786
00787 static void GRECB_Group (
00788 const GRE::MSG *msg,
00789 void *vgroup
00790 );
00791
00792 static const SERIALIZERITEM* SerialGetItemDef (
00793 SERIALIZER& serializer
00794 );
00795
00796 static ERRVALUE SerializerCB_OldClipProj (SERIALIZER&, const SERIALIZERITEM*, void *vgroup, SERIALIZERITEM::ACTION);
00797 static ERRVALUE SerializerCB_OldClipRect (SERIALIZER&, const SERIALIZERITEM*, void *vgroup, SERIALIZERITEM::ACTION);
00798 static ERRVALUE SerializerCB_OldGroupFlags (SERIALIZER&, const SERIALIZERITEM*, void *vgroup, SERIALIZERITEM::ACTION);
00799
00800 void Init ();
00801
00802
00803 GRE::LAYER *GetMatchedLayer () const;
00804
00805
00806 virtual bool v_Destroy (bool NotifyParent);
00807 virtual MICONSTRUCT* v_GetIcon () const;
00808 virtual const char* v_GetTypeName () const;
00809
00810
00811 virtual ERRVALUE v_DrawAllViews (GRE::DRAWCONDITION condition);
00812 virtual double v_GetDesignScale () const;
00813 virtual const DRECT2D& v_GetExtents () const;
00814 virtual double v_GetMaxScaleVisibleAny () const;
00815 virtual double v_GetMinScaleVisibleAny () const;
00816 virtual void v_SetDesignScale (double DesignScale, bool notify);
00817
00818 GROUP (const GROUP&);
00819 GROUP& operator= (const GROUP&);
00820
00821 friend class GRE::LAYOUT;
00822
00823 #endif
00824 };
00825
00826 DEFINE_ENUM_OP_BITWISE(GROUP::CREATEFLAGS)
00827
00828
00829
00830 }
00831
00832 #endif