Revision 9873
trunk/libraries/libDwg/src/com/iver/cit/jdwglib/dwg/DwgUtil.java | ||
---|---|---|
37 | 37 |
import java.nio.ByteBuffer; |
38 | 38 |
import java.nio.ByteOrder; |
39 | 39 |
import java.util.ArrayList; |
40 |
import java.util.ArrayList;
|
|
40 |
import java.util.List; |
|
41 | 41 |
|
42 | 42 |
import com.iver.cit.gvsig.fmap.drivers.dgn.ByteUtils; |
43 | 43 |
|
... | ... | |
199 | 199 |
val = defVal; |
200 | 200 |
} else { |
201 | 201 |
int _offset = offset + 2; |
202 |
String dstr; |
|
203 | 202 |
if (flags==0x3) { |
204 | 203 |
byte[] bytes = (byte[])getBits(data, 64, _offset); |
205 | 204 |
ByteBuffer bb = ByteBuffer.wrap(bytes); |
... | ... | |
685 | 684 |
} |
686 | 685 |
return dataOut; |
687 | 686 |
} |
687 |
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
|
|
692 |
|
|
693 |
/** |
|
694 |
* It receives the list procedent from getHandle method, and return the |
|
695 |
* handle as int |
|
696 |
* |
|
697 |
* */ |
|
698 |
public static int handleToInt(List fromGetHandle){ |
|
699 |
|
|
700 |
int[] handle = new int[fromGetHandle.size()-1]; |
|
701 |
for (int j=1; j< fromGetHandle.size(); j++) { |
|
702 |
handle[j-1] = ((Integer)fromGetHandle.get(j)).intValue(); |
|
703 |
} |
|
704 |
ArrayList handleVect = new ArrayList(); |
|
705 |
for (int i=0;i<handle.length;i++) { |
|
706 |
handleVect.add(new Integer(handle[i])); |
|
707 |
} |
|
708 |
return DwgUtil.handleBinToHandleInt(handleVect); |
|
709 |
|
|
710 |
|
|
711 |
} |
|
688 | 712 |
/** |
689 | 713 |
* Obtain the int value of a handle given in binary format |
690 | 714 |
* |
... | ... | |
712 | 736 |
int layer = ByteUtils.bytesToInt(layerBytes, new int[]{0}); |
713 | 737 |
return layer; |
714 | 738 |
} |
739 |
/* |
|
740 |
* TODO Ver si esto es necesario |
|
741 |
* */ |
|
742 |
public static int[] toIntArray(byte[] bytes){ |
|
743 |
String[] dataMachValString = new String[bytes.length]; |
|
744 |
int[] data = new int[bytes.length]; |
|
745 |
for (int i=0; i < bytes.length; i++) { |
|
746 |
dataMachValString[i] = HexUtil.bytesToHex(new byte[]{bytes[i]}); |
|
747 |
Integer dataMachValShort = Integer.decode("0x" + dataMachValString[i]); |
|
748 |
data[i] = dataMachValShort.byteValue(); |
|
749 |
data[i] = ByteUtils.getUnsigned((byte)data[i]); |
|
750 |
}//for |
|
751 |
return data; |
|
752 |
|
|
753 |
} |
|
715 | 754 |
} |
Also available in: Unified diff