OMNeT++ Simulation Library  6.0.3
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 <cmath>
23 #include "cownedobject.h"
24 #include "opp_pooledstring.h"
25 
26 namespace omnetpp {
27 
28 class cCanvas;
29 class cProperty;
30 class cProperties;
31 class cObjectFactory;
32 class cHasher;
33 
34 //TODO: doc: default values as precise enum names
35 //TODO: doc: @figure attributes for each figure type
36 //TODO: doc: revise class descriptions
37 
60 class SIM_API cFigure : public cOwnedObject
61 {
62  public:
67  struct SIM_API Point {
70  double x = 0, y = 0;
72 
74  Point() {}
75  Point(double x, double y) : x(x), y(y) {}
76  Point operator + (const Point& p) const;
77  Point operator - (const Point& p) const;
78  Point operator * (double s) const;
79  Point operator / (double s) const;
80  double operator * (const Point& p) const;
81  double distanceTo(const Point& p) const;
82  double getLength() const;
83  double getAngle() const {return std::atan2(y,x);}
84  Point& translate(double dx, double dy) {x += dx; y += dy; return *this;}
85  bool operator==(const Point& other) const {return x == other.x && y == other.y;}
86  std::string str() const;
88  };
89 
94  struct SIM_API Rectangle {
97  double x = 0, y = 0, width = 0, height = 0;
99 
101  Rectangle() {}
102  Rectangle(double x, double y, double width, double height) : x(x), y(y), width(width), height(height) {}
103  Point getCenter() const;
104  Point getSize() const;
105  Rectangle& translate(double dx, double dy) {x += dx; y += dy; return *this;}
106  bool operator==(const Rectangle& other) const {return x == other.x && y == other.y && width == other.width && height == other.height;}
107  std::string str() const;
109  };
110 
124  struct SIM_API Color {
127  uint8_t red = 0, green = 0, blue = 0;
129 
131  Color() {}
132  Color(uint8_t red, uint8_t green, uint8_t blue) : red(red), green(green), blue(blue) {}
133  Color(const char *color) {*this = parseColor(color);}
134  Color(const Color& other) = default;
135  bool operator==(const Color& other) const {return red == other.red && green == other.green && blue == other.blue;}
136  std::string str() const;
138  };
139 
142  static const Color BLACK;
143  static const Color WHITE;
144  static const Color GREY;
145  static const Color RED;
146  static const Color GREEN;
147  static const Color BLUE;
148  static const Color YELLOW;
149  static const Color CYAN;
150  static const Color MAGENTA;
151 
152  static const int NUM_GOOD_DARK_COLORS;
153  static const int NUM_GOOD_LIGHT_COLORS;
154  static const Color GOOD_DARK_COLORS[14];
155  static const Color GOOD_LIGHT_COLORS[10];
157 
162  struct SIM_API Font {
165  std::string typeface;
166  int pointSize = 0;
167  uint8_t style = FONT_NONE;
168 
169 
171  Font() {}
172  Font(std::string typeface, int pointSize=-1, uint8_t style=FONT_NONE) : typeface(typeface), pointSize(pointSize), style(style) {}
173  Font(const Font& other) = default;
174  bool operator==(const Font& other) const {return typeface == other.typeface && pointSize == other.pointSize && style == other.style;}
175  std::string str() const;
177  };
178 
180  enum FontStyle { FONT_NONE=0, FONT_BOLD=1, FONT_ITALIC=2, FONT_UNDERLINE=4 };
181 
183  enum LineStyle { LINE_SOLID, LINE_DOTTED, LINE_DASHED };
184 
186  enum CapStyle { CAP_BUTT, CAP_SQUARE, CAP_ROUND };
187 
189  enum JoinStyle { JOIN_BEVEL, JOIN_MITER, JOIN_ROUND };
190 
192  enum FillRule { FILL_EVENODD, FILL_NONZERO };
193 
195  enum Arrowhead { ARROW_NONE, ARROW_SIMPLE, ARROW_TRIANGLE, ARROW_BARBED };
196 
198  enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_FAST, INTERPOLATION_BEST };
199 
201  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 };
202 
204  enum Alignment { ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER };
205 
218  struct SIM_API Transform {
221  double a = 1, b = 0, c = 0, d = 1, t1 = 0, t2 = 0;
223 
226  Transform() {}
227  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) {}
228  Transform(const Transform& t) = default;
229  Transform& operator=(const Transform& t) = default;
230  Transform& translate(double dx, double dy);
231  Transform& translate(const Point& p) {return translate(p.x, p.y);}
232  Transform& scale(double s) {return scale(s,s);}
233  Transform& scale(double sx, double sy);
234  Transform& scale(double sx, double sy, double cx, double cy);
235  Transform& scale(double sx, double sy, const Point& c) {return scale(sx, sy, c.x, c.y);}
236  Transform& rotate(double phi);
237  Transform& rotate(double phi, double cx, double cy);
238  Transform& rotate(double phi, const Point& c) {return rotate(phi, c.x, c.y);}
239  Transform& skewx(double coeff); // note: if you want to skew by an angle, use coeff = tan(phi)
240  Transform& skewy(double coeff);
241  Transform& skewx(double coeff, double cy);
242  Transform& skewy(double coeff, double cx);
243  Transform& multiply(const Transform& t); // left-multiply: *this = t * (*this)
244  Transform& rightMultiply(const Transform& t); // *this = (*this) * t
245  Point applyTo(const Point& p) const;
246  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;}
247  std::string str() const;
249  };
250 
255  struct SIM_API RGBA {
258  uint8_t red = 0, green = 0, blue = 0, alpha = 0;
260 
262  RGBA() {}
263  RGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) : red(red), green(green), blue(blue), alpha(alpha) {}
264  explicit RGBA(const Color& color, double opacity=1) : red(color.red), green(color.green), blue(color.blue), alpha(toAlpha(opacity)) {}
265  RGBA(const RGBA& other) = default;
266  void set(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {red=r; green=g; blue=b; alpha=a;}
267  void operator=(const Color& color) {red = color.red; green = color.green; blue = color.blue; alpha = 255;}
268  operator Color() const {return Color(red, green, blue);}
269  bool operator==(const RGBA& o) const {return red == o.red && green == o.green && blue == o.blue && alpha == o.alpha;}
270  static uint8_t toAlpha(double opacity) {return opacity<=0 ? 0 : opacity>=1.0 ? 255 : (uint8_t)(opacity*255+0.5);}
271  std::string str() const;
273  };
274 
280  class SIM_API Pixmap {
281  private:
282  int width = 0, height = 0; // zero is allowed
283  RGBA *data = nullptr;
284  private:
285  void allocate(int width, int height);
286  public:
289  Pixmap() {}
290  Pixmap(int width, int height, const RGBA& fill=RGBA(BLACK,0));
291  Pixmap(int width, int height, const Color& color, double opacity=1) : Pixmap(width, height, RGBA(color, opacity)) {}
292  Pixmap(const Pixmap& other);
293  ~Pixmap();
294  Pixmap& operator=(const Pixmap& other);
295  void setSize(int width, int height, const RGBA& fill_); // nondestructive
296  void setSize(int width, int height, const Color& color, double opacity); // nondestructive
297  void fill(const RGBA& fill_);
298  void fill(const Color& color, double opacity);
299  int getWidth() const {return width;}
300  int getHeight() const {return height;}
301  RGBA& pixel(int x, int y);
302  const RGBA pixel(int x, int y) const {return const_cast<Pixmap*>(this)->pixel(x,y);}
303  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, RGBA::toAlpha(opacity));}
304  const Color getColor(int x, int y) const {return (Color)pixel(x,y);}
305  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;}
306  double getOpacity(int x, int y) const {return pixel(x,y).alpha / 255.0;}
307  void setOpacity(int x, int y, double opacity) {pixel(x,y).alpha = RGBA::toAlpha(opacity);}
308  const uint8_t *buffer() const {return (uint8_t*)data;} // direct access for low-level manipulation
309  std::string str() const;
311  };
312 
313  // internal:
314  enum {
315  CHANGE_STRUCTURAL = 1, // child added, removed, or reordered, shown/hidden
316  CHANGE_TRANSFORM = 2, // transform change
317  CHANGE_GEOMETRY = 4, // geometry information (bounds, position, start/end angle, etc)
318  CHANGE_VISUAL = 8, // styling
319  CHANGE_INPUTDATA = 16, // text, image name or pixmap data, value to be displayed, etc
320  CHANGE_TAGS = 32, // figure tags
321  CHANGE_ZINDEX = 64, // zIndex
322  CHANGE_OTHER = 128 // tooltip, associated object
323  };
324 
325  private:
326  static int lastId;
327  int id;
328  bool visible = true; // treated as structural change, for simpler handling
329  bool hasTooltip = false;
330  double zIndex = 0;
331  opp_pooledstring tooltip;
332  cObject *associatedObject = nullptr;
333  Transform transform;
334  std::vector<cFigure*> children;
335  opp_pooledstring tags;
336  uint64_t tagBits = 0; // bit-to-tagname mapping is stored in cCanvas. Note: change to std::bitset if 64 tags are not enough
337  uint8_t localChanges = 0;
338  uint8_t subtreeChanges = 0;
339  mutable bool cachedHashValid = false; // separate flag needed because zero hash is also a valid value
340  mutable uint32_t cachedHash = 0;
341 
342  protected:
343  // internal:
344  virtual void validatePropertyKeys(cProperty *property) const; // relies on isAllowedPropertyKey()
345  virtual bool isAllowedPropertyKey(const char *key) const; // allows "x-*" keys, plus the ones returned by getAllowedPropertyKeys()
346  virtual cFigure *getRootFigure() const;
347  void fireStructuralChange() {fire(CHANGE_STRUCTURAL);}
348  void fireTransformChange() {fire(CHANGE_TRANSFORM);}
349  void fireGeometryChange() {fire(CHANGE_GEOMETRY);}
350  void fireVisualChange() {fire(CHANGE_VISUAL);}
351  void fireInputDataChange() {fire(CHANGE_INPUTDATA);}
352  virtual void fire(uint8_t flags);
353  virtual void hashTo(cHasher& hasher) const;
354 
355  protected:
356  // helpers for parse(cProperty*)
357  static Point parsePoint(cProperty *property, const char *key, int index);
358  static std::vector<Point> parsePoints(cProperty *property, const char *key);
359  static Rectangle parseBounds(cProperty *property, const Rectangle& defaults);
360  static Transform parseTransform(cProperty *property, const char *key);
361  static Font parseFont(cProperty *property, const char *key);
362  static Rectangle computeBoundingBox(const Point& position, const Point& size, double ascent, Anchor anchor);
363  static void concatArrays(const char **dest, const char **first, const char **second); // concatenates nullptr-terminated arrays
364 
365  public:
366  // helpers for class descriptors and parse(cProperty*)
367  static Point parsePoint(const char *s); // parse Point::str() format
368  static Rectangle parseRectangle(const char *s); // parse Rectangle::str() format
369  static Transform parseTransform(const char *s); // parse Transform::str() format
370  static Font parseFont(const char *s); // parse Font::str() format
371  static Color parseColor(const char *s);
372  static bool parseBool(const char *s);
373  static LineStyle parseLineStyle(const char *s);
374  static CapStyle parseCapStyle(const char *s);
375  static JoinStyle parseJoinStyle(const char *s);
376  static FillRule parseFillRule(const char *s);
377  static Arrowhead parseArrowhead(const char *s);
378  static Interpolation parseInterpolation(const char *s);
379  static Anchor parseAnchor(const char *s);
380  static Alignment parseAlignment(const char *s);
381 
382  public:
383  // internal, mostly used by runtime GUIs:
384  virtual void updateParentTransform(Transform& transform) {transform.rightMultiply(getTransform());}
385  virtual void callRefreshDisplay(); // call refreshDisplay(), and recurse to its children
386  uint8_t getLocalChangeFlags() const {return localChanges;}
387  uint8_t getSubtreeChangeFlags() const {return subtreeChanges;}
388  void clearChangeFlags();
389  void refreshTagBitsRec(cCanvas *ownerCanvas);
390  int64_t getTagBits() const {return tagBits;}
391  void setTagBits(uint64_t tagBits) {this->tagBits = tagBits;}
392  uint32_t getHash() const;
393  void clearCachedHash(); // for debugging
394 
395  private:
396  void copy(const cFigure& other);
397 
398  public:
404  explicit cFigure(const char *name=nullptr);
405 
409  cFigure(const cFigure& other) : cOwnedObject(other) {copy(other);}
410 
414  virtual ~cFigure();
415 
421  cFigure& operator=(const cFigure& other);
423 
431  virtual cFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
432 
437  virtual void forEachChild(cVisitor *v) override;
438 
442  virtual std::string str() const override;
444 
451  int getId() const {return id;}
452 
456  virtual bool isVisible() const {return visible;}
457 
463  virtual void setVisible(bool visible);
464 
468  virtual const Transform& getTransform() const {return transform;}
469 
476  virtual void setTransform(const Transform& transform);
477 
482  virtual void resetTransform() {setTransform(Transform());}
483 
489  virtual double getZIndex() const {return zIndex;}
490 
501  virtual void setZIndex(double zIndex);
502 
509  virtual double getEffectiveZIndex() const;
510 
514  virtual const char *getTooltip() const {return hasTooltip ? tooltip.c_str() : nullptr;}
515 
522  virtual void setTooltip(const char *tooltip);
523 
530  virtual cObject *getAssociatedObject() const {return associatedObject;}
531 
537  virtual void setAssociatedObject(cObject *obj);
538 
544  virtual const char *getTags() const {return tags.c_str();}
545 
551  virtual void setTags(const char *tags);
553 
559  virtual cFigure *getParentFigure() const {return dynamic_cast<cFigure*>(getOwner());}
560 
566  virtual cCanvas *getCanvas() const;
567 
571  virtual int getNumFigures() const {return children.size();}
572 
578  virtual cFigure *getFigure(int pos) const;
579 
584  virtual cFigure *getFigure(const char *name) const;
585 
590  virtual int findFigure(const char *name) const;
591 
596  virtual int findFigure(const cFigure *figure) const;
597 
601  virtual bool containsFigures() const {return !children.empty();}
602 
607  virtual cFigure *findFigureRecursively(const char *name) const;
608 
627  virtual cFigure *getFigureByPath(const char *path) const;
629 
635  virtual void addFigure(cFigure *figure);
636 
643  virtual void addFigure(cFigure *figure, int pos);
644 
651  virtual cFigure *removeFigure(cFigure *figure);
652 
659  virtual cFigure *removeFigure(int pos);
660 
665  virtual cFigure *removeFromParent();
667 
676  virtual bool isAbove(const cFigure *figure) const;
677 
684  virtual bool isBelow(const cFigure *figure) const;
685 
698  virtual void insertAbove(cFigure *referenceFigure);
699 
712  virtual void insertBelow(cFigure *referenceFigure);
713 
719  virtual void insertAfter(const cFigure *referenceFigure);
720 
726  virtual void insertBefore(const cFigure *referenceFigure);
727 
734  virtual void raiseAbove(cFigure *figure);
735 
742  virtual void lowerBelow(cFigure *figure);
743 
750  virtual void raiseToTop();
751 
758  virtual void lowerToBottom();
759 
763  virtual cFigure *dupTree() const;
765 
768  virtual void translate(double dx, double dy) {transform.translate(dx,dy); fireTransformChange();}
769  virtual void scale(double s) {transform.scale(s); fireTransformChange();}
770  virtual void scale(double sx, double sy) {transform.scale(sx,sy); fireTransformChange();}
771  virtual void scale(double sx, double sy, double cx, double cy) {transform.scale(sx,sy,cx,cy); fireTransformChange();}
772  virtual void scale(double sx, double sy, const Point& c) {scale(sx, sy, c.x, c.y);}
773  virtual void rotate(double phi) {transform.rotate(phi); fireTransformChange();}
774  virtual void rotate(double phi, double cx, double cy) {transform.rotate(phi,cx,cy); fireTransformChange();}
775  virtual void rotate(double phi, const Point& c) {rotate(phi, c.x, c.y);}
776  virtual void skewx(double coeff) {transform.skewx(coeff); fireTransformChange();}
777  virtual void skewy(double coeff) {transform.skewy(coeff); fireTransformChange();}
778  virtual void skewx(double coeff, double cy) {transform.skewx(coeff,cy); fireTransformChange();}
779  virtual void skewy(double coeff, double cx) {transform.skewy(coeff,cx); fireTransformChange();}
781 
794  virtual void parse(cProperty *property);
795 
806  virtual const char **getAllowedPropertyKeys() const;
807 
812  virtual void moveLocal(double dx, double dy) = 0;
813 
820  virtual void move(double dx, double dy);
821 
829  virtual void refreshDisplay() {}
830 
836  virtual const char *getRendererClassName() const = 0;
838 };
839 
840 // import the namespace to be able to use the stream write operators
841 namespace canvas_stream_ops {
842 #define STREAMOP(CLASS) inline std::ostream& operator<<(std::ostream& os, const CLASS& x) { return os << x.str(); }
843 STREAMOP(cFigure::Point);
844 STREAMOP(cFigure::Rectangle);
845 STREAMOP(cFigure::Color);
846 STREAMOP(cFigure::Font);
847 STREAMOP(cFigure::Transform);
848 STREAMOP(cFigure::RGBA);
849 STREAMOP(cFigure::Pixmap);
850 #undef STREAMOP
851 };
852 
853 
864 class SIM_API cGroupFigure : public cFigure
865 {
866  private:
867  void copy(const cGroupFigure& other) {}
868  public:
871  explicit cGroupFigure(const char *name=nullptr) : cFigure(name) {}
872  cGroupFigure(const cGroupFigure& other) : cFigure(other) {copy(other);}
873  cGroupFigure& operator=(const cGroupFigure& other);
875 
878  virtual cGroupFigure *dup() const override {return new cGroupFigure(*this);}
879  virtual std::string str() const override;
880  virtual const char *getRendererClassName() const override {return "GroupFigureRenderer";}
881  virtual void moveLocal(double dx, double dy) override {}
883 };
884 
898 class SIM_API cPanelFigure : public cFigure
899 {
900  private:
901  Point position;
902  Point anchorPoint;
903  protected:
904  virtual const char **getAllowedPropertyKeys() const override;
905  virtual void parse(cProperty *property) override;
906  virtual void hashTo(cHasher& hasher) const override;
907 
908  private:
909  void copy(const cPanelFigure& other);
910  public:
913  explicit cPanelFigure(const char *name=nullptr) : cFigure(name) {}
914  cPanelFigure(const cPanelFigure& other) : cFigure(other) {copy(other);}
915  cPanelFigure& operator=(const cPanelFigure& other);
917 
920  virtual cPanelFigure *dup() const override {return new cPanelFigure(*this);}
921  virtual std::string str() const override;
922  virtual const char *getRendererClassName() const override {return "";} // non-visual figure
923  virtual void updateParentTransform(Transform& transform) override;
924  virtual void move(double dx, double dy) override { moveLocal(dx, dy); }
925  virtual void moveLocal(double dx, double dy) override {position.x += dx; position.y += dy; fireTransformChange();}
927 
930  virtual const Point& getPosition() const {return position;}
931  virtual void setPosition(const Point& position) {this->position = position; fireTransformChange();}
932 
942  virtual const Point& getAnchorPoint() const {return anchorPoint;}
943  virtual void setAnchorPoint(const Point& anchorPoint) {this->anchorPoint = anchorPoint; fireTransformChange();}
944 
946 };
947 
964 class SIM_API cAbstractLineFigure : public cFigure
965 {
966  private:
967  Color lineColor;
968  LineStyle lineStyle = LINE_SOLID;
969  double lineWidth = 1;
970  double lineOpacity = 1;
971  CapStyle capStyle = CAP_BUTT;
972  Arrowhead startArrowhead = ARROW_NONE, endArrowhead = ARROW_NONE;
973  bool zoomLineWidth = false;
974  private:
975  void copy(const cAbstractLineFigure& other);
976  protected:
977  virtual const char **getAllowedPropertyKeys() const override;
978  virtual void hashTo(cHasher& hasher) const override;
979  public:
982  explicit cAbstractLineFigure(const char *name=nullptr) : cFigure(name), lineColor(BLACK) {}
983  cAbstractLineFigure(const cAbstractLineFigure& other) : cFigure(other) {copy(other);}
984  cAbstractLineFigure& operator=(const cAbstractLineFigure& other);
986 
989  virtual cAbstractLineFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
990  virtual std::string str() const override;
991  virtual void parse(cProperty *property) override;
993 
999  virtual const Color& getLineColor() const {return lineColor;}
1000 
1004  virtual void setLineColor(const Color& lineColor);
1005 
1011  virtual double getLineWidth() const {return lineWidth;}
1012 
1018  virtual void setLineWidth(double lineWidth);
1019 
1023  virtual double getLineOpacity() const {return lineOpacity;}
1024 
1029  virtual void setLineOpacity(double lineOpacity);
1030 
1034  virtual LineStyle getLineStyle() const {return lineStyle;}
1035 
1040  virtual void setLineStyle(LineStyle lineStyle);
1041 
1045  virtual CapStyle getCapStyle() const {return capStyle;}
1046 
1051  virtual void setCapStyle(CapStyle capStyle);
1052 
1056  virtual Arrowhead getStartArrowhead() const {return startArrowhead;}
1057 
1062  virtual void setStartArrowhead(Arrowhead startArrowhead);
1063 
1067  virtual Arrowhead getEndArrowhead() const {return endArrowhead;}
1068 
1073  virtual void setEndArrowhead(Arrowhead endArrowhead);
1074 
1079  virtual bool getZoomLineWidth() const {return zoomLineWidth;}
1080 
1086  virtual void setZoomLineWidth(bool zoomLineWidth);
1088 };
1089 
1098 class SIM_API cLineFigure : public cAbstractLineFigure
1099 {
1100  private:
1101  Point start, end;
1102  private:
1103  void copy(const cLineFigure& other);
1104  protected:
1105  virtual const char **getAllowedPropertyKeys() const override;
1106  virtual void hashTo(cHasher& hasher) const override;
1107  public:
1110  explicit cLineFigure(const char *name=nullptr) : cAbstractLineFigure(name) {}
1111  cLineFigure(const cLineFigure& other) : cAbstractLineFigure(other) {copy(other);}
1112  cLineFigure& operator=(const cLineFigure& other);
1114 
1117  virtual cLineFigure *dup() const override {return new cLineFigure(*this);}
1118  virtual std::string str() const override;
1119  virtual void parse(cProperty *property) override;
1120  virtual void moveLocal(double dx, double dy) override;
1121  virtual const char *getRendererClassName() const override {return "LineFigureRenderer";}
1123 
1129  virtual const Point& getStart() const {return start;}
1130 
1134  virtual void setStart(const Point& start);
1135 
1139  virtual const Point& getEnd() const {return end;}
1140 
1144  virtual void setEnd(const Point& end);
1146 };
1147 
1167 class SIM_API cArcFigure : public cAbstractLineFigure
1168 {
1169  private:
1170  Rectangle bounds; // bounding box of the oval that arc is part of
1171  double startAngle = 0, endAngle = 0; // in radians, CCW, 0=east
1172  private:
1173  void copy(const cArcFigure& other);
1174  protected:
1175  virtual const char **getAllowedPropertyKeys() const override;
1176  virtual void hashTo(cHasher& hasher) const override;
1177  public:
1180  explicit cArcFigure(const char *name=nullptr) : cAbstractLineFigure(name) {}
1181  cArcFigure(const cArcFigure& other) : cAbstractLineFigure(other) {copy(other);}
1182  cArcFigure& operator=(const cArcFigure& other);
1184 
1187  virtual cArcFigure *dup() const override {return new cArcFigure(*this);}
1188  virtual std::string str() const override;
1189  virtual void parse(cProperty *property) override;
1190  virtual void moveLocal(double dx, double dy) override;
1191  virtual const char *getRendererClassName() const override {return "ArcFigureRenderer";}
1193 
1200  virtual const Rectangle& getBounds() const {return bounds;}
1201 
1206  virtual void setBounds(const Rectangle& bounds);
1207 
1212  virtual void setPosition(const Point& position, Anchor anchor);
1213 
1218  virtual double getStartAngle() const {return startAngle;}
1219 
1224  virtual void setStartAngle(double startAngle);
1225 
1230  virtual double getEndAngle() const {return endAngle;}
1231 
1236  virtual void setEndAngle(double endAngle);
1238 };
1239 
1257 class SIM_API cPolylineFigure : public cAbstractLineFigure
1258 {
1259  private:
1260  std::vector<Point> points;
1261  bool smooth = false;
1262  JoinStyle joinStyle = JOIN_MITER;
1263  private:
1264  void copy(const cPolylineFigure& other);
1265  void checkIndex(int i) const;
1266  void checkInsIndex(int i) const;
1267  protected:
1268  virtual const char **getAllowedPropertyKeys() const override;
1269  virtual void hashTo(cHasher& hasher) const override;
1270  public:
1273  explicit cPolylineFigure(const char *name=nullptr) : cAbstractLineFigure(name) {}
1274  cPolylineFigure(const cPolylineFigure& other) : cAbstractLineFigure(other) {copy(other);}
1275  cPolylineFigure& operator=(const cPolylineFigure& other);
1277 
1280  virtual cPolylineFigure *dup() const override {return new cPolylineFigure(*this);}
1281  virtual std::string str() const override;
1282  virtual void parse(cProperty *property) override;
1283  virtual void moveLocal(double dx, double dy) override;
1284  virtual const char *getRendererClassName() const override {return "PolylineFigureRenderer";}
1286 
1292  virtual const std::vector<Point>& getPoints() const {return points;}
1293 
1297  virtual void setPoints(const std::vector<Point>& points);
1298 
1302  virtual int getNumPoints() const {return points.size();}
1303 
1308  virtual const Point& getPoint(int i) const {checkIndex(i); return points[i];}
1309 
1314  virtual void setNumPoints(int size); // primarily for sim_std.msg
1315 
1319  virtual void setPoint(int i, const Point& point);
1320 
1324  virtual void addPoint(const Point& point);
1325 
1329  virtual void removePoint(int i);
1330 
1335  virtual void insertPoint(int i, const Point& point);
1336 
1343  virtual bool getSmooth() const {return smooth;}
1344 
1351  virtual void setSmooth(bool smooth);
1353 
1359  virtual JoinStyle getJoinStyle() const {return joinStyle;}
1360 
1365  virtual void setJoinStyle(JoinStyle joinStyle);
1367 };
1368 
1389 class SIM_API cAbstractShapeFigure : public cFigure
1390 {
1391  private:
1392  bool outlined = true;
1393  bool filled = false;
1394  Color lineColor;
1395  Color fillColor;
1396  LineStyle lineStyle = LINE_SOLID;
1397  double lineWidth = 1;
1398  double lineOpacity = 1;
1399  double fillOpacity = 1;
1400  bool zoomLineWidth = false;
1401  private:
1402  void copy(const cAbstractShapeFigure& other);
1403  protected:
1404  virtual const char **getAllowedPropertyKeys() const override;
1405  virtual void hashTo(cHasher& hasher) const override;
1406  public:
1409  explicit cAbstractShapeFigure(const char *name=nullptr) : cFigure(name), lineColor(BLACK), fillColor(BLUE) {}
1410  cAbstractShapeFigure(const cAbstractShapeFigure& other) : cFigure(other) {copy(other);}
1411  cAbstractShapeFigure& operator=(const cAbstractShapeFigure& other);
1413 
1416  virtual cAbstractShapeFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
1417  virtual std::string str() const override;
1418  virtual void parse(cProperty *property) override;
1420 
1426  virtual bool isFilled() const {return filled;}
1427 
1432  virtual void setFilled(bool filled);
1433 
1437  virtual bool isOutlined() const {return outlined;}
1438 
1443  virtual void setOutlined(bool outlined);
1444 
1448  virtual const Color& getLineColor() const {return lineColor;}
1449 
1454  virtual void setLineColor(const Color& lineColor);
1455 
1459  virtual const Color& getFillColor() const {return fillColor;}
1460 
1466  virtual void setFillColor(const Color& fillColor);
1467 
1471  virtual LineStyle getLineStyle() const {return lineStyle;}
1472 
1477  virtual void setLineStyle(LineStyle lineStyle);
1478 
1484  virtual double getLineWidth() const {return lineWidth;}
1485 
1491  virtual void setLineWidth(double lineWidth);
1492 
1497  virtual double getLineOpacity() const {return lineOpacity;}
1498 
1503  virtual void setLineOpacity(double lineOpacity);
1504 
1509  virtual double getFillOpacity() const {return fillOpacity;}
1510 
1515  virtual void setFillOpacity(double fillOpacity);
1516 
1521  virtual bool getZoomLineWidth() const {return zoomLineWidth;}
1522 
1528  virtual void setZoomLineWidth(bool zoomLineWidth);
1530 };
1531 
1542 {
1543  private:
1544  Rectangle bounds;
1545  double cornerRx = 0, cornerRy = 0;
1546  protected:
1547  virtual const char **getAllowedPropertyKeys() const override;
1548  virtual void hashTo(cHasher& hasher) const override;
1549  private:
1550  void copy(const cRectangleFigure& other);
1551  public:
1554  explicit cRectangleFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1555  cRectangleFigure(const cRectangleFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1556  cRectangleFigure& operator=(const cRectangleFigure& other);
1558 
1561  virtual cRectangleFigure *dup() const override {return new cRectangleFigure(*this);}
1562  virtual std::string str() const override;
1563  virtual void parse(cProperty *property) override;
1564  virtual void moveLocal(double dx, double dy) override;
1565  virtual const char *getRendererClassName() const override {return "RectangleFigureRenderer";}
1567 
1573  virtual const Rectangle& getBounds() const {return bounds;}
1574 
1578  virtual void setBounds(const Rectangle& bounds);
1579 
1584  virtual void setPosition(const Point& position, Anchor anchor);
1585 
1590  virtual void setCornerRadius(double r) {setCornerRx(r);setCornerRy(r);}
1591 
1595  virtual double getCornerRx() const {return cornerRx;}
1596 
1601  virtual void setCornerRx(double rx);
1602 
1606  virtual double getCornerRy() const {return cornerRy;}
1607 
1612  virtual void setCornerRy(double ry);
1614 };
1615 
1625 class SIM_API cOvalFigure : public cAbstractShapeFigure
1626 {
1627  private:
1628  Rectangle bounds; // bounding box
1629  private:
1630  void copy(const cOvalFigure& other);
1631  protected:
1632  virtual const char **getAllowedPropertyKeys() const override;
1633  virtual void hashTo(cHasher& hasher) const override;
1634  public:
1637  explicit cOvalFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1638  cOvalFigure(const cOvalFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1639  cOvalFigure& operator=(const cOvalFigure& other);
1641 
1644  virtual cOvalFigure *dup() const override {return new cOvalFigure(*this);}
1645  virtual std::string str() const override;
1646  virtual void parse(cProperty *property) override;
1647  virtual void moveLocal(double dx, double dy) override;
1648  virtual const char *getRendererClassName() const override {return "OvalFigureRenderer";}
1650 
1656  virtual const Rectangle& getBounds() const {return bounds;}
1657 
1661  virtual void setBounds(const Rectangle& bounds);
1662 
1667  virtual void setPosition(const Point& position, Anchor anchor);
1669 };
1670 
1681 class SIM_API cRingFigure : public cAbstractShapeFigure
1682 {
1683  private:
1684  Rectangle bounds; // bounding box
1685  double innerRx = 0, innerRy = 0;
1686  private:
1687  void copy(const cRingFigure& other);
1688  protected:
1689  virtual const char **getAllowedPropertyKeys() const override;
1690  virtual void hashTo(cHasher& hasher) const override;
1691  public:
1694  explicit cRingFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1695  cRingFigure(const cRingFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1696  cRingFigure& operator=(const cRingFigure& other);
1698 
1701  virtual cRingFigure *dup() const override {return new cRingFigure(*this);}
1702  virtual std::string str() const override;
1703  virtual void parse(cProperty *property) override;
1704  virtual void moveLocal(double dx, double dy) override;
1705  virtual const char *getRendererClassName() const override {return "RingFigureRenderer";}
1707 
1713  virtual const Rectangle& getBounds() const {return bounds;}
1714 
1718  virtual void setBounds(const Rectangle& bounds);
1719 
1724  virtual void setPosition(const Point& position, Anchor anchor);
1725 
1731  virtual void setInnerRadius(double r) {setInnerRx(r);setInnerRy(r);}
1732 
1736  virtual double getInnerRx() const {return innerRx;}
1737 
1741  virtual void setInnerRx(double rx);
1742 
1746  virtual double getInnerRy() const {return innerRy;}
1747 
1751  virtual void setInnerRy(double ry);
1753 };
1754 
1783 {
1784  private:
1785  Rectangle bounds; // bounding box of the oval that the pie slice is part of
1786  double startAngle = 0, endAngle = 0; // in radians, CCW, 0=east
1787  private:
1788  void copy(const cPieSliceFigure& other);
1789  protected:
1790  virtual const char **getAllowedPropertyKeys() const override;
1791  virtual void hashTo(cHasher& hasher) const override;
1792  public:
1795  explicit cPieSliceFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1796  cPieSliceFigure(const cPieSliceFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1797  cPieSliceFigure& operator=(const cPieSliceFigure& other);
1799 
1802  virtual cPieSliceFigure *dup() const override {return new cPieSliceFigure(*this);}
1803  virtual std::string str() const override;
1804  virtual void parse(cProperty *property) override;
1805  virtual void moveLocal(double dx, double dy) override;
1806  virtual const char *getRendererClassName() const override {return "PieSliceFigureRenderer";}
1808 
1815  virtual const Rectangle& getBounds() const {return bounds;}
1816 
1821  virtual void setBounds(const Rectangle& bounds);
1822 
1827  virtual void setPosition(const Point& position, Anchor anchor);
1828 
1833  virtual double getStartAngle() const {return startAngle;}
1834 
1839  virtual void setStartAngle(double startAngle);
1840 
1845  virtual double getEndAngle() const {return endAngle;}
1846 
1851  virtual void setEndAngle(double endAngle);
1853 };
1854 
1868 class SIM_API cPolygonFigure : public cAbstractShapeFigure
1869 {
1870  private:
1871  std::vector<Point> points;
1872  bool smooth = false;
1873  JoinStyle joinStyle = JOIN_MITER;
1874  FillRule fillRule = FILL_EVENODD;
1875  private:
1876  void copy(const cPolygonFigure& other);
1877  void checkIndex(int i) const;
1878  void checkInsIndex(int i) const;
1879  protected:
1880  virtual const char **getAllowedPropertyKeys() const override;
1881  virtual void hashTo(cHasher& hasher) const override;
1882  public:
1885  explicit cPolygonFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
1886  cPolygonFigure(const cPolygonFigure& other) : cAbstractShapeFigure(other) {copy(other);}
1887  cPolygonFigure& operator=(const cPolygonFigure& other);
1889 
1892  virtual cPolygonFigure *dup() const override {return new cPolygonFigure(*this);}
1893  virtual std::string str() const override;
1894  virtual void parse(cProperty *property) override;
1895  virtual void moveLocal(double dx, double dy) override;
1896  virtual const char *getRendererClassName() const override {return "PolygonFigureRenderer";}
1898 
1904  virtual const std::vector<Point>& getPoints() const {return points;}
1905 
1909  virtual void setPoints(const std::vector<Point>& points);
1910 
1914  virtual int getNumPoints() const {return points.size();}
1915 
1920  virtual const Point& getPoint(int i) const {checkIndex(i); return points[i];}
1921 
1926  virtual void setNumPoints(int size); // primarily for sim_std.msg
1927 
1931  virtual void setPoint(int i, const Point& point);
1932 
1936  virtual void addPoint(const Point& point);
1937 
1941  virtual void removePoint(int i);
1942 
1947  virtual void insertPoint(int i, const Point& point);
1948 
1953  virtual bool getSmooth() const {return smooth;}
1954 
1960  virtual void setSmooth(bool smooth);
1962 
1968  virtual JoinStyle getJoinStyle() const {return joinStyle;}
1969 
1974  virtual void setJoinStyle(JoinStyle joinStyle);
1975 
1982  virtual FillRule getFillRule() const {return fillRule;}
1983 
1991  virtual void setFillRule(FillRule fillRule);
1993 };
1994 
2011 class SIM_API cPathFigure : public cAbstractShapeFigure
2012 {
2013  public:
2014  struct PathItem { char code; };
2015  struct MoveTo : PathItem { double x; double y; };
2016  struct MoveRel : PathItem { double dx; double dy; };
2017  struct LineTo : PathItem { double x; double y; };
2018  struct LineRel : PathItem { double dx; double dy; };
2019  struct HorizontalLineTo : PathItem { double x; };
2020  struct HorizontalLineRel : PathItem { double dx; };
2021  struct VerticalLineTo : PathItem { double y; };
2022  struct VerticalLineRel : PathItem { double dy; };
2023  struct ArcTo : PathItem { double rx; double ry; double phi; bool largeArc; bool sweep; double x; double y; };
2024  struct ArcRel : PathItem { double rx; double ry; double phi; bool largeArc; bool sweep; double dx; double dy; };
2025  struct CurveTo : PathItem { double x1; double y1; double x; double y; };
2026  struct CurveRel : PathItem { double dx1; double dy1; double dx; double dy; };
2027  struct SmoothCurveTo : PathItem { double x; double y; };
2028  struct SmoothCurveRel : PathItem { double dx; double dy; };
2029  struct CubicBezierCurveTo : PathItem { double x1; double y1; double x2; double y2; double x; double y; };
2030  struct CubicBezierCurveRel : PathItem { double dx1; double dy1; double dx2; double dy2; double dx; double dy; };
2031  struct SmoothCubicBezierCurveTo : PathItem { double x2; double y2; double x; double y; };
2032  struct SmoothCubicBezierCurveRel : PathItem { double dx2; double dy2; double dx; double dy; };
2033  struct ClosePath : PathItem { };
2034 
2035  private:
2036  std::vector<PathItem*> path;
2037  mutable std::string cachedPathString;
2038  JoinStyle joinStyle = JOIN_MITER;
2039  CapStyle capStyle = CAP_BUTT;
2040  Point offset;
2041  FillRule fillRule = FILL_EVENODD;
2042 
2043  private:
2044  void copy(const cPathFigure& other);
2045  void addItem(PathItem *item);
2046  void doClearPath();
2047 
2048  protected:
2049  virtual const char **getAllowedPropertyKeys() const override;
2050  virtual void hashTo(cHasher& hasher) const override;
2051 
2052  public:
2055  explicit cPathFigure(const char *name=nullptr) : cAbstractShapeFigure(name) {}
2056  cPathFigure(const cPathFigure& other) : cAbstractShapeFigure(other) {copy(other);}
2057  virtual ~cPathFigure() {doClearPath();}
2058  cPathFigure& operator=(const cPathFigure& other);
2060 
2063  virtual cPathFigure *dup() const override {return new cPathFigure(*this);}
2064  virtual std::string str() const override;
2065  virtual void parse(cProperty *property) override;
2069  virtual void moveLocal(double dx, double dy) override;
2070  virtual const char *getRendererClassName() const override {return "PathFigureRenderer";}
2072 
2078  virtual JoinStyle getJoinStyle() const {return joinStyle;}
2079 
2084  virtual void setJoinStyle(JoinStyle joinStyle);
2085 
2089  virtual CapStyle getCapStyle() const {return capStyle;}
2090 
2095  virtual void setCapStyle(CapStyle capStyle);
2096 
2103  virtual FillRule getFillRule() const {return fillRule;}
2104 
2113  virtual void setFillRule(FillRule fillRule);
2115 
2123  virtual const Point& getOffset() const {return offset;}
2124 
2132  virtual void setOffset(const Point& offset);
2134 
2140  virtual const char *getPath() const;
2141 
2147  virtual void setPath(const char *path);
2148 
2152  virtual int getNumPathItems() const {return path.size();}
2153 
2159  virtual const PathItem *getPathItem(int k) const {return path[k];}
2160 
2164  virtual void clearPath();
2165 
2172  virtual void addMoveTo(double x, double y); // M x y
2173 
2181  virtual void addMoveRel(double dx, double dy); // m dx dy
2182 
2189  virtual void addLineTo(double x, double y); // L x y
2190 
2197  virtual void addLineRel(double dx, double dy); // l dx dy
2198 
2205  virtual void addHorizontalLineTo(double x); // H x
2206 
2213  virtual void addHorizontalLineRel(double dx); // h dx
2214 
2221  virtual void addVerticalLineTo(double y); // V y
2222 
2229  virtual void addVerticalLineRel(double dy); // v dy
2230 
2245  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
2246 
2262  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
2263 
2270  virtual void addCurveTo(double x1, double y1, double x, double y); // Q x1 y1 x y
2271 
2279  virtual void addCurveRel(double dx1, double dy1, double dx, double dy); // q dx1 dy1 dx dy
2280 
2292  virtual void addSmoothCurveTo(double x, double y); // T x y
2293 
2305  virtual void addSmoothCurveRel(double dx, double dy); // t dx dy
2306 
2315  virtual void addCubicBezierCurveTo(double x1, double y1, double x2, double y2, double x, double y); // C x1 y1 x2 y2 x y
2316 
2326  virtual void addCubicBezierCurveRel(double dx1, double dy1, double dx2, double dy2, double dx, double dy); // c dx1 dy1 dx2 dy2 dx dy
2327 
2340  virtual void addSmoothCubicBezierCurveTo(double x2, double y2, double x, double y); // S x2 y2 x y
2341 
2354  virtual void addSmoothCubicBezierCurveRel(double dx2, double dy2, double dx, double dy); // s dx2 dy2 dx dy
2355 
2363  virtual void addClosePath(); // Z
2365 };
2366 
2386 class SIM_API cAbstractTextFigure : public cFigure
2387 {
2388  private:
2389  Point position;
2390  Color color; // note: tkpath's text supports separate colors and opacity for fill and outline -- ignore because probably SWT doesn't support it!
2391  double opacity = 1;
2392  bool halo = false;
2393  Font font;
2394  std::string text;
2395  Anchor anchor = ANCHOR_NW;
2396  Alignment alignment = ALIGN_LEFT;
2397  private:
2398  void copy(const cAbstractTextFigure& other);
2399  protected:
2400  virtual const char **getAllowedPropertyKeys() const override;
2401  virtual void hashTo(cHasher& hasher) const override;
2402  public:
2405  explicit cAbstractTextFigure(const char *name=nullptr) : cFigure(name), color(BLACK) {}
2406  cAbstractTextFigure(const cAbstractTextFigure& other) : cFigure(other) {copy(other);}
2407  cAbstractTextFigure& operator=(const cAbstractTextFigure& other);
2409 
2412  virtual cAbstractTextFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
2413  virtual std::string str() const override;
2414  virtual void parse(cProperty *property) override;
2418  virtual void moveLocal(double dx, double dy) override;
2420 
2428  virtual const Point& getPosition() const {return position;}
2429 
2435  virtual void setPosition(const Point& position);
2436 
2442  virtual Anchor getAnchor() const {return anchor;}
2443 
2449  virtual void setAnchor(Anchor anchor);
2450 
2458  virtual Alignment getAlignment() const {return alignment;}
2459 
2467  virtual void setAlignment(Alignment alignment);
2468 
2483  virtual Rectangle getBounds() const;
2485 
2491  virtual const Color& getColor() const {return color;}
2492 
2496  virtual void setColor(const Color& color);
2497 
2501  virtual double getOpacity() const {return opacity;}
2502 
2507  virtual void setOpacity(double opacity);
2508 
2512  virtual bool getHalo() const {return halo;}
2513 
2525  virtual void setHalo(bool enabled);
2526 
2530  virtual const Font& getFont() const {return font;}
2531 
2537  virtual void setFont(Font font);
2539 
2545  virtual const char *getText() const {return text.c_str();}
2546 
2551  virtual void setText(const char* text);
2553 };
2554 
2563 class SIM_API cTextFigure : public cAbstractTextFigure
2564 {
2565  private:
2566  void copy(const cTextFigure& other) {}
2567  public:
2570  explicit cTextFigure(const char *name=nullptr) : cAbstractTextFigure(name) {}
2571  cTextFigure(const cTextFigure& other) : cAbstractTextFigure(other) {copy(other);}
2572  cTextFigure& operator=(const cTextFigure& other);
2574 
2577  virtual cTextFigure *dup() const override {return new cTextFigure(*this);}
2578  virtual const char *getRendererClassName() const override {return "TextFigureRenderer";}
2580 };
2581 
2591 class SIM_API cLabelFigure : public cAbstractTextFigure
2592 {
2593  private:
2594  double angle = 0.0; // in radians, positive is CCW, 0 is "horizontal" or "unrotated"
2595  private:
2596  void copy(const cLabelFigure& other);
2597  protected:
2598  virtual const char **getAllowedPropertyKeys() const override;
2599  virtual void hashTo(cHasher& hasher) const override;
2600  public:
2603  explicit cLabelFigure(const char *name=nullptr) : cAbstractTextFigure(name) {}
2604  cLabelFigure(const cLabelFigure& other) : cAbstractTextFigure(other) {copy(other);}
2605  cLabelFigure& operator=(const cLabelFigure& other);
2607 
2610  virtual cLabelFigure *dup() const override {return new cLabelFigure(*this);}
2611  virtual void parse(cProperty *property) override;
2612  virtual const char *getRendererClassName() const override {return "LabelFigureRenderer";}
2614 
2617  virtual double getAngle() const {return angle;}
2618  virtual void setAngle(double angle);
2620 };
2621 
2647 class SIM_API cAbstractImageFigure : public cFigure
2648 {
2649  private:
2650  Point position;
2651  Anchor anchor = ANCHOR_CENTER; // note: do not use the ANCHOR_BASELINE_START/MIDDLE/END constants, as they are for text items
2652  double width = 0, height = 0; // zero or negative values mean using the image's own size
2653  Interpolation interpolation = INTERPOLATION_FAST;
2654  double opacity = 1;
2655  Color tintColor;
2656  double tintAmount = 0; // in the range 0..1
2657  private:
2658  void copy(const cAbstractImageFigure& other);
2659  protected:
2660  virtual const char **getAllowedPropertyKeys() const override;
2661  virtual void hashTo(cHasher& hasher) const override;
2662  virtual Point getDefaultSize() const = 0;
2663  public:
2666  explicit cAbstractImageFigure(const char *name=nullptr) : cFigure(name), tintColor(BLUE) { }
2667  cAbstractImageFigure(const cAbstractImageFigure& other) : cFigure(other) {copy(other);}
2668  cAbstractImageFigure& operator=(const cAbstractImageFigure& other);
2670 
2673  virtual cAbstractImageFigure *dup() const override {throw cRuntimeError(this, E_CANTDUP);}
2674  virtual void parse(cProperty *property) override;
2678  virtual void moveLocal(double dx, double dy) override;
2680 
2688  virtual const Point& getPosition() const {return position;}
2689 
2695  virtual void setPosition(const Point& position);
2696 
2702  virtual Anchor getAnchor() const {return anchor;}
2703 
2709  virtual void setAnchor(Anchor anchor);
2710 
2715  virtual double getWidth() const {return width;}
2716 
2723  virtual void setWidth(double width);
2724 
2729  virtual double getHeight() const {return height;}
2730 
2737  virtual void setHeight(double height); // zero means "unset"
2738 
2743  virtual void setSize(double width, double height) {setWidth(width); setHeight(height);}
2744 
2756  virtual Rectangle getBounds() const;
2758 
2766  virtual Interpolation getInterpolation() const {return interpolation;}
2767 
2773  virtual void setInterpolation(Interpolation interpolation);
2774 
2778  virtual double getOpacity() const {return opacity;}
2779 
2784  virtual void setOpacity(double opacity);
2785 
2789  virtual const Color& getTintColor() const {return tintColor;}
2790 
2798  virtual void setTintColor(const Color& tintColor);
2799 
2804  virtual double getTintAmount() const {return tintAmount;}
2805 
2814  virtual void setTintAmount(double tintAmount);
2816 };
2817 
2827 class SIM_API cImageFigure : public cAbstractImageFigure
2828 {
2829  private:
2830  std::string imageName;
2831  private:
2832  void copy(const cImageFigure& other);
2833  protected:
2834  virtual const char **getAllowedPropertyKeys() const override;
2835  virtual void hashTo(cHasher& hasher) const override;
2836  virtual Point getDefaultSize() const override;
2837  public:
2840  explicit cImageFigure(const char *name=nullptr) : cAbstractImageFigure(name) {}
2841  cImageFigure(const cImageFigure& other) : cAbstractImageFigure(other) {copy(other);}
2842  cImageFigure& operator=(const cImageFigure& other);
2844 
2847  virtual cImageFigure *dup() const override {return new cImageFigure(*this);}
2848  virtual std::string str() const override;
2849  virtual void parse(cProperty *property) override;
2850  virtual const char *getRendererClassName() const override {return "ImageFigureRenderer";}
2852 
2858  virtual const char *getImageName() const {return imageName.c_str();}
2859 
2866  virtual void setImageName(const char* imageName);
2867 
2878  virtual int getImageNaturalWidth() const {return getDefaultSize().x;}
2879 
2890  virtual int getImageNaturalHeight() const {return getDefaultSize().y;}
2892 };
2893 
2904 class SIM_API cIconFigure : public cImageFigure
2905 {
2906  private:
2907  void copy(const cIconFigure& other) {}
2908  public:
2911  explicit cIconFigure(const char *name=nullptr) : cImageFigure(name) {}
2912  cIconFigure(const cIconFigure& other) : cImageFigure(other) {copy(other);}
2913  cIconFigure& operator=(const cIconFigure& other);
2915 
2918  virtual cIconFigure *dup() const override {return new cIconFigure(*this);}
2919  virtual const char *getRendererClassName() const override {return "IconFigureRenderer";}
2921 };
2922 
2932 class SIM_API cPixmapFigure : public cAbstractImageFigure
2933 {
2934  private:
2935  Pixmap pixmap;
2936  private:
2937  void copy(const cPixmapFigure& other);
2938  protected:
2939  virtual const char **getAllowedPropertyKeys() const override;
2940  virtual void hashTo(cHasher& hasher) const override;
2941  virtual Point getDefaultSize() const override;
2942  public:
2945  explicit cPixmapFigure(const char *name=nullptr) : cAbstractImageFigure(name) {}
2946  cPixmapFigure(const cPixmapFigure& other) : cAbstractImageFigure(other) {copy(other);}
2947  virtual ~cPixmapFigure() {}
2948  cPixmapFigure& operator=(const cPixmapFigure& other);
2950 
2953  virtual cPixmapFigure *dup() const override {return new cPixmapFigure(*this);}
2954  virtual std::string str() const override;
2955  virtual void parse(cProperty *property) override;
2956  virtual const char *getRendererClassName() const override {return "PixmapFigureRenderer";}
2958 
2968  virtual const Pixmap& getPixmap() const {return pixmap;}
2969 
2974  virtual void setPixmap(const Pixmap& pixmap);
2975 
2977  virtual int getPixmapHeight() const {return pixmap.getHeight();}
2979  virtual int getPixmapWidth() const {return pixmap.getWidth();}
2981  virtual void setPixmapSize(int width, int height, const RGBA& fill); // nondestructive, set *newly added* pixels with this color and opacity
2983  virtual void setPixmapSize(int width, int height, const Color& color, double opacity); // nondestructive, fills *newly added* pixels with this color and opacity
2985  virtual void fillPixmap(const RGBA& fill);
2987  virtual void fillPixmap(const Color& color, double opacity);
2989  virtual const RGBA getPixel(int x, int y) const {return pixmap.pixel(x, y);}
2991  virtual void setPixel(int x, int y, const RGBA& argb);
2993  virtual void setPixel(int x, int y, const Color& color, double opacity = 1.0);
2995  virtual const Color getPixelColor(int x, int y) const {return pixmap.getColor(x,y);}
2997  virtual void setPixelColor(int x, int y, const Color& color);
2999  virtual double getPixelOpacity(int x, int y) const {return pixmap.getOpacity(x,y);}
3001  virtual void setPixelOpacity(int x, int y, double opacity);
3003 };
3004 
3023 class SIM_API cCanvas : public cOwnedObject
3024 {
3025  private:
3026  cFigure::Color backgroundColor;
3027  cFigure *rootFigure;
3028  std::map<std::string,int> tagBitIndex; // tag-to-bitindex
3029  static std::map<std::string,cObjectFactory*> figureFactories;
3030  std::map<const cObject*,double> animationSpeedMap; // maps source to animationSpeed
3031  double minAnimationSpeed = DBL_MAX; // minimum of the values in animationSpeedMap cached, or DBL_MAX for none
3032  double animationHoldEndTime = 0; // the effective one will be the maximum endTime of all visible canvases
3033  public:
3034  // internal:
3035  virtual cFigure *parseFigure(cProperty *property) const;
3036  virtual cFigure *createFigure(const char *type) const;
3037  static bool containsCanvasItems(cProperties *properties);
3038  virtual void addFiguresFrom(cProperties *properties);
3039  virtual uint64_t parseTags(const char *s);
3040  virtual std::string getTags(uint64_t tagBits);
3041  const std::map<const cObject*,double>& getAnimationSpeedMap() const {return animationSpeedMap;} // for e.g. Qtenv
3042  double getMinAnimationSpeed() const {return minAnimationSpeed;} // for e.g. Qtenv; DBL_MAX if none
3043  double getAnimationHoldEndTime() const {return animationHoldEndTime;} // for e.g. Qtenv
3044  private:
3045  void copy(const cCanvas& other);
3046  public:
3049  explicit cCanvas(const char *name = nullptr);
3050  cCanvas(const cCanvas& other) : cOwnedObject(other), rootFigure(nullptr) {copy(other);}
3051  virtual ~cCanvas();
3052  cCanvas& operator=(const cCanvas& other);
3054 
3057  virtual cCanvas *dup() const override {return new cCanvas(*this);}
3058  virtual void forEachChild(cVisitor *v) override;
3059  virtual std::string str() const override;
3061 
3067  virtual const cFigure::Color& getBackgroundColor() const {return backgroundColor;}
3068 
3072  virtual void setBackgroundColor(const cFigure::Color& color) {this->backgroundColor = color;}
3073 
3078  virtual uint32_t getHash() const;
3080 
3087  virtual cFigure *getRootFigure() const {return rootFigure;}
3088 
3092  virtual void addFigure(cFigure *figure) {rootFigure->addFigure(figure);}
3093 
3100  virtual void addFigure(cFigure *figure, int pos) {rootFigure->addFigure(figure, pos);}
3101 
3106  virtual cFigure *removeFigure(cFigure *figure) {return rootFigure->removeFigure(figure);}
3107 
3112  virtual cFigure *removeFigure(int pos) {return rootFigure->removeFigure(pos);}
3113 
3119  virtual int findFigure(const char *name) const {return rootFigure->findFigure(name);}
3120 
3125  virtual int findFigure(cFigure *figure) const {return rootFigure->findFigure(figure);}
3126 
3131  virtual bool hasFigures() const {return rootFigure->containsFigures();}
3132 
3136  virtual int getNumFigures() const {return rootFigure->getNumFigures();}
3137 
3143  virtual cFigure *getFigure(int pos) const {return rootFigure->getFigure(pos);}
3144 
3149  virtual cFigure *getFigure(const char *name) const {return rootFigure->getFigure(name);}
3151 
3161  virtual cFigure *getSubmodulesLayer() const;
3162 
3167  virtual cFigure *findFigureRecursively(const char *name) const {return rootFigure->findFigureRecursively(name);}
3168 
3173  virtual cFigure *getFigureByPath(const char *path) const {return rootFigure->getFigureByPath(path);}
3175 
3182  virtual std::string getAllTags() const;
3183 
3188  virtual std::vector<std::string> getAllTagsAsVector() const;
3190 
3208  virtual void setAnimationSpeed(double animationSpeed, const cObject *source);
3209 
3214  virtual double getAnimationSpeed(const cObject *source);
3215 
3234  virtual void holdSimulationFor(double animationTimeDelta);
3236 };
3237 
3238 } // namespace omnetpp
3239 
3240 
3241 #endif
3242 
omnetpp::cAbstractLineFigure::dup
virtual cAbstractLineFigure * dup() const override
Definition: ccanvas.h:989
omnetpp::cPathFigure::dup
virtual cPathFigure * dup() const override
Definition: ccanvas.h:2063
omnetpp::cFigure::CapStyle
CapStyle
Line cap style constants: CAP_BUTT, CAP_SQUARE, etc.
Definition: ccanvas.h:186
omnetpp::cLabelFigure
A figure that displays text which is unaffected by zooming or transformations, except for its positio...
Definition: ccanvas.h:2591
omnetpp::cAbstractTextFigure::dup
virtual cAbstractTextFigure * dup() const override
Definition: ccanvas.h:2412
omnetpp::cPathFigure::getCapStyle
virtual CapStyle getCapStyle() const
Definition: ccanvas.h:2089
omnetpp::cFigure::findFigureRecursively
virtual cFigure * findFigureRecursively(const char *name) const
omnetpp::cRingFigure::setInnerRadius
virtual void setInnerRadius(double r)
Definition: ccanvas.h:1731
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
omnetpp::cRectangleFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1565
omnetpp::cAbstractTextFigure::getAnchor
virtual Anchor getAnchor() const
Definition: ccanvas.h:2442
omnetpp::cPieSliceFigure::getEndAngle
virtual double getEndAngle() const
Definition: ccanvas.h:1845
omnetpp::cCanvas::getFigure
virtual cFigure * getFigure(const char *name) const
Definition: ccanvas.h:3149
omnetpp::cAbstractTextFigure::getHalo
virtual bool getHalo() const
Definition: ccanvas.h:2512
omnetpp::cAbstractImageFigure::getAnchor
virtual Anchor getAnchor() const
Definition: ccanvas.h:2702
omnetpp::cOvalFigure::getBounds
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1656
omnetpp::cPixmapFigure::dup
virtual cPixmapFigure * dup() const override
Definition: ccanvas.h:2953
omnetpp::cLineFigure::dup
virtual cLineFigure * dup() const override
Definition: ccanvas.h:1117
omnetpp::cPolylineFigure::dup
virtual cPolylineFigure * dup() const override
Definition: ccanvas.h:1280
omnetpp::cHasher
Utility class to calculate the hash of some data.
Definition: chasher.h:39
omnetpp::cPolylineFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1284
omnetpp::cRingFigure::dup
virtual cRingFigure * dup() const override
Definition: ccanvas.h:1701
omnetpp::cRingFigure::getInnerRx
virtual double getInnerRx() const
Definition: ccanvas.h:1736
omnetpp::cPieSliceFigure::dup
virtual cPieSliceFigure * dup() const override
Definition: ccanvas.h:1802
omnetpp::cAbstractLineFigure::getZoomLineWidth
virtual bool getZoomLineWidth() const
Definition: ccanvas.h:1079
omnetpp::cFigure::Font
Represents properties of a font.
Definition: ccanvas.h:162
omnetpp::cGroupFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:880
omnetpp::cAbstractShapeFigure::getFillOpacity
virtual double getFillOpacity() const
Definition: ccanvas.h:1509
omnetpp::cFigure::cFigure
cFigure(const cFigure &other)
Definition: ccanvas.h:409
omnetpp::cAbstractShapeFigure::getFillColor
virtual const Color & getFillColor() const
Definition: ccanvas.h:1459
omnetpp::cPathFigure::getOffset
virtual const Point & getOffset() const
Definition: ccanvas.h:2123
omnetpp::cCanvas::findFigure
virtual int findFigure(cFigure *figure) const
Definition: ccanvas.h:3125
omnetpp::cAbstractLineFigure::getLineOpacity
virtual double getLineOpacity() const
Definition: ccanvas.h:1023
omnetpp::cAbstractTextFigure
Abstract base class for figures that display text. Text may be multi-line.
Definition: ccanvas.h:2386
omnetpp::cPanelFigure::dup
virtual cPanelFigure * dup() const override
Definition: ccanvas.h:920
omnetpp::cPixmapFigure::getPixmapHeight
virtual int getPixmapHeight() const
Definition: ccanvas.h:2977
omnetpp::cImageFigure::getImageNaturalWidth
virtual int getImageNaturalWidth() const
Definition: ccanvas.h:2878
omnetpp::cAbstractLineFigure::getCapStyle
virtual CapStyle getCapStyle() const
Definition: ccanvas.h:1045
omnetpp::cFigure::resetTransform
virtual void resetTransform()
Definition: ccanvas.h:482
omnetpp::cFigure::getFigure
virtual cFigure * getFigure(int pos) const
omnetpp::cFigure::getId
int getId() const
Definition: ccanvas.h:451
omnetpp::cFigure::addFigure
virtual void addFigure(cFigure *figure)
omnetpp::cLineFigure::getStart
virtual const Point & getStart() const
Definition: ccanvas.h:1129
omnetpp::cFigure::Alignment
Alignment
Text alignment mode constants: ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER.
Definition: ccanvas.h:204
omnetpp::cAbstractLineFigure::getLineStyle
virtual LineStyle getLineStyle() const
Definition: ccanvas.h:1034
omnetpp::cFigure::getZIndex
virtual double getZIndex() const
Definition: ccanvas.h:489
omnetpp::cFigure::RGBA
Represents an RGBA pixel, for Pixmap manipulation.
Definition: ccanvas.h:255
omnetpp::cPolylineFigure::getPoint
virtual const Point & getPoint(int i) const
Definition: ccanvas.h:1308
omnetpp::cCanvas::removeFigure
virtual cFigure * removeFigure(cFigure *figure)
Definition: ccanvas.h:3106
omnetpp::cPixmapFigure
A figure that displays an image that can be manipulated programmatically.
Definition: ccanvas.h:2932
omnetpp::cPolygonFigure::getNumPoints
virtual int getNumPoints() const
Definition: ccanvas.h:1914
omnetpp::cPolygonFigure::getJoinStyle
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:1968
omnetpp::cAbstractImageFigure
Abstract base class for figures that display an image.
Definition: ccanvas.h:2647
omnetpp::cFigure::removeFigure
virtual cFigure * removeFigure(cFigure *figure)
omnetpp::cAbstractLineFigure::getEndArrowhead
virtual Arrowhead getEndArrowhead() const
Definition: ccanvas.h:1067
omnetpp::cVisitor
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
omnetpp::cAbstractTextFigure::getOpacity
virtual double getOpacity() const
Definition: ccanvas.h:2501
omnetpp::cArcFigure::dup
virtual cArcFigure * dup() const override
Definition: ccanvas.h:1187
omnetpp::cPixmapFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2956
omnetpp::cPolygonFigure
A figure that displays a (closed) polygon, determined by a sequence of points.
Definition: ccanvas.h:1868
omnetpp::cCanvas::getFigure
virtual cFigure * getFigure(int pos) const
Definition: ccanvas.h:3143
omnetpp::cCanvas
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:3023
omnetpp::cFigure::dup
virtual cFigure * dup() const override
Definition: ccanvas.h:431
omnetpp::cTextFigure
A figure that displays text which is affected by zooming and transformations.
Definition: ccanvas.h:2563
omnetpp::cLineFigure::getEnd
virtual const Point & getEnd() const
Definition: ccanvas.h:1139
omnetpp::cFigure::containsFigures
virtual bool containsFigures() const
Definition: ccanvas.h:601
omnetpp::cAbstractImageFigure::getTintAmount
virtual double getTintAmount() const
Definition: ccanvas.h:2804
omnetpp::cCanvas::getRootFigure
virtual cFigure * getRootFigure() const
Definition: ccanvas.h:3087
omnetpp::cFigure::Color
Represents an RGB color.
Definition: ccanvas.h:124
omnetpp::cAbstractShapeFigure::dup
virtual cAbstractShapeFigure * dup() const override
Definition: ccanvas.h:1416
omnetpp::cCanvas::getNumFigures
virtual int getNumFigures() const
Definition: ccanvas.h:3136
omnetpp::cCanvas::findFigure
virtual int findFigure(const char *name) const
Definition: ccanvas.h:3119
omnetpp::cAbstractShapeFigure
Abstract base class for various shapes.
Definition: ccanvas.h:1389
omnetpp::cPathFigure::getNumPathItems
virtual int getNumPathItems() const
Definition: ccanvas.h:2152
omnetpp::cIconFigure::dup
virtual cIconFigure * dup() const override
Definition: ccanvas.h:2918
omnetpp::cPathFigure::getPathItem
virtual const PathItem * getPathItem(int k) const
Definition: ccanvas.h:2159
omnetpp::cFigure::Transform
Homogeneous 2D transformation matrix.
Definition: ccanvas.h:218
omnetpp::cFigure::Font::typeface
std::string typeface
Typeface of the font. An empty string means the default font.
Definition: ccanvas.h:165
omnetpp::cPathFigure
A figure that displays a "path", a complex shape or line modeled after SVG paths.
Definition: ccanvas.h:2011
omnetpp::cAbstractShapeFigure::getLineStyle
virtual LineStyle getLineStyle() const
Definition: ccanvas.h:1471
omnetpp::cArcFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1191
omnetpp::cAbstractImageFigure::getOpacity
virtual double getOpacity() const
Definition: ccanvas.h:2778
omnetpp::cRectangleFigure::getCornerRy
virtual double getCornerRy() const
Definition: ccanvas.h:1606
omnetpp::cAbstractImageFigure::getTintColor
virtual const Color & getTintColor() const
Definition: ccanvas.h:2789
omnetpp::cFigure::getTags
virtual const char * getTags() const
Definition: ccanvas.h:544
omnetpp::cAbstractImageFigure::getHeight
virtual double getHeight() const
Definition: ccanvas.h:2729
omnetpp::cPieSliceFigure::getStartAngle
virtual double getStartAngle() const
Definition: ccanvas.h:1833
omnetpp::cFigure::findFigure
virtual int findFigure(const char *name) const
omnetpp::cProperties
A collection of properties (cProperty).
Definition: cproperties.h:34
omnetpp::cAbstractTextFigure::getPosition
virtual const Point & getPosition() const
Definition: ccanvas.h:2428
omnetpp::cFigure::getAssociatedObject
virtual cObject * getAssociatedObject() const
Definition: ccanvas.h:530
omnetpp::cPolylineFigure::getJoinStyle
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:1359
omnetpp::cCanvas::dup
virtual cCanvas * dup() const override
Definition: ccanvas.h:3057
omnetpp::cPanelFigure
Sets up an axis-aligned, unscaled coordinate system for children, canceling the effect of any transfo...
Definition: ccanvas.h:898
omnetpp::cRingFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1705
omnetpp::cFigure::getTooltip
virtual const char * getTooltip() const
Definition: ccanvas.h:514
omnetpp::cFigure::Pixmap
A rectangular RGBA pixel array.
Definition: ccanvas.h:280
omnetpp::cRingFigure
A figure that displays a ring, with explicitly controllable inner/outer radii.
Definition: ccanvas.h:1681
omnetpp::cPolylineFigure::getNumPoints
virtual int getNumPoints() const
Definition: ccanvas.h:1302
omnetpp::cPolygonFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1896
omnetpp::cTextFigure::dup
virtual cTextFigure * dup() const override
Definition: ccanvas.h:2577
omnetpp::cFigure::getNumFigures
virtual int getNumFigures() const
Definition: ccanvas.h:571
omnetpp::cArcFigure::getEndAngle
virtual double getEndAngle() const
Definition: ccanvas.h:1230
omnetpp::cPixmapFigure::getPixelColor
virtual const Color getPixelColor(int x, int y) const
Definition: ccanvas.h:2995
omnetpp::cAbstractShapeFigure::getLineWidth
virtual double getLineWidth() const
Definition: ccanvas.h:1484
omnetpp::cPanelFigure::getAnchorPoint
virtual const Point & getAnchorPoint() const
Definition: ccanvas.h:942
omnetpp::cRectangleFigure
A figure that displays a rectangle, with optionally rounded corners.
Definition: ccanvas.h:1541
omnetpp::cFigure::refreshDisplay
virtual void refreshDisplay()
Definition: ccanvas.h:829
omnetpp::cRingFigure::getBounds
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1713
omnetpp::cAbstractImageFigure::getInterpolation
virtual Interpolation getInterpolation() const
Definition: ccanvas.h:2766
omnetpp::cPolygonFigure::getPoints
virtual const std::vector< Point > & getPoints() const
Definition: ccanvas.h:1904
omnetpp::cCanvas::addFigure
virtual void addFigure(cFigure *figure, int pos)
Definition: ccanvas.h:3100
omnetpp::cLabelFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2612
omnetpp::cPolygonFigure::getSmooth
virtual bool getSmooth() const
Definition: ccanvas.h:1953
omnetpp::cPixmapFigure::getPixelOpacity
virtual double getPixelOpacity(int x, int y) const
Definition: ccanvas.h:2999
omnetpp::cTextFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2578
omnetpp::cAbstractShapeFigure::getLineOpacity
virtual double getLineOpacity() const
Definition: ccanvas.h:1497
omnetpp::cImageFigure
A figure that displays an image, typically an icon or a background image, loaded from the OMNeT++ ima...
Definition: ccanvas.h:2827
omnetpp::cPixmapFigure::getPixel
virtual const RGBA getPixel(int x, int y) const
Definition: ccanvas.h:2989
omnetpp::cCanvas::getFigureByPath
virtual cFigure * getFigureByPath(const char *path) const
Definition: ccanvas.h:3173
omnetpp::cGroupFigure::moveLocal
virtual void moveLocal(double dx, double dy) override
Definition: ccanvas.h:881
omnetpp::cAbstractImageFigure::getPosition
virtual const Point & getPosition() const
Definition: ccanvas.h:2688
omnetpp::cAbstractLineFigure::getLineColor
virtual const Color & getLineColor() const
Definition: ccanvas.h:999
omnetpp::cAbstractLineFigure::getLineWidth
virtual double getLineWidth() const
Definition: ccanvas.h:1011
omnetpp::cFigure::getFigureByPath
virtual cFigure * getFigureByPath(const char *path) const
omnetpp::cIconFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2919
omnetpp::cFigure::Point
Represents a point as (x,y) coordinates.
Definition: ccanvas.h:67
omnetpp::cPathFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2070
omnetpp::cPixmapFigure::getPixmapWidth
virtual int getPixmapWidth() const
Definition: ccanvas.h:2979
omnetpp::cFigure::getTransform
virtual const Transform & getTransform() const
Definition: ccanvas.h:468
omnetpp::cAbstractTextFigure::getAlignment
virtual Alignment getAlignment() const
Definition: ccanvas.h:2458
omnetpp::cArcFigure::getStartAngle
virtual double getStartAngle() const
Definition: ccanvas.h:1218
omnetpp::cOvalFigure
A figure that draws a circle or ellipse.
Definition: ccanvas.h:1625
omnetpp::cAbstractLineFigure
Common base class for line figures.
Definition: ccanvas.h:964
omnetpp::cAbstractShapeFigure::isFilled
virtual bool isFilled() const
Definition: ccanvas.h:1426
omnetpp::cCanvas::removeFigure
virtual cFigure * removeFigure(int pos)
Definition: ccanvas.h:3112
omnetpp::cAbstractShapeFigure::getZoomLineWidth
virtual bool getZoomLineWidth() const
Definition: ccanvas.h:1521
omnetpp::cImageFigure::dup
virtual cImageFigure * dup() const override
Definition: ccanvas.h:2847
omnetpp::cGroupFigure
A figure with the sole purpose of grouping its children, and no visual representation.
Definition: ccanvas.h:864
omnetpp::cPathFigure::getFillRule
virtual FillRule getFillRule() const
Definition: ccanvas.h:2103
omnetpp::cPieSliceFigure
A figure that displays a pie slice, that is, a section of an axis-aligned disc or filled ellipse.
Definition: ccanvas.h:1782
omnetpp::opp_pooledstring
Definition: opp_pooledstring.h:63
omnetpp::cPieSliceFigure::getBounds
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1815
omnetpp::cAbstractTextFigure::getFont
virtual const Font & getFont() const
Definition: ccanvas.h:2530
omnetpp::cPanelFigure::moveLocal
virtual void moveLocal(double dx, double dy) override
Definition: ccanvas.h:925
omnetpp::cRectangleFigure::getCornerRx
virtual double getCornerRx() const
Definition: ccanvas.h:1595
omnetpp::cAbstractShapeFigure::isOutlined
virtual bool isOutlined() const
Definition: ccanvas.h:1437
omnetpp::cAbstractImageFigure::setSize
virtual void setSize(double width, double height)
Definition: ccanvas.h:2743
omnetpp::cFigure::FontStyle
FontStyle
Font style constants: FONT_NONE, FONT_BOLD, etc.
Definition: ccanvas.h:180
omnetpp::cRectangleFigure::getBounds
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1573
omnetpp::cFigure::isVisible
virtual bool isVisible() const
Definition: ccanvas.h:456
omnetpp::cLineFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1121
omnetpp::cLabelFigure::dup
virtual cLabelFigure * dup() const override
Definition: ccanvas.h:2610
omnetpp::cCanvas::getBackgroundColor
virtual const cFigure::Color & getBackgroundColor() const
Definition: ccanvas.h:3067
omnetpp::cArcFigure
A figure that displays an arc.
Definition: ccanvas.h:1167
omnetpp::cRuntimeError
Thrown when the simulation kernel or other components detect a runtime error.
Definition: cexception.h:286
omnetpp::cCanvas::setBackgroundColor
virtual void setBackgroundColor(const cFigure::Color &color)
Definition: ccanvas.h:3072
omnetpp::cAbstractTextFigure::getText
virtual const char * getText() const
Definition: ccanvas.h:2545
omnetpp::cFigure::Interpolation
Interpolation
Image interpolation mode constants: INTERPOLATION_NONE, INTERPOLATION_FAST, etc.
Definition: ccanvas.h:198
omnetpp::cFigure::Arrowhead
Arrowhead
Arrowhead style constants: ARROW_NONE, ARROW_SIMPLE, etc.
Definition: ccanvas.h:195
omnetpp::cPixmapFigure::getPixmap
virtual const Pixmap & getPixmap() const
Definition: ccanvas.h:2968
omnetpp::cPolygonFigure::getFillRule
virtual FillRule getFillRule() const
Definition: ccanvas.h:1982
omnetpp::cArcFigure::getBounds
virtual const Rectangle & getBounds() const
Definition: ccanvas.h:1200
omnetpp::cOvalFigure::dup
virtual cOvalFigure * dup() const override
Definition: ccanvas.h:1644
omnetpp::cFigure::LineStyle
LineStyle
Line style constants: LINE_SOLID, LINE_DOTTED, etc.
Definition: ccanvas.h:183
omnetpp::cPolylineFigure
A figure that displays a line that consists of multiple connecting straight line segments or of a sin...
Definition: ccanvas.h:1257
omnetpp::cCanvas::hasFigures
virtual bool hasFigures() const
Definition: ccanvas.h:3131
omnetpp::cAbstractImageFigure::getWidth
virtual double getWidth() const
Definition: ccanvas.h:2715
omnetpp::cFigure::Rectangle
Represents a rectangle as an (x,y,width,height) tuple.
Definition: ccanvas.h:94
omnetpp::cProperty
Stores a (NED) property with its (possibly compound) value.
Definition: cproperty.h:38
omnetpp::cPolygonFigure::dup
virtual cPolygonFigure * dup() const override
Definition: ccanvas.h:1892
omnetpp::cPathFigure::getJoinStyle
virtual JoinStyle getJoinStyle() const
Definition: ccanvas.h:2078
omnetpp::cOvalFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1648
omnetpp::cAbstractTextFigure::getColor
virtual const Color & getColor() const
Definition: ccanvas.h:2491
omnetpp::cFigure::Anchor
Anchor
Anchoring mode constants: ANCHOR_CENTER, ANCHOR_N, etc.
Definition: ccanvas.h:201
omnetpp::cImageFigure::getImageName
virtual const char * getImageName() const
Definition: ccanvas.h:2858
omnetpp::cCanvas::addFigure
virtual void addFigure(cFigure *figure)
Definition: ccanvas.h:3092
omnetpp::cImageFigure::getImageNaturalHeight
virtual int getImageNaturalHeight() const
Definition: ccanvas.h:2890
omnetpp::cPolylineFigure::getPoints
virtual const std::vector< Point > & getPoints() const
Definition: ccanvas.h:1292
omnetpp::cGroupFigure::dup
virtual cGroupFigure * dup() const override
Definition: ccanvas.h:878
omnetpp::cPanelFigure::move
virtual void move(double dx, double dy) override
Definition: ccanvas.h:924
omnetpp::cIconFigure
A figure that displays an image, typically an icon or a background image, loaded from the OMNeT++ ima...
Definition: ccanvas.h:2904
omnetpp::cRectangleFigure::dup
virtual cRectangleFigure * dup() const override
Definition: ccanvas.h:1561
omnetpp::cPanelFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:922
omnetpp::cFigure::getParentFigure
virtual cFigure * getParentFigure() const
Definition: ccanvas.h:559
omnetpp::cPieSliceFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:1806
omnetpp::cCanvas::findFigureRecursively
virtual cFigure * findFigureRecursively(const char *name) const
Definition: ccanvas.h:3167
omnetpp::cAbstractShapeFigure::getLineColor
virtual const Color & getLineColor() const
Definition: ccanvas.h:1448
omnetpp::cAbstractImageFigure::dup
virtual cAbstractImageFigure * dup() const override
Definition: ccanvas.h:2673
omnetpp::cPolygonFigure::getPoint
virtual const Point & getPoint(int i) const
Definition: ccanvas.h:1920
omnetpp::cRectangleFigure::setCornerRadius
virtual void setCornerRadius(double r)
Definition: ccanvas.h:1590
omnetpp::cImageFigure::getRendererClassName
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2850
omnetpp::cFigure
A lightweight graphical object for cCanvas.
Definition: ccanvas.h:60
omnetpp::cPolylineFigure::getSmooth
virtual bool getSmooth() const
Definition: ccanvas.h:1343
omnetpp::cFigure::JoinStyle
JoinStyle
Line join style constants: JOIN_BEVEL, JOIN_MITER, etc.
Definition: ccanvas.h:189
omnetpp::cAbstractLineFigure::getStartArrowhead
virtual Arrowhead getStartArrowhead() const
Definition: ccanvas.h:1056
omnetpp::cOwnedObject
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:105
omnetpp::cFigure::FillRule
FillRule
Fill rule constants: FILL_EVENODD, FILL_NONZERO.
Definition: ccanvas.h:192
omnetpp::cLineFigure
A figure that displays a straight line segment.
Definition: ccanvas.h:1098
omnetpp::cRingFigure::getInnerRy
virtual double getInnerRy() const
Definition: ccanvas.h:1746