Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / readers / objreaders / v1314 / DwgDimOrdReader1314.java @ 23941

History | View | Annotate | Download (6.53 KB)

1
/*
2
 * Created on 03-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: DwgDimOrdReader1314.java 23941 2008-10-15 07:11:08Z vcaballero $
47
* $Log$
48
* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
49
* implementation of dwg 12, 13, 14.
50
*
51
* Revision 1.1  2007/02/05 07:03:22  azabala
52
* *** empty log message ***
53
*
54
*
55
*/
56
package com.iver.cit.jdwglib.dwg.readers.objreaders.v1314;
57

    
58
import java.util.List;
59

    
60
import com.iver.cit.jdwglib.dwg.CorruptedDwgEntityException;
61
import com.iver.cit.jdwglib.dwg.DwgHandleReference;
62
import com.iver.cit.jdwglib.dwg.DwgObject;
63
import com.iver.cit.jdwglib.dwg.DwgUtil;
64
import com.iver.cit.jdwglib.dwg.objects.DwgDimOrd;
65

    
66
public class DwgDimOrdReader1314 extends AbstractDwg1314Reader {
67

    
68
        public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
69
                        throws RuntimeException, CorruptedDwgEntityException {
70
                 if(! (dwgObj instanceof DwgDimOrd))
71
                            throw new RuntimeException("ArcReader 14 solo puede leer DwgDimOrd");
72
                
73
                DwgDimOrd dim = (DwgDimOrd) dwgObj;
74
                int bitPos = offset;
75
                bitPos = headTailReader.readObjectHeader(data, bitPos, dim);
76
                
77
                List val = DwgUtil.getBitDouble(data, bitPos);
78
                bitPos = ((Integer) val.get(0)).intValue();
79
                double x = ((Double) val.get(1)).doubleValue();
80
                
81
                val = DwgUtil.getBitDouble(data, bitPos);
82
                bitPos = ((Integer) val.get(0)).intValue();
83
                double y = ((Double) val.get(1)).doubleValue();
84
                
85
                val = DwgUtil.getBitDouble(data, bitPos);
86
                bitPos = ((Integer) val.get(0)).intValue();
87
                double z = ((Double) val.get(1)).doubleValue();
88
                dim.setExtrusion(new double[]{x, y, z});
89
                
90
                val = DwgUtil.getRawDouble(data, bitPos);
91
                bitPos = ((Integer) val.get(0)).intValue();
92
                x = ((Double) val.get(1)).doubleValue();
93
                
94
                val = DwgUtil.getRawDouble(data, bitPos);
95
                bitPos = ((Integer) val.get(0)).intValue();
96
                y = ((Double) val.get(1)).doubleValue();
97
                dim.setTextMidPoint(new double[]{x, y});
98
                
99
                val = DwgUtil.getBitDouble(data, bitPos);
100
                bitPos = ((Integer) val.get(0)).intValue();
101
                double elevation = ((Double) val.get(1)).doubleValue();
102
                dim.setElevation(elevation);
103
                
104
                val = DwgUtil.getRawChar(data, bitPos);
105
                bitPos = ((Integer) val.get(0)).intValue();
106
                int flags = ((Integer) val.get(1)).intValue();
107
                dim.setFlags(flags);
108
                
109
                val = DwgUtil.getTextString(data, bitPos);
110
                bitPos = ((Integer) val.get(0)).intValue();
111
                String txt = (String) val.get(1);
112
                dim.setText(txt);
113
                
114

    
115
                val = DwgUtil.getBitDouble(data, bitPos);
116
                bitPos = ((Integer) val.get(0)).intValue();
117
                double textRotation = ((Double) val.get(1)).doubleValue();
118
                dim.setTextRotation(textRotation);
119
                
120
                val = DwgUtil.getBitDouble(data, bitPos);
121
                bitPos = ((Integer) val.get(0)).intValue();
122
                double horizDir = ((Double) val.get(1)).doubleValue();
123
                dim.setHorizDir(horizDir);
124
                
125
                val = DwgUtil.getBitDouble(data, bitPos);
126
                bitPos = ((Integer) val.get(0)).intValue();
127
                x = ((Double) val.get(1)).doubleValue();
128
                
129
                val = DwgUtil.getBitDouble(data, bitPos);
130
                bitPos = ((Integer) val.get(0)).intValue();
131
                y = ((Double) val.get(1)).doubleValue();
132
                
133
                val = DwgUtil.getBitDouble(data, bitPos);
134
                bitPos = ((Integer) val.get(0)).intValue();
135
                z = ((Double) val.get(1)).doubleValue();
136
                dim.setInsScale(new double[]{x, y, z});
137
                
138
                val = DwgUtil.getBitDouble(data, bitPos);
139
                bitPos = ((Integer) val.get(0)).intValue();
140
                double insRotation = ((Double) val.get(1)).doubleValue();
141
                dim.setInsRotation(insRotation);
142
                
143
                val = DwgUtil.getRawDouble(data, bitPos);
144
                bitPos = ((Integer) val.get(0)).intValue();
145
                double v1 = ((Double) val.get(1)).doubleValue();
146
                
147
                val = DwgUtil.getRawDouble(data, bitPos);
148
                bitPos = ((Integer) val.get(0)).intValue();
149
                double v2 = ((Double) val.get(1)).doubleValue();
150
                dim.set12Pt(new double[]{v1, v2});
151
                
152
                val = DwgUtil.getBitDouble(data, bitPos);
153
                bitPos = ((Integer) val.get(0)).intValue();
154
                v1 = ((Double) val.get(1)).doubleValue();
155
                
156
                val = DwgUtil.getBitDouble(data, bitPos);
157
                bitPos = ((Integer) val.get(0)).intValue();
158
                v2 = ((Double) val.get(1)).doubleValue();
159
                
160
                val = DwgUtil.getBitDouble(data, bitPos);
161
                bitPos = ((Integer) val.get(0)).intValue();
162
                double v3 = ((Double) val.get(1)).doubleValue();
163
                dim.set10Pt(new double[]{v1, v2, v3});
164
                
165
                val = DwgUtil.getBitDouble(data, bitPos);
166
                bitPos = ((Integer) val.get(0)).intValue();
167
                v1 = ((Double) val.get(1)).doubleValue();
168
                
169
                val = DwgUtil.getBitDouble(data, bitPos);
170
                bitPos = ((Integer) val.get(0)).intValue();
171
                v2 = ((Double) val.get(1)).doubleValue();
172
                
173
                val = DwgUtil.getBitDouble(data, bitPos);
174
                bitPos = ((Integer) val.get(0)).intValue();
175
                v3 = ((Double) val.get(1)).doubleValue();
176
                dim.set13Pt(new double[]{v1, v2, v3});
177
                
178
                val = DwgUtil.getBitDouble(data, bitPos);
179
                bitPos = ((Integer) val.get(0)).intValue();
180
                v1 = ((Double) val.get(1)).doubleValue();
181
                
182
                val = DwgUtil.getBitDouble(data, bitPos);
183
                bitPos = ((Integer) val.get(0)).intValue();
184
                v2 = ((Double) val.get(1)).doubleValue();
185
                
186
                val = DwgUtil.getBitDouble(data, bitPos);
187
                bitPos = ((Integer) val.get(0)).intValue();
188
                v3 = ((Double) val.get(1)).doubleValue();
189
                dim.set14Pt(new double[]{v1, v2, v3});
190
                
191
                val = DwgUtil.getRawChar(data, bitPos);
192
                bitPos = ((Integer) val.get(0)).intValue();
193
                flags = ((Integer) val.get(1)).intValue();
194
                dim.setFlags2(flags);
195
                
196
                bitPos = headTailReader.readObjectTailer(data, bitPos, dim);
197
                
198
                DwgHandleReference handle = new DwgHandleReference();
199
                bitPos = handle.read(data, bitPos);
200
                dim.setDimStyleHandle(handle);
201
                
202
                handle = new DwgHandleReference();
203
                bitPos = handle.read(data, bitPos);
204
                dim.setAnonBlockHandle(handle);
205
        }
206

    
207
}
208