private String getKey(SingleElementNode node) {
String key;
- if (mappings.containsKey(node.getKey()))
- key = mappings.get(node.getKey()).toString();
- else
- key = node.getKey().toString();
+ if(node.getKey() != null) {
+ if (mappings.containsKey(node.getKey()))
+ key = mappings.get(node.getKey()).toString();
+ else
+ key = node.getKey().toString();
+ } else {
+ key = Long.toString(node.getId());
+ }
return key;
}
SelectionNode n = (SelectionNode)node;
SingleElementNode parentSEN = (SingleElementNode)NodeUtil.getNearestParentOfType(node, SingleElementNode.class);
- if(parentSEN != null && parentSEN.getKey() != null) {
+ if(parentSEN != null) {
RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN);
AffineTransform at = node.getTransform();
if(node instanceof SingleElementNode) {
SingleElementNode sen = (SingleElementNode)node;
- if(sen.getKey() != null) {
- String key = getKey(sen);
- String typeClass = sen.getTypeClass();
- String clazz = "definedElement";
- if(typeClass != null && !typeClass.isEmpty())
- clazz = clazz + " " + typeClass;
-
- parentBuilder.append(MAIN_SECTION, "\n<g class=\""+clazz+"\" id=\"" + key + "\">");
- }
+ String key = getKey(sen);
+ String typeClass = sen.getTypeClass();
+ String clazz = "definedElement";
+ if(typeClass != null && !typeClass.isEmpty())
+ clazz = clazz + " " + typeClass;
+
+ parentBuilder.append(MAIN_SECTION, "\n<g class=\""+clazz+"\" id=\"" + key + "\">");
senBuilders.put(sen, new RenderSVGContext());
}
if(!at.isIdentity()) {
RenderSVGContext b = senBuilders.get(sen);
String content = b.get(MAIN_SECTION);
if(content.isEmpty()) {
- if(sen.getKey() != null) {
-
- for(SelectionNode n : NodeUtil.collectNodes(node, SelectionNode.class)) {
- n.setIgnore(true);
- }
-
- Element doc = renderSVGNode((IG2DNode)node);
- String svg = printSVGDocument(doc);
- parentBuilder.append(MAIN_SECTION, svg);
+ for(SelectionNode n : NodeUtil.collectNodes(node, SelectionNode.class)) {
+ n.setIgnore(true);
}
+ Element doc = renderSVGNode((IG2DNode)node);
+ String svg = printSVGDocument(doc);
+ parentBuilder.append(MAIN_SECTION, svg);
} else {
parentBuilder.append(b);
}
}
if(node instanceof SingleElementNode) {
SingleElementNode sen = (SingleElementNode)node;
- if(sen.getKey() != null) {
+ //if(sen.getKey() != null) {
parentBuilder.append(MAIN_SECTION, "</g>");
- }
+ //}
}
}
indent --;