fake_support/opencascade: simplify Handle and array classes

This commit is contained in:
Hugues Delorme 2016-04-25 17:17:39 +02:00
parent 1b2c4e945e
commit cbfd3b438f
9 changed files with 43 additions and 53 deletions

View File

@ -81,10 +81,11 @@ struct gmio_stl_occmesh_iterator
explicit gmio_stl_occmesh_iterator(const StlMesh_Mesh* mesh); explicit gmio_stl_occmesh_iterator(const StlMesh_Mesh* mesh);
explicit gmio_stl_occmesh_iterator(const Handle_StlMesh_Mesh& hnd); explicit gmio_stl_occmesh_iterator(const Handle_StlMesh_Mesh& hnd);
inline const StlMesh_Mesh* mesh() const;
bool move_to_next_tri(uint32_t tri_id); bool move_to_next_tri(uint32_t tri_id);
inline const Handle_StlMesh_MeshTriangle& domain_tri(uint32_t tri_id) const; inline const Handle_StlMesh_MeshTriangle& domain_tri(uint32_t tri_id) const;
inline const TColgp_SequenceOfXYZ& domain_vertices() const; inline const TColgp_SequenceOfXYZ& domain_vertices() const;
inline const StlMesh_Mesh* mesh() const;
private: private:
void init(const StlMesh_Mesh* mesh); void init(const StlMesh_Mesh* mesh);

View File

@ -66,10 +66,11 @@ struct gmio_stl_occmesh_datasource_iterator
explicit gmio_stl_occmesh_datasource_iterator(const MeshVS_DataSource* data_src); explicit gmio_stl_occmesh_datasource_iterator(const MeshVS_DataSource* data_src);
explicit gmio_stl_occmesh_datasource_iterator(const Handle_MeshVS_DataSource& hnd); explicit gmio_stl_occmesh_datasource_iterator(const Handle_MeshVS_DataSource& hnd);
inline const MeshVS_DataSource* data_src() const;
inline void move_to_next_tri(); inline void move_to_next_tri();
inline int current_element_key() const; inline int current_element_key() const;
inline TColStd_Array1OfReal& cached_element_coords(); inline TColStd_Array1OfReal& cached_element_coords();
inline const MeshVS_DataSource* data_src() const;
private: private:
const MeshVS_DataSource* m_data_src; const MeshVS_DataSource* m_data_src;

View File

@ -4,7 +4,7 @@
#include "../../src/gmio_support/stream_cpp.h" #include "../../src/gmio_support/stream_cpp.h"
#include <QtCore/QFile> #include <QtCore/QFile>
#include <Handle_StlMesh_Mesh.hxx> #include <StlMesh_Mesh.hxx>
#include <fstream> #include <fstream>
int main() int main()

View File

@ -2,8 +2,7 @@
#define _MeshVS_DataSource_HeaderFile #define _MeshVS_DataSource_HeaderFile
#include "Standard_TypeDef.hxx" #include "Standard_TypeDef.hxx"
#include "Handle_MeshVS_DataSource.hxx" #include "TColStd_Array1OfReal.hxx"
class TColStd_Array1OfReal;
class TColStd_PackedMapOfInteger; class TColStd_PackedMapOfInteger;
typedef enum typedef enum
@ -41,4 +40,7 @@ public:
{ return 0; } { return 0; }
}; };
#include "generic_handle.h"
typedef FakeOcc::GenericHandle<MeshVS_DataSource> Handle_MeshVS_DataSource;
#endif // _MeshVS_DataSource_HeaderFile #endif // _MeshVS_DataSource_HeaderFile

View File

