svn-gvsig-desktop / branches / v10 / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / readers / objreaders / v1314 / DwgDictionaryReader1314.java @ 10539
History | View | Annotate | Download (3.5 KB)
1 |
/*
|
---|---|
2 |
* Created on 05-feb-2007
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id: DwgDictionaryReader1314.java 10539 2007-02-28 07:35:10Z jmvivo $
|
47 |
* $Log$
|
48 |
* Revision 1.2.2.1 2007-02-28 07:35:09 jmvivo
|
49 |
* Actualizado desde el HEAD.
|
50 |
*
|
51 |
* Revision 1.2 2007/02/06 20:17:29 azabala
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
* Revision 1.1 2007/02/05 19:44:00 azabala
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
*
|
58 |
*/
|
59 |
package com.iver.cit.jdwglib.dwg.readers.objreaders.v1314; |
60 |
|
61 |
import java.util.List; |
62 |
|
63 |
import com.iver.cit.jdwglib.dwg.CorruptedDwgEntityException; |
64 |
import com.iver.cit.jdwglib.dwg.DwgHandleReference; |
65 |
import com.iver.cit.jdwglib.dwg.DwgObject; |
66 |
import com.iver.cit.jdwglib.dwg.DwgUtil; |
67 |
import com.iver.cit.jdwglib.dwg.objects.DwgDictionary; |
68 |
|
69 |
public class DwgDictionaryReader1314 extends AbstractDwg1314Reader { |
70 |
|
71 |
public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) |
72 |
throws RuntimeException, CorruptedDwgEntityException { |
73 |
|
74 |
if(! (dwgObj instanceof DwgDictionary)) |
75 |
throw new RuntimeException("ArcReader 15 solo puede leer DwgDictionary"); |
76 |
DwgDictionary dic = (DwgDictionary) dwgObj; |
77 |
|
78 |
int bitPos = offset;
|
79 |
List val = DwgUtil.getBitShort(data, bitPos);
|
80 |
bitPos = ((Integer) val.get(0)).intValue(); |
81 |
int nr = ((Integer) val.get(1)).intValue(); |
82 |
|
83 |
val = DwgUtil.getBitLong(data, bitPos); |
84 |
bitPos = ((Integer) val.get(0)).intValue(); |
85 |
int ni = ((Integer) val.get(1)).intValue(); |
86 |
int u = 0; |
87 |
//TODO Revisar que valores puede tomar el campo version
|
88 |
if(dic.getVersion() == "Autocad R14"){ |
89 |
val = DwgUtil.getRawChar(data, bitPos); |
90 |
bitPos = ((Integer) val.get(0)).intValue(); |
91 |
u = ((Integer) val.get(1)).intValue(); |
92 |
} |
93 |
String[] texts = null; |
94 |
if(ni > 0){ |
95 |
texts = new String[ni]; |
96 |
for(int i = 0; i < ni; i++){ |
97 |
val = DwgUtil.getTextString(data, bitPos); |
98 |
bitPos = ((Integer) val.get(0)).intValue(); |
99 |
texts[i] = (String) val.get(1); |
100 |
}//for
|
101 |
} |
102 |
|
103 |
DwgHandleReference handle = new DwgHandleReference();
|
104 |
bitPos = handle.read(data, bitPos); |
105 |
dic.setParentHandle(handle); |
106 |
|
107 |
for (int i = 0; i < nr; i++){ |
108 |
handle = new DwgHandleReference();
|
109 |
bitPos = handle.read(data, bitPos); |
110 |
dic.addReactorHandle(handle); |
111 |
} |
112 |
|
113 |
handle = new DwgHandleReference();
|
114 |
bitPos = handle.read(data, bitPos); |
115 |
dic.setXDicObjHandle(handle); |
116 |
|
117 |
if(ni > 0){ |
118 |
for(int i = 0; i < ni; i++){ |
119 |
handle = new DwgHandleReference();
|
120 |
bitPos = handle.read(data, bitPos); |
121 |
|
122 |
dic.put(texts[i], handle); |
123 |
} |
124 |
} |
125 |
} |
126 |
|
127 |
|
128 |
} |
129 |
|