}
else
{
for( DNVNode node : nodes.values() )
{
Vector3D color;
if( !node.hasProperty( "originalColor" ) )
{
node.setProperty( "originalColor", node.getColor().toString() );
color = fillColor;
}
else
{
color = new Vector3D( node.getColor() );
color.add( fillColor );
color.dotProduct( 0.5f );
}
node.setColor( color );
}
}
Vector2D position = new Vector2D();
Vector2D selectedNodeScreenPos = transformPosition( minX, maxX, minY, maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width,
height, selectedNode.getPosition() );
float xDiff = Math.abs( selectedNodeScreenPos.getX() - ( minPosScreen.getX() + ( maxPosScreen.getX() - minPosScreen.getX() ) / 2.0f ) );
float yDiff = Math.abs( selectedNodeScreenPos.getY() - ( minPosScreen.getY() + ( maxPosScreen.getY() - minPosScreen.getY() ) / 2.0f ) );
String key;
if( alignBoxInfoRelativeToBox )
{
if( headerAlignment.containsKey( "X-align" + selectedNode.getId() )
|| ( !headerAlignment.containsKey( "Y-align" + selectedNode.getId() ) && xDiff >= yDiff ) )
{
headerAlignment.put( "X-align" + selectedNode.getId(), true );
position = new Vector2D( minPosScreen.getX() + ( maxPosScreen.getX() - minPosScreen.getX() ) / 2.0f, 14 );
key = "X" + hops;
if( !drawnHeadings.containsKey( key ) )
{
Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
true );
t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
drawnHeadings.put( key, 1 );
}
else
{
drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
}
}
else
{
headerAlignment.put( "Y-align" + selectedNode.getId(), true );
position = new Vector2D( 35, minPosScreen.getY() + ( maxPosScreen.getY() - minPosScreen.getY() ) / 2.0f );
key = "Y" + hops;
if( !drawnHeadings.containsKey( key ) )
{
Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
true );
t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
drawnHeadings.put( key, 1 );
}
else
{
drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
}
}
}
else
{
position = new Vector2D( 70 * hops, 14 );
key = "Align" + hops;
if( !drawnHeadings.containsKey( key ) )
{
Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false, true );
t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
drawnHeadings.put( key, 1 );
}
else
{
drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
}
}
position.setY( position.getY() + ( drawnHeadings.get( key ) * 20 ) );
if( drawNumberOfNodesInBox )
{
Text t = new Text( nodes.size() + " nodes", position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
true );
t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
}
return 1;