13 namespace datastructure {
25 float width = 1.0, height = 1.0;
32 setRectangle(0., 0., 1., 1.);
41 setRectangle (0., 0., w, h);
51 Rectangle (
float locx,
float locy,
float w,
float h) {
52 setRectangle (locx, locy, w, h);
80 throw "Illegal Size Value! Please enter a value in the range(0-300)";
92 throw "Illegal Size Value! Please enter a value in the range(0-300)";
104 const float *loc = getLocation();
105 float myloc[] = {loc[0], loc[1]};
106 translatePoint (myloc, tx, ty);
107 setLocation(myloc[0], myloc[1]);
118 float pt[2] = {(float) width, (
float) height};
119 scalePoint (pt, sx, sy);
132 vector<float> dims(4);
133 const float *location = getLocation();
135 dims[0] = location[0];
136 dims[1] = location[0] + width;
137 dims[2] = location[1];
138 dims[3] = location[1] + height;
154 if (w <= 0 || h <= 0)
155 throw "Width, Height must be positive";
156 setLocation (
float(locx),
float(locy));
159 setShapeType(
"rect");
169 string shape_json = getSymbolAttributeRepresentation();
171 string shape = getShapeType();
178 shape_json +=
QUOTE +
"width" +
QUOTE +
COLON + to_string(width) + COMMA +
void setHeight(float h)
Definition: Rectangle.h:90
Rectangle(int w, int h)
Definition: Rectangle.h:40
void translate(float tx, float ty)
Definition: Rectangle.h:103
const string COLON
Definition: DataStructure.h:51
Rectangle(float locx, float locy, float w, float h)
Definition: Rectangle.h:51
virtual const string getSymbolRepresentation() const
Definition: Rectangle.h:167
void setRectangle(float locx, float locy, float w, float h)
Definition: Rectangle.h:153
void scale(float sx, float sy)
Definition: Rectangle.h:115
const string CLOSE_CURLY
Definition: DataStructure.h:53
string getDataStructType()
Definition: Rectangle.h:60
This is an abstract class for deriving a number of Symbol shape objects, for use in a SymbolCollectio...
Definition: Symbol.h:32
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
void setWidth(float w)
Definition: Rectangle.h:78
string getName() const
Definition: Rectangle.h:69
Rectangle()
Definition: Rectangle.h:31
vector< float > getDimensions() const
Definition: Rectangle.h:130
const string COMMA
Definition: DataStructure.h:50
const string QUOTE
Definition: DataStructure.h:49
This class defines a rectangle and is part of the symbol collection. A rectangle has height and width...
Definition: Rectangle.h:22