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 #ifndef INC_GRE_VIEWABLE_H
00094 #define INC_GRE_VIEWABLE_H
00095
00096 #if !defined(INC_MI32_STDAFX_H) && defined(WIN32_MFC)
00097 #include <mi32/stdafx.h>
00098 #endif
00099
00100 #ifndef INC_GRE_OBJECTBASE_H
00101 #include <gre/objectbase.h>
00102 #endif
00103
00104 #ifndef INC_GRE_VIEWSCRIPT_H
00105 #include <gre/viewscript.h>
00106 #endif
00107
00108 #ifndef INC_MI32_SERIALIZ_H
00109 #include <mi32/serializ.h>
00110 #endif
00111
00112 #ifndef INC_MI32_MISTRING_H
00113 #include <mi32/mistring.h>
00114 #endif
00115
00116 #ifndef INC_MI32_SIMPLEAR_H
00117 #include <mi32/simplear.h>
00118 #endif
00119
00120 #ifndef INC_MI32_MGD2_H
00121 #include <mi32/mgd2.h>
00122 #endif
00123
00124 #if defined(X_NATIVE) && !defined(INC_MI32_XDEFNS_H)
00125 #include <mi32/xdefns.h>
00126 #endif
00127
00128 #if defined(USE_MGUI) && !defined(INC_MI32_SML_H)
00129 #include <mi32/sml.h>
00130 #endif
00131
00132
00133
00134
00135 class GRE_VIEWABLE : public GRE_OBJECT {
00136 public:
00137
00138 #ifdef USE_MGUI
00139 class MAINSCRIPT : public SERIALIZABLE {
00140 public:
00141
00142 enum FUNC {
00143 FUNC_OnViewDataTipShowRequest,
00144 FUNC_OnViewDataTipShowText,
00145 FUNC_OnGroupDrawLabelsBegin,
00146 FUNC_OnGroupDrawLabelsEnd,
00147 FUNC_OnLayerDrawLabelsBegin,
00148 FUNC_OnLayerDrawLabelsEnd,
00149 FUNC_OnDrawLabel,
00150 FUNC_COUNT
00151 };
00152
00153 MAINSCRIPT (GRE_VIEWABLE *viewable);
00154 virtual ~MAINSCRIPT ();
00155 int CallFunction (
00156 FUNC func,
00157 SMLARG *ArgIn,
00158 int NumArg,
00159 SMLARG *ArgRet = 0
00160 );
00161 int CallFunction (
00162 FUNC func,
00163 int NumArg,
00164 void *ArgPtr1,
00165 void *ArgPtr2 = 0,
00166 void *ArgPtr3 = 0
00167 );
00168 void Destroy ();
00169 int DlgEdit (MDLGPARENT dlgparent);
00170 bool HasFunction (FUNC func) const;
00171 bool HasScript () const;
00172 ERRVALUE Initialize ();
00173 void Terminate ();
00174 private:
00175 class CONTEXT;
00176 GRE_VIEWABLE *m_viewable;
00177 CONTEXT *m_pContext;
00178 MISTRING m_String;
00179
00180 ERRVALUE CreateSMLContext (SMLCONTEXT *& smlcontext);
00181 static void GRECB_CtrlScript (const GRE_CALLBACK_MSG *pMsg, void *vpCtrlScript);
00182 static const SERIALIZER::ITEMDEF* SerialGetItemDef ();
00183 virtual ERRVALUE SerialRead (SERIALIZER& serializer);
00184 virtual ERRVALUE SerialWrite (SERIALIZER& serializer, const char *tagname = 0) const;
00185 friend class MAINSCRIPT::CONTEXT;
00186 };
00187 #endif
00188
00189
00190 static void SMLClassInstall (
00191 SMLCONTEXT* context
00192 );
00193
00194
00195 virtual ~GRE_VIEWABLE (
00196 );
00197
00198 #ifdef X_NATIVE
00199
00200 void ClearMacroScriptList (
00201 ) { m_MacroScripts.Clear(); }
00202 #endif
00203
00204
00205 void ClearSaveLocation (
00206 ) { m_SaveObjItem.Clear(); }
00207
00208 #ifdef X_NATIVE
00209
00210 void ClearToolScriptList (
00211 ) { m_ToolScripts.Clear(); }
00212 #endif
00213
00214
00215 ERRVALUE ControlScriptEdit (
00216 MDLGPARENT dlgparent
00217 );
00218
00219
00220 void DestroyAllViews (
00221 );
00222
00223 #ifdef X_NATIVE
00224 void DlgObjMgrClose (
00225 ) { v_DlgObjMgrClose(); }
00226
00227 ERRVALUE DlgObjMgrCreate (
00228 MDLGPARENT dlgparent
00229 ) { return (v_DlgObjMgrCreate(dlgparent,MISTRING::GetEmpty())); }
00230
00231 ERRVALUE DlgObjMgrCreate (
00232 MDLGPARENT dlgparent,
00233 const MISTRING& title
00234 ) { return (v_DlgObjMgrCreate(dlgparent,title)); }
00235
00236 void DlgObjMgrDestroy (
00237 ) { v_DlgObjMgrDestroy(); }
00238
00239 bool DlgObjMgrIsOpen (
00240 ) const { return (v_DlgObjMgrIsOpen()); }
00241
00242 void DlgObjMgrOpen (
00243 ) { v_DlgObjMgrOpen(); }
00244 #endif
00245
00246
00247 ERRVALUE DrawAllViews (
00248 GRE::DRAWCONDITION condition = GRE::DRAWCONDITION_Always
00249 ) { return (v_DrawAllViews(condition)); }
00250
00251 #ifdef USE_MGUI
00252
00253 MAINSCRIPT& GetControlScript (
00254 ) { return (m_CtrlScript); }
00255 #endif
00256
00257
00258 const DRECT2D& GetExtents (
00259 ) const { return (v_GetExtents()); }
00260
00261
00262 virtual GRE_LAYER *FindLayerByID (
00263 UINT32 LayerID
00264 ) const = 0;
00265
00266
00267 double GetDesignScale (
00268 ) const { return (v_GetDesignScale()); }
00269
00270
00271 MDLGPARENT GetDialogParent (
00272 ) const { return (m_DialogParent); }
00273
00274
00275 GRE::HIGHLIGHTMODE GetElemHighlightMode (
00276 ) const { return (GetTopViewable()->m_ElemHighlightMode); }
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287 GRE_VIEW* GetFirstView (
00288 ) const;
00289
00290
00291 virtual void GetFullName (
00292 MISTRING& name
00293 ) const = 0;
00294
00295
00296 const char* GetIniName (
00297 ) const { return (m_IniName); }
00298
00299 #ifdef X_NATIVE
00300
00301 GRE::MACROSCRIPTLIST& GetMacroScriptList (
00302 ) { return (m_MacroScripts); }
00303 #endif
00304
00305
00306 virtual UINT32 GetNextLayerID (
00307 ) const = 0;
00308
00309
00310 const FILEPATH& GetSaveFilePath (
00311 ) const { return (m_SaveObjItem.GetFilePath()); }
00312
00313
00314 const RVC::OBJITEM& GetSaveObjItem (
00315 ) const { return (m_SaveObjItem); }
00316
00317
00318 bool GetShowInternalTables (
00319 ) const { return (m_ShowInternalTables); }
00320
00321
00322 bool GetShowScaleRanges (
00323 ) const { return (m_ShowScaleRanges); }
00324
00325
00326 virtual ERRVALUE GetSizeMeters (
00327 DPOINT2D& sizemeters
00328 ) = 0;
00329
00330 #ifdef X_NATIVE
00331
00332 GRE::TOOLSCRIPTLIST& GetToolScriptList (
00333 ) { return (m_ToolScripts); }
00334 #endif
00335
00336
00337 const GRE_VIEWABLE* GetTopViewable (
00338 ) const;
00339
00340
00341 GRE_VIEWABLE* GetTopViewable (
00342 );
00343
00344
00345
00346 GRE_VIEW* GetView (
00347 int ViewNum
00348 ) const;
00349
00350
00351 virtual bool HasLayers (
00352 ) const = 0;
00353
00354
00355 bool HasSaveLocation (
00356 ) const;
00357
00358
00359 bool IsModified (
00360 ) const { return (m_IsModified); }
00361
00362 #ifdef X_NATIVE
00363
00364
00365 Widget ObjMgrCreate (
00366 Widget pwidget,
00367 Arg *arglist,
00368 int argcount
00369 );
00370 #endif
00371
00372 #ifdef X_NATIVE
00373
00374 Widget ObjMgrGetContainer (
00375 ) const { return (m_ObjMgrRC); }
00376 #endif
00377
00378 #ifdef X_NATIVE
00379
00380 void ObjMgrMakeVisible (
00381 Widget widget
00382 );
00383 #endif
00384
00385 #ifdef X_NATIVE
00386
00387
00388 short ObjMgrSetPosition (
00389 Widget widget,
00390 short newindex
00391 );
00392 #endif
00393
00394
00395 ERRVALUE RenderToRaster (
00396 RVC::OBJITEM& objitem,
00397 COLORSPACE colorspace,
00398 INT32 rastcols,
00399 INT32 rastlins,
00400 double cellsize,
00401 const COLOR& bgcolor,
00402 int viewnum = 1,
00403 bool savegeoref = true,
00404 const SIMPLE_ARRAY<COLOR>* pColors = 0,
00405 const DRECT2D *pRect = 0,
00406 MGD::PIXEL *pFallbackPixel = 0
00407 );
00408
00409
00410 void ResetModified (
00411 ) { m_IsModified = false; }
00412
00413
00414 void SetDesignScale (
00415 double DesignScale,
00416 bool notify = true
00417 ) { v_SetDesignScale(DesignScale,notify); }
00418
00419
00420 void SetDialogParent (
00421 MDLGPARENT DialogParent
00422 ) { m_DialogParent = DialogParent; }
00423
00424
00425 void SetElemHighlightMode (
00426 GRE::HIGHLIGHTMODE HighlightMode
00427 );
00428
00429
00430 void SetIniBase (
00431 const char* name
00432 );
00433
00434 #ifdef X_NATIVE
00435 void SetMacroScriptList (
00436 const GRE::MACROSCRIPTLIST& ScriptList
00437 ) { m_MacroScripts = ScriptList; m_IsModified = true; }
00438 #endif
00439
00440
00441
00442 void SetSaveFilePath (
00443 const FILEPATH& SaveFilePath
00444 );
00445
00446
00447 void SetSaveObjItem (
00448 const RVC::OBJITEM& SaveObjItem
00449 ) { m_SaveObjItem = SaveObjItem; }
00450
00451
00452 void SetShowInternalTables (
00453 bool ShowInternalTables
00454 );
00455
00456
00457 void SetShowScaleRanges (
00458 bool ShowScaleRanges
00459 );
00460
00461 #ifdef X_NATIVE
00462 void SetToolScriptList (
00463 const GRE::TOOLSCRIPTLIST& ScriptList
00464 ) { m_ToolScripts = ScriptList; m_IsModified = true; }
00465 #endif
00466
00467 #ifdef X_NATIVE
00468
00469 void UpdateViewScriptUI (
00470 );
00471 #endif
00472
00473 protected:
00474
00475 bool m_IsModified;
00476
00477
00478 explicit GRE_VIEWABLE (
00479 GRE_OBJTYPE type,
00480 GRE_VIEWABLE *container
00481 );
00482
00483
00484 ERRVALUE ControlScriptInitialize (
00485 );
00486
00487
00488 UINT8 GetIniIndex (
00489 ) const { return (m_IniIndex); }
00490
00491 #ifdef X_NATIVE
00492
00493 virtual void ObjMgrInitItems (
00494 ) = 0;
00495 #endif
00496
00497
00498 static const SERIALIZER::ITEMDEF* SerialGetItemDef (
00499 SERIALIZER&
00500 ) { return (TemplateGetItemDef()); }
00501
00502
00503 void SetIniIndex (
00504 UINT8 IniIndex
00505 );
00506
00507
00508 static const SERIALIZER::ITEMDEF* TemplateGetItemDef (
00509 );
00510
00511 private:
00512 #ifndef GENERATING_DOXYGEN_OUTPUT
00513
00514 GRE_VIEWABLE *m_Container;
00515 bool m_ShowInternalTables;
00516 bool m_ShowScaleRanges;
00517 char m_IniName[20];
00518 UINT8 m_IniIndex;
00519 UINT8 m_IniBaseLen;
00520 MDLGPARENT m_DialogParent;
00521 RVC::OBJITEM m_SaveObjItem;
00522 GRE::HIGHLIGHTMODE m_ElemHighlightMode;
00523 #ifdef USE_MGUI
00524 MAINSCRIPT m_CtrlScript;
00525 #endif
00526 #ifdef X_NATIVE
00527 GRE::TOOLSCRIPTLIST m_ToolScripts;
00528 GRE::MACROSCRIPTLIST m_MacroScripts;
00529 Widget m_ObjMgrRC;
00530 #endif
00531
00532 #ifdef X_NATIVE
00533 static void CB_NotifyGreObjMgr (const GRE_CALLBACK_MSG *msg, void *vviewable);
00534 virtual void OnNotifyGreObjMgr (const GRE_CALLBACK_MSG& msg) = 0;
00535 static ERRVALUE SerialCB_MacroScript (SERIALIZER&, const SERIALIZER::ITEMDEF*, GRE_VIEWABLE *viewable, SERIALIZER::ITEMDEF::ACTION);
00536 static ERRVALUE SerialCB_ToolScript (SERIALIZER&, const SERIALIZER::ITEMDEF*, GRE_VIEWABLE *viewable, SERIALIZER::ITEMDEF::ACTION);
00537 #endif
00538
00539
00540 #ifdef X_NATIVE
00541 virtual void v_DlgObjMgrClose () = 0;
00542 virtual ERRVALUE v_DlgObjMgrCreate (MDLGPARENT dlgparent, const MISTRING& title) = 0;
00543 virtual void v_DlgObjMgrDestroy () = 0;
00544 virtual bool v_DlgObjMgrIsOpen () const = 0;
00545 virtual void v_DlgObjMgrOpen () = 0;
00546 #endif
00547 virtual ERRVALUE v_DrawAllViews (GRE::DRAWCONDITION condition) = 0;
00548 virtual double v_GetDesignScale () const = 0;
00549 virtual const DRECT2D& v_GetExtents () const = 0;
00550 virtual void v_SetDesignScale (double DesignScale, bool notify) = 0;
00551
00552 GRE_VIEWABLE (const GRE_VIEWABLE&);
00553 GRE_VIEWABLE& operator= (const GRE_VIEWABLE&);
00554
00555 #endif
00556 };
00557
00558
00559
00560 #ifndef GENERATING_DOXYGEN_OUTPUT
00561 #ifdef WIN32_MFC
00562
00563 class GRE_MFC_VIEWABLE : public CDocument {
00564 protected:
00565
00566 GRE_MFC_VIEWABLE (
00567 GRE_VIEWABLE *viewable = 0
00568 );
00569
00570 DECLARE_DYNCREATE(GRE_MFC_VIEWABLE)
00571
00572 public:
00573 GRE_VIEWABLE *GetViewable (
00574 ) const {
00575 return (m_viewable);
00576 }
00577
00578 virtual ~GRE_MFC_VIEWABLE();
00579
00580 protected:
00581
00582 GRE_VIEWABLE *m_viewable;
00583
00584 protected:
00585 DECLARE_MESSAGE_MAP()
00586 };
00587
00588 #endif
00589 #endif // GENERATING_DOXYGEN_OUTPUT
00590
00591
00592
00593
00594 #endif // INC_GRE_VIEWABLE_H