Revision 10539 branches/v10/libraries/libDwg/src/com/iver/cit/jdwglib/dwg/objects/DwgVertex3D.java

View differences:

DwgVertex3D.java
34 34
 */
35 35
package com.iver.cit.jdwglib.dwg.objects;
36 36

  
37
import java.util.ArrayList;
38

  
39 37
import com.iver.cit.jdwglib.dwg.DwgObject;
40
import com.iver.cit.jdwglib.dwg.DwgUtil;
41 38

  
42 39
/**
43 40
 * The DwgVertex3D class represents a DWG Vertex3D
......
45 42
 * @author jmorell
46 43
 */
47 44
public class DwgVertex3D extends DwgObject {
45
	public DwgVertex3D(int index) {
46
		super(index);
47
		// TODO Auto-generated constructor stub
48
	}
48 49
	private int flags;
49 50
	private double[] point;
50 51
	
51 52
	/**
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
		ArrayList v = DwgUtil.getRawChar(data, bitPos);
63
		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 53
	 * @return Returns the flags.
81 54
	 */
82 55
	public int getFlags() {
......
100 73
	public void setPoint(double[] point) {
101 74
		this.point = point;
102 75
	}
76
	public Object clone(){
77
		DwgVertex3D obj = new DwgVertex3D(index);
78
		this.fill(obj);
79
		return obj;
80
	}
81
	
82
	protected void fill(DwgObject obj){
83
		super.fill(obj);
84
		DwgVertex3D myObj = (DwgVertex3D)obj;
85

  
86
		myObj.setFlags(flags);
87
		myObj.setPoint(point);
88
	}
89

  
103 90
}

Also available in: Unified diff