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