ToolMap
Loading...
Searching...
No Matches
tmattributiondata.h
1/***************************************************************************
2 tmattributiondata.h
3 Main class for attribution process
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TM_ATTRIBUTION_DATA_H_
20#define _TM_ATTRIBUTION_DATA_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include "../gui/attribution_obj_type.h" // attribution panel
31#include "tmattributionbasicarray.h" // for storing attribution into array
32
33class DataBaseTM;
34
35/***************************************************************************/
43class tmAttributionData : public wxObject {
44 private:
45 void InitMemberValues();
46
47 protected:
48 wxArrayLong* m_SelIDs;
49 DataBaseTM* m_pDB;
50
51 wxString m_TableName;
52
53 // checking function
54 virtual bool IsValid();
55
56 // database function
57 void PrepareAttributionStatement(wxString& statement, const wxString& tablename, wxArrayLong* checkedVal);
58
59 void PrepareCleaningStatement(wxString& statement, const wxString& tablename);
60
61 void PrepareGetInfoStatement(wxString& statement, const wxString& tablename);
62
63 void PrepareGetInfoMultipleStatement(wxString& statement, const wxString& tablename);
64
65 bool PrepareGetAttributionLayersID(const long& geomid, tmLayerValueArray& layersid, const wxString& tablename,
66 int layertype);
67
68 bool _GetInfoBasic(long oid, wxArrayLong& objid, wxArrayString& objcode, wxArrayString& objname, int layertype);
69
70 public:
71 // ctor - dtor
73
74 tmAttributionData(wxArrayLong* selected, DataBaseTM* database);
75
76 virtual void Create(wxArrayLong* selected, DataBaseTM* database);
77
79
80 // init database table
81 virtual void SetDataBaseTable(const wxString& tablename) {
82 m_TableName = tablename;
83 }
84
85 // attribution
86 virtual bool SetAttributeBasic(AttribObjType_PANEL* panel) {
87 return false;
88 }
89
90 virtual bool SetAttributeBasicValues(wxArrayLong* values);
91
92 virtual bool CleanAttributesAdvanced(long objectid, PrjDefMemManage* prjdef, PRJDEF_LAYERS_TYPE layertype);
93
94 virtual bool SetAttributesAdvanced(long objectid, PrjMemLayersArray* layers, const wxArrayString& values);
95
96 // copy attribution
97 virtual bool CopyAttributesBasic(const long& copyfrom);
98
99 // info
100 virtual bool GetInfoBasic(AttribObjType_PANEL* panel) {
101 return false;
102 }
103
104 virtual bool GetInfoBasic(long oid, wxArrayLong& objid, wxArrayString& objcode, wxArrayString& objname) {
105 return false;
106 }
107
108 virtual bool GetInfoBasicValues(const long& selected, wxArrayLong& values);
109
110 virtual bool GetInfoBasicArray(tmAttributionBasicArray& values);
111
112 static bool IsAttributionSimilar(const tmAttributionBasicArray& values);
113
114 bool GetBasicNameFromID(const tmAttributionBasic& myAttribObj, wxArrayString& txtvalues);
115
116 bool GetConcatenedBasicName(const tmAttributionBasicArray& myAttrib, wxArrayString& concatenedattrib);
117
118 virtual bool GetAttributesAdvanced(long objectid, PrjMemLayersArray* layers, wxArrayString& values);
119
120 // only for one layer
121 bool GetAdvancedAttribution(ProjectDefMemoryLayers* layer, wxArrayString& values, wxArrayString& codes,
122 long selected);
123
124 bool GetAdvancedAttribution(int layerid, long geomoid, wxArrayString& values);
125
126 virtual bool GetAttributionLayersID(const long& geomid, tmLayerValueArray& layersid) {
127 return false;
128 }
129
130 virtual bool GetAttributionLayersIDFull(const long& geomid, tmLayerValueArray& layersid) {
131 return false;
132 }
133};
134
135#endif
Definition attribution_obj_type.h:71
Definition database_tm.h:80
Definition prjdefmemmanage.h:54
Storing layers properties in memory.
Definition projectdefmemory.h:246
Definition tmattributionbasicarray.h:30
Class for attributing data.
Definition tmattributiondata.h:43
virtual bool SetAttributeBasicValues(wxArrayLong *values)
Set Basic attribution.
Definition tmattributiondata.cpp:178
void PrepareGetInfoStatement(wxString &statement, const wxString &tablename)
Create MySQL statement for getting info.
Definition tmattributiondata.cpp:140
virtual bool IsValid()
Verify validity of member objects.
Definition tmattributiondata.cpp:70
virtual bool GetInfoBasicArray(tmAttributionBasicArray &values)
Get basic attributions for selected objets.
Definition tmattributiondata.cpp:410
void PrepareCleaningStatement(wxString &statement, const wxString &tablename)
Create MySQL statement for attribution.
Definition tmattributiondata.cpp:124
void PrepareGetInfoMultipleStatement(wxString &statement, const wxString &tablename)
Create MySQL statement for getting info.
Definition tmattributiondata.cpp:155
virtual bool CopyAttributesBasic(const long &copyfrom)
Copy attribution between objects.
Definition tmattributiondata.cpp:351
static bool IsAttributionSimilar(const tmAttributionBasicArray &values)
Check array for similar attribution.
Definition tmattributiondata.cpp:465
bool GetBasicNameFromID(const tmAttributionBasic &myAttribObj, wxArrayString &txtvalues)
Get Basic attribution string from database.
Definition tmattributiondata.cpp:496
virtual bool CleanAttributesAdvanced(long objectid, PrjDefMemManage *prjdef, PRJDEF_LAYERS_TYPE layertype)
Clean advanced attribution.
Definition tmattributiondata.cpp:285
bool PrepareGetAttributionLayersID(const long &geomid, tmLayerValueArray &layersid, const wxString &tablename, int layertype)
Get Layer attributed for selected geometry.
Definition tmattributiondata.cpp:572
virtual bool GetAttributesAdvanced(long objectid, PrjMemLayersArray *layers, wxArrayString &values)
Get advanced attribution in all layers for an object ID.
Definition tmattributiondata.cpp:326
virtual bool GetInfoBasicValues(const long &selected, wxArrayLong &values)
Get basic attribution values for passed ID.
Definition tmattributiondata.cpp:377
tmAttributionData()
Default constructor.
Definition tmattributiondata.cpp:30
void PrepareAttributionStatement(wxString &statement, const wxString &tablename, wxArrayLong *checkedVal)
Create MySQL statement for attribution.
Definition tmattributiondata.cpp:94
bool GetAdvancedAttribution(ProjectDefMemoryLayers *layer, wxArrayString &values, wxArrayString &codes, long selected)
Get advanced attribution for a layer.
Definition tmattributiondata.cpp:660
virtual bool SetAttributesAdvanced(long objectid, PrjMemLayersArray *layers, const wxArrayString &values)
Set advanced attribution.
Definition tmattributiondata.cpp:203
bool GetConcatenedBasicName(const tmAttributionBasicArray &myAttrib, wxArrayString &concatenedattrib)
Get Concatened basic attribution values for object.
Definition tmattributiondata.cpp:531
~tmAttributionData()
Destructor.
Definition tmattributiondata.cpp:39