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
Özgür Ozan Sen
ogs
Commits
1e7bd1a0
Verified
Commit
1e7bd1a0
authored
4 years ago
by
Karsten Rink
Committed by
Lars Bilke
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[meshlib] added flag that allows ignoring nodata values during mesh mapping
parent
ddcd99bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshGenerators/MeshLayerMapper.cpp
+18
-7
18 additions, 7 deletions
MeshLib/MeshGenerators/MeshLayerMapper.cpp
MeshLib/MeshGenerators/MeshLayerMapper.h
+4
-1
4 additions, 1 deletion
MeshLib/MeshGenerators/MeshLayerMapper.h
with
22 additions
and
8 deletions
MeshLib/MeshGenerators/MeshLayerMapper.cpp
+
18
−
7
View file @
1e7bd1a0
...
@@ -269,8 +269,10 @@ void MeshLayerMapper::addLayerToMesh(const MeshLib::Mesh &dem_mesh, unsigned lay
...
@@ -269,8 +269,10 @@ void MeshLayerMapper::addLayerToMesh(const MeshLib::Mesh &dem_mesh, unsigned lay
bool
MeshLayerMapper
::
layerMapping
(
MeshLib
::
Mesh
const
&
mesh
,
bool
MeshLayerMapper
::
layerMapping
(
MeshLib
::
Mesh
const
&
mesh
,
GeoLib
::
Raster
const
&
raster
,
GeoLib
::
Raster
const
&
raster
,
double
const
noDataReplacementValue
=
0.0
)
double
const
nodata_replacement
,
bool
const
ignore_nodata
)
{
{
if
(
mesh
.
getDimension
()
!=
2
)
if
(
mesh
.
getDimension
()
!=
2
)
{
{
ERR
(
"MshLayerMapper::layerMapping() - requires 2D mesh"
);
ERR
(
"MshLayerMapper::layerMapping() - requires 2D mesh"
);
...
@@ -289,18 +291,27 @@ bool MeshLayerMapper::layerMapping(MeshLib::Mesh const& mesh,
...
@@ -289,18 +291,27 @@ bool MeshLayerMapper::layerMapping(MeshLib::Mesh const& mesh,
const
std
::
vector
<
MeshLib
::
Node
*>
&
nodes
=
mesh
.
getNodes
();
const
std
::
vector
<
MeshLib
::
Node
*>
&
nodes
=
mesh
.
getNodes
();
for
(
unsigned
i
=
0
;
i
<
nNodes
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
nNodes
;
++
i
)
{
{
if
(
!
raster
.
isPntOnRaster
(
*
nodes
[
i
]))
if
(
!
ignore_nodata
&&
!
raster
.
isPntOnRaster
(
*
nodes
[
i
]))
{
{
// use either default value or elevation from layer above
// use either default value or elevation from layer above
nodes
[
i
]
->
updateCoordinates
((
*
nodes
[
i
])[
0
],
(
*
nodes
[
i
])[
1
],
noDataReplacementValue
);
nodes
[
i
]
->
updateCoordinates
((
*
nodes
[
i
])[
0
],
(
*
nodes
[
i
])[
1
],
nodata_replacement
);
continue
;
continue
;
}
}
double
elevation
(
raster
.
interpolateValueAtPoint
(
*
nodes
[
i
]));
double
elevation
(
raster
.
getValueAtPoint
(
*
nodes
[
i
]));
if
(
std
::
abs
(
elevation
-
header
.
no_data
)
<
constexpr
double
eps
=
std
::
numeric_limits
<
double
>::
epsilon
();
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
std
::
fabs
(
elevation
-
header
.
no_data
)
<
eps
)
{
if
(
ignore_nodata
)
{
continue
;
}
elevation
=
nodata_replacement
;
}
else
{
{
elevation
=
noDataReplacementValue
;
elevation
=
raster
.
interpolateValueAtPoint
(
*
nodes
[
i
])
;
}
}
nodes
[
i
]
->
updateCoordinates
((
*
nodes
[
i
])[
0
],
(
*
nodes
[
i
])[
1
],
elevation
);
nodes
[
i
]
->
updateCoordinates
((
*
nodes
[
i
])[
0
],
(
*
nodes
[
i
])[
1
],
elevation
);
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshLayerMapper.h
+
4
−
1
View file @
1e7bd1a0
...
@@ -59,7 +59,10 @@ public:
...
@@ -59,7 +59,10 @@ public:
* locations where no information is given, node elevation is set to
* locations where no information is given, node elevation is set to
* noDataReplacementValue.
* noDataReplacementValue.
*/
*/
static
bool
layerMapping
(
MeshLib
::
Mesh
const
&
mesh
,
const
GeoLib
::
Raster
&
raster
,
double
noDataReplacementValue
);
static
bool
layerMapping
(
MeshLib
::
Mesh
const
&
mesh
,
const
GeoLib
::
Raster
&
raster
,
double
nodata_replacement
=
0.0
,
bool
const
ignore_nodata
=
false
);
/// Maps the elevation of all mesh nodes to the specified static value.
/// Maps the elevation of all mesh nodes to the specified static value.
static
bool
mapToStaticValue
(
MeshLib
::
Mesh
const
&
mesh
,
double
value
);
static
bool
mapToStaticValue
(
MeshLib
::
Mesh
const
&
mesh
,
double
value
);
...
...
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