Revision 1868 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dwg/DwgMemoryDriver.java
DwgMemoryDriver.java | ||
---|---|---|
495 | 495 |
|
496 | 496 |
manageInsert(dwgObjects, point, scale, rot, blockHandle, auxRow); |
497 | 497 |
|
498 |
/*byte[] blockHandleBytes = new byte[]{0,0,0,0}; |
|
499 |
if (blockHandle.length>2) blockHandleBytes[3] = (byte)blockHandle[2]; |
|
500 |
if (blockHandle.length>3) blockHandleBytes[2] = (byte)blockHandle[3]; |
|
501 |
if (blockHandle.length>4) blockHandleBytes[1] = (byte)blockHandle[4]; |
|
502 |
if (blockHandle.length>5) blockHandleBytes[0] = (byte)blockHandle[5]; |
|
503 |
int bHandle = ByteUtils.bytesToInt(blockHandleBytes, new int[]{0}); |
|
504 |
System.out.println("bHandle = " + bHandle); |
|
505 |
|
|
506 |
for (int j=0;j<dwgObjects.size();j++) { |
|
507 |
DwgObject obj = (DwgObject)dwgObjects.get(j); |
|
508 |
DwgObjectSpecificDataItem dataa = obj.getDwgObjectSpecificDataItem("BLOCK_ENTITY_HANDLE"); |
|
509 |
//System.out.println("obj.getType() = " + obj.getType()); |
|
510 |
//System.out.println("dataa = " + dataa); |
|
511 |
if (dataa!=null) { |
|
512 |
int[] handle = (int[])dataa.getValue(); |
|
513 |
byte[] handleBytes = new byte[]{0,0,0,0}; |
|
514 |
if (handle.length>2) handleBytes[3] = (byte)handle[2]; |
|
515 |
if (handle.length>3) handleBytes[2] = (byte)handle[3]; |
|
516 |
if (handle.length>4) handleBytes[1] = (byte)handle[4]; |
|
517 |
if (handle.length>5) handleBytes[0] = (byte)handle[5]; |
|
518 |
int objHandle = ByteUtils.bytesToInt(handleBytes, new int[]{0}); |
|
519 |
System.out.println("objHandle = " + objHandle); |
|
520 |
System.out.println("bHandle = " + bHandle); |
|
521 |
if (objHandle==bHandle+1 && handle[1]==blockHandle[1]) { |
|
522 |
//obj = (DwgObject)dwgObjects.get(j+1); |
|
523 |
//System.out.println("Hemos encontrado el bloque"); |
|
524 |
System.out.println("obj.getType() = " + obj.getType()); |
|
525 |
data = obj.getDwgObjectSpecificDataItem("BASE_POINT"); |
|
526 |
double[] bPoint = (double[])data.getValue(); |
|
527 |
//System.out.println("bPoint[0] = " + bPoint[0]); |
|
528 |
//System.out.println("bPoint[1] = " + bPoint[1]); |
|
529 |
data = obj.getDwgObjectSpecificDataItem("FIRST_ENTITY_HANDLE"); |
|
530 |
int[] firstEntityHandle = (int[])data.getValue(); |
|
531 |
System.out.println("firstEntityHandle[0] = " + firstEntityHandle[0]); |
|
532 |
System.out.println("firstEntityHandle[1] = " + firstEntityHandle[1]); |
|
533 |
if (firstEntityHandle.length>2) System.out.println("firstEntityHandle[2] = " + firstEntityHandle[2]); |
|
534 |
if (firstEntityHandle.length>3) System.out.println("firstEntityHandle[3] = " + firstEntityHandle[3]); |
|
535 |
byte[] firstEntityBytes = new byte[]{0,0,0,0}; |
|
536 |
if (firstEntityHandle.length>2) firstEntityBytes[3] = (byte)firstEntityHandle[2]; |
|
537 |
if (firstEntityHandle.length>3) firstEntityBytes[2] = (byte)firstEntityHandle[3]; |
|
538 |
if (firstEntityHandle.length>4) firstEntityBytes[1] = (byte)firstEntityHandle[4]; |
|
539 |
if (firstEntityHandle.length>5) firstEntityBytes[0] = (byte)firstEntityHandle[5]; |
|
540 |
int firstHandle = ByteUtils.bytesToInt(firstEntityBytes, new int[]{0}); |
|
541 |
//System.out.println("firstHandle = " + firstHandle); |
|
542 |
data = obj.getDwgObjectSpecificDataItem("LAST_ENTITY_HANDLE"); |
|
543 |
int[] lastEntityHandle = (int[])data.getValue(); |
|
544 |
byte[] lastEntityBytes = new byte[]{0,0,0,0}; |
|
545 |
if (lastEntityHandle.length>2) lastEntityBytes[3] = (byte)lastEntityHandle[2]; |
|
546 |
if (lastEntityHandle.length>3) lastEntityBytes[2] = (byte)lastEntityHandle[3]; |
|
547 |
if (lastEntityHandle.length>4) lastEntityBytes[1] = (byte)lastEntityHandle[4]; |
|
548 |
if (lastEntityHandle.length>5) lastEntityBytes[0] = (byte)lastEntityHandle[5]; |
|
549 |
int lastHandle = ByteUtils.bytesToInt(lastEntityBytes, new int[]{0}); |
|
550 |
//System.out.println("lastHandle = " + lastHandle); |
|
551 |
|
|
552 |
for (int k=0;k<dwgObjects.size();k++) { |
|
553 |
DwgObject ent = (DwgObject)dwgObjects.get(k); |
|
554 |
Vector entHandle = ent.getHandle(); |
|
555 |
byte[] entHandleBytes = new byte[]{0,0,0,0}; |
|
556 |
if (entHandle.size()>2) entHandleBytes[3] = ((Integer)entHandle.get(2)).byteValue(); |
|
557 |
if (entHandle.size()>3) entHandleBytes[2] = ((Integer)entHandle.get(3)).byteValue(); |
|
558 |
if (entHandle.size()>4) entHandleBytes[1] = ((Integer)entHandle.get(4)).byteValue(); |
|
559 |
if (entHandle.size()>5) entHandleBytes[0] = ((Integer)entHandle.get(5)).byteValue(); |
|
560 |
int eHandle = ByteUtils.bytesToInt(entHandleBytes, new int[]{0}); |
|
561 |
//System.out.println("eHandle = " + eHandle); |
|
562 |
if (eHandle==firstHandle && ((Integer)entHandle.get(1)).intValue()==firstEntityHandle[1]) { |
|
563 |
//System.out.println("Hemos encontrado el primer elemento"); |
|
564 |
int l=0; |
|
565 |
while (true) { |
|
566 |
DwgObject blockEntity = (DwgObject)dwgObjects.get(k+l); |
|
567 |
Vector blockEntityHandle = blockEntity.getHandle(); |
|
568 |
byte[] blockEntityHandleBytes = new byte[]{0,0,0,0}; |
|
569 |
if (blockEntityHandle.size()>2) blockEntityHandleBytes[3] = ((Integer)blockEntityHandle.get(2)).byteValue(); |
|
570 |
if (blockEntityHandle.size()>3) blockEntityHandleBytes[2] = ((Integer)blockEntityHandle.get(3)).byteValue(); |
|
571 |
if (blockEntityHandle.size()>4) blockEntityHandleBytes[1] = ((Integer)blockEntityHandle.get(4)).byteValue(); |
|
572 |
if (blockEntityHandle.size()>5) blockEntityHandleBytes[0] = ((Integer)blockEntityHandle.get(5)).byteValue(); |
|
573 |
int bEntityHandle = ByteUtils.bytesToInt(blockEntityHandleBytes, new int[]{0}); |
|
574 |
manageBlockEntity(blockEntity, bPoint, point, scale, rot, auxRow); |
|
575 |
l++; |
|
576 |
if (bEntityHandle==lastHandle && ((Integer)entHandle.get(1)).intValue()==lastEntityHandle[1]) { |
|
577 |
break; |
|
578 |
} |
|
579 |
} |
|
580 |
} |
|
581 |
} |
|
582 |
} |
|
583 |
} |
|
584 |
}*/ |
|
585 |
|
|
586 | 498 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
587 | 499 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity")); |
588 | 500 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer")); |
... | ... | |
1082 | 994 |
if (handle.length>4) handleBytes[1] = (byte)handle[4]; |
1083 | 995 |
if (handle.length>5) handleBytes[0] = (byte)handle[5]; |
1084 | 996 |
int objHandle = ByteUtils.bytesToInt(handleBytes, new int[]{0}); |
1085 |
System.out.println("objHandle = " + objHandle); |
|
1086 |
System.out.println("bHandle = " + bHandle); |
|
997 |
//System.out.println("objHandle = " + objHandle);
|
|
998 |
//System.out.println("bHandle = " + bHandle);
|
|
1087 | 999 |
if (objHandle==bHandle+1 && handle[1]==blockHandle[1]) { |
1088 | 1000 |
//obj = (DwgObject)dwgObjects.get(j+1); |
1089 | 1001 |
//System.out.println("Hemos encontrado el bloque"); |
1090 |
System.out.println("obj.getType() = " + obj.getType()); |
|
1002 |
//System.out.println("obj.getType() = " + obj.getType());
|
|
1091 | 1003 |
DwgObjectSpecificDataItem data = obj.getDwgObjectSpecificDataItem("BASE_POINT"); |
1092 | 1004 |
double[] bPoint = (double[])data.getValue(); |
1093 | 1005 |
//System.out.println("bPoint[0] = " + bPoint[0]); |
1094 | 1006 |
//System.out.println("bPoint[1] = " + bPoint[1]); |
1095 | 1007 |
data = obj.getDwgObjectSpecificDataItem("FIRST_ENTITY_HANDLE"); |
1096 | 1008 |
int[] firstEntityHandle = (int[])data.getValue(); |
1097 |
System.out.println("firstEntityHandle[0] = " + firstEntityHandle[0]); |
|
1098 |
System.out.println("firstEntityHandle[1] = " + firstEntityHandle[1]); |
|
1099 |
if (firstEntityHandle.length>2) System.out.println("firstEntityHandle[2] = " + firstEntityHandle[2]); |
|
1100 |
if (firstEntityHandle.length>3) System.out.println("firstEntityHandle[3] = " + firstEntityHandle[3]); |
|
1009 |
//System.out.println("firstEntityHandle[0] = " + firstEntityHandle[0]);
|
|
1010 |
//System.out.println("firstEntityHandle[1] = " + firstEntityHandle[1]);
|
|
1011 |
//if (firstEntityHandle.length>2) System.out.println("firstEntityHandle[2] = " + firstEntityHandle[2]);
|
|
1012 |
//if (firstEntityHandle.length>3) System.out.println("firstEntityHandle[3] = " + firstEntityHandle[3]);
|
|
1101 | 1013 |
byte[] firstEntityBytes = new byte[]{0,0,0,0}; |
1102 | 1014 |
if (firstEntityHandle.length>2) firstEntityBytes[3] = (byte)firstEntityHandle[2]; |
1103 | 1015 |
if (firstEntityHandle.length>3) firstEntityBytes[2] = (byte)firstEntityHandle[3]; |
Also available in: Unified diff