Revision 2768 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfCircle.java
DxfCircle.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
|
41 | 41 |
/** |
42 |
* Entidad TEXT de AutoCAD |
|
43 |
* jmorell: Definici?n de atributos para el piloto de CAD e implementaci?n de |
|
44 |
* la escritura en formato DXF2000. |
|
45 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>* @author administrador |
|
42 |
* Entidad CIRCLE de un fichero DXF. |
|
43 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
44 |
* @author jmorell |
|
46 | 45 |
*/ |
47 | 46 |
public class DxfCircle extends DxfEntity { |
48 | 47 |
final static Color baseColor = new Color(69, 106, 121); |
... | ... | |
54 | 53 |
private Point2D center; |
55 | 54 |
private double radius; |
56 | 55 |
private Color color = baseColor; //Color(255,214,132,255); |
57 |
|
|
56 |
|
|
57 |
/** |
|
58 |
* Constructor de DxfCircle. |
|
59 |
* @param proj, proyecci?n cartogr?fica en la que se encuentra el DxfCircle. |
|
60 |
* @param layer, capa del DXF en la que se encuentra el DxfCircle. |
|
61 |
* @param pts, puntos 2D que componen el DxfCircle. |
|
62 |
*/ |
|
58 | 63 |
public DxfCircle(IProjection proj, DxfLayer layer, Point2D[] pts) { |
59 | 64 |
super(proj, layer); |
60 | 65 |
this.pts = pts; |
... | ... | |
64 | 69 |
extent.add(pts[i]); |
65 | 70 |
} |
66 | 71 |
} |
67 |
|
|
72 |
|
|
73 |
/** |
|
74 |
* Devuelve el color del DxfCircle. |
|
75 |
* @return Color |
|
76 |
*/ |
|
68 | 77 |
public Color c() { |
69 | 78 |
return color; |
70 | 79 |
} |
71 |
|
|
80 |
|
|
81 |
/** |
|
82 |
* Establece el color del DxfCircle. |
|
83 |
* @param color |
|
84 |
* @return Color |
|
85 |
*/ |
|
72 | 86 |
public Color c(Color color) { |
73 | 87 |
this.color = color; |
74 | 88 |
|
75 | 89 |
return color; |
76 | 90 |
} |
77 |
|
|
91 |
|
|
92 |
/** |
|
93 |
* Permite reproyectar un DxfCircle dado un conjunto de coordenadas de transformaci?n. |
|
94 |
* @param rp, coordenadas de transformaci?n. |
|
95 |
*/ |
|
78 | 96 |
public void reProject(ICoordTrans rp) { |
79 | 97 |
Point2D[] savePts = pts; |
80 | 98 |
|
... | ... | |
92 | 110 |
|
93 | 111 |
setProjection(rp.getPDest()); |
94 | 112 |
} |
95 |
|
|
113 |
|
|
114 |
/** |
|
115 |
* Permite dibujar un DxfCircle. |
|
116 |
*/ |
|
96 | 117 |
public void draw(Graphics2D g, ViewPortData vp) { |
97 | 118 |
//System.out.println("Va a pintar un circle"); |
98 | 119 |
Color color = null; |
... | ... | |
116 | 137 |
g.setColor(color); |
117 | 138 |
g.draw(gp); |
118 | 139 |
} |
119 |
|
|
140 |
|
|
141 |
/** |
|
142 |
* Permite generar un GeneralPath partiendo del array de Point2D que conforma el |
|
143 |
* DxfCircle. |
|
144 |
* @param vp |
|
145 |
*/ |
|
120 | 146 |
private void newGP(ViewPortData vp) { |
121 | 147 |
//if (gp != null) return; |
122 | 148 |
gp = new GeneralPath(); |
... | ... | |
145 | 171 |
} |
146 | 172 |
|
147 | 173 |
/** |
148 |
* Escritura de c?rculos en un DXF2000. |
|
174 |
* Permite la escritura de entidades DxfCircle en un fichero DXF2000. |
|
175 |
* @return String, la cadena que se escribir? en el fichero con la informaci?n |
|
176 |
* del DxfCircle. |
|
149 | 177 |
*/ |
150 | 178 |
public String toDxfString() { |
151 | 179 |
StringBuffer sb = null; |
... | ... | |
163 | 191 |
} |
164 | 192 |
|
165 | 193 |
/** |
166 |
* @return |
|
194 |
* Devuelve el array de puntos que conforman el DxfCircle. |
|
195 |
* @return Point2D[], puntos del DxfCircle. |
|
167 | 196 |
*/ |
168 | 197 |
public Point2D[] getPts() { |
169 | 198 |
return pts; |
170 | 199 |
} |
171 | 200 |
|
172 | 201 |
/** |
173 |
* @return |
|
202 |
* Devuelve el GeneralPath qie conforma el DxfCircle. |
|
203 |
* @return GeneralPath del DxfCircle. |
|
174 | 204 |
*/ |
175 |
|
|
176 | 205 |
/*public GeneralPath getGeneralPath(ViewPort vp) { |
177 | 206 |
newGP(vp); |
178 | 207 |
return (GeneralPath) gp.clone(); |
Also available in: Unified diff