1 /*
2 * Copyright 2006 Sony Computer Entertainment Inc.
3 *
4 * Licensed under the MIT Open Source License, for details please see license.txt or the website
5 * http://www.opensource.org/licenses/mit-license.php
6 *
7 */
8 
9 #ifndef __dom141Geometry_h__
10 #define __dom141Geometry_h__
11 
12 #include <dae/daeDocument.h>
13 #include <1.4/dom/domTypes.h>
14 #include <1.4/dom/domElements.h>
15 
16 #include <1.4/dom/domAsset.h>
17 #include <1.4/dom/domConvex_mesh.h>
18 #include <1.4/dom/domMesh.h>
19 #include <1.4/dom/domSpline.h>
20 #include <1.4/dom/domExtra.h>
21 
22 class DAE;
23 namespace ColladaDOM141 {
24 
25 /**
26  * Geometry describes the visual shape and appearance of an object in the
27  * scene. The geometry element categorizes the declaration of geometric information.
28  * Geometry is a  branch of mathematics that deals with the measurement, properties,
29  * and relationships of  points, lines, angles, surfaces, and solids.
30  */
31 class domGeometry : public daeElement
32 {
33 public:
getElementType()34 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::GEOMETRY; }
ID()35 	static daeInt ID() { return 613; }
typeID()36 	virtual daeInt typeID() const { return ID(); }
37 protected:  // Attributes
38 /**
39  *  The id attribute is a text string containing the unique identifier of
40  * this element.  This value must be unique within the instance document.
41  * Optional attribute.
42  */
43 	xsID attrId;
44 /**
45  *  The name attribute is the text string name of this element. Optional attribute.
46  */
47 	xsNCName attrName;
48 
49 protected:  // Elements
50 /**
51  *  The geometry element may contain an asset element.  @see domAsset
52  */
53 	domAssetRef elemAsset;
54 /**
55  *  The geometry element may contain only one mesh or convex_mesh.  @see domConvex_mesh
56  */
57 	domConvex_meshRef elemConvex_mesh;
58 /**
59  *  The geometry element may contain only one mesh or convex_mesh.  @see domMesh
60  */
61 	domMeshRef elemMesh;
62 	domSplineRef elemSpline;
63 /**
64  *  The extra element may appear any number of times.  @see domExtra
65  */
66 	domExtra_Array elemExtra_array;
67 	/**
68 	 * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
69 	 */
70 	daeElementRefArray _contents;
71 	/**
72 	 * Used to preserve order in elements that have a complex content model.
73 	 */
74 	daeUIntArray       _contentsOrder;
75 
76 	/**
77 	 * Used to store information needed for some content model objects.
78 	 */
79 	daeTArray< daeCharArray * > _CMData;
80 
81 
82 public:	//Accessors and Mutators
83 	/**
84 	 * Gets the id attribute.
85 	 * @return Returns a xsID of the id attribute.
86 	 */
getId()87 	xsID getId() const { return attrId; }
88 	/**
89 	 * Sets the id attribute.
90 	 * @param atId The new value for the id attribute.
91 	 */
setId(xsID atId)92 	void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
93 		if( _document != NULL ) _document->changeElementID( this, attrId );
94 	}
95 
96 	/**
97 	 * Gets the name attribute.
98 	 * @return Returns a xsNCName of the name attribute.
99 	 */
getName()100 	xsNCName getName() const { return attrName; }
101 	/**
102 	 * Sets the name attribute.
103 	 * @param atName The new value for the name attribute.
104 	 */
setName(xsNCName atName)105 	void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
106 
107 	/**
108 	 * Gets the asset element.
109 	 * @return a daeSmartRef to the asset element.
110 	 */
getAsset()111 	const domAssetRef getAsset() const { return elemAsset; }
112 	/**
113 	 * Gets the convex_mesh element.
114 	 * @return a daeSmartRef to the convex_mesh element.
115 	 */
getConvex_mesh()116 	const domConvex_meshRef getConvex_mesh() const { return elemConvex_mesh; }
117 	/**
118 	 * Gets the mesh element.
119 	 * @return a daeSmartRef to the mesh element.
120 	 */
getMesh()121 	const domMeshRef getMesh() const { return elemMesh; }
122 	/**
123 	 * Gets the spline element.
124 	 * @return a daeSmartRef to the spline element.
125 	 */
getSpline()126 	const domSplineRef getSpline() const { return elemSpline; }
127 	/**
128 	 * Gets the extra element array.
129 	 * @return Returns a reference to the array of extra elements.
130 	 */
getExtra_array()131 	domExtra_Array &getExtra_array() { return elemExtra_array; }
132 	/**
133 	 * Gets the extra element array.
134 	 * @return Returns a constant reference to the array of extra elements.
135 	 */
getExtra_array()136 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
137 	/**
138 	 * Gets the _contents array.
139 	 * @return Returns a reference to the _contents element array.
140 	 */
getContents()141 	daeElementRefArray &getContents() { return _contents; }
142 	/**
143 	 * Gets the _contents array.
144 	 * @return Returns a constant reference to the _contents element array.
145 	 */
getContents()146 	const daeElementRefArray &getContents() const { return _contents; }
147 
148 protected:
149 	/**
150 	 * Constructor
151 	 */
domGeometry(DAE & dae)152 	domGeometry(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemConvex_mesh(), elemMesh(), elemSpline(), elemExtra_array() {}
153 	/**
154 	 * Destructor
155 	 */
~domGeometry()156 	virtual ~domGeometry() { daeElement::deleteCMDataArray(_CMData); }
157 	/**
158 	 * Overloaded assignment operator
159 	 */
160 	virtual domGeometry &operator=( const domGeometry &cpy ) { (void)cpy; return *this; }
161 
162 public: // STATIC METHODS
163 	/**
164 	 * Creates an instance of this class and returns a daeElementRef referencing it.
165 	 * @return a daeElementRef referencing an instance of this object.
166 	 */
167 	static DLLSPEC daeElementRef create(DAE& dae);
168 	/**
169 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
170 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
171 	 * @return A daeMetaElement describing this COLLADA element.
172 	 */
173 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
174 };
175 
176 
177 } // ColladaDOM141
178 #endif
179