68 m_Parameters.Set_Name (
"BASEMAP");
69 m_Parameters.Set_Identifier(
"BASEMAP");
72 m_Parameters.Add_Node(
"",
"NODE_GENERAL",
_TL(
"General") ,
_TL(
""));
74 m_Parameters.Add_String(
"NODE_GENERAL",
80 m_Parameters.Add_Choice(
"NODE_GENERAL",
81 "SERVER" ,
_TL(
"Server"),
84 SG_T(
"Open Street Map"),
86 SG_T(
"Google Satellite"),
87 SG_T(
"Google Hybrid"),
88 SG_T(
"Google Terrain"),
89 SG_T(
"Google Terrain, Streets and Water"),
90 SG_T(
"ArcGIS MapServer Tiles"),
92 SG_T(
"EMODnet Bathymetry WMTS service"),
97 m_Parameters.Add_String(
"SERVER",
98 "SERVER_USER",
_TL(
"Server"),
100 "tile.openstreetmap.org/${z}/${x}/${y}.png"
103 m_Parameters.Add_Int(
"SERVER",
104 "SERVER_EPSG" ,
_TL(
"EPSG"),
110 m_Parameters.Add_Bool(
"NODE_GENERAL",
111 "CACHE" ,
_TL(
"Cache"),
112 _TL(
"Enable local disk cache. Allows for offline operation."),
116 m_Parameters.Add_FilePath(
"CACHE",
117 "CACHE_DIR" ,
_TL(
"Cache Directory"),
118 _TL(
"If not specified the cache will be created in the current user's temporary directory."),
119 NULL, NULL,
false,
true
123 m_Parameters.Add_Node(
"",
"NODE_DISPLAY",
_TL(
"Display") ,
_TL(
""));
125 m_Parameters.Add_Double(
"NODE_DISPLAY",
126 "TRANSPARENCY",
_TL(
"Transparency"),
127 _TL(
"Transparency specified as percentage."),
128 0., 0.,
true, 100.,
true
131 m_Parameters.Add_Double(
"NODE_DISPLAY",
132 "BRIGHTNESS" ,
_TL(
"Maximum Brightness"),
133 _TL(
"Brightness threshold [%] below a pixel is displayed. Set to 100% to display all (default)."),
134 100., 0.,
true, 100.,
true
137 m_Parameters.Add_Choice(
"NODE_DISPLAY",
138 "GRAYSCALE" ,
_TL(
"Gray Scale"),
143 _TL(
"yes, contrastet")
147 m_Parameters.Add_Double(
"NODE_DISPLAY",
148 "RESOLUTION" ,
_TL(
"Resolution"),
149 _TL(
"resolution measured in screen pixels"),
170 for(
int i=0; i<Parameters.
Get_Count(); i++)
172 CSG_Parameter *pParameter = m_Parameters(Parameters[i].Get_Identifier());
174 if( pParameter && pParameter->
Get_Type() == Parameters[i].Get_Type() )
236 if( System != m_BaseMap.Get_System() )
240 wxColour oldColour(dc_Map.
Get_DC().GetTextForeground()); dc_Map.
Get_DC().SetTextForeground(*wxLIGHT_GREY);
241 wxFont oldFont (dc_Map.
Get_DC().GetFont ()); dc_Map.
Get_DC().SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
243 wxString Text(
_TL(
"Base Map Error")); wxSize Size(dc_Map.
Get_DC().GetTextExtent(Text));
245 for(
int y=dc_Map.
rDC().GetTop(), x0=0; y<=dc_Map.
rDC().GetBottom(); y+=2*Size.y, x0=x0?0:Size.x)
247 for(
int x=dc_Map.
rDC().GetLeft()+x0; x<=dc_Map.
rDC().GetRight(); x+=2*Size.x)
253 dc_Map.
Get_DC().SetTextForeground(oldColour);
254 dc_Map.
Get_DC().SetFont (oldFont );
261 if( dc_Map.
Draw_Image_Begin(m_Parameters[
"TRANSPARENCY"].asDouble() / 100.) )
263 #pragma omp parallel for
264 for(
int y=0; y<m_BaseMap.Get_NY(); y++)
for(
int x=0, yy=m_BaseMap.Get_NY()-y-1; x<m_BaseMap.Get_NX(); x++)
266 if( !m_BaseMap.is_NoData(x, yy) )
299 CSG_Grid_System _System(System);
301 if( m_Parameters[
"RESOLUTION"].
asDouble() > 1. )
306 if( _System != m_BaseMap.Get_System() )
320 && pTool->
Set_Parameter(
"SERVER_USER", m_Parameters(
"SERVER_USER"))
321 && pTool->
Set_Parameter(
"SERVER_EPSG", m_Parameters(
"SERVER_EPSG"))
323 && pTool->
Set_Parameter(
"CACHE_DIR" , m_Parameters(
"CACHE_DIR" ))
324 && pTool->
Set_Parameter(
"GRAYSCALE" , m_Parameters[
"GRAYSCALE" ].asInt() != 0)
329 int bGrayscale = m_Parameters[
"GRAYSCALE"].asInt();
331 if( System != m_BaseMap.Get_System() )
335 #pragma omp parallel for
336 for(
int y=0; y<m_BaseMap.Get_NY(); y++)
for(
int x=0; x<m_BaseMap.Get_NX(); x++)
342 m_BaseMap.Set_Value(x, y, c);
346 m_BaseMap.Set_NoData(x, y);
353 double offset = 0., scale = 1.;
355 if( bGrayscale == 2 && m_BaseMap.Get_Range() > 0. )
357 offset = m_BaseMap.Get_Min(); scale = 255. / m_BaseMap.Get_Range();
360 #pragma omp parallel for
361 for(
int y=0; y<m_BaseMap.Get_NY(); y++)
for(
int x=0; x<m_BaseMap.Get_NX(); x++)
363 if( m_BaseMap.is_NoData(x, y) ==
false )
365 int c = (int)(scale * (m_BaseMap.asDouble(x, y) - offset));
367 m_BaseMap.Set_Value(x, y,
SG_GET_RGB(c, c, c));
372 if( m_Parameters[
"BRIGHTNESS"].
asDouble() < 100. )
374 int Threshold = (int)(0.5 + 3 * 255 * m_Parameters[
"BRIGHTNESS"].
asDouble() / 100.);
376 #pragma omp parallel for
377 for(
sLong i=0; i<m_BaseMap.Get_NCells(); i++)
379 int c = m_BaseMap.asInt(i);
383 m_BaseMap.Set_NoData(i);
388 else if( pTool == m_pTool )
400 return( m_BaseMap.is_Valid() );
void SG_UI_ProgressAndMsg_Lock(bool bOn)
#define SG_GET_RGB(r, g, b)
TSG_Point Get_Grid_to_World(int xGrid, int yGrid) const
double Get_Cellsize(void) const
const CSG_Rect & Get_Extent(bool bCells=false) const
virtual bool Destroy(void)
virtual bool Parameters_Changed(void)
virtual bool Draw(CSG_Map_DC &dc, const CSG_Projection &Projection)
virtual bool Set_Parameters(const CSG_Parameters &Parameters)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual ~CSG_Map_BaseMap(void)
bool Draw_Image_Begin(double Transparency, Mode Mode=Mode::Transparent)
const CSG_Rect & rWorld(void) const
wxMemoryDC & Get_DC(void)
const wxRect & rDC(void) const
void Draw_Image_Pixel(int x, int y, int Color)
bool Draw_Image_End(void)
const double & DC2World(void) const
int Get_Count(void) const
bool Assign(CSG_Parameter *pSource)
class CSG_Parameter_Choice * asChoice(void) const
virtual TSG_Parameter_Type Get_Type(void) const =0
const SG_Char * asString(void) const
bool Cmp_Identifier(const CSG_String &Identifier) const
int Get_Count(void) const
void Set_Enabled(bool bEnabled=true)
double Get_XMin(void) const
double Get_YMin(void) const
int Cmp(const CSG_String &String) const
static CSG_String Format(const char *Format,...)
void SG_DC_Draw_Text(wxDC &dc, int Align, int x, int y, const wxString &Text)
#define SG_DC_TEXTALIGN_CENTER
#define SG_DC_TEXTEFFECT_FRAME
#define PARAMETER_CHECK_ENABLE