SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
DrawingElement.hpp
1 //
2 // DrawingElement.hpp
3 //
4 // Sketchup C++ Wrapper for C API
5 // MIT License
6 //
7 // Copyright (c) 2017 Tom Kaneko
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 
16 // The above copyright notice and this permission notice shall be included in all
17 // copies or substantial portions of the Software.
18 
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // SOFTWARE.
26 //
27 
28 #ifndef DrawingElement_hpp
29 #define DrawingElement_hpp
30 
31 #include <stdio.h>
32 
33 #include <SketchUpAPI/model/drawing_element.h>
34 
35 #include "SUAPI-CppWrapper/model/Entity.hpp"
36 namespace CW {
37 
38 // Forward declarations:
39 class Layer;
40 class Material;
41 class BoundingBox3D;
42 
43 /*
44 * Drawing Element wrapper
45 */
46 class DrawingElement :public Entity {
47  public:
48  /**
49  * Most common constructor.
50  * @param drawing_element - SUDrawingElementRef object to assign to the object.
51  * @param attached - flag indicating if the entity should be treated as attached to another object @see CW::Entity
52  */
53  DrawingElement(SUDrawingElementRef drawing_element, bool attached = true);
54 
55  /**
56  * Copy constructor with an optional parameter for the entity reference. SUDrawingElementRef objects cannot be created from this class, so the Ref object must be passed to this constructor from a derived class object.
57  * @param other - DrawingElement object from which properties will be copied.
58  * @param element_ref - SUDrawingElementRef object to assign to the copied object.
59  */
60  DrawingElement(const DrawingElement& other, SUDrawingElementRef element_ref = SU_INVALID);
61 
62  /**
63  * Constructor representing a null object.
64  */
66 
67  /** Copy assignment operator */
69 
70  /** Cast to native objects */
71  SUDrawingElementRef ref() const;
72  operator SUDrawingElementRef() const;
73  operator SUDrawingElementRef*();
74 
75  /**
76  * Returns the bounding box of the drawing element.
77  */
79 
80  /**
81  * Copies all DrawingElement properties from the given element to this one.
82  * @param element DrawingElement object from which to get properties
83  * @return bool true for success, or false for a failure.
84  */
85  bool copy_properties_from(const DrawingElement& element);
86 
87  /*
88  * Determine if the Drawingelement is casting shadows.
89  * @return true if the Drawingelement is casting shadows, false if not.
90  */
91  bool casts_shadows() const;
92 
93  /*
94  * Sets the Drawingelement to cast shadows.
95  * @param bool settign for casting shadows.
96  * @return true for successful, false for unsuccessful.
97  */
98  bool casts_shadows(bool casts_shadows);
99 
100  /*
101  * Determine if the Drawingelement is hidden.
102  * @return true if the Drawingelement is hidden.
103  */
104  bool hidden() const;
105 
106  /*
107  * Set the hidden status for an element.
108  * @param bool true if you want to hide the element, false if you do not want to hide the element.
109  * @return true for successful, false for unsuccessful.
110  */
111  bool hidden(bool hidden);
112 
113  /*
114  * Retrieves the Layer object of the drawing element.
115  */
116  Layer layer() const;
117 
118  /*
119  * Sets the Layer for the drawing element
120  * @param Layer object
121  */
122  bool layer(Layer& layer);
123 
124  /*
125  * Retrieves the Material object of the drawing element.
126  * @return Material object assigned to the drawing element.
127  */
128  Material material() const;
129 
130  /*
131  * Sets the Material of the drawing element.
132  * @param Material object to assign to the drawing element.
133  * @return Material object assigned to the drawing element.
134  */
135  bool material(const Material& material);
136 
137  /*
138  * Determine if the Drawingelement receives shadows.
139  * @return true if the Drawingelement receives shadows, false if not.
140  */
141  bool receive_shadows() const;
142 
143  /*
144  * Set the Drawingelement to receive shadows.
145  * @param bool true if you want the element to receive shadows, false if you not.
146  * @return true for successful, false for unsuccessful.
147  */
148  bool receive_shadows(bool receive_shadows);
149 };
150 
151 } /* namespace CW */
152 #endif /* DrawingElement_hpp */
bool attached() const
Returns true if the entity is attached to another object.
Definition: Entity.cpp:100
BoundingBox3D bounds()
bool copy_properties_from(const DrawingElement &element)
DrawingElement & operator=(const DrawingElement &other)
Definition: Color.hpp:34
SUDrawingElementRef ref() const