API Documentation
Loading...
Searching...
No Matches
DrillHole.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: DrillHole
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/StationModel.h>
34#if NDEVR_DRILL_HOLE
35#include <NDEVR/Deployment.h>
36#include <NDEVR/Material.h>
37#include <NDEVR/Geometry.h>
38namespace NDEVR
39{
40 /**--------------------------------------------------------------------------------------------------
41 \brief A Model which represents a Drilled hole such as ones created at a mining site.
42 **/
43 class NDEVR_DESIGN_API DrillHole : public StationModel
44 {
45 public:
46 DrillHole()
47 : StationModel()
48 {}
49 DrillHole(const Model& model, const Vector<3, fltp08>& location)
50 : StationModel(model)
51 {
52 /*if (getModelProperty<String>(Model::e_type) != "drill_hole")
53 {
54 setModelProperty(Model::e_type, "drill_hole");
55 setProperty<String>(DesignObject::e_icon, "borehole");
56 setCircular(true);
57 setAxesLabelsVisible(false);
58 }*/
59 setLocation(location);
60 }
61 DrillHole(const Model& model)
62 : StationModel(model)
63 {
64 if (!hasMetaData("drill_hole"))
65 {
66 setMetaData("drill_hole", true);
67 setCircular(true);
68 }
69 }
70
71
72 Model drillRow() const
73 {
74 Model model = getParent();
75 while (model.isValid())
76 {
77 if (model.isOfType("drill_pattern_row"))
78 return model;
79 model = model.getParent();
80 }
81 return Model();//return invalid
82 }
83 Model drillPattern() const
84 {
85 Model model = getParent();
86 while (model.isValid())
87 {
88 if (model.isOfType("drill_pattern"))
89 return model;
90 model = model.getParent();
91 }
92 return Model();//return invalid
93 }
94 void addHolePath(const String& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, const Buffer<Time>& times, fltp08 radius)
95 {
96
97 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
98 Model hole_data = createChild();
99 Deployment deployment(hole_data);
100 deployment.addSegments(locations, times);
101 deployment.setProperty(DesignObject::e_name, deployment_name);
102 if(!IsInvalid(radius))
103 deployment.setUseTube(Geometry::ThicknessMode::e_circle, radius);
104 else
105 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, 1.0);
106
107 }
108 void addHolePath(const String& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, fltp08 radius)
109 {
110 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
111 Model hole_data = createChild();
112 Deployment deployment(hole_data);
113 deployment.addSegments(locations);
114 deployment.setProperty(DesignObject::e_name, deployment_name);
115 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, radius);
116
117 }
118 void addHolePath(const String& deployment_name, const Buffer<fltp08>& depths, fltp08 radius)
119 {
120 Buffer<Vertex<3, fltp08>> new_data(depths.size());
121 Vertex<3, fltp08> collar_location = getLocation();
122 for (uint04 i = 0; i < depths.size(); i++)
123 {
124 new_data.add(Vertex<3, fltp08>(collar_location[X], collar_location[Y], depths[i]));
125 }
126 addHolePath(deployment_name, new_data, radius);
127 }
128 void setPathVisible(const String& deployment_name, bool visible)
129 {
130 Buffer<Model> children = getChildrenByName(deployment_name);
131 lib_assert(children.size() == 1, "Bad deployment name");
132 if (children.size() != 1)
133 return;
134 children[0].setDesignVisible(visible);
135 }
136
137 void colorBy(const String& property, fltp08 min, fltp08 mid, fltp08 max)
138 {
139 Material mat = getMaterial(PrimitiveProperty::Solid);
140 mat.setUVMode(UVType::e_KD, Material::UVMode::e_scaled_channel);
141 mat.setMaterialProperty(Material::e_extra_property_value_max, min);
142 mat.setMaterialProperty(Material::e_extra_property_value_mid, mid);
143 mat.setMaterialProperty(Material::e_extra_property_value_min, max);
144 mat.setMaterialProperty(Material::e_draw_by_property_channel, property);
145 mat.setProperty(DesignProperty::e_modified_time, Time::SystemTime());
146 }
147 void colorBy(const String& property)
148 {
149 Material mat = getMaterial(PrimitiveProperty::Solid);
150 colorByChannel(mat, property);
151 }
152 };
153}
154#endif
155
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
#define lib_assert(expression, message)
Definition LibAssert.h:61
Definition ACIColor.h:37
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170