01: /*
02: * Created on 30.08.2005
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Style - Code Templates
06: */
07: package de.latlon.deejump.plugin.style;
08:
09: import java.awt.Graphics2D;
10: import java.awt.Polygon;
11: import java.awt.Shape;
12: import java.awt.geom.Point2D;
13:
14: import com.vividsolutions.jump.workbench.ui.renderer.style.VertexStyle;
15:
16: /**
17: * @author hamammi
18: *
19: * TODO To change the template for this generated type comment go to
20: * Window - Preferences - Java - Code Style - Code Templates
21: */
22: public class CrossVertexStyle extends VertexStyle {
23:
24: public CrossVertexStyle() {
25: super (createDefaultCross());
26: }
27:
28: public void paint(Graphics2D g, Point2D p) {
29: //setFrame
30: //render
31: int thickness = 0;
32:
33: int p1X = (int) p.getX() + thickness;
34: int p1Y = (int) p.getY() - thickness - size;
35: int p2Y = (int) p.getY() - thickness;
36: int p3X = (int) p.getX() + thickness + size;
37: int p4Y = (int) p.getY() + thickness;
38: int p6Y = (int) p.getY() + thickness + size;
39: int p7X = (int) p.getX() - thickness;
40: int p9X = (int) p.getX() - thickness - size;
41:
42: ((Polygon) this .shape).xpoints = new int[] { p1X, p1X, p3X,
43: p3X, p1X, p1X, p7X, p7X, p9X, p9X, p7X, p7X };
44:
45: ((Polygon) this .shape).ypoints = new int[] { p1Y, p2Y, p2Y,
46: p4Y, p4Y, p6Y, p6Y, p4Y, p4Y, p2Y, p2Y, p1Y };
47:
48: ((Polygon) this .shape).npoints = ((Polygon) this .shape).xpoints.length;
49: render(g);
50: }
51:
52: protected static Shape createDefaultCross() {
53: return new Polygon();
54: }
55:
56: }
|