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 refreshTagBitsRec(
cCanvas *ownerCanvas);
379 int64_t getTagBits()
const {
return tagBits;}
380 void setTagBits(uint64_t tagBits) {this->tagBits = tagBits;}
383 void copy(
const cFigure& other);
391 explicit cFigure(
const char *name=
nullptr);
424 virtual void forEachChild(
cVisitor *v)
override;
429 virtual std::string str()
const override;
450 virtual void setVisible(
bool visible);
463 virtual void setTransform(
const Transform& transform);
488 virtual void setZIndex(
double zIndex);
496 virtual double getEffectiveZIndex()
const;
509 virtual void setTooltip(
const char *tooltip);
524 virtual void setAssociatedObject(
cObject *obj);
531 virtual const char *
getTags()
const {
return tags;}
538 virtual void setTags(
const char *tags);
553 virtual cCanvas *getCanvas()
const;
565 virtual cFigure *getFigure(
int pos)
const;
571 virtual cFigure *getFigure(
const char *name)
const;
577 virtual int findFigure(
const char *name)
const;
583 virtual int findFigure(
const cFigure *figure)
const;
594 virtual cFigure *findFigureRecursively(
const char *name)
const;
614 virtual cFigure *getFigureByPath(
const char *path)
const;
622 virtual void addFigure(
cFigure *figure);
630 virtual void addFigure(
cFigure *figure,
int pos);
656 virtual cFigure *removeFigure(
int pos);
662 virtual cFigure *removeFromParent();
673 virtual bool isAbove(
const cFigure *figure)
const;
681 virtual bool isBelow(
const cFigure *figure)
const;
695 virtual void insertAbove(
cFigure *referenceFigure);
709 virtual void insertBelow(
cFigure *referenceFigure);
716 virtual void insertAfter(
const cFigure *referenceFigure);
723 virtual void insertBefore(
const cFigure *referenceFigure);
731 virtual void raiseAbove(
cFigure *figure);
739 virtual void lowerBelow(
cFigure *figure);
747 virtual void raiseToTop();
755 virtual void lowerToBottom();
760 virtual cFigure *dupTree()
const;
765 virtual void translate(
double dx,
double dy) {transform.translate(dx,dy); fireTransformChange();}
766 virtual void scale(
double s) {transform.scale(s); fireTransformChange();}
767 virtual void scale(
double sx,
double sy) {transform.scale(sx,sy); fireTransformChange();}
768 virtual void scale(
double sx,
double sy,
double cx,
double cy) {transform.scale(sx,sy,cx,cy); fireTransformChange();}
769 virtual void scale(
double sx,
double sy,
const Point& c) {scale(sx, sy, c.x, c.y);}
770 virtual void rotate(
double phi) {transform.rotate(phi); fireTransformChange();}
771 virtual void rotate(
double phi,
double cx,
double cy) {transform.rotate(phi,cx,cy); fireTransformChange();}
772 virtual void rotate(
double phi,
const Point& c) {rotate(phi, c.x, c.y);}
773 virtual void skewx(
double coeff) {transform.skewx(coeff); fireTransformChange();}
774 virtual void skewy(
double coeff) {transform.skewy(coeff); fireTransformChange();}
775 virtual void skewx(
double coeff,
double cy) {transform.skewx(coeff,cy); fireTransformChange();}
776 virtual void skewy(
double coeff,
double cx) {transform.skewy(coeff,cx); fireTransformChange();}
803 virtual const char **getAllowedPropertyKeys()
const;
809 virtual void moveLocal(
double dx,
double dy) = 0;
817 virtual void move(
double dx,
double dy);
833 virtual const char *getRendererClassName()
const = 0;
838 namespace canvas_stream_ops {
839 #define STREAMOP(CLASS) inline std::ostream& operator<<(std::ostream& os, const CLASS& x) { return os << x.str(); } 876 virtual std::string str()
const override;
878 virtual void moveLocal(
double dx,
double dy)
override {}
901 virtual const char **getAllowedPropertyKeys()
const override;
902 virtual void parse(
cProperty *property)
override;
916 virtual std::string str()
const override;
918 virtual void updateParentTransform(
Transform& transform)
override;
919 virtual void move(
double dx,
double dy)
override { moveLocal(dx, dy); }
920 virtual void moveLocal(
double dx,
double dy)
override {position.x += dx; position.y += dy; fireTransformChange();}
925 virtual const Point& getPosition()
const {
return position;}
926 virtual void setPosition(
const Point& position) {this->position = position; fireTransformChange();}
938 virtual void setAnchorPoint(
const Point& anchorPoint) {this->anchorPoint = anchorPoint; fireTransformChange();}
967 Arrowhead startArrowhead, endArrowhead;
972 virtual const char **getAllowedPropertyKeys()
const override;
976 explicit cAbstractLineFigure(
const char *name=
nullptr) :
cFigure(name), lineColor(BLACK), lineStyle(LINE_SOLID), lineWidth(1), lineOpacity(1), capStyle(CAP_BUTT), startArrowhead(ARROW_NONE), endArrowhead(ARROW_NONE), zoomLineWidth(
false) {}
984 virtual std::string str()
const override;
985 virtual void parse(
cProperty *property)
override;
998 virtual void setLineColor(
const Color& lineColor);
1012 virtual void setLineWidth(
double lineWidth);
1023 virtual void setLineOpacity(
double lineOpacity);
1034 virtual void setLineStyle(LineStyle lineStyle);
1045 virtual void setCapStyle(CapStyle capStyle);
1056 virtual void setStartArrowhead(Arrowhead startArrowhead);
1067 virtual void setEndArrowhead(Arrowhead endArrowhead);
1080 virtual void setZoomLineWidth(
bool zoomLineWidth);
1099 virtual const char **getAllowedPropertyKeys()
const override;
1111 virtual std::string str()
const override;
1112 virtual void parse(
cProperty *property)
override;
1113 virtual void moveLocal(
double dx,
double dy)
override;
1127 virtual void setStart(
const Point& start);
1132 virtual const Point&
getEnd()
const {
return end;}
1137 virtual void setEnd(
const Point& end);
1164 double startAngle, endAngle;
1168 virtual const char **getAllowedPropertyKeys()
const override;
1180 virtual std::string str()
const override;
1181 virtual void parse(
cProperty *property)
override;
1182 virtual void moveLocal(
double dx,
double dy)
override;
1198 virtual void setBounds(
const Rectangle& bounds);
1204 virtual void setPosition(
const Point& position,
Anchor anchor);
1216 virtual void setStartAngle(
double startAngle);
1228 virtual void setEndAngle(
double endAngle);
1252 std::vector<Point> points;
1254 JoinStyle joinStyle;
1257 void checkIndex(
int i)
const;
1258 void checkInsIndex(
int i)
const;
1260 virtual const char **getAllowedPropertyKeys()
const override;
1272 virtual std::string str()
const override;
1273 virtual void parse(
cProperty *property)
override;
1274 virtual void moveLocal(
double dx,
double dy)
override;
1283 virtual const std::vector<Point>&
getPoints()
const {
return points;}
1288 virtual void setPoints(
const std::vector<Point>& points);
1299 virtual const Point&
getPoint(
int i)
const {checkIndex(i);
return points[i];}
1304 virtual void setPoint(
int i,
const Point& point);
1309 virtual void addPoint(
const Point& point);
1314 virtual void removePoint(
int i);
1320 virtual void insertPoint(
int i,
const Point& point);
1336 virtual void setSmooth(
bool smooth);
1350 virtual void setJoinStyle(JoinStyle joinStyle);
1381 LineStyle lineStyle;
1389 virtual const char **getAllowedPropertyKeys()
const override;
1393 explicit cAbstractShapeFigure(
const char *name=
nullptr) :
cFigure(name), outlined(
true), filled(
false), lineColor(BLACK), fillColor(BLUE), lineStyle(LINE_SOLID), lineWidth(1), lineOpacity(1), fillOpacity(1), zoomLineWidth(
false) {}
1401 virtual std::string str()
const override;
1402 virtual void parse(
cProperty *property)
override;
1416 virtual void setFilled(
bool filled);
1427 virtual void setOutlined(
bool outlined);
1438 virtual void setLineColor(
const Color& lineColor);
1450 virtual void setFillColor(
const Color& fillColor);
1461 virtual void setLineStyle(LineStyle lineStyle);
1475 virtual void setLineWidth(
double lineWidth);
1487 virtual void setLineOpacity(
double lineOpacity);
1499 virtual void setFillOpacity(
double fillOpacity);
1512 virtual void setZoomLineWidth(
bool zoomLineWidth);
1529 double cornerRx, cornerRy;
1531 virtual const char **getAllowedPropertyKeys()
const override;
1545 virtual std::string str()
const override;
1546 virtual void parse(
cProperty *property)
override;
1547 virtual void moveLocal(
double dx,
double dy)
override;
1561 virtual void setBounds(
const Rectangle& bounds);
1567 virtual void setPosition(
const Point& position,
Anchor anchor);
1584 virtual void setCornerRx(
double rx);
1595 virtual void setCornerRy(
double ry);
1615 virtual const char **getAllowedPropertyKeys()
const override;
1627 virtual std::string str()
const override;
1628 virtual void parse(
cProperty *property)
override;
1629 virtual void moveLocal(
double dx,
double dy)
override;
1643 virtual void setBounds(
const Rectangle& bounds);
1649 virtual void setPosition(
const Point& position,
Anchor anchor);
1667 double innerRx, innerRy;
1671 virtual const char **getAllowedPropertyKeys()
const override;
1683 virtual std::string str()
const override;
1684 virtual void parse(
cProperty *property)
override;
1685 virtual void moveLocal(
double dx,
double dy)
override;
1699 virtual void setBounds(
const Rectangle& bounds);
1705 virtual void setPosition(
const Point& position,
Anchor anchor);
1722 virtual void setInnerRx(
double rx);
1732 virtual void setInnerRy(
double ry);
1767 double startAngle, endAngle;
1771 virtual const char **getAllowedPropertyKeys()
const override;
1783 virtual std::string str()
const override;
1784 virtual void parse(
cProperty *property)
override;
1785 virtual void moveLocal(
double dx,
double dy)
override;
1801 virtual void setBounds(
const Rectangle& bounds);
1807 virtual void setPosition(
const Point& position,
Anchor anchor);
1819 virtual void setStartAngle(
double startAngle);
1831 virtual void setEndAngle(
double endAngle);
1851 std::vector<Point> points;
1857 void checkIndex(
int i)
const;
1858 void checkInsIndex(
int i)
const;
1860 virtual const char **getAllowedPropertyKeys()
const override;
1872 virtual std::string str()
const override;
1873 virtual void parse(
cProperty *property)
override;
1874 virtual void moveLocal(
double dx,
double dy)
override;
1883 virtual const std::vector<Point>&
getPoints()
const {
return points;}
1888 virtual void setPoints(
const std::vector<Point>& points);
1904 virtual void setPoint(
int i,
const Point& point);
1909 virtual void addPoint(
const Point& point);
1914 virtual void removePoint(
int i);
1920 virtual void insertPoint(
int i,
const Point& point);
1933 virtual void setSmooth(
bool smooth);
1947 virtual void setJoinStyle(
JoinStyle joinStyle);
1964 virtual void setFillRule(
FillRule fillRule);
1996 struct ArcTo :
PathItem {
double rx;
double ry;
double phi;
bool largeArc;
bool sweep;
double x;
double y; };
1997 struct ArcRel :
PathItem {
double rx;
double ry;
double phi;
bool largeArc;
bool sweep;
double dx;
double dy; };
2009 std::vector<PathItem*> path;
2010 mutable std::string cachedPathString;
2022 virtual const char **getAllowedPropertyKeys()
const override;
2036 virtual std::string str()
const override;
2037 virtual void parse(
cProperty *property)
override;
2041 virtual void moveLocal(
double dx,
double dy)
override;
2056 virtual void setJoinStyle(
JoinStyle joinStyle);
2067 virtual void setCapStyle(
CapStyle capStyle);
2085 virtual void setFillRule(
FillRule fillRule);
2104 virtual void setOffset(
const Point& offset);
2112 virtual const char *getPath()
const;
2119 virtual void setPath(
const char *path);
2136 virtual void clearPath();
2144 virtual void addMoveTo(
double x,
double y);
2153 virtual void addMoveRel(
double dx,
double dy);
2161 virtual void addLineTo(
double x,
double y);
2169 virtual void addLineRel(
double dx,
double dy);
2177 virtual void addHorizontalLineTo(
double x);
2185 virtual void addHorizontalLineRel(
double dx);
2193 virtual void addVerticalLineTo(
double y);
2201 virtual void addVerticalLineRel(
double dy);
2217 virtual void addArcTo(
double rx,
double ry,
double phi,
bool largeArc,
bool sweep,
double x,
double y);
2234 virtual void addArcRel(
double rx,
double ry,
double phi,
bool largeArc,
bool sweep,
double dx,
double dy);
2242 virtual void addCurveTo(
double x1,
double y1,
double x,
double y);
2251 virtual void addCurveRel(
double dx1,
double dy1,
double dx,
double dy);
2264 virtual void addSmoothCurveTo(
double x,
double y);
2277 virtual void addSmoothCurveRel(
double dx,
double dy);
2287 virtual void addCubicBezierCurveTo(
double x1,
double y1,
double x2,
double y2,
double x,
double y);
2298 virtual void addCubicBezierCurveRel(
double dx1,
double dy1,
double dx2,
double dy2,
double dx,
double dy);
2312 virtual void addSmoothCubicBezierCurveTo(
double x2,
double y2,
double x,
double y);
2326 virtual void addSmoothCubicBezierCurveRel(
double dx2,
double dy2,
double dx,
double dy);
2335 virtual void addClosePath();
2369 virtual const char **getAllowedPropertyKeys()
const override;
2373 explicit cAbstractTextFigure(
const char *name=
nullptr) :
cFigure(name), color(BLACK), opacity(1), halo(
false), anchor(ANCHOR_NW) {}
2381 virtual std::string str()
const override;
2382 virtual void parse(
cProperty *property)
override;
2386 virtual void moveLocal(
double dx,
double dy)
override;
2403 virtual void setPosition(
const Point& position);
2417 virtual void setAnchor(Anchor anchor);
2446 virtual void setColor(
const Color& color);
2457 virtual void setOpacity(
double opacity);
2475 virtual void setHalo(
bool enabled);
2480 virtual const Font&
getFont()
const {
return font;}
2487 virtual void setFont(Font font);
2495 virtual const char *
getText()
const {
return text.c_str();}
2501 virtual void setText(
const char* text);
2548 virtual const char **getAllowedPropertyKeys()
const override;
2560 virtual void parse(
cProperty *property)
override;
2566 virtual double getAngle()
const {
return angle;}
2567 virtual void setAngle(
double angle);
2601 double width, height;
2602 Interpolation interpolation;
2609 virtual const char **getAllowedPropertyKeys()
const override;
2610 virtual Point getDefaultSize()
const = 0;
2614 explicit cAbstractImageFigure(
const char *name=
nullptr) :
cFigure(name), anchor(ANCHOR_CENTER), width(0), height(0), interpolation(INTERPOLATION_FAST), opacity(1), tintColor(BLUE), tintAmount(0) { }
2622 virtual void parse(
cProperty *property)
override;
2626 virtual void moveLocal(
double dx,
double dy)
override;
2643 virtual void setPosition(
const Point& position);
2657 virtual void setAnchor(Anchor anchor);
2671 virtual void setWidth(
double width);
2685 virtual void setHeight(
double height);
2691 virtual void setSize(
double width,
double height) {setWidth(width); setHeight(height);}
2721 virtual void setInterpolation(Interpolation interpolation);
2732 virtual void setOpacity(
double opacity);
2746 virtual void setTintColor(
const Color& tintColor);
2762 virtual void setTintAmount(
double tintAmount);
2778 std::string imageName;
2782 virtual const char **getAllowedPropertyKeys()
const override;
2783 virtual Point getDefaultSize()
const override;
2795 virtual std::string str()
const override;
2796 virtual void parse(
cProperty *property)
override;
2813 virtual void setImageName(
const char* imageName);
2886 virtual const char **getAllowedPropertyKeys()
const override;
2887 virtual Point getDefaultSize()
const override;
2900 virtual std::string str()
const override;
2901 virtual void parse(
cProperty *property)
override;
2920 virtual void setPixmap(
const Pixmap& pixmap);
2927 virtual void setPixmapSize(
int width,
int height,
const RGBA& fill);
2929 virtual void setPixmapSize(
int width,
int height,
const Color& color,
double opacity);
2931 virtual void fillPixmap(
const RGBA& fill);
2933 virtual void fillPixmap(
const Color& color,
double opacity);
2935 virtual const RGBA getPixel(
int x,
int y)
const {
return pixmap.pixel(x, y);}
2937 virtual void setPixel(
int x,
int y,
const RGBA& argb);
2939 virtual void setPixel(
int x,
int y,
const Color& color,
double opacity = 1.0);
2943 virtual void setPixelColor(
int x,
int y,
const Color& color);
2947 virtual void setPixelOpacity(
int x,
int y,
double opacity);
2974 std::map<std::string,int> tagBitIndex;
2975 static std::map<std::string,cObjectFactory*> figureFactories;
2976 std::map<const cObject*,double> animationSpeedMap;
2977 double minAnimationSpeed;
2978 double animationHoldEndTime;
2982 virtual cFigure *createFigure(
const char *type)
const;
2983 static bool containsCanvasItems(
cProperties *properties);
2984 virtual void addFiguresFrom(
cProperties *properties);
2985 virtual uint64_t parseTags(
const char *s);
2986 virtual std::string getTags(uint64_t tagBits);
2987 const std::map<const cObject*,double>& getAnimationSpeedMap()
const {
return animationSpeedMap;}
2988 double getMinAnimationSpeed()
const {
return minAnimationSpeed;}
2989 double getAnimationHoldEndTime()
const {
return animationHoldEndTime;}
2991 void copy(
const cCanvas& other);
2995 explicit cCanvas(
const char *name =
nullptr);
3004 virtual void forEachChild(
cVisitor *v)
override;
3005 virtual std::string str()
const override;
3111 virtual cFigure *getSubmodulesLayer()
const;
3132 virtual std::string getAllTags()
const;
3138 virtual std::vector<std::string> getAllTagsAsVector()
const;
3158 virtual void setAnimationSpeed(
double animationSpeed,
const cObject *source);
3164 virtual double getAnimationSpeed(
const cObject *source);
3184 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:2528
virtual cAbstractTextFigure * dup() const override
Definition: ccanvas.h:2380
Thrown when the simulation kernel or other components detect a runtime error.
Definition: cexception.h:283
CapStyle
Line cap style constants: CAP_BUTT, CAP_SQUARE, etc.
Definition: ccanvas.h:180
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
virtual const Point & getPosition() const
Definition: ccanvas.h:2396
virtual double getOpacity() const
Definition: ccanvas.h:2451
FontStyle
Font style constants: FONT_NONE, FONT_BOLD, etc.
Definition: ccanvas.h:174
virtual cFigure * getFigureByPath(const char *path) const
Definition: ccanvas.h:3123
virtual const Font & getFont() const
Definition: ccanvas.h:2480
Interpolation
Image interpolation mode constants: INTERPOLATION_NONE, INTERPOLATION_FAST, etc.
Definition: ccanvas.h:192
Abstract base class for figures that display text. Text may be multi-line.
Definition: ccanvas.h:2356
virtual bool getHalo() const
Definition: ccanvas.h:2462
virtual cFigure * removeFigure(int pos)
Definition: ccanvas.h:3062
virtual cCanvas * dup() const override
Definition: ccanvas.h:3003
virtual cFigure * getRootFigure() const
Definition: ccanvas.h:3027
FillRule
Fill rule constants: FILL_EVENODD, FILL_NONZERO.
Definition: ccanvas.h:186
virtual const char * getText() const
Definition: ccanvas.h:2495
virtual const Color & getColor() const
Definition: ccanvas.h:2441
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:2969
Stores a (NED) property with its (possibly compound) value.
Definition: cproperty.h:38
virtual int findFigure(cFigure *figure) const
Definition: ccanvas.h:3075
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 int findFigure(const char *name) const
Definition: ccanvas.h:3069
virtual const cFigure::Color & getBackgroundColor() const
Definition: ccanvas.h:3013
virtual int getNumFigures() const
Definition: ccanvas.h:3086
virtual Anchor getAnchor() const
Definition: ccanvas.h:2410
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
LineStyle
Line style constants: LINE_SOLID, LINE_DOTTED, etc.
Definition: ccanvas.h:177
virtual bool hasFigures() const
Definition: ccanvas.h:3081
Definition: cabstracthistogram.h:21
A collection of properties (cProperty).
Definition: cproperties.h:34
virtual void addFigure(cFigure *figure, int pos)
Definition: ccanvas.h:3040
virtual cFigure * getFigure(const char *name) const
Definition: ccanvas.h:3099
JoinStyle
Line join style constants: JOIN_BEVEL, JOIN_MITER, etc.
Definition: ccanvas.h:183
virtual cTextFigure * dup() const override
Definition: ccanvas.h:2527
_OPPDEPRECATED void addFigureBelow(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3050
_OPPDEPRECATED void addFigureAbove(cFigure *figure, cFigure *referenceFigure)
Definition: ccanvas.h:3045
A figure that displays text which is affected by zooming and transformations.
Definition: ccanvas.h:2513
virtual void setBackgroundColor(const cFigure::Color &color)
Definition: ccanvas.h:3018
virtual void addFigure(cFigure *figure)
Definition: ccanvas.h:3032
Anchor
Anchoring mode constants: ANCHOR_CENTER, ANCHOR_N, etc.
Definition: ccanvas.h:195
virtual cFigure * getFigure(int pos) const
Definition: ccanvas.h:3093
virtual cFigure * findFigureRecursively(const char *name) const
Definition: ccanvas.h:3117
virtual cFigure * removeFigure(cFigure *figure)
Definition: ccanvas.h:3056
Reference-counted storage for strings.
Definition: cstringpool.h:36