50#ifndef _HEADER_INCLUDED__SAGA_GDI__Map_Layer_H
51#define _HEADER_INCLUDED__SAGA_GDI__Map_Layer_H
74#define LAYER_DRAW_FLAG_THUMBNAIL 0x01
75#define LAYER_DRAW_FLAG_SELECTION 0x02
76#define LAYER_DRAW_FLAG_HIGHLIGHT 0x04
77#define LAYER_DRAW_FLAG_NOEDITS 0x08
78#define LAYER_DRAW_FLAG_NOLABELS 0x10
107 virtual bool Parameters_Changed (
void);
108 virtual bool DataObject_Changed (
void);
121 wxString Get_Legend_Title (
void)
const;
122 wxString Get_Legend_Subtitle (
void)
const;
124 bool Get_Field_Value (
sLong Index,
int Field,
int Normalize,
double Scale, wxString &Value)
const;
125 bool Get_Field_Value (
sLong Index,
int Field,
int Normalize,
double Scale,
double &Value)
const;
127 double Get_Stretch_Minimum (
void)
const;
128 double Get_Stretch_Maximum (
void)
const;
129 double Get_Stretch_Range (
void)
const;
131 bool Set_Stretch_FullRange (
void);
141 const class wxBitmap * Get_Thumbnail (
int dx,
int dy);
142 bool Set_Thumbnail (
void);
168 bool Set_Normalization (
int Field_Value,
int Field_Normalize,
double Scale_Normalize,
sLong maxSamples = 0);
170 bool Set_Fields_Choice (
CSG_Parameter &Choice,
bool bNumeric,
bool bAddNone,
bool bSelectNone =
false);
195 return( m_pGrid != NULL );
198 bool is_Okay (
void)
const {
return( m_pGrid != NULL ); }
211 if( m_pGrid->Get_Value(x, y, Alpha) )
213 Alpha = (Alpha - m_Minimum) * m_Scale;
215 return( Alpha <= 0. ? 0 : Alpha >= 255. ? 255 : (BYTE)Alpha );
261 double m_Minimum = 0., m_Scale = 1.;
296 virtual bool Get_Image (wxImage &Image ,
bool bFitSize =
true,
int Width = 0,
int Height = 0);
297 virtual bool Get_Bitmap (wxBitmap &Bitmap,
bool bFitSize =
true,
int Width = 0,
int Height = 0);
310 int m_Stretch_Extent = -1, m_xSel = 0, m_ySel = 0;
320 CComposite & operator = (
const CComposite &Composite)
322 pReference = Composite.pReference; pGrid = Composite.pGrid; Scaler = Composite.Scaler;
327 bool Set_Color (BYTE &Color,
int x,
int y)
331 if( pReference && pReference != pGrid && pReference->
Get_System() != pGrid->Get_System() )
336 if( pGrid->is_InGrid(x, y) )
338 double Value = Scaler.
to_Relative(pGrid->asDouble(x, y));
340 Color = Value <= 0. ? 0 : Value >= 1. ? 255 : (BYTE)(255. * Value);
346 if( pGrid != pReference )
362 if( pGrid->Get_Value(Point, Value, Resampling) )
366 Color = Value <= 0. ? 0 : Value >= 1. ? 255 : (BYTE)(255. * Value);
372 if( pGrid != pReference )
386 void _Composite_Update (
void);
387 void _Composite_Get (CComposite Composite[3]);
391 void _Draw_Cells (
CSG_Map_DC &dc_Map, CComposite Composite[3]);
396 int _Adjust_Color (
int x,
int y,
int Color);
408 bool Create (
int Mode,
CSG_Grid *pGrid,
double Height,
double Azimuth,
double Exaggeration,
double Minimum,
double Maximum)
418 m_Exaggeration = Exaggeration;
426 bool is_Okay (
void)
const {
return( m_Mode != 0 ); }
428 bool Set_Shading (
int &Color,
int x,
int y)
const
430 double s, a;
return( m_Mode && m_pGrid && m_pGrid->Get_Gradient(x, y, s, a ) && _Set_Shading(s, a, Color) );
435 double s, a;
return( m_Mode && m_pGrid && m_pGrid->Get_Gradient(Point, s, a, Resampling) && _Set_Shading(s, a, Color) );
443 double m_Sin_Height = 0., m_Cos_Height = 0, m_Azimuth = 0., m_Exaggeration = 1., m_Minimum = 0., m_Range = 1.;
448 bool _Set_Shading (
double s,
double a,
int &Color)
const
450 s =
M_PI_090 - atan(m_Exaggeration * tan(s));
454 _Set_Shading(acos(sin(s) * m_Sin_Height + cos(s) * m_Cos_Height * cos(a - m_Azimuth)), (BYTE *)&Color);
458 double sum = 0., dir = m_Azimuth -
M_PI_180 / 2., sin_Slope = sin(s) * m_Sin_Height, cos_Slope = cos(s) * m_Cos_Height;
460 for(
int i=0; i<6; i++, dir+=
M_PI_180/5.)
462 sum += acos(sin_Slope + cos_Slope * cos(a - dir));
465 _Set_Shading(sum / 6., (BYTE *)&Color);
471 void _Set_Shading (
double Shade, BYTE *Color)
const
473 Shade = m_Range * ((1. - Shade /
M_PI_090) - m_Minimum);
double c;
475 c = Shade * Color[0]; Color[0] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
476 c = Shade * Color[1]; Color[1] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
477 c = Shade * Color[2]; Color[2] = c <= 0. ? 0 : c >= 255. ? 255 : (BYTE)c;
517 virtual bool Get_Image (wxImage &Image ,
bool bFitSize =
true,
int Width = 0,
int Height = 0);
518 virtual bool Get_Bitmap (wxBitmap &Bitmap,
bool bFitSize =
true,
int Width = 0,
int Height = 0);
529 int m_Stretch_Extent = -1;
537 CSG_String _Get_List_Bands (
int Attribute = -1);
546 bool _Draw_Get_Color (
int &Color,
int x,
int y );
547 bool _Draw_Get_Color (
int &Color,
const CSG_Point &Point);
556 bool bOverlay, bBandStatistics;
564 CSG_Grid * operator [] (
int i) {
return( pBands[i] ); }
601 virtual void On_Draw (
CSG_Map_DC &dc_Map,
int Flags);
606 int m_PointSize = 1, m_Aggregation = 0, m_Edit_Index = -1;
608 wxColour m_Color_Pen;
612 class CStretch {
public:
int Value = -1, Normal = -1;
double Scale = 1.; } m_Stretch;
615 void _Draw_Pixel (CSG_Map_DC &dc_Map,
int x,
int y,
double z,
int Color);
616 void _Draw_Symbol (CSG_Map_DC &dc_Map,
const CSG_Point_3D &Point,
int Color);
618 void _Draw_Points (CSG_Map_DC &dc_Map,
bool bSkipSelection);
620 void _Draw_Thumbnail (CSG_Map_DC &dc_Map);
652 virtual void Draw_Thumbnails (
CSG_Map_DC &dc_Map,
int Limit);
703 bool is_Valid (
void) {
return( m_Fields.Get_Count() > 0 ); }
705 bool Set_Options (
const CSG_Shapes *pShapes, CSG_Parameters &Parameters);
706 bool Get_Options (
const CSG_Shapes *pShapes,
const CSG_Parameters &Parameters);
708 void Draw (CSG_Map_DC &dc_Map, CSG_Shape *pShape);
715 CSG_Points_Int m_Fields;
717 class CSize {
public:
int Size = 1, Field = -1, Type = 0;
double Scale = 1., Range = 0.; } m_Size;
719 void _Draw_Pie (CSG_Map_DC &dc_Map, CSG_Table_Record *pRecord,
bool bOutline,
int x,
int y,
int size);
720 void _Draw_Bar (CSG_Map_DC &dc_Map, CSG_Table_Record *pRecord,
bool bOutline,
int x,
int y,
int sx,
int sy);
751 bool Get_Style_Size (
int &minSize,
int &maxSize,
double &
Minimum,
double &Scale, wxString *pName);
753 void Draw_Symbol (wxDC &dc,
int x,
int y,
int size);
783 void _Image_Draw (
CSG_Map_DC &dc,
int x,
int y,
int size,
const wxString &file);
785 void _Arrow_Draw (
CSG_Map_DC &dc_Map,
int x,
int y,
int size,
double direction);
787 void _Beachball_Draw (
CSG_Map_DC &dc,
int x,
int y,
int size,
double strike,
double dip,
double rake);
789 void _Beachball_Get_Scaled (
CSG_Shape *pShape,
double x,
double y,
double size);
833 bool Get_Style_Size (
int &min_Size,
int &max_Size,
double &min_Value,
double &dValue, wxString *pName);
854 void _Draw_Shape (
CSG_Map_DC &dc_Map,
CSG_Shape *pShape,
int xOffset = 0,
int yOffset = 0);
921 virtual bool asImage (
CSG_Grid *pImage);
934 typedef struct {
int x, y;
double z; } TPoint;
940 void _Draw_Triangle (
CSG_Map_DC &dc_Map, TPoint p[3]);
941 void _Draw_Triangle_Line (
CSG_Map_DC &dc_Map,
int xa,
int xb,
int y,
double za,
double zb);
964 virtual bool Parameters_Changed (
void);
1003 virtual bool Parameters_Changed (
void);
#define SAGA_API_DLL_EXPORT
TSG_Point Get_Grid_to_World(int xGrid, int yGrid) const
double Get_yGrid_to_World(int yGrid) const
double Get_xGrid_to_World(int xGrid) const
const CSG_Grid_System & Get_System(void) const
virtual CSG_Parameters & Get_Parameters(void)
virtual CSG_Parameters & Get_Parameters(void)
virtual bool Get_Image(wxImage &Image, bool bFitSize=true, int Width=0, int Height=0)
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual bool Get_Bitmap(wxBitmap &Bitmap, bool bFitSize=true, int Width=0, int Height=0)
virtual bool Parameters_Changed(void)
CSG_Grid * Get_Composite_Band(int Band)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool Update(CSG_Data_Object *pChanged)
virtual bool DataObject_Changed(void)
virtual bool asImage(CSG_Grid *pImage)
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
virtual bool Get_Bitmap_Legend(wxBitmap &Bitmap, double Zoom)
CSG_Map_Grid(CSG_Grid *pGrid=NULL)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
CSG_String Get_Grid_Name(int Band, int Style=SG_GRIDS_NAME_GRID)
virtual bool Get_Bitmap_Legend(wxBitmap &Bitmap, double Zoom)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual bool Get_Bitmap(wxBitmap &Bitmap, bool bFitSize=true, int Width=0, int Height=0)
CSG_Map_Grids(CSG_Grids *pGrids=NULL)
virtual bool Parameters_Changed(void)
bool Set_Grid_Choices(CSG_Parameters &Parameters, int NameField=-1)
CSG_Grid * Get_Grid(void)
virtual bool DataObject_Changed(void)
virtual bool Get_Image(wxImage &Image, bool bFitSize=true, int Width=0, int Height=0)
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
virtual bool asImage(CSG_Grid *pImage)
bool Set_Alpha(int &Color, double x, double y) const
bool Create(CSG_Grid *pGrid, double Minimum, double Maximum)
BYTE Get_Alpha(double x, double y) const
bool Set_Alpha(int &Color, const CSG_Point &Point) const
bool Set_Alpha(int &Color, const CSG_Grid_System &System, int x, int y) const
BYTE Get_Alpha(const CSG_Grid_System &System, int x, int y) const
BYTE Get_Alpha(const CSG_Point &Point) const
CSG_Table m_Normalization
class CSG_Map_Symbology * Get_Symbology(void)
class CSG_Map_Legend * Get_Legend(void)
class CSG_Map_Legend * m_pLegend
CSG_Parameters & Get_Parameters(void)
TSG_Data_Object_Type m_Type
CSG_Data_Object * m_pObject
const TSG_Data_Object_Type & Get_ObjectType(void) const
class wxBitmap * m_pThumbnail
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
CSG_Data_Object * Get_Object(void) const
CSG_Parameters m_Parameters
virtual bool asImage(CSG_Grid *pImage)
class CSG_Map_Symbology * m_pSymbology
virtual bool Set_Stretch_Extent(const CSG_Rect &Extent)
virtual bool Parameters_Changed(void)
int Get_Field_Normal(void)
double Get_Scale_Normal(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool DataObject_Changed(void)
int Get_Field_Value(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Map_PointCloud(CSG_PointCloud *pPointCloud=NULL)
bool Get_Style_Size(int &min_Size, int &max_Size, double &min_Value, double &dValue, wxString *pName)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
virtual bool Parameters_Changed(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool DataObject_Changed(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Map_Shapes_Line(CSG_Shapes *pShapes=NULL)
void Draw_Symbol(wxDC &dc, int x, int y, int size)
class CSG_Map_Shapes_Point::CSize m_Size
class CSG_Map_Shapes_Point::CLabel_Point m_Label_Point
CSG_Map_Shapes_Point(CSG_Shapes *pShapes=NULL)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual bool DataObject_Changed(void)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
class CSG_Map_Shapes_Point::CImage m_Image
class CSG_Map_Shapes_Point::CArrow m_Arrow
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
class CSG_Map_Shapes_Point::CBeachball m_Beachball
class CSG_Map_Shapes_Point::CSymbol m_Symbol
virtual bool Parameters_Changed(void)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
CSG_Map_Shapes_Points(CSG_Shapes *pShapes=NULL)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
virtual bool DataObject_Changed(void)
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void Draw_Thumbnails(CSG_Map_DC &dc_Map, int Limit)
virtual bool Parameters_Changed(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
CSG_Map_Shapes_Polygon(CSG_Shapes *pShapes=NULL)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
CSG_Parameter * BrushList_Add(CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
wxBrush Get_Def_Brush(void) const
virtual void Draw_Shape(CSG_Map_DC &dc_Map, CSG_Shape *pShape, int Flags=0)
int Get_Field_Label(void) const
int Get_Field_Normal(void) const
double Get_Scale_Normal(void) const
wxPen Get_Def_Pen(void) const
wxBrushStyle BrushList_Get_Style(const CSG_String &Identifier)
bool Get_Class_Color(CSG_Shape *pShape, int &Color)
CSG_Shape * Get_Shape(sLong i)
class CSG_Map_Shapes::CLabel m_Label
virtual void Draw_Initialize(CSG_Map_DC &dc_Map, int Flags)
class CSG_Map_Shapes::CStretch m_Stretch
int PenList_Get_Style(const CSG_String &Identifier)
CSG_Parameter * PenList_Add(CSG_Parameters &Parameters, const CSG_String &ParentID, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description) const
virtual void Draw_Label(CSG_Map_DC &dc_Map, CSG_Shape *pShape, const wxString &Label)
int Get_Field_Value(void) const
virtual bool Parameters_Changed(void)
virtual bool DataObject_Changed(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual bool DataObject_Changed(void)
virtual bool Add_Parameters(CSG_Parameters &Parameters)
double Get_Scale_Normal(void)
CSG_Map_TIN(CSG_TIN *pTIN=NULL)
int Get_Field_Value(void)
virtual bool Parameters_Changed(void)
int Get_Field_Normal(void)
class CSG_Map_TIN::CStretch m_Stretch
virtual void On_Draw(CSG_Map_DC &dc_Map, int Flags)
double to_Relative(double Value) const
@ SG_DATAOBJECT_TYPE_Undefined
#define SG_GRIDS_NAME_GRID