63#define ZOOMED(x) ((int)(m_Zoom * (double)x))
66#define SPACE_VERTICAL ZOOMED(5)
67#define BOX_WIDTH ZOOMED(30)
68#define BOX_HEIGHT ZOOMED(12)
69#define BOX_SPACE ZOOMED(2)
70#define TICK_WIDTH ZOOMED(5)
71#define SIZE_HEIGHT ZOOMED(100)
74#define FONT_SIZE_TITLE ZOOMED(10)
75#define FONT_SIZE_SUBTITLE ZOOMED(8)
76#define FONT_SIZE_LABEL ZOOMED(8)
79#define BOX_STYLE_RECT 0x01
80#define BOX_STYLE_LINE 0x02
81#define BOX_STYLE_SYMB 0x04
82#define BOX_STYLE_OUTL 0x08
83#define BOX_STYLE_FILL 0x10
132 Draw(dc, Zoom, Zoom_Map, wxPoint(0, 0), NULL);
141 m_Zoom = Zoom > 0. ? Zoom : 1.;
163 switch(
m_pLayer->Get_Object()->Get_ObjectType() )
166 switch(
m_pLayer->Get_Object()->asShapes()->Get_Type() )
215 wxFont Font(dc.GetFont());
219 case FONT_LABEL : Font.SetPointSize(
FONT_SIZE_LABEL ); Font.SetStyle(wxFONTSTYLE_ITALIC); Font.SetWeight(wxFONTWEIGHT_NORMAL);
break;
221 case FONT_TITLE : Font.SetPointSize(
FONT_SIZE_TITLE ); Font.SetStyle(wxFONTSTYLE_NORMAL); Font.SetWeight(wxFONTWEIGHT_BOLD );
break;
230 if( !Text.IsEmpty() )
232 wxCoord dx_Text, dy_Text;
238 dc.GetTextExtent(Text, &dx_Text, &dy_Text);
249 wxCoord dx_Text, dy_Text;
263 dc.GetTextExtent(Text, &dx_Text, &dy_Text);
274 if( !Text.IsEmpty() )
306 int FillColor =
SG_Get_Color(dc.GetBrush().IsOk() ? dc.GetBrush().GetColour() : dc.GetTextBackground());
325 _Draw_Box(dc, y, dy, Style, LineColor, FillColor, Text);
354 int size_Min, size_Max;
double size_Min_Value, size_dValue; wxString size_Name;
359 if( pLayer->
Get_Style_Size(size_Min, size_Max, size_Min_Value, size_dValue, &size_Name) )
364 double dySize = (double)(size_Max - size_Min) / (double)nClasses;
366 for(
int iClass=nClasses, iSize=size_Max; iClass>=0; iClass--, iSize-=dySize)
392 int size_Min, size_Max;
double size_Min_Value, size_dValue; wxString size_Name;
394 if( pLayer->
Get_Style_Size(size_Min, size_Max, size_Min_Value, size_dValue, &size_Name) )
400 for(
int iSize=size_Min; iSize<=size_Max; iSize++)
402 Pen.SetWidth(iSize); dc.SetPen(Pen);
505 if( Band >= 0 && Band < 3 && pLayer && pLayer->Get_Composite_Band(Band) )
514 if( Band >= 0 && Band < 3 && pLayer && pLayer->Get_Grid(Band) )
523 if( !Text.IsEmpty() )
539 dc.DrawLine(x, y, x, y + dy);
545 dc.SetPen(dc.GetTextForeground());
586#define METRIC_HEIGHT ZOOMED(200)
587#define METRIC_GET_STRING(z, dz) wxString::Format("%.*f", dz >= 1. ? 0 : 1 + (int)fabs(log10(dz)), z)
588#define METRIC_POS_V(Value) ( yBox + METRIC_HEIGHT - (int)((double)METRIC_HEIGHT * m_pSymbology->Get_Stretch_to_Relative((Value) / zFactor)))
589#define METRIC_POS_H(Value) (m_xBox + (int)((double)METRIC_HEIGHT * m_pSymbology->Get_Stretch_to_Relative((Value) / zFactor)))
594 double zMin =
m_pSymbology->Get_Stretch_from_Relative(0.);
595 double zMax =
m_pSymbology->Get_Stretch_from_Relative(1.);
600 if(
m_pLayer->Get_Stretch_Range() > 0. )
611 zMin *= zFactor; zMax *= zFactor;
615 wxSize TextSize = dc.GetTextExtent(wxString::Format(
"01234567"));
617 double zToDC =
METRIC_HEIGHT / (zMax - zMin), dz = pow(10., floor(log10(zMax - zMin)) - 1.);
619 while( zToDC * dz < TextSize.y ) { dz *= 2.; }
621 dc.SetPen(dc.GetTextForeground());
641 wxPen oldPen(dc.GetPen());
659 double z = dz * floor(zMin / dz);
if( z < zMin ) { z += dz; }
661 for(; z<=zMax; z+=dz)
675 double z = dz * floor(zMax / dz);
if( z > zMax ) { z -= dz; }
677 for(; z>=zMin; z-=dz)
681 if( abs(y0 - y) >= (
int)(0.75 * dyFont) )
686 while( dz >= 10. && abs(y -
METRIC_POS_V(z - dz)) > 2 * dyFont )
699 double z = dz * floor(zMin / dz);
if( z < zMin ) { z += dz; }
701 for(; z<=zMax; z+=dz)
705 if( abs(y0 - y) >= (
int)(0.75 * dyFont) )
710 while( dz >= 10. && abs(y -
METRIC_POS_V(z + dz)) > 2 * dyFont )
730 wxPen oldPen(dc.GetPen());
739 dc.DrawLine(ix, yBox, ix, yTick);
753 double z = dz * floor(zMin / dz);
if( z < zMin ) { z += dz; }
755 for(; z<=zMax; z+=dz)
757 int x =
METRIC_POS_H(z); dc.DrawLine(x, yTick, x, yText);
761 if( abs(x0 - x) >= (
int)(1.25 * s.x) )
774 double z = dz * floor(zMax / dz);
if( z > zMax ) { z -= dz; }
776 for(; z>=zMin; z-=dz)
778 int x =
METRIC_POS_H(z); dc.DrawLine(x, yTick, x, yText);
782 if( abs(x0 - x) >= (
int)(1.25 * s.x) )
800 double z = dz * floor(zMin / dz);
if( z < zMin ) { z += dz; }
802 for(; z<=zMax; z+=dz)
804 int x =
METRIC_POS_H(z); dc.DrawLine(x, yTick, x, yText);
808 if( abs(x0 - x) >= (
int)(1.25 * s.x) )
bool Set_Count(int nColors)
int Get_Count(void) const
const SG_Char * Get_Name(void) const
class CSG_Grids * asGrids(bool bPolymorph=false) const
class CSG_Grid * asGrid(bool bPolymorph=false) const
const CSG_String & Get_Unit(void) const
const SG_Char * Get_Unit(void) const
CSG_Grid * Get_Composite_Band(int Band)
CSG_String Get_Grid_Name(int Band, int Style=SG_GRIDS_NAME_GRID)
class CSG_Map_Symbology * Get_Symbology(void)
CSG_Data_Object * Get_Object(void) const
CSG_Rect Get_Extent(void) const
const class wxBitmap * Get_Thumbnail(int dx, int dy)
wxSize Get_Size(double Zoom, double Zoom_Map)
void _Draw_Boxes(wxDC &dc, int y, int Style, double zFactor=1.0)
void Draw(wxDC &dc, double Zoom, double Zoom_Map, wxPoint Position, wxSize *pSize=NULL)
void _Draw_Layer_Image(wxDC &dc, int y, class CSG_Map_Layer *pLayer)
void _Draw_Polygon(wxDC &dc, class CSG_Map_Shapes_Polygon *pLayer)
void _Draw_Line(wxDC &dc, class CSG_Map_Shapes_Line *pLayer)
CSG_Map_Legend(class CSG_Map_Layer *pLayer)
void Set_Orientation(int Orientation)
void _Draw_Grid(wxDC &dc, class CSG_Map_Grid *pLayer)
void _Draw_Point(wxDC &dc, class CSG_Map_Shapes_Point *pLayer)
void _Draw_TIN(wxDC &dc, class CSG_Map_TIN *pLayer)
void _Draw_Continuum_H(wxDC &dc, int y, double zMin, double zMax, double zFactor, double dz, int dyFont)
void _Draw_Label(wxDC &dc, int y, wxString Text, int yAlign)
class CSG_Map_Symbology * m_pSymbology
void _Set_Font(wxDC &dc, int Style)
void _Draw_Title(wxDC &dc, int Style, wxString Text)
void _Draw_Continuum_V(wxDC &dc, int y, double zMin, double zMax, double zFactor, double dz, int dyFont)
void _Set_Size(int xSet, int yAdd)
void _Draw_PointCloud(wxDC &dc, class CSG_Map_PointCloud *pLayer)
class CSG_Map_Layer * m_pLayer
void _Draw_Continuum(wxDC &dc, int y, double zFactor)
void _Draw_CompositeBand(wxDC &dc, int y, int dy, int Style, int Band, class CSG_Map_Grid *pLayer)
void _Draw_Grids(wxDC &dc, class CSG_Map_Grids *pLayer)
void _Draw_Box(wxDC &dc, int y, int dy, int Style, int LineColor, int FillColor, wxString Text)
bool Get_Style_Size(int &min_Size, int &max_Size, double &min_Value, double &dValue, wxString *pName)
void Draw_Symbol(wxDC &dc, int x, int y, int size)
bool Get_Style_Size(int &minSize, int &maxSize, double &Minimum, double &Scale, wxString *pName)
wxBrush Get_Def_Brush(void) const
wxPen Get_Def_Pen(void) const
double Get_YRange(void) const
double Get_XRange(void) const
const SG_Char * c_str(void) const
bool is_Empty(void) const
const class wxString & wx_str(void) const
@ SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Grid
wxColour SG_Get_wxColor(int Color)
void SG_DC_Draw_Text(wxDC &dc, int Align, int x, int y, const wxString &Text)
int SG_Get_Color(const wxColour &Color)
void SG_DC_Draw_Edge(wxDC &dc, int Edge_Style, int ax, int ay, int bx, int by)
#define SG_DC_TEXTALIGN_YCENTER
#define SG_DC_TEXTALIGN_TOPCENTER
#define SG_DC_TEXTALIGN_BOTTOM
#define SG_DC_TEXTALIGN_BOTTOMLEFT
@ SG_DC_EDGE_STYLE_SIMPLE
#define SG_DC_TEXTALIGN_TOPLEFT
#define SG_DC_TEXTALIGN_TOP
#define SG_DC_TEXTALIGN_CENTERLEFT
#define FONT_SIZE_SUBTITLE
#define METRIC_POS_V(Value)
#define METRIC_POS_H(Value)
#define METRIC_GET_STRING(z, dz)