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 class NDEVR_DESIGN_API DrillHole : public StationModel
41 {
42 public:
43 DrillHole()
44 : StationModel()
45 {}
46 DrillHole(const Model& model, const Vector<3, fltp08>& location)
47 : StationModel(model)
48 {
49 /*if (getModelProperty<String>(Model::e_type) != "drill_hole")
50 {
51 setModelProperty(Model::e_type, "drill_hole");
52 setProperty<String>(DesignObject::e_icon, "borehole");
53 setCircular(true);
54 setAxesLabelsVisible(false);
55 }*/
56 setLocation(location);
57 }
58 DrillHole(const Model& model)
59 : StationModel(model)
60 {
61 if (!hasMetaData("drill_hole"))
62 {
63 setMetaData("drill_hole", true);
64 setCircular(true);
65 }
66 }
67
68
69 Model drillRow() const
70 {
71 Model model = getParent();
72 while (model.isValid())
73 {
74 if (model.isOfType("drill_pattern_row"))
75 return model;
76 model = model.getParent();
77 }
78 return Model();//return invalid
79 }
80 Model drillPattern() const
81 {
82 Model model = getParent();
83 while (model.isValid())
84 {
85 if (model.isOfType("drill_pattern"))
86 return model;
87 model = model.getParent();
88 }
89 return Model();//return invalid
90 }
91 void addHolePath(const String& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, const Buffer<Time>& times, fltp08 radius)
92 {
93
94 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
95 Model hole_data = createChild();
96 Deployment deployment(hole_data);
97 deployment.addSegments(locations, times);
98 deployment.setProperty(DesignObject::e_name, deployment_name);
99 if(!isNaN(radius))
100 deployment.setUseTube(Geometry::ThicknessMode::e_circle, radius);
101 else
102 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, 1.0);
103
104 }
105 void addHolePath(const String& deployment_name, const Buffer<Vertex<3, fltp08>>& locations, fltp08 radius)
106 {
107 lib_assert(getChildrenByName(deployment_name).size() == 0, "Unexpected duplicate path name");
108 Model hole_data = createChild();
109 Deployment deployment(hole_data);
110 deployment.addSegments(locations);
111 deployment.setProperty(DesignObject::e_name, deployment_name);
112 deployment.setUseTube(Geometry::ThicknessMode::e_pixel, radius);
113
114 }
115 void addHolePath(const String& deployment_name, const Buffer<fltp08>& depths, fltp08 radius)
116 {
117 Buffer<Vertex<3, fltp08>> new_data(depths.size());
118 Vertex<3, fltp08> collar_location = getLocation();
119 for (uint04 i = 0; i < depths.size(); i++)
120 {
121 new_data.add(Vertex<3, fltp08>(collar_location[X], collar_location[Y], depths[i]));
122 }
123 addHolePath(deployment_name, new_data, radius);
124 }
125 void setPathVisible(const String& deployment_name, bool visible)
126 {
127 Buffer<Model> children = getChildrenByName(deployment_name);
128 lib_assert(children.size() == 1, "Bad deployment name");
129 if (children.size() != 1)
130 return;
131 children[0].setDesignVisible(visible);
132 }
133
134 void colorBy(const String& property, fltp08 min, fltp08 mid, fltp08 max)
135 {
136 Material mat = getMaterial(PrimitiveProperty::Solid);
137 mat.setUVMode(UVType::e_KD, Material::UVMode::e_scaled_channel);
138 mat.setMaterialProperty(Material::e_extra_property_value_max, min);
139 mat.setMaterialProperty(Material::e_extra_property_value_mid, mid);
140 mat.setMaterialProperty(Material::e_extra_property_value_min, max);
141 mat.setMaterialProperty(Material::e_draw_by_property_channel, property);
142 mat.setProperty(DesignProperty::e_modified_time, Time::SystemTime());
143 }
144 void colorBy(const String& property)
145 {
146 Material mat = getMaterial(PrimitiveProperty::Solid);
147 colorByChannel(mat, property);
148 }
149 };
150}
151#endif
152
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
Definition ACIColor.h:37
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200