SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Axes.hpp
1 //
2 // Axes.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 Axes_hpp
29 #define Axes_hpp
30 
31 #include <stdio.h>
32 #include <vector>
33 #include <string>
34 
35 #include <SketchUpAPI/model/axes.h>
36 
37 #include "SUAPI-CppWrapper/model/DrawingElement.hpp"
38 #include "SUAPI-CppWrapper/Geometry.hpp"
39 #include "SUAPI-CppWrapper/Transformation.hpp"
40 
41 namespace CW {
42 
43 /*
44 * Entity object wrapper
45 */
46 class Axes :public DrawingElement {
47  private:
48  /** Returns an empty SUAxesRef object using SUAxesCreate(). **/
49  static SUAxesRef create_axes();
50 
51  /** Returns a custom SUAxesRef object using SUAxesCreateCustom(). **/
52  static SUAxesRef create_custom_axes(const SUPoint3D& origin, const SUVector3D& xaxis, const SUVector3D& yaxis, const SUVector3D& zaxis);
53 
54  /** Returns a copied SUAxesRef object from the given Axes object **/
55  static SUAxesRef copy_reference(const Axes& other);
56 
57  public:
58  /**
59  * Constructor for null object.
60  */
61  Axes();
62 
63  /**
64  * Standard constructor from existing SUAxesRef object.
65  * @param axes - existing SUAxesRef object to wrap.
66  * @param attached - true if the SUAxesRef has been attached to the model. Required for object release purposes.
67  */
68  Axes(SUAxesRef axes, bool attached = true);
69 
70  /**
71  * Constructs Axes object from the given origin, x, y and z axes. The vectors passed to the constructor must be orthogonal, otherwise, a null object will be created.
72  * @param origin - origin of the Axes.
73  * @param x_axes - vector representing the x axis.
74  * @param y_axes - vector representing the y axis.
75  * @param z_axes - vector representing the z axis.
76  */
77  Axes(Point3D origin, Vector3D x_axis, Vector3D y_axis, Vector3D z_axis);
78 
79  /** Copy constructor */
80  Axes(const Axes& other);
81 
82  /** Destructor */
83  ~Axes();
84 
85  /**
86  * Returns the SU native reference
87  */
88  SUAxesRef ref() const;
89 
90  /** Copy assignment operator override */
91  Axes& operator=(const Axes& other);
92 
93  /**
94  * Operator overload signifies if this a valid object.
95  */
96  bool operator!() const;
97 
98  /**
99  * Return the vectors representing the axes.
100  */
101  Vector3D x_axis() const;
102  Vector3D y_axis() const;
103  Vector3D z_axis() const;
104 
105  /**
106  * Return the origin of the axes as a Point3D object.
107  */
108  Point3D origin() const;
109 
110  /**
111  * Return the transformation object of the axes.
112  */
114 };
115 
116 } /* namespace CW */
117 #endif /* Axes_hpp */
~Axes()
Definition: Axes.cpp:94
Axes & operator=(const Axes &other)
Definition: Axes.cpp:109
bool attached() const
Returns true if the entity is attached to another object.
Definition: Entity.cpp:100
Point3D origin() const
Definition: Axes.cpp:167
Transformation transformation() const
Definition: Axes.cpp:178
Axes()
Definition: Axes.cpp:74
Vector3D x_axis() const
Definition: Axes.cpp:136
Definition: Color.hpp:34
SUAxesRef ref() const
Definition: Axes.cpp:132
bool operator!() const
Definition: Axes.cpp:122