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_Map.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_Map_H 52 #define _HEADER_INCLUDED__SAGA_GUI__WKSP_Map_H 53 54 55 /////////////////////////////////////////////////////////// 56 // // 57 // // 58 // // 59 /////////////////////////////////////////////////////////// 60 61 //--------------------------------------------------------- 62 #include <saga_api/saga_api.h> 63 64 #include "wksp_base_manager.h" 65 66 67 /////////////////////////////////////////////////////////// 68 // // 69 // // 70 // // 71 /////////////////////////////////////////////////////////// 72 73 //--------------------------------------------------------- 74 class CWKSP_Map_Extents : public CSG_Rects 75 { 76 public: 77 CWKSP_Map_Extents(void); 78 is_First(void)79 bool is_First (void) { return( m_iExtent <= 0 ); } is_Last(void)80 bool is_Last (void) { return( m_iExtent >= m_nExtents - 1 ); } 81 82 CSG_Rect Set_Back (void); 83 CSG_Rect Set_Forward (void); 84 85 bool Add_Extent (const CSG_Rect &Extent, bool bReset = false); Get_Extent(void)86 const CSG_Rect & Get_Extent (void) { return( m_iExtent >= 0 ? Get_Rect(m_iExtent) : m_Dummy ); } 87 88 89 private: 90 91 int m_iExtent, m_nExtents; 92 93 static CSG_Rect m_Dummy; 94 95 }; 96 97 98 /////////////////////////////////////////////////////////// 99 // // 100 // // 101 // // 102 /////////////////////////////////////////////////////////// 103 104 //--------------------------------------------------------- 105 class CWKSP_Map : public CWKSP_Base_Manager 106 { 107 public: 108 CWKSP_Map(void); 109 virtual ~CWKSP_Map(void); 110 Get_Type(void)111 virtual TWKSP_Item Get_Type (void) { return( WKSP_ITEM_Map ); } 112 113 virtual wxString Get_Name (void); 114 virtual wxString Get_Description (void); 115 116 virtual wxMenu * Get_Menu(void); 117 118 virtual bool On_Command (int Cmd_ID); 119 virtual bool On_Command_UI (wxUpdateUIEvent &event); 120 121 virtual void Parameters_Changed (void); 122 123 bool Serialize (CSG_MetaData &Root, const wxString &ProjectDir, bool bSave); 124 Get_Extent(void)125 const CSG_Rect & Get_Extent (void) { return( m_Extents.Get_Extent() ); } 126 bool Set_Extent (const CSG_Rect &Extent, bool bReset = false, bool bPan = false); 127 bool Set_Extent (const CSG_Rect &Extent, const CSG_Projection &Projection, bool bPan = false); 128 bool Set_Extent (void); 129 bool Set_Extent_Full (void); 130 bool Set_Extent_Active (bool bPan); 131 bool Set_Extent_Selection (bool bPan); 132 bool Set_Extent_Back (bool bCheck_Only = false); 133 bool Set_Extent_Forward (bool bCheck_Only = false); 134 135 bool is_Synchronising (void); 136 void Set_Synchronising (bool bOn); 137 void Lock_Synchronising (bool bOn); 138 139 bool is_North_Arrow (void); 140 void Set_North_Arrow (bool bOn); 141 142 bool is_ScaleBar (bool bFrame = false); 143 void Set_ScaleBar (bool bOn); 144 is_Image_Save_Mode(void)145 bool is_Image_Save_Mode (void) { return( m_Img_bSave ); } 146 147 void Set_Mouse_Position (const TSG_Point &Point); 148 void Set_CrossHair (const TSG_Point &Point, const CSG_Projection &Projection); 149 void Set_CrossHair_Off (void); 150 151 bool Update (class CWKSP_Layer *pLayer, bool bMapOnly); 152 int Get_Map_Layer_Index (class CWKSP_Layer *pLayer); 153 class CWKSP_Map_Layer * Get_Map_Layer (class CWKSP_Layer *pLayer); 154 class CWKSP_Map_Layer * Get_Map_Layer_Active (bool bEditable = false); 155 class CWKSP_Map_Layer * Add_Layer (class CWKSP_Layer *pLayer); 156 class CWKSP_Map_Graticule * Add_Graticule (CSG_MetaData *pEntry = NULL); 157 class CWKSP_Map_BaseMap * Add_BaseMap (CSG_MetaData *pEntry = NULL); 158 class CWKSP_Base_Item * Add_Copy (CWKSP_Base_Item *pItem); 159 160 bool View_Opened (class MDI_ChildFrame *pView); 161 void View_Closes (class MDI_ChildFrame *pView); 162 void View_Refresh (bool bMapOnly); View_Get(void)163 class CVIEW_Map * View_Get (void) { return( m_pView ); } 164 void View_Show (bool bShow); 165 void View_Toggle (void); View_3D_Get(void)166 class CVIEW_Map_3D * View_3D_Get (void) { return( m_pView_3D ); } 167 void View_3D_Show (bool bShow); 168 void View_3D_Toggle (void); View_Layout_Get(void)169 class CVIEW_Layout * View_Layout_Get (void) { return( m_pLayout ); } 170 void View_Layout_Show (bool bShow); 171 void View_Layout_Toggle (void); 172 173 CSG_Rect Get_World (wxRect rClient); 174 CSG_Point Get_World (wxRect rClient, wxPoint ptClient); 175 176 bool Get_Image (wxImage &Image, CSG_Rect &rWorld); 177 void SaveAs_Image (void); 178 void SaveAs_Image_Clipboard (int nx, int ny, int frame); 179 void SaveAs_Image_Clipboard (bool bLegend = false); 180 void SaveAs_Image_To_KMZ (int nx, int ny); 181 void SaveAs_Image_To_Memory (int nx, int ny); 182 void SaveAs_Image_On_Change (void); 183 void SaveAs_Image_To_Grid (CSG_Grid &Grid, int Size); 184 185 void Draw_Map (wxDC &dc , double Zoom, const wxRect &rClient, int Flags = 0, int Background = -1); 186 void Draw_Map (wxDC &dc, const CSG_Rect &rWorld, double Zoom, const wxRect &rClient, int Flags = 0, int Background = -1); 187 void Draw_Frame (wxDC &dc, wxRect rMap, int Width); 188 void Draw_Frame (wxDC &dc, const CSG_Rect &rWorld, wxRect rMap, int Width, bool bScaleBar); 189 bool Draw_Legend (wxDC &dc, double Zoom_Map, double Zoom, wxPoint Position, wxSize *pSize = NULL); 190 191 bool Draw_North_Arrow (class CWKSP_Map_DC &dc_Map, const CSG_Rect &rWorld, const wxRect &rClient); 192 bool Draw_ScaleBar (class CWKSP_Map_DC &dc_Map, const CSG_Rect &rWorld, const wxRect &rClient); 193 bool Draw_Extent (class CWKSP_Map_DC &dc_Map, const CSG_Rect &rWorld, const wxRect &rClient); 194 195 const wxBitmap & Get_Thumbnail (int dx, int dy); 196 197 bool Get_Legend_Size (wxSize &Size, double Zoom_Map = 1.0, double Zoom = 1.0); 198 199 int Get_Frame_Width (void); 200 201 void Set_Projection (void); Get_Projection(void)202 CSG_Projection & Get_Projection (void) { return( m_Projection ); } 203 204 void Show_Coordinate (const CSG_Point &Coordinate) const; 205 206 207 protected: 208 209 virtual void On_Create_Parameters (void); 210 211 virtual int On_Parameter_Changed (CSG_Parameters *pParameters, CSG_Parameter *pParameter, int Flags); 212 213 214 private: 215 216 bool m_Img_bSave; 217 218 int m_Img_Type, m_Img_Count, m_Sync_bLock; 219 220 wxString m_Name, m_Img_File; 221 222 wxBitmap m_Thumbnail; 223 224 CSG_Parameters m_Img_Parms; 225 226 CSG_Projection m_Projection; 227 228 CWKSP_Map_Extents m_Extents; 229 230 class CVIEW_Map *m_pView; 231 232 class CVIEW_Map_3D *m_pView_3D; 233 234 class CVIEW_Layout *m_pLayout; 235 236 class CVIEW_Layout_Info *m_pLayout_Info; 237 238 239 bool _Set_Extent (const CSG_Rect &Extent); 240 241 void _Img_Save (wxString file, int type); 242 void _Img_Save_On_Change (void); 243 244 bool _Set_Thumbnail (void); 245 246 }; 247 248 249 /////////////////////////////////////////////////////////// 250 // // 251 // // 252 // // 253 /////////////////////////////////////////////////////////// 254 255 //--------------------------------------------------------- 256 #endif // #ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Map_H 257