Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
OpenMesh
Commits
ade4f58f
Commit
ade4f58f
authored
Apr 03, 2019
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hasProperty function
parent
fc63402d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
src/OpenMesh/Core/Utils/PropertyManager.hh
src/OpenMesh/Core/Utils/PropertyManager.hh
+28
-0
No files found.
src/OpenMesh/Core/Utils/PropertyManager.hh
View file @
ade4f58f
...
...
@@ -596,6 +596,34 @@ getOrMakeProperty(MeshT &mesh, const char *propname) {
return
PropertyManager
<
typename
HandleToPropHandle
<
ElementT
,
T
>::
type
,
MeshT
>::
createIfNotExists
(
mesh
,
propname
);
}
/** @relates PropertyManager
*
* Tests whether a property with the given element type, value type, and name is
* present on the given mesh.
*
* * Example:
* @code
* PolyMesh m;
* if (hasProperty<FaceHandle, bool>(m, "is_quad")) {
* // We now know the property exists: getProperty won't throw.
* auto is_quad = getProperty<FaceHandle, bool>(m, "is_quad");
* // Use is_quad here.
* }
* @endcode
*
* @param mesh The mesh in question
* @param propname The property name of the expected property
* @tparam ElementT Element type of the expected property, e.g. VertexHandle, HalfedgeHandle, etc.
* @tparam T Value type of the expected property, e.g., \p double, \p int, etc.
* @tparam MeshT Type of the mesh. Can often be inferred from \p mesh
*/
template
<
typename
ElementT
,
typename
T
,
typename
MeshT
>
bool
hasProperty
(
const
MeshT
&
mesh
,
const
char
*
propname
)
{
typename
HandleToPropHandle
<
ElementT
,
T
>::
type
ph
;
return
mesh
.
get_property_handle
(
ph
,
propname
);
}
/** @relates PropertyManager
* @deprecated Use makeTemporaryProperty() instead.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment