From 254ee6f47eebfc00462c10756a92066e82cc1a96 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 21 Jun 2011 15:46:02 +0200 Subject: Initial commit --- .../gui/model/AggregationVertexOutlineCreator.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 source/com/c2kernel/collection/gui/model/AggregationVertexOutlineCreator.java (limited to 'source/com/c2kernel/collection/gui/model/AggregationVertexOutlineCreator.java') diff --git a/source/com/c2kernel/collection/gui/model/AggregationVertexOutlineCreator.java b/source/com/c2kernel/collection/gui/model/AggregationVertexOutlineCreator.java new file mode 100755 index 0000000..ed19f9c --- /dev/null +++ b/source/com/c2kernel/collection/gui/model/AggregationVertexOutlineCreator.java @@ -0,0 +1,43 @@ +package com.c2kernel.collection.gui.model; + +import com.c2kernel.graph.model.GraphPoint; +import com.c2kernel.graph.model.Vertex; +import com.c2kernel.graph.model.VertexOutlineCreator; + + +public class AggregationVertexOutlineCreator implements VertexOutlineCreator +{ + public void setOutline(Vertex vertex) + { + GraphPoint centre = vertex.getCentrePoint(); + int height = vertex.getHeight(); + int width = vertex.getWidth(); + + + if (height==0 || width==0) + vertex.setOutlinePoints + ( + new GraphPoint[] + { + new GraphPoint(centre.x-20, centre.y-20), + new GraphPoint(centre.x+20, centre.y-20), + new GraphPoint(centre.x+20, centre.y+20), + new GraphPoint(centre.x-20, centre.y+20) + + } + ); + else + + vertex.setOutlinePoints + ( + new GraphPoint[] + { + new GraphPoint(centre.x-width/2, centre.y-height/2), + new GraphPoint(centre.x+width/2, centre.y-height/2), + new GraphPoint(centre.x+width/2, centre.y+height/2), + new GraphPoint(centre.x-width/2, centre.y+height/2) + + } + ); + } +} -- cgit v1.2.3