gmio_support: provide gmio_stl_mesh support of TopoDS_Shape
This commit is contained in:
parent
38a0a71a55
commit
1b2c4e945e
@ -66,8 +66,10 @@ install(FILES gmio_support/stream_qt.h DESTINATION include/gmio_support)
|
|||||||
install(FILES gmio_support/stream_qt.cpp DESTINATION src/gmio_support)
|
install(FILES gmio_support/stream_qt.cpp DESTINATION src/gmio_support)
|
||||||
|
|
||||||
# OpenCASCADE support
|
# OpenCASCADE support
|
||||||
|
install(FILES gmio_support/stl_occ_brep.h DESTINATION include/gmio_support)
|
||||||
install(FILES gmio_support/stl_occ_mesh.h DESTINATION include/gmio_support)
|
install(FILES gmio_support/stl_occ_mesh.h DESTINATION include/gmio_support)
|
||||||
install(FILES gmio_support/stl_occ_meshvs.h DESTINATION include/gmio_support)
|
install(FILES gmio_support/stl_occ_meshvs.h DESTINATION include/gmio_support)
|
||||||
|
install(FILES gmio_support/stl_occ_brep.cpp DESTINATION src/gmio_support)
|
||||||
install(FILES gmio_support/stl_occ_mesh.cpp DESTINATION src/gmio_support)
|
install(FILES gmio_support/stl_occ_mesh.cpp DESTINATION src/gmio_support)
|
||||||
install(FILES gmio_support/stl_occ_meshvs.cpp DESTINATION src/gmio_support)
|
install(FILES gmio_support/stl_occ_meshvs.cpp DESTINATION src/gmio_support)
|
||||||
install(FILES gmio_support/stl_occ_utils.h DESTINATION src/gmio_support)
|
install(FILES gmio_support/stl_occ_utils.h DESTINATION src/gmio_support)
|
||||||
|
140
src/gmio_support/stl_occ_brep.cpp
Normal file
140
src/gmio_support/stl_occ_brep.cpp
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** gmio
|
||||||
|
** Copyright Fougue (2 Mar. 2015)
|
||||||
|
** contact@fougue.pro
|
||||||
|
**
|
||||||
|
** This software is a reusable library whose purpose is to provide complete
|
||||||
|
** I/O support for various CAD file formats (eg. STL)
|
||||||
|
**
|
||||||
|
** This software is governed by the CeCILL-B license under French law and
|
||||||
|
** abiding by the rules of distribution of free software. You can use,
|
||||||
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
||||||
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <gmio_support/stl_occ_brep.h>
|
||||||
|
|
||||||
|
#include "stl_occ_utils.h"
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
static void occshape_get_triangle(
|
||||||
|
const void* cookie, uint32_t /*tri_id*/, gmio_stl_triangle* tri)
|
||||||
|
{
|
||||||
|
void* wcookie = const_cast<void*>(cookie);
|
||||||
|
gmio_stl_occshape_iterator* it =
|
||||||
|
static_cast<gmio_stl_occshape_iterator*>(wcookie);
|
||||||
|
|
||||||
|
const bool reversed = it->face_is_reversed();
|
||||||
|
const gp_Trsf& trsf = it->face_trsf();
|
||||||
|
const TColgp_Array1OfPnt* nodes = it->face_nodes();
|
||||||
|
int n1, n2, n3; // Node index
|
||||||
|
it->face_current_triangle()->Get(n1, n2, n3);
|
||||||
|
gp_Pnt p1 = nodes->Value(n1);
|
||||||
|
gp_Pnt p2 = nodes->Value(reversed ? n3 : n2);
|
||||||
|
gp_Pnt p3 = nodes->Value(reversed ? n2 : n3);
|
||||||
|
if (trsf.Form() != gp_Identity) {
|
||||||
|
p1.Transform(trsf);
|
||||||
|
p2.Transform(trsf);
|
||||||
|
p3.Transform(trsf);
|
||||||
|
}
|
||||||
|
gmio_stl_occ_copy_xyz(&tri->v1, p1.XYZ());
|
||||||
|
gmio_stl_occ_copy_xyz(&tri->v2, p2.XYZ());
|
||||||
|
gmio_stl_occ_copy_xyz(&tri->v3, p3.XYZ());
|
||||||
|
gmio_stl_triangle_compute_normal(tri);
|
||||||
|
it->move_to_next_tri();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
gmio_stl_mesh gmio_stl_occmesh(const gmio_stl_occshape_iterator& it)
|
||||||
|
{
|
||||||
|
gmio_stl_mesh mesh = {};
|
||||||
|
mesh.cookie = ⁢
|
||||||
|
|
||||||
|
if (it.shape() != NULL) {
|
||||||
|
TopLoc_Location loc;
|
||||||
|
const TopoDS_Shape& sh = *it.shape();
|
||||||
|
for (TopExp_Explorer expl(sh, TopAbs_FACE); expl.More(); expl.Next()) {
|
||||||
|
const Handle_Poly_Triangulation& poly =
|
||||||
|
BRep_Tool::Triangulation(TopoDS::Face(expl.Current()), loc);
|
||||||
|
if (!poly.IsNull())
|
||||||
|
mesh.triangle_count += poly->NbTriangles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh.func_get_triangle = internal::occshape_get_triangle;
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gmio_stl_occshape_iterator::gmio_stl_occshape_iterator()
|
||||||
|
: m_shape(NULL)
|
||||||
|
{
|
||||||
|
this->reset_face();
|
||||||
|
}
|
||||||
|
|
||||||
|
gmio_stl_occshape_iterator::gmio_stl_occshape_iterator(const TopoDS_Shape& shape)
|
||||||
|
: m_shape(&shape),
|
||||||
|
m_expl(shape, TopAbs_FACE)
|
||||||
|
{
|
||||||
|
if (m_expl.More()) {
|
||||||
|
this->cache_face(TopoDS::Face(m_expl.Current()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->reset_face();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gmio_stl_occshape_iterator::move_to_next_tri()
|
||||||
|
{
|
||||||
|
++m_face_tri_id;
|
||||||
|
if (m_face_tri_id > m_face_last_tri_id) {
|
||||||
|
m_expl.Next();
|
||||||
|
if (m_expl.More()) {
|
||||||
|
this->cache_face(TopoDS::Face(m_expl.Current()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gmio_stl_occshape_iterator::reset_face()
|
||||||
|
{
|
||||||
|
m_face_poly = NULL;
|
||||||
|
m_face_nodes = NULL;
|
||||||
|
m_face_triangles = NULL;
|
||||||
|
if (m_face_trsf.Form() != gp_Identity)
|
||||||
|
m_face_trsf = gp_Trsf();
|
||||||
|
m_face_is_reversed = false;
|
||||||
|
m_face_tri_id = 0;
|
||||||
|
m_face_last_tri_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gmio_stl_occshape_iterator::cache_face(const TopoDS_Face& face)
|
||||||
|
{
|
||||||
|
TopLoc_Location loc;
|
||||||
|
const Handle_Poly_Triangulation& hnd_face_poly =
|
||||||
|
BRep_Tool::Triangulation(face, loc);
|
||||||
|
m_face_trsf = loc.Transformation();
|
||||||
|
m_face_poly =
|
||||||
|
!hnd_face_poly.IsNull() ? hnd_face_poly.operator->() : NULL;
|
||||||
|
m_face_nodes =
|
||||||
|
m_face_poly != NULL ? &m_face_poly->Nodes() : NULL;
|
||||||
|
m_face_triangles =
|
||||||
|
m_face_poly != NULL ? &m_face_poly->Triangles() : NULL;
|
||||||
|
m_face_is_reversed = face.Orientation() == TopAbs_REVERSED;
|
||||||
|
if (m_face_trsf.IsNegative())
|
||||||
|
m_face_is_reversed = !m_face_is_reversed;
|
||||||
|
m_face_tri_id =
|
||||||
|
m_face_triangles != NULL ? m_face_triangles->Lower() : -1;
|
||||||
|
m_face_last_tri_id =
|
||||||
|
m_face_triangles != NULL ? m_face_triangles->Upper() : -1;
|
||||||
|
}
|
116
src/gmio_support/stl_occ_brep.h
Normal file
116
src/gmio_support/stl_occ_brep.h
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** gmio
|
||||||
|
** Copyright Fougue (2 Mar. 2015)
|
||||||
|
** contact@fougue.pro
|
||||||
|
**
|
||||||
|
** This software is a reusable library whose purpose is to provide complete
|
||||||
|
** I/O support for various CAD file formats (eg. STL)
|
||||||
|
**
|
||||||
|
** This software is governed by the CeCILL-B license under French law and
|
||||||
|
** abiding by the rules of distribution of free software. You can use,
|
||||||
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
||||||
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*! \file stl_occ_brep.h
|
||||||
|
* STL support of OpenCascade's TopoDS_Shape
|
||||||
|
*
|
||||||
|
* \addtogroup gmio_support
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
# error C++ compiler required
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GMIO_SUPPORT_STL_OCC_BREP_H
|
||||||
|
#define GMIO_SUPPORT_STL_OCC_BREP_H
|
||||||
|
|
||||||
|
#include "support_global.h"
|
||||||
|
#include "../gmio_stl/stl_mesh.h"
|
||||||
|
|
||||||
|
#include <Poly_Triangulation.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
class TopoDS_Face;
|
||||||
|
|
||||||
|
struct gmio_stl_occshape_iterator;
|
||||||
|
|
||||||
|
/*! Returns a gmio_stl_mesh mapped to the OpenCascade mesh in iterator \p it
|
||||||
|
*
|
||||||
|
* The mesh's cookie will point to \c &it so the lifescope of the corresponding
|
||||||
|
* object must be at least as longer as the returned gmio_stl_mesh.
|
||||||
|
*
|
||||||
|
* Example of use:
|
||||||
|
* \code{.cpp}
|
||||||
|
* const TopoDS_Shape occshape = ...;
|
||||||
|
* const gmio_stl_occshape_iterator it(occshape);
|
||||||
|
* const gmio_stl_mesh mesh = gmio_stl_occmesh(it);
|
||||||
|
* gmio_stl_write_file(stl_format, filepath, &mesh, &options);
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
gmio_stl_mesh gmio_stl_occmesh(const gmio_stl_occshape_iterator& it);
|
||||||
|
|
||||||
|
|
||||||
|
/*! Forward iterator over the triangles of OpenCascade's TopoDS_Shape
|
||||||
|
*
|
||||||
|
* It is used to iterate efficiently over the triangles of all internally
|
||||||
|
* triangulated sub faces
|
||||||
|
*
|
||||||
|
* Don't use API of this class, it's intended to gmio_stl_occmesh()
|
||||||
|
*/
|
||||||
|
struct gmio_stl_occshape_iterator
|
||||||
|
{
|
||||||
|
gmio_stl_occshape_iterator();
|
||||||
|
explicit gmio_stl_occshape_iterator(const TopoDS_Shape& shape);
|
||||||
|
|
||||||
|
inline const TopoDS_Shape* shape() const;
|
||||||
|
|
||||||
|
bool move_to_next_tri();
|
||||||
|
inline bool face_is_reversed() const;
|
||||||
|
inline const gp_Trsf& face_trsf() const;
|
||||||
|
inline const TColgp_Array1OfPnt* face_nodes() const;
|
||||||
|
inline const Poly_Triangle* face_current_triangle() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void reset_face();
|
||||||
|
void cache_face(const TopoDS_Face& face);
|
||||||
|
|
||||||
|
const TopoDS_Shape* m_shape;
|
||||||
|
TopExp_Explorer m_expl;
|
||||||
|
const Poly_Triangulation* m_face_poly;
|
||||||
|
const TColgp_Array1OfPnt* m_face_nodes;
|
||||||
|
const Poly_Array1OfTriangle* m_face_triangles;
|
||||||
|
gp_Trsf m_face_trsf;
|
||||||
|
bool m_face_is_reversed;
|
||||||
|
int m_face_tri_id;
|
||||||
|
int m_face_last_tri_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DOXYGEN
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TopoDS_Shape *gmio_stl_occshape_iterator::shape() const
|
||||||
|
{ return m_shape; }
|
||||||
|
|
||||||
|
bool gmio_stl_occshape_iterator::face_is_reversed() const
|
||||||
|
{ return m_face_is_reversed; }
|
||||||
|
|
||||||
|
const gp_Trsf &gmio_stl_occshape_iterator::face_trsf() const
|
||||||
|
{ return m_face_trsf; }
|
||||||
|
|
||||||
|
const TColgp_Array1OfPnt *gmio_stl_occshape_iterator::face_nodes() const
|
||||||
|
{ return m_face_nodes; }
|
||||||
|
|
||||||
|
const Poly_Triangle *gmio_stl_occshape_iterator::face_current_triangle() const
|
||||||
|
{ return &m_face_triangles->Value(m_face_tri_id); }
|
||||||
|
|
||||||
|
#endif /* !DOXYGEN */
|
||||||
|
|
||||||
|
#endif /* GMIO_SUPPORT_STL_OCC_BREP_H */
|
||||||
|
/*! @} */
|
@ -13,29 +13,21 @@
|
|||||||
## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
|
file(GLOB GMIO_FAKEOCC_HEADERS opencascade/*.hxx opencascade/*.h)
|
||||||
|
set(GMIO_FAKEOCC_HEADERS ${GMIO_FAKEOCC_HEADERS})
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
fake_support
|
fake_support
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
main.cpp
|
main.cpp
|
||||||
opencascade/gp_XYZ.hxx
|
${GMIO_FAKEOCC_HEADERS}
|
||||||
opencascade/Handle_MeshVS_DataSource.hxx
|
|
||||||
opencascade/Handle_StlMesh_Mesh.hxx
|
|
||||||
opencascade/Handle_StlMesh_MeshTriangle.hxx
|
|
||||||
opencascade/MeshVS_DataSource.hxx
|
|
||||||
opencascade/Standard_TypeDef.hxx
|
|
||||||
opencascade/StlMesh_Mesh.hxx
|
|
||||||
opencascade/StlMesh_MeshTriangle.hxx
|
|
||||||
opencascade/StlMesh_SequenceOfMeshTriangle.hxx
|
|
||||||
opencascade/TColStd_Array1OfReal.hxx
|
|
||||||
opencascade/TColStd_MapIteratorOfPackedMapOfInteger.hxx
|
|
||||||
opencascade/TColStd_PackedMapOfInteger.hxx
|
|
||||||
opencascade/TColgp_SequenceOfXYZ.hxx
|
|
||||||
qt/QtCore/QFile
|
qt/QtCore/QFile
|
||||||
qt/QtCore/QIODevice
|
qt/QtCore/QIODevice
|
||||||
qt/QtCore/QString
|
qt/QtCore/QString
|
||||||
qt/QtCore/QtGlobal
|
qt/QtCore/QtGlobal
|
||||||
../../src/gmio_support/stl_occ_mesh.cpp
|
../../src/gmio_support/stl_occ_mesh.cpp
|
||||||
../../src/gmio_support/stl_occ_meshvs.cpp
|
../../src/gmio_support/stl_occ_meshvs.cpp
|
||||||
|
../../src/gmio_support/stl_occ_brep.cpp
|
||||||
../../src/gmio_support/stream_qt.cpp)
|
../../src/gmio_support/stream_qt.cpp)
|
||||||
target_link_libraries(fake_support gmio)
|
target_link_libraries(fake_support gmio)
|
||||||
include_directories(
|
include_directories(
|
||||||
|
20
tests/fake_support/opencascade/BRep_Tool.hxx
Normal file
20
tests/fake_support/opencascade/BRep_Tool.hxx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef _BRep_Tool_HeaderFile
|
||||||
|
#define _BRep_Tool_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
#include <Poly_Triangulation.hxx>
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
|
||||||
|
class BRep_Tool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const Handle_Poly_Triangulation& Triangulation(
|
||||||
|
const TopoDS_Face& /*F*/, TopLoc_Location& /*L*/)
|
||||||
|
{
|
||||||
|
static Handle_Poly_Triangulation ply;
|
||||||
|
return ply;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _BRep_Tool_HeaderFile
|
@ -1,20 +0,0 @@
|
|||||||
#ifndef _Handle_MeshVS_DataSource_HeaderFile
|
|
||||||
#define _Handle_MeshVS_DataSource_HeaderFile
|
|
||||||
|
|
||||||
class MeshVS_DataSource;
|
|
||||||
|
|
||||||
class Handle_MeshVS_DataSource
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Handle_MeshVS_DataSource() {}
|
|
||||||
Handle_MeshVS_DataSource(const Handle_MeshVS_DataSource&) {}
|
|
||||||
Handle_MeshVS_DataSource(const MeshVS_DataSource*) {}
|
|
||||||
|
|
||||||
MeshVS_DataSource* operator->() const
|
|
||||||
{ return 0; }
|
|
||||||
|
|
||||||
Handle_MeshVS_DataSource& operator=(const MeshVS_DataSource*)
|
|
||||||
{ return *this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _Handle_MeshVS_DataSource_HeaderFile
|
|
@ -1,27 +0,0 @@
|
|||||||
#ifndef _Handle_StlMesh_Mesh_HeaderFile
|
|
||||||
#define _Handle_StlMesh_Mesh_HeaderFile
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
class StlMesh_Mesh;
|
|
||||||
|
|
||||||
class Handle_StlMesh_Mesh
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Handle_StlMesh_Mesh()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
Handle_StlMesh_Mesh(const Handle_StlMesh_Mesh&)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
Handle_StlMesh_Mesh(const StlMesh_Mesh*)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
StlMesh_Mesh* operator->() const
|
|
||||||
{ return NULL; }
|
|
||||||
|
|
||||||
Handle_StlMesh_Mesh& operator=(const StlMesh_Mesh*)
|
|
||||||
{ return *this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _Handle_StlMesh_Mesh_HeaderFile
|
|
@ -1,15 +0,0 @@
|
|||||||
#ifndef _Handle_StlMesh_MeshTriangle_HeaderFile
|
|
||||||
#define _Handle_StlMesh_MeshTriangle_HeaderFile
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
class StlMesh_MeshTriangle;
|
|
||||||
|
|
||||||
class Handle_StlMesh_MeshTriangle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StlMesh_MeshTriangle* operator->() const
|
|
||||||
{ return NULL; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _Handle_StlMesh_MeshTriangle_HeaderFile
|
|
300
tests/fake_support/opencascade/NCollection_Array1.hxx
Normal file
300
tests/fake_support/opencascade/NCollection_Array1.hxx
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
// Created on: 2002-04-15
|
||||||
|
// Created by: Alexander Kartomin (akm)
|
||||||
|
// Copyright (c) 2002-2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef NCollection_Array1_HeaderFile
|
||||||
|
#define NCollection_Array1_HeaderFile
|
||||||
|
|
||||||
|
#include <NCollection_StlIterator.hxx>
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
// *********************************************** Template for Array1 class
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: The class Array1 represents unidimensional arrays
|
||||||
|
* of fixed size known at run time.
|
||||||
|
* The range of the index is user defined.
|
||||||
|
* An array1 can be constructed with a "C array".
|
||||||
|
* This functionality is useful to call methods expecting
|
||||||
|
* an Array1. It allows to carry the bounds inside the arrays.
|
||||||
|
*
|
||||||
|
* Examples: Item tab[100]; // An example with a C array
|
||||||
|
* Array1OfItem ttab (tab[0],1,100);
|
||||||
|
*
|
||||||
|
* Array1OfItem tttab (ttab(10),10,20); // a slice of ttab
|
||||||
|
*
|
||||||
|
* If you want to reindex an array from 1 to Length do :
|
||||||
|
*
|
||||||
|
* Array1 tab1(tab(tab.Lower()),1,tab.Length());
|
||||||
|
*
|
||||||
|
* Warning: Programs client of such a class must be independant
|
||||||
|
* of the range of the first element. Then, a C++ for
|
||||||
|
* loop must be written like this
|
||||||
|
*
|
||||||
|
* for (i = A.Lower(); i <= A.Upper(); i++)
|
||||||
|
*
|
||||||
|
* Changes: In comparison to TCollection the flag isAllocated was
|
||||||
|
* renamed into myDeletable (alike in the Array2). For naming
|
||||||
|
* compatibility the method IsAllocated remained in class along
|
||||||
|
* with IsDeletable.
|
||||||
|
*/
|
||||||
|
template <class TheItemType>
|
||||||
|
class NCollection_Array1
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! STL-compliant typedef for value type
|
||||||
|
typedef TheItemType value_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Implementation of the Iterator interface.
|
||||||
|
class Iterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Empty constructor - for later Init
|
||||||
|
Iterator (void) :
|
||||||
|
myPtrCur (NULL),
|
||||||
|
myPtrEnd (NULL)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Constructor with initialization
|
||||||
|
Iterator (const NCollection_Array1& theArray, Standard_Boolean theToEnd = Standard_False) :
|
||||||
|
myPtrEnd (const_cast<TheItemType*> (&theArray.Last() + 1))
|
||||||
|
{
|
||||||
|
myPtrCur = theToEnd ? myPtrEnd : const_cast<TheItemType*> (&theArray.First());
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Initialisation
|
||||||
|
void Init (const NCollection_Array1& theArray)
|
||||||
|
{
|
||||||
|
myPtrCur = const_cast<TheItemType*> (&theArray.First());
|
||||||
|
myPtrEnd = const_cast<TheItemType*> (&theArray.Last() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Assignment
|
||||||
|
Iterator& operator= (const Iterator& theOther)
|
||||||
|
{
|
||||||
|
myPtrCur = theOther.myPtrCur;
|
||||||
|
myPtrEnd = theOther.myPtrEnd;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Check end
|
||||||
|
Standard_Boolean More (void) const
|
||||||
|
{ return myPtrCur < myPtrEnd; }
|
||||||
|
|
||||||
|
//! Increment operator
|
||||||
|
void Next (void)
|
||||||
|
{ ++myPtrCur; }
|
||||||
|
|
||||||
|
//! Decrement operator
|
||||||
|
void Previous()
|
||||||
|
{ --myPtrCur; }
|
||||||
|
|
||||||
|
//! Offset operator.
|
||||||
|
void Offset (ptrdiff_t theOffset)
|
||||||
|
{ myPtrCur += theOffset; }
|
||||||
|
|
||||||
|
//! Difference operator.
|
||||||
|
ptrdiff_t Differ (const Iterator& theOther) const
|
||||||
|
{ return myPtrCur - theOther.myPtrCur; }
|
||||||
|
|
||||||
|
//! Constant value access
|
||||||
|
const TheItemType& Value (void) const
|
||||||
|
{ return *myPtrCur; }
|
||||||
|
|
||||||
|
//! Variable value access
|
||||||
|
TheItemType& ChangeValue (void) const
|
||||||
|
{ return *myPtrCur; }
|
||||||
|
|
||||||
|
//! Performs comparison of two iterators
|
||||||
|
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||||
|
{ return myPtrCur == theOther.myPtrCur; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
TheItemType* myPtrCur; //!< Pointer to the current element in the array
|
||||||
|
TheItemType* myPtrEnd; //!< Pointer to the past-the-end element in the array
|
||||||
|
}; // End of the nested class Iterator
|
||||||
|
|
||||||
|
//! Shorthand for a regular iterator type.
|
||||||
|
typedef NCollection_StlIterator<std::random_access_iterator_tag, Iterator, TheItemType, false> iterator;
|
||||||
|
|
||||||
|
//! Shorthand for a constant iterator type.
|
||||||
|
typedef NCollection_StlIterator<std::random_access_iterator_tag, Iterator, TheItemType, true> const_iterator;
|
||||||
|
|
||||||
|
//! Returns an iterator pointing to the first element in the array.
|
||||||
|
iterator begin() const { return Iterator (*this, false); }
|
||||||
|
|
||||||
|
//! Returns an iterator referring to the past-the-end element in the array.
|
||||||
|
iterator end() const { return Iterator (*this, true); }
|
||||||
|
|
||||||
|
//! Returns a const iterator pointing to the first element in the array.
|
||||||
|
const_iterator cbegin() const { return Iterator (*this, false); }
|
||||||
|
|
||||||
|
//! Returns a const iterator referring to the past-the-end element in the array.
|
||||||
|
const_iterator cend() const { return Iterator (*this, true); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
// ---------- PUBLIC METHODS ------------
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
NCollection_Array1(const Standard_Integer theLower,
|
||||||
|
const Standard_Integer theUpper) :
|
||||||
|
myLowerBound (theLower),
|
||||||
|
myUpperBound (theUpper),
|
||||||
|
myDeletable (Standard_True)
|
||||||
|
{
|
||||||
|
TheItemType* pBegin = new TheItemType[Length()];
|
||||||
|
|
||||||
|
myData = pBegin - theLower;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Copy constructor
|
||||||
|
NCollection_Array1 (const NCollection_Array1& theOther) :
|
||||||
|
myLowerBound (theOther.Lower()),
|
||||||
|
myUpperBound (theOther.Upper()),
|
||||||
|
myDeletable (Standard_True)
|
||||||
|
{
|
||||||
|
TheItemType* pBegin = new TheItemType[Length()];
|
||||||
|
myData = pBegin - myLowerBound;
|
||||||
|
|
||||||
|
*this = theOther;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! C array-based constructor
|
||||||
|
NCollection_Array1 (const TheItemType& theBegin,
|
||||||
|
const Standard_Integer theLower,
|
||||||
|
const Standard_Integer theUpper) :
|
||||||
|
myLowerBound (theLower),
|
||||||
|
myUpperBound (theUpper),
|
||||||
|
myDeletable (Standard_False)
|
||||||
|
{
|
||||||
|
myData = (TheItemType *) &theBegin - theLower;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Initialise the items with theValue
|
||||||
|
void Init (const TheItemType& theValue)
|
||||||
|
{
|
||||||
|
TheItemType *pCur = &myData[myLowerBound], *pEnd=&myData[myUpperBound];
|
||||||
|
for(; pCur <= pEnd; pCur++)
|
||||||
|
*pCur = (TheItemType&) theValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Size query
|
||||||
|
Standard_Integer Size (void) const
|
||||||
|
{ return Length(); }
|
||||||
|
//! Length query (the same)
|
||||||
|
Standard_Integer Length (void) const
|
||||||
|
{ return (myUpperBound-myLowerBound+1); }
|
||||||
|
|
||||||
|
//! Lower bound
|
||||||
|
Standard_Integer Lower (void) const
|
||||||
|
{ return myLowerBound; }
|
||||||
|
//! Upper bound
|
||||||
|
Standard_Integer Upper (void) const
|
||||||
|
{ return myUpperBound; }
|
||||||
|
|
||||||
|
//! myDeletable flag
|
||||||
|
Standard_Boolean IsDeletable (void) const
|
||||||
|
{ return myDeletable; }
|
||||||
|
|
||||||
|
//! IsAllocated flag - for naming compatibility
|
||||||
|
Standard_Boolean IsAllocated (void) const
|
||||||
|
{ return myDeletable; }
|
||||||
|
|
||||||
|
//! Assignment
|
||||||
|
NCollection_Array1& Assign (const NCollection_Array1& theOther)
|
||||||
|
{
|
||||||
|
if (&theOther == this)
|
||||||
|
return *this;
|
||||||
|
TheItemType * pMyItem = &myData[myLowerBound];
|
||||||
|
TheItemType * const pEndItem = &(theOther.myData)[theOther.myUpperBound];
|
||||||
|
TheItemType * pItem = &(theOther.myData)[theOther.myLowerBound];
|
||||||
|
while (pItem <= pEndItem) * pMyItem ++ = * pItem ++;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Assignment operator
|
||||||
|
NCollection_Array1& operator= (const NCollection_Array1& theOther)
|
||||||
|
{
|
||||||
|
return Assign (theOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! @return first element
|
||||||
|
const TheItemType& First() const
|
||||||
|
{
|
||||||
|
return myData[myLowerBound];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! @return first element
|
||||||
|
TheItemType& ChangeFirst()
|
||||||
|
{
|
||||||
|
return myData[myLowerBound];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! @return last element
|
||||||
|
const TheItemType& Last() const
|
||||||
|
{
|
||||||
|
return myData[myUpperBound];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! @return last element
|
||||||
|
TheItemType& ChangeLast()
|
||||||
|
{
|
||||||
|
return myData[myUpperBound];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Constant value access
|
||||||
|
const TheItemType& Value (const Standard_Integer theIndex) const
|
||||||
|
{
|
||||||
|
return myData[theIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! operator() - alias to Value
|
||||||
|
const TheItemType& operator() (const Standard_Integer theIndex) const
|
||||||
|
{ return Value (theIndex); }
|
||||||
|
|
||||||
|
//! Variable value access
|
||||||
|
TheItemType& ChangeValue (const Standard_Integer theIndex)
|
||||||
|
{
|
||||||
|
return myData[theIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! operator() - alias to ChangeValue
|
||||||
|
TheItemType& operator() (const Standard_Integer theIndex)
|
||||||
|
{ return ChangeValue (theIndex); }
|
||||||
|
|
||||||
|
//! Set value
|
||||||
|
void SetValue (const Standard_Integer theIndex,
|
||||||
|
const TheItemType& theItem)
|
||||||
|
{
|
||||||
|
myData[theIndex] = theItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Destructor - releases the memory
|
||||||
|
~NCollection_Array1 (void)
|
||||||
|
{ if (myDeletable) delete [] &(myData[myLowerBound]); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// ---------- PROTECTED FIELDS -----------
|
||||||
|
Standard_Integer myLowerBound;
|
||||||
|
Standard_Integer myUpperBound;
|
||||||
|
Standard_Boolean myDeletable; //!< Flag showing who allocated the array
|
||||||
|
TheItemType* myData; //!< Pointer to '0'th array item
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
249
tests/fake_support/opencascade/NCollection_StlIterator.hxx
Normal file
249
tests/fake_support/opencascade/NCollection_StlIterator.hxx
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
// Created on: 2014-04-15
|
||||||
|
// Created by: Denis BOGOLEPOV
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef NCollection_StlIterator_HeaderFile
|
||||||
|
#define NCollection_StlIterator_HeaderFile
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
// This file uses C++11 utilities like std::is_base<>, which are not
|
||||||
|
// available in some environments (e.g. MSVC includes them since VS 2008).
|
||||||
|
// Hence here we define our own implementation of these tools in namespace opencascade.
|
||||||
|
// When all compilers support this, this namespace can be removed and replaced by std.
|
||||||
|
namespace opencascade
|
||||||
|
{
|
||||||
|
template<bool Condition, typename T>
|
||||||
|
struct enable_if
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct enable_if<false, T>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T1, typename T2>
|
||||||
|
struct is_same
|
||||||
|
{
|
||||||
|
enum { value = 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_same<T, T>
|
||||||
|
{
|
||||||
|
enum { value = 1 };
|
||||||
|
};
|
||||||
|
|
||||||
|
template<bool Condition, typename TypeTrue, typename TypeFalse>
|
||||||
|
struct conditional
|
||||||
|
{
|
||||||
|
typedef TypeTrue type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename TypeTrue, typename TypeFalse>
|
||||||
|
struct conditional<false, TypeTrue, TypeFalse>
|
||||||
|
{
|
||||||
|
typedef TypeFalse type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Helper class that allows to use NCollection iterators as STL iterators.
|
||||||
|
//! NCollection iterator can be extended to STL iterator of any category by
|
||||||
|
//! adding necessary methods: STL forward iterator requires IsEqual method,
|
||||||
|
//! STL bidirectional iterator requires Previous method, and STL random access
|
||||||
|
//! iterator requires Offset and Differ methods. See NCollection_Vector as
|
||||||
|
//! example of declaring custom STL iterators.
|
||||||
|
template<class Category, class BaseIterator, class ItemType, bool IsConstant>
|
||||||
|
class NCollection_StlIterator :
|
||||||
|
public std::iterator<Category, ItemType, ptrdiff_t,
|
||||||
|
typename opencascade::conditional<IsConstant, const ItemType*, ItemType*>::type,
|
||||||
|
typename opencascade::conditional<IsConstant, const ItemType&, ItemType&>::type>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Default constructor
|
||||||
|
NCollection_StlIterator () {}
|
||||||
|
|
||||||
|
//! Constructor from NCollection iterator
|
||||||
|
NCollection_StlIterator (const BaseIterator& theIterator)
|
||||||
|
: myIterator (theIterator)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//! Cast from non-const variant to const one
|
||||||
|
NCollection_StlIterator (const NCollection_StlIterator<Category, BaseIterator, ItemType, false>& theIterator)
|
||||||
|
: myIterator (theIterator.Iterator())
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//! Assignment of non-const iterator to const one
|
||||||
|
NCollection_StlIterator& operator= (const NCollection_StlIterator<Category, BaseIterator, ItemType, false>& theIterator)
|
||||||
|
{
|
||||||
|
myIterator = theIterator.myIterator;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Access to NCollection iterator instance
|
||||||
|
const BaseIterator& Iterator () const
|
||||||
|
{
|
||||||
|
return myIterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected: //! @name methods related to forward STL iterator
|
||||||
|
|
||||||
|
// Note: Here we use SFINAE (Substitution failure is not an error) to choose
|
||||||
|
// an appropriate method based on template arguments (at instantiation time).
|
||||||
|
|
||||||
|
template<bool Condition>
|
||||||
|
typename opencascade::enable_if<!Condition, ItemType&>::type Reference() const
|
||||||
|
{
|
||||||
|
return myIterator.ChangeValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<bool Condition>
|
||||||
|
typename opencascade::enable_if<Condition, const ItemType&>::type Reference() const
|
||||||
|
{
|
||||||
|
return myIterator.Value();
|
||||||
|
}
|
||||||
|
|
||||||
|
public: //! @name methods related to forward STL iterator
|
||||||
|
|
||||||
|
//! Test for equality
|
||||||
|
bool operator== (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return myIterator.More() == theOther.myIterator.More() &&
|
||||||
|
(!myIterator.More() || myIterator.IsEqual (theOther.myIterator));
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Test for inequality
|
||||||
|
bool operator!= (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return !(*this == theOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Get reference to current item
|
||||||
|
typename NCollection_StlIterator::reference operator*() const
|
||||||
|
{
|
||||||
|
return Reference<IsConstant>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Dereferencing operator
|
||||||
|
typename NCollection_StlIterator::pointer operator->() const
|
||||||
|
{
|
||||||
|
return &Reference<IsConstant>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Prefix increment
|
||||||
|
NCollection_StlIterator& operator++()
|
||||||
|
{
|
||||||
|
myIterator.Next();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Postfix increment
|
||||||
|
NCollection_StlIterator operator++(int)
|
||||||
|
{
|
||||||
|
const NCollection_StlIterator theOld (*this);
|
||||||
|
++(*this);
|
||||||
|
return theOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
public: //! @name methods related to bidirectional STL iterator
|
||||||
|
|
||||||
|
//! Prefix decrement
|
||||||
|
NCollection_StlIterator& operator--()
|
||||||
|
{
|
||||||
|
myIterator.Previous();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Postfix decrement
|
||||||
|
NCollection_StlIterator operator--(int)
|
||||||
|
{
|
||||||
|
NCollection_StlIterator theOld (*this);
|
||||||
|
--(*this);
|
||||||
|
return theOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
public: //! @name methods related to random access STL iterator
|
||||||
|
|
||||||
|
//! Move forward
|
||||||
|
NCollection_StlIterator& operator+= (typename NCollection_StlIterator::difference_type theOffset)
|
||||||
|
{
|
||||||
|
myIterator.Offset (theOffset);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Addition
|
||||||
|
NCollection_StlIterator operator+ (typename NCollection_StlIterator::difference_type theOffset) const
|
||||||
|
{
|
||||||
|
NCollection_StlIterator aTemp (*this);
|
||||||
|
return aTemp += theOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Move backward
|
||||||
|
NCollection_StlIterator& operator-= (typename NCollection_StlIterator::difference_type theOffset)
|
||||||
|
{
|
||||||
|
return *this += -theOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Decrease
|
||||||
|
NCollection_StlIterator operator- (typename NCollection_StlIterator::difference_type theOffset) const
|
||||||
|
{
|
||||||
|
NCollection_StlIterator aTemp (*this);
|
||||||
|
return aTemp += -theOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Difference
|
||||||
|
typename NCollection_StlIterator::difference_type operator- (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return myIterator.Differ (theOther.myIterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Get item at offset from current
|
||||||
|
typename NCollection_StlIterator::reference operator[] (typename NCollection_StlIterator::difference_type theOffset) const
|
||||||
|
{
|
||||||
|
return *(*this + theOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Comparison
|
||||||
|
bool operator< (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return (*this - theOther) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Comparison
|
||||||
|
bool operator> (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return theOther < *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Comparison
|
||||||
|
bool operator<= (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return !(theOther < *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Comparison
|
||||||
|
bool operator>= (const NCollection_StlIterator& theOther) const
|
||||||
|
{
|
||||||
|
return !(*this < theOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! NCollection iterator
|
||||||
|
BaseIterator myIterator;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NCollection_StlIterator_HeaderFile
|
26
tests/fake_support/opencascade/Poly_Array1OfTriangle.hxx
Normal file
26
tests/fake_support/opencascade/Poly_Array1OfTriangle.hxx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Created on: 1995-03-06
|
||||||
|
// Created by: Laurent PAINNOT
|
||||||
|
// Copyright (c) 1995-1999 Matra Datavision
|
||||||
|
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef Poly_Array1OfTriangle_HeaderFile
|
||||||
|
#define Poly_Array1OfTriangle_HeaderFile
|
||||||
|
|
||||||
|
#include <Poly_Triangle.hxx>
|
||||||
|
#include <NCollection_Array1.hxx>
|
||||||
|
|
||||||
|
typedef NCollection_Array1<Poly_Triangle> Poly_Array1OfTriangle;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
13
tests/fake_support/opencascade/Poly_Triangle.hxx
Normal file
13
tests/fake_support/opencascade/Poly_Triangle.hxx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _Poly_Triangle_HeaderFile
|
||||||
|
#define _Poly_Triangle_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
|
||||||
|
class Poly_Triangle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Poly_Triangle() {}
|
||||||
|
void Get(Standard_Integer&, Standard_Integer&, Standard_Integer&) const {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Poly_Triangle_HeaderFile
|
23
tests/fake_support/opencascade/Poly_Triangulation.hxx
Normal file
23
tests/fake_support/opencascade/Poly_Triangulation.hxx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef _Poly_Triangulation_HeaderFile
|
||||||
|
#define _Poly_Triangulation_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
#include <TColgp_Array1OfPnt.hxx>
|
||||||
|
#include <Poly_Array1OfTriangle.hxx>
|
||||||
|
|
||||||
|
class Poly_Triangulation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
|
||||||
|
const Poly_Array1OfTriangle& Triangles() const { return myTriangles; }
|
||||||
|
Standard_Integer NbTriangles() const { return 0; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
TColgp_Array1OfPnt myNodes;
|
||||||
|
Poly_Array1OfTriangle myTriangles;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "generic_handle.h"
|
||||||
|
typedef FakeOcc::GenericHandle<Poly_Triangulation> Handle_Poly_Triangulation;
|
||||||
|
|
||||||
|
#endif // _Poly_Triangulation_HeaderFile
|
26
tests/fake_support/opencascade/TColgp_Array1OfPnt.hxx
Normal file
26
tests/fake_support/opencascade/TColgp_Array1OfPnt.hxx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Created on: 1993-03-10
|
||||||
|
// Created by: Philippe DAUTRY
|
||||||
|
// Copyright (c) 1993-1999 Matra Datavision
|
||||||
|
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef TColgp_Array1OfPnt_HeaderFile
|
||||||
|
#define TColgp_Array1OfPnt_HeaderFile
|
||||||
|
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <NCollection_Array1.hxx>
|
||||||
|
|
||||||
|
typedef NCollection_Array1<gp_Pnt> TColgp_Array1OfPnt;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
26
tests/fake_support/opencascade/TopExp_Explorer.hxx
Normal file
26
tests/fake_support/opencascade/TopExp_Explorer.hxx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef _TopExp_Explorer_HeaderFile
|
||||||
|
#define _TopExp_Explorer_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
|
class TopExp_Explorer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopExp_Explorer() {}
|
||||||
|
TopExp_Explorer(
|
||||||
|
const TopoDS_Shape& /*S*/,
|
||||||
|
const TopAbs_ShapeEnum /*ToFind*/,
|
||||||
|
const TopAbs_ShapeEnum /*ToAvoid*/ = TopAbs_SHAPE)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Standard_Boolean More() const { return Standard_False; }
|
||||||
|
void Next() {}
|
||||||
|
const TopoDS_Shape& Current() const { return myShape; }
|
||||||
|
void ReInit() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
TopoDS_Shape myShape;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _TopExp_Explorer_HeaderFile
|
16
tests/fake_support/opencascade/TopLoc_Location.hxx
Normal file
16
tests/fake_support/opencascade/TopLoc_Location.hxx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef _TopLoc_Location_HeaderFile
|
||||||
|
#define _TopLoc_Location_HeaderFile
|
||||||
|
|
||||||
|
#include <gp_Trsf.hxx>
|
||||||
|
|
||||||
|
class TopLoc_Location
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopLoc_Location() {}
|
||||||
|
const gp_Trsf& Transformation() const { return m_trsf; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
gp_Trsf m_trsf;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _TopLoc_Location_HeaderFile
|
16
tests/fake_support/opencascade/TopoDS.hxx
Normal file
16
tests/fake_support/opencascade/TopoDS.hxx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef _TopoDS_HeaderFile
|
||||||
|
#define _TopoDS_HeaderFile
|
||||||
|
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
|
||||||
|
class TopoDS
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const TopoDS_Face& Face(const TopoDS_Shape&)
|
||||||
|
{
|
||||||
|
static const TopoDS_Face face;
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _TopoDS_HeaderFile
|
12
tests/fake_support/opencascade/TopoDS_Face.hxx
Normal file
12
tests/fake_support/opencascade/TopoDS_Face.hxx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef _TopoDS_Face_HeaderFile
|
||||||
|
#define _TopoDS_Face_HeaderFile
|
||||||
|
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
|
class TopoDS_Face : public TopoDS_Shape
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopoDS_Face() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _TopoDS_Face_HeaderFile
|
38
tests/fake_support/opencascade/TopoDS_Shape.hxx
Normal file
38
tests/fake_support/opencascade/TopoDS_Shape.hxx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#define _TopoDS_Shape_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
|
||||||
|
enum TopAbs_Orientation
|
||||||
|
{
|
||||||
|
TopAbs_FORWARD,
|
||||||
|
TopAbs_REVERSED,
|
||||||
|
TopAbs_INTERNAL,
|
||||||
|
TopAbs_EXTERNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TopAbs_ShapeEnum
|
||||||
|
{
|
||||||
|
TopAbs_COMPOUND,
|
||||||
|
TopAbs_COMPSOLID,
|
||||||
|
TopAbs_SOLID,
|
||||||
|
TopAbs_SHELL,
|
||||||
|
TopAbs_FACE,
|
||||||
|
TopAbs_WIRE,
|
||||||
|
TopAbs_EDGE,
|
||||||
|
TopAbs_VERTEX,
|
||||||
|
TopAbs_SHAPE
|
||||||
|
};
|
||||||
|
|
||||||
|
class TopoDS_Shape
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TopoDS_Shape() : myOrient(TopAbs_FORWARD) {}
|
||||||
|
Standard_Boolean IsNull() const { return Standard_True; }
|
||||||
|
TopAbs_Orientation Orientation() const { return myOrient; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
TopAbs_Orientation myOrient;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _TopoDS_Shape_HeaderFile
|
22
tests/fake_support/opencascade/generic_handle.h
Normal file
22
tests/fake_support/opencascade/generic_handle.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef FAKE_OCC_GENERIC_HANDLE
|
||||||
|
#define FAKE_OCC_GENERIC_HANDLE
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
|
||||||
|
namespace FakeOcc {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class GenericHandle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GenericHandle() { }
|
||||||
|
GenericHandle(const GenericHandle<T>&) { }
|
||||||
|
GenericHandle(const T*) { }
|
||||||
|
Standard_Boolean IsNull() const { return Standard_True; }
|
||||||
|
T* operator->() const { return NULL; }
|
||||||
|
GenericHandle<T>& operator=(const T*) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace FakeOcc
|
||||||
|
|
||||||
|
#endif // FAKE_OCC_GENERIC_HANDLE
|
19
tests/fake_support/opencascade/gp_Pnt.hxx
Normal file
19
tests/fake_support/opencascade/gp_Pnt.hxx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef _gp_Pnt_HeaderFile
|
||||||
|
#define _gp_Pnt_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
#include <gp_XYZ.hxx>
|
||||||
|
#include <gp_Trsf.hxx>
|
||||||
|
|
||||||
|
class gp_Pnt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gp_Pnt() {}
|
||||||
|
const gp_XYZ& XYZ() const { return coord; }
|
||||||
|
void Transform(const gp_Trsf&) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
gp_XYZ coord;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _gp_Pnt_HeaderFile
|
27
tests/fake_support/opencascade/gp_Trsf.hxx
Normal file
27
tests/fake_support/opencascade/gp_Trsf.hxx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef _gp_Trsf_HeaderFile
|
||||||
|
#define _gp_Trsf_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
|
|
||||||
|
enum gp_TrsfForm
|
||||||
|
{
|
||||||
|
gp_Identity,
|
||||||
|
gp_Rotation,
|
||||||
|
gp_Translation,
|
||||||
|
gp_PntMirror,
|
||||||
|
gp_Ax1Mirror,
|
||||||
|
gp_Ax2Mirror,
|
||||||
|
gp_Scale,
|
||||||
|
gp_CompoundTrsf,
|
||||||
|
gp_Other
|
||||||
|
};
|
||||||
|
|
||||||
|
class gp_Trsf
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gp_Trsf() {}
|
||||||
|
Standard_Boolean IsNegative() const { return Standard_False; }
|
||||||
|
gp_TrsfForm Form() const { return gp_Identity; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _gp_Trsf_HeaderFile
|
Loading…
Reference in New Issue
Block a user