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
wenqing
ogs
Commits
e1f08da7
Unverified
Commit
e1f08da7
authored
5 years ago
by
Lars Bilke
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2627 from rinkk/shapeexportcli
[utils] mesh to shape conversion
parents
a6237de7
fcae1c15
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
Applications/Utils/FileConverter/CMakeLists.txt
+9
-0
9 additions, 0 deletions
Applications/Utils/FileConverter/CMakeLists.txt
Applications/Utils/FileConverter/Mesh2Shape.cpp
+51
-0
51 additions, 0 deletions
Applications/Utils/FileConverter/Mesh2Shape.cpp
with
60 additions
and
0 deletions
Applications/Utils/FileConverter/CMakeLists.txt
+
9
−
0
View file @
e1f08da7
...
@@ -18,6 +18,10 @@ if(OGS_BUILD_GUI)
...
@@ -18,6 +18,10 @@ if(OGS_BUILD_GUI)
list
(
APPEND TOOLS FEFLOW2OGS
)
list
(
APPEND TOOLS FEFLOW2OGS
)
endif
()
endif
()
if
(
Shapelib_FOUND
)
list
(
APPEND TOOLS Mesh2Shape
)
endif
()
foreach
(
TOOL
${
TOOLS
}
)
foreach
(
TOOL
${
TOOLS
}
)
add_executable
(
${
TOOL
}
${
TOOL
}
.cpp
)
add_executable
(
${
TOOL
}
${
TOOL
}
.cpp
)
target_link_libraries
(
${
TOOL
}
ApplicationsFileIO GitInfoLib MeshLib
)
target_link_libraries
(
${
TOOL
}
ApplicationsFileIO GitInfoLib MeshLib
)
...
@@ -28,3 +32,8 @@ install(TARGETS ${TOOLS} RUNTIME DESTINATION bin COMPONENT Utilities)
...
@@ -28,3 +32,8 @@ install(TARGETS ${TOOLS} RUNTIME DESTINATION bin COMPONENT Utilities)
if
(
TARGET ConvertSHPToGLI
)
if
(
TARGET ConvertSHPToGLI
)
target_link_libraries
(
ConvertSHPToGLI GeoLib Qt5::Xml
${
Shapelib_LIBRARIES
}
)
target_link_libraries
(
ConvertSHPToGLI GeoLib Qt5::Xml
${
Shapelib_LIBRARIES
}
)
endif
()
endif
()
if
(
TARGET Mesh2Shape
)
target_link_libraries
(
Mesh2Shape
${
Shapelib_LIBRARIES
}
)
endif
()
This diff is collapsed.
Click to expand it.
Applications/Utils/FileConverter/Mesh2Shape.cpp
0 → 100644
+
51
−
0
View file @
e1f08da7
/**
*
* @copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
#include
<tclap/CmdLine.h>
#include
"Applications/ApplicationsLib/LogogSetup.h"
#include
"Applications/FileIO/SHPInterface.h"
#include
"InfoLib/GitInfo.h"
#include
"MeshLib/IO/readMeshFromFile.h"
#include
"MeshLib/Mesh.h"
int
main
(
int
argc
,
char
*
argv
[])
{
ApplicationsLib
::
LogogSetup
logog_setup
;
TCLAP
::
CmdLine
cmd
(
"Converts 2D mesh file into shapfile such that each element is "
"represented by a polygon. Cell attributes are transferred onto shape "
"polygons while point attributes are ignored.
\n\n
"
"OpenGeoSys-6 software, version "
+
GitInfoLib
::
GitInfo
::
ogs_version
+
".
\n
"
"Copyright (c) 2012-2019, OpenGeoSys Community "
"(http://www.opengeosys.org)"
,
' '
,
GitInfoLib
::
GitInfo
::
ogs_version
);
TCLAP
::
ValueArg
<
std
::
string
>
output_arg
(
"o"
,
"output-file"
,
"Esri Shapefile (*.shp)"
,
true
,
""
,
"output_file.shp"
);
cmd
.
add
(
output_arg
);
TCLAP
::
ValueArg
<
std
::
string
>
input_arg
(
"i"
,
"input-file"
,
"OGS mesh file (*.vtu, *.msh)"
,
true
,
""
,
"input_file.vtu"
);
cmd
.
add
(
input_arg
);
cmd
.
parse
(
argc
,
argv
);
std
::
string
const
file_name
(
input_arg
.
getValue
());
std
::
unique_ptr
<
MeshLib
::
Mesh
>
const
mesh
(
MeshLib
::
IO
::
readMeshFromFile
(
file_name
));
if
(
FileIO
::
SHPInterface
::
write2dMeshToSHP
(
output_arg
.
getValue
(),
*
mesh
))
return
EXIT_SUCCESS
;
return
EXIT_FAILURE
;
}
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