86 Parameters.
Add_Bool (
"NODE_VALUES",
"VALUES" ,
_TL(
"Show Cell Values"),
_TL(
"Show cell values when zoomed."),
false);
87 Parameters.
Add_Font (
"VALUES",
"VALUES_FONT" ,
_TL(
"Font" ),
_TL(
""));
88 Parameters.
Add_Double(
"VALUES",
"VALUES_SIZE" ,
_TL(
"Size" ),
_TL(
""), 15, 0,
true , 100.,
true);
89 Parameters.
Add_Int (
"VALUES",
"VALUES_DECIMALS",
_TL(
"Decimals" ),
_TL(
""), 2);
100 _TL(
"top right" )), 1
112 Parameters.
Add_Grid(
"TRANSPARENCY",
"TRANSPARENCY_GRID",
_TL(
"Transparency Grid"),
113 _TL(
"Grid values used to define transparency. Transparency will be linearly scaled from full transparency to full opacity value range. Can be combined with overall transparency."),
117 Parameters.
Add_Double(
"TRANSPARENCY_GRID",
"TRANSPARENCY_GRID_STRETCH.MIN",
_TL(
"Full Transparency"),
_TL(
""), 0.);
118 Parameters.
Add_Double(
"TRANSPARENCY_GRID",
"TRANSPARENCY_GRID_STRETCH.MAX",
_TL(
"Full Opacity" ),
_TL(
""), 0.);
124 Parameters.
Add_Double(
"SHADING" ,
"SHADING_AZIMUTH",
_TL(
"Azimuth" ),
_TL(
"Direction of the light source, measured in degree clockwise from the North direction."), 315., 0.,
true, 360.,
true);
125 Parameters.
Add_Double(
"SHADING" ,
"SHADING_HEIGHT" ,
_TL(
"Height" ),
_TL(
"Height of the light source, measured in degree above the horizon." ), 45., 0.,
true, 90.,
true);
126 Parameters.
Add_Double(
"SHADING" ,
"SHADING_EXAGG" ,
_TL(
"Exaggeration"),
_TL(
""), 1. );
127 Parameters.
Add_Double(
"SHADING" ,
"SHADING_MIN" ,
_TL(
"Minimum" ),
_TL(
""), 0. );
128 Parameters.
Add_Double(
"SHADING" ,
"SHADING_MAX" ,
_TL(
"Maximum" ),
_TL(
""), 1.5);
131 Parameters.
Add_Bool (
"NODE_COLORS" ,
"RGB_ALPHA" ,
_TL(
"Alpha Channel"),
_TL(
""),
false);
134 Parameters.
Add_Node (
"NODE_COLORS" ,
"NODE_COMPOSITE" ,
_TL(
"RGB Composite"),
_TL(
""));
143 Parameters[
"TRANSPARENCY_GRID"].Get_Parent()->Set_Value((
void *)&
m_pObject->asGrid()->Get_System());
145 Parameters[
"COMPOSITE_R" ].Get_Parent()->Set_Value((
void *)&
m_pObject->asGrid()->Get_System());
146 Parameters[
"COMPOSITE_G" ].Get_Parent()->Set_Value((
void *)&
m_pObject->asGrid()->Get_System());
147 Parameters[
"COMPOSITE_B" ].Get_Parent()->Set_Value((
void *)&
m_pObject->asGrid()->Get_System());
188 int Value = Parameter.
asInt();
221 Parameters[
"COMPOSITE_R"].Get_Parent()->
Set_Enabled(Parameter.
asInt() != 0);
222 Parameters[
"COMPOSITE_G"].Get_Parent()->
Set_Enabled(Parameter.
asInt() != 1);
223 Parameters[
"COMPOSITE_B"].Get_Parent()->
Set_Enabled(Parameter.
asInt() != 2);
293 for(
int i=0; i<3; i++)
314 switch( m_Stretch_Extent )
332 CSG_Simple_Statistics s;
416void CSG_Map_Grid::_Composite_Update(
void)
420 for(
int i=0; i<3; i++)
422 CSG_Grid *pGrid =
m_Parameters[
"COMPOSITE_" + Band[i]].asGrid();
426 m_Composite[i].pGrid = NULL;
428 else if( m_Composite[i].pGrid != pGrid )
430 m_Composite[i].pGrid = pGrid;
443void CSG_Map_Grid::_Composite_Get(CComposite Composite[3])
449 default: Composite[0].pGrid =
m_pObject->asGrid(); Composite[1] = m_Composite[1]; Composite[2] = m_Composite[2];
break;
450 case 1: Composite[1].pGrid =
m_pObject->asGrid(); Composite[0] = m_Composite[0]; Composite[2] = m_Composite[2];
break;
451 case 2: Composite[2].pGrid =
m_pObject->asGrid(); Composite[0] = m_Composite[0]; Composite[1] = m_Composite[1];
break;
457 for(
int i=0; i<3; i++)
459 Composite[i].pReference =
m_pObject->asGrid();
461 if( Composite[i].pGrid )
466 case 1: Composite[i].Scaler.Set_StdDev (Composite[i].pGrid,
m_Parameters[
"STRETCH_STDDEV" ].
asDouble(),
m_Parameters[
"STRETCH_STDDEV_RANGE" ].asBool (), Mode, LogScale);
break;
469 if( Composite[i].pGrid ==
m_pObject->asGrid() )
471 Composite[i].Scaler.Create(
526 CComposite Composite[3];
530 _Composite_Get(Composite);
536 _Draw_Points(dc_Map, Composite, Resampling);
540 _Draw_Cells (dc_Map, Composite);
548 _Draw_Values(dc_Map);
558void CSG_Map_Grid::_Draw_Cells(
CSG_Map_DC &dc_Map, CComposite Composite[3])
575 for(
int y=ya, yaDC=(
int)(ayDC), ybDC=(
int)(ayDC+dDC); y<=yb; y++, ybDC=yaDC, yaDC=(int)(yDC-=dDC))
579 for(
int x=xa, xaDC=(
int)(axDC-dDC), xbDC=(
int)(axDC); x<=xb; x++, xaDC=xbDC, xbDC=(int)(xDC+=dDC))
592 if( Composite[0].Set_Color(((BYTE *)&Color)[0], x, y)
593 && Composite[1].Set_Color(((BYTE *)&Color)[1], x, y)
594 && Composite[2].Set_Color(((BYTE *)&Color)[2], x, y) )
610 int axDC = (int)dc_Map.
xWorld2DC(rMap.Get_XMin());
if( axDC < 0 ) { axDC = 0; }
611 int bxDC = (int)dc_Map.
xWorld2DC(rMap.Get_XMax());
if( bxDC >= dc_Map.
rDC().GetWidth () ) { bxDC = dc_Map.
rDC().GetWidth () - 1; }
612 int ayDC = (int)dc_Map.
yWorld2DC(rMap.Get_YMin());
if( ayDC >= dc_Map.
rDC().GetHeight() ) { ayDC = dc_Map.
rDC().GetHeight() - 1; }
613 int byDC = (int)dc_Map.
yWorld2DC(rMap.Get_YMax());
if( byDC < 0 ) { byDC = 0; }
614 int nyDC = abs(ayDC - byDC);
618 for(
int iyDC=0; iyDC<=nyDC; iyDC++)
620 _Draw_Points(dc_Map, Composite, Resampling, ayDC - iyDC, axDC, bxDC);
625 #pragma omp parallel for
626 for(
int iyDC=0; iyDC<=nyDC; iyDC++)
628 _Draw_Points(dc_Map, Composite, Resampling, ayDC - iyDC, axDC, bxDC);
638 for(
int xDC=axDC; xDC<=bxDC; p.x+=dc_Map.
DC2World(), xDC++)
648 if(
m_pSymbology->Get_Class_Color_byValue(Value, Color) )
655 if( Composite[0].Set_Color(((BYTE *)&Color)[0], p, Resampling)
656 && Composite[1].Set_Color(((BYTE *)&Color)[1], p, Resampling)
657 && Composite[2].Set_Color(((BYTE *)&Color)[2], p, Resampling) )
667inline int CSG_Map_Grid::_Adjust_Color(
int x,
int y,
int Color)
669 if( m_Shading.is_Okay() )
671 m_Shading.Set_Shading(Color, x, y);
674 if( m_Alpha.is_Okay() )
676 ((BYTE *)&Color)[3] = m_Alpha.Get_Alpha(
m_pObject->asGrid()->Get_System(), x, y);
685 if( m_Shading.is_Okay() )
687 m_Shading.Set_Shading(Color, Point, Resampling);
690 if( m_Alpha.is_Okay() )
692 m_Alpha.Set_Alpha(Color, Point);
699void CSG_Map_Grid::_Draw_Values(
CSG_Map_DC &dc_Map)
710 int Decimals =
m_Parameters(
"VALUES_DECIMALS")->asInt();
731 wxColour Effect_Color =
m_Parameters(
"VALUES_EFFECT_COLOR")->asColor();
739 if( ax < 0 ) { ax = 0; }
if( bx >= pGrid->
Get_NX() ) { bx = pGrid->
Get_NX() - 1; }
740 if( ay < 0 ) { ax = 0; }
if( by >= pGrid->
Get_NY() ) { by = pGrid->
Get_NY() - 1; }
748 for(
int y=0; y<=ny; y++)
750 double xDC = axDC, yDC = ayDC - y * dDC;
752 for(
int x=ax; x<=bx; x++, xDC+=dDC)
756 double Value = pGrid->
asDouble(x, ay + y);
763 ), Effect, Effect_Color);
768 "%.*f", Decimals, Value
769 ), Effect, Effect_Color);
791 #pragma omp parallel for
792 for(
int y=0; y<pImage->
Get_NY(); y++)
for(
int x=0; x<pImage->
Get_NX(); x++)
794 if( Image.HasAlpha() && !Image.GetAlpha(x, y) )
800 pImage->
Set_Value(x, y,
SG_GET_RGB(Image.GetRed(x, y), Image.GetGreen(x, y), Image.GetBlue(x, y)));
815 if( bFitSize || Width < 1 ) { Width =
m_pObject->asGrid()->Get_NX(); }
816 if( bFitSize || Height < 1 ) { Height =
m_pObject->asGrid()->Get_NY(); }
818 if( Width > 0 && Height > 0 && Image.Create(Width, Height) )
842 if( bFitSize || Width < 1 ) { Width = bFitSize ?
m_pObject->asGrid()->Get_NX() : Bitmap.GetWidth (); }
843 if( bFitSize || Height < 1 ) { Height = bFitSize ?
m_pObject->asGrid()->Get_NY() : Bitmap.GetHeight(); }
845 if( Width > 0 && Height > 0 && Bitmap.Create(Width, Height) )
869 wxMemoryDC dc; wxSize s(
Get_Legend()->Get_Size(Zoom, 1.));
871 Bitmap.Create(s.GetWidth(), s.GetHeight());
873 dc.SelectObject(Bitmap);
874 dc.SetBackground(*wxWHITE_BRUSH);
879 dc.SelectObject(wxNullBitmap);
bool SG_UI_Process_Set_Busy(bool bOn, const CSG_String &Message)
#define SG_GET_RGB(r, g, b)
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
int Get_xWorld_to_Grid(double xWorld) const
int Get_yWorld_to_Grid(double yWorld) const
double Get_yGrid_to_World(int yGrid) const
double Get_xGrid_to_World(int xGrid) const
const CSG_Simple_Statistics & Get_Statistics(void)
bool is_Cached(void) const
virtual void Set_NoData(int x, int y)
const CSG_Histogram & Get_Histogram(size_t nClasses=0)
double Get_Cellsize(void) const
virtual double asDouble(sLong i, bool bScaled=true) const
virtual void Set_Value(sLong i, BYTE Value, bool bScaled=true)
bool Create(const CSG_Grid &Grid)
const CSG_Grid_System & Get_System(void) const
double Get_Value(double x, double y, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bByteWise=false) const
virtual const CSG_Rect & Get_Extent(void)
bool is_InGrid(int x, int y, bool bCheckNoData=true) const
double Get_Quantile(double Quantile) const
bool Get_Image(wxImage &Image)
double yDC2World(double y)
bool Draw_Image_Begin(double Transparency, Mode Mode=Mode::Transparent)
double yWorld2DC(double y, bool bRound=true)
double xDC2World(double x)
const CSG_Rect & rWorld(void) const
double xWorld2DC(double x, bool bRound=true)
wxMemoryDC & Get_DC(void)
const wxRect & rDC(void) const
void Draw_Image_Pixels(int x1, int y1, int x2, int y2, int Color)
void Draw_Image_Pixel(int x, int y, int Color)
wxBitmap Get_Bitmap(void)
bool Draw_Image_End(void)
const double & DC2World(void) const
const double & World2DC(void) const
void SetFont(const wxFont &Font)
void DrawText(int Align, int x, int y, const wxString &Text)
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)
class CSG_Map_Legend * Get_Legend(void)
virtual bool Parameters_Changed(void)
virtual bool DataObject_Changed(void)
virtual bool Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
CSG_Data_Object * m_pObject
bool Set_Stretch_Range(double Minimum, double Maximum)
bool Set_Object(CSG_Data_Object *pObject)
CSG_Rect Get_Extent(void) const
CSG_Parameters m_Parameters
class CSG_Map_Symbology * m_pSymbology
virtual bool Add_Parameters(CSG_Parameters &Parameters)
void Draw(wxDC &dc, double Zoom, double Zoom_Map, wxPoint Position, wxSize *pSize=NULL)
bool Set_Collapsed(bool bOn=true)
bool Set_Children_Enabled(bool bEnabled=true)
CSG_Grid * asGrid(void) const
bool Cmp_Identifier(const CSG_String &Identifier) const
CSG_Parameter * Add_Grid_Resampling(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_Resampling Methods=CSG_Grid_Resampling::Interpolations, CSG_Grid_Resampling Default=CSG_Grid_Resampling::Bicubic_2)
CSG_Parameter * Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default=0)
void Set_Enabled(bool bEnabled=true)
CSG_Parameter * Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
bool Create(const CSG_Parameters &Parameters)
CSG_Parameter * Add_Int(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0, int Minimum=0, bool bMinimum=false, int Maximum=0, bool bMaximum=false)
CSG_Parameter * Add_Node(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bCollapsed=false)
CSG_Parameter * Add_Color(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0)
bool Set_Parameter(const CSG_String &ID, CSG_Parameter *pValue)
CSG_Parameter * Add_Font(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *pInit=NULL)
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
CSG_Parameter * Add_Grid(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true, TSG_Data_Type Preferred_Type=SG_DATATYPE_Undefined)
double Get_XMax(void) const
double Get_XMin(void) const
double Get_YMin(void) const
double Get_YMax(void) const
static CSG_String Format(const char *Format,...)
bool Create(const class wxString *pString)
CSG_Data_Manager & SG_Get_Data_Manager(void)
@ SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grid
wxColour SG_Get_wxColor(int Color)
wxFont SG_Get_wxFont(CSG_Parameter *pFont)
#define SG_DC_TEXTEFFECT_TOPRIGHT
#define SG_DC_TEXTEFFECT_LEFT
#define SG_DC_TEXTALIGN_CENTER
#define SG_DC_TEXTEFFECT_BOTTOM
#define SG_DC_TEXTEFFECT_NONE
#define SG_DC_TEXTEFFECT_BOTTOMRIGHT
#define SG_DC_TEXTEFFECT_TOPLEFT
#define SG_DC_TEXTEFFECT_BOTTOMLEFT
#define SG_DC_TEXTEFFECT_RIGHT
#define SG_DC_TEXTEFFECT_TOP
#define SG_DC_TEXTEFFECT_FRAME
#define LAYER_DRAW_FLAG_NOLABELS
#define LAYER_DRAW_FLAG_NOEDITS
#define PARAMETER_CHECK_ENABLE
#define PARAMETER_CHECK_VALUES
#define PARAMETER_INPUT_OPTIONAL