root / trunk / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / objects / DwgBlockHeader.java @ 9927
History | View | Annotate | Download (7.88 KB)
1 |
/* jdwglib. Java Library for reading Dwg files.
|
---|---|
2 |
*
|
3 |
* Author: Jose Morell Rama (jose.morell@gmail.com).
|
4 |
* Port from the Pythoncad Dwg library by Art Haas.
|
5 |
*
|
6 |
* Copyright (C) 2005 Jose Morell, IVER TI S.A. 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 |
* Jose Morell (jose.morell@gmail.com)
|
25 |
*
|
26 |
* or
|
27 |
*
|
28 |
* IVER TI S.A.
|
29 |
* C/Salamanca, 50
|
30 |
* 46005 Valencia
|
31 |
* Spain
|
32 |
* +34 963163400
|
33 |
* dac@iver.es
|
34 |
*/
|
35 |
package com.iver.cit.jdwglib.dwg.objects; |
36 |
|
37 |
import java.util.ArrayList; |
38 |
import java.util.Vector; |
39 |
|
40 |
import com.iver.cit.jdwglib.dwg.DwgObject; |
41 |
import com.iver.cit.jdwglib.dwg.DwgUtil; |
42 |
import com.iver.cit.jdwglib.dwg.IDwg3DTestable; |
43 |
|
44 |
/**
|
45 |
* The DwgBlockHeader class represents a DWG Block header
|
46 |
*
|
47 |
* @author jmorell
|
48 |
*/
|
49 |
public class DwgBlockHeader extends DwgObject implements IDwg3DTestable { |
50 |
private String name; |
51 |
private boolean flag64; |
52 |
private int xRefPlus; |
53 |
private boolean xdep; |
54 |
private boolean anonymous; |
55 |
private boolean hasAttrs; |
56 |
private boolean blkIsXRef; |
57 |
private boolean xRefOverLaid; |
58 |
private boolean loaded; |
59 |
private double[] basePoint; |
60 |
private String xRefPName; |
61 |
private String blockDescription; |
62 |
private int previewData; |
63 |
private int blockControlHandle; |
64 |
private int nullHandle; |
65 |
private int blockEntityHandle; |
66 |
private int firstEntityHandle; |
67 |
private int lastEntityHandle; |
68 |
private int endBlkEntityHandle; |
69 |
private Vector insertHandles; |
70 |
private int layoutHandle; |
71 |
private Vector objects; |
72 |
|
73 |
/**
|
74 |
* Create new DwgBlockHeader object
|
75 |
*/
|
76 |
public DwgBlockHeader(int index) { |
77 |
super(index);
|
78 |
objects = new Vector(); |
79 |
} |
80 |
|
81 |
/**
|
82 |
* @return Returns the basePoint.
|
83 |
*/
|
84 |
public double[] getBasePoint() { |
85 |
return basePoint;
|
86 |
} |
87 |
/**
|
88 |
* @param basePoint The basePoint to set.
|
89 |
*/
|
90 |
public void setBasePoint(double[] basePoint) { |
91 |
this.basePoint = basePoint;
|
92 |
} |
93 |
/**
|
94 |
* @return Returns the firstEntityHandle.
|
95 |
*/
|
96 |
public int getFirstEntityHandle() { |
97 |
return firstEntityHandle;
|
98 |
} |
99 |
/**
|
100 |
* @param firstEntityHandle The firstEntityHandle to set.
|
101 |
*/
|
102 |
public void setFirstEntityHandle(int firstEntityHandle) { |
103 |
this.firstEntityHandle = firstEntityHandle;
|
104 |
} |
105 |
/**
|
106 |
* @return Returns the lastEntityHandle.
|
107 |
*/
|
108 |
public int getLastEntityHandle() { |
109 |
return lastEntityHandle;
|
110 |
} |
111 |
/**
|
112 |
* @param lastEntityHandle The lastEntityHandle to set.
|
113 |
*/
|
114 |
public void setLastEntityHandle(int lastEntityHandle) { |
115 |
this.lastEntityHandle = lastEntityHandle;
|
116 |
} |
117 |
/**
|
118 |
* @return Returns the name.
|
119 |
*/
|
120 |
public String getName() { |
121 |
return name;
|
122 |
} |
123 |
/**
|
124 |
* @param name The name to set.
|
125 |
*/
|
126 |
public void setName(String name) { |
127 |
this.name = name;
|
128 |
} |
129 |
/**
|
130 |
* @return Returns the blockEntityHandle.
|
131 |
*/
|
132 |
public int getBlockEntityHandle() { |
133 |
return blockEntityHandle;
|
134 |
} |
135 |
/**
|
136 |
* @param blockEntityHandle The blockEntityHandle to set.
|
137 |
*/
|
138 |
public void setBlockEntityHandle(int blockEntityHandle) { |
139 |
this.blockEntityHandle = blockEntityHandle;
|
140 |
} |
141 |
/**
|
142 |
* @return Returns the anonymous.
|
143 |
*/
|
144 |
public boolean isAnonymous() { |
145 |
return anonymous;
|
146 |
} |
147 |
/**
|
148 |
* @param anonymous The anonymous to set.
|
149 |
*/
|
150 |
public void setAnonymous(boolean anonymous) { |
151 |
this.anonymous = anonymous;
|
152 |
} |
153 |
/**
|
154 |
* @return Returns the blkIsXRef.
|
155 |
*/
|
156 |
public boolean isBlkIsXRef() { |
157 |
return blkIsXRef;
|
158 |
} |
159 |
/**
|
160 |
* @param blkIsXRef The blkIsXRef to set.
|
161 |
*/
|
162 |
public void setBlkIsXRef(boolean blkIsXRef) { |
163 |
this.blkIsXRef = blkIsXRef;
|
164 |
} |
165 |
/**
|
166 |
* @return Returns the blockControlHandle.
|
167 |
*/
|
168 |
public int getBlockControlHandle() { |
169 |
return blockControlHandle;
|
170 |
} |
171 |
/**
|
172 |
* @param blockControlHandle The blockControlHandle to set.
|
173 |
*/
|
174 |
public void setBlockControlHandle(int blockControlHandle) { |
175 |
this.blockControlHandle = blockControlHandle;
|
176 |
} |
177 |
/**
|
178 |
* @return Returns the blockDescription.
|
179 |
*/
|
180 |
public String getBlockDescription() { |
181 |
return blockDescription;
|
182 |
} |
183 |
/**
|
184 |
* @param blockDescription The blockDescription to set.
|
185 |
*/
|
186 |
public void setBlockDescription(String blockDescription) { |
187 |
this.blockDescription = blockDescription;
|
188 |
} |
189 |
/**
|
190 |
* @return Returns the endBlkEntityHandle.
|
191 |
*/
|
192 |
public int getEndBlkEntityHandle() { |
193 |
return endBlkEntityHandle;
|
194 |
} |
195 |
/**
|
196 |
* @param endBlkEntityHandle The endBlkEntityHandle to set.
|
197 |
*/
|
198 |
public void setEndBlkEntityHandle(int endBlkEntityHandle) { |
199 |
this.endBlkEntityHandle = endBlkEntityHandle;
|
200 |
} |
201 |
/**
|
202 |
* @return Returns the flag64.
|
203 |
*/
|
204 |
public boolean isFlag64() { |
205 |
return flag64;
|
206 |
} |
207 |
/**
|
208 |
* @param flag64 The flag64 to set.
|
209 |
*/
|
210 |
public void setFlag64(boolean flag64) { |
211 |
this.flag64 = flag64;
|
212 |
} |
213 |
/**
|
214 |
* @return Returns the hasAttrs.
|
215 |
*/
|
216 |
public boolean isHasAttrs() { |
217 |
return hasAttrs;
|
218 |
} |
219 |
/**
|
220 |
* @param hasAttrs The hasAttrs to set.
|
221 |
*/
|
222 |
public void setHasAttrs(boolean hasAttrs) { |
223 |
this.hasAttrs = hasAttrs;
|
224 |
} |
225 |
/**
|
226 |
* @return Returns the insertHandles.
|
227 |
*/
|
228 |
public Vector getInsertHandles() { |
229 |
return insertHandles;
|
230 |
} |
231 |
/**
|
232 |
* @param insertHandles The insertHandles to set.
|
233 |
*/
|
234 |
public void setInsertHandles(Vector insertHandles) { |
235 |
this.insertHandles = insertHandles;
|
236 |
} |
237 |
/**
|
238 |
* @return Returns the layoutHandle.
|
239 |
*/
|
240 |
public int getLayoutHandle() { |
241 |
return layoutHandle;
|
242 |
} |
243 |
/**
|
244 |
* @param layoutHandle The layoutHandle to set.
|
245 |
*/
|
246 |
public void setLayoutHandle(int layoutHandle) { |
247 |
this.layoutHandle = layoutHandle;
|
248 |
} |
249 |
/**
|
250 |
* @return Returns the loaded.
|
251 |
*/
|
252 |
public boolean isLoaded() { |
253 |
return loaded;
|
254 |
} |
255 |
/**
|
256 |
* @param loaded The loaded to set.
|
257 |
*/
|
258 |
public void setLoaded(boolean loaded) { |
259 |
this.loaded = loaded;
|
260 |
} |
261 |
/**
|
262 |
* @return Returns the nullHandle.
|
263 |
*/
|
264 |
public int getNullHandle() { |
265 |
return nullHandle;
|
266 |
} |
267 |
/**
|
268 |
* @param nullHandle The nullHandle to set.
|
269 |
*/
|
270 |
public void setNullHandle(int nullHandle) { |
271 |
this.nullHandle = nullHandle;
|
272 |
} |
273 |
/**
|
274 |
* @return Returns the previewData.
|
275 |
*/
|
276 |
public int getPreviewData() { |
277 |
return previewData;
|
278 |
} |
279 |
/**
|
280 |
* @param previewData The previewData to set.
|
281 |
*/
|
282 |
public void setPreviewData(int previewData) { |
283 |
this.previewData = previewData;
|
284 |
} |
285 |
/**
|
286 |
* @return Returns the xdep.
|
287 |
*/
|
288 |
public boolean isXdep() { |
289 |
return xdep;
|
290 |
} |
291 |
/**
|
292 |
* @param xdep The xdep to set.
|
293 |
*/
|
294 |
public void setXdep(boolean xdep) { |
295 |
this.xdep = xdep;
|
296 |
} |
297 |
/**
|
298 |
* @return Returns the xRefOverLaid.
|
299 |
*/
|
300 |
public boolean isXRefOverLaid() { |
301 |
return xRefOverLaid;
|
302 |
} |
303 |
/**
|
304 |
* @param refOverLaid The xRefOverLaid to set.
|
305 |
*/
|
306 |
public void setXRefOverLaid(boolean refOverLaid) { |
307 |
xRefOverLaid = refOverLaid; |
308 |
} |
309 |
/**
|
310 |
* @return Returns the xRefPlus.
|
311 |
*/
|
312 |
public int getXRefPlus() { |
313 |
return xRefPlus;
|
314 |
} |
315 |
/**
|
316 |
* @param refPlus The xRefPlus to set.
|
317 |
*/
|
318 |
public void setXRefPlus(int refPlus) { |
319 |
xRefPlus = refPlus; |
320 |
} |
321 |
/**
|
322 |
* @return Returns the xRefPName.
|
323 |
*/
|
324 |
public String getXRefPName() { |
325 |
return xRefPName;
|
326 |
} |
327 |
/**
|
328 |
* @param refPName The xRefPName to set.
|
329 |
*/
|
330 |
public void setXRefPName(String refPName) { |
331 |
xRefPName = refPName; |
332 |
} |
333 |
/**
|
334 |
* @return Returns the objects.
|
335 |
*/
|
336 |
public Vector getObjects() { |
337 |
return objects;
|
338 |
} |
339 |
/**
|
340 |
* @param objects The objects to set.
|
341 |
*/
|
342 |
public void setObjects(Vector objects) { |
343 |
this.objects = objects;
|
344 |
} |
345 |
/**
|
346 |
* Add a DWG object to the blockObjects vector
|
347 |
*
|
348 |
* @param object DWG object
|
349 |
*/
|
350 |
public void addObject(DwgObject object) { |
351 |
this.objects.add(object);
|
352 |
} |
353 |
/* (non-Javadoc)
|
354 |
* @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
|
355 |
*/
|
356 |
public boolean has3DData() { |
357 |
return (getBasePoint()[2] != 0.0); |
358 |
} |
359 |
public double getZ() { |
360 |
return getBasePoint()[2]; |
361 |
} |
362 |
} |