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};
73
74static wxString PRJDEF_PROJ_TYPE_EPSG[] = {
75 wxTRANSLATE("EPSG:21781"), //"Swiss projection (CH1903)"
76 wxTRANSLATE("EPSG:2056"), // (CH1903+ / LV95)")
77 wxTRANSLATE("EPSG:3857") //"World (WGS84)"),
78};
79
80enum PRJDEF_PROJ_TYPE {
81 PROJ_SWISS_CH1903 = 0,
82 PROJ_SWISS_CH1903PLUS,
83 PROJ_WORLD_WGS84
84};
85static const int PRJDEF_PROJ_TYPE_NUMBER = 3;
86
87// Definitions for the field type, we define the text and the id of
88// each string. The number of items in the list is also defined here.
89static wxString PRJDEF_FIELD_TYPE_STRING[] = {wxTRANSLATE("Enumeration"), wxTRANSLATE("Text"), wxTRANSLATE("Integer"),
90 wxTRANSLATE("Float"), wxTRANSLATE("Date")};
91enum PRJDEF_FIELD_TYPE {
92 TM_FIELD_ENUMERATION = 0,
93 TM_FIELD_TEXT,
94 TM_FIELD_INTEGER,
95 TM_FIELD_FLOAT,
96 TM_FIELD_DATE
97};
98static const int PRJDEF_FIELD_TYPE_NUMBER = 5;
99
100static wxString PRJDEF_FIELD_ORIENTATION_STRING[] = {wxTRANSLATE("Yes"), wxTRANSLATE("")};
101
102enum PRJDEF_FIELD_ORIENTATION {
103 TM_FIELD_ORIENT_YES = 0,
104 TM_FIELD_ORIENT_NO
105};
106
107// Definition for the constrain value type
108/*enum PRJDEF_FIELD_CONSTAIN_VALUE_TYPE
109{
110 TM_FIELD_CONSTRAIN_CODED = 0,
111 TM_FIELD_CONSTRAIN_RANGE,
112 TM_FIELD_NOT_CONSTRAIN
113};*/
114
115// Definitions for the layers type, we define the text and the id of
116// each string. The number of items in the list is also defined here.
117static wxString PRJDEF_LAYERS_TYPE_STRING[] = {wxTRANSLATE("Line"), wxTRANSLATE("Point"), wxTRANSLATE("Polygon")};
118enum PRJDEF_LAYERS_TYPE {
119 LAYER_LINE = 0,
120 LAYER_POINT,
121 LAYER_POLYGON
122};
123static const int PRJDEF_LAYERS_TYPE_NUMBER = 3; // only takes the 3 first
124
125// Definitions for the objects type, we define the text and the id of
126// each string. The number of items in the list is also defined here.
127static wxString PRJDEF_OBJECTS_FREQ_STRING[] = {_T(""), wxTRANSLATE("Frequent")};
128enum PRJDEF_OBJECTS_FREQ {
129 OBJECT_LESS_FREQUENT = 0,
130 OBJECT_FREQUENT
131};
132static const int PRJDEF_OBJECTSS_FREQ_NUMBER = 2;
133
134static const long NULL_LONG_VALUE = -9999;
135static const wxString NULL_LONG_STRING_VALUE = _T("-9999");
136
137/***************************************************************************/
145 private:
146 void InitMemberValues();
147
148 public:
149 long m_ValueID;
150 wxString m_ValueCode;
151 wxString m_ValueName;
152
154
155 ProjectDefMemoryFieldsCodedVal(const wxString& code, const wxString& desc);
156
158
159 static int ExtractCodedValuesFromString(const wxString& codedvalue, wxArrayString& results);
160
161 // copy
163};
164
165// Creating a list of MemoryObjects
166WX_DECLARE_OBJARRAY(ProjectDefMemoryFieldsCodedVal*, PrjMemFieldCodedValArray);
167
168/***************************************************************************/
176 private:
177 public:
178 long m_ObjectID;
179 wxString m_ObjectCode;
180 short m_ObjectType; // spatial type
181 wxString m_ObjectName;
182 PRJDEF_OBJECTS_FREQ m_ObjectFreq;
183
184 wxString m_ParentLayerName;
185
187
189
190 void InitMemberValues();
191
192 ProjectDefMemoryObjects& operator=(const ProjectDefMemoryObjects& source);
193};
194
195// Creating a list of MemoryObjects
196WX_DECLARE_OBJARRAY(ProjectDefMemoryObjects*, PrjMemObjectsArray);
197
198/***************************************************************************/
206 private:
207 void InitMemberValues();
208
209 wxString ExtractValuesFromString(const wxString& fielddef);
210
211 public:
212 int m_FieldID;
213 wxString m_Fieldname;
214 wxString m_FieldOldName; // used for modifications
215 PRJDEF_FIELD_TYPE m_FieldType;
216 int m_FieldPrecision;
217 int m_FieldScale;
218 bool m_FieldOrientation;
219 bool m_FieldConstrain;
220
221 // for storing layers to delete
222 wxArrayLong m_StoreDeleteCodedValues;
223
224 // for storing coded values
225 PrjMemFieldCodedValArray m_pCodedValueArray;
226
228
230
231 bool SetValues(const wxString& fieldname, const wxString& fielddef, const wxString& fieldcomment = _T(""));
232
233 bool GetStringTypeFromValues(wxString& sResult);
234
235 static wxString GetOrientationName() {
236 return _T("ORIENTATION");
237 }
238
239 // copy function
241};
242
243// Creating a list of MemoryFields
244WX_DECLARE_OBJARRAY(ProjectDefMemoryFields*, PrjMemFieldArray);
245
246/***************************************************************************/
254 private:
255 void InitMemberValues();
256
257 public:
258 int m_LayerID;
259 PRJDEF_LAYERS_TYPE m_LayerType;
260 wxString m_LayerName;
261 // for special case : polygons and default border value
262 wxString m_LayerPolygonDefaultValue;
263
265 PrjMemFieldArray m_pLayerFieldArray;
267 PrjMemObjectsArray m_pLayerObjectArray;
268
269 // for storing layers to delete
270 wxArrayString m_StoreDeleteFields;
271
273
275
276 // copy operator
278};
279
280// Creating a list of MemoryLayers
281WX_DECLARE_OBJARRAY(ProjectDefMemoryLayers*, PrjMemLayersArray);
282
284 private:
285 void InitMemberValues();
286
287 public:
288 long m_DBScaleID;
289 long m_ScaleValue;
290
292
294};
295
296// Creating a list of MemoryLayers
297WX_DECLARE_OBJARRAY(ProjectDefMemoryScale, PrjMemScaleArray);
298
299#endif
Storing coded val linked to a field in memory.
Definition projectdefmemory.h:144
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:205
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:253
~ProjectDefMemoryLayers()
Definition projectdefmemory.cpp:312
PrjMemFieldArray m_pLayerFieldArray
list of fields related to a layer
Definition projectdefmemory.h:265
ProjectDefMemoryLayers & operator=(const ProjectDefMemoryLayers &source)
Overloading = operator.
Definition projectdefmemory.cpp:344
PrjMemObjectsArray m_pLayerObjectArray
list of objects related to a layer
Definition projectdefmemory.h:267
Storing object properties in memory.
Definition projectdefmemory.h:175
Definition projectdefmemory.h:283
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