Skip to content

Commit bb3ab37

Browse files
committed
NetworkNodeCanvasVisualization: topLeft -> figureOffset
1 parent 88462be commit bb3ab37

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/inet/visualizer/canvas/scene/NetworkNodeCanvasVisualization.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ namespace visualizer {
1919
NetworkNodeCanvasVisualization::Annotation::Annotation(cFigure *figure, const cFigure::Point& size, Placement placementHint, double placementPriority) :
2020
figure(figure),
2121
bounds(cFigure::Rectangle(NaN, NaN, size.x, size.y)),
22-
topLeft(0.0, 0.0),
22+
figureOffset(0.0, 0.0),
2323
placementHint(placementHint),
2424
placementPriority(placementPriority)
2525
{
2626
}
2727

28-
NetworkNodeCanvasVisualization::Annotation::Annotation(cFigure *figure, const cFigure::Point& topLeft, const cFigure::Point& size, Placement placementHint, double placementPriority) :
28+
NetworkNodeCanvasVisualization::Annotation::Annotation(cFigure *figure, const cFigure::Rectangle& bounds,Placement placementHint, double placementPriority) :
2929
figure(figure),
30-
bounds(cFigure::Rectangle(NaN, NaN, size.x, size.y)),
31-
topLeft(topLeft),
30+
bounds(cFigure::Rectangle(NaN, NaN, bounds.width, bounds.height)),
31+
figureOffset(-bounds.x, -bounds.y),
3232
placementHint(placementHint),
3333
placementPriority(placementPriority)
3434
{
@@ -68,7 +68,7 @@ void NetworkNodeCanvasVisualization::refreshDisplay()
6868

6969
void NetworkNodeCanvasVisualization::addAnnotation(cFigure *figure, cFigure::Rectangle bounds, Placement placementHint, double placementPriority)
7070
{
71-
annotations.push_back(Annotation(figure, cFigure::Point(bounds.x, bounds.y), bounds.getSize(), placementHint, placementPriority));
71+
annotations.push_back(Annotation(figure, bounds, placementHint, placementPriority));
7272
annotationFigure->addFigure(figure);
7373
isLayoutInvalid = true;
7474
}
@@ -337,7 +337,7 @@ void NetworkNodeCanvasVisualization::layout()
337337
// store position and rectangle
338338
annotation.bounds.x = bestRc.x + annotationSpacing / 2;
339339
annotation.bounds.y = bestRc.y + annotationSpacing / 2;
340-
annotation.figure->setTransform(cFigure::Transform().translate(annotation.bounds.x - annotation.topLeft.x, annotation.bounds.y - annotation.topLeft.y));
340+
annotation.figure->setTransform(cFigure::Transform().translate(annotation.bounds.x + annotation.figureOffset.x, annotation.bounds.y + annotation.figureOffset.y));
341341

342342
// delete candidate points covered by best rc
343343
for (auto j = pts.begin(); j != pts.end();) {

src/inet/visualizer/canvas/scene/NetworkNodeCanvasVisualization.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class INET_API NetworkNodeCanvasVisualization : public NetworkNodeVisualizerBase
2222
public:
2323
cFigure *figure;
2424
cFigure::Rectangle bounds;
25-
cFigure::Point topLeft;
25+
cFigure::Point figureOffset;
2626
Placement placementHint;
2727
double placementPriority;
2828

2929
public:
3030
Annotation(cFigure *figure, const cFigure::Point& size, Placement placement, double placementPriority);
31-
Annotation(cFigure *figure, const cFigure::Point& topLeft, const cFigure::Point& size, Placement placement, double placementPriority);
31+
Annotation(cFigure *figure, const cFigure::Rectangle& bounds, Placement placement, double placementPriority);
3232

3333
static bool comparePlacementPriority(const Annotation& a1, const Annotation& a2);
3434
};

0 commit comments

Comments
 (0)