Merge branch 'PropertyManagerRefactoring' into SmartRanges
# Conflicts: # src/OpenMesh/Core/Mesh/PolyConnectivity.hh
This commit is contained in:
@@ -105,10 +105,26 @@ public:
|
||||
FAttribs = MeshItems::FAttribs
|
||||
};
|
||||
|
||||
typedef VPropHandleT<VertexData> DataVPropHandle;
|
||||
typedef HPropHandleT<HalfedgeData> DataHPropHandle;
|
||||
typedef EPropHandleT<EdgeData> DataEPropHandle;
|
||||
typedef FPropHandleT<FaceData> DataFPropHandle;
|
||||
typedef VPropHandleT<VertexData> DataVPropHandle;
|
||||
typedef HPropHandleT<HalfedgeData> DataHPropHandle;
|
||||
typedef EPropHandleT<EdgeData> DataEPropHandle;
|
||||
typedef FPropHandleT<FaceData> DataFPropHandle;
|
||||
|
||||
typedef VPropHandleT<Point> PointsPropertyHandle;
|
||||
typedef VPropHandleT<Normal> VertexNormalsPropertyHandle;
|
||||
typedef VPropHandleT<Color> VertexColorsPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord1D> VertexTexCoords1DPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord2D> VertexTexCoords2DPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord3D> VertexTexCoords3DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord1D> HalfedgeTexCoords1DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord2D> HalfedgeTexCoords2DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord3D> HalfedgeTexCoords3DPropertyHandle;
|
||||
typedef EPropHandleT<Color> EdgeColorsPropertyHandle;
|
||||
typedef HPropHandleT<Normal> HalfedgeNormalsPropertyHandle;
|
||||
typedef HPropHandleT<Color> HalfedgeColorsPropertyHandle;
|
||||
typedef FPropHandleT<Normal> FaceNormalsPropertyHandle;
|
||||
typedef FPropHandleT<Color> FaceColorsPropertyHandle;
|
||||
typedef FPropHandleT<TextureIndex> FaceTextureIndexPropertyHandle;
|
||||
|
||||
public:
|
||||
|
||||
@@ -240,6 +256,9 @@ public:
|
||||
void set_point(VertexHandle _vh, const Point& _p)
|
||||
{ this->property(points_, _vh) = _p; }
|
||||
|
||||
PointsPropertyHandle& points_property_handle()
|
||||
{ return points_; }
|
||||
|
||||
|
||||
//------------------------------------------------------------ vertex normals
|
||||
|
||||
@@ -592,24 +611,6 @@ public:
|
||||
bool has_face_colors() const { return face_colors_.is_valid(); }
|
||||
bool has_face_texture_index() const { return face_texture_index_.is_valid(); }
|
||||
|
||||
public:
|
||||
|
||||
typedef VPropHandleT<Point> PointsPropertyHandle;
|
||||
typedef VPropHandleT<Normal> VertexNormalsPropertyHandle;
|
||||
typedef VPropHandleT<Color> VertexColorsPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord1D> VertexTexCoords1DPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord2D> VertexTexCoords2DPropertyHandle;
|
||||
typedef VPropHandleT<TexCoord3D> VertexTexCoords3DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord1D> HalfedgeTexCoords1DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord2D> HalfedgeTexCoords2DPropertyHandle;
|
||||
typedef HPropHandleT<TexCoord3D> HalfedgeTexCoords3DPropertyHandle;
|
||||
typedef EPropHandleT<Color> EdgeColorsPropertyHandle;
|
||||
typedef HPropHandleT<Normal> HalfedgeNormalsPropertyHandle;
|
||||
typedef HPropHandleT<Color> HalfedgeColorsPropertyHandle;
|
||||
typedef FPropHandleT<Normal> FaceNormalsPropertyHandle;
|
||||
typedef FPropHandleT<Color> FaceColorsPropertyHandle;
|
||||
typedef FPropHandleT<TextureIndex> FaceTextureIndexPropertyHandle;
|
||||
|
||||
public:
|
||||
//standard vertex properties
|
||||
PointsPropertyHandle points_pph() const
|
||||
|
||||
@@ -516,7 +516,7 @@ public:
|
||||
// Copy all properties, if build in is true
|
||||
// Otherwise, copy only properties without build in specifier
|
||||
if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "v:" ) )
|
||||
(*p_it)->copy(_vh_from.idx(), _vh_to.idx());
|
||||
(*p_it)->copy(static_cast<size_t>(_vh_from.idx()), static_cast<size_t>(_vh_to.idx()));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -690,6 +690,9 @@ public: //----------------------------------------------------- element numbers
|
||||
virtual size_t n_edges() const { return 0; }
|
||||
virtual size_t n_faces() const { return 0; }
|
||||
|
||||
template <typename HandleT>
|
||||
size_t n_elements() const;
|
||||
|
||||
|
||||
protected: //------------------------------------------- synchronize properties
|
||||
|
||||
@@ -814,6 +817,16 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
inline size_t BaseKernel::n_elements<VertexHandle>() const { return n_vertices(); }
|
||||
template <>
|
||||
inline size_t BaseKernel::n_elements<HalfedgeHandle>() const { return n_halfedges(); }
|
||||
template <>
|
||||
inline size_t BaseKernel::n_elements<EdgeHandle>() const { return n_edges(); }
|
||||
template <>
|
||||
inline size_t BaseKernel::n_elements<FaceHandle>() const { return n_faces(); }
|
||||
|
||||
|
||||
//=============================================================================
|
||||
} // namespace OpenMesh
|
||||
//=============================================================================
|
||||
|
||||
66
src/OpenMesh/Core/Mesh/DefaultPolyMesh.hh
Normal file
66
src/OpenMesh/Core/Mesh/DefaultPolyMesh.hh
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ========================================================================= *
|
||||
* *
|
||||
* OpenMesh *
|
||||
* Copyright (c) 2001-2019, RWTH-Aachen University *
|
||||
* Department of Computer Graphics and Multimedia *
|
||||
* All rights reserved. *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
*---------------------------------------------------------------------------*
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions *
|
||||
* are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer. *
|
||||
* *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in the *
|
||||
* documentation and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* 3. Neither the name of the copyright holder nor the names of its *
|
||||
* contributors may be used to endorse or promote products derived from *
|
||||
* this software without specific prior written permission. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
* ========================================================================= */
|
||||
|
||||
|
||||
#ifndef OPENMESH_DEFAULTPOLYMESH_HH
|
||||
#define OPENMESH_DEFAULTPOLYMESH_HH
|
||||
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
#include <OpenMesh/Core/Mesh/Traits.hh>
|
||||
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
||||
|
||||
//== NAMESPACES ===============================================================
|
||||
|
||||
namespace OpenMesh {
|
||||
|
||||
//== TYPEDEFS =================================================================
|
||||
|
||||
typedef PolyMesh_ArrayKernelT<DefaultTraitsDouble> PolyMesh;
|
||||
|
||||
//=============================================================================
|
||||
} // namespace OpenMesh
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
#endif // OPENMESH_DEFAULTPOLYMESH_HH defined
|
||||
//=============================================================================
|
||||
66
src/OpenMesh/Core/Mesh/DefaultTriMesh.hh
Normal file
66
src/OpenMesh/Core/Mesh/DefaultTriMesh.hh
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ========================================================================= *
|
||||
* *
|
||||
* OpenMesh *
|
||||
* Copyright (c) 2001-2019, RWTH-Aachen University *
|
||||
* Department of Computer Graphics and Multimedia *
|
||||
* All rights reserved. *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
*---------------------------------------------------------------------------*
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions *
|
||||
* are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer. *
|
||||
* *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in the *
|
||||
* documentation and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* 3. Neither the name of the copyright holder nor the names of its *
|
||||
* contributors may be used to endorse or promote products derived from *
|
||||
* this software without specific prior written permission. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
* ========================================================================= */
|
||||
|
||||
|
||||
#ifndef OPENMESH_DEFAULTTRIMESH_HH
|
||||
#define OPENMESH_DEFAULTTRIMESH_HH
|
||||
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
#include <OpenMesh/Core/Mesh/Traits.hh>
|
||||
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||
|
||||
//== NAMESPACES ===============================================================
|
||||
|
||||
namespace OpenMesh {
|
||||
|
||||
//== TYPEDEFS =================================================================
|
||||
|
||||
typedef TriMesh_ArrayKernelT<DefaultTraitsDouble> TriMesh;
|
||||
|
||||
//=============================================================================
|
||||
} // namespace OpenMesh
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
#endif // OPENMESH_DEFAULTTRIMESH_HH defined
|
||||
//=============================================================================
|
||||
@@ -1099,6 +1099,9 @@ public:
|
||||
&PolyConnectivity::faces_end>> ConstFaceRangeSkipping;
|
||||
|
||||
|
||||
template <typename HandleType>
|
||||
struct ElementRange;
|
||||
|
||||
/**
|
||||
* @return The vertices as a range object suitable
|
||||
* for C++11 range based for loops. Will skip deleted vertices.
|
||||
@@ -1147,12 +1150,26 @@ public:
|
||||
*/
|
||||
ConstFaceRange all_faces() const;
|
||||
|
||||
/**
|
||||
* @return The elements corresponding to the template type as a range object suitable
|
||||
* for C++11 range based for loops. Will skip deleted faces.
|
||||
*/
|
||||
template <typename HandleType>
|
||||
typename ElementRange<HandleType>::RangeSkipping elements() const;
|
||||
|
||||
/**
|
||||
* @return The elements corresponding to the template type as a range object suitable
|
||||
* for C++11 range based for loops. Will include deleted faces.
|
||||
*/
|
||||
template <typename HandleType>
|
||||
typename ElementRange<HandleType>::Range all_elements() const;
|
||||
|
||||
|
||||
typedef CirculatorRange<CirculatorRangeTraitT<
|
||||
PolyConnectivity,
|
||||
ConstVertexVertexCWIter,
|
||||
VertexHandle,
|
||||
VertexHandle,
|
||||
VertexHandle,
|
||||
VertexHandle,
|
||||
&PolyConnectivity::cvv_cwbegin,
|
||||
&PolyConnectivity::cvv_cwend>> ConstVertexVertexRange;
|
||||
typedef CirculatorRange<CirculatorRangeTraitT<
|
||||
@@ -1524,6 +1541,34 @@ private: // Working storage for add_face()
|
||||
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PolyConnectivity::ElementRange<VertexHandle>
|
||||
{
|
||||
using Range = ConstVertexRange;
|
||||
using RangeSkipping = ConstVertexRangeSkipping;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PolyConnectivity::ElementRange<HalfedgeHandle>
|
||||
{
|
||||
using Range = ConstHalfedgeRange;
|
||||
using RangeSkipping = ConstHalfedgeRangeSkipping;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PolyConnectivity::ElementRange<EdgeHandle>
|
||||
{
|
||||
using Range = ConstEdgeRange;
|
||||
using RangeSkipping = ConstEdgeRangeSkipping;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PolyConnectivity::ElementRange<FaceHandle>
|
||||
{
|
||||
using Range = ConstFaceRange;
|
||||
using RangeSkipping = ConstFaceRangeSkipping;
|
||||
};
|
||||
|
||||
}//namespace OpenMesh
|
||||
|
||||
|
||||
@@ -1569,6 +1614,7 @@ class EntityRange : public SmartRangeT<EntityRange<RangeTraitT>, typename RangeT
|
||||
typename RangeTraitT::CONTAINER_TYPE &container_;
|
||||
};
|
||||
|
||||
|
||||
/// Generic class for iterator ranges.
|
||||
template <typename CirculatorRangeTraitT>
|
||||
//class CirculatorRange : public SmartRangeT<CirculatorRange<CirculatorRangeTraitT>, decltype (make_smart(std::declval<typename CirculatorRangeTraitT::TO_ENTITYE_TYPE>(), std::declval<PolyConnectivity>()))>{
|
||||
@@ -1592,7 +1638,6 @@ class CirculatorRange : public SmartRangeT<CirculatorRange<CirculatorRangeTraitT
|
||||
CENTER_ENTITY_TYPE center_;
|
||||
};
|
||||
|
||||
|
||||
inline PolyConnectivity::ConstVertexRangeSkipping PolyConnectivity::vertices() const { return ConstVertexRangeSkipping(*this); }
|
||||
inline PolyConnectivity::ConstVertexRange PolyConnectivity::all_vertices() const { return ConstVertexRange(*this); }
|
||||
inline PolyConnectivity::ConstHalfedgeRangeSkipping PolyConnectivity::halfedges() const { return ConstHalfedgeRangeSkipping(*this); }
|
||||
@@ -1602,6 +1647,15 @@ inline PolyConnectivity::ConstEdgeRange PolyConnectivity::all_edges(
|
||||
inline PolyConnectivity::ConstFaceRangeSkipping PolyConnectivity::faces() const { return ConstFaceRangeSkipping(*this); }
|
||||
inline PolyConnectivity::ConstFaceRange PolyConnectivity::all_faces() const { return ConstFaceRange(*this); }
|
||||
|
||||
template <> inline PolyConnectivity::ConstVertexRangeSkipping PolyConnectivity::elements<VertexHandle>() const { return vertices(); }
|
||||
template <> inline PolyConnectivity::ConstVertexRange PolyConnectivity::all_elements<VertexHandle>() const { return all_vertices(); }
|
||||
template <> inline PolyConnectivity::ConstHalfedgeRangeSkipping PolyConnectivity::elements<HalfedgeHandle>() const { return halfedges(); }
|
||||
template <> inline PolyConnectivity::ConstHalfedgeRange PolyConnectivity::all_elements<HalfedgeHandle>() const { return all_halfedges(); }
|
||||
template <> inline PolyConnectivity::ConstEdgeRangeSkipping PolyConnectivity::elements<EdgeHandle>() const { return edges(); }
|
||||
template <> inline PolyConnectivity::ConstEdgeRange PolyConnectivity::all_elements<EdgeHandle>() const { return all_edges(); }
|
||||
template <> inline PolyConnectivity::ConstFaceRangeSkipping PolyConnectivity::elements<FaceHandle>() const { return faces(); }
|
||||
template <> inline PolyConnectivity::ConstFaceRange PolyConnectivity::all_elements<FaceHandle>() const { return all_faces(); }
|
||||
|
||||
inline PolyConnectivity::ConstVertexVertexRange PolyConnectivity::vv_range(VertexHandle _vh) const {
|
||||
return ConstVertexVertexRange(*this, _vh);
|
||||
}
|
||||
|
||||
@@ -152,6 +152,24 @@ struct DefaultTraits
|
||||
FaceAttributes(0);
|
||||
};
|
||||
|
||||
/** \class DefaultTraitsDouble Traits.hh <OpenMesh/Mesh/Traits.hh>
|
||||
|
||||
Version of Default Traits that uses double precision for points and
|
||||
normals as well as floating point vectors for colors
|
||||
|
||||
\see The Mesh docu section on \ref mesh_type.
|
||||
\see Traits.hh for a list of macros for traits classes.
|
||||
*/
|
||||
struct DefaultTraitsDouble : public DefaultTraits
|
||||
{
|
||||
/// Use double precision points
|
||||
typedef OpenMesh::Vec3d Point;
|
||||
/// Use double precision Normals
|
||||
typedef OpenMesh::Vec3d Normal;
|
||||
/// Use RGBA Color
|
||||
typedef OpenMesh::Vec4f Color;
|
||||
};
|
||||
|
||||
|
||||
//== CLASS DEFINITION =========================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user