svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / gml / InsPoint.java @ 2218
History | View | Annotate | Download (2.98 KB)
1 |
package org.cresques.px.gml; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
import java.awt.geom.Point2D; |
5 |
import java.awt.Graphics2D; |
6 |
import java.awt.geom.Line2D; |
7 |
import java.util.Vector; |
8 |
|
9 |
import org.cresques.cts.ICoordTrans; |
10 |
import org.cresques.cts.IProjection; |
11 |
import org.cresques.geo.ViewPortData; |
12 |
import org.cresques.geo.Point3D; |
13 |
|
14 |
public class InsPoint extends Geometry { |
15 |
public static int pointNr = 0; |
16 |
public String text = null; |
17 |
|
18 |
String blockName;
|
19 |
Point3D scaleFactor; |
20 |
double rotAngle;
|
21 |
private FeatureCollection block = new FeatureCollection(proj); |
22 |
Vector blkList;
|
23 |
boolean blockFound = false; |
24 |
|
25 |
public InsPoint() {
|
26 |
super();
|
27 |
} |
28 |
|
29 |
public void add(Point2D pt) { |
30 |
pointNr++; |
31 |
super.add(pt);
|
32 |
} |
33 |
|
34 |
public double getRotAngle() { |
35 |
return rotAngle;
|
36 |
} |
37 |
|
38 |
public Point3D getScaleFactor() {
|
39 |
return scaleFactor;
|
40 |
} |
41 |
|
42 |
public Vector getBlkList() { |
43 |
return blkList;
|
44 |
} |
45 |
|
46 |
public boolean getBlockFound() { |
47 |
return blockFound;
|
48 |
} |
49 |
|
50 |
public void setBlock(FeatureCollection block) { |
51 |
this.block = block;
|
52 |
} |
53 |
|
54 |
public void setBlockFound(boolean found) { |
55 |
blockFound = found; |
56 |
} |
57 |
|
58 |
public void setBlkList(Vector blkList) { |
59 |
this.blkList = blkList;
|
60 |
} |
61 |
|
62 |
public FeatureCollection getBlock() {
|
63 |
return block;
|
64 |
} |
65 |
|
66 |
public void setBlockName(String blockName) { |
67 |
this.blockName = blockName;
|
68 |
} |
69 |
|
70 |
public String getBlockName() { |
71 |
return blockName;
|
72 |
} |
73 |
|
74 |
public void setScaleFactor(Point3D scaleFactor) { |
75 |
this.scaleFactor = scaleFactor;
|
76 |
} |
77 |
|
78 |
public void setRotAngle(double rotAngle) { |
79 |
this.rotAngle = rotAngle;
|
80 |
} |
81 |
|
82 |
public boolean encuentraBloque(String blockName) { |
83 |
int i = 0; |
84 |
while (i<blkList.size() && blockFound == false) { |
85 |
//System.out.println("encuentraBloque: ((DxfBlock)blkList.get(i)).getBlkName() = " + ((FeatureCollection)blkList.get(i)).getProp("blockName"));
|
86 |
//System.out.println("encuentraBloque: blockName = " + blockName);
|
87 |
if (((FeatureCollection)blkList.get(i)).getProp("blockName").equals(blockName)) { |
88 |
//System.out.println("encuentraBloque: Bloque " + i + " encontrado.");
|
89 |
block = (FeatureCollection)blkList.get(i); |
90 |
blockFound = true;
|
91 |
} else {
|
92 |
//System.out.println("encuentraBloque: Bloque " + blockName + " no encontrado");
|
93 |
blockFound = false;
|
94 |
} |
95 |
i++; |
96 |
} |
97 |
return blockFound;
|
98 |
} |
99 |
|
100 |
private Color fColor = null; //new Color(255,222,165,64); |
101 |
private Color color = new Color(255,0,0); //Color(255,214,132,255); |
102 |
|
103 |
public Color c() {return color;} |
104 |
public Color c(Color color) {this.color = color; return color;} |
105 |
|
106 |
public Color fillColor() {return fColor;} |
107 |
public Color fillColor(Color c) {fColor = c; return fColor;} |
108 |
|
109 |
public IProjection getProjection() { return proj; } |
110 |
public void setProjection(IProjection p) { proj = p; } |
111 |
public void reProject(ICoordTrans rp) { |
112 |
// TODO metodo reProject pendiente de implementar
|
113 |
} |
114 |
|
115 |
public void draw(Graphics2D g, ViewPortData vp) { |
116 |
g.setColor(c()); |
117 |
Point2D pt = new Point2D.Double(0D, 0D); |
118 |
vp.mat.transform((Point2D) data.get(0), pt); |
119 |
g.draw(new Line2D.Double(pt, pt)); |
120 |
if (text != null) |
121 |
g.drawString(text, (int) pt.getX(), (int) pt.getY()); |
122 |
} |
123 |
|
124 |
} |