+ return bounds;
+ }
+
+ private void updateBounds() {
+ Rectangle2D oldBounds = bounds;
+ if (oldBounds == null)
+ oldBounds = new Rectangle2D.Double();
+ bounds = calculateBounds(oldBounds);
+ }
+
+ @Override
+ public void setTransform(AffineTransform transform) {
+ super.setTransform(transform);
+ // Update bounds
+ updateBounds();
+ }
+
+ @Override
+ public AffineTransform getTransform() {
+ return super.getTransform();
+ }
+
+ private Rectangle2D calculateBounds(Rectangle2D rect) {
+ Point2D calcPoint = DistrictNetworkNodeUtils.calculatePoint2D(vertex.getPoint(), point);
+ AffineTransform at = getTransform();
+ double x = calcPoint.getX();
+ double y = calcPoint.getY();
+ double widthh = width / at.getScaleX();
+ double heighth = height / at.getScaleY();
+ return new Rectangle2D.Double(x - widthh, y - heighth, widthh * 2, heighth * 2).getBounds2D();