value = "getWindowPosition();"; // needed for calculation of
// label positions
Collection<DNVNode> nodes = subGraph.getNodes().values();
HashMap<Integer, Integer> realIdToId = new HashMap<Integer, Integer>();
DNVNode tempNode = new DNVNode( graph );
Vector2D position;
int radius = ImageRenderer.getNodeWidth( getNodeSize(), getMinX(), getMaxX(), 1 );
int j = 0;
String imageFile;
int tempRadius;
String label;
for( Iterator<DNVNode> i = nodes.iterator(); i.hasNext(); )
{
tempNode = i.next();
label = tempNode.getLabel( interpolationLabels ).replaceAll( "'", "`" ).replaceAll( "\n", " " ).replaceAll( "\r", " " )
.trim();
position = ImageRenderer.transformPosition( globalMinX, globalMaxX, globalMinY, globalMaxY, getMinX(), getMaxX(), getMinY(),
getMaxY(), getWidth(), getHeight(), tempNode.getPosition( true ) );
tempRadius = (int)( radius * tempNode.getRadius() );
imageFile = ImageRenderer.getURL( tempRadius, tempNode.getIcon(), tempNode.getColor(), showIcons, tempNode.isSelected(),
tempNode.getId() );
if( isShowLabels() && isCurvedLabels() )
{
imageFile += "&l=" + label + "&ls=" + labelSize + "&sl=" + curvedLabels + "&o=" + outlinedLabels;
}
value += "addNode(" + (int)position.getX() + "," + (int)position.getY() + "," + tempRadius + "," + tempNode.getId() + "," + j
+ ",'" + imageFile + "','" + label + "'," + ( showLabels && !curvedLabels ) + "," + tempNode.isSelected() + ");";
realIdToId.put( tempNode.getId(), j );
j++;
}
value += "nNodes = " + j + ";";
Collection<DNVEdge> edges = subGraph.getEdges().values();
DNVEdge tempEdge;
DNVNode fromNode;
DNVNode toNode;
int fromId;
int toId;
j = 0;
position = new Vector2D( tempNode.getPosition( true ) );
Vector2D originalPosition = ImageRenderer.transformPosition( globalMinX, globalMaxX, globalMinY, globalMaxY, getMinX(),
getMaxX(), getMinY(), getMaxY(), getWidth(), getHeight(), position );
position.setX( position.getX() + DNVEdge.DEFAULT_RESTING_DISTANCE );
position = ImageRenderer.transformPosition( globalMinX, globalMaxX, globalMinY, globalMaxY, getMinX(), getMaxX(), getMinY(),
getMaxY(), getWidth(), getHeight(), position );