@@ -19,6 +19,16 @@ namespace visualizer {
1919NetworkNodeCanvasVisualization::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 ),
23+ placementHint (placementHint),
24+ placementPriority (placementPriority)
25+ {
26+ }
27+
28+ NetworkNodeCanvasVisualization::Annotation::Annotation (cFigure *figure, const cFigure::Point& topLeft, const cFigure::Point& size, Placement placementHint, double placementPriority) :
29+ figure (figure),
30+ bounds (cFigure::Rectangle(NaN, NaN, size.x, size.y)),
31+ topLeft (topLeft),
2232 placementHint (placementHint),
2333 placementPriority (placementPriority)
2434{
@@ -56,9 +66,9 @@ void NetworkNodeCanvasVisualization::refreshDisplay()
5666 }
5767}
5868
59- void NetworkNodeCanvasVisualization::addAnnotation (cFigure *figure, cFigure::Point size , Placement placementHint, double placementPriority)
69+ void NetworkNodeCanvasVisualization::addAnnotation (cFigure *figure, cFigure::Rectangle bounds , Placement placementHint, double placementPriority)
6070{
61- annotations.push_back (Annotation (figure, size , placementHint, placementPriority));
71+ annotations.push_back (Annotation (figure, cFigure::Point (bounds. x , bounds. y ), bounds. getSize () , placementHint, placementPriority));
6272 annotationFigure->addFigure (figure);
6373 isLayoutInvalid = true ;
6474}
@@ -327,7 +337,7 @@ void NetworkNodeCanvasVisualization::layout()
327337 // store position and rectangle
328338 annotation.bounds .x = bestRc.x + annotationSpacing / 2 ;
329339 annotation.bounds .y = bestRc.y + annotationSpacing / 2 ;
330- annotation.figure ->setTransform (cFigure::Transform ().translate (annotation.bounds .x , annotation.bounds .y ));
340+ annotation.figure ->setTransform (cFigure::Transform ().translate (annotation.bounds .x - annotation. topLeft . x , annotation.bounds . y - annotation. topLeft .y ));
331341
332342 // delete candidate points covered by best rc
333343 for (auto j = pts.begin (); j != pts.end ();) {
0 commit comments