geofrmla.h

Go to the documentation of this file.
00001 /**
00002  * \file geofrmla.h <mi32/geofrmla.h>
00003  * \brief GeoFormula class definitions
00004  *
00005  * \if NODOC
00006  * $Id: geofrmla.h_v 1.21 2004/07/23 14:23:26 mju Exp $
00007  *
00008  * $Log: geofrmla.h_v $
00009  * Revision 1.21  2004/07/23 14:23:26  mju
00010  * Add getTransToExtCRS, remove getTransObjToMap.
00011  *
00012  * Revision 1.20  2004/07/22 19:43:47  mju
00013  * Keep separate objregion and mapregion.
00014  *
00015  * Revision 1.19  2004/06/30 19:27:34  mju
00016  * *** empty log message ***
00017  *
00018  * Revision 1.18  2004/06/29 14:31:44  mju
00019  * Add GetTransObjToMap.
00020  *
00021  * Revision 1.17  2004/06/29 14:25:29  mju
00022  * Use region2d.
00023  *
00024  * Revision 1.16  2004/06/28 17:55:27  mju
00025  * Convert to spatref system.
00026  *
00027  * Revision 1.15  2004/04/28 15:28:04  mju
00028  * Add ability to disable scriptcontext updates in editor.
00029  *
00030  * Revision 1.14  2004/03/05 15:13:15  mju
00031  * Use virtual dtor if class has virtual fn.
00032  *
00033  * Revision 1.13  2004/02/07 16:16:53  scowan
00034  * Removed vector and tin object info's.
00035  *
00036  * Revision 1.12  2004/02/07 16:06:11  scowan
00037  * Changed to use rvc interface classes instead of qtree.
00038  *
00039  * Revision 1.11  2003/09/15 13:49:56  fileserver!dwilliss
00040  * Doxygen
00041  *
00042  * Revision 1.10  2003/08/26 21:06:24  mju
00043  * When create formula from objects adjust duplicate names.
00044  *
00045  * Revision 1.9  2002/08/26 14:42:00  mju
00046  * Avoid shadowing method name with parm name.
00047  *
00048  * Revision 1.8  2002/05/16 14:42:02  dwilliss
00049  * Never mind, MOTU beat me to it.
00050  *
00051  * Revision 1.7  2002/05/15 23:27:25  scowan
00052  * Fixed deprecated stuff.
00053  *
00054  * Revision 1.6  2001/02/16 21:16:53  mju
00055  * Add SetOutputTrans from TRANS2D_MAPGEN.
00056  *
00057  * Revision 1.5  2000/11/13 17:19:41  mju
00058  * win32-native.
00059  *
00060  * Revision 1.4  2000/11/13 15:01:02  mju
00061  * Change so can use as formula layer in GRE.
00062  *
00063  * Revision 1.3  2000/11/09 16:01:12  mju
00064  * Forgot to make FilterObject static.
00065  *
00066  * Revision 1.2  2000/11/09 16:00:04  mju
00067  * Add FilterObject.
00068  *
00069  * Revision 1.1  2000/11/08 21:47:41  mju
00070  * Initial revision
00071  *
00072  * \endif
00073 **/
00074 
00075 #ifndef  INC_MI32_GEOFRMLA_H
00076 #define  INC_MI32_GEOFRMLA_H
00077 
00078 #ifndef  INC_SML
00079 #include <mi32/sml.h>
00080 #endif
00081 
00082 #ifndef  INC_RVC_TIN_H
00083 #include <rvc/tin.h>
00084 #endif
00085 
00086 #ifndef  INC_RVC_VECTOR_H
00087 #include <rvc/vector.h>
00088 #endif
00089 
00090 #ifndef  INC_MI32_RINTERP_H
00091 #include <mi32/rinterp.h>
00092 #endif
00093 
00094 #ifndef  INC_MI32_SERIALIZ_H
00095 #include <mi32/serializ.h>
00096 #endif
00097 
00098 
00099 //! Geospatial Formula class.
00100 class GEOFORMULA {
00101    public:
00102 
00103       //! Output type of formula.
00104       // Do not change the values as they are stored in serializations.
00105       enum OUTPUTTYPE {
00106          OUTPUTTYPE_Numeric =    0,
00107          OUTPUTTYPE_Color =      1
00108          };
00109 
00110       //! Mode for determining extents.
00111       // Do not change the values as they are stored in serializations.
00112       enum EXTENTSMODE {
00113          EXTENTSMODE_UserDefined =     0,
00114          EXTENTSMODE_Intersection =    1,
00115          EXTENTSMODE_Union =           2,
00116          EXTENTSMODE_Region =          3
00117          };
00118 
00119       enum SCRIPTFLAGS {
00120          SCRIPTFLAG_None =          0x00,
00121          SCRIPTFLAG_AllSymbols =    0x01,
00122          SCRIPTFLAG_NoParse =       0x02
00123          };
00124          //-------------------------------------------------------------------------
00125 
00126       class EDITOR;
00127 
00128       //! GEOFORMULA::OBJECT
00129       class OBJECT {
00130          public:
00131 
00132             //! Default constructor.
00133             OBJECT (
00134                );
00135 
00136             //! Copy constructor.
00137             OBJECT (
00138                const OBJECT& rhs
00139                );
00140 
00141             //! Destructor.
00142             virtual ~OBJECT (
00143                ) = 0;
00144 
00145             //! Assignment.
00146             OBJECT& operator= (
00147                const OBJECT& rhs
00148                );
00149 
00150             virtual ERRVALUE AddSymbols (
00151                GEOFORMULA& formula,
00152                bool OnlyIfUsed = true
00153                );
00154 
00155             virtual void ClearSymbols (
00156                );
00157 
00158             virtual void Close (
00159                );
00160 
00161             const RVCGENINFO& GetInfo (
00162                ) const { return (m_objitem.GetInfo()); }
00163 
00164             RVCINODENUM GetInode (
00165                ) const { return (m_objitem.GetInode()); }
00166 
00167             const RVC::OBJITEM& GetObjectItem (
00168                ) const { return (m_objitem); }
00169 
00170             const FILEPATH& GetPath (
00171                ) const { return (m_objitem.GetFilePath()); }
00172 
00173             const SPATREF::COORDREFSYS& GetCoordRefSys (
00174                ) const { return (GetMapRegion().GetCoordRefSys()); }
00175 
00176             const REGION2D& GetMapRegion (
00177                ) const { return (m_MapRegion); }
00178 
00179             const REGION2D& GetObjRegion (
00180                ) const { return (m_ObjRegion); }
00181 
00182             const MISTRING& GetSymbolName (
00183                ) const { return (m_SymbolName); }
00184 
00185             virtual ERRVALUE Open (
00186                );
00187 
00188          protected:
00189 
00190             MISTRING m_SymbolName;              //!< Name used in formula script
00191             RVCFILEHANDLE m_fhandle;            //!< Open file handle
00192             SMLSYMBOL *m_symobj;                //!< Symbol for object in context
00193             SIMPLE_ARRAY<DPOINT2D> m_pointbuf;  //!< Point buffer
00194 
00195             //! Construct from RVC object.
00196             OBJECT (
00197                const RVCOBJITEM& objitem
00198                );
00199 
00200             //! Constructor used when reading formula definition.
00201             OBJECT (
00202                int objtype,
00203                INIHANDLE handle,
00204                int objnum
00205                );
00206 
00207             //! Constructor used in reading from serialization.
00208             OBJECT (
00209                int objtype,
00210                const MISTRING& SymbolName,
00211                const FILEPATH& FilePath,
00212                INT32 ObjectInode
00213                );
00214 
00215             virtual ERRVALUE SetObjPoint (
00216                int idx
00217                );
00218 
00219             virtual void WriteDefn (
00220                INIHANDLE handle,
00221                int objnum
00222                ) const;
00223 
00224          private:
00225             #ifndef GENERATING_DOXYGEN_OUTPUT
00226 
00227             SMLSYMBOL *m_symx;                  // Symbol for object X coordinate
00228             SMLSYMBOL *m_symy;                  // Symbol for object Y coordinate
00229             MAT3X3 m_fwd, m_inv;                // Affine transformation, used if 'm_IsAffine' is set
00230             bool m_IsAffine;                    // Set if transformation is affine
00231 
00232             RVCOBJITEM m_objitem;
00233             REGION2D m_ObjRegion;               // Region defining object extents
00234             REGION2D m_MapRegion;               // Region defining object extents
00235             TRANS2D_MAPGEN m_trans;             // Transformation from object to virtual raster
00236 
00237             ERRVALUE CalcObjPoints (
00238                const GEOFORMULA& formula,
00239                const DPOINT2D& start,
00240                const DPOINT2D& inc,
00241                INT32 numvals
00242                );
00243 
00244             ERRVALUE SetupTrans (
00245                GEOFORMULA& formula
00246                );
00247 
00248          friend class GEOFORMULA;
00249          #endif // GENERATING_DOXYGEN_OUTPUT
00250          }; // End of GEOFORMULA::OBJECT
00251          //-------------------------------------------------------------------------
00252 
00253       //! GEOFORMULA::RASTER
00254       class RASTER : public OBJECT {
00255          public:
00256 
00257             //! Copy constructor.
00258             RASTER (
00259                const RASTER& rhs
00260                );
00261 
00262             //! Destructor.
00263             virtual ~RASTER (
00264                );
00265 
00266             //! Assignment.
00267             RASTER& operator= (
00268                const RASTER& rhs
00269                );
00270 
00271             virtual ERRVALUE AddSymbols (
00272                GEOFORMULA& formula,
00273                bool OnlyIfUsed = true
00274                );
00275 
00276             virtual void ClearSymbols (
00277                );
00278 
00279             virtual void Close (
00280                );
00281 
00282             virtual ERRVALUE Open (
00283                );
00284 
00285             void SetContrastType (
00286                UINT8 conttype
00287                ) { m_conttype = conttype; }
00288 
00289             void SetContrastUseTable (
00290                bool contusetable
00291                ) { m_contusetable = contusetable; }
00292 
00293          private:
00294             #ifndef GENERATING_DOXYGEN_OUTPUT
00295 
00296             enum DATATYPE {
00297                DATATYPE_RasterNumeric =      0,
00298                DATATYPE_RasterColor =        1,
00299                DATATYPE_RasterComplex =      2
00300                };
00301 
00302             RVCRASTINFO m_objinfo;
00303             DATATYPE m_datatype;             //!< Allowed data type
00304             UINT8 m_interpmode;              //!< Value interpolation mode (RESAMPLE_... )
00305             UINT8 m_conttype;                //!< Default contrast type (CTYPE_...)
00306             bool m_contusetable;             //!< Use contrast table if available
00307             int m_ohandle;                      //!< Open object handle
00308             RASTINTERPHANDLE m_interphandle;
00309             SMLSYMBOL *m_symval;
00310             SMLSYMBOL *m_symred;
00311             SMLSYMBOL *m_symgreen;
00312             SMLSYMBOL *m_symblue;
00313             CONTPARM m_contparm;             //!< Contrast parameters if needed
00314             bool m_NeedValue;                //!< Set if need interpolated value
00315             bool m_DoContrast;               //!< Apply contrast transformation
00316 
00317             //! Construct from RVC object.
00318             RASTER (
00319                const FILEPATH& filepath,
00320                const RVCRASTINFO& objinfo
00321                );
00322 
00323             //! Constructor used when reading formula definition.
00324             RASTER (
00325                INIHANDLE handle,
00326                int objnum
00327                );
00328 
00329             //! Constructor used in reading from serialization.
00330             RASTER (
00331                const MISTRING& SymbolName,
00332                const FILEPATH& FilePath,
00333                INT32 ObjectInode
00334                );
00335 
00336             ERRVALUE SerialWrite (
00337                SERIALIZER& serializer
00338                );
00339             #endif // GENERATING_DOXYGEN_OUTPUT
00340 
00341             virtual ERRVALUE SetObjPoint (
00342                int idx
00343                );
00344 
00345             virtual void WriteDefn (
00346                INIHANDLE handle,
00347                int objnum
00348                ) const;
00349 
00350          friend class GEOFORMULA;
00351          friend class EDITOR;
00352          }; // End of GEOFORMULA::RASTER
00353          //-------------------------------------------------------------------------
00354 
00355       //! GEOFORMULA::VECTOR
00356       class VECTOR : public OBJECT {
00357          public:
00358 
00359             //! Default constructor.
00360             VECTOR (
00361                );
00362 
00363             //! Copy constructor.
00364             VECTOR (
00365                const VECTOR& rhs
00366                );
00367 
00368             //! Destructor.
00369             virtual ~VECTOR (
00370                );
00371 
00372             //! Assignment.
00373             VECTOR& operator= (
00374                const VECTOR& rhs
00375                );
00376 
00377             virtual ERRVALUE AddSymbols (
00378                GEOFORMULA& formula,
00379                bool OnlyIfUsed = true
00380                );
00381 
00382             virtual void Close (
00383                );
00384 
00385             virtual ERRVALUE Open (
00386                );
00387 
00388          private:
00389             #ifndef GENERATING_DOXYGEN_OUTPUT
00390 
00391             RVC::VECTOR m_VectObj;
00392             
00393             //! Construct from RVC object.
00394             VECTOR (
00395                const FILEPATH& filepath,
00396                const RVCVECTINFO& objinfo
00397                );
00398 
00399             //! Constructor used when reading formula definition.
00400             VECTOR (
00401                INIHANDLE handle,
00402                int objnum
00403                ):
00404                OBJECT(OTYPE_VECTOR,handle,objnum)
00405                { }
00406 
00407             //! Constructor used in reading from serialization.
00408             VECTOR (
00409                const MISTRING& SymbolName,
00410                const FILEPATH& FilePath,
00411                INT32 ObjectInode
00412                );
00413 
00414             ERRVALUE SerialWrite (
00415                SERIALIZER& serializer
00416                );
00417             #endif // GENERATING_DOXYGEN_OUTPUT
00418 
00419             virtual ERRVALUE SetObjPoint (
00420                int idx
00421                );
00422 
00423             virtual void WriteDefn (
00424                INIHANDLE handle,
00425                int objnum
00426                ) const;
00427 
00428          friend class GEOFORMULA;
00429          }; //! End of GEOFORMULA::VECTOR
00430          //-------------------------------------------------------------------------
00431 
00432       //! GEOFORMULA::TIN
00433       class TIN : public OBJECT {
00434          public:
00435 
00436             //! Default constructor.
00437             TIN (
00438                );
00439 
00440             //! Copy constructor.
00441             TIN (
00442                const TIN& rhs
00443                );
00444 
00445             //! Destructor.
00446             virtual ~TIN (
00447                );
00448 
00449             //! Assignment.
00450             TIN& operator= (
00451                const TIN& rhs
00452                );
00453 
00454             virtual ERRVALUE AddSymbols (
00455                GEOFORMULA& formula,
00456                bool OnlyIfUsed = true
00457                );
00458 
00459             virtual void ClearSymbols (
00460                );
00461 
00462             virtual void Close (
00463                );
00464 
00465             virtual ERRVALUE Open (
00466                );
00467 
00468          private:
00469             #ifndef GENERATING_DOXYGEN_OUTPUT
00470 
00471             RVC::TIN m_TinObj;
00472             SMLSYMBOL *m_symval;
00473 
00474             //! Construct from RVC object.
00475             TIN (
00476                const FILEPATH& filepath,
00477                const RVCTININFO& objinfo
00478                );
00479 
00480             //! Constructor used when reading formula definition.
00481             TIN (
00482                INIHANDLE handle,
00483                int objnum
00484                ):
00485                OBJECT(OTYPE_TIN,handle,objnum)
00486                { }
00487 
00488             //! Constructor used in reading from serialization.
00489             TIN (
00490                const MISTRING& SymbolName,
00491                const FILEPATH& FilePath,
00492                INT32 ObjectInode
00493                );
00494 
00495             ERRVALUE SerialWrite (
00496                SERIALIZER& serializer
00497                );
00498             #endif // GENERATING_DOXYGEN_OUTPUT
00499 
00500             virtual ERRVALUE SetObjPoint (
00501                int idx
00502                );
00503 
00504             virtual void WriteDefn (
00505                INIHANDLE handle,
00506                int objnum
00507                ) const;
00508 
00509          friend class GEOFORMULA;
00510          }; // End of GEOFORMULA::TIN
00511          //-------------------------------------------------------------------------
00512 
00513       //! GEOFORMULA::VALUE
00514       class VALUE {
00515          public:
00516 
00517             VALUE (
00518                );
00519 
00520             VALUE (
00521                const VALUE& rhs
00522                );
00523 
00524             virtual ~VALUE (
00525                ) {
00526                }
00527 
00528             VALUE& operator= (
00529                const VALUE& rhs
00530                );
00531 
00532             void ClearSymbol (
00533                ) { m_Symbol = 0; }
00534 
00535             void CreateSymbol (
00536                SMLCONTEXT *context
00537                ) {
00538                m_Symbol = context->AddSymbol(m_SymbolName,STYPE_Constant);
00539                m_Symbol->SetValue(m_UserValue);
00540                return;
00541                }
00542 
00543             double GetDefaultValue (
00544                ) const { return (m_DefaultValue); }
00545 
00546             const MISTRING& GetSymbolName (
00547                ) const { return (m_SymbolName); }
00548 
00549             void SetDefaultValue (
00550                double value
00551                ) { m_DefaultValue = m_UserValue = value; }
00552 
00553             void SetSymbolName (
00554                const UNICODE* SymbolName
00555                ) { m_SymbolName = SymbolName; }
00556 
00557             void SetUserValue (
00558                double value
00559                ) { m_UserValue = value; }
00560 
00561             virtual void WriteDefn (
00562                INIHANDLE handle,
00563                int idx
00564                ) const;
00565 
00566          private:
00567             #ifndef GENERATING_DOXYGEN_OUTPUT
00568 
00569             MISTRING m_SymbolName;              //!< Name used in formula script
00570             double m_DefaultValue;              //!< Default value
00571             double m_UserValue;                 //!< User-specified value
00572             SMLSYMBOL *m_Symbol;                //!< Symbol in context
00573 
00574             //! Constructor used to read definition.
00575             VALUE (
00576                INIHANDLE handle,
00577                int valnum
00578                );
00579 
00580             //! Constructor used to create new value
00581             VALUE (
00582                const UNICODE *name,
00583                double dftvalue
00584                );
00585 
00586             static const SERIALIZER::ITEMDEF* SerialGetItemDef ();
00587 
00588             ERRVALUE SerialRead (
00589                SERIALIZER& serializer
00590                ) { return (serializer.Read(SerialGetItemDef(),this)); }
00591 
00592             ERRVALUE SerialWrite (
00593                SERIALIZER& serializer
00594                ) { return (serializer.Write("VALUE",SerialGetItemDef(),this)); }
00595 
00596          #endif // GENERATING_DOXYGEN_OUTPUT
00597          friend class GEOFORMULA;
00598          friend class EDITOR;
00599          }; // End of GEOFORMULA::VALUE
00600          //-------------------------------------------------------------------------
00601 
00602       //! GEOFORMULA::EDITOR
00603    #ifndef WIN32_NATIVE
00604       class EDITOR {
00605          public:
00606 
00607             //! Construct editor for specific formula.
00608             explicit EDITOR (
00609                GEOFORMULA& formula
00610                );
00611 
00612             //! Destructor.
00613             ~EDITOR (
00614                ) {
00615                }
00616 
00617             bool CheckValid (
00618                Widget pageform,
00619                int scriptpage
00620                );
00621 
00622             Widget CreateFormExtents (
00623                Widget pwidget,
00624                Arg *arglist,
00625                int argcount
00626                );
00627 
00628             void CreatePageObjects (Widget);
00629 
00630             void CreatePageValues (Widget);
00631 
00632             void CreatePageScript (Widget);
00633 
00634             void DisableUpdateContext (
00635                ) { ++m_UpdateContextDisabled; }
00636 
00637             void EnableUpdateContext (
00638                ) { if (m_UpdateContextDisabled) --m_UpdateContextDisabled; }
00639 
00640             SMLEDITOR* GetScriptEditHandle (
00641                ) const {
00642                return (m_qehandle);
00643                }
00644 
00645             const MISTRING& GetScript (
00646                ) const;
00647 
00648             void* GetTextEditHandle (
00649                ) const {
00650                return (m_tehandle);
00651                }
00652 
00653             bool IsChanged (
00654                ) const { return (m_IsChanged); }
00655 
00656             int Reset (
00657                );
00658 
00659             ERRVALUE SelectExtentsRegion (
00660                );
00661 
00662             void SetChanged (
00663                bool ischanged = true
00664                ) { m_IsChanged = ischanged; }
00665 
00666             void SetMsgLine (
00667                Widget MsgLine
00668                );
00669 
00670             void ShowAllDetails (
00671                );
00672 
00673             void ShowObjListDetails (
00674                bool show = true
00675                );
00676 
00677             void ShowValListDetails (
00678                bool show = true
00679                );
00680 
00681             int UpdateObjects (
00682                );
00683 
00684             void UpdateScriptContext (
00685                bool doinit
00686                );
00687 
00688          private:
00689             #ifndef GENERATING_DOXYGEN_OUTPUT
00690 
00691             struct OBJINFO {
00692 
00693                EDITOR& m_editor;
00694                OBJECT& m_object;
00695                Widget m_form;
00696                Widget m_DetailsTB;
00697                Widget m_SymbolP;
00698                Widget m_ObjectLabel;
00699                Widget m_detform;
00700                Widget m_conttypeOM;
00701                Widget m_usecontabTB;
00702                UNICODE m_symname[32];
00703 
00704                OBJINFO (
00705                   EDITOR& editor,
00706                   OBJECT& object
00707                   ):
00708                   m_editor(editor),
00709                   m_object(object)
00710                   {
00711                   }
00712                };
00713 
00714             struct VALINFO {
00715 
00716                EDITOR& m_editor;
00717                VALUE& m_value;
00718                Widget m_form;
00719                Widget m_SymbolP;
00720                Widget m_detform;
00721                UNICODE m_symname[32];
00722 
00723                VALINFO (
00724                   EDITOR& editor,
00725                   VALUE& value
00726                   ):
00727                   m_editor(editor),
00728                   m_value(value)
00729                   {
00730                   }
00731                };
00732 
00733             GEOFORMULA& m_Formula;                 //!< Reference to formula being edited
00734             Widget m_Shell;
00735             Widget m_MsgLine;
00736             Widget m_ObjectsPage;
00737             Widget m_ObjectsRC;
00738             Widget m_ShowObjListDetailsTB;
00739             Widget m_ValuesPage;
00740             Widget m_ValuesRC;
00741             Widget m_ShowValListDetailsTB;
00742             Widget m_ScriptPage;
00743             Widget m_ScriptXeT;
00744             Widget m_ExtentsOM;
00745             Widget m_ExtentsRegionPB;
00746             Widget m_ExtentsRegionXeT;
00747             void *m_tehandle;                      //!< MxTextEdit handle
00748             SMLEDITOR *m_qehandle;                 //!< Query editor handle
00749             bool m_IsChanged;
00750             bool m_HasRaster;
00751             bool m_ShowObjListDetails;
00752             bool m_ShowValListDetails;
00753             UINT32 m_UpdateContextDisabled;
00754             UNICODE m_NewValueName[16];
00755             double m_NewValueDefault;
00756 
00757             MILIST<OBJINFO> m_ObjInfoList;
00758             MILIST<VALINFO> m_ValInfoList;
00759             REGION2D m_MapRegionUnion;                // Union of selected object MapRegions
00760             REGION2D m_MapRegionIntersection;         // Intersection of selected object MapRegions
00761 
00762             static void CB_AddValue (Widget, void*, void*);
00763             static void CB_OptionExtentsMode (Widget, void*, void*);
00764             static void CB_OptionRastContType (Widget, void*, void*);
00765             static void CB_SelectExtentsRegion (Widget, void*, void*);
00766             static void CB_ToggleRastContUseTab (Widget, void*, XmToggleButtonCallbackStruct*);
00767 
00768             static MENUITEM* GetMenuOptionContrast ();
00769             static MENUITEM* GetMenuOptionExtentsMode ();
00770 
00771             static void PCB_ChangeObjectSymbolName (
00772                MxPromptCallbackStruct *cbs,
00773                void *vobjinfo
00774                );
00775 
00776             static void PCB_ChangeValueSymbolName (
00777                MxPromptCallbackStruct *cbs,
00778                void *vobjinfo
00779                );
00780 
00781             static bool NewValueCheckOK (
00782                void *veditor
00783                );
00784 
00785             static Widget NewValueCreateForm (
00786                Widget pwidget,
00787                void *veditor,
00788                Arg *arglist,
00789                int argcount
00790                );
00791 
00792             void ClearMessage (
00793                ) const {
00794                MxMsgLineClear(m_MsgLine);
00795                return;
00796                }
00797 
00798             void CreateObjectForm (
00799                OBJECT& obj,
00800                const char *IconName
00801                );
00802 
00803             void CreateValueForm (
00804                VALUE& val
00805                );
00806 
00807             void SetSensitive () const;
00808 
00809             EDITOR (const EDITOR&);
00810             EDITOR& operator= (const EDITOR&);
00811             #endif // GENERATING_DOXYGEN_OUTPUT
00812 
00813          friend class GEOFORMULA;
00814          }; // End of GEOFORMULA::EDITOR
00815    #endif
00816          //-------------------------------------------------------------------------
00817 
00818       //! Default constructor.
00819       GEOFORMULA (
00820          );
00821 
00822       //! Copy constructor.
00823       GEOFORMULA (
00824          const GEOFORMULA& rhs
00825          );
00826 
00827       //! Destructor.
00828       ~GEOFORMULA (
00829          );
00830 
00831       GEOFORMULA& operator= (
00832          const GEOFORMULA& rhs
00833          );
00834 
00835       //! Filter for input object selection.
00836       static int FilterObject (
00837          int fhandle,
00838          INT32 objinode,
00839          RVCGENINFO *geninfo,
00840          void *,
00841          char *msgkey
00842          );
00843 
00844       //! Add new "value" symbol to formula.
00845       ERRVALUE AddValue (
00846          const UNICODE *SymbolName,          //!< Symbol name
00847          double value                        //!< Initial value
00848          );
00849 
00850       //! Create new formula from specified list of objects.
00851       ERRVALUE CreateFromObjects (
00852          const RVCOBJITEMLIST& objitems
00853          );
00854 
00855       //! Display dialog allowing user to select region for extents.
00856       ERRVALUE DlgSelectExtentsRegion (
00857          MDLGPARENT dlgparent,
00858          const REGION2D *testregion = 0               //!< Region to test for overlap with, 0 to allow all regions
00859          );
00860 
00861       //! Display dialog allowing user to select specific objects to use.
00862       ERRVALUE DlgSelectObjects (
00863          MDLGPARENT dlgparent
00864          );
00865 
00866       //! Evaluate formula for points along specified interval.
00867       ERRVALUE Evaluate (
00868          const DPOINT2D& start,
00869          const DPOINT2D& increment,
00870          INT32 numvals,
00871          void *buffer,
00872          UINT8 *omask
00873          );
00874 
00875       //! Get extents region.
00876       const REGION2D& GetExtMapRegion (
00877          ) const { return (m_ExtMapRegion); }
00878 
00879       //! Get coordinate reference system of first object used in formula (for auto-match).
00880       ERRVALUE GetFirstObjectCoordRefSys (
00881          SPATREF::COORDREFSYS& CoordRefSys   //!< Coordinate Reference System returned
00882          ) const;
00883 
00884       //! Get minimum cell size for all rasters used in formula.
00885       ERRVALUE GetMinRasterCellSize (
00886          double& MinCellSize                 //!< Cell size returned, DBL_MAX if no rasters in formula
00887          ) const;
00888 
00889       //! Get number of objects used in formula.
00890       int GetNumObjects (
00891          ) const {
00892          return (m_Rasters.GetNumItems() + m_Vectors.GetNumItems() + m_TINs.GetNumItems());
00893          }
00894 
00895       //! Get raster object list.
00896       const MILIST<RASTER>& GetObjectListRaster (
00897          ) const {
00898          return (m_Rasters);
00899          }
00900 
00901       //! Get TIN object list.
00902       const MILIST<TIN>& GetObjectListTIN (
00903          ) const {
00904          return (m_TINs);
00905          }
00906 
00907       //! Get vector object list.
00908       const MILIST<VECTOR>& GetObjectListVector (
00909          ) const {
00910          return (m_Vectors);
00911          }
00912 
00913       //! Get formula output type.
00914       OUTPUTTYPE GetOutputType (
00915          ) const {
00916          return (m_OutputType);
00917          }
00918 
00919       //! Get formula script.
00920       const MISTRING& GetScript (
00921          ) const {
00922          return (m_Script);
00923          }
00924 
00925       //! Get transformation from virtual formula object to extents CRS.
00926       ERRVALUE GetTransToExtCRS (
00927          TRANS2D_MAPGEN& Trans,              //!< Transformation returned
00928          bool dooutput = false               //!< Place in output size of transformation
00929          ) const;
00930 
00931       //! Open objects to use in formula.
00932       ERRVALUE OpenObjects (
00933          );
00934 
00935       //! Read previously saved formula definition.
00936       ERRVALUE ReadDefn (
00937          const FILEPATH& filepath
00938          );
00939 
00940       //! Read from serialization.
00941       ERRVALUE SerialRead (
00942          SERIALIZER& serializer
00943          );
00944 
00945       //! Write to serialization.
00946       ERRVALUE SerialWrite (
00947          SERIALIZER& serializer,
00948          const char *tagname = 0
00949          );
00950 
00951       //! Set coordinate reference system for defining extents.
00952       void SetExtMapCoordRefSys (
00953          const SPATREF::COORDREFSYS& CoordRefSys
00954          ) { m_ExtMapRegion.SetCoordRefSys(CoordRefSys); m_Trans.SetOutputMapCoordRefSys(CoordRefSys); }
00955 
00956       //! Set output coordinate reference system
00957       void SetOutputCoordRefSys (
00958          const SPATREF::COORDREFSYS& CoordRefSys
00959          ) { m_Trans.SetInputMapCoordRefSys(CoordRefSys); }
00960 
00961       //! Set transformation from output object to map coordinates.
00962       void SetOutputTrans (
00963          const MAT3X3 fwd,
00964          const MAT3X3 inv
00965          ) { m_Trans.SetInputTrans(fwd,inv); }
00966 
00967       //! Set transformation from output object to map coordinates.
00968       void SetOutputTrans (
00969          const TRANS2D_AFFINE& trans
00970          ) { m_Trans.SetInputTrans(trans); }
00971 
00972       //! Set output transformation from "output side" of a TRANSPARM.
00973       void SetOutputTrans (
00974          const TRANSPARM& transparm
00975          ) { m_Trans.CopyOutputToInput(transparm); }
00976 
00977       //! Set output transformation from "output side" of a TRANS2D_MAPGEN reference.
00978       void SetOutputTrans (
00979          const TRANS2D_MAPGEN& trans
00980          ) { m_Trans.CopyOutputToInput(trans); }
00981 
00982       //! Set transformation from output object to map coordinates.
00983       void SetOutputTransIdentity (
00984          ) { m_Trans.SetInputTransIdentity(); }
00985 
00986       //! Set formula output type
00987       void SetOutputType (
00988          OUTPUTTYPE OutputType
00989          ) { m_OutputType = OutputType; }
00990 
00991       //! Set script to use in formula.
00992       void SetScript (
00993          const UNICODE* script
00994          ) { m_Script = script; }
00995 
00996       //! Start formula evaluation.
00997       ERRVALUE Start (
00998          const DRECT2D *extents,
00999          SCRIPTFLAGS flags = SCRIPTFLAG_None
01000          );
01001 
01002       //! Stop formula evaluation.
01003       void Stop (
01004          );
01005 
01006       //! Write formula definition to specified file.
01007       ERRVALUE WriteDefn (
01008          const FILEPATH& filepath
01009          );
01010 
01011    private:
01012       #ifndef GENERATING_DOXYGEN_OUTPUT
01013 
01014       OUTPUTTYPE m_OutputType;                  //!< Formula type
01015       EXTENTSMODE m_ExtentsMode;                //!< Extents mode
01016       INT32 m_RegionInode;                      //!< Region object inode if extents by region
01017       SMLCONTEXT *m_Context;                    //!< Query context
01018       int m_Segment;                            //!< Query segment
01019       SMLSYMBOL *m_symred;                      //!< Query symbol for red output value
01020       SMLSYMBOL *m_symgreen;                    //!< Query symbol for green output value
01021       SMLSYMBOL *m_symblue;                     //!< Query symbol for blue output value
01022       bool m_AllAffine;                         //!< All transformations are affine
01023    #ifndef WIN32_NATIVE
01024       EDITOR *m_editor;
01025    #endif
01026 
01027       MILIST<RASTER> m_Rasters;                 //!< Raster objects used in formula
01028       MILIST<VECTOR> m_Vectors;                 //!< Vector objects used in formula
01029       MILIST<TIN> m_TINs;                       //!< TIN objects used in formula
01030       MILIST<VALUE> m_Values;
01031       MISTRING m_Script;                        //!< Formula script expression
01032       FILEPATH m_RegionFilePath;
01033       REGION2D m_ExtMapRegion;                  //!< Extents region
01034       TRANS2D_MAPGEN m_Trans;                   //!< Transformation from output raster to map
01035       SIMPLE_ARRAY<DPOINT2D> m_ipointbuf;
01036 
01037       static const SERIALIZER::ITEMDEF* SerialGetItemDef ();
01038       static ERRVALUE SerializerCB_Object (SERIALIZER&, const SERIALIZER::ITEMDEF*, void*, SERIALIZER::ITEMDEF::ACTION);
01039       static ERRVALUE SerializerCB_Value (SERIALIZER&, const SERIALIZER::ITEMDEF*, void*, SERIALIZER::ITEMDEF::ACTION);
01040 
01041       ERRVALUE AddObjectRegion (
01042          const OBJECT& object
01043          );
01044 
01045       SMLSYMBOL* AddSymbol (
01046          const MISTRING& basename,
01047          const char* subname,
01048          bool OnlyIfUsed
01049          );
01050 
01051       void Clear ();
01052 
01053       void Copy (
01054          const GEOFORMULA& rhs
01055          );
01056 
01057       OBJECT* FindObjectByName (
01058          const UNICODE *symname
01059          );
01060 
01061       const VALUE* FindValueByName (
01062          const UNICODE *symname
01063          ) const;
01064 
01065       const OBJECT* GetFirstObject () const;
01066 
01067       int GetNumNameUses (const MISTRING& symname) const;
01068 
01069       ERRVALUE InitQuery (
01070          SCRIPTFLAGS flags = SCRIPTFLAG_None
01071          );
01072 
01073       //! @return true if successful, false if name used by another object or value.
01074       bool SetObjectSymbolName (
01075          OBJECT& obj,
01076          const UNICODE *symname
01077          );
01078 
01079       //! @return true if successful, false if name used by another object or value.
01080       bool SetValueSymbolName (
01081          VALUE& obj,
01082          const UNICODE *symname
01083          );
01084 
01085       void StopQuery ();
01086       #endif // GENERATING_DOXYGEN_OUTPUT
01087 
01088    friend class EDITOR;
01089    friend class OBJECT;
01090    friend class RASTER;
01091    friend class VECTOR;
01092    friend class TIN;
01093    };
01094 
01095 DEFINE_ENUM_OPERATORS(GEOFORMULA::SCRIPTFLAGS);
01096 
01097 #endif   //!< ifndef INC_MI32_GEOFRMLA_H

Generated on Tue Dec 14 13:18:22 2004 for TNTsdk by  doxygen 1.3.8-20040913