Revision 2218 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java

View differences:

DxfFeatureMaker.java
13 13
import org.cresques.px.gml.Feature;
14 14
import org.cresques.px.gml.FeatureCollection;
15 15
import org.cresques.px.gml.InsPoint;
16
import org.cresques.px.gml.InsPoint3D;
16 17
import org.cresques.px.gml.LineString;
18
import org.cresques.px.gml.LineString3D;
17 19
import org.cresques.px.gml.Point;
18 20
import org.cresques.px.gml.Polygon;
21
import org.cresques.px.gml.Polygon3D;
19 22

  
20
import java.util.HashSet;
21 23
import java.util.Iterator;
22
import java.util.Set;
23 24
import java.util.Vector;
24 25
import java.awt.Graphics2D;
25
import java.awt.geom.GeneralPath;
26 26
import java.awt.geom.Point2D;
27 27

  
28 28
/**
......
38 38
	double bulge = 0.0;
39 39
    double xtruX=0.0, xtruY=0.0, xtruZ=1.0;
40 40
    int polylineFlag = 0;
41
    Point2D firstPt = new Point2D.Double();
42
    Point2D ptAnterior = null;
41
    Point3D firstPt = new Point3D();
42
    Point3D ptAnterior = null;
43 43

  
44 44
    boolean addingToBlock = false;
45 45
    int iterator = 0;
......
53 53
	private Point2D facesFirstPoint = null;
54 54
	
55 55
	private Vector attributes = null;
56
	private boolean constantPolylineElevation;
57
	private double lastVertexElevation;
58
	private boolean dxf3DFile;
56 59

  
57 60
	public DxfFeatureMaker(IProjection proj) {
58 61
		this.proj = proj;
......
60 63
		features = new FeatureCollection(proj);
61 64
		blkList = new Vector();
62 65
		attributes = new Vector();
66
		dxf3DFile = false;
63 67
	}
64 68

  
65 69
	public void setAddingToBlock(boolean a) { addingToBlock = a; }
......
85 89
	}
86 90

  
87 91
	public void createPolyline(DxfGroupVector grp) throws Exception {
88
		LineString lineString = new LineString();
89
		Polygon polygon = new Polygon();
92
		LineString3D lineString3D = new LineString3D();
93
		Polygon3D polygon3D = new Polygon3D();
90 94
		//Feature feature= new Feature();
91 95
		Feature feaBordes= new Feature();
92 96
		Feature feaFondos= new Feature();
93 97
		double x = 0.0, y = 0.0, z = 0.0;
94 98
		int flags = 0;
99
		constantPolylineElevation = true;
95 100
		
96 101
		// 041122: Cada polyline tiene asociado un objeto faces distinto.
97 102
		faces = new Vector();
......
141 146
			y = grp.getDataAsDouble(20);
142 147
		if (grp.hasCode(30)) {
143 148
			z = grp.getDataAsDouble(30);
149
			if (z!=0.0) dxf3DFile = true;
144 150
			Double doub = new Double(z);
145 151
			String string = doub.toString();
146 152
			//feature.setProp("elevation", string);
......
161 167
		if (grp.hasCode(230))
162 168
			xtruZ = grp.getDataAsDouble(230);
163 169
		if ((flags & 0x01) == 0x01 || (flags & 0x40) == 0x40) {
164
			feaBordes.setGeometry(lineString);
165
			feaFondos.setGeometry(polygon);
170
			feaBordes.setGeometry(lineString3D);
171
			feaFondos.setGeometry(polygon3D);
166 172
			lastFeaBordes = feaBordes;
167 173
			lastFeaFondos = feaFondos;
168 174
			isDoubleFeatured = true;
169 175
		} else if ((flags & 0x01) == 0x00) {
170
			feaBordes.setGeometry(lineString);
176
			feaBordes.setGeometry(lineString3D);
171 177
			lastFeaBordes = feaBordes;
172 178
			isDoubleFeatured = false;
173 179
		} else {
......
178 184

  
179 185
	public void endSeq() throws Exception {
180 186
		if (isDoubleFeatured) {
181
			if (lastFeaBordes.getGeometry() instanceof LineString) {
182
				Feature feaBordes = lastFeaBordes;		
183
				Feature feaFondos = lastFeaFondos;		
184
				LineString lineString = (LineString)feaBordes.getGeometry();
185
				Polygon polygon = (Polygon)feaFondos.getGeometry();
186
				lineString.add(firstPt);
187
				// 041103: linea anulada porque hay pol?gonos en los que al final
188
				//		   a?ade el (0,0). Parece que a?adimos el punto inicial
189
				//		   del pol?gono una vez pero parece que el pol?gono, por
190
				//		   el hecho de ser pol?gono, ya se a?ade el punto inicial
191
				//		   al final, con lo que estamos duplicando el punto inicial
192
				//		   del pol?gono al final del mismo.
193
				//polygon.add(firstPt);
187
			if (lastFeaBordes.getGeometry() instanceof LineString3D) {
188
				Feature feaBordes = lastFeaBordes;
189
				Feature feaFondos = lastFeaFondos;
190
				LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
191
				Polygon3D polygon3D = (Polygon3D)feaFondos.getGeometry();
192
				lineString3D.add(firstPt);
194 193
				if (bulge!=0) {
195 194
					
196 195
					// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
197
					Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge);
198
					lineString.remove(lineString.pointNr()-1);
199
					lineString.remove(lineString.pointNr()-1);
200
					polygon.remove(lineString.pointNr()-1);
201
					polygon.remove(lineString.pointNr()-1);
196
					Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr()-2).getX(), lineString3D.get(lineString3D.pointNr()-2).getY()), new Point2D.Double(lineString3D.get(lineString3D.pointNr()-1).getX(), lineString3D.get(lineString3D.pointNr()-1).getY()), bulge);
197
					lineString3D.remove(lineString3D.pointNr()-1);
198
					lineString3D.remove(lineString3D.pointNr()-1);
199
					polygon3D.remove(lineString3D.pointNr()-1);
200
					polygon3D.remove(lineString3D.pointNr()-1);
202 201
					if (bulge>0) {
203 202
						for (int i=0; i<arc.size(); i++) {
204 203
							Point2D ptAux = new Point2D.Double();
204
							double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
205 205
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
206
							lineString.add(ptAux);
207
							polygon.add(ptAux);
208
							if (lineString.pointNr() == 1) firstPt = ptAux;
206
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
207
							lineString3D.add(ptAux3D);
208
							polygon3D.add(ptAux3D);
209
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
209 210
						}
210 211
					} else {
211 212
						for (int i=arc.size()-1; i>=0; i--) {
212 213
							Point2D ptAux = new Point2D.Double();
214
							double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
213 215
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
214
							lineString.add(ptAux);
215
							polygon.add(ptAux);
216
							if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
216
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
217
							lineString3D.add(ptAux3D);
218
							polygon3D.add(ptAux3D);
219
							if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
217 220
						}					
218 221
					}
219 222
					// 041122
......
240 243
							i1 = face[i];
241 244
							if (i0 > 0) {
242 245
								if ((facesIterador%2)!=0) {
243
									//System.out.println("endSeq(): hasFaces = " + hasFaces);
244
									//System.out.println("endSeq(): i0 = " + i0);
245
									//System.out.println("endSeq(): lineString.pointNr() = " + lineString.pointNr());
246
									ls1.add((Point2D)lineString.get(i0-1));
247
									pl1.add((Point2D)polygon.get(i0-1));
248
									//ls1.add((Point2D)lineString.get(Math.abs(i1)-1));
249
									//pl1.add((Point2D)polygon.get(Math.abs(i1)-1));									
246
									ls1.add((Point2D)lineString3D.get(i0-1));
247
									pl1.add((Point2D)polygon3D.get(i0-1));
250 248
								} else {
251
									ls2.add((Point2D)lineString.get(i0-1));
252
									pl2.add((Point2D)polygon.get(i0-1));
253
									//ls2.add((Point2D)lineString.get(Math.abs(i1)-1));
254
									//pl2.add((Point2D)polygon.get(Math.abs(i1)-1));									
249
									ls2.add((Point2D)lineString3D.get(i0-1));
250
									pl2.add((Point2D)polygon3D.get(i0-1));
255 251
								}
256 252
								facesIterador = facesIterador + 1;
257 253
							}
......
272 268
					lastFeaBordes.setGeometry(ls);					
273 269
					lastFeaFondos.setGeometry(pl);					
274 270
				} else {
275
					lastFeaBordes.setGeometry(lineString);
276
					lastFeaFondos.setGeometry(polygon);
271
					lastFeaBordes.setGeometry(lineString3D);
272
					lastFeaFondos.setGeometry(polygon3D);
277 273
				}
278 274
				
279 275
				// 041130: Rellena las props con los atributos.
280 276
				completeAttributes(lastFeaBordes);
281 277
				completeAttributes(lastFeaFondos);
282 278
				
279
				setPolylineElevation(lastFeaBordes, lastFeaFondos);
280
				
283 281
				if (addingToBlock == false) {
284 282
					features.add(lastFeaBordes);
285 283
					features.add(lastFeaFondos);
......
289 287
				}
290 288
				lastFeaBordes = null;
291 289
				lastFeaFondos = null;				
292
			} else if (lastFeaBordes.getGeometry() instanceof InsPoint) {
290
			} else if (lastFeaBordes.getGeometry() instanceof InsPoint3D) {
293 291
				// Se trata de un SEQEND despues de un ATTRIB
294
				
295
				// 041130: Rellena las props con los atributos.
296
				//completeAttributes(lastFeaBordes);
297
				//completeAttributes(lastFeaFondos);
298
				
299
				//System.out.println("endSeq(): lastFeaBordes.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
300
				//System.out.println("endSeq(): lastFeaFondos.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
301
				
302 292
				copyAttributes(lastFeaBordes);
303 293
				
304 294
				gestionaInsert(lastFeaBordes);
......
314 304
				// Caso no contemplado.
315 305
			}
316 306
		} else {
317
			if (lastFeaBordes.getGeometry() instanceof LineString) {
307
			if (lastFeaBordes.getGeometry() instanceof LineString3D) {
318 308
				Feature feaBordes = lastFeaBordes;
319
				LineString lineString = (LineString)feaBordes.getGeometry();
309
				LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
320 310
				if (bulge!=0) {
321 311
					
322 312
					// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
323
					Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge);
324
					lineString.remove(lineString.pointNr()-1);
325
					lineString.remove(lineString.pointNr()-1);
313
					Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr()-2).getX(), lineString3D.get(lineString3D.pointNr()-2).getY()), new Point2D.Double(lineString3D.get(lineString3D.pointNr()-1).getX(), lineString3D.get(lineString3D.pointNr()-1).getY()), bulge);
314
					lineString3D.remove(lineString3D.pointNr()-1);
315
					lineString3D.remove(lineString3D.pointNr()-1);
326 316
					if (bulge>0) {
327 317
						for (int i=0; i<arc.size(); i++) {
328 318
							Point2D ptAux = new Point2D.Double();
319
							double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
329 320
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
330
							lineString.add(ptAux);
331
							if (lineString.pointNr() == 1) firstPt = ptAux;
321
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
322
							lineString3D.add(ptAux3D);
323
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
332 324
						}
333 325
					} else {
334 326
						for (int i=arc.size()-1; i>=0; i--) {
335 327
							Point2D ptAux = new Point2D.Double();
328
							double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
336 329
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
337
							lineString.add(ptAux);
338
							if (lineString.pointNr() == 1) firstPt = ptAux;
330
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
331
							lineString3D.add(ptAux3D);
332
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
339 333
						}					
340 334
					}
341 335
					// 041122
......
358 352
							i1 = face[i];
359 353
							if (i0 > 0) {
360 354
								if ((facesIterador%2)!=0) {
361
									ls1.add((Point2D)lineString.get(i0-1));
355
									ls1.add((Point2D)lineString3D.get(i0-1));
362 356
									//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
363 357
								} else {
364
									ls2.add((Point2D)lineString.get(i0-1));
358
									ls2.add((Point2D)lineString3D.get(i0-1));
365 359
									//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
366 360
								}
367 361
								facesIterador = facesIterador + 1;
......
379 373
					ls.add(facesFirstPoint);
380 374
					lastFeaBordes.setGeometry(ls);					
381 375
				} else {
382
					lastFeaBordes.setGeometry(lineString);
376
					lastFeaBordes.setGeometry(lineString3D);
383 377
				}
384 378
				
385 379
				// 041130: Rellena las props con los atributos.
386 380
				completeAttributes(lastFeaBordes);
387 381
				
382
				setPolylineElevation(lastFeaBordes);
383
				
388 384
				if (addingToBlock == false) {
389 385
					features.add(lastFeaBordes);
390 386
				} else {
......
403 399
		hasFaces = false;
404 400
		facesIterador = 1;
405 401
	}
406
	
402
	private void setPolylineElevation(Feature feaBordes) {
403
	    if (constantPolylineElevation) {
404
			Double doub = new Double(lastVertexElevation);
405
			String string = doub.toString();
406
			feaBordes.setProp("elevation", string);
407
	    } else {
408
			Double doub = new Double(0.0);
409
			String string = doub.toString();
410
			feaBordes.setProp("elevation", string);
411
	    }
412
	}
413
	private void setPolylineElevation(Feature feaBordes, Feature feaFondos) {
414
	    if (constantPolylineElevation) {
415
			Double doub = new Double(lastVertexElevation);
416
			String string = doub.toString();
417
			feaBordes.setProp("elevation", string);
418
			feaFondos.setProp("elevation", string);
419
	    } else {
420
			Double doub = new Double(0.0);
421
			String string = doub.toString();
422
			feaBordes.setProp("elevation", string);
423
			feaFondos.setProp("elevation", string);
424
	    }
425
	}
407 426
	public void addVertex(DxfGroupVector grp) throws Exception {
408 427
		double x = 0.0, y = 0.0, z = 0.0;
409 428
		int vFlags = 0;
410 429
		if (isDoubleFeatured) {
411 430
			Feature feaBordes = lastFeaBordes;		
412 431
			Feature feaFondos = lastFeaFondos;		
413
			LineString lineString = (LineString)feaBordes.getGeometry();
414
			Polygon polygon = (Polygon)feaFondos.getGeometry();
432
			LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
433
			Polygon3D polygon3D = (Polygon3D)feaFondos.getGeometry();
415 434
			if (grp.hasCode(8)) {
416 435
				feaBordes.setProp("layer", grp.getDataAsString(8));
417 436
				feaFondos.setProp("layer", grp.getDataAsString(8));
......
421 440
			}
422 441
			x  = grp.getDataAsDouble(10);
423 442
			y  = grp.getDataAsDouble(20);
424
			if (grp.hasCode(30)) {
425
				z = grp.getDataAsDouble(30);
426
			}
443
			z = grp.getDataAsDouble(30);
427 444
			Point3D point_in = new Point3D(x, y, z);
428 445
			Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
429
			Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
446
			Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
430 447
			x = point_out.getX();
431 448
			y = point_out.getY();
449
			z = point_out.getZ();
450
			if (z!=0.0) dxf3DFile = true;
451
			if (z!=lastVertexElevation && lineString3D.pointNr()>0) constantPolylineElevation = false;
452
			lastVertexElevation = z;
432 453
			//System.out.println("addVertex(): vFlags = " + vFlags);
433 454
			if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) {
434 455
				int [] face = {0,0,0,0};
......
441 462
				// Son vertices que se trataran cuando se implementen
442 463
				// los splines. En principio no se hace nada con ellos.
443 464
			} else {
444
				Point2D pt = proj.createPoint( x, y);
445
				lineString.add(pt);
446
				polygon.add(pt);
447
				if (lineString.pointNr() == 1) {
465
				Point3D pt = new Point3D(proj.createPoint( x, y).getX(), proj.createPoint( x, y).getY(), z);
466
				lineString3D.add(pt);
467
				polygon3D.add(pt);
468
				if (lineString3D.pointNr() == 1) {
448 469
					firstPt = pt;
449 470
				}
450 471
				if (bulge == 0.0) {
......
457 478
						bulge_aux = grp.getDataAsDouble(42);
458 479
					} else { bulge_aux = 0.0; }
459 480
					//int cnt = lineString.pointNr();
460
					//System.out.println("addVertex(): lineString.pointNr() = " + lineString.pointNr());
461
					lineString.remove(lineString.pointNr()-1);
462
					lineString.remove(lineString.pointNr()-1);
463
					//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
464
					polygon.remove(polygon.pointNr()-1);
465
					polygon.remove(polygon.pointNr()-1);
481
					lineString3D.remove(lineString3D.pointNr()-1);
482
					lineString3D.remove(lineString3D.pointNr()-1);
483
					polygon3D.remove(polygon3D.pointNr()-1);
484
					polygon3D.remove(polygon3D.pointNr()-1);
466 485
					Vector arc = createArc(ptAnterior, pt, bulge);
467 486
					if (bulge>0) {
468 487
						for (int i=0; i<arc.size(); i++) {
469 488
							Point2D ptAux = new Point2D.Double();
470 489
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
471
							lineString.add(ptAux);
472
							polygon.add(ptAux);
473
							if (lineString.pointNr() == 1) firstPt = ptAux;
490
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
491
							lineString3D.add(ptAux3D);
492
							polygon3D.add(ptAux3D);
493
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
474 494
						}
475 495
					} else {
476 496
						for (int i=arc.size()-1; i>=0; i--) {
477 497
							Point2D ptAux = new Point2D.Double();
478 498
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
479
							lineString.add(ptAux);
480
							polygon.add(ptAux);
481
							if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
482
						}					
499
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
500
							lineString3D.add(ptAux3D);
501
							polygon3D.add(ptAux3D);
502
							if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
503
						}			
483 504
					}
484 505
					bulge = bulge_aux;
485 506
				}
......
487 508
			}
488 509
		} else {
489 510
			Feature feaBordes = lastFeaBordes;
490
			LineString lineString = (LineString)feaBordes.getGeometry();
511
			LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
491 512
			if (grp.hasCode(8))
492 513
				feaBordes.setProp("layer", grp.getDataAsString(8));
493 514
			if (grp.hasCode(70)) {
494 515
				vFlags = grp.getDataAsInt(70);
495 516
			}
496
			x  = grp.getDataAsDouble(10);
497
			y  = grp.getDataAsDouble(20);
498
			if (grp.hasCode(30)) {
499
				z = grp.getDataAsDouble(30);
500
			}
517
			x = grp.getDataAsDouble(10);
518
			y = grp.getDataAsDouble(20);
519
			z = grp.getDataAsDouble(30);
501 520
			Point3D point_in = new Point3D(x, y, z);
502 521
			Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
503
			Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
522
			Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
504 523
			x = point_out.getX();
505 524
			y = point_out.getY();
525
			z = point_out.getZ();
526
			if (z!=0.0) dxf3DFile = true;
527
			if (z!=lastVertexElevation && lineString3D.pointNr()>0) constantPolylineElevation = false;
528
			lastVertexElevation = z;
506 529
			if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) {
507 530
				int [] face = {0,0,0,0};
508 531
				face[0] = grp.getDataAsInt(71);
......
513 536
			} else if ((vFlags & 16) == 16) {
514 537
				// no se hace nada.
515 538
			} else {
516
				Point2D pt = proj.createPoint( x, y);
517
				lineString.add(pt);
539
				Point3D pt = new Point3D(proj.createPoint( x, y).getX(), proj.createPoint( x, y).getY(), z);
540
				lineString3D.add(pt);
518 541
				//System.out.println("addVertex: pt = " + pt);
519
				if (lineString.pointNr() == 1) {
542
				if (lineString3D.pointNr() == 1) {
520 543
					firstPt = pt;
521 544
					//System.out.println("addVertex(Primer pto de la lineString, firstPt=pt): firstPt = " + firstPt);
522 545
				}
......
531 554
					if (grp.hasCode(42)) {
532 555
						bulge_aux = grp.getDataAsDouble(42);
533 556
					} else { bulge_aux = 0.0; }
534
					//int cnt = lineString.pointNr();
535
					//System.out.println("addVertex: El vertice anterior tenia bulge. Se va a crear el");				
536
					//System.out.println("addVertex: arco del ptAnterior al ptActual.");
537
					//System.out.println("addVertex: ptAnterior = " + ptAnterior + ", ptActual = " + pt);
538 557
					// Borro los puntos inicio y final del arco.
539
					lineString.remove(lineString.pointNr()-1);
540
					lineString.remove(lineString.pointNr()-1);
558
					lineString3D.remove(lineString3D.pointNr()-1);
559
					lineString3D.remove(lineString3D.pointNr()-1);
541 560
					Vector arc = createArc(ptAnterior, pt, bulge);
542 561
					if (bulge>0) {
543 562
						for (int i=0; i<arc.size(); i++) {
544 563
							Point2D ptAux = new Point2D.Double();
545 564
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
546
							lineString.add(ptAux);
547
							if (lineString.pointNr() == 1) firstPt = ptAux;
565
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
566
							lineString3D.add(ptAux3D);
567
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
548 568
						}
549 569
					} else {
550 570
						for (int i=arc.size()-1; i>=0; i--) {
551 571
							Point2D ptAux = new Point2D.Double();
552 572
							ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
553
							lineString.add(ptAux);
554
							if (lineString.pointNr() == 1) firstPt = ptAux;
573
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
574
							lineString3D.add(ptAux3D);
575
							if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
555 576
						}					
556 577
					}
557 578
					bulge = bulge_aux;
......
565 586
		double x = 0.0, y = 0.0;
566 587
		double elev = 0.0;
567 588
		DxfGroup g = null;
568
		LineString lineString = new LineString();
569
		Polygon polygon = new Polygon();
589
		LineString3D lineString3D = new LineString3D();
590
		Polygon3D polygon3D = new Polygon3D();
570 591
		//Geometry geometria;
571 592
		//Feature feature= new Feature();
572 593
		Feature feaBordes= new Feature();
......
583 604
			feaFondos.setProp("layer", grp.getDataAsString(8));			
584 605
		if (grp.hasCode(38)) {
585 606
			elev = grp.getDataAsDouble(38);
607
			if (elev!=0.0) dxf3DFile = true;
586 608
			Double doub = new Double(elev);
587 609
			String string = doub.toString();
588 610
			//feature.setProp("elevation", string);
......
629 651
			flags = grp.getDataAsInt(70);
630 652
		if ((flags & 0x01) == 0x01) {
631 653
			//geometria = new Polygon();
632
			feaBordes.setGeometry(lineString);
633
			feaFondos.setGeometry(polygon);
654
			feaBordes.setGeometry(lineString3D);
655
			feaFondos.setGeometry(polygon3D);
634 656
			isDoubleFeatured = true;
635 657
		} else {
636 658
			//geometria = new LineString();
637
			feaBordes.setGeometry(lineString);
659
			feaBordes.setGeometry(lineString3D);
638 660
			isDoubleFeatured = false;
639 661
		}
640 662
		if (grp.hasCode(90))
......
652 674
				x = ((Double) g.getData()).doubleValue();
653 675
			} else if (g.getCode() == 20) {
654 676
				y = ((Double) g.getData()).doubleValue();
655
				//if (y <= 1.0) throw new Exception("Y == "+y);
656
				//lineString.add( proj.createPoint( x, y ) );
657
				//polygon.add( proj.createPoint( x, y ) );
658
				//geometria.add( proj.createPoint( x, y ) );
659
				//lineString.add( proj.createPoint( x, y ) );
660
				//if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
661
				
662 677
				if (hasBulge) {
663 678
					Point2D finalPoint = new Point2D.Double(x, y);
664
					//lineString.remove(lineString.pointNr()-1);
665
					//lineString.remove(lineString.pointNr()-1);
666
					//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
667
					//polygon.remove(polygon.pointNr()-1);
668
					//polygon.remove(polygon.pointNr()-1);
669
					Vector arc = createArc(lineString.get(lineString.pointNr()-1), finalPoint, bulgeLwp);
670
					lineString.remove(lineString.pointNr()-1);
671
					if (isDoubleFeatured) polygon.remove(polygon.pointNr()-1);
679
					Vector arc = createArc(((LineString3D)lineString3D).get(lineString3D.pointNr()-1), finalPoint, bulgeLwp);
680
					lineString3D.remove(lineString3D.pointNr()-1);
681
					if (isDoubleFeatured) polygon3D.remove(polygon3D.pointNr()-1);
672 682
					if (bulgeLwp>0) {
673 683
						for (int k=0; k<arc.size(); k++) {
674 684
							Point2D ptAux = new Point2D.Double();
675 685
							ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY());
676 686
							//System.out.println("createLwPolyline: ptAux = " + ptAux);
677
							lineString.add(ptAux);
687
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), elev);
688
							lineString3D.add(ptAux3D);
678 689
							//if (lineString.pointNr() == 1) firstPt = ptAux;
679
							if (isDoubleFeatured) polygon.add(ptAux);
680
							if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
690
							if (isDoubleFeatured) polygon3D.add(ptAux3D);
691
							if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
681 692
						}
682 693
					} else {
683 694
						for (int k=arc.size()-1; k>=0; k--) {
684 695
							Point2D ptAux = new Point2D.Double();
685 696
							ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY());
686
							lineString.add(ptAux);
687
							if (isDoubleFeatured) polygon.add(ptAux);
688
							if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
697
							Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), elev);
698
							lineString3D.add(ptAux3D);
699
							if (isDoubleFeatured) polygon3D.add(ptAux3D);
700
							if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
689 701
						}
690 702
					}
691 703
					hasBulge = false;
692 704
					bulgeLwp = 0.0;
693 705
				} else {
694 706
					//System.out.println("createLwPolyline: hasBulge siempre es false");
695
					lineString.add( proj.createPoint( x, y ) );
696
					if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
707
					Point3D ptAux3D = new Point3D(proj.createPoint( x, y ).getX(), proj.createPoint( x, y ).getY(), elev);
708
				    lineString3D.add(ptAux3D);
709
					if (isDoubleFeatured) polygon3D.add(ptAux3D);
697 710
				}
698 711
				if (j == 1) {
699 712
					firstX = x;
......
709 722
		}
710 723
		if (isDoubleFeatured) {
711 724
			//geometria.add(proj.createPoint(firstX, firstY));			
712
			lineString.add(proj.createPoint(firstX, firstY));			
713
			polygon.add(proj.createPoint(firstX, firstY));			
725
			Point3D ptAux3D = new Point3D(proj.createPoint(firstX, firstY).getX(), proj.createPoint(firstX, firstY).getY(), elev);
726
			lineString3D.add(ptAux3D);			
727
			polygon3D.add(ptAux3D);			
714 728
		}
715 729
				
716 730
		lastFeaBordes = feaBordes;
......
737 751
		double elev = 0.0;
738 752
		DxfGroup g = null;
739 753
		Point2D pt1 = null, pt2 = null;
740
		LineString lineString = new LineString();
754
		LineString3D lineString3D = new LineString3D();
741 755
		Feature feature = new Feature();
742 756

  
743 757
		feature.setProp("dxfEntity", "Line");
......
766 780
		}
767 781
		x = grp.getDataAsDouble(10);
768 782
		y = grp.getDataAsDouble(20);
769
		if (grp.hasCode(30)) {
783
		z1 = grp.getDataAsDouble(30);
784
		/*if (grp.hasCode(30)) {
770 785
			z1 = grp.getDataAsDouble(30);
771 786
			elev = z1;
772 787
			Double doub = new Double(elev);
773 788
			String string = doub.toString();
774
			feature.setProp("elevation", string);
775
		}
789
			//feature.setProp("elevation", string);
790
		}*/
