ToolMap
Loading...
Searching...
No Matches
tmsnappingmemory.h
1/***************************************************************************
2 tmsnappingmemory.h
3 Store snapping status into memory for faster access
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#ifndef _TM_SNAPPING_MEMORY_H_
18#define _TM_SNAPPING_MEMORY_H_
19
20#include <wx/wxprec.h>
21
22#ifndef WX_PRECOMP
23#include <wx/wx.h>
24#endif
25
26const int tmSNAPPING_OFF = 0;
27const int tmSNAPPING_VERTEX = 1;
28const int tmSNAPPING_BEGIN_END = 2;
29const wxString tmSNAPPING_TEXT_YES = wxTRANSLATE("Yes");
30
31const wxString tmSNAPPING_TEXT[] = {_T(""), wxTRANSLATE("all vertex"), wxTRANSLATE("begin / end")};
32
34 private:
35 void InitMemberValues();
36
37 public:
38 long m_LayerID;
39 int m_SnappingStatus;
40
42
44};
45// Creating a list of MemoryObjects
46WX_DECLARE_OBJARRAY(tmSnappingObject, tmSnappingObjArray);
47
48/***************************************************************************/
59class tmSnappingMemory : public wxObject {
60 private:
61 tmSnappingObjArray m_Snapping;
62 int m_Tolerence;
63
64 protected:
65 int FindSnappingItem(const long& lid);
66
67 public:
69
71
72 // snapping operations
73 void AddSnappingMemory(long lid, int snapstatus);
74
75 unsigned int GetCount() {
76 return m_Snapping.GetCount();
77 }
78
79 bool DeleteSnappingMemory(const long& lid);
80
81 int GetSnappingMemoryStatus(const long& lid);
82
83 bool SetSnappingMemoryStatus(const long& lid, int snapstatus);
84
85 bool GetSnappingInfo(unsigned int iIndex, long& lid, int& snapstatus);
86
87 void Clear() {
88 m_Snapping.Clear();
89 }
90
92
93 // tolerence operations
94 void SetTolerence(int tolereance) {
95 m_Tolerence = tolereance;
96 }
97
98 int GetTolerence() {
99 return m_Tolerence;
100 }
101
102 // misc function
103 bool IsSnappingEnabled();
104};
105
106#endif
Store snapping status into memory.
Definition tmsnappingmemory.h:59
int FindSnappingItem(const long &lid)
Search for specified layer ID in memory array.
Definition tmsnappingmemory.cpp:137
~tmSnappingMemory()
Destructor.
Definition tmsnappingmemory.cpp:46
bool GetSnappingInfo(unsigned int iIndex, long &lid, int &snapstatus)
Get snapping info by index.
Definition tmsnappingmemory.cpp:122
bool DeleteSnappingMemory(const long &lid)
Delete a layer from the memory array.
Definition tmsnappingmemory.cpp:75
bool IsSnappingEnabled()
Checks if snapping is enabled.
Definition tmsnappingmemory.cpp:170
int GetSnappingMemoryStatus(const long &lid)
Get the snapping status for specified layer.
Definition tmsnappingmemory.cpp:91
void AddSnappingMemory(long lid, int snapstatus)
Add snapping to memory.
Definition tmsnappingmemory.cpp:60
bool SetSnappingMemoryStatus(const long &lid, int snapstatus)
Change, or set snapping to existing layer.
Definition tmsnappingmemory.cpp:106
void ClearSnappingStatus()
Set all snapping status to tmSNAPPING_OFF.
Definition tmsnappingmemory.cpp:155
tmSnappingMemory()
Constructor.
Definition tmsnappingmemory.cpp:37
Definition tmsnappingmemory.h:33