ToolMap
Loading...
Searching...
No Matches
tmselecteddatamemory.h
1/***************************************************************************
2 tmSelectedDataMemory.h
3 Store ID of selected data into memory
4 -------------------
5 copyright : (C) 2008 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_SELECTEDDATAMEMORY_H_
20#define _TM_SELECTEDDATAMEMORY_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 <wx/dynarray.h> // support for array
31
32WX_DEFINE_SORTED_ARRAY_LONG(long, tmArraySortedLong);
33
34/***************************************************************************/
43class tmSelectedDataMemory : public wxObject {
44 private:
45 long m_LayerID;
46 tmArraySortedLong* m_SelectedIDs;
47 wxColour m_Colour;
48 bool m_HasHalo;
49
50 void InitMemberValues();
51
52 protected:
53 int Search(const long& value);
54
55 public:
56 // ctor(s) and destructors
58
60
61 // operations
62 bool AddSelected(wxArrayLong* selected);
63
64 bool Remove(wxArrayLong* selected = nullptr);
65
66 bool IsSelected(const long& value);
67
68 unsigned int GetCount();
69
70 void SetSelected(long selected);
71
72 // getters / setters
73 void SetLayerID(long layerID);
74
75 void Clear() {
76 m_SelectedIDs->Clear();
77 }
78
79 wxColour GetSelectionColour() {
80 return m_Colour;
81 }
82
83 void SetSelectionColour(const wxColour& col) {
84 m_Colour = col;
85 }
86
87 void SetSelectionHalo(bool hashalo) {
88 m_HasHalo = hashalo;
89 }
90
91 bool GetSelectionHalo() {
92 return m_HasHalo;
93 }
94
95 long GetSelectedLayer() {
96 return m_LayerID;
97 }
98
99 wxArrayLong* GetSelectedValues();
100
101 long GetSelectedUnique();
102};
103
104#endif
Store ID of selected data into memory.
Definition tmselecteddatamemory.h:43
~tmSelectedDataMemory()
Destructor.
Definition tmselecteddatamemory.cpp:42
long GetSelectedUnique()
Get the selected value.
Definition tmselecteddatamemory.cpp:217
wxArrayLong * GetSelectedValues()
Getting selected values.
Definition tmselecteddatamemory.cpp:199
bool Remove(wxArrayLong *selected=nullptr)
Removing items from the array.
Definition tmselecteddatamemory.cpp:134
void SetSelected(long selected)
Save any geometry into database.
Definition tmselecteddatamemory.cpp:102
bool AddSelected(wxArrayLong *selected)
Add selected ID to memory.
Definition tmselecteddatamemory.cpp:71
int Search(const long &value)
Search for existing item in the array.
Definition tmselecteddatamemory.cpp:117
bool IsSelected(const long &value)
Is this object selected.
Definition tmselecteddatamemory.cpp:161
tmSelectedDataMemory()
Constructor.
Definition tmselecteddatamemory.cpp:32
unsigned int GetCount()
Count the number of selected features.
Definition tmselecteddatamemory.cpp:172
void SetLayerID(long layerID)
Set on which layer we are working on.
Definition tmselecteddatamemory.cpp:186