Revision 29001 branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgCircle.java
DwgCircle.java | ||
---|---|---|
35 | 35 |
package org.gvsig.dwg.lib.objects; |
36 | 36 |
|
37 | 37 |
import java.awt.geom.Point2D; |
38 |
import java.util.ArrayList; |
|
39 | 38 |
import java.util.List; |
40 | 39 |
import java.util.Map; |
41 | 40 |
|
... | ... | |
46 | 45 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
47 | 46 |
import org.gvsig.dwg.lib.IDwgExtrusionable; |
48 | 47 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
49 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
50 |
import org.gvsig.dwg.lib.util.GisModelCurveCalculator; |
|
51 | 48 |
import org.gvsig.fmap.geom.Geometry; |
52 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
49 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
53 | 50 |
import org.gvsig.fmap.geom.GeometryManager; |
51 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
52 |
import org.gvsig.fmap.geom.primitive.Circle; |
|
53 |
import org.gvsig.fmap.geom.primitive.Point; |
|
54 | 54 |
|
55 | 55 |
|
56 | 56 |
/** |
... | ... | |
167 | 167 |
/* (non-Javadoc) |
168 | 168 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
169 | 169 |
*/ |
170 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
171 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory();
|
|
170 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
|
|
171 |
GeometryManager gMan = GeometryLocator.getGeometryManager();
|
|
172 | 172 |
double[] c = getCenter(); |
173 |
Point2D center = new Point2D.Double(c[0], c[1]); |
|
174 | 173 |
//FIXME: ¿qué hacer cuando llega un radio negativo? |
175 | 174 |
// De momento, tomamos el valor absoluto del radio, pero |
176 | 175 |
// ¿habría que modificar de alguna manera los angulos? |
177 | 176 |
double radius = Math.abs(getRadius()); |
178 |
if (is3DFile) { |
|
179 |
|
|
180 |
return gFactory.createArc2DZ(center, radius, c[2], 0, Math.PI * 2); |
|
181 |
} else { |
|
182 |
return gFactory.createArc(center, radius, 0, Math.PI * 2); |
|
183 |
} |
|
177 |
Circle circle = (Circle) gMan.create(getGeometryType(), |
|
178 |
getGeometrySubType(is3DFile)); |
|
179 |
Point center = (Point) gMan.create(Geometry.TYPES.POINT, |
|
180 |
getGeometrySubType(is3DFile)); |
|
181 |
center.setCoordinates(c); |
|
182 |
circle.setPoints(center, radius); |
|
183 |
return circle; |
|
184 | 184 |
} |
185 | 185 |
|
186 | 186 |
/* (non-Javadoc) |
187 | 187 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
188 | 188 |
*/ |
189 | 189 |
public String toFMapString(boolean is3DFile) { |
190 |
if(is3DFile) |
|
190 |
if(is3DFile) {
|
|
191 | 191 |
return "FPolyline3D"; |
192 |
else
|
|
192 |
} else {
|
|
193 | 193 |
return "FPolyline2D"; |
194 |
} |
|
194 | 195 |
} |
195 | 196 |
|
196 | 197 |
public String toString(){ |
... | ... | |
232 | 233 |
myObj.setThickness(thickness); |
233 | 234 |
|
234 | 235 |
} |
236 |
public int getGeometrySubType(boolean is3DFile) { |
|
237 |
if (is3DFile) { |
|
238 |
return Geometry.SUBTYPES.GEOM3D; |
|
239 |
} else { |
|
240 |
return Geometry.SUBTYPES.GEOM2D; |
|
241 |
} |
|
242 |
} |
|
235 | 243 |
|
244 |
public int getGeometryType() { |
|
245 |
return Geometry.TYPES.CIRCLE; |
|
246 |
} |
|
247 |
|
|
236 | 248 |
} |
Also available in: Unified diff