import org.simantics.district.network.ontology.DistrictNetworkResource;
import org.simantics.district.network.ui.internal.Activator;
import org.simantics.district.network.ui.nodes.DistrictRenderingPreparationNode;
+import org.simantics.district.network.ui.nodes.DistrictSelectionNode;
import org.simantics.district.network.ui.participants.DNPointerInteractor;
import org.simantics.district.network.ui.participants.DynamicVisualisationContributionsParticipant;
import org.simantics.district.network.ui.participants.ElevationServerParticipant;
import org.simantics.g2d.diagram.handler.PickRequest.PickFilter;
import org.simantics.g2d.diagram.participant.DelayedBatchElementPainter;
import org.simantics.g2d.diagram.participant.ElementPainter;
+import org.simantics.g2d.diagram.participant.ElementPainterConfiguration;
import org.simantics.g2d.diagram.participant.Selection;
import org.simantics.g2d.diagram.participant.ZOrderHandler;
import org.simantics.g2d.participant.BackgroundPainter;
protected void addDiagramParticipants(ICanvasContext ctx) {
ctx.add(new ZOrderHandler());
ctx.add(new Selection());
- ctx.add(new ElementPainter());
+ ctx.add(new ElementPainter(new ElementPainterConfiguration().selectionNodeClass(DistrictSelectionNode.class)));
ctx.add(new DNPointerInteractor());
AffineTransform tr = new AffineTransform(MapScalingTransform.INSTANCE);
if (size == null)
size = new Rectangle2D.Double();
if (edge != null)
- size.setFrame(DistrictNetworkEdgeNode.calculatePath(edge, path.get(), false).getBounds2D());
+ size.setFrame(DistrictNetworkEdgeNode.calculatePath(edge, path.get(), true).getBounds2D());
else
LOGGER.debug("Element {} does not have edge!", e);
public Shape getElementShape(IElement e) {
DistrictNetworkEdge edge = e.getHint(KEY_DN_EDGE);
if (edge != null) {
- return DistrictNetworkEdgeNode.calculatePath(edge, null, false);
+ return DistrictNetworkEdgeNode.calculatePath(edge, null, true);
} else {
return getBounds(e, null);
}
}
private Rectangle2D calculateBounds(Rectangle2D rect) {
- return calculatePath(edge, null, false).getBounds2D();
+ return calculatePath(edge, null, true).getBounds2D();
}
public void setDNEdge(DistrictNetworkEdge edge) {
--- /dev/null
+package org.simantics.district.network.ui.nodes;
+
+import java.awt.geom.Rectangle2D;
+
+import org.simantics.scenegraph.g2d.G2DParentNode;
+import org.simantics.scenegraph.utils.GeometryUtils;
+
+/**
+ * Customized selection parent node that returns undefined bounds instead of
+ * <code>null</code> bounds to allow parent G2DNode to ignore these selection
+ * nodes that since they do not have any children in the District scene graph
+ * case.
+ *
+ * @author Tuukka Lehtonen
+ */
+public class DistrictSelectionNode extends G2DParentNode {
+
+ private static final long serialVersionUID = -6030674263538134789L;
+
+ @Override
+ public Rectangle2D getBoundsInLocal() {
+ return GeometryUtils.undefinedRectangle();
+ }
+
+}