12 namespace datastructure {
32 virtual string getShapeType()
const override {
62 if ((x > -INFINITY) && (x < INFINITY) &&
63 (y > -INFINITY) && (y < INFINITY)) {
68 throw "Invalid points for polyline!";
94 bbox[0] = bbox[1] = INFINITY;
95 bbox[2] = bbox[3] = -INFINITY;
96 for (
int k = 0; k <
points.size(); k += 2) {
101 if (
points[k + 1] < bbox[1])
103 if (
points[k + 1] > bbox[3])
106 center[0] = bbox[0] + (bbox[2] - bbox[0]) / 2.;
107 center[1] = bbox[1] + (bbox[3] - bbox[1]) / 2.;
118 string shape = getShapeType();
122 vector<float>::iterator it;
123 for (
int k = 0; k <
points.size(); k++) {
129 shape_json.erase(shape_json.size() - 1);
This class defines a polyline and is part of the symbol collection. A polyline has a set of vertices ...
Definition Polyline.h:23
void addPoint(float x, float y)
This method adds a point to the polyline.
Definition Polyline.h:61
vector< float > points
Definition Polyline.h:38
vector< float > getPoints()
This method returns the point list of the polyline.
Definition Polyline.h:76
Polyline()
default constructor
Definition Polyline.h:44
void setPolyline(vector< float > pts)
Construct a polyline from sequence of points.
Definition Polyline.h:84
const string getSymbolRepresentation() const override
This method returns the JSON representation of the shape.
Definition Polyline.h:115
Polyline(vector< float > pts)
Construct a polyline from sequence of points.
Definition Polyline.h:52
void getCenter(float *center)
Get center of polyline - use its bounding box.
Definition Polyline.h:92
This is an abstract class for deriving a number of Symbol shape objects, for use in a SymbolCollectio...
Definition Symbol.h:31
const string getSymbolAttributeRepresentation() const
Get the JSON of the symbol representation.
Definition Symbol.h:602
Support for drawing Bar charts.
Definition alltypes.h:4
const string COLON
Definition DataStructure.h:52
const string OPEN_BOX
Definition DataStructure.h:55
const string COMMA
Definition DataStructure.h:51
const string CLOSE_BOX
Definition DataStructure.h:56
const string CLOSE_CURLY
Definition DataStructure.h:54
const string QUOTE
Definition DataStructure.h:50