Revision 2768 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEllipse.java
DxfEllipse.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
|
41 | 41 |
/** |
42 |
* Entidad ELLIPSE de AutoCAD. Implementaci?n b?sica para el piloto de CAD sobre el |
|
43 |
* formato DXF2000. |
|
44 |
* |
|
42 |
* Entidad ELLIPSE de un fichero DXF. |
|
45 | 43 |
* @author jmorell |
46 | 44 |
*/ |
47 | 45 |
public class DxfEllipse extends DxfEntity { |
... | ... | |
55 | 53 |
private Point2D center; |
56 | 54 |
private double minorToMajorAxisRatio; |
57 | 55 |
private Color color = baseColor; //Color(255,214,132,255); |
58 |
|
|
56 |
|
|
57 |
/** |
|
58 |
* Constructor de DxfEllipse. |
|
59 |
* @param proj, proyecci?n cartogr?fica en la que se encuentra el DxfEllipse. |
|
60 |
* @param layer, capa del DXF en la que se encuentra el DxfEllipse. |
|
61 |
* @param pt1, primer punto del semieje mayor. |
|
62 |
* @param pt2, segundo punto del semieje mayor. |
|
63 |
* @param minorAxisLength, longitud del semieje menor. |
|
64 |
*/ |
|
59 | 65 |
public DxfEllipse(IProjection proj, DxfLayer layer, Point2D pt1, |
60 | 66 |
Point2D pt2, double minorAxisLength) { |
61 | 67 |
super(proj, layer); |
... | ... | |
78 | 84 |
//System.out.println("majorAxisLength = " + majorAxisLength); |
79 | 85 |
minorToMajorAxisRatio = minorAxisLength / majorAxisLength; |
80 | 86 |
} |
81 |
|
|
87 |
|
|
88 |
/** |
|
89 |
* Devuelve el color del DxfEllipse. |
|
90 |
* @return Color |
|
91 |
*/ |
|
82 | 92 |
public Color c() { |
83 | 93 |
return color; |
84 | 94 |
} |
85 |
|
|
95 |
|
|
96 |
/** |
|
97 |
* Establece el color del DxfEllipse. |
|
98 |
* @param color |
|
99 |
* @return Color |
|
100 |
*/ |
|
86 | 101 |
public Color c(Color color) { |
87 | 102 |
this.color = color; |
88 | 103 |
|
89 | 104 |
return color; |
90 | 105 |
} |
91 |
|
|
106 |
|
|
107 |
/** |
|
108 |
* Permite reproyectar un DxfEllipse dado un conjunto de coordenadas de transformaci?n. |
|
109 |
* @param rp, coordenadas de transformaci?n. |
|
110 |
*/ |
|
92 | 111 |
public void reProject(ICoordTrans rp) { |
93 | 112 |
Point2D[] savePts = pts; |
94 | 113 |
|
... | ... | |
106 | 125 |
|
107 | 126 |
setProjection(rp.getPDest()); |
108 | 127 |
} |
109 |
|
|
128 |
|
|
129 |
/** |
|
130 |
* Permite dibujar un DxfEllipse. |
|
131 |
*/ |
|
110 | 132 |
public void draw(Graphics2D g, ViewPortData vp) { |
111 | 133 |
//System.out.println("Va a pintar un circle"); |
112 | 134 |
Color color = null; |
... | ... | |
130 | 152 |
g.setColor(color); |
131 | 153 |
g.draw(gp); |
132 | 154 |
} |
133 |
|
|
155 |
|
|
156 |
/** |
|
157 |
* Permite generar un GeneralPath partiendo del array de Point2D que conforma el |
|
158 |
* DxfEllipse. |
|
159 |
* @param vp |
|
160 |
*/ |
|
134 | 161 |
private void newGP(ViewPortData vp) { |
135 | 162 |
//if (gp != null) return; |
136 | 163 |
gp = new GeneralPath(); |
... | ... | |
157 | 184 |
gp.closePath(); |
158 | 185 |
} |
159 | 186 |
} |
160 |
|
|
187 |
|
|
188 |
/** |
|
189 |
* Permite la escritura de entidades DxfEllipse en un fichero DXF2000. |
|
190 |
* @return String, la cadena que se escribir? en el fichero con la informaci?n |
|
191 |
* del DxfEllipse. |
|
192 |
*/ |
|
161 | 193 |
public String toDxfString() { |
162 | 194 |
StringBuffer sb = null; |
163 | 195 |
sb = new StringBuffer(DxfGroup.toString(0, "ELLIPSE")); |
... | ... | |
178 | 210 |
|
179 | 211 |
return sb.toString(); |
180 | 212 |
} |
181 |
|
|
213 |
|
|
182 | 214 |
/** |
183 |
* @return |
|
215 |
* Devuelve el array de puntos que conforman el DxfEllipse. |
|
216 |
* @return Point2D[], puntos del DxfEllipse. |
|
184 | 217 |
*/ |
185 | 218 |
public Point2D[] getPts() { |
186 | 219 |
return pts; |
187 | 220 |
} |
188 | 221 |
|
189 | 222 |
/** |
190 |
* @return |
|
223 |
* Devuelve el GeneralPath qie conforma el DxfEllipse. |
|
224 |
* @return GeneralPath del DxfEllipse. |
|
191 | 225 |
*/ |
192 |
|
|
193 | 226 |
/*public GeneralPath getGeneralPath(ViewPort vp) { |
194 | 227 |
newGP(vp); |
195 | 228 |
return (GeneralPath) gp.clone(); |
Also available in: Unified diff