17 namespace datastructure {
37 string name = string();
39 string shape_type =
"circle";
44 float default_location[2] = {0.0f, 0.0f};
45 Color default_fill_color{
"blue"};
46 Color default_stroke_color{
"white"};
47 int default_stroke_dash = 1;
48 float default_opacity = 1.0f;
49 float default_stroke_width = 1.0f;
50 string default_symbol =
"circle";
51 int default_font_size = 12;
55 string label = string();
56 Color fillColor{
"blue"},
59 float strokeWidth = 1.0f;
65 float location[2] = {0.0f, 0.0f};
68 int getNewIdentifier() {
96 identifier = getNewIdentifier();
102 virtual const string getSymbolRepresentation()
const = 0;
107 virtual vector<float> getDimensions()
const = 0;
113 identifier = getNewIdentifier();
159 fillColor =
Color(c);
185 strokeColor =
Color(c);
203 if (strokeWidth < 0.0f)
204 throw "Stroke width must be positive or null";
206 strokeWidth = strk_width;
224 if (op < 0.0f || op > 1.0f)
225 throw "Opacity must be between 0 and 1";
245 if (dash < 0 || dash > 10)
246 throw "Dash must be between 0 and 10 (inclusive)";
267 setLocation(
float(x),
float(y));
287 if ((x > -INFINITY && x < INFINITY) &&
288 (y > -INFINITY && y < INFINITY)) {
293 throw "Coordinates must be real numbers";
344 float angle_r = angle *
M_PI / 180.;
345 float c = cos(angle_r);
346 float s = sin(angle_r);
349 float tmp[] = { pt[0]*c - pt[1]*s, tmp[1] = pt[0] * s + pt[1] * c};
368 if (fillColor.getRepresentation() !=
369 default_fill_color.getRepresentation()) {
371 fillColor.getCSSRepresentation() +
COMMA;
374 if (opacity != default_opacity) {
376 to_string(opacity) +
COMMA;
379 if (strokeColor.getRepresentation() !=
380 default_stroke_color.getRepresentation()) {
382 strokeColor.getCSSRepresentation() +
COMMA;
385 if (strokeWidth != default_stroke_width) {
387 to_string(strokeWidth) +
COMMA;
390 if (strokeDash != default_stroke_dash) {
392 to_string(strokeDash) +
COMMA;
395 if (location[0] != default_location[0] ||
396 location[1] != default_location[1]) {
400 to_string(location[0]) +
COMMA +
402 to_string(location[1]) +
406 return symbol_attr_json;
void setLabel(string lbl)
Definition: Symbol.h:131
void setStrokeColor(Color c)
Definition: Symbol.h:175
Color getStrokeColor()
Definition: Symbol.h:193
const string COLON
Definition: DataStructure.h:51
void scalePoint(float *pt, float sx, float sy)
Scale a 2D point.
Definition: Symbol.h:331
const float * getLocation() const
Definition: Symbol.h:300
#define M_PI
Definition: OSMData.h:13
void setLocation(int x, int y)
Definition: Symbol.h:266
void setOpacity(float op)
Definition: Symbol.h:223
void rotatePoint(float *pt, float angle)
Rotate a 2D point (about Z)
Definition: Symbol.h:342
void setStrokeColor(string c)
Definition: Symbol.h:184
Symbol()
Definition: Symbol.h:95
const string CLOSE_CURLY
Definition: DataStructure.h:53
void setFillColor(string c)
Definition: Symbol.h:158
string getLabel() const
Definition: Symbol.h:140
This is an abstract class for deriving a number of Symbol shape objects, for use in a SymbolCollectio...
Definition: Symbol.h:32
void translatePoint(float *pt, float tx, float ty)
Translate a 2D point.
Definition: Symbol.h:320
This class represents Color, and supports rgba, hexadecimal and named color values.
Definition: Color.h:51
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
void setLocation(float x, float y)
Definition: Symbol.h:286
const string OPEN_CURLY
Definition: DataStructure.h:52
const string getSymbolAttributeRepresentation() const
Definition: Symbol.h:362
void setCenter(float x, float y)
Definition: Symbol.h:276
int getStrokeDash()
Definition: Symbol.h:256
Symbol(string symb)
Definition: Symbol.h:112
string getName() const
Definition: Symbol.h:309
float getOpacity()
Definition: Symbol.h:235
void setShapeType(string s)
Set the shape type.
Definition: Symbol.h:81
void setFillColor(Color c)
Definition: Symbol.h:150
const string COMMA
Definition: DataStructure.h:50
float getStrokeWidth()
Definition: Symbol.h:214
Color getFillColor()
Definition: Symbol.h:166
const string QUOTE
Definition: DataStructure.h:49
int getIdentifier()
Definition: Symbol.h:122
string getShapeType() const
Definition: Symbol.h:89
void setStrokeDash(int dash)
Definition: Symbol.h:244
void setStrokeWidth(float strk_width)
Definition: Symbol.h:202