gmio_support: OpenCascade support no longer requires C++11

This commit is contained in:
Hugues Delorme 2016-07-26 16:23:03 +02:00
parent 362c789f5b
commit 38ae856f36
4 changed files with 25 additions and 36 deletions

View File

@ -45,13 +45,6 @@ add_executable(occstl_write_file
occstl_write_file.cpp ${SUPPORT_STL_OCC_FILES})
add_executable(occstl_redefine_mesh_creator
occstl_redefine_mesh_creator.cpp ${SUPPORT_STL_OCC_FILES})
if(CMAKE_COMPILER_IS_GNUCC)
set_target_properties(
occstl_read_file
occstl_write_file
occstl_redefine_mesh_creator
PROPERTIES COMPILE_FLAGS "-std=c++0x")
endif()
# gmio STL
add_executable(stl_get_infos stl_get_infos.c)

View File

@ -61,32 +61,34 @@ gmio_stl_mesh_occshape::gmio_stl_mesh_occshape(const TopoDS_Shape& shape)
}
// Fill face and triangle datas
m_vec_face_data.reserve(face_count);
m_vec_triangle_data.reserve(this->triangle_count);
std::size_t vec_face_id = 0;
std::size_t vec_tri_id = 0;
m_vec_face_data.resize(face_count);
m_vec_triangle_data.resize(this->triangle_count);
for (TopExp_Explorer expl(shape, TopAbs_FACE); expl.More(); expl.Next()) {
const TopoDS_Face& topoface = TopoDS::Face(expl.Current());
TopLoc_Location loc;
const Handle_Poly_Triangulation& hnd_face_poly =
BRep_Tool::Triangulation(topoface, loc);
if (!hnd_face_poly.IsNull()) {
{ // Add next face_data
struct face_data facedata;
facedata.trsf = loc.Transformation();
facedata.is_reversed = (topoface.Orientation() == TopAbs_REVERSED);
if (facedata.trsf.IsNegative())
facedata.is_reversed = !facedata.is_reversed;
facedata.ptr_nodes = &hnd_face_poly->Nodes();
m_vec_face_data.push_back(std::move(facedata));
}
const struct face_data& last_facedata = m_vec_face_data.back();
// Add triangle_datas
// Copy next face_data
struct face_data& facedata = m_vec_face_data.at(vec_face_id);
facedata.trsf = loc.Transformation();
facedata.is_reversed = (topoface.Orientation() == TopAbs_REVERSED);
if (facedata.trsf.IsNegative())
facedata.is_reversed = !facedata.is_reversed;
facedata.ptr_nodes = &hnd_face_poly->Nodes();
// Copy triangle_datas
const Poly_Array1OfTriangle& vec_face_tri = hnd_face_poly->Triangles();
for (int i = vec_face_tri.Lower(); i <= vec_face_tri.Upper(); ++i) {
struct triangle_data tridata;
struct triangle_data& tridata = m_vec_triangle_data.at(vec_tri_id);
tridata.ptr_triangle = &vec_face_tri.Value(i);
tridata.ptr_face_data = &last_facedata;
m_vec_triangle_data.push_back(std::move(tridata));
tridata.ptr_face_data = &facedata;
++vec_tri_id;
}
++vec_face_id;
}
}
}

View File

@ -95,13 +95,14 @@ void gmio_stl_mesh_occmesh::init_cache()
this->triangle_count += m_mesh->NbTriangles(dom_id);
// Fill vector of triangle data
m_vec_domain_data.reserve(domain_count);
m_vec_triangle_data.reserve(this->triangle_count);
m_vec_domain_data.resize(domain_count);
m_vec_triangle_data.resize(this->triangle_count);
std::size_t vec_tri_id = 0;
for (int dom_id = 1; dom_id <= domain_count; ++dom_id) {
// Cache vertex indexes
// TColgp_SequenceOfXYZ::Value(int) is slow(linear search)
const TColgp_SequenceOfXYZ& seq_vertices = m_mesh->Vertices(dom_id);
struct domain_data domdata;
struct domain_data& domdata = m_vec_domain_data.at(dom_id - 1);
domdata.vec_coords.reserve(seq_vertices.Length());
#if OCC_VERSION_HEX >= 0x070000
typedef TColgp_SequenceOfXYZ::const_iterator ConstIterSeqXYZ;
@ -112,7 +113,6 @@ void gmio_stl_mesh_occmesh::init_cache()
for (int i = 1; i <= seq_vertices.Length(); ++i)
domdata.vec_coords.push_back(&seq_vertices.Value(i));
#endif
m_vec_domain_data.push_back(std::move(domdata));
// Cache triangles
const StlMesh_SequenceOfMeshTriangle& seq_triangles =
@ -120,10 +120,10 @@ void gmio_stl_mesh_occmesh::init_cache()
for (int tri_id = 1; tri_id <= seq_triangles.Length(); ++tri_id) {
const Handle_StlMesh_MeshTriangle& hnd_occtri =
seq_triangles.Value(tri_id);
struct triangle_data tridata;
struct triangle_data& tridata = m_vec_triangle_data.at(vec_tri_id);
tridata.ptr_triangle = hnd_occtri.operator->();
tridata.ptr_domain = &m_vec_domain_data.back();
m_vec_triangle_data.push_back(std::move(tridata));
tridata.ptr_domain = &domdata;
++vec_tri_id;
}
}
}

View File

@ -48,9 +48,3 @@ include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/opencascade
${CMAKE_CURRENT_SOURCE_DIR}/qt)
if(CMAKE_COMPILER_IS_GNUCC)
set_target_properties(
fake_support
PROPERTIES COMPILE_FLAGS "-std=c++0x")
endif()