OMNeT++ Simulation Library  5.6.1
ccanvas.h
1 //==========================================================================
2 // CCANVAS.H - header for
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 //==========================================================================
7 
8 /*--------------------------------------------------------------*
9  Copyright (C) 1992-2017 Andras Varga
10  Copyright (C) 2006-2017 OpenSim Ltd.
11 
12  This file is distributed WITHOUT ANY WARRANTY. See the file
13  `license' for details on this and other legal matters.
14 *--------------------------------------------------------------*/
15 
16 #ifndef __OMNETPP_CCANVAS_H
17 #define __OMNETPP_CCANVAS_H
18 
19 #include <string>
20 #include <map>
21 #include <vector>
22 #include "cownedobject.h"
23 
24 namespace omnetpp {
25 
26 class cCanvas;
27 class cProperty;
28 class cProperties;
29 class cObjectFactory;
30 
31 //TODO: doc: default values as precise enum names
32 //TODO: doc: @figure attributes for each figure type
33 //TODO: doc: revise class descriptions
34 
57 class SIM_API cFigure : public cOwnedObject
58 {
59  public:
64  struct SIM_API Point {
67  double x, y;
69 
71  Point() : x(0), y(0) {}
72  Point(double x, double y) : x(x), y(y) {}
73  Point operator + (const Point& p) const;
74  Point operator - (const Point& p) const;
75  Point operator * (double s) const;
76  Point operator / (double s) const;
77  double operator * (const Point& p) const;
78  double distanceTo(const Point& p) const;
79  double getLength() const;
80  Point& translate(double dx, double dy) {x += dx; y += dy; return *this;}
81  bool operator==(const Point& other) const {return x == other.x && y == other.y;}
82  std::string str() const;
84  };
85 
90  struct SIM_API Rectangle {
93  double x, y, width, height;
95 
97  Rectangle() : x(0), y(0), width(0), height(0) {}
98  Rectangle(double x, double y, double width, double height) : x(x), y(y), width(width), height(height) {}
99  Point getCenter() const;
100  Point getSize() const;
101  Rectangle& translate(double dx, double dy) {x += dx; y += dy; return *this;}
102  bool operator==(const Rectangle& other) const {return x == other.x && y == other.y && width == other.width && height == other.height;}
103  std::string str() const;
105  };
106 
120  struct SIM_API Color {
123  uint8_t red, green, blue;
125 
127  Color() : red(0), green(0), blue(0) {}
128  Color(uint8_t red, uint8_t green, uint8_t blue) : red(red), green(green), blue(blue) {}
129  Color(const char *color) {*this = parseColor(color);}
130  bool operator==(const Color& other) const {return red == other.red && green == other.green && blue == other.blue;}
131  std::string str() const;
133  };
134 
137  static const Color BLACK;
138  static const Color WHITE;
139  static const Color GREY;
140  static const Color RED;
141  static const Color GREEN;
142  static const Color BLUE;
143  static const Color YELLOW;
144  static const Color CYAN;
145  static const Color MAGENTA;
146 
147  static const int NUM_GOOD_DARK_COLORS;
148  static const int NUM_GOOD_LIGHT_COLORS;
149  static const Color GOOD_DARK_COLORS[14];
150  static const Color GOOD_LIGHT_COLORS[10];
152 
157  struct SIM_API Font {
160  std::string typeface;
161  int pointSize;
162  uint8_t style;
163 
164 
166  Font() : pointSize(0), style(FONT_NONE) {}
167  Font(std::string typeface, int pointSize=-1, uint8_t style=FONT_NONE) : typeface(typeface), pointSize(pointSize), style(style) {}
168  bool operator==(const Font& other) const {return typeface == other.typeface && pointSize == other.pointSize && style == other.style;}
169  std::string str() const;
171  };
172 
174  enum FontStyle { FONT_NONE=0, FONT_BOLD=1, FONT_ITALIC=2, FONT_UNDERLINE=4 };
175 
177  enum LineStyle { LINE_SOLID, LINE_DOTTED, LINE_DASHED };
178 
180  enum CapStyle { CAP_BUTT, CAP_SQUARE, CAP_ROUND };
181 
183  enum JoinStyle { JOIN_BEVEL, JOIN_MITER, JOIN_ROUND };
184 
186  enum FillRule { FILL_EVENODD, FILL_NONZERO };
187 
189  enum Arrowhead { ARROW_NONE, ARROW_SIMPLE, ARROW_TRIANGLE, ARROW_BARBED };
190 
192  enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_FAST, INTERPOLATION_BEST };
193 
195  enum Anchor {ANCHOR_CENTER, ANCHOR_N, ANCHOR_E, ANCHOR_S, ANCHOR_W, ANCHOR_NW, ANCHOR_NE, ANCHOR_SE, ANCHOR_SW, ANCHOR_BASELINE_START, ANCHOR_BASELINE_MIDDLE, ANCHOR_BASELINE_END };
196 
197  //TODO enum Alignment { ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER }; // note: multi-line text is always left-aligned in tkpath
198 
211  struct SIM_API Transform {
214  double a, b, c, d, t1, t2;
216 
219  Transform() : a(1), b(0), c(0), d(1), t1(0), t2(0) {}
220  Transform(double a, double b, double c, double d, double t1, double t2) : a(a), b(b), c(c), d(d), t1(t1), t2(t2) {}
221  Transform(const Transform& t) : a(t.a), b(t.b), c(t.c), d(t.d), t1(t.t1), t2(t.t2) {}
222  Transform& operator=(const Transform& t) {a=t.a; b=t.b; c=t.c; d=t.d; t1=t.t1; t2=t.t2; return *this;}
223  Transform& translate(double dx, double dy);
224  Transform& translate(const Point& p) {return translate(p.x, p.y);}
225  Transform& scale(double s) {return scale(s,s);}
226  Transform& scale(double sx, double sy);
227  Transform& scale(double sx, double sy, double cx, double cy);
228  Transform& scale(double sx, double sy, const Point& c) {return scale(sx, sy, c.x, c.y);}
229  Transform& rotate(double phi);
230  Transform& rotate(double phi, double cx, double cy);
231  Transform& rotate(double phi, const Point& c) {return rotate(phi, c.x, c.y);}
232  Transform& skewx(double coeff); // note: if you want to skew by an angle, use coeff = tan(phi)
233  Transform& skewy(double coeff);
234  Transform& skewx(double coeff, double cy);
235  Transform& skewy(double coeff, double cx);
236  Transform& multiply(const Transform& t); // left-multiply: *this = t * (*this)
237  Transform& rightMultiply(const Transform& t); // *this = (*this) * t
238  Point applyTo(const Point& p) const;
239  bool operator==(const Transform& o) const {return a == o.a && b == o.b && c == o.c && d == o.d && t1 == o.t1 && t2 == o.t2;}
240  std::string str() const;
242  };
243 
248  struct SIM_API RGBA {
251  uint8_t red, green, blue, alpha;
253 
255  RGBA() : red(0), green(0), blue(0), alpha(0) {}
256  RGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) : red(red), green(green), blue(blue), alpha(alpha) {}
257  void set(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {red=r; green=g; blue=b; alpha=a;}
258  void operator=(const Color& color) {red = color.red; green = color.green; blue = color.blue; alpha = 255;}
259  operator Color() const {return Color(red, green, blue);}
260  bool operator==(const RGBA& o) const {return red == o.red && green == o.green && blue == o.blue && alpha == o.alpha;}
261  std::string str() const;
263  };
264 
270  class SIM_API Pixmap {
271  private:
272  int width, height; // zero is allowed
273  RGBA *data;
274  private:
275  void allocate(int width, int height);
276  static uint8_t alpha(double opacity) {return opacity<=0 ? 0 : opacity>=1.0 ? 255 : (uint8_t)(opacity*255+0.5);}
277  public:
280  Pixmap();
281  Pixmap(int width, int height); // filled with transparent black
282  Pixmap(int width, int height, const RGBA& fill);
283  Pixmap(int width, int height, const Color& color, double opacity=1);
284  Pixmap(const Pixmap& other);
285  ~Pixmap();
286  Pixmap& operator=(const Pixmap& other);
287  void setSize(int width, int height, const RGBA& fill_); // nondestructive
288  void setSize(int width, int height, const Color& color, double opacity); // nondestructive
289  void fill(const RGBA& fill_);
290  void fill(const Color& color, double opacity);
291  int getWidth() const {return width;}
292  int getHeight() const {return height;}
293  RGBA& pixel(int x, int y);
294  const RGBA pixel(int x, int y) const {return const_cast<Pixmap*>(this)->pixel(x,y);}
295  void setPixel(int x, int y, const Color& color, double opacity=1.0) {RGBA& p = pixel(x,y); p.set(color.red, color.green, color.blue, alpha(opacity));}
296  const Color getColor(int x, int y) const {return (Color)pixel(x,y);}
297  void setColor(int x, int y, const Color& color) {RGBA& p = pixel(x,y); p.red = color.red; p.green = color.green; p.blue = color.blue;}
298  double getOpacity(int x, int y) const {return pixel(x,y).alpha / 255.0;}
299  void setOpacity(int x, int y, double opacity) {pixel(x,y).alpha = alpha(opacity);}
300  const uint8_t *buffer() const {return (uint8_t*)data;} // direct access for low-level manipulation
301  std::string str() const;
303  };
304 
305  // internal:
306  enum {
307  CHANGE_STRUCTURAL = 1, // child added, removed, or reordered, shown/hidden
308  CHANGE_TRANSFORM = 2, // transform change
309  CHANGE_GEOMETRY = 4, // geometry information (bounds, position, start/end angle, etc)
310  CHANGE_VISUAL = 8, // styling
311  CHANGE_INPUTDATA = 16, // text, image name or pixmap data, value to be displayed, etc
312  CHANGE_TAGS = 32, // figure tags
313  CHANGE_ZINDEX = 64, // zIndex
314  CHANGE_OTHER = 128 // tooltip, associated object
315  };
316 
317  private:
318  static int lastId;
319  static cStringPool stringPool;
320  int id;
321  double zIndex;
322  bool visible; // treated as structural change, for simpler handling
323  const char *tooltip; // stringpool'd
324  cObject *associatedObject;
325  Transform transform;
326  std::vector<cFigure*> children;
327  const char *tags; // stringpool'd
328  uint64_t tagBits; // bit-to-tagname mapping is stored in cCanvas. Note: change to std::bitset if 64 tags are not enough
329  uint8_t localChanges;
330  uint8_t subtreeChanges;
331 
332  protected:
333  // internal:
334  virtual void validatePropertyKeys(cProperty *property) const; // relies on isAllowedPropertyKey()
335  virtual bool isAllowedPropertyKey(const char *key) const; // allows "x-*" keys, plus the ones returned by getAllowedPropertyKeys()
336  virtual cFigure *getRootFigure() const;
337  void fireStructuralChange() {fire(CHANGE_STRUCTURAL);}
338  void fireTransformChange() {fire(CHANGE_TRANSFORM);}
339  void fireGeometryChange() {fire(CHANGE_GEOMETRY);}
340  void fireVisualChange() {fire(CHANGE_VISUAL);}
341  void fireInputDataChange() {fire(CHANGE_INPUTDATA);}
342  virtual void fire(uint8_t flags);
343 
344  protected:
345  // helpers for parse(cProperty*)
346  static Point parsePoint(cProperty *property, const char *key, int index);
347  static std::vector<Point> parsePoints(cProperty *property, const char *key);
348  _OPPDEPRECATED static Rectangle parseBounds(cProperty *property) {return parseBounds(property, Rectangle());} //TODO use parseBounds(property, getBounds()) instead
349  static Rectangle parseBounds(cProperty *property, const Rectangle& defaults);
350  static Transform parseTransform(cProperty *property, const char *key);
351  static Font parseFont(cProperty *property, const char *key);
352  static Rectangle computeBoundingBox(const Point& position, const Point& size, double ascent, Anchor anchor);
353  static void concatArrays(const char **dest, const char **first, const char **second); // concatenates nullptr-terminated arrays
354 
355  public:
356  // helpers for class descriptors and parse(cProperty*)
357  static Point parsePoint(const char *s); // parse Point::str() format
358  static Rectangle parseRectangle(const char *s); // parse Rectangle::str() format
359  static Transform parseTransform(const char *s); // parse Transform::str() format
360  static Font parseFont(const char *s); // parse Font::str() format
361  static Color parseColor(const char *s);
362  static bool parseBool(const char *s);
363  static LineStyle parseLineStyle(const char *s);
364  static CapStyle parseCapStyle(const char *s);
365  static JoinStyle parseJoinStyle(const char *s);
366  static FillRule parseFillRule(const char *s);
367  static Arrowhead parseArrowhead(const char *s);
368  static Interpolation parseInterpolation(const char *s);
369  static Anchor parseAnchor(const char *s);
370 
371  public:
372  // internal, mostly used by runtime GUIs:
373  virtual void updateParentTransform(Transform& transform) {transform.rightMultiply(getTransform());}
374  virtual void callRefreshDisplay(); // call refreshDisplay(), and recurse to its children
375  uint8_t getLocalChangeFlags() const {return localChanges;}
376  uint8_t getSubtreeChangeFlags() const {return subtreeChanges;}
377  void clearChangeFlags();
378  void refreshTagBitsRec(cCanvas *ownerCanvas);
379  int64_t getTagBits() const {return tagBits;}
380  void setTagBits(uint64_t tagBits) {this->tagBits = tagBits;}
381 
382  private:
383  void copy(const cFigure& other);
384 
385  public:
391  explicit cFigure(const char *name=nullptr);
392 
396  cFigure(const cFigure& other) : cOwnedObject(other), tooltip(nullptr), tags(nullptr) {copy(other);}
397 
401  virtual ~cFigure();
402 
408  cFigure& operator=(const cFigure& other);
410 
418  virtual cFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
419 
424  virtual void forEachChild(cVisitor *v) override;
425 
429  virtual std::string str() const override;
431 
438  int getId() const {return id;}
439 
443  virtual bool isVisible() const {return visible;}
444 
450  virtual void setVisible(bool visible);
451 
455  virtual const Transform& getTransform() const {return transform;}
456 
463  virtual void setTransform(const Transform& transform);
464 
469  virtual void resetTransform() {setTransform(Transform());}
470 
476  virtual double getZIndex() const {return zIndex;}
477 
488  virtual void setZIndex(double zIndex);
489 
496  virtual double getEffectiveZIndex() const;
497 
501  virtual const char *getTooltip() const {return tooltip;}
502 
509  virtual void setTooltip(const char *tooltip);
510 
517  virtual cObject *getAssociatedObject() const {return associatedObject;}
518 
524  virtual void setAssociatedObject(cObject *obj);
525 
531  virtual const char *getTags() const {return tags;}
532 
538  virtual void setTags(const char *tags);
540 
546  virtual cFigure *getParentFigure() const {return dynamic_cast<cFigure*>(getOwner());}
547 
553  virtual cCanvas *getCanvas() const;
554 
558  virtual int getNumFigures() const {return children.size();}
559 
565  virtual cFigure *getFigure(int pos) const;
566 
571  virtual cFigure *getFigure(const char *name) const;
572 
577  virtual int findFigure(const char *name) const;
578 
583  virtual int findFigure(const cFigure *figure) const;
584 
588  virtual bool containsFigures() const {return !children.empty();}
589 
594  virtual cFigure *findFigureRecursively(const char *name) const;
595 
614  virtual cFigure *getFigureByPath(const char *path) const;
616 
622  virtual void addFigure(cFigure *figure);
623 
630  virtual void addFigure(cFigure *figure, int pos);
631 
635  _OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure) {figure->insertAbove(referenceFigure);}
636 
640  _OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure) {figure->insertBelow(referenceFigure);}
641 
648  virtual cFigure *removeFigure(cFigure *figure);
649 
656  virtual cFigure *removeFigure(int pos);
657 
662  virtual cFigure *removeFromParent();
664 
673  virtual bool isAbove(const cFigure *figure) const;
674 
681  virtual bool isBelow(const cFigure *figure) const;
682 
695  virtual void insertAbove(cFigure *referenceFigure);
696 
709  virtual void insertBelow(cFigure *referenceFigure);
710 
716  virtual void insertAfter(const cFigure *referenceFigure);
717 
723  virtual void insertBefore(const cFigure *referenceFigure);
724 
731  virtual void raiseAbove(cFigure *figure);
732 
739  virtual void lowerBelow(cFigure *figure);
740 
747  virtual void raiseToTop();
748 
755  virtual void lowerToBottom();
756 
760  virtual cFigure *dupTree() const;
762 
765  virtual void translate(double dx, double dy) {transform.translate(dx,dy); fireTransformChange();}
766  virtual void scale(double s) {transform.scale(s); fireTransformChange();}
767  virtual void scale(double sx, double sy) {transform.scale(sx,sy); fireTransformChange();}
768  virtual void scale(double sx, double sy, double cx, double cy) {transform.scale(sx,sy,cx,cy); fireTransformChange();}
769  virtual void scale(double sx, double sy, const Point& c) {scale(sx, sy, c.x, c.y);}
770  virtual void rotate(double phi) {transform.rotate(phi); fireTransformChange();}
771  virtual void rotate(double phi, double cx, double cy) {transform.rotate(phi,cx,cy); fireTransformChange();}
772  virtual void rotate(double phi, const Point& c) {rotate(phi, c.x, c.y);}
773  virtual void skewx(double coeff) {transform.skewx(coeff); fireTransformChange();}
774  virtual void skewy(double coeff) {transform.skewy(coeff); fireTransformChange();}
775  virtual void skewx(double coeff, double cy) {transform.skewx(coeff,cy); fireTransformChange();}
776  virtual void skewy(double coeff, double cx) {transform.skewy(coeff,cx); fireTransformChange();}
778 
791  virtual void parse(cProperty *property);
792 
803  virtual const char **getAllowedPropertyKeys() const;
804 
809  virtual void moveLocal(double dx, double dy) = 0;
810 
817  virtual void move(double dx, double dy);
818 
826  virtual void refreshDisplay() {}
827 
833  virtual const char *getRendererClassName() const = 0;
835 };
836 
837 // import the namespace to be able to use the stream write operators
838 namespace canvas_stream_ops {
839 #define STREAMOP(CLASS) inline std::ostream& operator<<(std::ostream& os, const CLASS& x) { return os << x.str(); }
840 STREAMOP(cFigure::Point);
841 STREAMOP(cFigure::Rectangle);
842 STREAMOP(cFigure::Color);
843 STREAMOP(cFigure::Font);
844 STREAMOP(cFigure::Transform);
845 STREAMOP(cFigure::RGBA);
846 STREAMOP(cFigure::Pixmap);
847 #undef STREAMOP
848 };
849 
850 
861 class SIM_API cGroupFigure : public cFigure
862 {
863  private:
864  void copy(const cGroupFigure& other) {}
865  public:
868  explicit cGroupFigure(const char *name=nullptr) : cFigure(name) {}
869  cGroupFigure(const cGroupFigure& other) : cFigure(other) {copy(other);}
870  cGroupFigure& operator=(const cGroupFigure& other);
872 
875  virtual cGroupFigure *dup() const override {return new cGroupFigure(*this);}
876  virtual std::string str() const override;
877  virtual const char *getRendererClassName() const override {return "GroupFigureRenderer";}
878  virtual void moveLocal(double dx, double dy) override {}
880 };
881 
895 class SIM_API cPanelFigure : public cFigure
896 {
897  private:
898  Point position;
899  Point anchorPoint;
900  protected:
901  virtual const char **getAllowedPropertyKeys() const override;
902  virtual void parse(cProperty *property) override;
903  private:
904  void copy(const cPanelFigure& other);
905  public:
908  explicit cPanelFigure(const char *name=nullptr) : cFigure(name) {}
909  cPanelFigure(const cPanelFigure& other) : cFigure(other) {copy(other);}
910  cPanelFigure& operator=(const cPanelFigure& other);
912 
915  virtual cPanelFigure *dup() const override {return new cPanelFigure(*this);}
916  virtual std::string str() const override;
917  virtual const char *getRendererClassName() const override {return "";} // non-visual figure
918  virtual void updateParentTransform(Transform& transform) override;
919  virtual void move(double dx, double dy) override { moveLocal(dx, dy); }
920  virtual void moveLocal(double dx, double dy) override {position.x += dx; position.y += dy; fireTransformChange();}
922 
925  virtual const Point& getPosition() const {return position;}
926  virtual void setPosition(const Point& position) {this->position = position; fireTransformChange();}
927 
937  virtual const Point& getAnchorPoint() const {return anchorPoint;}
938  virtual void setAnchorPoint(const Point& anchorPoint) {this->anchorPoint = anchorPoint; fireTransformChange();}
939 
941 };
942 
959 class SIM_API cAbstractLineFigure : public cFigure
960 {
961  private:
962  Color lineColor;
963  LineStyle lineStyle;
964  double lineWidth;
965  double lineOpacity;
966  CapStyle capStyle;
967  Arrowhead startArrowhead, endArrowhead;
968  bool zoomLineWidth;
969  private:
970  void copy(const cAbstractLineFigure& other);
971  protected:
972  virtual const char **getAllowedPropertyKeys() const override;
973  public:
976  explicit cAbstractLineFigure(const char *name=nullptr) : cFigure(name), lineColor(BLACK), lineStyle(LINE_SOLID), lineWidth(1), lineOpacity(1), capStyle(CAP_BUTT), startArrowhead(ARROW_NONE), endArrowhead(ARROW_NONE), zoomLineWidth(false) {}
977  cAbstractLineFigure(const cAbstractLineFigure& other) : cFigure(other) {copy(other);}
978  cAbstractLineFigure& operator=(const cAbstractLineFigure& other);
980 
983  virtual cAbstractLineFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
984  virtual std::string str() const override;
985  virtual void parse(cProperty *property) override;
987 
993  virtual const Color& getLineColor() const {return lineColor;}
994 
998  virtual void setLineColor(const Color& lineColor);
999 
1005  virtual double getLineWidth() const {return lineWidth;}
1006 
1012  virtual void setLineWidth(double lineWidth);
1013 
1017  virtual double getLineOpacity() const {return lineOpacity;}
1018 
1023  virtual void setLineOpacity(double lineOpacity);
1024 
1028  virtual LineStyle getLineStyle() const {return lineStyle;}
1029 
1034  virtual void setLineStyle(LineStyle lineStyle);
1035 
1039  virtual CapStyle getCapStyle() const {return capStyle;}
1040 
1045  virtual void setCapStyle(CapStyle capStyle);
1046 
1050  virtual Arrowhead getStartArrowhead() const {return startArrowhead;}
1051 
1056  virtual void setStartArrowhead(Arrowhead startArrowhead);
1057 
1061  virtual Arrowhead getEndArrowhead() const {return endArrowhead;}
1062 
1067  virtual void setEndArrowhead(Arrowhead endArrowhead);
1068 
1073  virtual bool getZoomLineWidth() const {return zoomLineWidth;}
1074 
1080  virtual void setZoomLineWidth(bool zoomLineWidth);
1082 };
1083 
1092 class SIM_API cLineFigure : public cAbstractLineFigure
1093 {
1094  private:
1095  Point start, end;
1096  private:
1097  void copy(const cLineFigure& other);
1098  protected:
1099  virtual const char **getAllowedPropertyKeys() const override;
1100  public:
1103  explicit cLineFigure(const char *name=nullptr) : cAbstractLineFigure(name) {}
1104  cLineFigure(const cLineFigure& other) : cAbstractLineFigure(other) {copy(other);}
1105  cLineFigure& operator=(const cLineFigure& other);
1107 
1110  virtual cLineFigure *dup() const override {return new cLineFigure(*this);}
1111  virtual std::string str() const override;
1112  virtual void parse(cProperty *property) override;
1113  virtual void moveLocal(double dx, double dy) override;
1114  virtual const char *getRendererClassName() const override {return "LineFigureRenderer";}
1116 
1122  virtual const Point& getStart() const {return start;}
1123 
1127  virtual void setStart(const Point& start);
1128 
1132  virtual const Point& getEnd() const {return end;}
1133 
1137  virtual void setEnd(const Point& end);
1139 };
1140 
1160 class SIM_API cArcFigure : public cAbstractLineFigure
1161 {
1162  private:
1163  Rectangle bounds; // bounding box of the oval that arc is part of
1164  double startAngle, endAngle; // in radians, CCW, 0=east
1165  private:
1166  void copy(const cArcFigure& other);
1167  protected:
1168  virtual const char **getAllowedPropertyKeys() const override;
1169  public:
1172  explicit cArcFigure(const char *name=nullptr) : cAbstractLineFigure(name), startAngle(0), endAngle(0) {}
1173  cArcFigure(const cArcFigure& other) : cAbstractLineFigure(other) {copy(other);}
1174  cArcFigure& operator=(const cArcFigure& other);
1176 
1179  virtual cArcFigure *dup() const override {return new cArcFigure(*this);}
1180  virtual std::string str() const override;
1181  virtual void parse(cProperty *property) override;
1182  virtual void moveLocal(double dx, double dy) override;
1183  virtual const char *getRendererClassName() const override {return "ArcFigureRenderer";}
1185 
1192  virtual const Rectangle& getBounds() const {return bounds;}
1193 
1198  virtual void setBounds(const Rectangle& bounds);
1199 
1204  virtual void setPosition(const Point& position, Anchor anchor);
1205 
1210  virtual double getStartAngle() const {return startAngle;}
1211 
1216  virtual void setStartAngle(double startAngle);
1217 
1222  virtual double getEndAngle() const {return endAngle;}
1223 
1228  virtual void setEndAngle(double endAngle);
1230 };
1231 
1249 class SIM_API cPolylineFigure : public cAbstractLineFigure
1250 {
1251  private:
1252  std::vector<Point> points;
1253  bool smooth;
1254  JoinStyle joinStyle;
1255  private:
1256  void copy(const cPolylineFigure& other);
1257  void checkIndex(int i) const;
1258  void checkInsIndex(int i) const;
1259  protected:
1260  virtual const char **getAllowedPropertyKeys() const override;
1261  public:
1264  explicit cPolylineFigure(const char *name=nullptr) : cAbstractLineFigure(name), smooth(false), joinStyle(JOIN_MITER) {}
1265  cPolylineFigure(const cPolylineFigure& other) : cAbstractLineFigure(other) {copy(other);}
1266  cPolylineFigure& operator=(const cPolylineFigure& other);
1268 
1271  virtual cPolylineFigure *dup() const override {return new cPolylineFigure(*this);}
1272  virtual std::string str() const override;
1273  virtual void parse(cProperty *property) override;
1274  virtual void moveLocal(double dx, double dy) override;
1275  virtual const char *getRendererClassName() const override {return "PolylineFigureRenderer";}
1277 
1283  virtual const std::vector<Point>& getPoints() const {return points;}
1284 
1288  virtual void setPoints(const std::vector<Point>& points);
1289 
1293  virtual int getNumPoints() const {return points.size();}
1294 
1299  virtual const Point& getPoint(int i) const {checkIndex(i); return points[i];}
1300 
1304  virtual void setPoint(int i, const Point& point);
1305 
1309  virtual void addPoint(const Point& point);
1310 
1314  virtual void removePoint(int i);
1315 
1320  virtual void insertPoint(int i, const Point& point);
1321 
1328  virtual bool getSmooth() const {return smooth;}
1329 
1336  virtual void setSmooth(bool smooth);
1338 
1344  virtual JoinStyle getJoinStyle() const {return joinStyle;}
1345 
1350  virtual void setJoinStyle(JoinStyle joinStyle);
1352 };
1353 
1374 class SIM_API cAbstractShapeFigure : public cFigure
1375 {
1376  private:
1377  bool outlined;
1378  bool filled;
1379  Color lineColor;
1380  Color fillColor;
1381  LineStyle lineStyle;
1382  double lineWidth;
1383  double lineOpacity;
1384  double fillOpacity;
1385  bool zoomLineWidth;
1386  private:
1387  void copy(const cAbstractShapeFigure& other);
1388  protected:
1389  virtual const char **getAllowedPropertyKeys() const override;
1390  public:
1393  explicit cAbstractShapeFigure(const char *name=nullptr) : cFigure(name), outlined(true), filled(false), lineColor(BLACK), fillColor(BLUE), lineStyle(LINE_SOLID), lineWidth(1), lineOpacity(1), fillOpacity(1), zoomLineWidth(false) {}
1394  cAbstractShapeFigure(const cAbstractShapeFigure& other) : cFigure(other) {copy(other);}
1395  cAbstractShapeFigure& operator=(const cAbstractShapeFigure& other);
1397 
1400  virtual cAbstractShapeFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
1401  virtual std::string str() const override;
1402  virtual void parse(cProperty *property) override;
1404 
1410  virtual bool isFilled() const {return filled;}
1411 
1416  virtual void setFilled(bool filled);
1417 
1421  virtual bool isOutlined() const {return outlined;}
1422 
1427  virtual void setOutlined(bool outlined);
1428 
1432  virtual const Color& getLineColor() const {return lineColor;}
1433 
1438  virtual void setLineColor(const Color& lineColor);
1439 
1443  virtual const Color& getFillColor() const {return fillColor;}
1444 
1450  virtual void setFillColor(const Color& fillColor);
1451 
1455  virtual LineStyle getLineStyle() const {return lineStyle;}
1456 
1461  virtual void setLineStyle(LineStyle lineStyle);
1462 
1468  virtual double getLineWidth() const {return lineWidth;}
1469 
1475  virtual void setLineWidth(double lineWidth);
1476 
1481  virtual double getLineOpacity() const {return lineOpacity;}
1482 
1487  virtual void setLineOpacity(double lineOpacity);
1488 
1493  virtual double getFillOpacity() const {return fillOpacity;}
1494 
1499  virtual void setFillOpacity(double fillOpacity);
1500 
1505  virtual bool getZoomLineWidth() const {return zoomLineWidth;}
1506 
1512  virtual void setZoomLineWidth(bool zoomLineWidth);
1514 };
1515 
1526 {
1527  private:
1528  Rectangle bounds;
1529  double cornerRx, cornerRy;
1530  protected:
1531  virtual const char **getAllowedPropertyKeys() const override;
1532  private:
1533  void copy(const cRectangleFigure& other);
1534  public:
1537  explicit cRectangleFigure(const char *name=nullptr) : cAbstractShapeFigure(name), cornerRx(0), cornerRy(0) {}
1538  cRectangleFigure(const cRectangleFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1539  cRectangleFigure& operator=(const cRectangleFigure& other);
1541 
1544  virtual cRectangleFigure *dup() const override {return new cRectangleFigure(*this);}
1545  virtual std::string str() const override;
1546  virtual void parse(cProperty *property) override;
1547  virtual void moveLocal(double dx, double dy) override;
1548  virtual const char *getRendererClassName() const override {return "RectangleFigureRenderer";}
1550 
1556  virtual const Rectangle& getBounds() const {return bounds;}
1557 
1561  virtual void setBounds(const Rectangle& bounds);
1562 
1567  virtual void setPosition(const Point& position, Anchor anchor);
1568 
1573  virtual void setCornerRadius(double r) {setCornerRx(r);setCornerRy(r);}
1574 
1578  virtual double getCornerRx() const {return cornerRx;}
1579 
1584  virtual void setCornerRx(double rx);
1585 
1589  virtual double getCornerRy() const {return cornerRy;}
1590 
1595  virtual void setCornerRy(double ry);
1597 };
1598 
1608 class SIM_API cOvalFigure : public cAbstractShapeFigure
1609 {
1610  private:
1611  Rectangle bounds; // bounding box
1612  private:
1613  void copy(const cOvalFigure& other);
1614  protected:
1615  virtual const char **getAllowedPropertyKeys() const override;
1616  public:
1619  explicit cOvalFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1620  cOvalFigure(const cOvalFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1621  cOvalFigure& operator=(const cOvalFigure& other);
1623 
1626  virtual cOvalFigure *dup() const override {return new cOvalFigure(*this);}
1627  virtual std::string str() const override;
1628  virtual void parse(cProperty *property) override;
1629  virtual void moveLocal(double dx, double dy) override;
1630  virtual const char *getRendererClassName() const override {return "OvalFigureRenderer";}
1632 
1638  virtual const Rectangle& getBounds() const {return bounds;}
1639 
1643  virtual void setBounds(const Rectangle& bounds);
1644 
1649  virtual void setPosition(const Point& position, Anchor anchor);
1651 };
1652 
1663 class SIM_API cRingFigure : public cAbstractShapeFigure
1664 {
1665  private:
1666  Rectangle bounds; // bounding box
1667  double innerRx, innerRy;
1668  private:
1669  void copy(const cRingFigure& other);
1670  protected:
1671  virtual const char **getAllowedPropertyKeys() const override;
1672  public:
1675  explicit cRingFigure(const char *name=nullptr) : cAbstractShapeFigure(name), innerRx(0), innerRy(0) {}
1676  cRingFigure(const cRingFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1677  cRingFigure& operator=(const cRingFigure& other);
1679 
1682  virtual cRingFigure *dup() const override {return new cRingFigure(*this);}
1683  virtual std::string str() const override;
1684  virtual void parse(cProperty *property) override;
1685  virtual void moveLocal(double dx, double dy) override;
1686  virtual const char *getRendererClassName() const override {return "RingFigureRenderer";}
1688 
1694  virtual const Rectangle& getBounds() const {return bounds;}
1695 
1699  virtual void setBounds(const Rectangle& bounds);
1700 
1705  virtual void setPosition(const Point& position, Anchor anchor);
1706 
1712  virtual void setInnerRadius(double r) {setInnerRx(r);setInnerRy(r);}
1713 
1717  virtual double getInnerRx() const {return innerRx;}
1718 
1722  virtual void setInnerRx(double rx);
1723 
1727  virtual double getInnerRy() const {return innerRy;}
1728 
1732  virtual void setInnerRy(double ry);
1734 };
1735 
1764 {
1765  private:
1766  Rectangle bounds; // bounding box of the oval that the pie slice is part of
1767  double startAngle, endAngle; // in radians, CCW, 0=east
1768  private:
1769  void copy(const cPieSliceFigure& other);
1770  protected:
1771  virtual const char **getAllowedPropertyKeys() const override;
1772  public:
1775  explicit cPieSliceFigure(const char *name=nullptr) : cAbstractShapeFigure(name), startAngle(0), endAngle(0) {}
1776  cPieSliceFigure(const cPieSliceFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1777  cPieSliceFigure& operator=(const cPieSliceFigure& other);
1779 
1782  virtual cPieSliceFigure *dup() const override {return new cPieSliceFigure(*this);}
1783  virtual std::string str() const override;
1784  virtual void parse(cProperty *property) override;
1785  virtual void moveLocal(double dx, double dy) override;
1786  virtual const char *getRendererClassName() const override {return "PieSliceFigureRenderer";}
1788 
1795  virtual const Rectangle& getBounds() const {return bounds;}
1796 
1801  virtual void setBounds(const Rectangle& bounds);
1802 
1807  virtual void setPosition(const Point& position, Anchor anchor);
1808 
1813  virtual double getStartAngle() const {return startAngle;}
1814 
1819  virtual void setStartAngle(double startAngle);
1820 
1825  virtual double getEndAngle() const {return endAngle;}
1826 
1831  virtual void setEndAngle(double endAngle);
1833 };
1834 
1848 class SIM_API cPolygonFigure : public cAbstractShapeFigure
1849 {
1850  private:
1851  std::vector<Point> points;
1852  bool smooth;
1853  JoinStyle joinStyle;
1854  FillRule fillRule;
1855  private:
1856  void copy(const cPolygonFigure& other);
1857  void checkIndex(int i) const;
1858  void checkInsIndex(int i) const;
1859  protected:
1860  virtual const char **getAllowedPropertyKeys() const override;
1861  public:
1864  explicit cPolygonFigure(const char *name=nullptr) : cAbstractShapeFigure(name), smooth(false), joinStyle(JOIN_MITER), fillRule(FILL_EVENODD) {}
1865  cPolygonFigure(const cPolygonFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1866  cPolygonFigure& operator=(const cPolygonFigure& other);
1868 
1871  virtual cPolygonFigure *dup() const override {return new cPolygonFigure(*this);}
1872  virtual std::string str() const override;
1873  virtual void parse(cProperty *property) override;
1874  virtual void moveLocal(double dx, double dy) override;
1875  virtual const char *getRendererClassName() const override {return "PolygonFigureRenderer";}
1877 
1883  virtual const std::vector<Point>& getPoints() const {return points;}
1884 
1888  virtual void setPoints(const std::vector<Point>& points);
1889 
1893  virtual int getNumPoints() const {return points.size();}
1894 
1899  virtual const Point& getPoint(int i) const {checkIndex(i); return points[i];}
1900 
1904  virtual void setPoint(int i, const Point& point);
1905 
1909  virtual void addPoint(const Point& point);
1910 
1914  virtual void removePoint(int i);
1915 
1920  virtual void insertPoint(int i, const Point& point);
1921 
1926  virtual bool getSmooth() const {return smooth;}
1927 
1933  virtual void setSmooth(bool smooth);
1935 
1941  virtual JoinStyle getJoinStyle() const {return joinStyle;}
1942 
1947  virtual void setJoinStyle(JoinStyle joinStyle);
1948 
1955  virtual FillRule getFillRule() const {return fillRule;}
1956 
1964  virtual void setFillRule(FillRule fillRule);
1966 };
1967 
1984 class SIM_API cPathFigure : public cAbstractShapeFigure
1985 {
1986  public:
1987  struct PathItem { char code; };
1988  struct MoveTo : PathItem { double x; double y; };
1989  struct MoveRel : PathItem { double dx; double dy; };
1990  struct LineTo : PathItem { double x; double y; };
1991  struct LineRel : PathItem { double dx; double dy; };
1992  struct HorizontalLineTo : PathItem { double x; };
1993  struct HorizontalLineRel : PathItem { double dx; };
1994  struct VerticalLineTo : PathItem { double y; };
1995  struct VerticalLineRel : PathItem { double dy; };
1996  struct ArcTo : PathItem { double rx; double ry; double phi; bool largeArc; bool sweep; double x; double y; };
1997  struct ArcRel : PathItem { double rx; double ry; double phi; bool largeArc; bool sweep; double dx; double dy; };
1998  struct CurveTo : PathItem { double x1; double y1; double x; double y; };
1999  struct CurveRel : PathItem { double dx1; double dy1; double dx; double dy; };
2000  struct SmoothCurveTo : PathItem { double x; double y; };
2001  struct SmoothCurveRel : PathItem { double dx; double dy; };
2002  struct CubicBezierCurveTo : PathItem { double x1; double y1; double x2; double y2; double x; double y; };
2003  struct CubicBezierCurveRel : PathItem { double dx1; double dy1; double dx2; double dy2; double dx; double dy; };
2004  struct SmoothCubicBezierCurveTo : PathItem { double x2; double y2; double x; double y; };
2005  struct SmoothCubicBezierCurveRel : PathItem { double dx2; double dy2; double dx; double dy; };
2006  struct ClosePath : PathItem { };
2007 
2008  private:
2009  std::vector<PathItem*> path;
2010  mutable std::string cachedPathString;
2011  JoinStyle joinStyle;
2012  CapStyle capStyle;
2013  Point offset;
2014  FillRule fillRule;
2015 
2016  private:
2017  void copy(const cPathFigure& other);
2018  void addItem(PathItem *item);
2019  void doClearPath();
2020 
2021  protected:
2022  virtual const char **getAllowedPropertyKeys() const override;
2023 
2024  public:
2027  explicit cPathFigure(const char *name=nullptr) : cAbstractShapeFigure(name), joinStyle(JOIN_MITER), capStyle(CAP_BUTT), fillRule(FILL_EVENODD) {}
2028  cPathFigure(const cPathFigure& other) : cAbstractShapeFigure(other) {copy(other);}
2029  virtual ~cPathFigure() {doClearPath();}
2030  cPathFigure& operator=(const cPathFigure& other);
2032 
2035  virtual cPathFigure *dup() const override {return new cPathFigure(*this);}
2036  virtual std::string str() const override;
2037  virtual void parse(cProperty *property) override;
2041  virtual void moveLocal(double dx, double dy) override;
2042  virtual const char *getRendererClassName() const override {return "PathFigureRenderer";}
2044 
2050  virtual JoinStyle getJoinStyle() const {return joinStyle;}
2051 
2056  virtual void setJoinStyle(JoinStyle joinStyle);
2057 
2061  virtual CapStyle getCapStyle() const {return capStyle;}
2062 
2067  virtual void setCapStyle(CapStyle capStyle);
2068 
2075  virtual FillRule getFillRule() const {return fillRule;}
2076 
2085  virtual void setFillRule(FillRule fillRule);
2087 
2095  virtual const Point& getOffset() const {return offset;}
2096 
2104  virtual void setOffset(const Point& offset);
2106 
2112  virtual const char *getPath() const;
2113 
2119  virtual void setPath(const char *path);
2120 
2124  virtual int getNumPathItems() const {return path.size();}
2125 
2131  virtual const PathItem *getPathItem(int k) const {return path[k];}
2132 
2136  virtual void clearPath();
2137 
2144  virtual void addMoveTo(double x, double y); // M x y
2145 
2153  virtual void addMoveRel(double dx, double dy); // m dx dy
2154 
2161  virtual void addLineTo(double x, double y); // L x y
2162 
2169  virtual void addLineRel(double dx, double dy); // l dx dy
2170 
2177  virtual void addHorizontalLineTo(double x); // H x
2178 
2185  virtual void addHorizontalLineRel(double dx); // h dx
2186 
2193  virtual void addVerticalLineTo(double y); // V y
2194 
2201  virtual void addVerticalLineRel(double dy); // v dy
2202 
2217  virtual void addArcTo(double rx, double ry, double phi, bool largeArc, bool sweep, double x, double y); // A rx ry phi largeArc sweep x y
2218 
2234  virtual void addArcRel(double rx, double ry, double phi, bool largeArc, bool sweep, double dx, double dy); // a rx ry phi largeArc sweep dx dy
2235 
2242  virtual void addCurveTo(double x1, double y1, double x, double y); // Q x1 y1 x y
2243 
2251  virtual void addCurveRel(double dx1, double dy1, double dx, double dy); // q dx1 dy1 dx dy
2252 
2264  virtual void addSmoothCurveTo(double x, double y); // T x y
2265 
2277  virtual void addSmoothCurveRel(double dx, double dy); // t dx dy
2278 
2287  virtual void addCubicBezierCurveTo(double x1, double y1, double x2, double y2, double x, double y); // C x1 y1 x2 y2 x y
2288 
2298  virtual void addCubicBezierCurveRel(double dx1, double dy1, double dx2, double dy2, double dx, double dy); // c dx1 dy1 dx2 dy2 dx dy
2299 
2312  virtual void addSmoothCubicBezierCurveTo(double x2, double y2, double x, double y); // S x2 y2 x y
2313 
2326  virtual void addSmoothCubicBezierCurveRel(double dx2, double dy2, double dx, double dy); // s dx2 dy2 dx dy
2327 
2335  virtual void addClosePath(); // Z
2337 };
2338 
2356 class SIM_API cAbstractTextFigure : public cFigure
2357 {
2358  private:
2359  Point position;
2360  Color color; // note: tkpath's text supports separate colors and opacity for fill and outline -- ignore because probably SWT doesn't support it!
2361  double opacity;
2362  bool halo;
2363  Font font;
2364  std::string text;
2365  Anchor anchor;
2366  private:
2367  void copy(const cAbstractTextFigure& other);
2368  protected:
2369  virtual const char **getAllowedPropertyKeys() const override;
2370  public:
2373  explicit cAbstractTextFigure(const char *name=nullptr) : cFigure(name), color(BLACK), opacity(1), halo(false), anchor(ANCHOR_NW) {}
2374  cAbstractTextFigure(const cAbstractTextFigure& other) : cFigure(other) {copy(other);}
2375  cAbstractTextFigure& operator=(const cAbstractTextFigure& other);
2377 
2380  virtual cAbstractTextFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
2381  virtual std::string str() const override;
2382  virtual void parse(cProperty *property) override;
2386  virtual void moveLocal(double dx, double dy) override;
2388 
2396  virtual const Point& getPosition() const {return position;}
2397 
2403  virtual void setPosition(const Point& position);
2404 
2410  virtual Anchor getAnchor() const {return anchor;}
2411 
2417  virtual void setAnchor(Anchor anchor);
2418 
2433  virtual Rectangle getBounds() const;
2435 
2441  virtual const Color& getColor() const {return color;}
2442 
2446  virtual void setColor(const Color& color);
2447 
2451  virtual double getOpacity() const {return opacity;}
2452 
2457  virtual void setOpacity(double opacity);
2458 
2462  virtual bool getHalo() const {return halo;}
2463 
2475  virtual void setHalo(bool enabled);
2476 
2480  virtual const Font& getFont() const {return font;}
2481 
2487  virtual void setFont(Font font);
2489 
2495  virtual const char *getText() const {return text.c_str();}
2496 
2501  virtual void setText(const char* text);
2503 };
2504 
2513 class SIM_API cTextFigure : public cAbstractTextFigure
2514 {
2515  private:
2516  void copy(const cTextFigure& other) {}
2517  public:
2520  explicit cTextFigure(const char *name=nullptr) : cAbstractTextFigure(name) {}
2521  cTextFigure(const cTextFigure& other) : cAbstractTextFigure(other) {copy(other);}
2522  cTextFigure& operator=(const cTextFigure& other);
2524 
2527  virtual cTextFigure *dup() const override {return new cTextFigure(*this);}
2528  virtual const char *getRendererClassName() const override {return "TextFigureRenderer";}
2530 };
2531 
2541 class SIM_API cLabelFigure : public cAbstractTextFigure
2542 {
2543  private:
2544  double angle = 0.0; // in radians, positive is CCW, 0 is "horizontal" or "unrotated"
2545  private:
2546  void copy(const cLabelFigure& other);
2547  protected:
2548  virtual const char **getAllowedPropertyKeys() const override;
2549  public:
2552  explicit cLabelFigure(const char *name=nullptr) : cAbstractTextFigure(name) {}
2553  cLabelFigure(const cLabelFigure& other) : cAbstractTextFigure(other) {copy(other);}
2554  cLabelFigure& operator=(const cLabelFigure& other);
2556 
2559  virtual cLabelFigure *dup() const override {return new cLabelFigure(*this);}
2560  virtual void parse(cProperty *property) override;
2561  virtual const char *getRendererClassName() const override {return "LabelFigureRenderer";}
2563 
2566  virtual double getAngle() const {return angle;}
2567  virtual void setAngle(double angle);
2569 };
2570 
2596 class SIM_API cAbstractImageFigure : public cFigure
2597 {
2598  private:
2599  Point position;
2600  Anchor anchor; // note: do not use the ANCHOR_BASELINE_START/MIDDLE/END constants, as they are for text items
2601  double width, height; // zero or negative values mean using the image's own size
2602  Interpolation interpolation;
2603  double opacity;
2604  Color tintColor;
2605  double tintAmount; // in the range 0..1
2606  private:
2607  void copy(const cAbstractImageFigure& other);
2608  protected:
2609  virtual const char **getAllowedPropertyKeys() const override;
2610  virtual Point getDefaultSize() const = 0;
2611  public:
2614  explicit cAbstractImageFigure(const char *name=nullptr) : cFigure(name), anchor(ANCHOR_CENTER), width(0), height(0), interpolation(INTERPOLATION_FAST), opacity(1), tintColor(BLUE), tintAmount(0) { }
2615  cAbstractImageFigure(const cAbstractImageFigure& other) : cFigure(other) {copy(other);}
2616  cAbstractImageFigure& operator=(const cAbstractImageFigure& other);
2618 
2621  virtual cAbstractImageFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
2622  virtual void parse(cProperty *property) override;
2626  virtual void moveLocal(double dx, double dy) override;
2628 
2636  virtual const Point& getPosition() const {return position;}
2637 
2643  virtual void setPosition(const Point& position);
2644 
2650  virtual Anchor getAnchor() const {return anchor;}
2651 
2657  virtual void setAnchor(Anchor anchor);
2658 
2663  virtual double getWidth() const {return width;}
2664 
2671  virtual void setWidth(double width);
2672 
2677  virtual double getHeight() const {return height;}
2678 
2685  virtual void setHeight(double height); // zero means "unset"
2686 
2691  virtual void setSize(double width, double height) {setWidth(width); setHeight(height);}
2692 
2704  virtual Rectangle getBounds() const;
2706 
2714  virtual Interpolation getInterpolation() const {return interpolation;}
2715 
2721  virtual void setInterpolation(Interpolation interpolation);
2722 
2726  virtual double getOpacity() const {return opacity;}
2727 
2732  virtual void setOpacity(double opacity);
2733 
2737  virtual const Color& getTintColor() const {return tintColor;}
2738 
2746  virtual void setTintColor(const Color& tintColor);
2747 
2752  virtual double getTintAmount() const {return tintAmount;}
2753 
2762  virtual void setTintAmount(double tintAmount);
2764 };
2765 
2775 class SIM_API cImageFigure : public cAbstractImageFigure
2776 {
2777  private:
2778  std::string imageName;
2779  private:
2780  void copy(const cImageFigure& other);
2781  protected:
2782  virtual const char **getAllowedPropertyKeys() const override;
2783  virtual Point getDefaultSize() const override;
2784  public:
2787  explicit cImageFigure(const char *name=nullptr) : cAbstractImageFigure(name) {}
2788  cImageFigure(const cImageFigure& other) : cAbstractImageFigure(other) {copy(other);}
2789  cImageFigure& operator=(const cImageFigure& other);
2791 
2794  virtual cImageFigure *dup() const override {return new cImageFigure(*this);}
2795  virtual std::string str() const override;
2796  virtual void parse(cProperty *property) override;
2797  virtual const char *getRendererClassName() const override {return "ImageFigureRenderer";}
2799 
2805  virtual const char *getImageName() const {return imageName.c_str();}
2806 
2813  virtual void setImageName(const char* imageName);
2814 
2825  virtual int getImageNaturalWidth() const {return getDefaultSize().x;}
2826 
2837  virtual int getImageNaturalHeight() const {return getDefaultSize().y;}
2839 };
2840 
2851 class SIM_API cIconFigure : public cImageFigure
2852 {
2853  private:
2854  void copy(const cIconFigure& other) {}
2855  public:
2858  explicit cIconFigure(const char *name=nullptr) : cImageFigure(name) {}
2859  cIconFigure(const cIconFigure& other) : cImageFigure(other) {copy(other);}
2860  cIconFigure& operator=(const cIconFigure& other);
2862 
2865  virtual cIconFigure *dup() const override {return new cIconFigure(*this);}
2866  virtual const char *getRendererClassName() const override {return "IconFigureRenderer";}
2868 };
2869 
2879 class SIM_API cPixmapFigure : public cAbstractImageFigure
2880 {
2881  private:
2882  Pixmap pixmap;
2883  private:
2884  void copy(const cPixmapFigure& other);
2885  protected:
2886  virtual const char **getAllowedPropertyKeys() const override;
2887  virtual Point getDefaultSize() const override;
2888  public:
2891  explicit cPixmapFigure(const char *name=nullptr) : cAbstractImageFigure(name) {}
2892  cPixmapFigure(const cPixmapFigure& other) : cAbstractImageFigure(other) {copy(other);}
2893  virtual ~cPixmapFigure() {}
2894  cPixmapFigure& operator=(const cPixmapFigure& other);
2896 
2899  virtual cPixmapFigure *dup() const override {return new cPixmapFigure(*this);}
2900  virtual std::string str() const override;
2901  virtual void parse(cProperty *property) override;
2902  virtual const char *getRendererClassName() const override {return "PixmapFigureRenderer";}
2904 
2914  virtual const Pixmap& getPixmap() const {return pixmap;}
2915 
2920  virtual void setPixmap(const Pixmap& pixmap);
2921 
2923  virtual int getPixmapHeight() const {return pixmap.getHeight();}
2925  virtual int getPixmapWidth() const {return pixmap.getWidth();}
2927  virtual void setPixmapSize(int width, int height, const RGBA& fill); // nondestructive, set *newly added* pixels with this color and opacity
2929  virtual void setPixmapSize(int width, int height, const Color& color, double opacity); // nondestructive, fills *newly added* pixels with this color and opacity
2931  virtual void fillPixmap(const RGBA& fill);
2933  virtual void fillPixmap(const Color& color, double opacity);
2935  virtual const RGBA getPixel(int x, int y) const {return pixmap.pixel(x, y);}
2937  virtual void setPixel(int x, int y, const RGBA& argb);
2939  virtual void setPixel(int x, int y, const Color& color, double opacity = 1.0);
2941  virtual const Color getPixelColor(int x, int y) const {return pixmap.getColor(x,y);}
2943  virtual void setPixelColor(int x, int y, const Color& color);
2945  virtual double getPixelOpacity(int x, int y) const {return pixmap.getOpacity(x,y);}
2947  virtual void setPixelOpacity(int x, int y, double opacity);
2949 };
2950 
2969 class SIM_API cCanvas : public cOwnedObject
2970 {
2971  private:
2972  cFigure::Color backgroundColor;
2973  cFigure *rootFigure;
2974  std::map<std::string,int> tagBitIndex; // tag-to-bitindex
2975  static std::map<std::string,cObjectFactory*> figureFactories;
2976  std::map<const cObject*,double> animationSpeedMap; // maps source to animationSpeed
2977  double minAnimationSpeed; // minimum of the values in animationSpeedMap cached, or DBL_MAX for none
2978  double animationHoldEndTime; // the effective one will be the maximum endTime of all visible canvases
2979  public:
2980  // internal:
2981  virtual cFigure *parseFigure(cProperty *property) const;
2982  virtual cFigure *createFigure(const char *type) const;
2983  static bool containsCanvasItems(cProperties *properties);
2984  virtual void addFiguresFrom(cProperties *properties);
2985  virtual uint64_t parseTags(const char *s);
2986  virtual std::string getTags(uint64_t tagBits);
2987  const std::map<const cObject*,double>& getAnimationSpeedMap() const {return animationSpeedMap;} // for e.g. Qtenv
2988  double getMinAnimationSpeed() const {return minAnimationSpeed;} // for e.g. Qtenv; DBL_MAX if none
2989  double getAnimationHoldEndTime() const {return animationHoldEndTime;} // for e.g. Qtenv
2990  private:
2991  void copy(const cCanvas& other);
2992  public:
2995  explicit cCanvas(const char *name = nullptr);
2996  cCanvas(const cCanvas& other) : cOwnedObject(other), rootFigure(nullptr) {copy(other);}
2997  virtual ~cCanvas();
2998  cCanvas& operator=(const cCanvas& other);
3000 
3003  virtual cCanvas *dup() const override {return new cCanvas(*this);}
3004  virtual void forEachChild(cVisitor *v) override;
3005  virtual std::string str() const override;
3007 
3013  virtual const cFigure::Color& getBackgroundColor() const {return backgroundColor;}
3014 
3018  virtual void setBackgroundColor(const cFigure::Color& color) {this->backgroundColor = color;}
3020 
3027  virtual cFigure *getRootFigure() const {return rootFigure;}
3028 
3032  virtual void addFigure(cFigure *figure) {rootFigure->addFigure(figure);}
3033 
3040  virtual void addFigure(cFigure *figure, int pos) {rootFigure->addFigure(figure, pos);}
3041 
3045  _OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure) {figure->insertAbove(referenceFigure);}
3046 
3050  _OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure) {figure->insertBelow(referenceFigure);}
3051 
3056  virtual cFigure *removeFigure(cFigure *figure) {return rootFigure->removeFigure(figure);}
3057 
3062  virtual cFigure *removeFigure(int pos) {return rootFigure->removeFigure(pos);}
3063 
3069  virtual int findFigure(const char *name) const {return rootFigure->findFigure(name);}
3070 
3075  virtual int findFigure(cFigure *figure) const {return rootFigure->findFigure(figure);}
3076 
3081  virtual bool hasFigures() const {return rootFigure->containsFigures();}
3082 
3086  virtual int getNumFigures() const {return rootFigure->getNumFigures();}
3087 
3093  virtual cFigure *getFigure(int pos) const {return rootFigure->getFigure(pos);}
3094 
3099  virtual cFigure *getFigure(const char *name) const {return rootFigure->getFigure(name);}
3101 
3111  virtual cFigure *getSubmodulesLayer() const;
3112 
3117  virtual cFigure *findFigureRecursively(const char *name) const {return rootFigure->findFigureRecursively(name);}
3118 
3123  virtual cFigure *getFigureByPath(const char *path) const {return rootFigure->getFigureByPath(path);}
3125 
3132  virtual std::string getAllTags() const;
3133 
3138  virtual std::vector<std::string> getAllTagsAsVector() const;
3140 
3158  virtual void setAnimationSpeed(double animationSpeed, const cObject *source);
3159 
3164  virtual double getAnimationSpeed(const cObject *source);
3165 
3184  virtual void holdSimulationFor(double animationTimeDelta);
3186 };
3187 
3188 } // namespace omnetpp
3189 
3190 
3191 #endif
3192 
Arrowhead
Arrowhead style constants: ARROW_NONE, ARROW_SIMPLE, etc.
Definition: ccanvas.h:189
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2528
virtual int getNumPoints() const
Definition: ccanvas.h:1893
virtual LineStyle getLineStyle() const
Definition: ccanvas.h:1028
virtual cAbstractTextFigure * dup() const override
Definition: ccanvas.h:2380
virtual double getStartAngle() const
Definition: ccanvas.h:1813
Represents the "q" path command with parameters.
Definition: ccanvas.h:1999
virtual cFigure * getParentFigure() const
Definition: ccanvas.h:546
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1795
Thrown when the simulation kernel or other components detect a runtime error.
Definition: cexception.h:283
virtual const Point & getPosition() const
Definition: ccanvas.h:2636
A figure that displays a ring, with explicitly controllable inner/outer radii.
Definition: ccanvas.h:1663
A figure that displays a line that consists of multiple connecting straight line segments or of a sin...
Definition: ccanvas.h:1249
CapStyle
Line cap style constants: CAP_BUTT, CAP_SQUARE, etc.
Definition: ccanvas.h:180
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
virtual const Point & getPosition() const
Definition: ccanvas.h:2396
virtual cObject * getAssociatedObject() const
Definition: ccanvas.h:517
virtual bool getZoomLineWidth() const
Definition: ccanvas.h:1073
virtual const Point & getPoint(int i) const
Definition: ccanvas.h:1899
A figure that displays an image that can be manipulated programmatically.
Definition: ccanvas.h:2879
virtual double getOpacity() const
Definition: ccanvas.h:2451
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:877
Represents the "M" path command with parameters.
Definition: ccanvas.h:1988
std::string typeface
Typeface of the font. An empty string means the default font.
Definition: ccanvas.h:160
virtual int getNumPathItems() const
Definition: ccanvas.h:2124
FontStyle
Font style constants: FONT_NONE, FONT_BOLD, etc.
Definition: ccanvas.h:174
virtual cFigure * getFigureByPath(const char *path) const
Definition: ccanvas.h:3123
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1548
A figure that displays an image, typically an icon or a background image, loaded from the OMNeT++ ima...
Definition: ccanvas.h:2775
virtual void moveLocal(double dx, double dy) override
Definition: ccanvas.h:920
virtual const Font & getFont() const
Definition: ccanvas.h:2480
A rectangular RGBA pixel array.
Definition: ccanvas.h:270
Represents the "V" path command with parameters.
Definition: ccanvas.h:1994
virtual Arrowhead getEndArrowhead() const
Definition: ccanvas.h:1061
virtual const Point & getPoint(int i) const
Definition: ccanvas.h:1299
virtual cArcFigure * dup() const override
Definition: ccanvas.h:1179
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1114
Interpolation
Image interpolation mode constants: INTERPOLATION_NONE, INTERPOLATION_FAST, etc.
Definition: ccanvas.h:192
virtual const char * getTooltip() const
Definition: ccanvas.h:501
A figure that draws a circle or ellipse.
Definition: ccanvas.h:1608
virtual CapStyle getCapStyle() const
Definition: ccanvas.h:1039
virtual cPolylineFigure * dup() const override
Definition: ccanvas.h:1271
Represents an RGB color.
Definition: ccanvas.h:120
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1786
Represents an RGBA pixel, for Pixmap manipulation.
Definition: ccanvas.h:248
Homogeneous 2D transformation matrix.
Definition: ccanvas.h:211
Abstract base class for figures that display text. Text may be multi-line.
Definition: ccanvas.h:2356
Represents the "s" path command with parameters.
Definition: ccanvas.h:2005
virtual double getOpacity() const
Definition: ccanvas.h:2726
Represents an item in a cPathFigure path.
Definition: ccanvas.h:1987
Sets up an axis-aligned, unscaled coordinate system for children, canceling the effect of any transfo...
Definition: ccanvas.h:895
virtual cPathFigure * dup() const override
Definition: ccanvas.h:2035
virtual double getFillOpacity() const
Definition: ccanvas.h:1493
virtual const Color & getTintColor() const
Definition: ccanvas.h:2737
virtual double getStartAngle() const
Definition: ccanvas.h:1210
virtual cLabelFigure * dup() const override
Definition: ccanvas.h:2559
virtual int getImageNaturalHeight() const
Definition: ccanvas.h:2837
virtual double getLineOpacity() const
Definition: ccanvas.h:1017
virtual bool getHalo() const
Definition: ccanvas.h:2462
virtual double getWidth() const
Definition: ccanvas.h:2663
virtual cFigure * removeFigure(int pos)
Definition: ccanvas.h:3062
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2866
virtual cCanvas * dup() const override
Definition: ccanvas.h:3003
virtual double getEndAngle() const
Definition: ccanvas.h:1222
virtual bool isVisible() const
Definition: ccanvas.h:443
Represents a point as (x,y) coordinates.
Definition: ccanvas.h:64
virtual cFigure * getRootFigure() const
Definition: ccanvas.h:3027
virtual const Color & getLineColor() const
Definition: ccanvas.h:993
int getId() const
Definition: ccanvas.h:438
virtual void refreshDisplay()
Definition: ccanvas.h:826
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1183
virtual double getTintAmount() const
Definition: ccanvas.h:2752
virtual int getPixmapHeight() const
Definition: ccanvas.h:2923
virtual double getInnerRy() const
Definition: ccanvas.h:1727
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:917
Represents the "v" path command with parameters.
Definition: ccanvas.h:1995
virtual const Pixmap & getPixmap() const
Definition: ccanvas.h:2914
Represents the "Z" path command.
Definition: ccanvas.h:2006
Abstract base class for various shapes.
Definition: ccanvas.h:1374
virtual int getNumFigures() const
Definition: ccanvas.h:558
FillRule
Fill rule constants: FILL_EVENODD, FILL_NONZERO.
Definition: ccanvas.h:186
virtual const char * getText() const
Definition: ccanvas.h:2495
A figure that displays a pie slice, that is, a section of an axis-aligned disc or filled ellipse...
Definition: ccanvas.h:1763
virtual const std::vector< Point > & getPoints() const
Definition: ccanvas.h:1883
virtual bool isFilled() const
Definition: ccanvas.h:1410
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2042
virtual double getCornerRy() const
Definition: ccanvas.h:1589
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2797
virtual cRectangleFigure * dup() const override
Definition: ccanvas.h:1544
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1875
virtual const Color & getColor() const
Definition: ccanvas.h:2441
virtual double getLineOpacity() const
Definition: ccanvas.h:1481
virtual void move(double dx, double dy) override
Definition: ccanvas.h:919
virtual const Color getPixelColor(int x, int y) const
Definition: ccanvas.h:2941
A figure that displays an image, typically an icon or a background image, loaded from the OMNeT++ ima...
Definition: ccanvas.h:2851
virtual const char * getImageName() const
Definition: ccanvas.h:2805
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:2969
cFigure(const cFigure &other)
Definition: ccanvas.h:396
Stores a (NED) property with its (possibly compound) value.
Definition: cproperty.h:38
int pointSize
Font size in points. A zero or negative value means the default size.
Definition: ccanvas.h:161
virtual cFigure * findFigureRecursively(const char *name) const
Represents the "C" path command with parameters.
Definition: ccanvas.h:2002
virtual int findFigure(cFigure *figure) const
Definition: ccanvas.h:3075
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:1941
virtual double getInnerRx() const
Definition: ccanvas.h:1717
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:104
virtual double getEndAngle() const
Definition: ccanvas.h:1825
Represents the "Q" path command with parameters.
Definition: ccanvas.h:1998
virtual double getLineWidth() const
Definition: ccanvas.h:1468
virtual int findFigure(const char *name) const
Represents the "H" path command with parameters.
Definition: ccanvas.h:1992
virtual cOvalFigure * dup() const override
Definition: ccanvas.h:1626
virtual const RGBA getPixel(int x, int y) const
Definition: ccanvas.h:2935
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:1344
Represents the "S" path command with parameters.
Definition: ccanvas.h:2004
virtual bool getZoomLineWidth() const
Definition: ccanvas.h:1505
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2561
virtual cFigure * getFigure(int pos) const
virtual void setInnerRadius(double r)
Definition: ccanvas.h:1712
virtual cRingFigure * dup() const override
Definition: ccanvas.h:1682
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1556
virtual Interpolation getInterpolation() const
Definition: ccanvas.h:2714
virtual const Color & getLineColor() const
Definition: ccanvas.h:1432
virtual int findFigure(const char *name) const
Definition: ccanvas.h:3069
Represents the "T" path command with parameters.
Definition: ccanvas.h:2000
virtual const cFigure::Color & getBackgroundColor() const
Definition: ccanvas.h:3013
virtual double getLineWidth() const
Definition: ccanvas.h:1005
Common base class for line figures.
Definition: ccanvas.h:959
Represents the "t" path command with parameters.
Definition: ccanvas.h:2001
virtual cPieSliceFigure * dup() const override
Definition: ccanvas.h:1782
virtual cPolygonFigure * dup() const override
Definition: ccanvas.h:1871
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1630
virtual void insertBelow(cFigure *referenceFigure)
virtual int getNumFigures() const
Definition: ccanvas.h:3086
virtual Anchor getAnchor() const
Definition: ccanvas.h:2410
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:2050
virtual cGroupFigure * dup() const override
Definition: ccanvas.h:875
virtual cLineFigure * dup() const override
Definition: ccanvas.h:1110
virtual const PathItem * getPathItem(int k) const
Definition: ccanvas.h:2131
A figure that displays an arc.
Definition: ccanvas.h:1160
virtual cFigure * removeFigure(cFigure *figure)
LineStyle
Line style constants: LINE_SOLID, LINE_DOTTED, etc.
Definition: ccanvas.h:177
virtual bool hasFigures() const
Definition: ccanvas.h:3081
virtual const char * getTags() const
Definition: ccanvas.h:531
virtual int getPixmapWidth() const
Definition: ccanvas.h:2925
virtual cPixmapFigure * dup() const override
Definition: ccanvas.h:2899
A figure that displays a straight line segment.
Definition: ccanvas.h:1092
Represents the "A" path command with parameters.
Definition: ccanvas.h:1996
virtual LineStyle getLineStyle() const
Definition: ccanvas.h:1455
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1275
virtual cIconFigure * dup() const override
Definition: ccanvas.h:2865
Represents the "h" path command with parameters.
Definition: ccanvas.h:1993
Definition: cabstracthistogram.h:21
A figure that displays a rectangle, with optionally rounded corners.
Definition: ccanvas.h:1525
virtual void moveLocal(double dx, double dy) override
Definition: ccanvas.h:878
A collection of properties (cProperty).
Definition: cproperties.h:34
virtual cPanelFigure * dup() const override
Definition: ccanvas.h:915
Represents the "m" path command with parameters.
Definition: ccanvas.h:1989
virtual void setSize(double width, double height)
Definition: ccanvas.h:2691
virtual cImageFigure * dup() const override
Definition: ccanvas.h:2794
Represents the "L" path command with parameters.
Definition: ccanvas.h:1990
_OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:635
virtual int getImageNaturalWidth() const
Definition: ccanvas.h:2825
virtual void addFigure(cFigure *figure, int pos)
Definition: ccanvas.h:3040
virtual void insertAbove(cFigure *referenceFigure)
virtual cFigure * getFigure(const char *name) const
Definition: ccanvas.h:3099
virtual bool getSmooth() const
Definition: ccanvas.h:1926
virtual void setCornerRadius(double r)
Definition: ccanvas.h:1573
A figure that displays a "path", a complex shape or line modeled after SVG paths. ...
Definition: ccanvas.h:1984
JoinStyle
Line join style constants: JOIN_BEVEL, JOIN_MITER, etc.
Definition: ccanvas.h:183
virtual cTextFigure * dup() const override
Definition: ccanvas.h:2527
virtual void addFigure(cFigure *figure)
virtual bool getSmooth() const
Definition: ccanvas.h:1328
virtual double getCornerRx() const
Definition: ccanvas.h:1578
_OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3050
virtual FillRule getFillRule() const
Definition: ccanvas.h:1955
Represents a rectangle as an (x,y,width,height) tuple.
Definition: ccanvas.h:90
virtual Arrowhead getStartArrowhead() const
Definition: ccanvas.h:1050
virtual const Transform & getTransform() const
Definition: ccanvas.h:455
_OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3045
virtual const Point & getOffset() const
Definition: ccanvas.h:2095
virtual CapStyle getCapStyle() const
Definition: ccanvas.h:2061
virtual cFigure * dup() const override
Definition: ccanvas.h:418
virtual Anchor getAnchor() const
Definition: ccanvas.h:2650
virtual bool isOutlined() const
Definition: ccanvas.h:1421
virtual cAbstractLineFigure * dup() const override
Definition: ccanvas.h:983
A figure that displays text which is affected by zooming and transformations.
Definition: ccanvas.h:2513
virtual void setBackgroundColor(const cFigure::Color &color)
Definition: ccanvas.h:3018
virtual void addFigure(cFigure *figure)
Definition: ccanvas.h:3032
virtual const Point & getEnd() const
Definition: ccanvas.h:1132
virtual cAbstractShapeFigure * dup() const override
Definition: ccanvas.h:1400
virtual double getZIndex() const
Definition: ccanvas.h:476
Anchor
Anchoring mode constants: ANCHOR_CENTER, ANCHOR_N, etc.
Definition: ccanvas.h:195
virtual cFigure * getFigure(int pos) const
Definition: ccanvas.h:3093
uint8_t style
Font style. Binary OR of FontStyle constants such as FONT_BOLD.
Definition: ccanvas.h:162
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1638
A figure with the sole purpose of grouping its children, and no visual representation.
Definition: ccanvas.h:861
A figure that displays text which is unaffected by zooming or transformations, except for its positio...
Definition: ccanvas.h:2541
virtual const Point & getAnchorPoint() const
Definition: ccanvas.h:937
virtual cFigure * findFigureRecursively(const char *name) const
Definition: ccanvas.h:3117
Abstract base class for figures that display an image.
Definition: ccanvas.h:2596
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1192
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1686
virtual double getHeight() const
Definition: ccanvas.h:2677
virtual const std::vector< Point > & getPoints() const
Definition: ccanvas.h:1283
virtual double getPixelOpacity(int x, int y) const
Definition: ccanvas.h:2945
A figure that displays a (closed) polygon, determined by a sequence of points.
Definition: ccanvas.h:1848
Represents the "c" path command with parameters.
Definition: ccanvas.h:2003
A lightweight graphical object for cCanvas.
Definition: ccanvas.h:57
virtual int getNumPoints() const
Definition: ccanvas.h:1293
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1694
Represents the "a" path command with parameters.
Definition: ccanvas.h:1997
virtual FillRule getFillRule() const
Definition: ccanvas.h:2075
virtual cFigure * getFigureByPath(const char *path) const
_OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:640
virtual const Point & getStart() const
Definition: ccanvas.h:1122
virtual cFigure * removeFigure(cFigure *figure)
Definition: ccanvas.h:3056
virtual cAbstractImageFigure * dup() const override
Definition: ccanvas.h:2621
virtual const Color & getFillColor() const
Definition: ccanvas.h:1443
virtual void resetTransform()
Definition: ccanvas.h:469
virtual bool containsFigures() const
Definition: ccanvas.h:588
Represents the "l" path command with parameters.
Definition: ccanvas.h:1991
Represents properties of a font.
Definition: ccanvas.h:157
Reference-counted storage for strings.
Definition: cstringpool.h:36
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2902