776 791
		pt1 = proj.createPoint(x, y);
777 792
		x = grp.getDataAsDouble(11);
778 793
		y = grp.getDataAsDouble(21);
779
		if (grp.hasCode(31)) {
794
		z2 = grp.getDataAsDouble(31);
795
		/*if (grp.hasCode(31)) {
780 796
			z2 = grp.getDataAsDouble(31);
781 797
		} else {
782 798
			// Cuando no se especifican z para las lineas se asume que la
783 799
			// z es cero.
784 800
			Double doub = new Double(0.0);
785
			feature.setProp("elevation", doub.toString());
786
		}
801
			//feature.setProp("elevation", doub.toString());
802
		}*/
787 803
		pt2 = proj.createPoint(x, y);
788 804
		if (grp.hasCode(210))
789 805
			xtruX = grp.getDataAsDouble(210);
......
794 810
		Point3D point_in1 = new Point3D(pt1.getX(), pt1.getY(), z1);
795 811
		Point3D point_in2 = new Point3D(pt2.getX(), pt2.getY(), z2);
796 812
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
797
		Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
798
		Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
799
		pt1.setLocation(point_out1);
800
		pt2.setLocation(point_out2);
801
		lineString.add(pt1);
802
		lineString.add(pt2);
813
		Point3D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
814
		Point3D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
815
		if (point_out1.getZ()!=0.0) dxf3DFile = true;
816
		if (point_out2.getZ()!=0.0) dxf3DFile = true;
803 817
		
804
		feature.setGeometry(lineString);
818
		if (point_out1.getZ()==point_out2.getZ()) {
819
			elev = z1;
820
			Double doub = new Double(elev);
821
			String string = doub.toString();
822
			feature.setProp("elevation", string);
823
		} else {
824
			elev = 0.0;
825
			Double doub = new Double(elev);
826
			String string = doub.toString();
827
			feature.setProp("elevation", string);
828
		}
805 829
		
830
		//pt1.setLocation(point_out1);
831
		//pt2.setLocation(point_out2);
832
		lineString3D.add(point_out1);
833
		lineString3D.add(point_out2);
834
		
835
		feature.setGeometry(lineString3D);
836
		
806 837
		// 041130: Rellena las props con los atributos.
807 838
		completeAttributes(feature);
808 839
		
......
822 853
	public void createText(DxfGroupVector grp) throws Exception {
823 854
		double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0;
824 855
		DxfGroup g = null;
825
		Point2D pt1 = null, pt2 = null;
826
		Point2D pt = null;
827
		Point point = new Point();
856
		//Point3D pt1 = null, pt2 = null;
857
		Point3D pt = null;
858
		org.cresques.px.gml.Point3D point = new org.cresques.px.gml.Point3D();
828 859
		
829
		point.isText = true;
860
		point.setTextPoint(true);
830 861
		
831 862
		Feature feature = new Feature();
832 863

  
......
878 909
		}
879 910
		x = grp.getDataAsDouble(10);
880 911
		y = grp.getDataAsDouble(20);
881
		if (grp.hasCode(30)){
882
			z = grp.getDataAsDouble(30);
912
		z = grp.getDataAsDouble(30);
913
		/*if (grp.hasCode(30)){
883 914
			Double doub = new Double(z);
884 915
			String string = doub.toString();
885 916
			feature.setProp("elevation", string);
886 917
		} else {
887 918
			Double doub = new Double(0.0);
888 919
			feature.setProp("elevation", doub.toString());
889
		}
920
		}*/
890 921
		if (grp.hasCode(210))
891 922
			xtruX = grp.getDataAsDouble(210);
892 923
		if (grp.hasCode(220))
......
895 926
			xtruZ = grp.getDataAsDouble(230);
896 927
		Point3D point_in = new Point3D(x, y, z);
897 928
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
898
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
929
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
899 930
		x = point_out.getX();
900 931
		y = point_out.getY();
901
		point.add(new Point2D.Double(x, y));
932
		z = point_out.getZ();
933
		Double doub = new Double(z);
934
		feature.setProp("elevation", doub.toString());
935
		if (z!=0.0) dxf3DFile = true;
936
		point.add(new Point3D(x, y, z));
902 937
		feature.setGeometry(point);
903 938
		
904 939
		// 041130: Rellena las props con los atributos.
......
916 951
	public void createMText(DxfGroupVector grp) throws Exception {
917 952
		double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0;
918 953
		DxfGroup g = null;
919
		Point2D pt1 = null, pt2 = null;
920
		Point2D pt = null;
921
		Point point = new Point();
954
		//Point2D pt1 = null, pt2 = null;
955
		Point3D pt = null;
956
		org.cresques.px.gml.Point3D point = new org.cresques.px.gml.Point3D();
922 957
		
923
		point.isText = true;
958
		point.setTextPoint(true);
924 959
		
925 960
		Feature feature = new Feature();
926 961

  
......
998 1033
		}
999 1034
		x = grp.getDataAsDouble(10);
1000 1035
		y = grp.getDataAsDouble(20);
1001
		if (grp.hasCode(30)){
1036
		z = grp.getDataAsDouble(30);
1037
		/*if (grp.hasCode(30)){
1002 1038
			z = grp.getDataAsDouble(30);
1003 1039
			Double doub = new Double(z);
1004 1040
			String string = doub.toString();
......
1006 1042
		} else {
1007 1043
			Double doub = new Double(0.0);
1008 1044
			feature.setProp("elevation", doub.toString());
1009
		}
1045
		}*/
1010 1046
		if (grp.hasCode(210))
1011 1047
			xtruX = grp.getDataAsDouble(210);
1012 1048
		if (grp.hasCode(220))
......
1015 1051
			xtruZ = grp.getDataAsDouble(230);
1016 1052
		Point3D point_in = new Point3D(x, y, z);
1017 1053
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1018
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1054
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1019 1055
		x = point_out.getX();
1020 1056
		y = point_out.getY();
1021
		point.add(new Point2D.Double(x, y));
1057
		z = point_out.getZ();
1058
		Double doub = new Double(z);
1059
		feature.setProp("elevation", doub.toString());
1060
		if (z!=0.0) dxf3DFile = true;
1061
		point.add(new Point3D(x, y, z));
1022 1062
		feature.setGeometry(point);
1023 1063
		
1024 1064
		// 041130: Rellena las props con los atributos.
......
1036 1076
	public void createPoint(DxfGroupVector grp) throws Exception {
1037 1077
		double x = 0.0, y = 0.0, z = 0.0;
1038 1078
		DxfGroup g = null;
1039
		Point2D pt = null;
1040
		Point point = new Point();
1079
		Point3D pt = null;
1080
		org.cresques.px.gml.Point3D point = new org.cresques.px.gml.Point3D();
1041 1081
		Feature feature = new Feature();
1042 1082

  
1043 1083
		feature.setProp("dxfEntity", "Point");
......
1066 1106
		}
1067 1107
		x = grp.getDataAsDouble(10);
1068 1108
		y = grp.getDataAsDouble(20);
1069
		if (grp.hasCode(30)) {
1109
		z = grp.getDataAsDouble(30);
1110
		/*if (grp.hasCode(30)) {
1070 1111
			z = grp.getDataAsDouble(30);
1071 1112
			Double doub = new Double(z);
1072 1113
			String string = doub.toString();
......
1074 1115
		} else {
1075 1116
			Double doub = new Double(0.0);
1076 1117
			feature.setProp("elevation", doub.toString());
1077
		}
1118
		}*/
1078 1119
		if (grp.hasCode(210))
1079 1120
			xtruX = grp.getDataAsDouble(210);
1080 1121
		if (grp.hasCode(220))
......
1083 1124
			xtruZ = grp.getDataAsDouble(230);
1084 1125
		Point3D point_in = new Point3D(x, y, z);
1085 1126
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1086
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1127
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1087 1128
		x = point_out.getX();
1088 1129
		y = point_out.getY();
1089
		point.add(new Point2D.Double(x, y));
1130
		z = point_out.getZ();
1131
		Double doub = new Double(z);
1132
		feature.setProp("elevation", doub.toString());
1133
		if (z!=0.0) dxf3DFile = true;
1134
		point.add(new Point3D(x, y, z));
1090 1135
		feature.setGeometry(point);
1091 1136
		
1092 1137
		// 041130: Rellena las props con los atributos.
......
1109 1154
	public void createCircle(DxfGroupVector grp) throws Exception {
1110 1155
		double x = 0.0, y = 0.0, z = 0.0;
1111 1156
		double r = 0.0;
1157
		Point3D firstPt = new Point3D();
1112 1158
		DxfGroup g = null;
1113
		LineString lineString = new LineString();
1114
		Polygon polygon = new Polygon();
1159
		LineString3D lineString3D = new LineString3D();
1160
		Polygon3D polygon3D = new Polygon3D();
1115 1161
		Feature feaBordes = new Feature();
1116 1162
		Feature feaFondos = new Feature();
1117 1163
		
......
1149 1195
		}
1150 1196
		x = grp.getDataAsDouble(10);
1151 1197
		y = grp.getDataAsDouble(20);
1152
		if (grp.hasCode(30)) {
1198
		z = grp.getDataAsDouble(30);
1199
		/*if (grp.hasCode(30)) {
1153 1200
			z = grp.getDataAsDouble(30);
1154 1201
			Double doub = new Double(z);
1155 1202
			String string = doub.toString();
......
1159 1206
			Double doub = new Double(0.0);
1160 1207
			feaBordes.setProp("elevation", doub.toString());
1161 1208
			feaFondos.setProp("elevation", doub.toString());
1162
		}
1209
		}*/
1163 1210
		if (grp.hasCode(40)) r = grp.getDataAsDouble(40);
1164 1211
		if (grp.hasCode(210))
1165 1212
			xtruX = grp.getDataAsDouble(210);
......
1169 1216
			xtruZ = grp.getDataAsDouble(230);
1170 1217
		Point3D point_in = new Point3D(x, y, z);
1171 1218
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1172
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1219
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1173 1220
		x = point_out.getX();
1174 1221
		y = point_out.getY();
1175
		
1176
		Point2D center = proj.createPoint( x, y);
1177
		Point2D[] pts = new Point2D[360];
1222
		z = point_out.getZ();
1223
		Double doub = new Double(z);
1224
		feaBordes.setProp("elevation", doub.toString());
1225
		feaFondos.setProp("elevation", doub.toString());
1226
		if (z!=0.0) dxf3DFile = true;
1227
		Point2D c = proj.createPoint( x, y);
1228
		Point3D center = new Point3D(c.getX(), c.getY(), z);
1229
		Point3D[] pts = new Point3D[360];
1178 1230
		int angulo = 0;
1179 1231
		for (angulo=0; angulo<360; angulo++) {
1180
			pts[angulo] = new Point2D.Double(center.getX(), center.getY());
1181
			pts[angulo].setLocation(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[angulo].getY() + r * Math.cos(angulo*Math.PI/(double)180.0));
1232
			pts[angulo] = new Point3D(center.getX(), center.getY(), center.getZ());
1233
			pts[angulo] = new Point3D(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[angulo].getY() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getZ());
1182 1234
			if (pts.length == 1) {
1183 1235
				firstPt = pts[angulo];
1184 1236
			}
1185 1237
		}
1186 1238
		for (int i=0; i<pts.length; i++) {
1187
			lineString.add(pts[i]);
1188
			polygon.add(pts[i]);
1239
			lineString3D.add(pts[i]);
1240
			polygon3D.add(pts[i]);
1189 1241
		}
1190 1242
		
1191
		feaBordes.setGeometry(lineString);
1192
		feaFondos.setGeometry(polygon);
1243
		feaBordes.setGeometry(lineString3D);
1244
		feaFondos.setGeometry(polygon3D);
1193 1245
		
1194 1246
		// 041130: Rellena las props con los atributos.
1195 1247
		completeAttributes(feaBordes);
......
1211 1263
		double x = 0.0, y = 0.0, z = 0.0;
1212 1264
		double r = 0.0, empieza = 0.0, acaba = 0.0;
1213 1265
		DxfGroup g = null;
1214
		LineString lineString = new LineString();
1266
		LineString3D lineString3D = new LineString3D();
1215 1267
		Feature feature = new Feature();
1216 1268

  
1217 1269
		feature.setProp("dxfEntity", "Arc");
......
1240 1292
		}
1241 1293
		x = grp.getDataAsDouble(10);
1242 1294
		y = grp.getDataAsDouble(20);
1243
		if (grp.hasCode(30)) {
1295
		z = grp.getDataAsDouble(30);
1296
		/*if (grp.hasCode(30)) {
1244 1297
			z = grp.getDataAsDouble(30);
1245 1298
			Double doub = new Double(z);
1246 1299
			String string = doub.toString();
......
1248 1301
		} else {
1249 1302
			Double doub = new Double(0.0);
1250 1303
			feature.setProp("elevation", doub.toString());
1251
		}
1304
		}*/
1252 1305
		if (grp.hasCode(40)) r = grp.getDataAsDouble(40);
1253 1306
		if (grp.hasCode(50)) empieza = grp.getDataAsDouble(50);
1254 1307
		if (grp.hasCode(51)) acaba = grp.getDataAsDouble(51);
......
1260 1313
			xtruZ = grp.getDataAsDouble(230);
1261 1314
		Point3D point_in = new Point3D(x, y, z);
1262 1315
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1263
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1316
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1264 1317
		x = point_out.getX();
1265 1318
		y = point_out.getY();
1266
		
1267
		Point2D center = proj.createPoint( x, y);
1319
		z = point_out.getZ();
1320
		Double doub = new Double(z);
1321
		feature.setProp("elevation", doub.toString());
1322
		if (z!=0.0) dxf3DFile = true;
1323
		Point2D c = proj.createPoint( x, y);
1324
		Point3D center = new Point3D(c.getX(), c.getY(), z);
1268 1325
		//System.out.println("empieza = " + empieza + ", acaba = " + acaba);
1269 1326
		int iempieza = (int)empieza;
1270 1327
		int iacaba = (int)acaba;
1271 1328
		//System.out.println("iempieza = " + iempieza + ", iacaba = " + iacaba);
1272 1329
		double angulo = 0;
1273
		Point2D[] pts = null;
1330
		Point3D[] pts = null;
1274 1331
		if (empieza <= acaba) {
1275
			pts = new Point2D[(iacaba-iempieza)+2];
1332
			pts = new Point3D[(iacaba-iempieza)+2];
1276 1333
			angulo = empieza;
1277
			pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1334
			pts[0] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1278 1335
			for (int i=1; i<=(iacaba-iempieza)+1; i++) {
1279 1336
				angulo = (double)(iempieza+i);
1280
				pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1337
				pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1281 1338
			}
1282 1339
			angulo = acaba;
1283
			pts[(iacaba-iempieza)+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1340
			pts[(iacaba-iempieza)+1] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1284 1341
		} else {
1285
			pts = new Point2D[(360-iempieza)+iacaba+2];
1342
			pts = new Point3D[(360-iempieza)+iacaba+2];
1286 1343
			angulo = empieza;
1287 1344
			//System.out.println("pts[0] = " + pts[0] + ", center = " + center + ", angulo = " + angulo);
1288
			pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1345
			pts[0] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1289 1346
			for (int i=1; i<=(360-iempieza); i++) {
1290 1347
				angulo = (double)(iempieza+i);
1291
				pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1348
				pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1292 1349
			}
1293 1350
			for (int i=(360-iempieza)+1; i<=(360-iempieza)+iacaba; i++) {
1294 1351
				angulo = (double)(i-(360-iempieza));
1295
				pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1352
				pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1296 1353
			}
1297 1354
			angulo = acaba;
1298
			pts[(360-iempieza)+iacaba+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0));
1355
			pts[(360-iempieza)+iacaba+1] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), center.getZ());
1299 1356
		}
1300 1357
		for (int i=0; i<pts.length; i++) {
1301
			lineString.add(pts[i]);
1358
			lineString3D.add(pts[i]);
1302 1359
		}
1303 1360
		
1304
		feature.setGeometry(lineString);
1361
		feature.setGeometry(lineString3D);
1305 1362
		
1306 1363
		// 041130: Rellena las props con los atributos.
1307 1364
		completeAttributes(feature);
......
1318 1375
	public void createInsert(DxfGroupVector grp) throws Exception {
1319 1376
		double x = 0.0, y = 0.0, z = 0.0;
1320 1377
		DxfGroup g = null;
1321
		Point2D pt = new Point2D.Double(0.0, 0.0);
1322
		Point2D scaleFactor = new Point2D.Double(1.0, 1.0);
1378
		Point3D pt = new Point3D(0.0, 0.0, 0.0);
1379
		Point3D scaleFactor = new Point3D(1.0, 1.0, 1.0);
1323 1380
		double rotAngle = 0.0;
1324 1381
		String blockName = "";
1325 1382

  
1326
		InsPoint insert = new InsPoint();
1383
		InsPoint3D insert = new InsPoint3D();
1327 1384
		Feature feature = new Feature();
1328
		Point secondGeom = new Point();
1385
		org.cresques.px.gml.Point3D secondGeom = new org.cresques.px.gml.Point3D();
1329 1386
		Feature secondFeat = new Feature();
1330 1387
		int attributesFollowFlag = 0;
1331 1388

  
......
1364 1421
		if (grp.hasCode(66)) {
1365 1422
			attributesFollowFlag = grp.getDataAsInt(66);
1366 1423
		}
1367
		if (grp.hasCode(10)) x = grp.getDataAsDouble(10);
1368
		if (grp.hasCode(20)) y = grp.getDataAsDouble(20);
1369
		if (grp.hasCode(30)) {
1424
		x = grp.getDataAsDouble(10);
1425
		y = grp.getDataAsDouble(20);
1426
		z = grp.getDataAsDouble(30);
1427
		/*if (grp.hasCode(30)) {
1370 1428
			z = grp.getDataAsDouble(30);
1371 1429
			Double doubz = new Double(z);
1372 1430
			String string = doubz.toString();
......
1377 1435
			//feature.setProp("elevation", doub.toString());
1378 1436
			feature.setProp("elevation", elev.toString());
1379 1437
			secondFeat.setProp("elevation", elev.toString());
1380
		}
1438
		}*/
1381 1439
		if (grp.hasCode(41)) {
1382 1440
			scaleFactor.setLocation(grp.getDataAsDouble(41), scaleFactor.getY());
1383
			//Double scaleFactorX = new Double(scaleFactor.getX());
1384
			//feature.setProp("scaleFactorX", scaleFactorX.toString());
1385 1441
			insert.setScaleFactor(scaleFactor);
1386 1442
		} else {
1387
			//Double scaleFactorX = new Double(scaleFactor.getX());
1388
			//feature.setProp("scaleFactorX", scaleFactorX.toString());
1389 1443
			insert.setScaleFactor(scaleFactor);
1390 1444
		}
1391 1445
		if (grp.hasCode(42)) {
1392 1446
			scaleFactor.setLocation(scaleFactor.getX(), grp.getDataAsDouble(42));
1393
			//Double scaleFactorY = new Double(scaleFactor.getY());
1394
			//feature.setProp("scaleFactorY", scaleFactorY.toString());
1395 1447
			insert.setScaleFactor(scaleFactor);
1396 1448
		} else {
1397
			//Double scaleFactorY = new Double(scaleFactor.getY());
1398
			//feature.setProp("scaleFactorY", scaleFactorY.toString());
1399 1449
			insert.setScaleFactor(scaleFactor);
1400 1450
		}
1401 1451
		if (grp.hasCode(43)) {
1402
			// TODO La coordenada z
1452
			scaleFactor = new Point3D(scaleFactor.getX(), scaleFactor.getY(), grp.getDataAsDouble(43));
1453
			insert.setScaleFactor(scaleFactor);
1454
		} else {
1455
			insert.setScaleFactor(scaleFactor);
1403 1456
		}
1404 1457
		if (grp.hasCode(50)) {
1405 1458
			rotAngle = grp.getDataAsDouble(50);
1406
			//Double objRotAngle = new Double(rotAngle);
1407
			//feature.setProp("rotAngle", objRotAngle.toString());
1408 1459
			insert.setRotAngle(rotAngle);
1409 1460
		}
1410 1461
		if (grp.hasCode(210))
......
1415 1466
			xtruZ = grp.getDataAsDouble(230);
1416 1467
		Point3D point_in = new Point3D(x, y, z);
1417 1468
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1418
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1469
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1419 1470
		x = point_out.getX();
1420 1471
		y = point_out.getY();
1421
		
1472
		z = point_out.getZ();
1473
		Double doubz = new Double(z);
1474
		feature.setProp("elevation", doubz.toString());
1475
		secondFeat.setProp("elevation", doubz.toString());
1476
		if (z!=0.0) dxf3DFile = true;
1422 1477
		insert.setBlkList(blkList);
1423 1478
		
1424 1479
		insert.encuentraBloque(blockName);
1425 1480
		
1426
		insert.add(new Point2D.Double(x, y));
1427
		secondGeom.add(new Point2D.Double(x, y));
1481
		insert.add(new Point3D(x, y, z));
1482
		secondGeom.add(new Point3D(x, y, z));
1428 1483
		
1429 1484
		feature.setGeometry(insert);
1430 1485
		secondFeat.setGeometry(secondGeom);
......
1468 1523
		double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0, z3 = 0.0, z4 = 0.0;
1469 1524
		DxfGroup g = null;
1470 1525
		//Point2D pt1 = null, pt2 = null, pt3 = null, pt4 = null;
1471
		Point2D[] pts = new Point2D[4];
1526
		Point3D[] pts = new Point3D[4];
1472 1527
		//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
1473 1528
		
1474
		LineString lineString = new LineString();
1475
		Polygon polygon = new Polygon();
1529
		LineString3D lineString3D = new LineString3D();
1530
		Polygon3D polygon3D = new Polygon3D();
1476 1531
		Feature feaBordes = new Feature();
1477 1532
		Feature feaFondos = new Feature();
1478
		double elev = 0;
1533
		//double elev = 0;
1479 1534

  
1480 1535
		feaBordes.setProp("dxfEntity", "Solid");
1481 1536
		feaFondos.setProp("dxfEntity", "Solid");
......
1484 1539
			feaFondos.setProp("layer", grp.getDataAsString(8));
1485 1540
		x = grp.getDataAsDouble(10);
1486 1541
		y = grp.getDataAsDouble(20);
1487
		if (grp.hasCode(30)) {
1542
		z1 = grp.getDataAsDouble(30);
1543
		/*if (grp.hasCode(30)) {
1488 1544
			z1 = grp.getDataAsDouble(30);
1489
			elev = z1;
1490
			Double doub = new Double(elev);
1491
			String string = doub.toString();
1492
			feaBordes.setProp("elevation", string);
1493
			feaFondos.setProp("elevation", string);
1494 1545
		} else {
1495 1546
			Double doub = new Double(0.0);
1496 1547
			feaBordes.setProp("elevation", doub.toString());
1497 1548
			feaFondos.setProp("elevation", doub.toString());
1498
		}
1499
		pts[0] = proj.createPoint(x, y);
1549
		}*/
1550
		Point2D pto = proj.createPoint(x, y);
1551
		Point3D pto3D = new Point3D(pto.getX(), pto.getY(), z1);
1552
		pts[0] = pto3D;
1500 1553
		x = grp.getDataAsDouble(11);
1501 1554
		y = grp.getDataAsDouble(21);
1502
		if (grp.hasCode(31)) z2 = grp.getDataAsDouble(31);
1503
		pts[1] = proj.createPoint(x, y);
1555
		z2 = grp.getDataAsDouble(31);
1556
		pto = proj.createPoint(x, y);
1557
		pto3D = new Point3D(pto.getX(), pto.getY(), z2);
1558
		pts[1] = pto3D;
1504 1559
		x = grp.getDataAsDouble(12);
1505 1560
		y = grp.getDataAsDouble(22);
1506
		if (grp.hasCode(32)) z3 = grp.getDataAsDouble(32);
1507
		pts[2] = proj.createPoint(x, y);
1508
		x = grp.getDataAsDouble(13);
1509
		y = grp.getDataAsDouble(23);
1510
		if (grp.hasCode(33)) z2 = grp.getDataAsDouble(33);
1511
		pts[3] = proj.createPoint(x, y);
1561
		z3 = grp.getDataAsDouble(32);
1562
		pto = proj.createPoint(x, y);
1563
		pto3D = new Point3D(pto.getX(), pto.getY(), z3);
1564
		pts[2] = pto3D;
1565
		if (grp.hasCode(13)) x = grp.getDataAsDouble(13);
1566
		if (grp.hasCode(23)) y = grp.getDataAsDouble(23);
1567
		if (grp.hasCode(33)) z4 = grp.getDataAsDouble(33);
1568
		pto = proj.createPoint(x, y);
1569
		pto3D = new Point3D(pto.getX(), pto.getY(), z4);
1570
		pts[3] = pto3D;
1512 1571
		if (grp.hasCode(39)) {
1513 1572
			Double doub = new Double(grp.getDataAsDouble(39));
1514 1573
			String string = doub.toString();
......
1547 1606
		Point3D point_in3 = new Point3D(pts[2].getX(), pts[2].getY(), z3);
1548 1607
		Point3D point_in4 = new Point3D(pts[3].getX(), pts[3].getY(), z4);
1549 1608
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1550
		Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
1551
		Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
1552
		Point2D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
1553
		Point2D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
1554
		pts[0].setLocation(point_out1);
1555
		pts[1].setLocation(point_out2);
1556
		pts[2].setLocation(point_out3);
1557
		pts[3].setLocation(point_out4);
1558
		
1559
		Point2D aux = pts[2];
1609
		Point3D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
1610
		Point3D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
1611
		Point3D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
1612
		Point3D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
1613
		pts[0] = new Point3D(point_out1);
1614
		pts[1] = new Point3D(point_out2);
1615
		pts[2] = new Point3D(point_out3);
1616
		pts[3] = new Point3D(point_out4);
1617
		if (pts[0].getZ()!=0.0 || pts[1].getZ()!=0.0 || pts[2].getZ()!=0.0 || pts[3].getZ()!=0.0) dxf3DFile = true;
1618
		Point3D aux = pts[3];
1560 1619
		pts[2] = pts[3];
1561 1620
		pts[3] = aux;
1562 1621
		
1622
		if (pts[0].getZ()==pts[1].getZ() && pts[1].getZ()==pts[2].getZ() && pts[2].getZ()==pts[3].getZ()) {
1623
			Double doub = new Double(pts[0].getZ());
1624
			String string = doub.toString();
1625
			feaBordes.setProp("elevation", string);
1626
			feaFondos.setProp("elevation", string);
1627
		} else {
1628
			Double doub = new Double(0.0);
1629
			String string = doub.toString();
1630
			feaBordes.setProp("elevation", string);
1631
			feaFondos.setProp("elevation", string);
1632
		}
1633
		
1563 1634
		for (int i=0; i<pts.length; i++) {
1564
			lineString.add(pts[i]);
1565
			polygon.add(pts[i]);
1635
			lineString3D.add(pts[i]);
1636
			polygon3D.add(pts[i]);
1566 1637
		}
1567 1638
		
1568 1639
		// Para cerrarlos.
1569
		lineString.add(pts[0]);
1570
		polygon.add(pts[0]);
1640
		lineString3D.add(pts[0]);
1641
		polygon3D.add(pts[0]);
1571 1642
		
1572
		feaBordes.setGeometry(lineString);
1573
		feaFondos.setGeometry(polygon);
1643
		feaBordes.setGeometry(lineString3D);
1644
		feaFondos.setGeometry(polygon3D);
1574 1645
		
1575 1646
		// 041130: Rellena las props con los atributos.
1576 1647
		completeAttributes(feaBordes);
......
1589 1660
	}
1590 1661
	
1591 1662
	public void createSpline(DxfGroupVector grp) throws Exception {
1592
		double x = 0.0, y = 0.0, z = 0.0, elev = 0.0;
1663
		double x = 0.0, y = 0.0, z = 0.0; //elev = 0.0;
1593 1664
		//double elev = 0.0;
1594 1665
		DxfGroup g = null;
1595
		LineString lineString = new LineString();
1596
		Polygon polygon = new Polygon();
1666
		LineString3D lineString3D = new LineString3D();
1667
		Polygon3D polygon3D = new Polygon3D();
1597 1668
		//Geometry geometria;
1598 1669
		//Feature feature= new Feature();
1599 1670
		Feature feaBordes= new Feature();
......
1643 1714
			flags = grp.getDataAsInt(70);
1644 1715
		if ((flags & 0x01) == 0x01) {
1645 1716
			//geometria = new Polygon();
1646
			feaBordes.setGeometry(lineString);
1647
			feaFondos.setGeometry(polygon);
1717
			feaBordes.setGeometry(lineString3D);
1718
			feaFondos.setGeometry(polygon3D);
1648 1719
			isDoubleFeatured = true;
1649 1720
		} else {
1650 1721
			//geometria = new LineString();
1651
			feaBordes.setGeometry(lineString);
1722
			feaBordes.setGeometry(lineString3D);
1652 1723
			isDoubleFeatured = false;
1653 1724
		}
1654 1725
		
......
1663 1734
				x = ((Double) g.getData()).doubleValue();
1664 1735
			} else if (g.getCode() == 20) {
1665 1736
				y = ((Double) g.getData()).doubleValue();
1666
				//if (y <= 1.0) throw new Exception("Y == "+y);
1667
				//lineString.add( proj.createPoint( x, y ) );
1668
				//polygon.add( proj.createPoint( x, y ) );
1669
				//geometria.add( proj.createPoint( x, y ) );
1670 1737
			} else if (g.getCode() == 30) {
1671 1738
				z = ((Double) g.getData()).doubleValue();				
1672
				// OJO --> proj.createPoint no acepta ptos con 3 coordenadas,
1673
				//		   ni gvSIG en esta fase de desarrollo.
1674
				lineString.add(proj.createPoint(x, y));
1675
				if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
1739
				Point2D p = proj.createPoint(x, y);
1740
				Point3D p3d = new Point3D(p.getX(), p.getY(), z);
1741
				lineString3D.add(p3d);
1742
				if (isDoubleFeatured) polygon3D.add(p3d);
1676 1743
				if (j == 1) {
1677 1744
					firstX = x;
1678 1745
					firstY = y;
1679 1746
					firstZ = z;
1680 1747
				}
1681
				elev = z;
1748
				//elev = z;
1682 1749
				x = 0.0; y = 0.0; z = 0.0;
1683 1750
			}
1684 1751
		}
1685 1752
		
1686
		Double doub = new Double(elev);
1687
		String string = doub.toString();
1753
		//Double doub = new Double(elev);
1754
		//String string = doub.toString();
1688 1755
		//feature.setProp("elevation", string);
1689
		feaBordes.setProp("elevation", string);
1690
		feaFondos.setProp("elevation", string);
1756
		//feaBordes.setProp("elevation", string);
1757
		//feaFondos.setProp("elevation", string);
1691 1758
		
1692 1759
		if (isDoubleFeatured) {
1693
			//geometria.add(proj.createPoint(firstX, firstY));			
1694
			lineString.add(proj.createPoint(firstX, firstY));			
1695
			polygon.add(proj.createPoint(firstX, firstY));			
1760
		    Point2D p = proj.createPoint(firstX, firstY);
1761
			Point3D p3d = new Point3D(p.getX(), p.getY(), z);
1762
			lineString3D.add(p3d);
1763
			polygon3D.add(p3d);			
1696 1764
		}
1697
				
1765
		
1766
		double zprev = 0;
1767
		boolean constSplineElev = true;
1768
		for (int i=0;i<lineString3D.pointNr();i++) {
1769
		    z = lineString3D.getPoint3D(i).getZ();
1770
			if (z!=0.0) dxf3DFile = true;
1771
		    if (i>0 && z!=zprev) {
1772
		        constSplineElev = false;
1773
		    }
1774
		    zprev = z;
1775
		}
1776
		if (constSplineElev) {
1777
			Double doub = new Double(lineString3D.getPoint3D(0).getZ());
1778
			String string = doub.toString();
1779
			feaBordes.setProp("elevation", string);
1780
			if (isDoubleFeatured) feaFondos.setProp("elevation", string);
1781
		} else {
1782
			Double doub = new Double(0.0);
1783
			String string = doub.toString();
1784
			feaBordes.setProp("elevation", string);
1785
			if (isDoubleFeatured) feaFondos.setProp("elevation", string);
1786
		}
1787
		
1698 1788
		lastFeaBordes = feaBordes;
1699 1789
		if (isDoubleFeatured) lastFeaFondos = feaFondos;
1700 1790
		
......
1745 1835
		double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0;
1746 1836
		DxfGroup g = null;
1747 1837
		//Point2D pt1 = null, pt2 = null;
1748
		Point2D pt = null;
1749
		Point point = new Point();
1838
		Point3D pt = null;
1839
		org.cresques.px.gml.Point3D point = new org.cresques.px.gml.Point3D();
1750 1840
		
1751
		point.isText = true;
1841
		point.setTextPoint(true);
1752 1842
		
1753 1843
		String defaultValue = "";
1754 1844
		String tagString = "";
......
1835 1925
		}
1836 1926
		x = grp.getDataAsDouble(10);
1837 1927
		y = grp.getDataAsDouble(20);
1838
		if (grp.hasCode(30)){
1928
		z = grp.getDataAsDouble(30);
1929
		/*if (grp.hasCode(30)){
1839 1930
			z = grp.getDataAsDouble(30);
1840 1931
			Double doub = new Double(z);
1841 1932
			String string = doub.toString();
......
1843 1934
		} else {
1844 1935
			Double doub = new Double(0.0);
1845 1936
			feature.setProp("elevation", doub.toString());
1846
		}
1937
		}*/
1847 1938
		if (grp.hasCode(210))
1848 1939
			xtruX = grp.getDataAsDouble(210);
1849 1940
		if (grp.hasCode(220))
......
1852 1943
			xtruZ = grp.getDataAsDouble(230);
1853 1944
		Point3D point_in = new Point3D(x, y, z);
1854 1945
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
1855
		Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1946
		Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
1856 1947
		x = point_out.getX();
1857 1948
		y = point_out.getY();
1858
		point.add(new Point2D.Double(x, y));
1949
		z = point_out.getZ();
1950
		Double doub = new Double(z);
1951
		feature.setProp("elevation", doub.toString());
1952
		if (z!=0.0) dxf3DFile = true;
1953
		point.add(new Point3D(x, y, z));
1859 1954
		feature.setGeometry(point);
1860 1955
		
1861 1956
		// 041130: Rellena las props con los atributos.
......
1874 1969
		//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
1875 1970
		blk = new FeatureCollection(proj);
1876 1971
		
1877
		Point2D basePoint = new Point2D.Double();
1972
		Point3D basePoint = new Point3D();
1878 1973
		String blockName = "";
1879 1974
		//System.out.println("createBlock(): Creamos nuevo bloque, el bloque " + iterator);
1880 1975
		
......
1910 2005
			//blk.setBlkName(blockName);
1911 2006
			blk.setProp("blockName", blockName);
1912 2007
		}
1913
		// 041001: Anulado porque provoca que no se visualizen bloques de la
1914
		// leyenda en m54643.dxf.
1915
		/*if (grp.hasCode(3)) {
1916
			blockName = grp.getDataAsString(3);
1917
			//blk.setBlkName(blockName);
1918
			blk.setProp("blockName", blockName);
1919
		}*/
1920 2008
		if (grp.hasCode(10)) {
1921
			//basePoint.setLocation(grp.getDataAsDouble(10), basePoint.getY());
1922
			//blk.setBPoint(basePoint);
1923 2009
			Double basePointX = new Double(grp.getDataAsDouble(10));
2010
			basePoint.X = grp.getDataAsDouble(10);
1924 2011
			blk.setProp("basePointX", basePointX.toString());
1925 2012
		}
1926 2013
		if (grp.hasCode(20)) {
1927
			//basePoint.setLocation(basePoint.getX(), grp.getDataAsDouble(20));
1928
			//blk.setBPoint(basePoint);
1929 2014
			Double basePointY = new Double(grp.getDataAsDouble(20));
2015
			basePoint.Y = grp.getDataAsDouble(20);
1930 2016
			blk.setProp("basePointY", basePointY.toString());
1931 2017
		}
1932 2018
		if (grp.hasCode(30)) {
1933
			//basePoint.setLocation(basePoint.getZ(), grp.getDataAsDouble(30));
1934
			//blk.setBPoint(basePoint);
1935 2019
			Double basePointZ = new Double(grp.getDataAsDouble(30));
2020
			basePoint.Z = grp.getDataAsDouble(30);
2021
			if (basePoint.getZ()!=0.0) dxf3DFile = true;
1936 2022
			blk.setProp("basePointZ", basePointZ.toString());
1937 2023
		}
1938 2024
		if (grp.hasCode(70)) {
......
1954 2040
		Vector blkList = getBlkList();
1955 2041
		FeatureCollection block = null;
1956 2042
		Feature feature = null;
1957
		InsPoint insert = null;
1958
		Point2D point1 = new Point2D.Double();
1959
		Point2D point2 = new Point2D.Double();
1960
		//System.out.println("blkList = " + blkList);
1961
		//System.out.println("blkList.size() = " + blkList.size());
2043
		InsPoint3D insert = null;
1962 2044
		for (int i=0; i<blkList.size(); i++) {
1963 2045
			//System.out.println("compruebaBloques(): Bloque " + i +" de " + blkList.size());
1964 2046
			block = (FeatureCollection) blkList.get(i);
......
1966 2048
			for (int j=0; j<aux; j++) {
1967 2049
				feature = (Feature)block.get(j);
1968 2050
				//if (feature.getGeometry() instanceof InsPoint && feature.getProp("isAnInsert") == "true") {
1969
				if (feature.getGeometry() instanceof InsPoint) {
1970
					insert = (InsPoint)feature.getGeometry();
2051
				if (feature.getGeometry() instanceof InsPoint3D) {
2052
					insert = (InsPoint3D)feature.getGeometry();
1971 2053
					String nomBlock = insert.getBlockName();
1972
					//System.out.println("compruebaBloques(): Bloque = " + i + ", elemento = " + j + ", inserta el bloque = " + nomBlock);
1973
					//System.out.println("compruebaBloques(): insert.get(0) = " + insert.get(0));
1974
					//System.out.println("compruebaBloques(): feature.getProp(rotAngle) = " + insert.getRotAngle());
1975
					//System.out.println("compruebaBloques(): insert.getScaleFactor() = " + insert.getScaleFactor());
1976
					//if (feature.getProp("blockFound") == "false") {
1977 2054
					if (insert.getBlockFound() == false) {
1978 2055
						//System.out.println("compruebaBloques(): Ahora se ocupa del DxfInsert " + nomBlock);
1979 2056
						insert.encuentraBloque(nomBlock);
1980 2057
						//gestionaInsert(feature);
1981 2058
						//block.add(feature);
1982 2059
					}
1983
						
1984 2060
				}
1985 2061
			}
1986 2062
		}
......
1988 2064
    
1989 2065
	private void gestionaInsert(Feature feature) {
1990 2066
		Feature feature2 = null;
1991
		Point point = null;
1992
		LineString lineString = null;
1993
		Polygon polygon = null;
1994
		InsPoint insert = new InsPoint();
1995
		insert = (InsPoint)feature.getGeometry();
2067
		org.cresques.px.gml.Point3D point = null;
2068
		LineString3D lineString3D = null;
2069
		Polygon3D polygon3D = null;
2070
		InsPoint3D insert = new InsPoint3D();
2071
		insert = (InsPoint3D)feature.getGeometry();
1996 2072
		double bPointX = 0.0;
1997 2073
		double bPointY = 0.0;
2074
		double bPointZ = 0.0;
1998 2075
		//if (insert.getBlockFound() == true) {
1999 2076
			bPointX = Double.parseDouble(insert.getBlock().getProp("basePointX"));
2000 2077
			bPointY = Double.parseDouble(insert.getBlock().getProp("basePointY"));
2078
			bPointZ = Double.parseDouble(insert.getBlock().getProp("basePointZ"));
2001 2079
		//}
2002 2080
		double sFactorX = insert.getScaleFactor().getX();
2003 2081
		double sFactorY = insert.getScaleFactor().getY();
2082
		double sFactorZ = insert.getScaleFactor().getZ();
2004 2083
		double rAngleGra = insert.getRotAngle();
2005 2084
		double rAngleRad = rAngleGra*Math.PI/180.0;
2006
		InsPoint insert2 = null;
2085
		InsPoint3D insert2 = null;
2007 2086
		
2008 2087
		for (int i=0; i<insert.getBlock().size(); i++) {
2009 2088
			//System.out.println("gestionaInserts: insert.getBlock().features.size() = " + insert.getBlock().size());
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff