Revision 1880 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dwg/DwgMemoryDriver.java
DwgMemoryDriver.java | ||
---|---|---|
146 | 146 |
boolean addingToBlock = false; |
147 | 147 |
|
148 | 148 |
time = System.currentTimeMillis(); |
149 |
|
|
150 |
// Para intentar entender la manera de asignar la layer a cada elemento ... |
|
151 |
/*for (int i=0;i<dwgObjects.size();i++) { |
|
152 |
DwgObject obj = (DwgObject)dwgObjects.get(i); |
|
153 |
if (obj.getType()==0x33) { |
|
154 |
System.out.println("obj.getHandle().get(0) = " + obj.getHandle().get(0)); |
|
155 |
System.out.println("obj.getHandle().get(1) = " + obj.getHandle().get(1)); |
|
156 |
if (obj.getHandle().size()>2) System.out.println("obj.getHandle().get(2) = " + obj.getHandle().get(2)); |
|
157 |
if (obj.getHandle().size()>3) System.out.println("obj.getHandle().get(3) = " + obj.getHandle().get(3)); |
|
158 |
} |
|
159 |
}*/ |
|
160 |
|
|
161 |
Vector layerTable = createLayerTable(dwgObjects); |
|
162 |
|
|
149 | 163 |
for (int i=0;i<dwgObjects.size();i++) { |
150 | 164 |
|
151 | 165 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0); |
... | ... | |
167 | 181 |
Point2D[] arc = createArc(center, radius, startAngle, endAngle); |
168 | 182 |
FPolyline2D arcc = createPolyline3D(arc); |
169 | 183 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
170 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
171 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
172 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
184 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Arc")); |
|
185 |
int[] layerHandle = (int[])entity.getLayer(); |
|
186 |
String layerName = getLayerName(entity, layerTable); |
|
187 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
188 |
int color = entity.getColor(); |
|
189 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
190 |
//if (color==0) color ByBlock |
|
191 |
if (color==256) color = colorByLayer; |
|
192 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
173 | 193 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
174 | 194 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
175 | 195 |
// Attributes |
... | ... | |
191 | 211 |
double radius = ((Double)data.getValue()).doubleValue(); |
192 | 212 |
FPolyline2D circle = createCircle(center, radius); |
193 | 213 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
194 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
195 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
196 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
214 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Circle")); |
|
215 |
int[] layerHandle = (int[])entity.getLayer(); |
|
216 |
String layerName = getLayerName(entity, layerTable); |
|
217 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
218 |
int color = entity.getColor(); |
|
219 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
220 |
//if (color==0) color ByBlock |
|
221 |
if (color==256) color = colorByLayer; |
|
222 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
197 | 223 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
198 | 224 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
199 | 225 |
// Attributes |
... | ... | |
216 | 242 |
Point2D p2 = new Point2D.Double(coord[0], coord[1]); |
217 | 243 |
FPolyline2D line = createLine(p1, p2); |
218 | 244 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
219 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
220 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
221 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
245 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Line")); |
|
246 |
int[] layerHandle = (int[])entity.getLayer(); |
|
247 |
String layerName = getLayerName(entity, layerTable); |
|
248 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
249 |
int color = entity.getColor(); |
|
250 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
251 |
//if (color==0) color ByBlock |
|
252 |
if (color==256) color = colorByLayer; |
|
253 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
222 | 254 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
223 | 255 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
224 | 256 |
// Attributes |
... | ... | |
238 | 270 |
Point2D p = new Point2D.Double(coord[0], coord[1]); |
239 | 271 |
FPoint2D point = createPoint(p); |
240 | 272 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
241 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
242 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
243 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
273 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Point")); |
|
274 |
int[] layerHandle = (int[])entity.getLayer(); |
|
275 |
String layerName = getLayerName(entity, layerTable); |
|
276 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
277 |
int color = entity.getColor(); |
|
278 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
279 |
//if (color==0) color ByBlock |
|
280 |
if (color==256) color = colorByLayer; |
|
281 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
244 | 282 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
245 | 283 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
246 | 284 |
// Attributes |
... | ... | |
326 | 364 |
} |
327 | 365 |
FPolyline2D pline = createPolyline2D(newPts, bulges); |
328 | 366 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
329 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
330 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
331 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
367 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Polyline2D")); |
|
368 |
int[] layerHandle = (int[])entity.getLayer(); |
|
369 |
String layerName = getLayerName(entity, layerTable); |
|
370 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
371 |
int color = entity.getColor(); |
|
372 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
373 |
//if (color==0) color ByBlock |
|
374 |
if (color==256) color = colorByLayer; |
|
375 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
332 | 376 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
333 | 377 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
334 | 378 |
// Attributes |
... | ... | |
380 | 424 |
} |
381 | 425 |
FPolyline2D pline3d = createPolyline3D(newPts); |
382 | 426 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
383 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
384 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
385 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
427 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Polyline3D")); |
|
428 |
int[] layerHandle = (int[])entity.getLayer(); |
|
429 |
String layerName = getLayerName(entity, layerTable); |
|
430 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
431 |
int color = entity.getColor(); |
|
432 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
433 |
//if (color==0) color ByBlock |
|
434 |
if (color==256) color = colorByLayer; |
|
435 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
386 | 436 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
387 | 437 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
388 | 438 |
// Attributes |
... | ... | |
401 | 451 |
Point2D p = (Point2D)data.getValue(); |
402 | 452 |
FPoint2D point = createPoint(p); |
403 | 453 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
404 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
405 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
406 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
407 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
|
408 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
|
454 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Text")); |
|
455 |
int[] layerHandle = (int[])entity.getLayer(); |
|
456 |
String layerName = getLayerName(entity, layerTable); |
|
457 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
458 |
int color = entity.getColor(); |
|
459 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
460 |
//if (color==0) color ByBlock |
|
461 |
if (color==256) color = colorByLayer; |
|
462 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
463 |
data = entity.getDwgObjectSpecificDataItem("TEXT"); |
|
464 |
String text = (String)data.getValue(); |
|
465 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createValue(new String(text)); |
|
466 |
data = entity.getDwgObjectSpecificDataItem("HEIGHT"); |
|
467 |
heightText = ((Float)data.getValue()).floatValue(); |
|
468 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(heightText); |
|
469 |
data = entity.getDwgObjectSpecificDataItem("DATA_FLAG"); |
|
470 |
int dflag = ((Integer)data.getValue()).intValue(); |
|
471 |
if ((dflag & 0x8) == 0) { |
|
472 |
data = entity.getDwgObjectSpecificDataItem("ROTATION_ANGLE"); |
|
473 |
double textRot = ((Double)data.getValue()).doubleValue(); |
|
474 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(Math.toDegrees(textRot)); |
|
475 |
} else { |
|
476 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0); |
|
477 |
} |
|
478 |
if ((dflag & 0x1)==0) { |
|
479 |
data = entity.getDwgObjectSpecificDataItem("ELEVATION"); |
|
480 |
double elev = ((Double)data.getValue()).doubleValue(); |
|
481 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev); |
|
482 |
} |
|
483 |
data = entity.getDwgObjectSpecificDataItem("THICKNESS"); |
|
484 |
double thickness = ((Double)data.getValue()).doubleValue(); |
|
485 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(thickness); |
|
409 | 486 |
// Attributes |
410 | 487 |
/*for (int j=0;j<nAtt;j++) { |
411 | 488 |
String[] attributes = new String[2]; |
... | ... | |
424 | 501 |
//pto = (Point2D.Double)point.get(0); |
425 | 502 |
//FShape nuevoShp; |
426 | 503 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
427 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
428 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
429 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
504 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block")); |
|
505 |
int[] layerHandle = (int[])entity.getLayer(); |
|
506 |
String layerName = getLayerName(entity, layerTable); |
|
507 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
508 |
int color = entity.getColor(); |
|
509 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
510 |
//if (color==0) color ByBlock |
|
511 |
if (color==256) color = colorByLayer; |
|
512 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
430 | 513 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
431 | 514 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
432 | 515 |
// Attributes |
... | ... | |
445 | 528 |
//pto = (Point2D.Double)point.get(0); |
446 | 529 |
//FShape nuevoShp; |
447 | 530 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
448 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
449 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
450 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
531 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("EndBlk")); |
|
532 |
int[] layerHandle = (int[])entity.getLayer(); |
|
533 |
String layerName = getLayerName(entity, layerTable); |
|
534 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
535 |
int color = entity.getColor(); |
|
536 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
537 |
//if (color==0) color ByBlock |
|
538 |
if (color==256) color = colorByLayer; |
|
539 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
451 | 540 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
452 | 541 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
453 | 542 |
// Attributes |
... | ... | |
466 | 555 |
//pto = (Point2D.Double)point.get(0); |
467 | 556 |
//FShape nuevoShp; |
468 | 557 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
469 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
470 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
471 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
558 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block Control Object")); |
|
559 |
int[] layerHandle = (int[])entity.getLayer(); |
|
560 |
String layerName = getLayerName(entity, layerTable); |
|
561 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
562 |
int color = entity.getColor(); |
|
563 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
564 |
//if (color==0) color ByBlock |
|
565 |
if (color==256) color = colorByLayer; |
|
566 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
472 | 567 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
473 | 568 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
474 | 569 |
// Attributes |
... | ... | |
487 | 582 |
//pto = (Point2D.Double)point.get(0); |
488 | 583 |
//FShape nuevoShp; |
489 | 584 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
490 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
491 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
492 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
585 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block Header")); |
|
586 |
int[] layerHandle = (int[])entity.getLayer(); |
|
587 |
String layerName = getLayerName(entity, layerTable); |
|
588 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
589 |
int color = entity.getColor(); |
|
590 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
591 |
//if (color==0) color ByBlock |
|
592 |
if (color==256) color = colorByLayer; |
|
593 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
493 | 594 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
494 | 595 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
495 | 596 |
// Attributes |
... | ... | |
517 | 618 |
manageInsert(dwgObjects, point, scale, rot, blockHandle, auxRow); |
518 | 619 |
|
519 | 620 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
520 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
521 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
522 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
621 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Insert")); |
|
622 |
int[] layerHandle = (int[])entity.getLayer(); |
|
623 |
String layerName = getLayerName(entity, layerTable); |
|
624 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
625 |
int color = entity.getColor(); |
|
626 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
627 |
//if (color==0) color ByBlock |
|
628 |
if (color==256) color = colorByLayer; |
|
629 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
523 | 630 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
524 | 631 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
525 | 632 |
// Attributes |
... | ... | |
540 | 647 |
Point2D p = new Point2D.Double(coord[0], coord[1]); |
541 | 648 |
FPoint2D point = createPoint(p); |
542 | 649 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
543 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
544 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
545 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
650 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("MText")); |
|
651 |
int[] layerHandle = (int[])entity.getLayer(); |
|
652 |
String layerName = getLayerName(entity, layerTable); |
|
653 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
654 |
int color = entity.getColor(); |
|
655 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
656 |
//if (color==0) color ByBlock |
|
657 |
if (color==256) color = colorByLayer; |
|
658 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
546 | 659 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
547 | 660 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
548 | 661 |
// Attributes |
... | ... | |
571 | 684 |
Point2D p4 = new Point2D.Double(coord[0], coord[1]); |
572 | 685 |
FPolygon2D solid = createSolid(new Point2D[]{p1, p2, p4, p3}); |
573 | 686 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
574 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
575 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
576 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
687 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Solid")); |
|
688 |
int[] layerHandle = (int[])entity.getLayer(); |
|
689 |
String layerName = getLayerName(entity, layerTable); |
|
690 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
691 |
int color = entity.getColor(); |
|
692 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
693 |
//if (color==0) color ByBlock |
|
694 |
if (color==256) color = colorByLayer; |
|
695 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
577 | 696 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
578 | 697 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
579 | 698 |
// Attributes |
... | ... | |
604 | 723 |
} |
605 | 724 |
FPolyline2D spline = createLwPolyline(pts); |
606 | 725 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
607 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
608 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
609 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
726 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Spline")); |
|
727 |
int[] layerHandle = (int[])entity.getLayer(); |
|
728 |
String layerName = getLayerName(entity, layerTable); |
|
729 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
730 |
int color = entity.getColor(); |
|
731 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
732 |
//if (color==0) color ByBlock |
|
733 |
if (color==256) color = colorByLayer; |
|
734 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
610 | 735 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
611 | 736 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
612 | 737 |
// Attributes |
... | ... | |
639 | 764 |
} |
640 | 765 |
FPolyline2D lwpline = createLwPolyline(pts); |
641 | 766 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
642 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
|
643 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
|
644 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0); |
|
767 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("LwPolyline")); |
|
768 |
int[] layerHandle = (int[])entity.getLayer(); |
|
769 |
String layerName = getLayerName(entity, layerTable); |
|
770 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
|
771 |
int color = entity.getColor(); |
|
772 |
int colorByLayer = setColorByLayer(layerHandle, layerTable); |
|
773 |
//if (color==0) color ByBlock |
|
774 |
if (color==256) color = colorByLayer; |
|
775 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
|
645 | 776 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
646 | 777 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0); |
647 | 778 |
// Attributes |
... | ... | |
1221 | 1352 |
} |
1222 | 1353 |
} |
1223 | 1354 |
|
1355 |
/** |
|
1356 |
* LayerTable podr?a ser un objeto y LayerTableRecord tambi?n ... |
|
1357 |
* @param dwgObjects |
|
1358 |
* @return |
|
1359 |
*/ |
|
1360 |
private Vector createLayerTable(Vector dwgObjects) { |
|
1361 |
Vector layerTable = new Vector(); |
|
1362 |
for (int i=0;i<dwgObjects.size();i++) { |
|
1363 |
DwgObject obj = (DwgObject)dwgObjects.get(i); |
|
1364 |
if (obj.getType()==0x33) { |
|
1365 |
//System.out.println("Encuentra un objeto layer ..."); |
|
1366 |
Vector layerTableRecord = new Vector(); |
|
1367 |
layerTableRecord.add(obj.getHandle()); |
|
1368 |
layerTableRecord.add(((String)obj.getDwgObjectSpecificDataItem("NAME").getValue())); |
|
1369 |
//System.out.println("((Integer)obj.getDwgObjectSpecificDataItem(COLOR).getValue()).intValue() = " + ((Integer)obj.getDwgObjectSpecificDataItem("COLOR").getValue()).intValue()); |
|
1370 |
layerTableRecord.add(((Integer)obj.getDwgObjectSpecificDataItem("COLOR").getValue())); |
|
1371 |
//layerTableRecord.add(obj.getDwgObjectSpecificDataItem("LAYER_CONTROL_HANDLE").getValue()); |
|
1372 |
layerTable.add(layerTableRecord); |
|
1373 |
} |
|
1374 |
} |
|
1375 |
return layerTable; |
|
1376 |
} |
|
1377 |
|
|
1378 |
//private String setLayerName(int[] layerHandle, Vector layerTable) { |
|
1379 |
private String getLayerName(DwgObject entity, Vector layerTable) { |
|
1380 |
String layerName = ""; |
|
1381 |
int[] layerHandle = (int[])entity.getLayer(); |
|
1382 |
System.out.println("layerHandle[0] = " + layerHandle[0]); |
|
1383 |
if (layerHandle.length>1) System.out.println("layerHandle[1] = " + layerHandle[1]); |
|
1384 |
if (layerHandle.length>2) System.out.println("layerHandle[2] = " + layerHandle[2]); |
|
1385 |
if (layerHandle.length>3) System.out.println("layerHandle[3] = " + layerHandle[3]); |
|
1386 |
byte[] layerBytes = new byte[]{0,0,0,0}; |
|
1387 |
if (layerHandle.length>2) layerBytes[3] = (byte)layerHandle[2]; |
|
1388 |
if (layerHandle.length>3) layerBytes[2] = (byte)layerHandle[3]; |
|
1389 |
if (layerHandle.length>4) layerBytes[1] = (byte)layerHandle[4]; |
|
1390 |
if (layerHandle.length>5) layerBytes[0] = (byte)layerHandle[5]; |
|
1391 |
int layer = ByteUtils.bytesToInt(layerBytes, new int[]{0}); |
|
1392 |
for (int j=0;j<layerTable.size();j++) { |
|
1393 |
Vector layerTableRecord = (Vector)layerTable.get(j); |
|
1394 |
Vector layerHandleVect = (Vector)layerTableRecord.get(0); |
|
1395 |
System.out.println("layerHandleVect.get(0) = " + layerHandleVect.get(0)); |
|
1396 |
if (layerHandleVect.size()>1) System.out.println("layerHandleVect.get(1) = " + layerHandleVect.get(1)); |
|
1397 |
if (layerHandleVect.size()>2) System.out.println("layerHandleVect.get(2) = " + layerHandleVect.get(2)); |
|
1398 |
if (layerHandleVect.size()>3) System.out.println("layerHandleVect.get(3) = " + layerHandleVect.get(3)); |
|
1399 |
byte[] layerHandleBytes = new byte[]{0,0,0,0}; |
|
1400 |
if (layerHandleVect.size()>2) layerHandleBytes[3] = (byte)((Integer)layerHandleVect.get(2)).intValue(); |
|
1401 |
if (layerHandleVect.size()>3) layerHandleBytes[2] = (byte)((Integer)layerHandleVect.get(3)).intValue(); |
|
1402 |
if (layerHandleVect.size()>4) layerHandleBytes[1] = (byte)((Integer)layerHandleVect.get(4)).intValue(); |
|
1403 |
if (layerHandleVect.size()>5) layerHandleBytes[0] = (byte)((Integer)layerHandleVect.get(5)).intValue(); |
|
1404 |
int lHandle = ByteUtils.bytesToInt(layerHandleBytes, new int[]{0}); |
|
1405 |
/*int[] layerControlHandle = (int[])layerTableRecord.get(3); |
|
1406 |
byte[] layerControlBytes = new byte[]{0,0,0,0}; |
|
1407 |
if (layerControlHandle.length>2) layerControlBytes[3] = (byte)layerControlHandle[2]; |
|
1408 |
if (layerControlHandle.length>3) layerControlBytes[2] = (byte)layerControlHandle[3]; |
|
1409 |
if (layerControlHandle.length>4) layerControlBytes[1] = (byte)layerControlHandle[4]; |
|
1410 |
if (layerControlHandle.length>5) layerControlBytes[0] = (byte)layerControlHandle[5]; |
|
1411 |
int layerControl = ByteUtils.bytesToInt(layerControlBytes, new int[]{0});*/ |
|
1412 |
System.out.println("lHandle = " + lHandle); |
|
1413 |
System.out.println("layer = " + layer); |
|
1414 |
if (lHandle==layer) { |
|
1415 |
layerName = (String)layerTableRecord.get(1); |
|
1416 |
System.out.println("layerName = " + layerName); |
|
1417 |
} |
|
1418 |
} |
|
1419 |
return layerName; |
|
1420 |
} |
|
1421 |
|
|
1422 |
private int setColorByLayer(int[] layerHandle, Vector layerTable) { |
|
1423 |
int colorByLayer = 0; |
|
1424 |
byte[] layerBytes = new byte[]{0,0,0,0}; |
|
1425 |
if (layerHandle.length>2) layerBytes[3] = (byte)layerHandle[2]; |
|
1426 |
if (layerHandle.length>3) layerBytes[2] = (byte)layerHandle[3]; |
|
1427 |
if (layerHandle.length>4) layerBytes[1] = (byte)layerHandle[4]; |
|
1428 |
if (layerHandle.length>5) layerBytes[0] = (byte)layerHandle[5]; |
|
1429 |
int layer = ByteUtils.bytesToInt(layerBytes, new int[]{0}); |
|
1430 |
for (int j=0;j<layerTable.size();j++) { |
|
1431 |
Vector layerTableRecord = (Vector)layerTable.get(j); |
|
1432 |
Vector layerHandleVect = (Vector)layerTableRecord.get(0); |
|
1433 |
byte[] layerHandleBytes = new byte[]{0,0,0,0}; |
|
1434 |
if (layerHandleVect.size()>2) layerHandleBytes[3] = (byte)((Integer)layerHandleVect.get(2)).intValue(); |
|
1435 |
if (layerHandleVect.size()>3) layerHandleBytes[2] = (byte)((Integer)layerHandleVect.get(3)).intValue(); |
|
1436 |
if (layerHandleVect.size()>4) layerHandleBytes[1] = (byte)((Integer)layerHandleVect.get(4)).intValue(); |
|
1437 |
if (layerHandleVect.size()>5) layerHandleBytes[0] = (byte)((Integer)layerHandleVect.get(5)).intValue(); |
|
1438 |
int lHandle = ByteUtils.bytesToInt(layerHandleBytes, new int[]{0}); |
|
1439 |
//System.out.println("layerHandle = " + layerHandle); |
|
1440 |
//System.out.println("layer = " + layer); |
|
1441 |
if (lHandle==layer) { |
|
1442 |
colorByLayer = ((Integer)layerTableRecord.get(2)).intValue(); |
|
1443 |
//System.out.println("colorByLayer = " + colorByLayerObj.intValue()); |
|
1444 |
} |
|
1445 |
} |
|
1446 |
return colorByLayer; |
|
1447 |
} |
|
1448 |
|
|
1224 | 1449 |
/* (non-Javadoc) |
1225 | 1450 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#accept(java.io.File) |
1226 | 1451 |
*/ |
Also available in: Unified diff