root / branches / Mobile_Compatible_Hito_1 / libFMap / src / es / prodevelop / gvsig / mobile / fmap / core / acetate / AcetateTrail.java @ 21606
History | View | Annotate | Download (1.44 KB)
1 |
package es.prodevelop.gvsig.mobile.fmap.core.acetate; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
import java.awt.Graphics2D; |
5 |
import java.awt.geom.AffineTransform; |
6 |
|
7 |
import es.prodevelop.gvsig.mobile.fmap.core.FPolyline2D; |
8 |
import es.prodevelop.gvsig.mobile.fmap.core.GeneralPathX; |
9 |
import es.prodevelop.gvsig.mobile.fmap.util.graph2d.Graph2DUtilities; |
10 |
|
11 |
public class AcetateTrail extends FPolyline2D implements IAcetateElement { |
12 |
|
13 |
public static final int MAX_VERTICES = 100; |
14 |
public static final Color ACETATE_TRAILER_COLOR = Color.RED; |
15 |
|
16 |
private int maxVertices; |
17 |
private GeneralPathX generalPath;
|
18 |
|
19 |
private int nOfPoints = 0; |
20 |
private boolean visible = false; |
21 |
|
22 |
public AcetateTrail(int maxv, GeneralPathX gpx) { |
23 |
super(gpx);
|
24 |
|
25 |
maxVertices = maxv; |
26 |
generalPath = gpx; |
27 |
} |
28 |
|
29 |
public void reset() { |
30 |
generalPath = new GeneralPathX();
|
31 |
nOfPoints = 0;
|
32 |
} |
33 |
|
34 |
public void addVertex(double x, double y) { |
35 |
if (nOfPoints == 0) { |
36 |
generalPath.moveTo(x, y); |
37 |
} else {
|
38 |
generalPath.lineTo(x, y); |
39 |
} |
40 |
nOfPoints++; |
41 |
} |
42 |
|
43 |
public double getRotation() { |
44 |
return 0; |
45 |
} |
46 |
|
47 |
public void setRotation(double r) { |
48 |
} |
49 |
|
50 |
public void draw(Graphics2D g, AffineTransform at) { |
51 |
|
52 |
if ((nOfPoints == 0) || (!visible)) { |
53 |
return;
|
54 |
} |
55 |
|
56 |
// System.out.println("Drawing TRAIL...");
|
57 |
g.setColor(ACETATE_TRAILER_COLOR); |
58 |
Graph2DUtilities.drawPathIteratorLastVertices( |
59 |
g, generalPath.getPathIterator(at), null, nOfPoints, MAX_VERTICES);
|
60 |
} |
61 |
|
62 |
public void setVisible(boolean b) { |
63 |
visible = b; |
64 |
} |
65 |
|
66 |
|
67 |
|
68 |
|
69 |
} |