69 m_pDC =
new wxMemoryDC(); m_pBitmap =
new wxBitmap;
75 m_pDC =
new wxMemoryDC(); m_pBitmap =
new wxBitmap;
77 Create(Width, Height, Background);
83 delete(m_pDC);
delete(m_pBitmap);
94 m_pDC->SelectObject(wxNullBitmap);
96 if( Width > 0 && Height > 0 && m_pBitmap->Create(Width, Height) )
98 m_pDC->SelectObject(*m_pBitmap);
99 m_pDC->SetBackground(wxBrush(Background < 0 ? *wxWHITE : wxColour(
SG_GET_R(Background),
SG_GET_G(Background),
SG_GET_B(Background))));
126 if( m_pBitmap->IsOk() )
128 if(
SG_File_Cmp_Extension(File,
"jpg") && !wxImage::FindHandler(wxBITMAP_TYPE_JPEG) ) { wxImage::AddHandler(
new wxJPEGHandler); }
129 if(
SG_File_Cmp_Extension(File,
"png") && !wxImage::FindHandler(wxBITMAP_TYPE_PNG ) ) { wxImage::AddHandler(
new wxPNGHandler ); }
130 if(
SG_File_Cmp_Extension(File,
"tif") && !wxImage::FindHandler(wxBITMAP_TYPE_TIF ) ) { wxImage::AddHandler(
new wxTIFFHandler); }
131 if(
SG_File_Cmp_Extension(File,
"gif") && !wxImage::FindHandler(wxBITMAP_TYPE_GIF ) ) { wxImage::AddHandler(
new wxGIFHandler ); }
133 m_pDC->SelectObject(wxNullBitmap);
134 wxImage Image = m_pBitmap->ConvertToImage();
135 m_pDC->SelectObject(*m_pBitmap);
137 return( Image.SaveFile(File.
wx_str()) );
151 return( Map.
Draw(*
this, x, y, Frame) );
188 Create(rWorld, Width, Height, Scale, Background, bAlpha);
200 return( m_pDC->Create(rWorld, wxRect(0, 0, Width, Height), Scale, Background, bAlpha) );
206 return( m_pDC->Create(m_pDC->rWorld(), m_pDC->rDC(), m_pDC->Scale(), m_pDC->Get_Background(), m_pDC->has_Alpha()) );
224 wxDC &dc = *Canvas.m_pDC;
226 dc.DrawBitmap(m_pDC->Get_Bitmap(), x, y);
230 wxRect rMap(x, y, m_pDC->DC_Width(), m_pDC->DC_Height());
231 CSG_Rect rWorld = m_pDC->rWorld();
int Width = Frame;
bool bUseDCFont =
false;
bool bScaleBar =
false;
235 wxRect rFrame(rMap); rFrame.Inflate(Width);
237 SG_DC_Draw_Scale(dc, wxRect(rMap .GetLeft(), rFrame.GetTop(), rMap.GetWidth (), Width),
241 SG_DC_Draw_Scale(dc, wxRect(rFrame.GetLeft(), rMap .GetTop(), Width, rMap.GetHeight()),
245 if( bScaleBar ==
false )
247 SG_DC_Draw_Scale(dc, wxRect(rMap.GetLeft (), rMap.GetBottom(), rMap.GetWidth (), Width),
251 SG_DC_Draw_Scale(dc, wxRect(rMap.GetRight(), rMap.GetTop (), Width, rMap.GetHeight()),
257 SG_DC_Draw_Scale(dc, wxRect(rMap.GetLeft (), rMap.GetBottom(), rMap.GetWidth (), Width),
258 0., rWorld.
Get_XRange(),
true,
true,
true,
"", bUseDCFont
261 SG_DC_Draw_Scale(dc, wxRect(rMap.GetRight(), rMap.GetTop (), Width, rMap.GetHeight()),
262 0., rWorld.
Get_YRange(),
false,
false,
true,
"", bUseDCFont
275 return( Layer.
Draw(*
this) );
285 if( m_pDC->Get_Image(Image) )
287 if(
SG_File_Cmp_Extension(File,
"jpg") && !wxImage::FindHandler(wxBITMAP_TYPE_JPEG) ) { wxImage::AddHandler(
new wxJPEGHandler); }
288 if(
SG_File_Cmp_Extension(File,
"png") && !wxImage::FindHandler(wxBITMAP_TYPE_PNG ) ) { wxImage::AddHandler(
new wxPNGHandler ); }
289 if(
SG_File_Cmp_Extension(File,
"tif") && !wxImage::FindHandler(wxBITMAP_TYPE_TIF ) ) { wxImage::AddHandler(
new wxTIFFHandler); }
290 if(
SG_File_Cmp_Extension(File,
"gif") && !wxImage::FindHandler(wxBITMAP_TYPE_GIF ) ) { wxImage::AddHandler(
new wxGIFHandler ); }
292 return( Image.SaveFile(File.
wx_str()) );
320 return( Listing.
c_str() );
379 Destroy();
delete(m_pClassify);
401 default :
return(
false );
404 default :
return(
false );
426 return( m_pLayer ? m_pLayer->Get_Parameters() : Dummy );
432 return( m_pLayer && m_pLayer->Parameters_Changed() && m_pLayer->Draw(dc_Map) );
438 if( m_pLayer && m_pLayer->Get_Object() )
440 if( m_pLayer->Get_Object()->asShapes() )
442 return(
SG_Get_ShapeType_Name(m_pLayer->Get_Object()->asShapes()->Get_Type()) +
": " + m_pLayer->Get_Object()->Get_Name() );
448 return(
_TL(
"have no layer") );
457bool CMap_Layer::_Classify_Initialize(
const SG_Char *_Field,
const SG_Char *_Normalize)
470 return( m_pClassify->Create(m_pLayer->Get_Object()) );
478bool CMap_Layer::_Classify_Finalize(
int ColorsID)
480 CSG_Colors Colors(0, ColorsID);
if( ColorsID < 0 ) { Colors.Create(*
Get_Parameters()[
"STRETCH_COLORS"].asColors()); }
482 return( m_pLayer && m_pLayer->Get_Object() && m_pClassify->Set_LUT(*
Get_Parameters()[
"CLASSIFIED_LUT"].asTable(), Colors, 0) &&
Set_Parameter(
SG_T(
"COLOR_SYMBOLS"), 1) );
486bool CMap_Layer::Classify_Unique (
int maxCount ,
int ColorsID,
const SG_Char *Field ) {
return( _Classify_Initialize(Field, NULL ) && m_pClassify->Classify_Unique (maxCount ) && _Classify_Finalize(ColorsID) ); }
488bool CMap_Layer::Classify_Equal (
int Count ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Equal (Count ) && _Classify_Finalize(ColorsID) ); }
489bool CMap_Layer::Classify_Defined (
double Interval,
double Offset ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Defined (Interval, Offset ) && _Classify_Finalize(ColorsID) ); }
490bool CMap_Layer::Classify_Defined (
double Interval ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Defined (Interval ) && _Classify_Finalize(ColorsID) ); }
491bool CMap_Layer::Classify_Quantile (
int Count,
bool bHistogram ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Quantile (Count, bHistogram ) && _Classify_Finalize(ColorsID) ); }
492bool CMap_Layer::Classify_Geometric(
int Count,
bool bIncreasing ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Geometric(Count, bIncreasing ) && _Classify_Finalize(ColorsID) ); }
493bool CMap_Layer::Classify_Natural (
int Count ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_Natural (Count ) && _Classify_Finalize(ColorsID) ); }
494bool CMap_Layer::Classify_StdDev (
double StdDev,
double StdDev_Max ,
int ColorsID,
const SG_Char *Field,
const SG_Char *Normalize) {
return( _Classify_Initialize(Field, Normalize) && m_pClassify->Classify_StdDev (StdDev, StdDev_Max ) && _Classify_Finalize(ColorsID) ); }
499 if( m_pLayer && m_pLayer->Get_Object() )
501 m_pLayer->Get_Legend()->Draw(*Canvas.m_pDC, Zoom, 1., wxPoint(x, y));
548 return(
m_pLayer->Get_Parameters() );
560 return(
"Graticule" );
601 return(
m_pLayer->Get_Parameters() );
613 return(
"Base Map" );
SAGA_API_DLL_EXPORT bool SG_File_Cmp_Extension(const CSG_String &File, const CSG_String &Extension)
virtual ~CMap_Base_Layer(void)
const SG_Char * List_Parameters(bool bDescription=true, bool bConstraints=true, bool bValue=true) const
virtual CSG_String Get_Name(void) const =0
virtual bool On_Draw(class CSG_Map_DC &dc_Map)=0
virtual CSG_Parameters & Get_Parameters(void) const =0
bool Set_Parameter(const SG_Char *ID, const char *Value)
virtual bool On_Draw(class CSG_Map_DC &dc_Map)
class CSG_Map_BaseMap * m_pLayer
CSG_Projection m_Projection
virtual CSG_String Get_Name(void) const
virtual ~CMap_BaseMap(void)
virtual CSG_Parameters & Get_Parameters(void) const
bool Create(const CSG_Projection &Projection)
bool Draw_Legend(class CMap_Layer &Layer, int x=0, int y=0, double Zoom=1.)
bool Save(const char *File)
bool Draw_Map(class CMap &Map, int x=0, int y=0, int Frame=0)
bool Create(int Width, int Height, int Background=-1)
virtual ~CMap_Canvas(void)
bool Draw_ScaleBar(class CMap &Map, int x=0, int y=0, int Width=400, int Height=30, int Style=0x18)
class CSG_Map_Graticule * m_pLayer
virtual CSG_Parameters & Get_Parameters(void) const
virtual CSG_String Get_Name(void) const
virtual bool On_Draw(class CSG_Map_DC &dc_Map)
bool Create(const CSG_Projection &Projection)
CSG_Projection m_Projection
virtual ~CMap_Graticule(void)
virtual CSG_String Get_Name(void) const
bool Draw_Legend(CMap_Canvas &Canvas, int x, int y, double Zoom=1.)
bool Classify_Unique(int maxCount=1024, int ColorsID=-1, const SG_Char *Field=NULL)
bool Classify_Equal(int Count, double Minimum, double Maximum, int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
virtual bool On_Draw(class CSG_Map_DC &dc_Map)
bool Classify_Geometric(int Count=10, bool bIncreasing=true, int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
bool Classify_Quantile(int Count=10, bool bHistogram=true, int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
bool Classify_Defined(double Interval, double Offset, int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
bool Classify_Natural(int Count=10, int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
bool Classify_StdDev(double StdDev, double StdDev_Max=4., int ColorsID=-1, const SG_Char *Field=NULL, const SG_Char *Normalize=NULL)
virtual CSG_Parameters & Get_Parameters(void) const
bool Create(CSG_Data_Object &Layer)
virtual ~CMap_Layer(void)
friend class CMap_Base_Layer
bool Draw(CMap_Canvas &Canvas, int x, int y, int Frame=0)
bool Save(const char *File)
bool Create(const CSG_Rect &rWorld, int Width, int Height, double Scale=1., int Background=-1, bool bAlpha=false)
int Get_Width(void) const
int Get_Height(void) const
const CSG_Rect & Get_Extent(void) const
class CSG_PointCloud * asPointCloud(bool bPolymorph=false) const
class CSG_TIN * asTIN(bool bPolymorph=false) const
class CSG_Shapes * asShapes(bool bPolymorph=false) const
class CSG_Grids * asGrids(bool bPolymorph=false) const
virtual TSG_Data_Object_Type Get_ObjectType(void) const =0
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
class CSG_Grid * asGrid(bool bPolymorph=false) const
class CSG_Table * asTable(bool bPolymorph=false) const
bool Create(CSG_Data_Object *pObject)
CSG_Data_Object * Get_Object(void) const
bool Get_Parameter_Listing(CSG_Table &Listing) const
bool Set_Parameter(const CSG_String &ID, CSG_Parameter *pValue)
double Get_YRange(void) const
double Get_XMax(void) const
double Get_XRange(void) const
double Get_XMin(void) const
double Get_YMin(void) const
double Get_YMax(void) const
virtual TSG_Shape_Type Get_Type(void) const
const SG_Char * c_str(void) const
int Printf(const char *Format,...)
const class wxString & wx_str(void) const
CSG_String SG_Get_DataObject_Name(TSG_Data_Object_Type Type)
@ SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Grid
void SG_DC_Draw_Scale(wxDC &dc, const wxRect &r, double zMin, double zMax, int Orientation, int Tick, int Style, const wxString &Unit, bool bUseDCFont)
void SG_DC_Draw_Edge(wxDC &dc, int Edge_Style, int ax, int ay, int bx, int by)
#define SG_DC_SCALE_HORIZONTAL
@ SG_DC_EDGE_STYLE_SIMPLE
CSG_String SG_Get_ShapeType_Name(TSG_Shape_Type Type)