float globalMinX = GraphFunctions.getMinXPosition( subgraph.getSuperGraph(), level, true );
float globalMaxX = GraphFunctions.getMaxXPosition( subgraph.getSuperGraph(), level, true );
float globalMinY = GraphFunctions.getMinYPosition( subgraph.getSuperGraph(), level, true );
float globalMaxY = GraphFunctions.getMaxYPosition( subgraph.getSuperGraph(), level, true );
Vector2D bottomLeft = new Vector2D( globalMinX, globalMaxY );
Vector2D bottomRight = new Vector2D( globalMaxX, globalMaxY );
Vector2D topLeft = new Vector2D( globalMinX, globalMinY );
Vector2D bottomLeftScreen = ImageRenderer.transformPosition( pb, bottomLeft );
Vector2D bottomRightScreen = ImageRenderer.transformPosition( pb, bottomRight );
Vector2D topLeftScreen = ImageRenderer.transformPosition( pb, topLeft );
g2d.setColor( Color.black );
g2d.setStroke( new BasicStroke( 1 ) );
Vector3D color = new Vector3D( 0, 0, 0 );
Vector3D outlineColor = new Vector3D( 1, 1, 1 );
// X-axis
g2d.drawLine( (int)bottomLeftScreen.getX(), (int)bottomLeftScreen.getY(), (int)bottomRightScreen.getX() + 20, (int)bottomRightScreen.getY() );
Vector2D tempPos = new Vector2D( bottomLeft );
Vector2D tempPosScreen = new Vector2D( bottomLeftScreen );
int numberOfTicks = 5;
float axisTickLength = ( bottomRight.getX() - bottomLeft.getX() ) / numberOfTicks;
float axisTickLengthScreen = ( bottomRightScreen.getX() - bottomLeftScreen.getX() ) / numberOfTicks;
for( int i = 0; i <= numberOfTicks; i++ )
{
g2d.drawLine( (int)tempPosScreen.getX(), (int)tempPosScreen.getY(), (int)tempPosScreen.getX(), (int)tempPosScreen.getY() + 10 );
Text text = new Text( "" + ( Math.round( tempPos.getX() * 1000.0 ) / 1000.0 ), new Vector2D( tempPosScreen.getX(),
tempPosScreen.getY() + 15 ), outlineColor, color, 10, false, true, false, false, false, false, true );
text.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, globalMinX, globalMaxX, globalMinY, globalMaxY,
nodeWidth, height, overview );
tempPos.add( axisTickLength, 0 );
tempPosScreen.add( axisTickLengthScreen, 0 );
}
// Y-axis
g2d.drawLine( (int)bottomLeftScreen.getX(), (int)bottomLeftScreen.getY(), (int)topLeftScreen.getX(), (int)topLeftScreen.getY() );
tempPos.set( bottomLeft );
tempPosScreen.set( bottomLeftScreen );
axisTickLength = ( topLeft.getY() - bottomLeft.getY() ) / numberOfTicks;
axisTickLengthScreen = ( topLeftScreen.getY() - bottomLeftScreen.getY() ) / numberOfTicks;
for( int i = 0; i <= numberOfTicks; i++ )
{
g2d.drawLine( (int)tempPosScreen.getX(), (int)tempPosScreen.getY(), (int)tempPosScreen.getX() - 10, (int)tempPosScreen.getY() );
Text text = new Text( "" + ( Math.round( tempPos.getY() * 1000.0 ) / 1000.0 ), new Vector2D( tempPosScreen.getX() - 25,
tempPosScreen.getY() ), outlineColor, color, 10, false, true, false, false, false, false, true );
text.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, globalMinX, globalMaxX, globalMinY, globalMaxY,
nodeWidth, height, overview );
tempPos.add( 0, axisTickLength );
tempPosScreen.add( 0, axisTickLengthScreen );
}
}