-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrender_geojson.hh
166 lines (143 loc) · 4.34 KB
/
render_geojson.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#ifndef WX_RENDER_GEOJSON
#define WX_RENDER_GEOJSON 1
#include "wx/wxprec.h"
#include "wx/wx.h"
#include "wx/splitter.h"
#include "wx/artprov.h"
#include "wx/imaglist.h"
#include "wx/grid.h"
#include "wx/mdi.h"
#include "wx/toolbar.h"
#include "wx/laywin.h"
#include "wx/list.h"
#include "wx/cmdline.h"
#include "wx/datetime.h"
#include "wx/datectrl.h"
#include "wx/stattext.h"
#include "wx/dateevt.h"
#include "wx/panel.h"
#include "wx/calctrl.h"
#include "wx/timectrl.h"
#include "wx/collpane.h"
#include "wx/treectrl.h"
#include "grafix.hh"
#include "geojson.hh"
#include "topojson.hh"
enum
{
ID_NEXT_GEOMETRY = wxID_HIGHEST + 1,
ID_NEXT_POINT
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//rgb_t
/////////////////////////////////////////////////////////////////////////////////////////////////////
class rgb_t
{
public:
rgb_t(unsigned char r, unsigned char g, unsigned char b) :
red(r),
green(g),
blue(b)
{
}
unsigned char red;
unsigned char green;
unsigned char blue;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//wxChart
/////////////////////////////////////////////////////////////////////////////////////////////////////
class wxChart : public wxScrolledWindow
{
public:
wxChart(wxWindow *parent);
virtual void OnDraw(wxDC& dc);
void OnMouseDown(wxMouseEvent &event);
void OnMouseMove(wxMouseEvent &event);
int m_is_topojson;
int read_geojson(const char* file_name);
/////////////////////////////////////////////////////////////////////////////////////////////////////
//topojson
/////////////////////////////////////////////////////////////////////////////////////////////////////
int read_topojson(const char* file_name, wxTreeCtrl *tree, wxTreeItemId item_id);
void draw_geometry(wxDC& dc, const topology_object_t& topology, size_t idx_geom);
void draw_topology(wxDC& dc, const topology_object_t& topology);
void next_geometry();
void next_point();
private:
double x_low, y_low, x_high, y_high; //data
int x_min, x_max, y_min, y_max; //screen
std::vector<rgb_t> rgb_256;
graf_t m_graf;
geojson_t m_geojson;
topojson_t m_topojson;
size_t m_curr_geom;
size_t m_curr_point;
wxDECLARE_EVENT_TABLE();
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//wxTreeCtrlExplorer
/////////////////////////////////////////////////////////////////////////////////////////////////////
class wxTreeCtrlExplorer : public wxTreeCtrl
{
public:
wxTreeCtrlExplorer(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
void OnSelChanged(wxTreeEvent& event);
void select_item(size_t);
private:
wxTreeItemId find_item(wxTreeItemId parent, size_t curr_geom);
wxDECLARE_EVENT_TABLE();
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//wxFrameMain
/////////////////////////////////////////////////////////////////////////////////////////////////////
class wxFrameMain : public wxFrame
{
public:
wxFrameMain();
~wxFrameMain();
void OnFileOpen(wxCommandEvent &event);
void OnMRUFile(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnNextGeometry(wxCommandEvent& event);
void OnNextPoint(wxCommandEvent& event);
wxString m_current_file;
wxTreeCtrlExplorer *m_tree;
protected:
wxWindow *m_win_grid;
wxTreeItemId m_tree_root;
wxChart *m_win_chart;
wxSplitterWindow* m_splitter;
int read(const std::string &file_name);
wxFileHistory m_file_history;
//tree icons
enum
{
id_folder,
id_variable
};
private:
wxDECLARE_EVENT_TABLE();
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//wxAppAlert
/////////////////////////////////////////////////////////////////////////////////////////////////////
class wxAppAlert : public wxApp
{
public:
virtual bool OnInit();
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
//ItemData
/////////////////////////////////////////////////////////////////////////////////////////////////////
class ItemData : public wxTreeItemData
{
public:
ItemData(size_t curr_geom) :
m_curr_geom(curr_geom)
{
}
size_t m_curr_geom;
};
#endif