Revision 29001 branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgArc.java
DwgArc.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.Arc; |
|
53 |
import org.gvsig.fmap.geom.primitive.Point; |
|
54 | 54 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
55 | 55 |
|
56 | 56 |
|
... | ... | |
170 | 170 |
/* (non-Javadoc) |
171 | 171 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry() |
172 | 172 |
*/ |
173 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
174 |
|
|
175 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
173 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
176 | 174 |
|
175 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
176 |
|
|
177 | 177 |
double[] center = getCenter(); |
178 | 178 |
//FIXME: ¿qué hacer cuando llega un radio negativo? |
179 | 179 |
// De momento, tomamos el valor absoluto del radio, pero |
... | ... | |
182 | 182 |
double angSt = getInitAngle(); |
183 | 183 |
double angEnd = getEndAngle(); |
184 | 184 |
double angExt = UtilFunctions.angleDistance(angSt, angEnd); |
185 |
if (is3DFile) {
|
|
186 |
return gFactory.createArc2DZ(new Point2D.Double(center[0], center[1]), radius, angSt, -angExt, center[2]);
|
|
187 |
} else {
|
|
188 |
return gFactory.createArc(new Point2D.Double(center[0], center[1]), radius, angSt, -angExt );
|
|
189 |
}
|
|
185 |
Arc arc = (Arc) gMan.create(getGeometryType(),getGeometrySubType(is3DFile));
|
|
186 |
Point point = (Point) gMan.create(Geometry.TYPES.POINT,getGeometrySubType(is3DFile));
|
|
187 |
point.setCoordinates(center);
|
|
188 |
arc.setPoints(point, radius, angSt, -angExt);
|
|
189 |
return arc;
|
|
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
public String toString(){ |
... | ... | |
197 | 197 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString() |
198 | 198 |
*/ |
199 | 199 |
public String toFMapString(boolean is3dFile) { |
200 |
if(is3dFile) |
|
200 |
if(is3dFile) {
|
|
201 | 201 |
return "FPolyline3D"; |
202 |
else
|
|
202 |
} else {
|
|
203 | 203 |
return "FPolyline2D"; |
204 |
} |
|
204 | 205 |
} |
205 | 206 |
|
206 | 207 |
/* (non-Javadoc) |
... | ... | |
273 | 274 |
|
274 | 275 |
} |
275 | 276 |
|
277 |
|
|
278 |
public int getGeometrySubType(boolean is3DFile) { |
|
279 |
if (is3DFile) { |
|
280 |
return Geometry.SUBTYPES.GEOM3D; |
|
281 |
} else { |
|
282 |
return Geometry.SUBTYPES.GEOM2D; |
|
283 |
} |
|
284 |
} |
|
285 |
|
|
286 |
public int getGeometryType() { |
|
287 |
return Geometry.TYPES.ARC; |
|
288 |
} |
|
289 |
|
|
276 | 290 |
} |
Also available in: Unified diff