1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                    User Interface                     //
9 //                                                       //
10 //                    Program: SAGA                      //
11 //                                                       //
12 //-------------------------------------------------------//
13 //                                                       //
14 //                     WKSP_Layer.h                      //
15 //                                                       //
16 //          Copyright (C) 2005 by Olaf Conrad            //
17 //                                                       //
18 //-------------------------------------------------------//
19 //                                                       //
20 // This file is part of 'SAGA - System for Automated     //
21 // Geoscientific Analyses'. SAGA is free software; you   //
22 // can redistribute it and/or modify it under the terms  //
23 // of the GNU General Public License as published by the //
24 // Free Software Foundation, either version 2 of the     //
25 // License, or (at your option) any later version.       //
26 //                                                       //
27 // SAGA is distributed in the hope that it will be       //
28 // useful, but WITHOUT ANY WARRANTY; without even the    //
29 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
30 // PARTICULAR PURPOSE. See the GNU General Public        //
31 // License for more details.                             //
32 //                                                       //
33 // You should have received a copy of the GNU General    //
34 // Public License along with this program; if not, see   //
35 // <http://www.gnu.org/licenses/>.                       //
36 //                                                       //
37 //-------------------------------------------------------//
38 //                                                       //
39 //    contact:    Olaf Conrad                            //
40 //                Institute of Geography                 //
41 //                University of Goettingen               //
42 //                Goldschmidtstr. 5                      //
43 //                37077 Goettingen                       //
44 //                Germany                                //
45 //                                                       //
46 //    e-mail:     oconrad@saga-gis.org                   //
47 //                                                       //
48 ///////////////////////////////////////////////////////////
49 
50 //---------------------------------------------------------
51 #ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Layer_H
52 #define _HEADER_INCLUDED__SAGA_GUI__WKSP_Layer_H
53 
54 
55 ///////////////////////////////////////////////////////////
56 //														 //
57 //														 //
58 //														 //
59 ///////////////////////////////////////////////////////////
60 
61 //---------------------------------------------------------
62 #include "wksp_data_item.h"
63 
64 #include "wksp_layer_classify.h"
65 
66 #include "wksp_map_dc.h"
67 
68 
69 ///////////////////////////////////////////////////////////
70 //														 //
71 //														 //
72 //														 //
73 ///////////////////////////////////////////////////////////
74 
75 //---------------------------------------------------------
76 class CWKSP_Layer : public CWKSP_Data_Item
77 {
78 public:
79 	CWKSP_Layer(CSG_Data_Object *pObject);
80 	virtual ~CWKSP_Layer(void);
81 
82 	virtual bool					On_Command				(int Cmd_ID);
83 	virtual bool					On_Command_UI			(wxUpdateUIEvent &event);
84 
Get_Object(void)85 	CSG_Data_Object *				Get_Object				(void)	{	return( m_pObject );	}
86 	CSG_Rect						Get_Extent				(void);
87 
88 	CSG_Colors *					Get_Colors				(void);
89 	bool							Get_Colors				(CSG_Colors *pColors);
90 	bool							Set_Colors				(CSG_Colors *pColors);
91 	bool							Set_Color_Range			(double Minimum, double Maximum);
92 
93 	virtual wxString				Get_Value				(CSG_Point ptWorld, double Epsilon)	= 0;
94 	virtual double					Get_Value_Minimum		(void)								= 0;
95 	virtual double					Get_Value_Maximum		(void)								= 0;
96 	virtual double					Get_Value_Range			(void)								= 0;
97 	virtual double					Get_Value_Mean			(void)								= 0;
98 	virtual double					Get_Value_StdDev		(void)								= 0;
99 
100 	bool							Draw					(CWKSP_Map_DC &dc_Map, int Flags = 0, CSG_Data_Object *pObject = NULL);
101 
Get_Classifier(void)102 	class CWKSP_Layer_Classify *	Get_Classifier			(void)	{	return( m_pClassify );	}
103 
Get_Legend(void)104 	class CWKSP_Layer_Legend *		Get_Legend				(void)	{	return( m_pLegend );	}
105 	bool							do_Legend				(void);
106 	bool							do_Show					(CSG_Rect const &Map_Extent, bool bIntersects = true);
107 
108 	virtual bool					Show					(class CWKSP_Map *pMap);
109 	virtual bool					Show					(int Flags = 0);
110 	virtual bool					Update					(CWKSP_Layer *pChanged);
111 	virtual bool					View_Closes				(class MDI_ChildFrame *pView);
asImage(CSG_Grid * pImage)112 	virtual bool					asImage					(CSG_Grid *pImage)		{	return( false );	}
113 
114 
115 	const wxBitmap &				Get_Thumbnail			(int dx, int dy);
116 
117 	void							Histogram_Show			(bool bShow);
118 	void							Histogram_Toggle		(void);
119 
120 	virtual wxMenu *				Edit_Get_Menu			(void);
121 	virtual TSG_Rect				Edit_Get_Extent			(void)	= 0;
122 	virtual bool					Edit_On_Key_Down		(int KeyCode);
123 	virtual bool					Edit_On_Mouse_Down		(CSG_Point Point, double ClientToWorld, int Key);
124 	virtual bool					Edit_On_Mouse_Up		(CSG_Point Point, double ClientToWorld, int Key);
125 	virtual bool					Edit_On_Mouse_Move		(wxWindow *pMap, CSG_Rect rWorld, wxPoint pt, wxPoint ptLast, int Key);
126 	virtual bool					Edit_Set_Index			(int Index);
Edit_Set_Attributes(void)127 	virtual bool					Edit_Set_Attributes		(void)	{	return( false );	}
128 	int								Edit_Get_Index			(void);
129 	CSG_Table *						Edit_Get_Attributes		(void);
130 
131 
132 protected:
133 
134 	int								m_Edit_Index;
135 
136 	CSG_Parameter_Range				*m_pZRange;
137 
138 	CSG_Point						m_Edit_Mouse_Down;
139 
140 	CSG_Table						m_Edit_Attributes;
141 
142 	class CWKSP_Layer_Classify		*m_pClassify;
143 
144 	class CWKSP_Layer_Legend		*m_pLegend;
145 
146 	class CVIEW_Histogram			*m_pHistogram;
147 
148 	wxBitmap						m_Thumbnail;
149 
150 
151 	virtual void					On_Create_Parameters	(void);
152 	virtual void					On_DataObject_Changed	(void);
153 	virtual void					On_Parameters_Changed	(void);
154 
155 	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter, int Flags);
156 
157 	virtual void					On_Update_Views			(bool bAll);
On_Update_Views(void)158 	virtual void					On_Update_Views			(void)			{}
159 
160 	virtual void					On_Draw					(CWKSP_Map_DC &dc_Map, int Flags)	= 0;
161 
162 	void							ColorsParms_Add			(void);
163 	void							ColorsParms_On_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter, int Flags);
164 	bool							ColorsParms_Adjust		(CSG_Parameters  &Parameters, CSG_Data_Object *pObject = NULL, const CSG_String &Suffix = "");
165 
166 
167 private:
168 
169 	bool							_Set_Thumbnail			(bool bRefresh);
170 
171 	void							_Set_Projection			(void);
172 
173 };
174 
175 
176 ///////////////////////////////////////////////////////////
177 //														 //
178 //														 //
179 //														 //
180 ///////////////////////////////////////////////////////////
181 
182 //---------------------------------------------------------
183 CWKSP_Layer *						Get_Active_Layer		(void);
184 
185 
186 ///////////////////////////////////////////////////////////
187 //														 //
188 //														 //
189 //														 //
190 ///////////////////////////////////////////////////////////
191 
192 //---------------------------------------------------------
193 #endif // #ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Layer_H
194