16 #ifndef __OMNETPP_CCANVAS_H 17 #define __OMNETPP_CCANVAS_H 22 #include "cownedobject.h" 71 Point() : x(0), y(0) {}
72 Point(
double x,
double y) : x(x), y(y) {}
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;
93 double x, y, width, height;
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;
123 uint8_t red, green, blue;
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;
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;
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];
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;
174 enum FontStyle { FONT_NONE=0, FONT_BOLD=1, FONT_ITALIC=2, FONT_UNDERLINE=4 };
177 enum LineStyle { LINE_SOLID, LINE_DOTTED, LINE_DASHED };
189 enum Arrowhead { ARROW_NONE, ARROW_SIMPLE, ARROW_TRIANGLE, ARROW_BARBED };
192 enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_FAST, INTERPOLATION_BEST };
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 };
214 double a, b, c, d, t1, t2;
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) {}
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);}
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);}
230 Transform& rotate(
double phi,
double cx,
double cy);
231 Transform& rotate(
double phi,
const Point& c) {
return rotate(phi, c.x, c.y);}
234 Transform& skewx(
double coeff,
double cy);
235 Transform& skewy(
double coeff,
double cx);
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;
251 uint8_t red, green, blue, alpha;
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;
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);}
281 Pixmap(
int width,
int height);
282 Pixmap(
int width,
int height,
const RGBA& fill);
283 Pixmap(
int width,
int height,
const Color& color,
double opacity=1);
287 void setSize(
int width,
int height,
const RGBA& fill_);
288 void setSize(
int width,
int height,
const Color& color,
double opacity);
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;}
301 std::string str()
const;
307 CHANGE_STRUCTURAL = 1,
308 CHANGE_TRANSFORM = 2,
311 CHANGE_INPUTDATA = 16,
326 std::vector<cFigure*> children;
329 uint8_t localChanges;
330 uint8_t subtreeChanges;
334 virtual void validatePropertyKeys(
cProperty *property)
const;
335 virtual bool isAllowedPropertyKey(
const char *key)
const;
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);
346 static Point parsePoint(
cProperty *property,
const char *key,
int index);
347 static std::vector<Point> parsePoints(
cProperty *property,
const char *key);
353 static void concatArrays(
const char **dest,
const char **first,
const char **second);
357 static Point parsePoint(
const char *s);
358 static Rectangle parseRectangle(
const char *s);
359 static Transform parseTransform(
const char *s);
360 static Font parseFont(
const char *s);
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);
369 static Anchor parseAnchor(
const char *s);
373 virtual void updateParentTransform(
Transform& transform) {transform.rightMultiply(getTransform());}
374 virtual void callRefreshDisplay();
375 uint8_t getLocalChangeFlags()
const {
return localChanges;}
376 uint8_t getSubtreeChangeFlags()
const {
return subtreeChanges;}
377 void clearChangeFlags();
378 void refreshTagBits();
379 void refreshTagBitsRec();
380 int64_t getTagBits()
const {
return tagBits;}
381 void setTagBits(uint64_t tagBits) {this->tagBits = tagBits;}
384 void copy(
const cFigure& other);
392 explicit cFigure(
const char *name=
nullptr);
425 virtual void forEachChild(
cVisitor *v)
override;
430 virtual std::string str()
const override;
451 virtual void setVisible(
bool visible);
464 virtual void setTransform(
const Transform& transform);
489 virtual void setZIndex(
double zIndex);
497 virtual double getEffectiveZIndex()
const;
510 virtual void setTooltip(
const char *tooltip);
525 virtual void setAssociatedObject(
cObject *obj);
532 virtual const char *
getTags()
const {
return tags;}
539 virtual void setTags(
const char *tags);
554 virtual cCanvas *getCanvas()
const;
566 virtual cFigure *getFigure(
int pos)
const;
572 virtual cFigure *getFigure(
const char *name)
const;
578 virtual int findFigure(
const char *name)
const;
584 virtual int findFigure(
const cFigure *figure)
const;
595 virtual cFigure *findFigureRecursively(
const char *name)
const;
615 virtual cFigure *getFigureByPath(
const char *path)
const;
623 virtual void addFigure(
cFigure *figure);
631 virtual void addFigure(
cFigure *figure,
int pos);
657 virtual cFigure *removeFigure(
int pos);
663 virtual cFigure *removeFromParent();
674 virtual bool isAbove(
const cFigure *figure)
const;
682 virtual bool isBelow(
const cFigure *figure)
const;
696 virtual void insertAbove(
cFigure *referenceFigure);
710 virtual void insertBelow(
cFigure *referenceFigure);
717 virtual void insertAfter(
const cFigure *referenceFigure);
724 virtual void insertBefore(
const cFigure *referenceFigure);
732 virtual void raiseAbove(
cFigure *figure);
740 virtual void lowerBelow(
cFigure *figure);
748 virtual void raiseToTop();
756 virtual void lowerToBottom();
761 virtual cFigure *dupTree()
const;
766 virtual void translate(
double dx,
double dy) {transform.translate(dx,dy); fireTransformChange();}
767 virtual void scale(
double s) {transform.scale(s); fireTransformChange();}
768 virtual void scale(
double sx,
double sy) {transform.scale(sx,sy); fireTransformChange();}
769 virtual void scale(
double sx,
double sy,
double cx,
double cy) {transform.scale(sx,sy,cx,cy); fireTransformChange();}
770 virtual void scale(
double sx,
double sy,
const Point& c) {scale(sx, sy, c.x, c.y);}
771 virtual void rotate(
double phi) {transform.rotate(phi); fireTransformChange();}
772 virtual void rotate(
double phi,
double cx,
double cy) {transform.rotate(phi,cx,cy); fireTransformChange();}
773 virtual void rotate(
double phi,
const Point& c) {rotate(phi, c.x, c.y);}
774 virtual void skewx(
double coeff) {transform.skewx(coeff); fireTransformChange();}
775 virtual void skewy(
double coeff) {transform.skewy(coeff); fireTransformChange();}
776 virtual void skewx(
double coeff,
double cy) {transform.skewx(coeff,cy); fireTransformChange();}
777 virtual void skewy(
double coeff,
double cx) {transform.skewy(coeff,cx); fireTransformChange();}
804 virtual const char **getAllowedPropertyKeys()
const;
810 virtual void moveLocal(
double dx,
double dy) = 0;
818 virtual void move(
double dx,
double dy);
834 virtual const char *getRendererClassName()
const = 0;
839 namespace canvas_stream_ops {
840 #define STREAMOP(CLASS) inline std::ostream& operator<<(std::ostream& os, const CLASS& x) { return os << x.str(); } 877 virtual std::string str()
const override;
879 virtual void moveLocal(
double dx,
double dy)
override {}
902 virtual const char **getAllowedPropertyKeys()
const override;
903 virtual void parse(
cProperty *property)
override;
917 virtual std::string str()
const override;
919 virtual void updateParentTransform(
Transform& transform)
override;
920 virtual void move(
double dx,
double dy)
override { moveLocal(dx, dy); }
921 virtual void moveLocal(
double dx,
double dy)
override {position.x += dx; position.y += dy; fireTransformChange();}
926 virtual const Point& getPosition()
const {
return position;}
927 virtual void setPosition(
const Point& position) {this->position = position; fireTransformChange();}
939 virtual void setAnchorPoint(
const Point& anchorPoint) {this->anchorPoint = anchorPoint; fireTransformChange();}
968 Arrowhead startArrowhead, endArrowhead;
973 virtual const char **getAllowedPropertyKeys()
const override;
977 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) {}
985 virtual std::string str()
const override;
986 virtual void parse(
cProperty *property)
override;
999 virtual void setLineColor(
const Color& lineColor);
1013 virtual void setLineWidth(
double lineWidth);
1024 virtual void setLineOpacity(
double lineOpacity);
1035 virtual void setLineStyle(LineStyle lineStyle);
1046 virtual void setCapStyle(CapStyle capStyle);
1057 virtual void setStartArrowhead(Arrowhead startArrowhead);
1068 virtual void setEndArrowhead(Arrowhead endArrowhead);
1081 virtual void setZoomLineWidth(
bool zoomLineWidth);
1100 virtual const char **getAllowedPropertyKeys()
const override;
1112 virtual std::string str()
const override;
1113 virtual void parse(
cProperty *property)
override;
1114 virtual void moveLocal(
double dx,
double dy)
override;
1128 virtual void setStart(
const Point& start);
1133 virtual const Point&
getEnd()
const {
return end;}
1138 virtual void setEnd(
const Point& end);
1165 double startAngle, endAngle;
1169 virtual const char **getAllowedPropertyKeys()
const override;
1181 virtual std::string str()
const override;
1182 virtual void parse(
cProperty *property)
override;
1183 virtual void moveLocal(
double dx,
double dy)
override;
1199 virtual void setBounds(
const Rectangle& bounds);
1205 virtual void setPosition(
const Point& position,
Anchor anchor);
1217 virtual void setStartAngle(
double startAngle);
1229 virtual void setEndAngle(
double endAngle);
1253 std::vector<Point> points;
1255 JoinStyle joinStyle;
1258 void checkIndex(
int i)
const;
1259 void checkInsIndex(
int i)
const;
1261 virtual const char **getAllowedPropertyKeys()
const override;
1273 virtual std::string str()
const override;
1274 virtual void parse(
cProperty *property)
override;
1275 virtual void moveLocal(
double dx,
double dy)
override;
1284 virtual const std::vector<Point>&
getPoints()
const {
return points;}
1289 virtual void setPoints(
const std::vector<Point>& points);
1300 virtual const Point&
getPoint(
int i)
const {checkIndex(i);
return points[i];}
1305 virtual void setPoint(
int i,
const Point& point);
1310 virtual void addPoint(
const Point& point);
1315 virtual void removePoint(
int i);
1321 virtual void insertPoint(
int i,
const Point& point);
1337 virtual void setSmooth(
bool smooth);
1351 virtual void setJoinStyle(JoinStyle joinStyle);
1390 virtual const char **getAllowedPropertyKeys()
const override;
1394 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) {}
1402 virtual std::string str()
const override;
1403 virtual void parse(
cProperty *property)
override;
1417 virtual void setFilled(
bool filled);
1428 virtual void setOutlined(
bool outlined);
1439 virtual void setLineColor(
const Color& lineColor);
1451 virtual void setFillColor(
const Color& fillColor);
1462 virtual void setLineStyle(
LineStyle lineStyle);
1476 virtual void setLineWidth(
double lineWidth);
1488 virtual void setLineOpacity(
double lineOpacity);
1500 virtual void setFillOpacity(
double fillOpacity);
1513 virtual void setZoomLineWidth(
bool zoomLineWidth);
1530 double cornerRx, cornerRy;
1532 virtual const char **getAllowedPropertyKeys()
const override;
1546 virtual std::string str()
const override;
1547 virtual void parse(
cProperty *property)
override;
1548 virtual void moveLocal(
double dx,
double dy)
override;
1562 virtual void setBounds(
const Rectangle& bounds);
1568 virtual void setPosition(
const Point& position,
Anchor anchor);
1585 virtual void setCornerRx(
double rx);
1596 virtual void setCornerRy(
double ry);
1616 virtual const char **getAllowedPropertyKeys()
const override;
1628 virtual std::string str()
const override;
1629 virtual void parse(
cProperty *property)
override;
1630 virtual void moveLocal(
double dx,
double dy)
override;
1644 virtual void setBounds(
const Rectangle& bounds);
1650 virtual void setPosition(
const Point& position,
Anchor anchor);
1668 double innerRx, innerRy;
1672 virtual const char **getAllowedPropertyKeys()
const override;
1684 virtual std::string str()
const override;
1685 virtual void parse(
cProperty *property)
override;
1686 virtual void moveLocal(
double dx,
double dy)
override;
1700 virtual void setBounds(
const Rectangle& bounds);
1706 virtual void setPosition(
const Point& position,
Anchor anchor);
1723 virtual void setInnerRx(
double rx);
1733 virtual void setInnerRy(
double ry);
1768 double startAngle, endAngle;
1772 virtual const char **getAllowedPropertyKeys()
const override;
1784 virtual std::string str()
const override;
1785 virtual void parse(
cProperty *property)
override;
1786 virtual void moveLocal(
double dx,
double dy)
override;
1802 virtual void setBounds(
const Rectangle& bounds);
1808 virtual void setPosition(
const Point& position,
Anchor anchor);
1820 virtual void setStartAngle(
double startAngle);
1832 virtual void setEndAngle(
double endAngle);
1852 std::vector<Point> points;
1858 void checkIndex(
int i)
const;
1859 void checkInsIndex(
int i)
const;
1861 virtual const char **getAllowedPropertyKeys()
const override;
1873 virtual std::string str()
const override;
1874 virtual void parse(
cProperty *property)
override;
1875 virtual void moveLocal(
double dx,
double dy)
override;
1884 virtual const std::vector<Point>&
getPoints()
const {
return points;}
1889 virtual void setPoints(
const std::vector<Point>& points);
1905 virtual void setPoint(
int i,
const Point& point);
1910 virtual void addPoint(
const Point& point);
1915 virtual void removePoint(
int i);
1921 virtual void insertPoint(
int i,
const Point& point);
1934 virtual void setSmooth(
bool smooth);
1948 virtual void setJoinStyle(
JoinStyle joinStyle);
1965 virtual void setFillRule(
FillRule fillRule);
1997 struct ArcTo :
PathItem {
double rx;
double ry;
double phi;
bool largeArc;
bool sweep;
double x;
double y; };
1998 struct ArcRel :
PathItem {
double rx;
double ry;
double phi;
bool largeArc;
bool sweep;
double dx;
double dy; };
2010 std::vector<PathItem*> path;
2011 mutable std::string cachedPathString;
2023 virtual const char **getAllowedPropertyKeys()
const override;
2037 virtual std::string str()
const override;
2038 virtual void parse(
cProperty *property)
override;
2042 virtual void moveLocal(
double dx,
double dy)
override;
2057 virtual void setJoinStyle(
JoinStyle joinStyle);
2068 virtual void setCapStyle(
CapStyle capStyle);
2086 virtual void setFillRule(
FillRule fillRule);
2105 virtual void setOffset(
const Point& offset);
2113 virtual const char *getPath()
const;
2120 virtual void setPath(
const char *path);
2137 virtual void clearPath();
2145 virtual void addMoveTo(
double x,
double y);
2154 virtual void addMoveRel(
double dx,
double dy);
2162 virtual void addLineTo(
double x,
double y);
2170 virtual void addLineRel(
double dx,
double dy);
2178 virtual void addHorizontalLineTo(
double x);
2186 virtual void addHorizontalLineRel(
double dx);
2194 virtual void addVerticalLineTo(
double y);
2202 virtual void addVerticalLineRel(
double dy);
2218 virtual void addArcTo(
double rx,
double ry,
double phi,
bool largeArc,
bool sweep,
double x,
double y);
2235 virtual void addArcRel(
double rx,
double ry,
double phi,
bool largeArc,
bool sweep,
double dx,
double dy);
2243 virtual void addCurveTo(
double x1,
double y1,
double x,
double y);
2252 virtual void addCurveRel(
double dx1,
double dy1,
double dx,
double dy);
2265 virtual void addSmoothCurveTo(
double x,
double y);
2278 virtual void addSmoothCurveRel(
double dx,
double dy);
2288 virtual void addCubicBezierCurveTo(
double x1,
double y1,
double x2,
double y2,
double x,
double y);
2299 virtual void addCubicBezierCurveRel(
double dx1,
double dy1,
double dx2,
double dy2,
double dx,
double dy);
2313 virtual void addSmoothCubicBezierCurveTo(
double x2,
double y2,
double x,
double y);
2327 virtual void addSmoothCubicBezierCurveRel(
double dx2,
double dy2,
double dx,
double dy);
2336 virtual void addClosePath();
2370 virtual const char **getAllowedPropertyKeys()
const override;
2374 explicit cAbstractTextFigure(
const char *name=
nullptr) :
cFigure(name), color(BLACK), opacity(1), halo(
false), anchor(ANCHOR_NW) {}
2382 virtual std::string str()
const override;
2383 virtual void parse(
cProperty *property)
override;
2387 virtual void moveLocal(
double dx,
double dy)
override;
2404 virtual void setPosition(
const Point& position);
2418 virtual void setAnchor(
Anchor anchor);
2447 virtual void setColor(
const Color& color);
2458 virtual void setOpacity(
double opacity);
2476 virtual void setHalo(
bool enabled);
2488 virtual void setFont(
Font font);
2496 virtual const char *
getText()
const {
return text.c_str();}
2502 virtual void setText(
const char* text);
2591 double width, height;
2592 Interpolation interpolation;
2599 virtual const char **getAllowedPropertyKeys()
const override;
2600 virtual Point getDefaultSize()
const = 0;
2604 explicit cAbstractImageFigure(
const char *name=
nullptr) :
cFigure(name), anchor(ANCHOR_CENTER), width(0), height(0), interpolation(INTERPOLATION_FAST), opacity(1), tintColor(BLUE), tintAmount(0) { }
2612 virtual void parse(
cProperty *property)
override;
2616 virtual void moveLocal(
double dx,
double dy)
override;
2633 virtual void setPosition(
const Point& position);
2647 virtual void setAnchor(Anchor anchor);
2661 virtual void setWidth(
double width);
2675 virtual void setHeight(
double height);
2681 virtual void setSize(
double width,
double height) {setWidth(width); setHeight(height);}
2711 virtual void setInterpolation(Interpolation interpolation);
2722 virtual void setOpacity(
double opacity);
2736 virtual void setTintColor(
const Color& tintColor);
2752 virtual void setTintAmount(
double tintAmount);
2768 std::string imageName;
2772 virtual const char **getAllowedPropertyKeys()
const override;
2773 virtual Point getDefaultSize()
const override;
2785 virtual std::string str()
const override;
2786 virtual void parse(
cProperty *property)
override;
2803 virtual void setImageName(
const char* imageName);
2876 virtual const char **getAllowedPropertyKeys()
const override;
2877 virtual Point getDefaultSize()
const override;
2890 virtual std::string str()
const override;
2891 virtual void parse(
cProperty *property)
override;
2910 virtual void setPixmap(
const Pixmap& pixmap);
2917 virtual void setPixmapSize(
int width,
int height,
const RGBA& fill);
2919 virtual void setPixmapSize(
int width,
int height,
const Color& color,
double opacity);
2921 virtual void fillPixmap(
const RGBA& fill);
2923 virtual void fillPixmap(
const Color& color,
double opacity);
2925 virtual const RGBA getPixel(
int x,
int y)
const {
return pixmap.pixel(x, y);}
2927 virtual void setPixel(
int x,
int y,
const RGBA& argb);
2929 virtual void setPixel(
int x,
int y,
const Color& color,
double opacity = 1.0);
2933 virtual void setPixelColor(
int x,
int y,
const Color& color);
2937 virtual void setPixelOpacity(
int x,
int y,
double opacity);
2964 std::map<std::string,int> tagBitIndex;
2965 static std::map<std::string,cObjectFactory*> figureFactories;
2966 std::map<const cObject*,double> animationSpeedMap;
2967 double animationHoldEndTime;
2971 virtual cFigure *createFigure(
const char *type)
const;
2972 static bool containsCanvasItems(
cProperties *properties);
2973 virtual void addFiguresFrom(
cProperties *properties);
2974 virtual uint64_t parseTags(
const char *s);
2975 virtual std::string getTags(uint64_t tagBits);
2976 const std::map<const cObject*,double>& getAnimationSpeedMap()
const {
return animationSpeedMap;}
2977 double getAnimationHoldEndTime()
const {
return animationHoldEndTime;}
2979 void copy(
const cCanvas& other);
2983 explicit cCanvas(
const char *name =
nullptr);
2992 virtual void forEachChild(
cVisitor *v)
override;
2993 virtual std::string str()
const override;
3099 virtual cFigure *getSubmodulesLayer()
const;
3120 virtual std::string getAllTags()
const;
3126 virtual std::vector<std::string> getAllTagsAsVector()
const;
3146 virtual void setAnimationSpeed(
double animationSpeed,
const cObject *source);
3152 virtual double getAnimationSpeed(
const cObject *source);
3172 virtual void holdSimulationFor(
double animationTimeDelta);
Arrowhead
Arrowhead style constants: ARROW_NONE, ARROW_SIMPLE, etc.
Definition: ccanvas.h:189
virtual const char * getRendererClassName() const override
Definition: ccanvas.h:2529
virtual cAbstractTextFigure * dup() const override
Definition: ccanvas.h:2381
Thrown when the simulation kernel or other components detect a runtime error.
Definition: cexception.h:282
virtual Anchor getAnchor() const
Definition: ccanvas.h:2411
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
FontStyle
Font style constants: FONT_NONE, FONT_BOLD, etc.
Definition: ccanvas.h:174
Interpolation
Image interpolation mode constants: INTERPOLATION_NONE, INTERPOLATION_FAST, etc.
Definition: ccanvas.h:192
virtual int findFigure(cFigure *figure) const
Definition: ccanvas.h:3063
Abstract base class for figures that display text. Text may be multi-line.
Definition: ccanvas.h:2357
virtual int getNumFigures() const
Definition: ccanvas.h:3074
virtual cFigure * removeFigure(int pos)
Definition: ccanvas.h:3050
virtual cCanvas * dup() const override
Definition: ccanvas.h:2991
virtual cFigure * getRootFigure() const
Definition: ccanvas.h:3015
virtual cFigure * findFigureRecursively(const char *name) const
Definition: ccanvas.h:3105
virtual const Color & getColor() const
Definition: ccanvas.h:2442
FillRule
Fill rule constants: FILL_EVENODD, FILL_NONZERO.
Definition: ccanvas.h:186
virtual bool hasFigures() const
Definition: ccanvas.h:3069
virtual cFigure * getFigure(int pos) const
Definition: ccanvas.h:3081
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:2959
Stores a (NED) property with its (possibly compound) value.
Definition: cproperty.h:38
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 const cFigure::Color & getBackgroundColor() const
Definition: ccanvas.h:3001
virtual cFigure * getFigureByPath(const char *path) const
Definition: ccanvas.h:3111
virtual double getOpacity() const
Definition: ccanvas.h:2452
virtual int findFigure(const char *name) const
Definition: ccanvas.h:3057
virtual cFigure * getFigure(const char *name) const
Definition: ccanvas.h:3087
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
LineStyle
Line style constants: LINE_SOLID, LINE_DOTTED, etc.
Definition: ccanvas.h:177
Definition: cabstracthistogram.h:21
A collection of properties (cProperty).
Definition: cproperties.h:34
virtual const Point & getPosition() const
Definition: ccanvas.h:2397
virtual void addFigure(cFigure *figure, int pos)
Definition: ccanvas.h:3028
virtual const Font & getFont() const
Definition: ccanvas.h:2481
JoinStyle
Line join style constants: JOIN_BEVEL, JOIN_MITER, etc.
Definition: ccanvas.h:183
virtual cTextFigure * dup() const override
Definition: ccanvas.h:2528
_OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3038
_OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3033
A figure that displays text which is affected by zooming and transformations.
Definition: ccanvas.h:2514
virtual void setBackgroundColor(const cFigure::Color &color)
Definition: ccanvas.h:3006
virtual void addFigure(cFigure *figure)
Definition: ccanvas.h:3020
Anchor
Anchoring mode constants: ANCHOR_CENTER, ANCHOR_N, etc.
Definition: ccanvas.h:195
virtual const char * getText() const
Definition: ccanvas.h:2496
virtual cFigure * removeFigure(cFigure *figure)
Definition: ccanvas.h:3044
virtual bool getHalo() const
Definition: ccanvas.h:2463
Reference-counted storage for strings.
Definition: cstringpool.h:36