68 m_Parameters.Set_Name (
"GRATICULE");
69 m_Parameters.Set_Identifier(
"GRATICULE");
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 "INTERVAL" ,
_TL(
"Interval"),
84 _TL(
"fixed interval"),
85 _TL(
"fitted interval")
89 m_Parameters.Add_Double(
"INTERVAL",
90 "FIXED" ,
_TL(
"Fixed Interval (Degree)"),
95 m_Parameters.Add_Int(
"INTERVAL",
96 "FITTED" ,
_TL(
"Number of Intervals"),
101 m_Parameters.Add_Double(
"NODE_GENERAL",
102 "RESOLUTION" ,
_TL(
"Minimum Resolution (Degree)"),
108 m_Parameters.Add_Node(
"",
"NODE_DISPLAY",
_TL(
"Display"),
_TL(
""));
110 m_Parameters.Add_Double(
"NODE_DISPLAY",
111 "TRANSPARENCY",
_TL(
"Transparency"),
112 _TL(
"Transparency specified as percentage."),
113 0, 0.,
true, 100.,
true
116 m_Parameters.Add_Color(
"NODE_DISPLAY",
117 "LINE_COLOR" ,
_TL(
"Line Color"),
122 m_Parameters.Add_Int(
"NODE_DISPLAY",
123 "LINE_WIDTH" ,
_TL(
"Line Width"),
128 m_Parameters.Add_Choice(
"NODE_DISPLAY",
129 "LINE_STYLE" ,
_TL(
"Line Style"),
133 _TL(
"Dotted style" ),
134 _TL(
"Long dashed style" ),
135 _TL(
"Short dashed style" ),
136 _TL(
"Dot and dash style" ),
137 _TL(
"Backward diagonal hatch"),
138 _TL(
"Cross-diagonal hatch" ),
139 _TL(
"Forward diagonal hatch" ),
141 _TL(
"Horizontal hatch" ),
142 _TL(
"Vertical hatch" )
150 m_Parameters.Add_Bool(
"NODE_DISPLAY",
151 "LABEL" ,
_TL(
"Label"),
156 m_Parameters.Add_Choice(
"LABEL",
157 "LABEL_UNITS" ,
_TL(
"Units"),
160 _TL(
"Decimal Degrees"),
161 _TL(
"Degrees, Minutes, Seconds"),
162 _TL(
"Degrees, Minutes, Seconds (significant)")
166 m_Parameters.Add_Int(
"LABEL",
167 "LABEL_DECIMALS",
_TL(
"Decimals"),
168 _TL(
"Maximum number of decimals of a second to be printed."),
172 m_Parameters.Add_Font(
"LABEL",
173 "LABEL_FONT" ,
_TL(
"Font"),
177 m_Parameters.Add_Double(
"LABEL",
178 "LABEL_SIZE" ,
_TL(
"Size"),
179 _TL(
"Font size given as percentage of map size."),
180 2., 0.,
true, 10.,
true
183 m_Parameters.Add_Choice(
"LABEL",
184 "LABEL_ORIENT" ,
_TL(
"Latitude Orientation"),
192 m_Parameters.Add_Choice(
"LABEL",
193 "LABEL_EFFECT" ,
_TL(
"Boundary Effect"),
209 m_Parameters.Add_Color(
"LABEL",
210 "LABEL_EFFCOL" ,
_TL(
"Boundary Effect Color"),
230 m_Parameters.Assign_Values(&Parameters);
276 if( !Get_Graticule(dc_Map.
rWorld(),
Projection) || m_Graticule.Get_Count() <= 0 )
282 if( m_Parameters[
"TRANSPARENCY"].
asDouble() > 0. )
288 wxPen Pen(m_Parameters[
"LINE_COLOR"].asColor(), m_Parameters[
"LINE_WIDTH"].asInt());
290 switch( m_Parameters[
"LINE_STYLE"].asInt() )
292 default: Pen.SetStyle(wxPENSTYLE_SOLID );
break;
293 case 1: Pen.SetStyle(wxPENSTYLE_DOT );
break;
294 case 2: Pen.SetStyle(wxPENSTYLE_LONG_DASH );
break;
295 case 3: Pen.SetStyle(wxPENSTYLE_SHORT_DASH );
break;
296 case 4: Pen.SetStyle(wxPENSTYLE_DOT_DASH );
break;
297 case 5: Pen.SetStyle(wxPENSTYLE_BDIAGONAL_HATCH );
break;
298 case 6: Pen.SetStyle(wxPENSTYLE_CROSSDIAG_HATCH );
break;
299 case 7: Pen.SetStyle(wxPENSTYLE_FDIAGONAL_HATCH );
break;
300 case 8: Pen.SetStyle(wxPENSTYLE_CROSS_HATCH );
break;
301 case 9: Pen.SetStyle(wxPENSTYLE_HORIZONTAL_HATCH);
break;
302 case 10: Pen.SetStyle(wxPENSTYLE_VERTICAL_HATCH );
break;
311 for(
sLong iLine=0; iLine<m_Graticule.Get_Count(); iLine++)
313 CSG_Shape *pLine = m_Graticule.Get_Shape(iLine);
332 if( m_Parameters[
"LABEL"].asBool() )
334 int Size = (int)(0.5 + 0.01 * m_Parameters[
"LABEL_SIZE"].
asDouble()
335 * ( dc_Map.
rDC().GetWidth() < dc_Map.
rDC().GetHeight()
336 ? dc_Map.
rDC().GetWidth() : dc_Map.
rDC().GetHeight() )
341 bool bLatVertical = m_Parameters[
"LABEL_ORIENT"].asInt() == 1;
342 int Effect, Units = m_Parameters[
"LABEL_UNITS" ].asInt(), Decimals = m_Parameters[
"LABEL_DECIMALS"].asInt();
343 wxColour Effect_Color =
SG_Get_wxColor(m_Parameters[
"LABEL_EFFCOL"].asInt());
346 Font.SetPointSize(Size);
349 dc_Map.
Get_DC().SetTextForeground(m_Parameters[
"LABEL_FONT"].asColor());
351 switch( m_Parameters[
"LABEL_EFFECT"].asInt() )
365 for(
sLong iPoint=0; iPoint<m_Coordinates.Get_Count(); iPoint++)
367 CSG_Shape *pPoint = m_Coordinates.Get_Shape(iPoint);
371 CSG_String Coordinate(Get_Unit(pPoint, Units, Decimals, (!Type.Cmp(
"LAT_MIN") || !Type.Cmp(
"LAT_MAX"))));
373 int Align;
double Angle;
378 Angle = !Type.Cmp(
"LAT_MIN") ? 90. : !Type.Cmp(
"LAT_MAX") ? -90. : 0.;
389 dc_Map.
DrawText(Align, p.
x, p.
y, Angle, Coordinate.
c_str(), Effect, Effect_Color);
395 if( m_Parameters[
"TRANSPARENCY"].
asDouble() > 0. )
423 m_pTool->Set_Manager(NULL);
432 m_pTool->Set_Parameter(
"XMIN" ,
Extent .Get_XMin())
433 && m_pTool->Set_Parameter(
"XMAX" ,
Extent .Get_XMax())
434 && m_pTool->Set_Parameter(
"YMIN" ,
Extent .Get_YMin())
435 && m_pTool->Set_Parameter(
"YMAX" ,
Extent .Get_YMax())
436 && m_pTool->Set_Parameter(
"CRS_WKT" ,
Projection.Get_WKT2())
437 && m_pTool->Set_Parameter(
"CRS_PROJ" ,
Projection.Get_PROJ())
438 && m_pTool->Set_Parameter(
"INTERVAL" , m_Parameters(
"INTERVAL" ))
439 && m_pTool->Set_Parameter(
"FIXED" , m_Parameters(
"FIXED" ))
440 && m_pTool->Set_Parameter(
"FITTED" , m_Parameters(
"FITTED" ))
441 && m_pTool->Set_Parameter(
"RESOLUTION", m_Parameters(
"RESOLUTION"))
442 && m_pTool->Set_Parameter(
"GRATICULE" , &m_Graticule)
443 && m_pTool->Set_Parameter(
"COORDS" , &m_Coordinates)
444 && m_pTool->On_Before_Execution()
445 && m_pTool->Execute();
458CSG_String CSG_Map_Graticule::Get_Unit(
CSG_Shape *pPoint,
int Units,
int Decimals,
bool bLatitude)
465 ? (Value < 0. ?
SG_T(
"S") :
SG_T(
"N"))
466 : (Value > 0. ?
SG_T(
"E") :
SG_T(
"W"));
485 Value = fmod(Value, 360.);
487 Value = (Value - d) * 60.;
489 Value = (Value - h) * 60.;
498 String.
Printf(
"%d%s%02d'%02d.%d''", d, D, h, s, (
int)(Value * pow(10, n)));
500 else if( s > 0 || Units == 1 )
502 String.
Printf(
"%d%s%02d'%02d''" , d, D, h, s);
506 String.
Printf(
"%d%s%02d'" , d, D, h);
510 String.
Printf(
"%d%s" , d, D);
void SG_UI_ProgressAndMsg_Lock(bool bOn)
#define SG_GET_RGB(r, g, b)
SAGA_API_DLL_EXPORT int SG_Get_Significant_Decimals(double Value, int maxDecimals=6)
bool Draw_Layer_Begin(void)
void SetPen(const wxPen &Pen)
const CSG_Rect & rWorld(void) const
bool Draw_Layer_End(double Transparency=0.)
void DrawLine(int x1, int y1, int x2, int y2)
wxMemoryDC & Get_DC(void)
const wxRect & rDC(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 Parameter_Changed(CSG_Parameters &Parameters, CSG_Parameter &Parameter, int Flags)
virtual ~CSG_Map_Graticule(void)
virtual bool Draw(CSG_Map_DC &dc, const CSG_Projection &Projection)
virtual bool Parameters_Changed(void)
virtual bool Set_Parameters(const CSG_Parameters &Parameters)
bool Set_Children_Enabled(bool bEnabled=true)
bool Cmp_Identifier(const CSG_String &Identifier) const
void Set_Enabled(bool bEnabled=true)
virtual int Get_Point_Count(void) const =0
virtual int Get_Part_Count(void) const =0
virtual TSG_Point Get_Point(int iPoint=0) const =0
static CSG_String Format(const char *Format,...)
const SG_Char * c_str(void) const
int Printf(const char *Format,...)
double asDouble(int Field) const
const SG_Char * asString(int Field, int Decimals=-99) const
wxColour SG_Get_wxColor(int Color)
wxFont SG_Get_wxFont(CSG_Parameter *pFont)
#define SG_DC_TEXTALIGN_TOPCENTER
#define SG_DC_TEXTEFFECT_TOPRIGHT
#define SG_DC_TEXTEFFECT_LEFT
#define SG_DC_TEXTALIGN_CENTER
#define SG_DC_TEXTALIGN_BOTTOMCENTER
#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_TEXTALIGN_CENTERRIGHT
#define SG_DC_TEXTEFFECT_RIGHT
#define SG_DC_TEXTEFFECT_TOP
#define SG_DC_TEXTEFFECT_FRAME
#define SG_DC_TEXTALIGN_CENTERLEFT
#define PARAMETER_CHECK_ENABLE