97 |
97 |
|
98 |
98 |
for (int i=0;i<geoms.length;i++) {
|
99 |
99 |
if (geoms[i].getGeometryType()==FShape.POINT) {
|
100 |
|
System.out.println("Punto encontrado.");
|
|
100 |
//System.out.println("Punto encontrado.");
|
101 |
101 |
FPoint2D point = new FPoint2D(0,0);
|
102 |
102 |
double[] pointCoords = new double[6];
|
103 |
103 |
GeneralPathXIterator pointIt = geoms[i].getGeneralPathXIterator();
|
... | ... | |
120 |
120 |
pv.add(py);
|
121 |
121 |
entityMaker.createPoint(pv);
|
122 |
122 |
} else if (geoms[i].getGeometryType()==FShape.LINE) {
|
123 |
|
System.out.println("L?nea encontrada.");
|
|
123 |
//System.out.println("L?nea encontrada.");
|
124 |
124 |
double[] lineCoords = new double[6];
|
125 |
125 |
GeneralPathXIterator lineIt = geoms[i].getGeneralPathXIterator();
|
126 |
126 |
int j = 0;
|
... | ... | |
219 |
219 |
sev.add(polylineLayer);
|
220 |
220 |
entityMaker.endSeq();*/
|
221 |
221 |
} else if (geoms[i].getGeometryType()==FShape.ARC) {
|
222 |
|
System.out.println("ARC encontrado.");
|
|
222 |
//System.out.println("ARC encontrado.");
|
223 |
223 |
FShape[] shapes = geoms[i].getShapes();
|
224 |
224 |
FArc2D fArc = (FArc2D)(shapes[0]);
|
225 |
225 |
Point2D[] pts = new Point2D[3];
|
... | ... | |
230 |
230 |
double radius = center.distance(pts[0]);
|
231 |
231 |
double initAngle=TrigonometricalFunctions.getAngle(center, pts[0]);
|
232 |
232 |
initAngle = Math.toDegrees(initAngle);
|
233 |
|
System.out.println("initAngle = " + initAngle);
|
|
233 |
//System.out.println("initAngle = " + initAngle);
|
234 |
234 |
double midAngle=TrigonometricalFunctions.getAngle(center, pts[1]);
|
235 |
235 |
midAngle = Math.toDegrees(midAngle);
|
236 |
|
System.out.println("midAngle = " + midAngle);
|
|
236 |
//System.out.println("midAngle = " + midAngle);
|
237 |
237 |
double endAngle=TrigonometricalFunctions.getAngle(center, pts[2]);
|
238 |
238 |
endAngle = Math.toDegrees(endAngle);
|
239 |
|
System.out.println("endAngle = " + endAngle);
|
|
239 |
//System.out.println("endAngle = " + endAngle);
|
240 |
240 |
|
241 |
241 |
// 050307, jmorell: Resoluci?n de un bug sobre el sentido de
|
242 |
242 |
// los arcos.
|
... | ... | |
282 |
282 |
av.add(ae);
|
283 |
283 |
entityMaker.createArc(av);
|
284 |
284 |
} else if (geoms[i].getGeometryType()==FShape.CIRCLE) {
|
285 |
|
System.out.println("CIRCLE encontrado.");
|
|
285 |
//System.out.println("CIRCLE encontrado.");
|
286 |
286 |
FShape[] shapes = geoms[i].getShapes();
|
287 |
287 |
FCircle2D circle = (FCircle2D)(shapes[0]);
|
288 |
288 |
Point2D center = circle.getCenter();
|
... | ... | |
304 |
304 |
av.add(ar);
|
305 |
305 |
entityMaker.createCircle(av);
|
306 |
306 |
} else if (geoms[i].getGeometryType()==FShape.ELLIPSE) {
|
307 |
|
System.out.println("ELLIPSE encontrada.");
|
|
307 |
//System.out.println("ELLIPSE encontrada.");
|
308 |
308 |
FShape[] shapes = geoms[i].getShapes();
|
309 |
309 |
FEllipse2D fElip = (FEllipse2D)(shapes[0]);
|
310 |
310 |
Point2D center = new Point2D.Double((fElip.getInit().getX()+fElip.getEnd().getX())/2, (fElip.getInit().getY()+fElip.getEnd().getY())/2);
|
311 |
311 |
double mAxisL = fElip.getDist()*2;
|
312 |
|
System.out.println("mAxisL = " + mAxisL);
|
|
312 |
//System.out.println("mAxisL = " + mAxisL);
|
313 |
313 |
/*System.out.println("mAxisL/(center.distance(fElip.getEnd()))*2 = " + mAxisL/(center.distance(fElip.getEnd()))*2);
|
314 |
314 |
minToMaj.setData(new Double(mAxisL/()*2));*/
|
315 |
315 |
double maAxisL = fElip.getInit().distance(fElip.getEnd());
|
... | ... | |
331 |
331 |
endPointOfMajorAxis = pAux;
|
332 |
332 |
}
|
333 |
333 |
double mToMAR = mAxisL/maAxisL;
|
334 |
|
System.out.println("mToMar = " + mToMAR);
|
|
334 |
//System.out.println("mToMar = " + mToMAR);
|
335 |
335 |
DxfGroup arcLayer = new DxfGroup(8, "default");
|
336 |
336 |
DxfGroup x = new DxfGroup();
|
337 |
337 |
DxfGroup y = new DxfGroup();
|
... | ... | |
428 |
428 |
entityMaker.endSeq();*/
|
429 |
429 |
// Para escribir LwPolylines.
|
430 |
430 |
} else if (geoms[i] instanceof FGeometryCollection) {
|
431 |
|
System.out.println("Polil?nea encontrada (Soluci?n provisional).");
|
|
431 |
//System.out.println("Polil?nea encontrada (Soluci?n provisional).");
|
432 |
432 |
FGeometryCollection gc = (FGeometryCollection)geoms[i];
|
433 |
433 |
FShape[] fShapes = gc.getShapes();
|
434 |
434 |
//double[] lineCoords = new double[6];
|
... | ... | |
444 |
444 |
Point2D last = new Point2D.Double();
|
445 |
445 |
for (int j=0;j<fShapes.length;j++) {
|
446 |
446 |
if (fShapes[j] instanceof FPolyline2D && !(fShapes[j] instanceof FArc2D)) {
|
447 |
|
System.out.println("L?nea encontrada dentro de la polil?nea.");
|
|
447 |
//System.out.println("L?nea encontrada dentro de la polil?nea.");
|
448 |
448 |
FPolyline2D fLine = (FPolyline2D)fShapes[j];
|
449 |
449 |
double[] lineCoords = new double[6];
|
450 |
450 |
PathIterator lineIt = fLine.getPathIterator(new AffineTransform());
|
... | ... | |
483 |
483 |
}
|
484 |
484 |
}
|
485 |
485 |
} else if (fShapes[j] instanceof FArc2D) {
|
486 |
|
System.out.println("Arco encontrada dentro de la polil?nea.");
|
|
486 |
//System.out.println("Arco encontrada dentro de la polil?nea.");
|
487 |
487 |
FArc2D fArc = (FArc2D)fShapes[j];
|
488 |
488 |
double[] lineCoords = new double[6];
|
489 |
489 |
/*PathIterator lineIt = fLine.getPathIterator(new AffineTransform());
|
... | ... | |
493 |
493 |
pts[1] = fArc.getMid();
|
494 |
494 |
pts[2] = fArc.getEnd();
|
495 |
495 |
Point2D center = fArc.getCenter(); //TrigonometricalFunctions.getCenter(pts[0], pts[1], pts[2]);
|
496 |
|
System.out.println("pts[0] = " + pts[0]);
|
497 |
|
System.out.println("pts[1] = " + pts[1]);
|
498 |
|
System.out.println("center = " + center);
|
499 |
|
System.out.println("pts[2] = " + pts[2]);
|
|
496 |
//System.out.println("pts[0] = " + pts[0]);
|
|
497 |
//System.out.println("pts[1] = " + pts[1]);
|
|
498 |
//System.out.println("center = " + center);
|
|
499 |
//System.out.println("pts[2] = " + pts[2]);
|
500 |
500 |
double initAngRad = TrigonometricalFunctions.getAngle(center, pts[0]);
|
501 |
501 |
double endAngRad = TrigonometricalFunctions.getAngle(center, pts[2]);
|
502 |
502 |
double angleRad = endAngRad-initAngRad;
|