ToolMap
Loading...
Searching...
No Matches
projectdefmemory.h
Go to the documentation of this file.
1/***************************************************************************
2 projectdefmemory.h
3 Manage all the project definition in memory before
4 Creating the database (to allow cancel operations)
5 -------------------
6 copyright : (C) 2007 CREALP Lucien Schreiber
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18/***************************************************************************/
28#ifndef PROJECTDEFMEMORY_H
29#define PROJECTDEFMEMORY_H
30
31// For compilers that support precompilation, includes "wx/wx.h".
32#include <wx/wxprec.h>
33
34// Include wxWidgets' headers
35#ifndef WX_PRECOMP
36#include <wx/wx.h>
37#endif
38
39#include "../gui/listgenreport.h"
40
41// Definition for the project export type
50
51static wxString PRJDEF_EXPORT_TYPE_STRING[] = {wxTRANSLATE("Shapefiles"), wxTRANSLATE("Graphics (EPS)")};
52
53// Definitions for the project unit type, we define the text and the id of
54// each string. The number of items in the list is also defined here.
55static wxString PRJDEF_UNIT_TYPE_STRING[] = {wxTRANSLATE("Meters"), wxTRANSLATE("Degrees (DD)"),
56 wxTRANSLATE("Degrees (DMS)")};
57enum PRJDEF_UNIT_TYPE {
58 UNIT_METERS = 0,
59 UNIT_DD,
60 UNIT_DMS
61};
62static const int PRJDEF_UNIT_TYPE_NUMBER = 3;
63
64const wxString TABLE_COMMENT_ENUMERATION = _T("ENUMERATION");
65
66// Definitions for the Projection type, we define the text and the id of
67// each string. The number of items in the list is also defined here.
68static wxString PRJDEF_PROJ_TYPE_STRING[] = {
69 wxTRANSLATE("Swiss projection (CH1903)"),
70 wxTRANSLATE("Swiss projection (CH1903+ / LV95)"),
71 wxTRANSLATE("World (WGS84)"),
72};
73enum PRJDEF_PROJ_TYPE {
74 PROJ_SWISS_CH1903 = 0,
75 PROJ_SWISS_CH1903PLUS,
76 PROJ_WORLD_WGS84
77};
78static const int PRJDEF_PROJ_TYPE_NUMBER = 3;
79
80// Definitions for the field type, we define the text and the id of
81// each string. The number of items in the list is also defined here.
82static wxString PRJDEF_FIELD_TYPE_STRING[] = {wxTRANSLATE("Enumeration"), wxTRANSLATE("Text"), wxTRANSLATE("Integer"),
83 wxTRANSLATE("Float"), wxTRANSLATE("Date")};
84enum PRJDEF_FIELD_TYPE {
85 TM_FIELD_ENUMERATION = 0,
86 TM_FIELD_TEXT,
87 TM_FIELD_INTEGER,
88 TM_FIELD_FLOAT,
89 TM_FIELD_DATE
90};
91static const int PRJDEF_FIELD_TYPE_NUMBER = 5;
92
93static wxString PRJDEF_FIELD_ORIENTATION_STRING[] = {wxTRANSLATE("Yes"), wxTRANSLATE("")};
94
95enum PRJDEF_FIELD_ORIENTATION {
96 TM_FIELD_ORIENT_YES = 0,
97 TM_FIELD_ORIENT_NO
98};
99
100// Definition for the constrain value type
101/*enum PRJDEF_FIELD_CONSTAIN_VALUE_TYPE
102{
103 TM_FIELD_CONSTRAIN_CODED = 0,
104 TM_FIELD_CONSTRAIN_RANGE,
105 TM_FIELD_NOT_CONSTRAIN
106};*/
107
108// Definitions for the layers type, we define the text and the id of
109// each string. The number of items in the list is also defined here.
110static wxString PRJDEF_LAYERS_TYPE_STRING[] = {wxTRANSLATE("Line"), wxTRANSLATE("Point"), wxTRANSLATE("Polygon")};
111enum PRJDEF_LAYERS_TYPE {
112 LAYER_LINE = 0,
113 LAYER_POINT,
114 LAYER_POLYGON
115};
116static const int PRJDEF_LAYERS_TYPE_NUMBER = 3; // only takes the 3 first
117
118// Definitions for the objects type, we define the text and the id of
119// each string. The number of items in the list is also defined here.
120static wxString PRJDEF_OBJECTS_FREQ_STRING[] = {_T(""), wxTRANSLATE("Frequent")};
121enum PRJDEF_OBJECTS_FREQ {
122 OBJECT_LESS_FREQUENT = 0,
123 OBJECT_FREQUENT
124};
125static const int PRJDEF_OBJECTSS_FREQ_NUMBER = 2;
126
127static const long NULL_LONG_VALUE = -9999;
128static const wxString NULL_LONG_STRING_VALUE = _T("-9999");
129
130/***************************************************************************/
138 private:
139 void InitMemberValues();
140
141 public:
142 long m_ValueID;
143 wxString m_ValueCode;
144 wxString m_ValueName;
145
147
148 ProjectDefMemoryFieldsCodedVal(const wxString& code, const wxString& desc);
149
151
152 static int ExtractCodedValuesFromString(const wxString& codedvalue, wxArrayString& results);
153
154 // copy
156};
157
158// Creating a list of MemoryObjects
159WX_DECLARE_OBJARRAY(ProjectDefMemoryFieldsCodedVal*, PrjMemFieldCodedValArray);
160
161/***************************************************************************/
169 private:
170 public:
171 long m_ObjectID;
172 wxString m_ObjectCode;
173 short m_ObjectType; // spatial type
174 wxString m_ObjectName;
175 PRJDEF_OBJECTS_FREQ m_ObjectFreq;
176
177 wxString m_ParentLayerName;
178
180
182
183 void InitMemberValues();
184
185 ProjectDefMemoryObjects& operator=(const ProjectDefMemoryObjects& source);
186};
187
188// Creating a list of MemoryObjects
189WX_DECLARE_OBJARRAY(ProjectDefMemoryObjects*, PrjMemObjectsArray);
190
191/***************************************************************************/
199 private:
200 void InitMemberValues();
201
202 wxString ExtractValuesFromString(const wxString& fielddef);
203
204 public:
205 int m_FieldID;
206 wxString m_Fieldname;
207 wxString m_FieldOldName; // used for modifications
208 PRJDEF_FIELD_TYPE m_FieldType;
209 int m_FieldPrecision;
210 int m_FieldScale;
211 bool m_FieldOrientation;
212 bool m_FieldConstrain;
213
214 // for storing layers to delete
215 wxArrayLong m_StoreDeleteCodedValues;
216
217 // for storing coded values
218 PrjMemFieldCodedValArray m_pCodedValueArray;
219
221
223
224 bool SetValues(const wxString& fieldname, const wxString& fielddef, const wxString& fieldcomment = _T(""));
225
226 bool GetStringTypeFromValues(wxString& sResult);
227
228 static wxString GetOrientationName() {
229 return _T("ORIENTATION");
230 }
231
232 // copy function
234};
235
236// Creating a list of MemoryFields
237WX_DECLARE_OBJARRAY(ProjectDefMemoryFields*, PrjMemFieldArray);
238
239/***************************************************************************/
247 private:
248 void InitMemberValues();
249
250 public:
251 int m_LayerID;
252 PRJDEF_LAYERS_TYPE m_LayerType;
253 wxString m_LayerName;
254 // for special case : polygons and default border value
255 wxString m_LayerPolygonDefaultValue;
256
258 PrjMemFieldArray m_pLayerFieldArray;
260 PrjMemObjectsArray m_pLayerObjectArray;
261
262 // for storing layers to delete
263 wxArrayString m_StoreDeleteFields;
264
266
268
269 // copy operator
271};
272
273// Creating a list of MemoryLayers
274WX_DECLARE_OBJARRAY(ProjectDefMemoryLayers*, PrjMemLayersArray);
275
277 private:
278 void InitMemberValues();
279
280 public:
281 long m_DBScaleID;
282 long m_ScaleValue;
283
285
287};
288
289// Creating a list of MemoryLayers
290WX_DECLARE_OBJARRAY(ProjectDefMemoryScale, PrjMemScaleArray);
291
292#endif
Storing coded val linked to a field in memory.
Definition projectdefmemory.h:137
ProjectDefMemoryFieldsCodedVal & operator=(const ProjectDefMemoryFieldsCodedVal &source)
Copy fields coded values.
Definition projectdefmemory.cpp:76
static int ExtractCodedValuesFromString(const wxString &codedvalue, wxArrayString &results)
Tokenize coded values.
Definition projectdefmemory.cpp:50
Storing Fields property in memory.
Definition projectdefmemory.h:198
bool SetValues(const wxString &fieldname, const wxString &fielddef, const wxString &fieldcomment=_T(""))
Assign values based on string.
Definition projectdefmemory.cpp:182
ProjectDefMemoryFields & operator=(const ProjectDefMemoryFields &source)
Copy Field values (and array of coded values)
Definition projectdefmemory.cpp:120
bool GetStringTypeFromValues(wxString &sResult)
Create string type.
Definition projectdefmemory.cpp:271
Storing layers properties in memory.
Definition projectdefmemory.h:246
~ProjectDefMemoryLayers()
Definition projectdefmemory.cpp:312
PrjMemFieldArray m_pLayerFieldArray
list of fields related to a layer
Definition projectdefmemory.h:258
ProjectDefMemoryLayers & operator=(const ProjectDefMemoryLayers &source)
Overloading = operator.
Definition projectdefmemory.cpp:344
PrjMemObjectsArray m_pLayerObjectArray
list of objects related to a layer
Definition projectdefmemory.h:260
Storing object properties in memory.
Definition projectdefmemory.h:168
Definition projectdefmemory.h:276
PRJDEF_EXPORT_TYPE
Type of export we want.
Definition projectdefmemory.h:46
@ EXPORT_SHAPEFILE
shapefile is selected (default)
Definition projectdefmemory.h:47
@ EXPORT_GRAPHIC
we specify export to graphical format
Definition projectdefmemory.h:48