@ -1,7 +1,6 @@
#ifndef _StlMesh_Mesh_HeaderFile #ifndef _StlMesh_Mesh_HeaderFile
#define _StlMesh_Mesh_HeaderFile #define _StlMesh_Mesh_HeaderFile
#include <Handle_StlMesh_Mesh.hxx>
#include <StlMesh_SequenceOfMeshTriangle.hxx> #include <StlMesh_SequenceOfMeshTriangle.hxx>
#include <TColgp_SequenceOfXYZ.hxx> #include <TColgp_SequenceOfXYZ.hxx>
@ -11,8 +10,7 @@ public:
StlMesh_Mesh() StlMesh_Mesh()
{ } { }
virtual void AddDomain() virtual void AddDomain() { }
{ }
virtual int AddTriangle( virtual int AddTriangle(
const int /*V1*/, const int /*V2*/, const int /*V3*/, const int /*V1*/, const int /*V2*/, const int /*V3*/,
@ -23,11 +21,9 @@ public:
const double /*X*/, const double /*Y*/, const double /*Z*/) const double /*X*/, const double /*Y*/, const double /*Z*/)
{ return -1; } { return -1; }
virtual int NbTriangles(const int /*DomainIndex*/) const virtual int NbTriangles(const int /*DomainIndex*/) const { return 0; }
{ return 0; }
virtual int NbDomains() const virtual int NbDomains() const { return 0; }
{ return 0; }
virtual const StlMesh_SequenceOfMeshTriangle& Triangles( virtual const StlMesh_SequenceOfMeshTriangle& Triangles(
const int /*DomainIndex = 1*/) const const int /*DomainIndex = 1*/) const
@ -44,4 +40,7 @@ public:
} }
}; };
#include "generic_handle.h"
typedef FakeOcc::GenericHandle<StlMesh_Mesh> Handle_StlMesh_Mesh;
#endif // _StlMesh_Mesh_HeaderFile #endif // _StlMesh_Mesh_HeaderFile

View File

@ -1,8 +1,6 @@
#ifndef _StlMesh_MeshTriangle_HeaderFile #ifndef _StlMesh_MeshTriangle_HeaderFile
#define _StlMesh_MeshTriangle_HeaderFile #define _StlMesh_MeshTriangle_HeaderFile
#include <Handle_StlMesh_MeshTriangle.hxx>
class StlMesh_MeshTriangle class StlMesh_MeshTriangle
{ {
public: public:
@ -12,4 +10,7 @@ public:
{ } { }
}; };
#include "generic_handle.h"
typedef FakeOcc::GenericHandle<StlMesh_MeshTriangle> Handle_StlMesh_MeshTriangle;
#endif // _StlMesh_MeshTriangle_HeaderFile #endif // _StlMesh_MeshTriangle_HeaderFile

View File

@ -1,7 +1,7 @@
#ifndef _StlMesh_SequenceOfMeshTriangle_HeaderFile #ifndef _StlMesh_SequenceOfMeshTriangle_HeaderFile
#define _StlMesh_SequenceOfMeshTriangle_HeaderFile #define _StlMesh_SequenceOfMeshTriangle_HeaderFile
#include <Handle_StlMesh_MeshTriangle.hxx> #include <StlMesh_MeshTriangle.hxx>
class StlMesh_SequenceOfMeshTriangle class StlMesh_SequenceOfMeshTriangle
{ {

View File

@ -1,34 +1,23 @@
#ifndef _TColStd_Array1OfReal_HeaderFile // Copyright (c) 1998-1999 Matra Datavision
#define _TColStd_Array1OfReal_HeaderFile // 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.
class TColStd_Array1OfReal #ifndef TColStd_Array1OfReal_HeaderFile
{ #define TColStd_Array1OfReal_HeaderFile
public:
TColStd_Array1OfReal(const int, const int) {}
int Length() const { return 0; } #include <Standard_TypeDef.hxx>
int Lower() const { return 1; } #include <NCollection_Array1.hxx>
int Upper() const { return 1; }
void SetValue (const int, const double&) {} typedef NCollection_Array1<Standard_Real> TColStd_Array1OfReal;
const double& Value(const int) const #endif
{
static const double v = 0;
return v;
}
const double& operator()(const int Index) const
{ return Value(Index); }
double& ChangeValue(const int)
{
static double v = 0;
return v;
}
double& operator()(const int Index)
{ return ChangeValue(Index); }
};
#endif // _TColStd_Array1OfReal_HeaderFile

View File

@ -1,17 +1,14 @@
#ifndef _gp_XYZ_HeaderFile #ifndef _gp_XYZ_HeaderFile
#define _gp_XYZ_HeaderFile #define _gp_XYZ_HeaderFile
#include <Standard_TypeDef.hxx>
class gp_XYZ class gp_XYZ
{ {
public: public:
double X() const Standard_Real X() const { return 0.; }
{ return 0.; } Standard_Real Y() const { return 0.; }
Standard_Real Z() const { return 0.; }
double Y() const
{ return 0.; }
double Z() const
{ return 0.; }
}; };
#endif // _gp_XYZ_HeaderFile #endif // _gp_XYZ_HeaderFile