SingleElementNode diagramParent;
RTreeNode elementParent;
- boolean paintSelectionFrames;
+ ElementPainterConfiguration cfg;
/**
* Internally reused to avert constant reallocation.
}
public ElementPainter(boolean paintSelectionFrames) {
- this.paintSelectionFrames = paintSelectionFrames;
+ this(new ElementPainterConfiguration().paintSelectionFrames(paintSelectionFrames));
+ }
+
+ public ElementPainter(ElementPainterConfiguration cfg) {
+ this.cfg = cfg;
}
@Override
Object task = BEGIN("EP.updateSelections");
try {
- if (!paintSelectionFrames)
+ if (!cfg.paintSelectionFrames)
return;
if (selection == null)
return;
Object task = BEGIN("EP.updateSelection");
try {
- if (!paintSelectionFrames)
+ if (!cfg.paintSelectionFrames)
return;
G2DParentNode elementNode = (G2DParentNode) el.getHint(ElementHints.KEY_SG_NODE);
Color color = getSelectionColor(selectionId);
G2DParentNode selectionsNode = getSelectionsNode(selectionId);
+ Class<? extends G2DParentNode> selectionNodeClass = cfg.selectionNodeClass != null ? cfg.selectionNodeClass : G2DParentNode.class;
+
for (IElement e : selection) {
Node elementNode = e.getHint(ElementHints.KEY_SG_NODE);
// System.out.println("selectionNode: " + elementNode + " " + e);
if (elementNode instanceof G2DParentNode) {
G2DParentNode en = (G2DParentNode) elementNode;
- G2DParentNode selectionNode = en.getOrCreateNode(NodeUtil.SELECTION_NODE_NAME, G2DParentNode.class);
+ G2DParentNode selectionNode = en.getOrCreateNode(NodeUtil.SELECTION_NODE_NAME, selectionNodeClass);
selectionNode.setZIndex(SELECTION_PAINT_PRIORITY);
if (selectionNodes != null)
selectionNodes.add(selectionNode);
return result;
}
+
+ /**
+ * We need to have separate class for SelectionNode, so that SCLSceneGraph can handle this properly.
+ *
+ */
+ public static class SelectionShapeNode extends ShapeNode {
+
+ private static final long serialVersionUID = -5393630944240940166L;
+
+ }
+
public void paintSelectionFrame(int selectionId, G2DParentNode elementNode, G2DParentNode selectionNode, final IElement e, Color color) {
// The element node already has the correct transform.
AffineTransform selectionTransform = ElementUtils.getTransform(e);// no it doesnt ... new AffineTransform();
Outline outline = (Outline) es.getAdapter(Outline.class);
if (outline == null || outline.getElementShape(e) == null)
continue;
- ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), ShapeNode.class);
+ ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), SelectionShapeNode.class);
// shapenode.setShape(es.getSelectionShape(e));
// shapenode.setStroke(SELECTION_STROKE);
// shapenode.setScaleStroke(true);
G2DParentNode shapeholder = selectionNode.getOrCreateNode(getNodeId("outlines", e), G2DParentNode.class);
for (SelectionOutline es : shapeHandlers) {
- ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), ShapeNode.class);
+ ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), SelectionShapeNode.class);
// shapenode.setShape(es.getSelectionShape(e));
// shapenode.setStroke(SELECTION_STROKE);
// shapenode.setScaleStroke(true);