public class DistrictNetworkEdgeElement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DistrictNetworkEdgeElement.class);
+
public static final Key KEY_DN_EDGE = new KeyOf(DistrictNetworkEdge.class, "DN_EDGE");
public static final Key KEY_DN_EDGE_NODE = new SceneGraphNodeKey(DistrictNetworkEdgeNode.class, "DN_EDGE_NODE");
public static final Key KEY_DN_EDGE_SYMBOL_NODE = new SceneGraphNodeKey(DistrictNetworkEdgeNode.class, "DN_EDGE_SYMBOL_NODE");
@Override
public void init(IElement edgeElement, G2DParentNode parent) {
- DistrictNetworkEdge edge = edgeElement.getHint(KEY_DN_EDGE);
- if (edge == null) {
- cleanup(edgeElement);
- } else {
- DistrictNetworkEdgeNode node = edgeElement.getHint(KEY_DN_EDGE_NODE);
- if (node == null) {
- node = parent.addNode(ElementUtils.generateNodeId(edgeElement), DistrictNetworkEdgeNode.class);
- edgeElement.setHint(KEY_DN_EDGE_NODE, node);
+ try {
+ DistrictNetworkEdge edge = edgeElement.getHint(KEY_DN_EDGE);
+ if (edge == null) {
+ cleanup(edgeElement);
+ } else {
+ DistrictNetworkEdgeNode node = edgeElement.getHint(KEY_DN_EDGE_NODE);
+ if (node == null) {
+ node = parent.addNode(ElementUtils.generateNodeId(edgeElement), DistrictNetworkEdgeNode.class);
+ edgeElement.setHint(KEY_DN_EDGE_NODE, node);
+
+ SVGNode symbol = node.addNode(ElementUtils.generateNodeId(edgeElement), SVGNode.class);
+ edgeElement.setHint(KEY_DN_EDGE_SYMBOL_NODE, symbol);
+ }
+
+ node.setColor(ElementUtils.getAdditionalColor(edgeElement, Color.BLUE));
- SVGNode symbol = node.addNode(ElementUtils.generateNodeId(edgeElement), SVGNode.class);
- edgeElement.setHint(KEY_DN_EDGE_SYMBOL_NODE, symbol);
+ node.setDNEdge(edge);
+ AffineTransform at = ElementUtils.getTransform(edgeElement);
+ if (at != null)
+ node.setTransform(at);
}
-
- node.setColor(ElementUtils.getAdditionalColor(edgeElement, Color.BLUE));
-
- node.setDNEdge(edge);
- AffineTransform at = ElementUtils.getTransform(edgeElement);
- if (at != null)
- node.setTransform(at);
+ } catch (Exception e) {
+ LOGGER.error("Could not initialize element {} for parent {}", edgeElement, parent, e);
}
}