Revision 3151
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java | ||
---|---|---|
59 | 59 |
public class DxfFeatureMaker implements DxfFile.EntityFactory, Projected { |
60 | 60 |
IProjection proj = null; |
61 | 61 |
|
62 |
Feature lastFeature = null; |
|
63 |
Feature attribFeature = null; |
|
64 |
//Feature lastFeaBordes = null; |
|
65 |
//Feature lastFeaFondos = null; |
|
66 |
//boolean isDoubleFeatured = false; |
|
67 |
boolean isClosedFeatured = false; |
|
62 |
//Feature lastFeature = null; |
|
63 |
Feature lastFeaBordes = null; |
|
64 |
Feature lastFeaFondos = null; |
|
65 |
boolean isDoubleFeatured = false; |
|
68 | 66 |
FeatureCollection features = null; |
69 | 67 |
double bulge = 0.0; |
70 | 68 |
double xtruX = 0.0; |
... | ... | |
144 | 142 |
LineString3D lineString3D = new LineString3D(); |
145 | 143 |
Polygon3D polygon3D = new Polygon3D(); |
146 | 144 |
|
147 |
Feature feature= new Feature(); |
|
148 |
//Feature feaBordes = new Feature();
|
|
149 |
//Feature feaFondos = new Feature();
|
|
145 |
//Feature feature= new Feature();
|
|
146 |
Feature feaBordes = new Feature(); |
|
147 |
Feature feaFondos = new Feature(); |
|
150 | 148 |
double x = 0.0; |
151 | 149 |
double y = 0.0; |
152 | 150 |
double z = 0.0; |
... | ... | |
156 | 154 |
// 041122: Cada polyline tiene asociado un objeto faces distinto. |
157 | 155 |
faces = new Vector(); |
158 | 156 |
|
159 |
feature.setProp("dxfEntity", "Polyline"); |
|
160 |
//feaBordes.setProp("dxfEntity", "Polyline");
|
|
161 |
//feaFondos.setProp("dxfEntity", "Polyline");
|
|
157 |
//feature.setProp("dxfEntity", "Polyline");
|
|
158 |
feaBordes.setProp("dxfEntity", "Polyline"); |
|
159 |
feaFondos.setProp("dxfEntity", "Polyline"); |
|
162 | 160 |
|
163 | 161 |
if (grp.hasCode(8)) { |
164 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
165 |
//feaBordes.setProp("layer", grp.getDataAsString(8));
|
|
166 |
//feaFondos.setProp("layer", grp.getDataAsString(8));
|
|
162 |
//feature.setProp("layer", grp.getDataAsString(8));
|
|
163 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
164 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
167 | 165 |
} |
168 | 166 |
|
169 | 167 |
if (grp.hasCode(39)) { |
170 | 168 |
Double doub = new Double(grp.getDataAsDouble(39)); |
171 | 169 |
String string = doub.toString(); |
172 | 170 |
|
173 |
feature.setProp("thickness", string); |
|
174 |
//feaBordes.setProp("thickness", string);
|
|
175 |
//feaFondos.setProp("thickness", string);
|
|
171 |
//feature.setProp("thickness", string);
|
|
172 |
feaBordes.setProp("thickness", string); |
|
173 |
feaFondos.setProp("thickness", string); |
|
176 | 174 |
} else { |
177 | 175 |
Double doub = new Double(0.0); |
178 | 176 |
|
179 |
feature.setProp("thickness", doub.toString()); |
|
180 |
//feaBordes.setProp("thickness", doub.toString());
|
|
181 |
//feaFondos.setProp("thickness", doub.toString());
|
|
177 |
//feature.setProp("thickness", doub.toString());
|
|
178 |
feaBordes.setProp("thickness", doub.toString()); |
|
179 |
feaFondos.setProp("thickness", doub.toString()); |
|
182 | 180 |
} |
183 | 181 |
|
184 | 182 |
if (grp.hasCode(62)) { |
185 | 183 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
186 | 184 |
String string = integer.toString(); |
187 | 185 |
|
188 |
feature.setProp("color", string); |
|
189 |
//feaBordes.setProp("color", string); |
|
190 |
//feaFondos.setProp("color", string); |
|
191 |
feature.setProp("colorByLayer", "false"); |
|
192 |
//feaBordes.setProp("colorByLayer", "false"); |
|
193 |
//feaFondos.setProp("colorByLayer", "false"); |
|
186 |
//feature.setProp("color", string); |
|
187 |
feaBordes.setProp("color", string); |
|
188 |
feaFondos.setProp("color", string); |
|
189 |
feaBordes.setProp("colorByLayer", "false"); |
|
190 |
feaFondos.setProp("colorByLayer", "false"); |
|
194 | 191 |
} else { |
195 | 192 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
196 | 193 |
int clr = layer.colorNumber; |
197 | 194 |
Integer integer = new Integer(clr); |
198 | 195 |
String string = integer.toString(); |
199 | 196 |
|
200 |
feature.setProp("color", string); |
|
201 |
//feaBordes.setProp("color", string); |
|
202 |
//feaFondos.setProp("color", string); |
|
203 |
feature.setProp("colorByLayer", "true"); |
|
204 |
//feaBordes.setProp("colorByLayer", "true"); |
|
205 |
//feaFondos.setProp("colorByLayer", "true"); |
|
197 |
//feature.setProp("color", string); |
|
198 |
feaBordes.setProp("color", string); |
|
199 |
feaFondos.setProp("color", string); |
|
200 |
feaBordes.setProp("colorByLayer", "true"); |
|
201 |
feaFondos.setProp("colorByLayer", "true"); |
|
206 | 202 |
} |
207 | 203 |
|
208 | 204 |
if (grp.hasCode(10)) { |
... | ... | |
223 | 219 |
Double doub = new Double(z); |
224 | 220 |
String string = doub.toString(); |
225 | 221 |
|
226 |
feature.setProp("elevation", string); |
|
227 |
//feaBordes.setProp("elevation", string);
|
|
228 |
//feaFondos.setProp("elevation", string);
|
|
222 |
//feature.setProp("elevation", string);
|
|
223 |
feaBordes.setProp("elevation", string); |
|
224 |
feaFondos.setProp("elevation", string); |
|
229 | 225 |
} else { |
230 | 226 |
Double doub = new Double(0.0); |
231 | 227 |
|
232 |
feature.setProp("elevation", doub.toString()); |
|
233 |
//feaBordes.setProp("elevation", doub.toString());
|
|
234 |
//feaFondos.setProp("elevation", doub.toString());
|
|
228 |
//feature.setProp("elevation", doub.toString());
|
|
229 |
feaBordes.setProp("elevation", doub.toString()); |
|
230 |
feaFondos.setProp("elevation", doub.toString()); |
|
235 | 231 |
} |
236 | 232 |
|
237 | 233 |
if (grp.hasCode(70)) { |
... | ... | |
251 | 247 |
} |
252 | 248 |
|
253 | 249 |
if (((flags & 0x01) == 0x01) || ((flags & 0x40) == 0x40)) { |
254 |
feature.setGeometry(polygon3D); |
|
255 |
//feaBordes.setGeometry(lineString3D); |
|
256 |
//feaFondos.setGeometry(polygon3D); |
|
257 |
lastFeature = feature; |
|
258 |
//lastFeaBordes = feaBordes; |
|
259 |
//lastFeaFondos = feaFondos; |
|
260 |
//isDoubleFeatured = true; |
|
261 |
isClosedFeatured = true; |
|
250 |
feaBordes.setGeometry(lineString3D); |
|
251 |
feaFondos.setGeometry(polygon3D); |
|
252 |
lastFeaBordes = feaBordes; |
|
253 |
lastFeaFondos = feaFondos; |
|
254 |
isDoubleFeatured = true; |
|
262 | 255 |
} else if ((flags & 0x01) == 0x00) { |
263 |
feature.setGeometry(lineString3D); |
|
264 |
//feaBordes.setGeometry(lineString3D); |
|
265 |
lastFeature = feature; |
|
266 |
//lastFeaBordes = feaBordes; |
|
267 |
//isDoubleFeatured = false; |
|
268 |
isClosedFeatured = false; |
|
256 |
feaBordes.setGeometry(lineString3D); |
|
257 |
lastFeaBordes = feaBordes; |
|
258 |
isDoubleFeatured = false; |
|
269 | 259 |
} else { |
270 | 260 |
System.out.println("Detectada una Polyline Flag que no corresponde"); |
271 | 261 |
System.out.println("a una Polyline corriente, ni a una Closed Polyline"); |
... | ... | |
276 | 266 |
* @see org.cresques.io.DxfFile.EntityFactory#endSeq(org.cresques.io.DxfGroupVector) |
277 | 267 |
*/ |
278 | 268 |
public void endSeq() throws Exception { |
279 |
//if (isDoubleFeatured) { |
|
280 |
if (isClosedFeatured) { |
|
281 |
//if (lastFeaBordes.getGeometry() instanceof LineString3D) { |
|
282 |
if (lastFeature.getGeometry() instanceof Polygon3D) { |
|
283 |
//Feature feaBordes = lastFeaBordes; |
|
284 |
//Feature feaFondos = lastFeaFondos; |
|
285 |
Feature feature = lastFeature; |
|
286 |
//LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
287 |
//Polygon3D polygon3D = (Polygon3D) feaFondos.getGeometry(); |
|
288 |
Polygon3D polygon3D = (Polygon3D) feature.getGeometry(); |
|
289 |
//lineString3D.add(firstPt); |
|
290 |
polygon3D.add(firstPt); |
|
269 |
if (isDoubleFeatured) { |
|
270 |
if (lastFeaBordes.getGeometry() instanceof LineString3D) { |
|
271 |
Feature feaBordes = lastFeaBordes; |
|
272 |
Feature feaFondos = lastFeaFondos; |
|
273 |
LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
274 |
Polygon3D polygon3D = (Polygon3D) feaFondos.getGeometry(); |
|
275 |
lineString3D.add(firstPt); |
|
291 | 276 |
|
292 |
//if ((bulge != 0) && !((lineString3D.get(lineString3D.pointNr() - 2).getX() == lineString3D.get(lineString3D.pointNr() - 1).getX()) && (lineString3D.get(lineString3D.pointNr() - 2).getY() == lineString3D.get(lineString3D.pointNr() - 1).getY()))) { |
|
293 |
if ((bulge != 0) && !((polygon3D.get(polygon3D.pointNr() - 2).getX() == polygon3D.get(polygon3D.pointNr() - 1).getX()) && (polygon3D.get(polygon3D.pointNr() - 2).getY() == polygon3D.get(polygon3D.pointNr() - 1).getY()))) { |
|
277 |
if ((bulge != 0) && |
|
278 |
!((lineString3D.get(lineString3D.pointNr() - 2).getX() == lineString3D.get(lineString3D.pointNr() - |
|
279 |
1) |
|
280 |
.getX()) && |
|
281 |
(lineString3D.get(lineString3D.pointNr() - 2).getY() == lineString3D.get(lineString3D.pointNr() - |
|
282 |
1) |
|
283 |
.getY()))) { |
|
294 | 284 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF |
295 |
/*Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr() -
|
|
285 |
Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr() - |
|
296 | 286 |
2) |
297 | 287 |
.getX(), |
298 | 288 |
lineString3D.get(lineString3D.pointNr() - |
... | ... | |
304 | 294 |
lineString3D.get(lineString3D.pointNr() - |
305 | 295 |
1) |
306 | 296 |
.getY()), |
307 |
bulge);*/ |
|
308 |
Vector arc = createArc(new Point2D.Double(polygon3D.get(polygon3D.pointNr() - |
|
309 |
2) |
|
310 |
.getX(), |
|
311 |
polygon3D.get(polygon3D.pointNr() - |
|
312 |
2) |
|
313 |
.getY()), |
|
314 |
new Point2D.Double(polygon3D.get(polygon3D.pointNr() - |
|
315 |
1) |
|
316 |
.getX(), |
|
317 |
polygon3D.get(polygon3D.pointNr() - |
|
318 |
1) |
|
319 |
.getY()), |
|
320 |
bulge); |
|
321 |
//lineString3D.remove(lineString3D.pointNr() - 1); |
|
322 |
//lineString3D.remove(lineString3D.pointNr() - 1); |
|
323 |
polygon3D.remove(polygon3D.pointNr() - 1); |
|
324 |
polygon3D.remove(polygon3D.pointNr() - 1); |
|
297 |
bulge); |
|
298 |
lineString3D.remove(lineString3D.pointNr() - 1); |
|
299 |
lineString3D.remove(lineString3D.pointNr() - 1); |
|
300 |
polygon3D.remove(lineString3D.pointNr() - 1); |
|
301 |
polygon3D.remove(lineString3D.pointNr() - 1); |
|
325 | 302 |
|
326 | 303 |
if (bulge > 0) { |
327 | 304 |
for (int i = 0; i < arc.size(); i++) { |
328 | 305 |
Point2D ptAux = new Point2D.Double(); |
329 |
//double z = ((Point3D) lineString3D.get(lineString3D.pointNr() - 2)).getZ();
|
|
330 |
double z = ((Point3D) polygon3D.get(polygon3D.pointNr() - 2)).getZ();
|
|
306 |
double z = ((Point3D) lineString3D.get(lineString3D.pointNr() -
|
|
307 |
2)).getZ();
|
|
331 | 308 |
ptAux = proj.createPoint(((Point2D) arc.get(i)).getX(), |
332 | 309 |
((Point2D) arc.get(i)).getY()); |
333 | 310 |
|
334 | 311 |
Point3D ptAux3D = new Point3D(ptAux.getX(), |
335 | 312 |
ptAux.getY(), z); |
336 |
//lineString3D.add(ptAux3D);
|
|
313 |
lineString3D.add(ptAux3D); |
|
337 | 314 |
polygon3D.add(ptAux3D); |
338 | 315 |
|
339 |
//if (lineString3D.pointNr() == 1) { |
|
340 |
// firstPt = ptAux3D; |
|
341 |
//} |
|
342 |
if (polygon3D.pointNr() == 1) { |
|
316 |
if (lineString3D.pointNr() == 1) { |
|
343 | 317 |
firstPt = ptAux3D; |
344 | 318 |
} |
345 | 319 |
} |
346 | 320 |
} else { |
347 | 321 |
for (int i = arc.size() - 1; i >= 0; i--) { |
348 | 322 |
Point2D ptAux = new Point2D.Double(); |
349 |
//double z = ((Point3D) lineString3D.get(lineString3D.pointNr() - 2)).getZ();
|
|
350 |
double z = ((Point3D) polygon3D.get(polygon3D.pointNr() - 2)).getZ();
|
|
323 |
double z = ((Point3D) lineString3D.get(lineString3D.pointNr() -
|
|
324 |
2)).getZ();
|
|
351 | 325 |
ptAux = proj.createPoint(((Point2D) arc.get(i)).getX(), |
352 | 326 |
((Point2D) arc.get(i)).getY()); |
353 | 327 |
|
354 | 328 |
Point3D ptAux3D = new Point3D(ptAux.getX(), |
355 | 329 |
ptAux.getY(), z); |
356 |
//lineString3D.add(ptAux3D);
|
|
330 |
lineString3D.add(ptAux3D); |
|
357 | 331 |
polygon3D.add(ptAux3D); |
358 | 332 |
|
359 |
//if ((lineString3D.pointNr() == 1) || (polygon3D.pointNr() == 1)) {
|
|
360 |
if (polygon3D.pointNr() == 1) {
|
|
333 |
if ((lineString3D.pointNr() == 1) ||
|
|
334 |
(polygon3D.pointNr() == 1)) {
|
|
361 | 335 |
firstPt = ptAux3D; |
362 | 336 |
} |
363 | 337 |
} |
... | ... | |
390 | 364 |
|
391 | 365 |
if (i0 > 0) { |
392 | 366 |
if ((facesIterador % 2) != 0) { |
393 |
//ls1.add((Point2D) lineString3D.get(i0 - 1));
|
|
367 |
ls1.add((Point2D) lineString3D.get(i0 - 1)); |
|
394 | 368 |
pl1.add((Point2D) polygon3D.get(i0 - 1)); |
395 | 369 |
} else { |
396 |
//ls2.add((Point2D) lineString3D.get(i0 - 1));
|
|
370 |
ls2.add((Point2D) lineString3D.get(i0 - 1)); |
|
397 | 371 |
pl2.add((Point2D) polygon3D.get(i0 - 1)); |
398 | 372 |
} |
399 | 373 |
|
... | ... | |
419 | 393 |
|
420 | 394 |
ls.add(facesFirstPoint); |
421 | 395 |
pl.add(facesFirstPoint); |
422 |
//lastFeaBordes.setGeometry(ls); |
|
423 |
//lastFeaFondos.setGeometry(pl); |
|
424 |
lastFeature.setGeometry(pl); |
|
396 |
lastFeaBordes.setGeometry(ls); |
|
397 |
lastFeaFondos.setGeometry(pl); |
|
425 | 398 |
} else { |
426 |
//lastFeaBordes.setGeometry(lineString3D); |
|
427 |
//lastFeaFondos.setGeometry(polygon3D); |
|
428 |
lastFeature.setGeometry(polygon3D); |
|
399 |
lastFeaBordes.setGeometry(lineString3D); |
|
400 |
lastFeaFondos.setGeometry(polygon3D); |
|
429 | 401 |
} |
430 | 402 |
|
431 | 403 |
// 041130: Rellena las props con los atributos. |
432 |
//completeAttributes(lastFeaBordes); |
|
433 |
//completeAttributes(lastFeaFondos); |
|
434 |
completeAttributes(lastFeature); |
|
404 |
completeAttributes(lastFeaBordes); |
|
405 |
completeAttributes(lastFeaFondos); |
|
435 | 406 |
|
436 |
//setPolylineElevation(lastFeaBordes, lastFeaFondos); |
|
437 |
setPolygonElevation(lastFeature); |
|
407 |
setPolylineElevation(lastFeaBordes, lastFeaFondos); |
|
438 | 408 |
|
439 | 409 |
if (addingToBlock == false) { |
440 | 410 |
//features.add(lastFeaBordes); |
441 |
//features.add(lastFeaFondos); |
|
442 |
features.add(lastFeature); |
|
411 |
features.add(lastFeaFondos); |
|
443 | 412 |
} else { |
444 | 413 |
//blk.add(lastFeaBordes); |
445 |
//blk.add(lastFeaFondos); |
|
446 |
blk.add(lastFeature); |
|
414 |
blk.add(lastFeaFondos); |
|
447 | 415 |
} |
448 | 416 |
|
449 |
//lastFeaBordes = null; |
|
450 |
//lastFeaFondos = null; |
|
451 |
lastFeature = null; |
|
452 |
//} else if (lastFeaBordes.getGeometry() instanceof InsPoint3D) { |
|
453 |
} else if (lastFeature.getGeometry() instanceof InsPoint3D) { |
|
417 |
lastFeaBordes = null; |
|
418 |
lastFeaFondos = null; |
|
419 |
} else if (lastFeaBordes.getGeometry() instanceof InsPoint3D) { |
|
454 | 420 |
// Se trata de un SEQEND despues de un ATTRIB |
455 |
//copyAttributes(lastFeaBordes); |
|
456 |
copyAttributes(lastFeature); |
|
421 |
copyAttributes(lastFeaBordes); |
|
457 | 422 |
|
458 |
//gestionaInsert(lastFeaBordes); |
|
459 |
gestionaInsert(lastFeature); |
|
423 |
gestionaInsert(lastFeaBordes); |
|
460 | 424 |
|
461 | 425 |
if (addingToBlock == false) { |
462 |
//features.add(lastFeaFondos); |
|
463 |
features.add(lastFeature); |
|
426 |
features.add(lastFeaFondos); |
|
464 | 427 |
} else { |
465 |
//blk.add(lastFeaBordes); |
|
466 |
blk.add(lastFeature); |
|
428 |
blk.add(lastFeaBordes); |
|
467 | 429 |
} |
468 | 430 |
|
469 |
//lastFeaBordes = null; |
|
470 |
//lastFeaFondos = null; |
|
471 |
lastFeature = null; |
|
431 |
lastFeaBordes = null; |
|
432 |
lastFeaFondos = null; |
|
472 | 433 |
} else { |
473 | 434 |
// Caso no contemplado. |
474 | 435 |
} |
475 | 436 |
} else { |
476 |
//if (lastFeaBordes.getGeometry() instanceof LineString3D) { |
|
477 |
if (lastFeature.getGeometry() instanceof LineString3D) { |
|
478 |
//Feature feaBordes = lastFeaBordes; |
|
479 |
//LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
480 |
Feature feature = lastFeature; |
|
481 |
LineString3D lineString3D = (LineString3D) feature.getGeometry(); |
|
437 |
if (lastFeaBordes.getGeometry() instanceof LineString3D) { |
|
438 |
Feature feaBordes = lastFeaBordes; |
|
439 |
LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
482 | 440 |
|
483 | 441 |
if ((bulge != 0) && |
484 | 442 |
!((lineString3D.get(lineString3D.pointNr() - 2).getX() == lineString3D.get(lineString3D.pointNr() - |
... | ... | |
589 | 547 |
} |
590 | 548 |
|
591 | 549 |
ls.add(facesFirstPoint); |
592 |
//lastFeaBordes.setGeometry(ls); |
|
593 |
lastFeature.setGeometry(ls); |
|
550 |
lastFeaBordes.setGeometry(ls); |
|
594 | 551 |
} else { |
595 |
//lastFeaBordes.setGeometry(lineString3D); |
|
596 |
lastFeature.setGeometry(lineString3D); |
|
552 |
lastFeaBordes.setGeometry(lineString3D); |
|
597 | 553 |
} |
598 | 554 |
|
599 | 555 |
// 041130: Rellena las props con los atributos. |
600 |
//completeAttributes(lastFeaBordes); |
|
601 |
completeAttributes(lastFeature); |
|
556 |
completeAttributes(lastFeaBordes); |
|
602 | 557 |
|
603 |
//setPolylineElevation(lastFeaBordes); |
|
604 |
setPolylineElevation(lastFeature); |
|
558 |
setPolylineElevation(lastFeaBordes); |
|
605 | 559 |
|
606 | 560 |
if (addingToBlock == false) { |
607 |
//features.add(lastFeaBordes); |
|
608 |
features.add(lastFeature); |
|
561 |
features.add(lastFeaBordes); |
|
609 | 562 |
} else { |
610 |
//blk.add(lastFeaBordes); |
|
611 |
blk.add(lastFeature); |
|
563 |
blk.add(lastFeaBordes); |
|
612 | 564 |
} |
613 | 565 |
|
614 |
//lastFeaBordes = null; |
|
615 |
lastFeature = null; |
|
566 |
lastFeaBordes = null; |
|
616 | 567 |
} else { |
617 | 568 |
// Se trata de un SEQEND despues de un ATTRIB |
618 | 569 |
} |
... | ... | |
622 | 573 |
xtruY = 0.0; |
623 | 574 |
xtruZ = 1.0; |
624 | 575 |
bulge = 0.0; |
625 |
//isDoubleFeatured = false; |
|
626 |
isClosedFeatured = false; |
|
576 |
isDoubleFeatured = false; |
|
627 | 577 |
hasFaces = false; |
628 | 578 |
facesIterador = 1; |
629 | 579 |
} |
... | ... | |
646 | 596 |
|
647 | 597 |
/** |
648 | 598 |
* Establece un valor constante para la elevaci?n de un pol?gono. |
649 |
* @param feaBordes, la polil?nea. |
|
650 |
*/ |
|
651 |
private void setPolygonElevation(Feature feaFondos) { |
|
652 |
if (constantPolylineElevation) { |
|
653 |
Double doub = new Double(lastVertexElevation); |
|
654 |
String string = doub.toString(); |
|
655 |
feaFondos.setProp("elevation", string); |
|
656 |
} else { |
|
657 |
Double doub = new Double(0.0); |
|
658 |
String string = doub.toString(); |
|
659 |
feaFondos.setProp("elevation", string); |
|
660 |
} |
|
661 |
} |
|
662 |
|
|
663 |
/** |
|
664 |
* Establece un valor constante para la elevaci?n de un pol?gono. |
|
665 | 599 |
* @param feaBordes, borde del pol?gono. |
666 | 600 |
* @param feaFondos, fondo del pol?gono. |
667 | 601 |
*/ |
... | ... | |
688 | 622 |
double z = 0.0; |
689 | 623 |
int vFlags = 0; |
690 | 624 |
|
691 |
//if (isDoubleFeatured) { |
|
692 |
if (isClosedFeatured) { |
|
693 |
//Feature feaBordes = lastFeaBordes; |
|
694 |
//Feature feaFondos = lastFeaFondos; |
|
695 |
Feature feature = lastFeature; |
|
696 |
//LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
697 |
//Polygon3D polygon3D = (Polygon3D) feaFondos.getGeometry(); |
|
698 |
//LineString3D lineString3D = (LineString3D) feature.getGeometry(); |
|
699 |
Polygon3D polygon3D = (Polygon3D) feature.getGeometry(); |
|
625 |
if (isDoubleFeatured) { |
|
626 |
Feature feaBordes = lastFeaBordes; |
|
627 |
Feature feaFondos = lastFeaFondos; |
|
628 |
LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
629 |
Polygon3D polygon3D = (Polygon3D) feaFondos.getGeometry(); |
|
700 | 630 |
|
701 | 631 |
if (grp.hasCode(8)) { |
702 |
//feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
703 |
//feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
704 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
632 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
633 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
705 | 634 |
} |
706 | 635 |
|
707 | 636 |
if (grp.hasCode(70)) { |
... | ... | |
723 | 652 |
dxf3DFile = true; |
724 | 653 |
} |
725 | 654 |
|
726 |
//if ((z != lastVertexElevation) && (lineString3D.pointNr() > 0)) { |
|
727 |
if ((z != lastVertexElevation) && (polygon3D.pointNr() > 0)) { |
|
655 |
if ((z != lastVertexElevation) && (lineString3D.pointNr() > 0)) { |
|
728 | 656 |
constantPolylineElevation = false; |
729 | 657 |
} |
730 | 658 |
|
... | ... | |
744 | 672 |
} else { |
745 | 673 |
Point3D pt = new Point3D(proj.createPoint(x, y).getX(), |
746 | 674 |
proj.createPoint(x, y).getY(), z); |
747 |
//lineString3D.add(pt);
|
|
675 |
lineString3D.add(pt); |
|
748 | 676 |
polygon3D.add(pt); |
749 | 677 |
|
750 |
//if (lineString3D.pointNr() == 1) {
|
|
751 |
// firstPt = pt;
|
|
752 |
//}
|
|
678 |
if (lineString3D.pointNr() == 1) { |
|
679 |
firstPt = pt; |
|
680 |
} |
|
753 | 681 |
|
754 | 682 |
if (bulge == 0.0) { |
755 | 683 |
if (grp.hasCode(42)) { |
... | ... | |
771 | 699 |
(ptAnterior.getY() == pt.getY())) { |
772 | 700 |
// no se construye el arco |
773 | 701 |
} else { |
774 |
//lineString3D.remove(lineString3D.pointNr() - 1);
|
|
775 |
//lineString3D.remove(lineString3D.pointNr() - 1);
|
|
702 |
lineString3D.remove(lineString3D.pointNr() - 1); |
|
703 |
lineString3D.remove(lineString3D.pointNr() - 1); |
|
776 | 704 |
polygon3D.remove(polygon3D.pointNr() - 1); |
777 | 705 |
polygon3D.remove(polygon3D.pointNr() - 1); |
778 | 706 |
|
... | ... | |
786 | 714 |
|
787 | 715 |
Point3D ptAux3D = new Point3D(ptAux.getX(), |
788 | 716 |
ptAux.getY(), z); |
789 |
//lineString3D.add(ptAux3D);
|
|
717 |
lineString3D.add(ptAux3D); |
|
790 | 718 |
polygon3D.add(ptAux3D); |
791 | 719 |
|
792 |
//if (lineString3D.pointNr() == 1) {
|
|
793 |
// firstPt = ptAux3D;
|
|
794 |
//}
|
|
720 |
if (lineString3D.pointNr() == 1) { |
|
721 |
firstPt = ptAux3D; |
|
722 |
} |
|
795 | 723 |
} |
796 | 724 |
} else { |
797 | 725 |
for (int i = arc.size() - 1; i >= 0; i--) { |
... | ... | |
801 | 729 |
|
802 | 730 |
Point3D ptAux3D = new Point3D(ptAux.getX(), |
803 | 731 |
ptAux.getY(), z); |
804 |
//lineString3D.add(ptAux3D);
|
|
732 |
lineString3D.add(ptAux3D); |
|
805 | 733 |
polygon3D.add(ptAux3D); |
806 | 734 |
|
807 |
//if ((lineString3D.pointNr() == 1) || (polygon3D.pointNr() == 1)) {
|
|
808 |
if (polygon3D.pointNr() == 1) {
|
|
735 |
if ((lineString3D.pointNr() == 1) ||
|
|
736 |
(polygon3D.pointNr() == 1)) {
|
|
809 | 737 |
firstPt = ptAux3D; |
810 | 738 |
} |
811 | 739 |
} |
... | ... | |
818 | 746 |
ptAnterior = pt; |
819 | 747 |
} |
820 | 748 |
} else { |
821 |
//Feature feaBordes = lastFeaBordes; |
|
822 |
Feature feature = lastFeature; |
|
823 |
//LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
824 |
LineString3D lineString3D = (LineString3D) feature.getGeometry(); |
|
749 |
Feature feaBordes = lastFeaBordes; |
|
750 |
LineString3D lineString3D = (LineString3D) feaBordes.getGeometry(); |
|
825 | 751 |
|
826 | 752 |
if (grp.hasCode(8)) { |
827 |
//feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
828 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
753 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
829 | 754 |
} |
830 | 755 |
|
831 | 756 |
if (grp.hasCode(70)) { |
... | ... | |
953 | 878 |
Polygon3D polygon3D = new Polygon3D(); |
954 | 879 |
|
955 | 880 |
//Geometry geometria; |
956 |
Feature feature= new Feature(); |
|
957 |
//Feature feaBordes = new Feature();
|
|
958 |
//Feature feaFondos = new Feature();
|
|
881 |
//Feature feature= new Feature();
|
|
882 |
Feature feaBordes = new Feature(); |
|
883 |
Feature feaFondos = new Feature(); |
|
959 | 884 |
int flags = 0; |
960 | 885 |
int NumberOfVertices = 0; |
961 | 886 |
double extx = 0.0; |
962 | 887 |
double exty = 0.0; |
963 | 888 |
double extz = 1.0; |
964 | 889 |
|
965 |
feature.setProp("dxfEntity", "LwPolyline"); |
|
966 |
//feaBordes.setProp("dxfEntity", "LwPolyline");
|
|
967 |
//feaFondos.setProp("dxfEntity", "LwPolyline");
|
|
890 |
//feature.setProp("dxfEntity", "LwPolyline");
|
|
891 |
feaBordes.setProp("dxfEntity", "LwPolyline"); |
|
892 |
feaFondos.setProp("dxfEntity", "LwPolyline"); |
|
968 | 893 |
|
969 | 894 |
if (grp.hasCode(8)) { |
970 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
971 |
//feaBordes.setProp("layer", grp.getDataAsString(8));
|
|
895 |
//feature.setProp("layer", grp.getDataAsString(8));
|
|
896 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
972 | 897 |
} |
973 | 898 |
|
974 |
//feaFondos.setProp("layer", grp.getDataAsString(8));
|
|
899 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
975 | 900 |
|
976 | 901 |
if (grp.hasCode(38)) { |
977 | 902 |
elev = grp.getDataAsDouble(38); |
... | ... | |
983 | 908 |
Double doub = new Double(elev); |
984 | 909 |
String string = doub.toString(); |
985 | 910 |
|
986 |
feature.setProp("elevation", string); |
|
987 |
//feaBordes.setProp("elevation", string);
|
|
988 |
//feaFondos.setProp("elevation", string);
|
|
911 |
//feature.setProp("elevation", string);
|
|
912 |
feaBordes.setProp("elevation", string); |
|
913 |
feaFondos.setProp("elevation", string); |
|
989 | 914 |
} else { |
990 | 915 |
Double doub = new Double(0.0); |
991 | 916 |
|
992 |
feature.setProp("elevation", doub.toString()); |
|
993 |
//feaBordes.setProp("elevation", doub.toString());
|
|
994 |
//feaFondos.setProp("elevation", doub.toString());
|
|
917 |
//feature.setProp("elevation", doub.toString());
|
|
918 |
feaBordes.setProp("elevation", doub.toString()); |
|
919 |
feaFondos.setProp("elevation", doub.toString()); |
|
995 | 920 |
} |
996 | 921 |
|
997 | 922 |
if (grp.hasCode(39)) { |
998 | 923 |
Double doub = new Double(grp.getDataAsDouble(39)); |
999 | 924 |
String string = doub.toString(); |
1000 | 925 |
|
1001 |
feature.setProp("thickness", string); |
|
1002 |
//feaBordes.setProp("thickness", string);
|
|
1003 |
//feaFondos.setProp("thickness", string);
|
|
926 |
//feature.setProp("thickness", string);
|
|
927 |
feaBordes.setProp("thickness", string); |
|
928 |
feaFondos.setProp("thickness", string); |
|
1004 | 929 |
} else { |
1005 | 930 |
Double doub = new Double(0.0); |
1006 | 931 |
|
1007 |
feature.setProp("thickness", doub.toString()); |
|
1008 |
//feaBordes.setProp("thickness", doub.toString());
|
|
1009 |
//feaFondos.setProp("thickness", doub.toString());
|
|
932 |
//feature.setProp("thickness", doub.toString());
|
|
933 |
feaBordes.setProp("thickness", doub.toString()); |
|
934 |
feaFondos.setProp("thickness", doub.toString()); |
|
1010 | 935 |
} |
1011 | 936 |
|
1012 | 937 |
if (grp.hasCode(62)) { |
1013 | 938 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1014 | 939 |
String string = integer.toString(); |
1015 | 940 |
|
1016 |
feature.setProp("color", string); |
|
1017 |
//feaBordes.setProp("color", string); |
|
1018 |
//feaFondos.setProp("color", string); |
|
1019 |
feature.setProp("colorByLayer", "false"); |
|
1020 |
//feaBordes.setProp("colorByLayer", "false"); |
|
1021 |
//feaFondos.setProp("colorByLayer", "false"); |
|
941 |
//feature.setProp("color", string); |
|
942 |
feaBordes.setProp("color", string); |
|
943 |
feaFondos.setProp("color", string); |
|
944 |
feaBordes.setProp("colorByLayer", "false"); |
|
945 |
feaFondos.setProp("colorByLayer", "false"); |
|
1022 | 946 |
} else { |
1023 | 947 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
1024 | 948 |
int clr = layer.colorNumber; |
1025 | 949 |
Integer integer = new Integer(clr); |
1026 | 950 |
String string = integer.toString(); |
1027 | 951 |
|
1028 |
feature.setProp("color", string); |
|
1029 |
//feaBordes.setProp("color", string); |
|
1030 |
//feaFondos.setProp("color", string); |
|
1031 |
//feaBordes.setProp("colorByLayer", "true"); |
|
1032 |
//feaFondos.setProp("colorByLayer", "true"); |
|
1033 |
feature.setProp("colorByLayer", "true"); |
|
952 |
//feature.setProp("color", string); |
|
953 |
feaBordes.setProp("color", string); |
|
954 |
feaFondos.setProp("color", string); |
|
955 |
feaBordes.setProp("colorByLayer", "true"); |
|
956 |
feaFondos.setProp("colorByLayer", "true"); |
|
1034 | 957 |
} |
1035 | 958 |
|
1036 | 959 |
if (grp.hasCode(70)) { |
... | ... | |
1039 | 962 |
|
1040 | 963 |
if ((flags & 0x01) == 0x01) { |
1041 | 964 |
//geometria = new Polygon(); |
1042 |
//feaBordes.setGeometry(lineString3D); |
|
1043 |
//feaFondos.setGeometry(polygon3D); |
|
1044 |
feature.setGeometry(polygon3D); |
|
1045 |
//isDoubleFeatured = true; |
|
1046 |
isClosedFeatured = true; |
|
965 |
feaBordes.setGeometry(lineString3D); |
|
966 |
feaFondos.setGeometry(polygon3D); |
|
967 |
isDoubleFeatured = true; |
|
1047 | 968 |
} else { |
1048 | 969 |
//geometria = new LineString(); |
1049 |
//feaBordes.setGeometry(lineString3D); |
|
1050 |
feature.setGeometry(lineString3D); |
|
1051 |
isClosedFeatured = false; |
|
970 |
feaBordes.setGeometry(lineString3D); |
|
971 |
isDoubleFeatured = false; |
|
1052 | 972 |
} |
1053 | 973 |
|
1054 | 974 |
if (grp.hasCode(90)) { |
... | ... | |
1105 | 1025 |
finalPoint, bulgeLwp); |
1106 | 1026 |
lineString3D.remove(lineString3D.pointNr() - 1); |
1107 | 1027 |
|
1108 |
//if (isDoubleFeatured) { |
|
1109 |
if (isClosedFeatured) { |
|
1028 |
if (isDoubleFeatured) { |
|
1110 | 1029 |
polygon3D.remove(polygon3D.pointNr() - 1); |
1111 | 1030 |
} |
1112 | 1031 |
|
... | ... | |
1122 | 1041 |
lineString3D.add(ptAux3D); |
1123 | 1042 |
|
1124 | 1043 |
//if (lineString.pointNr() == 1) firstPt = ptAux; |
1125 |
//if (isDoubleFeatured) { |
|
1126 |
if (isClosedFeatured) { |
|
1044 |
if (isDoubleFeatured) { |
|
1127 | 1045 |
polygon3D.add(ptAux3D); |
1128 | 1046 |
} |
1129 | 1047 |
|
... | ... | |
1142 | 1060 |
ptAux.getY(), elev); |
1143 | 1061 |
lineString3D.add(ptAux3D); |
1144 | 1062 |
|
1145 |
//if (isDoubleFeatured) { |
|
1146 |
if (isClosedFeatured) { |
|
1063 |
if (isDoubleFeatured) { |
|
1147 | 1064 |
polygon3D.add(ptAux3D); |
1148 | 1065 |
} |
1149 | 1066 |
|
... | ... | |
1164 | 1081 |
elev); |
1165 | 1082 |
lineString3D.add(ptAux3D); |
1166 | 1083 |
|
1167 |
//if (isDoubleFeatured) { |
|
1168 |
if (isClosedFeatured) { |
|
1084 |
if (isDoubleFeatured) { |
|
1169 | 1085 |
polygon3D.add(ptAux3D); |
1170 | 1086 |
} |
1171 | 1087 |
} |
... | ... | |
1184 | 1100 |
} |
1185 | 1101 |
} |
1186 | 1102 |
|
1187 |
//if (isDoubleFeatured) { |
|
1188 |
if (isClosedFeatured) { |
|
1103 |
if (isDoubleFeatured) { |
|
1189 | 1104 |
//geometria.add(proj.createPoint(firstX, firstY)); |
1190 | 1105 |
Point3D ptAux3D = new Point3D(proj.createPoint(firstX, firstY).getX(), |
1191 | 1106 |
proj.createPoint(firstX, firstY).getY(), |
... | ... | |
1194 | 1109 |
polygon3D.add(ptAux3D); |
1195 | 1110 |
} |
1196 | 1111 |
|
1197 |
//lastFeaBordes = feaBordes; |
|
1198 |
lastFeature = feature; |
|
1112 |
lastFeaBordes = feaBordes; |
|
1199 | 1113 |
|
1200 |
//if (isDoubleFeatured) { |
|
1201 |
// lastFeaFondos = feaFondos; |
|
1202 |
//} |
|
1203 |
if (isClosedFeatured) { |
|
1204 |
lastFeature = feature; |
|
1114 |
if (isDoubleFeatured) { |
|
1115 |
lastFeaFondos = feaFondos; |
|
1205 | 1116 |
} |
1206 | 1117 |
|
1207 | 1118 |
// 041130: Rellena las props con los atributos. |
1208 |
//completeAttributes(lastFeaBordes); |
|
1209 |
//completeAttributes(lastFeaFondos); |
|
1210 |
completeAttributes(lastFeature); |
|
1211 |
completeAttributes(lastFeature); |
|
1119 |
completeAttributes(lastFeaBordes); |
|
1120 |
completeAttributes(lastFeaFondos); |
|
1212 | 1121 |
|
1213 | 1122 |
//features.add(feature); |
1214 | 1123 |
if (addingToBlock == false) { |
1215 |
//features.add(feaBordes); |
|
1216 |
features.add(feature); |
|
1217 |
|
|
1218 |
//if (isDoubleFeatured) { |
|
1219 |
// features.add(feaFondos); |
|
1220 |
//} |
|
1221 |
if (isClosedFeatured) { |
|
1222 |
features.add(feature); |
|
1124 |
if (isDoubleFeatured) { |
|
1125 |
features.add(feaFondos); |
|
1126 |
} else { |
|
1127 |
features.add(feaBordes); |
|
1223 | 1128 |
} |
1224 | 1129 |
} else { |
1225 | 1130 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator); |
1226 |
//blk.add(feaBordes); |
|
1227 |
blk.add(feature); |
|
1228 |
|
|
1229 |
//if (isDoubleFeatured) { |
|
1230 |
// blk.add(feaFondos); |
|
1231 |
//} |
|
1232 |
if (isClosedFeatured) { |
|
1233 |
blk.add(feature); |
|
1131 |
if (isDoubleFeatured) { |
|
1132 |
blk.add(feaFondos); |
|
1133 |
} else { |
|
1134 |
blk.add(feaBordes); |
|
1234 | 1135 |
} |
1235 | 1136 |
} |
1236 | 1137 |
|
1237 |
//isDoubleFeatured = false; |
|
1238 |
isClosedFeatured = false; |
|
1138 |
isDoubleFeatured = false; |
|
1239 | 1139 |
} |
1240 | 1140 |
|
1241 | 1141 |
/* (non-Javadoc) |
... | ... | |
1781 | 1681 |
double extx = 0.0; |
1782 | 1682 |
double exty = 0.0; |
1783 | 1683 |
double extz = 1.0; |
1784 |
//LineString3D lineString3D = new LineString3D();
|
|
1684 |
LineString3D lineString3D = new LineString3D(); |
|
1785 | 1685 |
Polygon3D polygon3D = new Polygon3D(); |
1786 |
//Feature feaBordes = new Feature(); |
|
1787 |
//Feature feaFondos = new Feature(); |
|
1788 |
Feature feature = new Feature(); |
|
1686 |
Feature feaBordes = new Feature(); |
|
1687 |
Feature feaFondos = new Feature(); |
|
1789 | 1688 |
|
1790 |
//feaBordes.setProp("dxfEntity", "Circle"); |
|
1791 |
//feaFondos.setProp("dxfEntity", "Circle"); |
|
1792 |
feature.setProp("dxfEntity", "Circle"); |
|
1689 |
feaBordes.setProp("dxfEntity", "Circle"); |
|
1690 |
feaFondos.setProp("dxfEntity", "Circle"); |
|
1793 | 1691 |
|
1794 |
//if (grp.hasCode(8)) {
|
|
1795 |
// feaBordes.setProp("layer", grp.getDataAsString(8));
|
|
1796 |
//}
|
|
1692 |
if (grp.hasCode(8)) { |
|
1693 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
1694 |
} |
|
1797 | 1695 |
|
1798 |
//feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
1799 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
1696 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
1800 | 1697 |
|
1801 | 1698 |
if (grp.hasCode(39)) { |
1802 | 1699 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1803 | 1700 |
String string = doub.toString(); |
1804 |
//feaBordes.setProp("thickness", string); |
|
1805 |
//feaFondos.setProp("thickness", string); |
|
1806 |
feature.setProp("thickness", string); |
|
1701 |
feaBordes.setProp("thickness", string); |
|
1702 |
feaFondos.setProp("thickness", string); |
|
1807 | 1703 |
} else { |
1808 | 1704 |
Double doub = new Double(0.0); |
1809 |
//feaBordes.setProp("thickness", doub.toString()); |
|
1810 |
//feaFondos.setProp("thickness", doub.toString()); |
|
1811 |
feature.setProp("thickness", doub.toString()); |
|
1705 |
feaBordes.setProp("thickness", doub.toString()); |
|
1706 |
feaFondos.setProp("thickness", doub.toString()); |
|
1812 | 1707 |
} |
1813 | 1708 |
|
1814 | 1709 |
if (grp.hasCode(62)) { |
1815 | 1710 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1816 | 1711 |
String string = integer.toString(); |
1817 |
//feaBordes.setProp("color", string); |
|
1818 |
//feaFondos.setProp("color", string); |
|
1819 |
feature.setProp("color", string); |
|
1820 |
//feaBordes.setProp("colorByLayer", "false"); |
|
1821 |
//feaFondos.setProp("colorByLayer", "false"); |
|
1822 |
feature.setProp("colorByLayer", "false"); |
|
1712 |
feaBordes.setProp("color", string); |
|
1713 |
feaFondos.setProp("color", string); |
|
1714 |
feaBordes.setProp("colorByLayer", "false"); |
|
1715 |
feaFondos.setProp("colorByLayer", "false"); |
|
1823 | 1716 |
} else { |
1824 | 1717 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
1825 | 1718 |
int clr = layer.colorNumber; |
1826 | 1719 |
Integer integer = new Integer(clr); |
1827 | 1720 |
String string = integer.toString(); |
1828 |
//feaBordes.setProp("color", string); |
|
1829 |
//feaFondos.setProp("color", string); |
|
1830 |
feature.setProp("color", string); |
|
1831 |
//feaBordes.setProp("colorByLayer", "true"); |
|
1832 |
//feaFondos.setProp("colorByLayer", "true"); |
|
1833 |
feature.setProp("colorByLayer", "true"); |
|
1721 |
feaBordes.setProp("color", string); |
|
1722 |
feaFondos.setProp("color", string); |
|
1723 |
feaBordes.setProp("colorByLayer", "true"); |
|
1724 |
feaFondos.setProp("colorByLayer", "true"); |
|
1834 | 1725 |
} |
1835 | 1726 |
|
1836 | 1727 |
x = grp.getDataAsDouble(10); |
... | ... | |
1872 | 1763 |
z = point_out.getZ(); |
1873 | 1764 |
|
1874 | 1765 |
Double doub = new Double(z); |
1875 |
//feaBordes.setProp("elevation", doub.toString()); |
|
1876 |
//feaFondos.setProp("elevation", doub.toString()); |
|
1877 |
feature.setProp("elevation", doub.toString()); |
|
1766 |
feaBordes.setProp("elevation", doub.toString()); |
|
1767 |
feaFondos.setProp("elevation", doub.toString()); |
|
1878 | 1768 |
|
1879 | 1769 |
if (z != 0.0) { |
1880 | 1770 |
dxf3DFile = true; |
... | ... | |
1900 | 1790 |
} |
1901 | 1791 |
|
1902 | 1792 |
for (int i = 0; i < pts.length; i++) { |
1903 |
//lineString3D.add(pts[i]);
|
|
1793 |
lineString3D.add(pts[i]); |
|
1904 | 1794 |
polygon3D.add(pts[i]); |
1905 | 1795 |
} |
1906 | 1796 |
|
1907 |
//feaBordes.setGeometry(lineString3D); |
|
1908 |
//feaFondos.setGeometry(polygon3D); |
|
1909 |
feature.setGeometry(polygon3D); |
|
1797 |
feaBordes.setGeometry(lineString3D); |
|
1798 |
feaFondos.setGeometry(polygon3D); |
|
1910 | 1799 |
|
1911 | 1800 |
// 041130: Rellena las props con los atributos. |
1912 |
//completeAttributes(feaBordes); |
|
1913 |
//completeAttributes(feaFondos); |
|
1914 |
completeAttributes(feature); |
|
1801 |
completeAttributes(feaBordes); |
|
1802 |
completeAttributes(feaFondos); |
|
1915 | 1803 |
|
1916 | 1804 |
//features.add(feature); |
1917 | 1805 |
if (addingToBlock == false) { |
1918 | 1806 |
//System.out.println("createCircle(): A?ade un circulo a la lista de entidades"); |
1919 | 1807 |
//features.add(feaBordes); |
1920 |
//features.add(feaFondos); |
|
1921 |
features.add(feature); |
|
1808 |
features.add(feaFondos); |
|
1922 | 1809 |
} else { |
1923 | 1810 |
//System.out.println("createCircle(): A?adimos un circulo al bloque " + iterator); |
1924 | 1811 |
//blk.add(feaBordes); |
1925 |
//blk.add(feaFondos); |
|
1926 |
blk.add(feature); |
|
1812 |
blk.add(feaFondos); |
|
1927 | 1813 |
} |
1928 | 1814 |
} |
1929 | 1815 |
|
... | ... | |
2279 | 2165 |
//} |
2280 | 2166 |
// 041129: A?adido para implementar los ATTRIBS. |
2281 | 2167 |
if (attributesFollowFlag == 1) { |
2282 |
//isDoubleFeatured = true; |
|
2283 |
isClosedFeatured = true; |
|
2284 |
//lastFeaBordes = feature; |
|
2285 |
//lastFeaFondos = secondFeat; |
|
2286 |
attribFeature = feature; |
|
2287 |
lastFeature = secondFeat; |
|
2168 |
isDoubleFeatured = true; |
|
2169 |
lastFeaBordes = feature; |
|
2170 |
lastFeaFondos = secondFeat; |
|
2288 | 2171 |
} else { |
2289 | 2172 |
if (addingToBlock == false) { |
2290 | 2173 |
features.add(secondFeat); |
... | ... | |
2317 | 2200 |
double exty = 0.0; |
2318 | 2201 |
double extz = 1.0; |
2319 | 2202 |
|
2320 |
//LineString3D lineString3D = new LineString3D();
|
|
2203 |
LineString3D lineString3D = new LineString3D(); |
|
2321 | 2204 |
Polygon3D polygon3D = new Polygon3D(); |
2322 |
//Feature feaBordes = new Feature();
|
|
2205 |
Feature feaBordes = new Feature(); |
|
2323 | 2206 |
Feature feaFondos = new Feature(); |
2324 | 2207 |
|
2325 | 2208 |
//double elev = 0; |
2326 |
//feaBordes.setProp("dxfEntity", "Solid");
|
|
2209 |
feaBordes.setProp("dxfEntity", "Solid"); |
|
2327 | 2210 |
feaFondos.setProp("dxfEntity", "Solid"); |
2328 | 2211 |
|
2329 |
//if (grp.hasCode(8)) {
|
|
2330 |
// feaBordes.setProp("layer", grp.getDataAsString(8));
|
|
2331 |
//}
|
|
2212 |
if (grp.hasCode(8)) { |
|
2213 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
2214 |
} |
|
2332 | 2215 |
|
2333 | 2216 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
2334 | 2217 |
x = grp.getDataAsDouble(10); |
... | ... | |
2377 | 2260 |
if (grp.hasCode(39)) { |
2378 | 2261 |
Double doub = new Double(grp.getDataAsDouble(39)); |
2379 | 2262 |
String string = doub.toString(); |
2380 |
//feaBordes.setProp("thickness", string);
|
|
2263 |
feaBordes.setProp("thickness", string); |
|
2381 | 2264 |
feaFondos.setProp("thickness", string); |
2382 | 2265 |
} else { |
2383 | 2266 |
Double doub = new Double(0.0); |
2384 |
//feaBordes.setProp("thickness", doub.toString());
|
|
2267 |
feaBordes.setProp("thickness", doub.toString()); |
|
2385 | 2268 |
feaFondos.setProp("thickness", doub.toString()); |
2386 | 2269 |
} |
2387 | 2270 |
|
2388 | 2271 |
if (grp.hasCode(62)) { |
2389 | 2272 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
2390 | 2273 |
String string = integer.toString(); |
2391 |
//feaBordes.setProp("color", string);
|
|
2274 |
feaBordes.setProp("color", string); |
|
2392 | 2275 |
feaFondos.setProp("color", string); |
2393 |
//feaBordes.setProp("colorByLayer", "false");
|
|
2276 |
feaBordes.setProp("colorByLayer", "false"); |
|
2394 | 2277 |
feaFondos.setProp("colorByLayer", "false"); |
2395 | 2278 |
} else { |
2396 | 2279 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
2397 | 2280 |
int clr = layer.colorNumber; |
2398 | 2281 |
Integer integer = new Integer(clr); |
2399 | 2282 |
String string = integer.toString(); |
2400 |
//feaBordes.setProp("color", string);
|
|
2283 |
feaBordes.setProp("color", string); |
|
2401 | 2284 |
feaFondos.setProp("color", string); |
2402 |
//feaBordes.setProp("colorByLayer", "true");
|
|
2285 |
feaBordes.setProp("colorByLayer", "true"); |
|
2403 | 2286 |
feaFondos.setProp("colorByLayer", "true"); |
2404 | 2287 |
} |
2405 | 2288 |
|
... | ... | |
2443 | 2326 |
(pts[2].getZ() == pts[3].getZ())) { |
2444 | 2327 |
Double doub = new Double(pts[0].getZ()); |
2445 | 2328 |
String string = doub.toString(); |
2446 |
//feaBordes.setProp("elevation", string);
|
|
2329 |
feaBordes.setProp("elevation", string); |
|
2447 | 2330 |
feaFondos.setProp("elevation", string); |
2448 | 2331 |
} else { |
2449 | 2332 |
Double doub = new Double(0.0); |
2450 | 2333 |
String string = doub.toString(); |
2451 |
//feaBordes.setProp("elevation", string);
|
|
2334 |
feaBordes.setProp("elevation", string); |
|
2452 | 2335 |
feaFondos.setProp("elevation", string); |
2453 | 2336 |
} |
2454 | 2337 |
|
2455 | 2338 |
for (int i = 0; i < pts.length; i++) { |
2456 |
//lineString3D.add(pts[i]);
|
|
2339 |
lineString3D.add(pts[i]); |
|
2457 | 2340 |
polygon3D.add(pts[i]); |
2458 | 2341 |
} |
2459 | 2342 |
|
2460 | 2343 |
// Para cerrarlos. |
2461 |
//lineString3D.add(pts[0]);
|
|
2344 |
lineString3D.add(pts[0]); |
|
2462 | 2345 |
polygon3D.add(pts[0]); |
2463 | 2346 |
|
2464 |
//feaBordes.setGeometry(lineString3D);
|
|
2347 |
feaBordes.setGeometry(lineString3D); |
|
2465 | 2348 |
feaFondos.setGeometry(polygon3D); |
2466 | 2349 |
|
2467 | 2350 |
// 041130: Rellena las props con los atributos. |
2468 |
//completeAttributes(feaBordes);
|
|
2351 |
completeAttributes(feaBordes); |
|
2469 | 2352 |
completeAttributes(feaFondos); |
2470 | 2353 |
|
2471 | 2354 |
//features.add(feature); |
... | ... | |
2494 | 2377 |
Polygon3D polygon3D = new Polygon3D(); |
2495 | 2378 |
|
2496 | 2379 |
//Geometry geometria; |
2497 |
Feature feature= new Feature(); |
|
2498 |
//Feature feaBordes = new Feature();
|
|
2499 |
//Feature feaFondos = new Feature();
|
|
2380 |
//Feature feature= new Feature();
|
|
2381 |
Feature feaBordes = new Feature(); |
|
2382 |
Feature feaFondos = new Feature(); |
|
2500 | 2383 |
int flags = 0; |
2501 | 2384 |
|
2502 |
feature.setProp("dxfEntity", "Spline");
|
|
2503 |
//feaBordes.setProp("dxfEntity", "Spline");
|
|
2504 |
//feaFondos.setProp("dxfEntity", "Spline");
|
|
2385 |
//feature.setProp("dxfEntity", "LwPolyline");
|
|
2386 |
feaBordes.setProp("dxfEntity", "Spline"); |
|
2387 |
feaFondos.setProp("dxfEntity", "Spline"); |
|
2505 | 2388 |
|
2506 | 2389 |
if (grp.hasCode(8)) { |
2507 |
feature.setProp("layer", grp.getDataAsString(8)); |
|
2508 |
//feaBordes.setProp("layer", grp.getDataAsString(8));
|
|
2509 |
//feaFondos.setProp("layer", grp.getDataAsString(8));
|
|
2390 |
//feature.setProp("layer", grp.getDataAsString(8));
|
|
2391 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
|
2392 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
|
2510 | 2393 |
} |
2511 | 2394 |
|
2512 | 2395 |
if (grp.hasCode(39)) { |
2513 | 2396 |
Double doub = new Double(grp.getDataAsDouble(39)); |
2514 | 2397 |
String string = doub.toString(); |
2515 | 2398 |
|
2516 |
feature.setProp("thickness", string); |
|
2517 |
//feaBordes.setProp("thickness", string);
|
|
2518 |
//feaFondos.setProp("thickness", string);
|
|
2399 |
//feature.setProp("thickness", string);
|
|
2400 |
feaBordes.setProp("thickness", string); |
|
2401 |
feaFondos.setProp("thickness", string); |
|
2519 | 2402 |
} else { |
2520 | 2403 |
Double doub = new Double(0.0); |
2521 | 2404 |
|
2522 |
feature.setProp("thickness", doub.toString()); |
|
2523 |
//feaBordes.setProp("thickness", doub.toString());
|
|
2524 |
//feaFondos.setProp("thickness", doub.toString());
|
|
2405 |
//feature.setProp("thickness", doub.toString());
|
|
2406 |
feaBordes.setProp("thickness", doub.toString()); |
|
2407 |
feaFondos.setProp("thickness", doub.toString()); |
|
2525 | 2408 |
} |
2526 | 2409 |
|
2527 | 2410 |
if (grp.hasCode(62)) { |
2528 | 2411 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
2529 | 2412 |
String string = integer.toString(); |
2530 | 2413 |
|
2531 |
feature.setProp("color", string); |
|
2532 |
//feaBordes.setProp("color", string); |
|
2533 |
//feaFondos.setProp("color", string); |
|
2534 |
feature.setProp("colorByLayer", "false"); |
|
2535 |
//feaBordes.setProp("colorByLayer", "false"); |
|
2536 |
//feaFondos.setProp("colorByLayer", "false"); |
|
2414 |
//feature.setProp("color", string); |
|
2415 |
feaBordes.setProp("color", string); |
|
2416 |
feaFondos.setProp("color", string); |
|
2417 |
feaBordes.setProp("colorByLayer", "false"); |
|
2418 |
feaFondos.setProp("colorByLayer", "false"); |
|
2537 | 2419 |
} else { |
2538 | 2420 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
2539 | 2421 |
int clr = layer.colorNumber; |
2540 | 2422 |
Integer integer = new Integer(clr); |
2541 | 2423 |
String string = integer.toString(); |
2542 | 2424 |
|
2543 |
feature.setProp("color", string); |
|
2544 |
//feaBordes.setProp("color", string); |
|
2545 |
//feaFondos.setProp("color", string); |
|
2546 |
feature.setProp("colorByLayer", "true"); |
|
2547 |
//feaBordes.setProp("colorByLayer", "true"); |
|
2548 |
//feaFondos.setProp("colorByLayer", "true"); |
|
2425 |
//feature.setProp("color", string); |
|
2426 |
feaBordes.setProp("color", string); |
|
2427 |
feaFondos.setProp("color", string); |
|
2428 |
feaBordes.setProp("colorByLayer", "true"); |
|
2429 |
feaFondos.setProp("colorByLayer", "true"); |
|
2549 | 2430 |
} |
2550 | 2431 |
|
2551 | 2432 |
if (grp.hasCode(70)) { |
... | ... | |
2554 | 2435 |
|
2555 | 2436 |
if ((flags & 0x01) == 0x01) { |
2556 | 2437 |
//geometria = new Polygon(); |
2557 |
//feaBordes.setGeometry(lineString3D); |
|
2558 |
//feaFondos.setGeometry(polygon3D); |
|
2559 |
feature.setGeometry(polygon3D); |
|
2560 |
//isDoubleFeatured = true; |
|
2561 |
isClosedFeatured = true; |
|
2438 |
feaBordes.setGeometry(lineString3D); |
|
2439 |
feaFondos.setGeometry(polygon3D); |
|
2440 |
isDoubleFeatured = true; |
|
2562 | 2441 |
} else { |
2563 | 2442 |
//geometria = new LineString(); |
2564 |
//feaBordes.setGeometry(lineString3D); |
|
2565 |
feature.setGeometry(lineString3D); |
|
2566 |
//isDoubleFeatured = false; |
|
2567 |
isClosedFeatured = false; |
|
2443 |
feaBordes.setGeometry(lineString3D); |
|
2444 |
isDoubleFeatured = false; |
|
2568 | 2445 |
} |
2569 | 2446 |
|
2570 | 2447 |
int j = 0; |
... | ... | |
2587 | 2464 |
Point3D p3d = new Point3D(p.getX(), p.getY(), z); |
2588 | 2465 |
lineString3D.add(p3d); |
2589 | 2466 |
|
2590 |
//if (isDoubleFeatured) { |
|
2591 |
if (isClosedFeatured) { |
|
2467 |
if (isDoubleFeatured) { |
|
2592 | 2468 |
polygon3D.add(p3d); |
2593 | 2469 |
} |
2594 | 2470 |
|
... | ... | |
2610 | 2486 |
//feature.setProp("elevation", string); |
2611 | 2487 |
//feaBordes.setProp("elevation", string); |
2612 | 2488 |
//feaFondos.setProp("elevation", string); |
2613 |
//if (isDoubleFeatured) { |
|
2614 |
if (isClosedFeatured) { |
|
2489 |
if (isDoubleFeatured) { |
|
2615 | 2490 |
Point2D p = proj.createPoint(firstX, firstY); |
2616 | 2491 |
Point3D p3d = new Point3D(p.getX(), p.getY(), z); |
2617 | 2492 |
lineString3D.add(p3d); |
... | ... | |
2638 | 2513 |
if (constSplineElev) { |
2639 | 2514 |
Double doub = new Double(lineString3D.getPoint3D(0).getZ()); |
2640 | 2515 |
String string = doub.toString(); |
2641 |
//feaBordes.setProp("elevation", string); |
|
2642 |
feature.setProp("elevation", string); |
|
2516 |
feaBordes.setProp("elevation", string); |
|
2643 | 2517 |
|
2644 |
//if (isDoubleFeatured) { |
|
2645 |
// feaFondos.setProp("elevation", string); |
|
2646 |
//} |
|
2647 |
if (isClosedFeatured) { |
|
2648 |
feature.setProp("elevation", string); |
|
2518 |
if (isDoubleFeatured) { |
|
2519 |
feaFondos.setProp("elevation", string); |
|
2649 | 2520 |
} |
2650 | 2521 |
} else { |
2651 | 2522 |
Double doub = new Double(0.0); |
2652 | 2523 |
String string = doub.toString(); |
2653 |
//feaBordes.setProp("elevation", string); |
|
2654 |
feature.setProp("elevation", string); |
|
2524 |
feaBordes.setProp("elevation", string); |
|
2655 | 2525 |
|
2656 |
//if (isDoubleFeatured) { |
|
2657 |
// feaFondos.setProp("elevation", string); |
|
2658 |
//} |
|
2659 |
if (isClosedFeatured) { |
|
2660 |
feature.setProp("elevation", string); |
|
2526 |
if (isDoubleFeatured) { |
|
2527 |
feaFondos.setProp("elevation", string); |
|
2661 | 2528 |
} |
2662 | 2529 |
} |
2663 | 2530 |
|
2664 |
//lastFeaBordes = feaBordes; |
|
2665 |
lastFeature = feature; |
|
2531 |
lastFeaBordes = feaBordes; |
|
2666 | 2532 |
|
2667 |
//if (isDoubleFeatured) { |
|
2668 |
// lastFeaFondos = feaFondos; |
|
2669 |
//} |
|
2670 |
if (isClosedFeatured) { |
|
2671 |
lastFeature = feature; |
|
2533 |
if (isDoubleFeatured) { |
|
2534 |
lastFeaFondos = feaFondos; |
|
2672 | 2535 |
} |
2673 | 2536 |
|
2674 | 2537 |
// 041130: Rellena las props con los atributos. |
2675 |
//completeAttributes(feaBordes); |
|
2676 |
//completeAttributes(feaFondos); |
|
2677 |
completeAttributes(feature); |
|
2538 |
completeAttributes(feaBordes); |
|
2539 |
completeAttributes(feaFondos); |
|
2678 | 2540 |
|
2679 | 2541 |
//features.add(feature); |
2680 | 2542 |
if (addingToBlock == false) { |
2681 |
//features.add(feaBordes); |
|
2682 |
features.add(feature); |
|
2683 |
|
|
2684 |
//if (isDoubleFeatured) { |
|
2685 |
// features.add(feaFondos); |
|
2686 |
//} |
|
2687 |
if (isClosedFeatured) { |
|
2688 |
features.add(feature); |
|
2543 |
if (isDoubleFeatured) { |
|
2544 |
features.add(feaFondos); |
|
2545 |
} else { |
|
2546 |
features.add(feaBordes); |
|
2689 | 2547 |
} |
2690 | 2548 |
} else { |
2691 | 2549 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator); |
2692 |
//blk.add(feaBordes); |
|
2693 |
blk.add(feature); |
|
2694 |
|
|
2695 |
//if (isDoubleFeatured) { |
|
2696 |
// blk.add(feaFondos); |
|
2697 |
//} |
|
2698 |
if (isClosedFeatured) { |
|
2699 |
blk.add(feature); |
|
2550 |
if (isDoubleFeatured) { |
|
2551 |
blk.add(feaFondos); |
|
2552 |
} else { |
|
2553 |
blk.add(feaBordes); |
|
2700 | 2554 |
} |
2701 | 2555 |
} |
2702 | 2556 |
|
2703 |
//isDoubleFeatured = false; |
|
2704 |
isClosedFeatured = false; |
|
2557 |
isDoubleFeatured = false; |
|
2705 | 2558 |
} |
2706 | 2559 |
|
2707 | 2560 |
/* (non-Javadoc) |
... | ... | |
2774 | 2627 |
double exty = 0.0; |
2775 | 2628 |
double extz = 1.0; |
2776 | 2629 |
|
2777 |
//Feature insFea = lastFeaBordes; |
|
2778 |
//Feature ptFea = lastFeaFondos; |
|
2779 |
Feature insFea = attribFeature; |
|
2780 |
Feature ptFea = lastFeature; |
|
2630 |
Feature insFea = lastFeaBordes; |
|
2631 |
Feature ptFea = lastFeaFondos; |
|
2781 | 2632 |
|
2782 | 2633 |
Feature feature = new Feature(); |
2783 | 2634 |
|
Also available in: Unified diff