root / tags / v1_0_2_Build_899 / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / objects / DwgVertex3D.java @ 10517
History | View | Annotate | Download (2.95 KB)
1 | 2896 | jmorell | /* 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 | 8765 | jjdelcerro | import java.util.ArrayList; |
38 | 2896 | jmorell | |
39 | import com.iver.cit.jdwglib.dwg.DwgObject; |
||
40 | import com.iver.cit.jdwglib.dwg.DwgUtil; |
||
41 | |||
42 | /**
|
||
43 | * The DwgVertex3D class represents a DWG Vertex3D
|
||
44 | *
|
||
45 | * @author jmorell
|
||
46 | */
|
||
47 | public class DwgVertex3D extends DwgObject { |
||
48 | private int flags; |
||
49 | private double[] point; |
||
50 | |||
51 | /**
|
||
52 | * Read a Vertex3D in the DWG format Version 15
|
||
53 | *
|
||
54 | * @param data Array of unsigned bytes obtained from the DWG binary file
|
||
55 | * @param offset The current bit offset where the value begins
|
||
56 | * @throws Exception If an unexpected bit value is found in the DWG file. Occurs
|
||
57 | * when we are looking for LwPolylines.
|
||
58 | */
|
||
59 | public void readDwgVertex3DV15(int[] data, int offset) throws Exception { |
||
60 | int bitPos = offset;
|
||
61 | bitPos = readObjectHeaderV15(data, bitPos); |
||
62 | 8765 | jjdelcerro | ArrayList v = DwgUtil.getRawChar(data, bitPos);
|
63 | 2896 | jmorell | bitPos = ((Integer)v.get(0)).intValue(); |
64 | int flags = ((Integer)v.get(1)).intValue(); |
||
65 | this.flags = flags;
|
||
66 | v = DwgUtil.getBitDouble(data, bitPos); |
||
67 | bitPos = ((Integer)v.get(0)).intValue(); |
||
68 | double x = ((Double)v.get(1)).doubleValue(); |
||
69 | v = DwgUtil.getBitDouble(data, bitPos); |
||
70 | bitPos = ((Integer)v.get(0)).intValue(); |
||
71 | double y = ((Double)v.get(1)).doubleValue(); |
||
72 | v = DwgUtil.getBitDouble(data, bitPos); |
||
73 | bitPos = ((Integer)v.get(0)).intValue(); |
||
74 | double z = ((Double)v.get(1)).doubleValue(); |
||
75 | double[] coord = new double[]{x, y, z}; |
||
76 | point = new double[]{x, y, z}; |
||
77 | bitPos = readObjectTailV15(data, bitPos); |
||
78 | } |
||
79 | /**
|
||
80 | * @return Returns the flags.
|
||
81 | */
|
||
82 | public int getFlags() { |
||
83 | return flags;
|
||
84 | } |
||
85 | /**
|
||
86 | * @param flags The flags to set.
|
||
87 | */
|
||
88 | public void setFlags(int flags) { |
||
89 | this.flags = flags;
|
||
90 | } |
||
91 | /**
|
||
92 | * @return Returns the point.
|
||
93 | */
|
||
94 | public double[] getPoint() { |
||
95 | return point;
|
||
96 | } |
||
97 | /**
|
||
98 | * @param point The point to set.
|
||
99 | */
|
||
100 | public void setPoint(double[] point) { |
||
101 | this.point = point;
|
||
102 | } |
||
103 | } |