NDEVR
API Documentation
DrillHole.h
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{
46 class NDEVR_DESIGN_API DrillHole : public StationModel
47 {
48 public:
52 DrillHole()
53 : StationModel()
54 {}
60 DrillHole(const Model& model, const Vector<3, fltp08>& location)
61 : StationModel(model)
62 {
63 /*if (get<NDPN::type>() != "drill_hole")
64 {
65 set<NDPN::type>("drill_hole");
66 setProperty<String>(NDPO::icon, "borehole");
67 setCircular(true);
68 setAxesLabelsVisible(false);
69 }*/
70 setLocation(location);
71 }
77 DrillHole(const Model& model)
78 : StationModel(model)
79 {
80 if (!hasMetaData("drill_hole"))
81 {
82 setMetaData("drill_hole", true);
83 setCircular(true);
84 }
85 }
86
87
92 Model drillRow() const
93 {
94 Model model = getParent();
95 while (model.isValid())
96 {
97 if (model.is<NDPN::type>("drill_pattern_row"))
98 return model;
99 model = model.getParent();
100 }
101 return Model();//return invalid
102 }
107 Model drillPattern() const
108 {
109 Model model = getParent();
110 while (model.isValid())
111 {
112 if (model.is<NDPN::type>("drill_pattern"))
113 return model;
114 model = model.getParent();
115 }
116 return Model();//return invalid
117 }
128 void addHolePath(const StringView& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, const Buffer<Time>& times, fltp08 radius)
129 {
130
131 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
132 Model hole_data = createChild();
133 Deployment deployment(hole_data);
134 deployment.addSegments(locations, times);
135 deployment.set<NDPO::name>(deployment_name);
136 if(IsValid(radius))
137 deployment.setUseTube(Geometry::ThicknessMode::e_circle, radius);
138 else
139 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, 1.0);
140
141 }
148 void addHolePath(const StringView& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, fltp08 radius)
149 {
150 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
151 Model hole_data = createChild();
152 Deployment deployment(hole_data);
153 deployment.addSegments(locations);
154 deployment.set<NDPO::name>(deployment_name);
155 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, radius);
156
157 }
165 void addHolePath(const StringView& deployment_name, const Buffer<fltp08>& depths, fltp08 radius)
166 {
167 Buffer<Vertex<3, fltp08>> new_data(depths.size());
168 Vertex<3, fltp08> collar_location = getLocation();
169 for (uint04 i = 0; i < depths.size(); i++)
170 {
171 new_data.add(Vertex<3, fltp08>(collar_location[X], collar_location[Y], depths[i]));
172 }
173 addHolePath(deployment_name, new_data, radius);
174 }
180 void setPathVisible(const StringView& deployment_name, bool visible)
181 {
182 Buffer<Model> children = getChildrenByName(deployment_name);
183 lib_assert(children.size() == 1, "Bad deployment name");
184 if (children.size() != 1)
185 return;
186 children[0].set<NDPO::spacial_visible>(visible);
187 }
188
197 void colorBy(const StringView& property, fltp08 min, fltp08 mid, fltp08 max)
198 {
199 Material mat = getMaterial();
200 mat.setUVMode(UVType::e_KD, Material::UVMode::e_scaled_channel);
201 mat.set<NDPM::extra_property_value_max>(min);
202 mat.set<NDPM::extra_property_value_mid>(mid);
203 mat.set<NDPM::extra_property_value_min>(max);
204 mat.set<NDPM::draw_by_property_channel>(property);
205 mat.updateModifiedTime();
206 }
212 void colorBy(const StringView& property)
213 {
214 Material mat = getMaterial();
215 colorByChannel(mat, property);
216 }
217 };
218}
219#endif
220
The primary namespace for the NDEVR SDK.