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