57#include <wx/filename.h>
59#include "../saga_gui/res/xpm/default.xpm"
69#define SYMBOL_TYPE_Image 13
70#define SYMBOL_TYPE_Arrow 14
71#define SYMBOL_TYPE_Beachball 15
108 Parameters.
Add_Int (
"OUTLINE" ,
"OUTLINE_SIZE" ,
_TL(
"Size" ),
_TL(
""), 1, 1,
true);
114 _TL(
"triangle (up)"),
115 _TL(
"triangle (down)"),
116 _TL(
"circle with square"),
117 _TL(
"circle with rhombus"),
118 _TL(
"circle with triangle (up)"),
119 _TL(
"circle with triangle (down)"),
120 _TL(
"circle in square"),
121 _TL(
"circle in rhombus"),
122 _TL(
"circle in triangle (up)"),
123 _TL(
"circle in triangle (down)"),
126 _TL(
"beachball plot")), 0
130 "%s|*.bmp;*.ico;*.gif;*.jpg;*.jif;*.jpeg;*.pcx;*.png;*.pnm;*.tif;*.tiff;*.xpm|"
132 "%s (*.jpg)|*.jpg;*.jif;*.jpeg|"
133 "%s (*.tif)|*.tif;*.tiff|"
139 _TL(
"Recognized File Types" ),
140 _TL(
"Portable Network Graphics" ),
141 _TL(
"JPEG - JFIF Compliant" ),
142 _TL(
"Tagged Image File Format" ),
143 _TL(
"Graphics Interchange Format"),
144 _TL(
"Windows or OS/2 Bitmap" ),
145 _TL(
"Zsoft Paintbrush" ),
146 _TL(
"X11 Pixel Map" ),
151 Parameters.
Add_Int (
"ARROW_DIRECTION" ,
"ARROW_OFFSET" ,
_TL(
"Offset" ),
_TL(
""), 0.);
155 Parameters.
Add_Int (
"ARROW_DIRECTION" ,
"ARROW_WIDTH" ,
_TL(
"Line Width" ),
_TL(
""), 2, 1,
true);
164 Parameters.
Add_Choice(
"NODE_DISPLAY",
"IMAGE_FIELD",
_TL(
"Image Field"),
165 _TL(
"Field that provides file paths (either absolute or relative to this data set) to images to be displayed besides the points."),
171 Parameters.
Add_Double(
"IMAGE_FIELD",
"IMAGE_OFFSET" ,
_TL(
"Offset" ),
_TL(
"Offset distance to symbol relative to symbol's size."), 1., 0.,
true);
172 Parameters.
Add_Double(
"IMAGE_FIELD",
"IMAGE_SCALE" ,
_TL(
"Size Scaling" ),
_TL(
"Scales image size relative to symbol's size."), 10., 0.1,
true);
180 Parameters.
Add_Range (
"SIZE_FIELD",
"SIZE_RANGE" ,
_TL(
"Size Range" ),
_TL(
""), 2., 10., 0.,
true);
181 Parameters.
Add_Double(
"NODE_SIZE" ,
"SIZE_DEFAULT",
_TL(
"Size" ),
_TL(
""), 5., 0.,
true);
188 Parameters.
Add_Double(
"LABEL_ANGLE_FIELD",
"LABEL_ANGLE" ,
_TL(
"Default Rotation"),
_TL(
"rotation clockwise in degree"), 0., -360.,
true, 360.,
true);
189 Parameters.
Add_Node (
"LABEL_FIELD" ,
"LABEL_PLACEMENT" ,
_TL(
"Placement" ),
_TL(
""));
191 Parameters.
Add_Double(
"LABEL_PLACEMENT_X",
"LABEL_OFFSET_X" ,
_TL(
"Offset" ),
_TL(
"Offset distance to symbol (either screen or map units)."), 0., 0.,
true);
193 Parameters.
Add_Double(
"LABEL_PLACEMENT_Y",
"LABEL_OFFSET_Y" ,
_TL(
"Offset" ),
_TL(
"Offset distance to symbol (either screen or map units)."), 0., 0.,
true);
221 int Value = Parameter.
asInt();
232 bool Value = Parameter.
asInt() <
m_pObject->asShapes()->Get_Field_Count();
234 Parameters.
Set_Enabled(
"LABEL_ANGLE_FIELD" , Value);
260 Parameters.
Set_Enabled(
"SIZE_DEFAULT" , Value < 0);
320 m_Symbol.Image = wxBitmap(default_xpm).ConvertToImage();
430 minSize = (int)(
m_Size.Offset);
514 switch(
m_Parameters(
"LABEL_FIELD_SIZE_TYPE")->asInt() )
530 default: _Size *= dc_Map.
Scale ();
break;
531 case 1: _Size *= dc_Map.
World2DC();
break;
534 return( (Size = (
int)(0.5 + _Size)) > 0 );
577 double d = (double)
m_Symbol.Image.GetWidth() / (double)
m_Symbol.Image.GetHeight();
579 int sx = d > 1.0 ? Size : (int)(0.5 + Size * d);
580 int sy = d <= 1.0 ? Size : (int)(0.5 + Size / d);
582 if( sx > 0 && sy > 0 )
584 wxRect r(p.
x - sx, p.
y - sy, 2 * sx, 2 * sy);
610 _Beachball_Draw(dc_Map, p.
x, p.
y, Size,
654#define DRAW_CIRCLE(d) { int s = d == 1. ? Size : (int)((d) * Size);\
655 dc.DrawCircle(x, y, s);\
659#define DRAW_SQUARE(d) { int s = d == 1. ? Size : (int)((d) * Size);\
660 dc.DrawRectangle(x - s, y - s, 1 + 2 * s, 1 + 2 * s);\
664#define DRAW_RHOMBUS(d) { int s = d == 1. ? Size : (int)((d) * Size); wxPoint p[4];\
665 p[0].y = p[2].y = y;\
666 p[1].x = p[3].x = x;\
671 dc.DrawPolygon(4, p);\
675#define DRAW_TRIANGLE_UP(d) { int s = d == 1. ? Size : (int)((d) * Size); wxPoint p[3];\
676 p[0].y = p[1].y = y + (s / 2);\
677 p[2].y = y - (s - 1);\
678 p[0].x = x - (int)(0.8660254038 * s);\
679 p[1].x = x + (int)(0.8660254038 * s);\
681 dc.DrawPolygon(3, p);\
685#define DRAW_TRIANGLE_DOWN(d) { int s = d == 1. ? Size : (int)((d) * Size); wxPoint p[3];\
686 p[0].y = p[1].y = y - (s / 2);\
687 p[2].y = y + (s - 1);\
688 p[0].x = x - (int)(0.8660254038 * s);\
689 p[1].x = x + (int)(0.8660254038 * s);\
691 dc.DrawPolygon(3, p);\
742void CSG_Map_Shapes_Point::_Image_Draw(
CSG_Map_DC &dc_Map,
int x,
int y,
int size,
const wxString &file)
746 if( fn.IsRelative() )
753 if( fn.Exists() && Image.LoadFile(fn.GetFullPath()) )
755 double s =
m_Image.Scale * size;
756 double o =
m_Image.Offset * size;
758 int sx = Image.GetWidth ();
759 int sy = Image.GetHeight();
761 double d = (double)sx / (
double)sy;
766 sx = d > 1. ? s : (int)(0.5 + s * d);
767 sy = d <= 1. ? s : (int)(0.5 + s / d);
772 sy = (int)(0.5 + s / d);
776 sx = (int)(0.5 + s * d);
781 if( sx > 1 && sy > 1 )
791 dc_Map.
DrawBitmap(wxBitmap(Image.Scale(sx, sy)), x, y,
true);
802void CSG_Map_Shapes_Point::_Arrow_Draw(
CSG_Map_DC &dc_Map,
int x,
int y,
int size,
double angle)
804 static double Template[4][2] =
824 double sin_a = (1 + size) * sin(angle), cos_a = (1 + size) * cos(angle);
827 x + (int)(Template[i][0] * cos_a + Template[i][1] * sin_a),\
828 y + (int)(Template[i][1] * cos_a - Template[i][0] * sin_a) }
846 dc_Map.
DrawLine(Arrow[0][0], Arrow[0][1], Arrow[1][0], Arrow[1][1]);
847 dc_Map.
DrawLine(Arrow[0][0], Arrow[0][1], Arrow[2][0], Arrow[2][1]);
848 dc_Map.
DrawLine(Arrow[0][0], Arrow[0][1], Arrow[3][0], Arrow[3][1]);
857void CSG_Map_Shapes_Point::_Beachball_Draw(
CSG_Map_DC &dc_Map,
int x,
int y,
int size,
double strike,
double dip,
double rake)
859 const double dArc = 5.;
869 Plot.Get_Shape(0)->Add_Point(sin(a), cos(a));
874 N[0] = 0; N[1] = 0; N[2] = 1;
879 _Beachball_Get_Plane(Plot.Add_Shape(), Plot.Get_Shape(0), N);
881 N[0] = 0; N[1] = -1; N[2] = 0;
889 _Beachball_Get_Plane(Plot.Add_Shape(), Plot.Get_Shape(0), N);
895 CSG_Shape_Polygon *pPlot[2];
899 SG_Shape_Get_Difference (Plot.Get_Shape(3), Plot.Get_Shape(2)->asPolygon(), pPlot[0] = (CSG_Shape_Polygon *)Plot.Add_Shape());
900 SG_Shape_Get_Intersection(Plot.Get_Shape(4), Plot.Get_Shape(2)->asPolygon(), pPlot[1] = (CSG_Shape_Polygon *)Plot.Add_Shape());
904 SG_Shape_Get_Intersection(Plot.Get_Shape(3), Plot.Get_Shape(2)->asPolygon(), pPlot[0] = (CSG_Shape_Polygon *)Plot.Add_Shape());
905 SG_Shape_Get_Difference (Plot.Get_Shape(4), Plot.Get_Shape(2)->asPolygon(), pPlot[1] = (CSG_Shape_Polygon *)Plot.Add_Shape());
911 wxBrush b = dc_Map.
Get_DC().GetBrush(); dc_Map.
SetBrush(*wxWHITE_BRUSH);
913 for(
int i=0; i<2; i++)
916 _Beachball_Get_Scaled(pPlot[i], x, y, size);
918 if( pPlot[i]->Get_Area() > 1 )
922 for(
int iPoint=0; iPoint<pPlot[i]->Get_Point_Count(0); iPoint++)
924 CSG_Point p(pPlot[i]->Get_Point(iPoint, 0));
925 Points[iPoint].x = (int)(p.x + 0.5);
926 Points[iPoint].y = (int)(p.y + 0.5);
929 dc_Map.
DrawPolygon(pPlot[i]->Get_Point_Count(0), Points);
941 CSG_Vector Ez(3); Ez[2] = 1.0;
944 double Azimuth =
M_PI_090 + atan2(Normal[1], Normal[0]);
959 double d = -2. * tan(Slope / 2.);
961 C.x = d * sin(Azimuth);
962 C.y = d * cos(Azimuth);
964 pPlane->
Add_Part(((CSG_Shape_Polygon *)pCircle)->Get_Part(0));
970 A.x *= 1.1;
A.y *= 1.1;
980void CSG_Map_Shapes_Point::_Beachball_Get_Scaled(
CSG_Shape *pShape,
double x,
double y,
double size)
988 Point.
x = x + size * Point.
x;
989 Point.
y = y - size * Point.
y;
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path(const CSG_String &full_Path)
#define SG_GET_RGB(r, g, b)
const SG_Char * Get_File_Name(bool bNative=true) const
class CSG_Shapes * asShapes(bool bPolymorph=false) const
void SetBrush(const wxBrush &Brush)
void SetPen(const wxPen &Pen)
void DrawPolygon(int n, const wxPoint points[], int xoffset=0, int yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE)
void DrawCircle(int x, int y, int radius)
void DrawBitmap(const wxBitmap &bitmap, int x, int y, bool useAlpha=false)
void DrawLine(int x1, int y1, int x2, int y2)
wxMemoryDC & Get_DC(void)
const double & Scale(void) const
const double & World2DC(void) const
void DrawText(int Align, int x, int y, const wxString &Text)
void DrawRectangle(int x1, int y1, int width, int height)
bool Set_Fields_Choice(CSG_Parameter &Choice, bool bNumeric, bool bAddNone, bool bSelectNone=false)
static int Get_Fields_Choice(CSG_Parameter &Choice)
CSG_Data_Object * m_pObject
bool Set_Object(CSG_Data_Object *pObject)
CSG_Parameters m_Parameters
class CSG_Map_Symbology * m_pSymbology
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)
bool Get_Style_Size(int &minSize, int &maxSize, double &Minimum, double &Scale, wxString *pName)
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 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)
wxBrushStyle BrushList_Get_Style(const CSG_String &Identifier)
bool Get_Class_Color(CSG_Shape *pShape, int &Color)
class CSG_Map_Shapes::CLabel m_Label
virtual bool Parameters_Changed(void)
virtual bool DataObject_Changed(void)
bool Set_Collapsed(bool bOn=true)
bool Set_Children_Enabled(bool bEnabled=true)
bool Cmp_Identifier(const CSG_String &Identifier) const
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_FilePath(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *Filter=NULL, const SG_Char *Default=NULL, bool bSave=false, bool bDirectory=false, bool bMultiple=false)
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)
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)
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_Range(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Range_Min=0.0, double Range_Max=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
virtual int Get_Point_Count(void) const
virtual int Get_Point_Count(void) const =0
virtual int Add_Part(class CSG_Shape_Part *pPart, bool bRevert=false)
virtual int Add_Point(double x, double y, int iPart=0)=0
virtual int Get_Part_Count(void) const =0
virtual TSG_Point Get_Point(int iPoint=0) const =0
virtual int Set_Point(double x, double y, int iPoint=0, int iPart=0)=0
virtual TSG_Shape_Type Get_Type(void) const
static CSG_String Format(const char *Format,...)
const SG_Char * c_str(void) const
bool is_NoData(int Field) const
double asDouble(int Field) const
const SG_Char * asString(int Field, int Decimals=-99) const
double Get_Angle(const CSG_Vector &Vector) const
wxColour SG_Get_wxColor(int Color)
#define SG_DC_TEXTALIGN_YCENTER
#define SG_DC_TEXTALIGN_BOTTOM
#define SG_DC_TEXTALIGN_LEFT
#define SG_DC_TEXTALIGN_XCENTER
#define SG_DC_TEXTALIGN_RIGHT
#define SG_DC_TEXTALIGN_TOP
double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
#define LAYER_DRAW_FLAG_THUMBNAIL
#define LAYER_DRAW_FLAG_SELECTION
#define DRAW_TRIANGLE_DOWN(d)
#define SYMBOL_TYPE_Arrow
#define SYMBOL_TYPE_Image
#define DRAW_TRIANGLE_UP(d)
#define SYMBOL_TYPE_Beachball
bool SG_VectorR3_Rotate(double Vector[3], size_t Axis, double Angle)
#define PARAMETER_CHECK_ENABLE
#define PARAMETER_CHECK_VALUES
CSG_String SG_Get_ShapeType_Name(TSG_Shape_Type Type)
SAGA_API_DLL_EXPORT bool SG_Shape_Get_Intersection(CSG_Shape *pSubject, CSG_Shape_Polygon *pClip, CSG_Shape *pSolution=NULL)
SAGA_API_DLL_EXPORT bool SG_Shape_Get_Difference(CSG_Shape *pSubject, CSG_Shape_Polygon *pClip, CSG_Shape *pSolution=NULL)