Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Karsten Rink
ogs
Commits
4e56bf56
Commit
4e56bf56
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MGTL] First step of refactorization of GeoMapper::mapData().
parent
bb41eedf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshGeoToolsLib/GeoMapper.cpp
+42
-30
42 additions, 30 deletions
MeshGeoToolsLib/GeoMapper.cpp
MeshGeoToolsLib/GeoMapper.h
+2
-0
2 additions, 0 deletions
MeshGeoToolsLib/GeoMapper.h
with
44 additions
and
30 deletions
MeshGeoToolsLib/GeoMapper.cpp
+
42
−
30
View file @
4e56bf56
...
...
@@ -67,6 +67,13 @@ void GeoMapper::mapOnMesh(const std::string &file_name)
void
GeoMapper
::
mapOnMesh
(
const
MeshLib
::
Mesh
*
mesh
)
{
std
::
vector
<
GeoLib
::
Point
*>
const
*
pnts
(
_geo_objects
.
getPointVec
(
_geo_name
));
if
(
!
pnts
)
{
ERR
(
"Geometry
\"
%s
\"
does not exist."
,
_geo_name
.
c_str
());
return
;
}
bool
const
is_station
(
GeoLib
::
isStation
((
*
pnts
)[
0
]));
if
(
mesh
->
getDimension
()
<
3
)
this
->
_surface_mesh
=
new
MeshLib
::
Mesh
(
*
mesh
);
else
...
...
@@ -82,7 +89,12 @@ void GeoMapper::mapOnMesh(const MeshLib::Mesh* mesh)
MeshLib
::
projectMeshOntoPlane
(
*
_surface_mesh
,
origin
,
normal
);
std
::
vector
<
MeshLib
::
Node
*>
const
&
flat_nodes
(
flat_mesh
->
getNodes
());
_grid
=
new
GeoLib
::
Grid
<
MeshLib
::
Node
>
(
flat_nodes
.
cbegin
(),
flat_nodes
.
cend
());
this
->
mapData
();
if
(
is_station
)
{
mapStationData
();
}
else
{
mapData
();
}
delete
_grid
;
delete
flat_mesh
;
...
...
@@ -99,14 +111,8 @@ void GeoMapper::mapToConstantValue(double value)
std
::
for_each
(
points
->
begin
(),
points
->
end
(),
[
value
](
GeoLib
::
Point
*
pnt
){
(
*
pnt
)[
2
]
=
value
;
});
}
void
GeoMapper
::
mapData
()
void
GeoMapper
::
map
Station
Data
()
{
const
std
::
vector
<
GeoLib
::
Point
*>
*
points
(
this
->
_geo_objects
.
getPointVec
(
this
->
_geo_name
));
GeoLib
::
Station
*
stn_test
=
dynamic_cast
<
GeoLib
::
Station
*>
((
*
points
)[
0
]);
bool
is_borehole
(
false
);
if
(
stn_test
!=
nullptr
&&
static_cast
<
GeoLib
::
StationBorehole
*>
((
*
points
)[
0
])
->
type
()
==
GeoLib
::
Station
::
StationType
::
BOREHOLE
)
is_borehole
=
true
;
double
min_val
(
0
),
max_val
(
0
);
if
(
_surface_mesh
)
{
...
...
@@ -115,34 +121,40 @@ void GeoMapper::mapData()
min_val
=
bounding_box
.
getMinPoint
()[
2
];
max_val
=
bounding_box
.
getMaxPoint
()[
2
];
}
std
::
size_t
nPoints
(
points
->
size
());
if
(
!
is_borehole
)
std
::
vector
<
GeoLib
::
Point
*>
const
*
points
(
_geo_objects
.
getPointVec
(
_geo_name
));
std
::
size_t
nPoints
(
points
->
size
());
for
(
unsigned
j
=
0
;
j
<
nPoints
;
++
j
)
{
for
(
unsigned
j
=
0
;
j
<
nPoints
;
++
j
)
GeoLib
::
Point
*
pnt
((
*
points
)[
j
]);
double
offset
=
(
_grid
)
?
(
getMeshElevation
((
*
pnt
)[
0
],
(
*
pnt
)[
1
],
min_val
,
max_val
)
-
(
*
pnt
)[
2
])
:
getDemElevation
(
*
pnt
);
if
(
!
GeoLib
::
isBorehole
(
pnt
))
continue
;
GeoLib
::
StationBorehole
*
borehole
=
static_cast
<
GeoLib
::
StationBorehole
*>
(
pnt
);
const
std
::
vector
<
GeoLib
::
Point
*>
layers
=
borehole
->
getProfile
();
std
::
size_t
nLayers
=
layers
.
size
();
for
(
unsigned
k
=
0
;
k
<
nLayers
;
++
k
)
{
GeoLib
::
Point
*
pnt
((
*
points
)[
j
]);
(
*
pnt
)[
2
]
=
(
_grid
)
?
this
->
getMeshElevation
((
*
pnt
)[
0
],(
*
pnt
)[
1
],
min_val
,
max_val
)
:
this
->
getDemElevation
(
*
pnt
);
GeoLib
::
Point
*
layer_pnt
=
layers
[
k
];
(
*
layer_pnt
)[
2
]
=
(
*
layer_pnt
)[
2
]
+
offset
;
}
}
else
}
void
GeoMapper
::
mapData
()
{
const
std
::
vector
<
GeoLib
::
Point
*>
*
points
(
this
->
_geo_objects
.
getPointVec
(
this
->
_geo_name
));
for
(
auto
pnt
:
pnts
)
{
for
(
unsigned
j
=
0
;
j
<
nPoints
;
++
j
)
{
GeoLib
::
Point
*
pnt
((
*
points
)[
j
]);
double
offset
=
(
_grid
)
?
(
this
->
getMeshElevation
((
*
pnt
)[
0
],(
*
pnt
)[
1
],
min_val
,
max_val
)
-
(
*
pnt
)[
2
])
:
this
->
getDemElevation
(
*
pnt
);
GeoLib
::
StationBorehole
*
borehole
=
static_cast
<
GeoLib
::
StationBorehole
*>
(
pnt
);
const
std
::
vector
<
GeoLib
::
Point
*>
layers
=
borehole
->
getProfile
();
std
::
size_t
nLayers
=
layers
.
size
();
for
(
unsigned
k
=
0
;
k
<
nLayers
;
++
k
)
{
GeoLib
::
Point
*
layer_pnt
=
layers
[
k
];
(
*
layer_pnt
)[
2
]
=
(
*
layer_pnt
)[
2
]
+
offset
;
}
}
GeoLib
::
Point
*
pnt
((
*
points
)[
j
]);
(
*
pnt
)[
2
]
=
(
_grid
)
?
getMeshElevation
((
*
pnt
)[
0
],(
*
pnt
)[
1
],
min_val
,
max_val
)
:
getDemElevation
(
*
pnt
);
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshGeoToolsLib/GeoMapper.h
+
2
−
0
View file @
4e56bf56
...
...
@@ -70,6 +70,8 @@ public:
void
advancedMapOnMesh
(
const
MeshLib
::
Mesh
*
mesh
,
const
std
::
string
&
new_geo_name
);
private:
/// Mapping stations, boreholes on a raster or mesh.
void
mapStationData
();
/// Manages the mapping geometric data (points, stations, boreholes) on a raster or mesh.
void
mapData
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment