29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/DrawingElement.hpp" 36 #include "SUAPI-CppWrapper/model/Layer.hpp" 37 #include "SUAPI-CppWrapper/model/Material.hpp" 38 #include "SUAPI-CppWrapper/Geometry.hpp" 44 Entity(SUDrawingElementToEntity(drawing_element), attached)
49 Entity(other, SUDrawingElementToEntity(element_ref))
68 return SUDrawingElementFromEntity(
m_entity);
72 DrawingElement::operator SUDrawingElementRef()
const {
79 throw std::logic_error(
"CW::DrawingElement::bounds(): DrawingElement is null");
81 SUBoundingBox3D box = SU_INVALID;
82 SUResult res = SUDrawingElementGetBoundingBox(this->
ref(), &box);
83 assert(res == SU_ERROR_NONE); _unused(res);
89 bool success = this->casts_shadows(element.casts_shadows());
92 success = this->hidden(element.hidden());
95 success = this->receive_shadows(element.receive_shadows());
98 Layer elem_layer = element.layer();
99 success = this->layer(elem_layer);
102 success = this->material(element.material());
110 bool DrawingElement::casts_shadows()
const {
112 throw std::logic_error(
"CW::DrawingElement::casts_shadows(): DrawingElement is null");
114 bool cast_shadows_flag;
115 SUResult res = SUDrawingElementGetCastsShadows(this->
ref(), &cast_shadows_flag);
116 assert(res == SU_ERROR_NONE); _unused(res);
117 return cast_shadows_flag;
121 bool DrawingElement::casts_shadows(
bool casts_shadows) {
123 throw std::logic_error(
"CW::DrawingElement::casts_shadows(): DrawingElement is null");
125 SUResult res = SUDrawingElementSetCastsShadows(this->
ref(), casts_shadows);
126 if (res == SU_ERROR_NONE) {
133 bool DrawingElement::hidden()
const {
135 throw std::logic_error(
"CW::DrawingElement::hidden(): DrawingElement is null");
138 SUDrawingElementGetHidden(this->
ref(), &hide_flag);
143 bool DrawingElement::hidden(
bool hidden) {
145 throw std::logic_error(
"CW::DrawingElement::hidden(): DrawingElement is null");
147 SUResult res = SUDrawingElementSetHidden(this->
ref(), hidden);
148 if (res == SU_ERROR_NONE) {
155 Layer DrawingElement::layer()
const {
157 throw std::logic_error(
"CW::DrawingElement::layer(): DrawingElement is null");
159 SULayerRef layer_ref = SU_INVALID;
160 SUResult res = SUDrawingElementGetLayer(this->
ref(), &layer_ref);
161 if (res == SU_ERROR_NULL_POINTER_OUTPUT || res == SU_ERROR_NO_DATA) {
164 assert(res == SU_ERROR_NONE); _unused(res);
165 return Layer(layer_ref,
true);
169 bool DrawingElement::layer(
Layer& layer){
171 throw std::logic_error(
"CW::DrawingElement::layer(): DrawingElement is null");
173 SUResult res = SUDrawingElementSetLayer(this->
ref(), layer);
174 if (res == SU_ERROR_NONE) {
182 Material DrawingElement::material()
const {
184 throw std::logic_error(
"CW::DrawingElement::material(): DrawingElement is null");
186 SUMaterialRef material_ref = SU_INVALID;
187 SUResult res = SUDrawingElementGetMaterial(this->
ref(), &material_ref);
188 if (res == SU_ERROR_NO_DATA || res == SU_ERROR_NULL_POINTER_OUTPUT) {
191 assert(res == SU_ERROR_NONE); _unused(res);
192 return Material(material_ref,
true);
196 bool DrawingElement::material(
const Material& material) {
198 throw std::logic_error(
"CW::DrawingElement::material(): DrawingElement is null");
200 SUResult res = SUDrawingElementSetMaterial(this->
ref(), material);
201 if (res == SU_ERROR_NONE) {
208 bool DrawingElement::receive_shadows()
const {
210 throw std::logic_error(
"CW::DrawingElement::receive_shadows(): DrawingElement is null");
212 bool receives_shadows_flag;
213 SUResult res = SUDrawingElementGetReceivesShadows(this->
ref(), &receives_shadows_flag);
214 assert (res == SU_ERROR_NONE); _unused(res);
215 return receives_shadows_flag;
219 bool DrawingElement::receive_shadows(
bool receives_shadows_flag) {
221 throw std::logic_error(
"CW::DrawingElement::receive_shadows(): DrawingElement is null");
223 SUResult res = SUDrawingElementSetReceivesShadows(this->
ref(), receives_shadows_flag);
224 if (res == SU_ERROR_NONE) {
bool m_attached
Indicates whether the Entity has been attached to a model.
bool attached() const
Returns true if the entity is attached to another object.
bool copy_properties_from(const DrawingElement &element)
DrawingElement & operator=(const DrawingElement &other)
SUEntityRef m_entity
The C SUEntityRef that this class wraps.
SUDrawingElementRef ref() const
Entity & operator=(const Entity &other)
Copy assignment operator.