Skip to content

Commit 507df6b

Browse files
committed
Small cleanings in geometry
1 parent a3ec816 commit 507df6b

File tree

10 files changed

+76
-144
lines changed

10 files changed

+76
-144
lines changed

src/Core/Geom/Curve.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ namespace Mgx3D {
3131
/*----------------------------------------------------------------------------*/
3232
namespace Geom {
3333
/*----------------------------------------------------------------------------*/
34-
const char* Curve::typeNameGeomCurve = "GeomCurve";
35-
/*----------------------------------------------------------------------------*/
3634
Curve::Curve(Internal::Context& ctx, Utils::Property* prop, Utils::DisplayProperties* disp,
3735
GeomProperty* gprop, TopoDS_Edge& shape)
3836
:GeomEntity(ctx, prop, disp, gprop)

src/Core/Geom/Surface_Geom.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@
2727
namespace Mgx3D {
2828
/*----------------------------------------------------------------------------*/
2929
namespace Geom {
30-
/*----------------------------------------------------------------------------*/
31-
const char* Surface::typeNameGeomSurface = "GeomSurface";
32-
33-
/*----------------------------------------------------------------------------*/
34-
//void Surface::add(TopoDS_Edge e)
35-
//{m_occ_edges.push_back(e);}
36-
///*----------------------------------------------------------------------------*/
37-
//std::vector<TopoDS_Edge> Surface::getEdges()
38-
//{return m_occ_edges;}
39-
4030
/*----------------------------------------------------------------------------*/
4131
Surface::Surface(Internal::Context& ctx, Utils::Property* prop,
4232
Utils::DisplayProperties* disp,

src/Core/Geom/Vertex_Geom.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ namespace Mgx3D {
2020
/*----------------------------------------------------------------------------*/
2121
namespace Geom {
2222
/*----------------------------------------------------------------------------*/
23-
const char* Vertex::typeNameGeomVertex = "GeomVertex";
24-
/*----------------------------------------------------------------------------*/
2523
Vertex::Vertex(Internal::Context& ctx, Utils::Property* prop, Utils::DisplayProperties* disp,
2624
GeomProperty* gprop, TopoDS_Vertex& shape)
2725
: GeomEntity(ctx, prop, disp, gprop)

src/Core/Geom/Volume_Geom.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ namespace Mgx3D {
2020
/*----------------------------------------------------------------------------*/
2121
namespace Geom {
2222
/*----------------------------------------------------------------------------*/
23-
const char* Volume::typeNameGeomVolume = "GeomVolume";
24-
/*----------------------------------------------------------------------------*/
2523
Volume::Volume(Internal::Context& ctx, Utils::Property* prop, Utils::DisplayProperties* disp,
2624
GeomProperty* gprop, TopoDS_Shape& shape)
2725
: GeomEntity(ctx, prop, disp, gprop)

src/Core/Group/GroupEntity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*----------------------------------------------------------------------------*/
21
#include "Group/GroupEntity.h"
32
#include "Group/GroupEntityVisitor.h"
43
#include "Internal/Context.h"
54
#include "Mesh/MeshModificationItf.h"
5+
#include "Services/DescriptionService.h"
66
/*----------------------------------------------------------------------------*/
77
#include <TkUtil/Exception.h>
88
/*----------------------------------------------------------------------------*/

src/Core/protected/Geom/Curve.h

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <sys/types.h> // CP : uint sur Bull
77
/*----------------------------------------------------------------------------*/
88
#include "Geom/GeomEntity.h"
9-
#include "Geom/GeomProperty.h"
109
#include "Services/MementoService.h"
1110
#include "Utils/Point.h"
1211
#include "Utils/Vector.h"
@@ -16,8 +15,6 @@
1615
namespace Mgx3D {
1716
/*----------------------------------------------------------------------------*/
1817
namespace Geom {
19-
20-
class GeomProperty;
2118
/*----------------------------------------------------------------------------*/
2219
/**
2320
* \class Curve
@@ -27,7 +24,6 @@ class GeomProperty;
2724
class Curve: public GeomEntity {
2825

2926
friend class Services::MementoService;
30-
static const char* typeNameGeomCurve;
3127

3228
public:
3329

@@ -57,42 +53,42 @@ class Curve: public GeomEntity {
5753

5854
const std::vector<TopoDS_Edge>& getOCCEdges() const { return m_occ_edges; }
5955

60-
virtual void apply(std::function<void(const TopoDS_Shape&)> const& lambda) const;
61-
virtual void applyAndReturn(std::function<TopoDS_Shape(const TopoDS_Shape&)> const& lambda);
62-
virtual void accept(ConstGeomEntityVisitor& v) const { v.visit(this); }
63-
virtual void accept(GeomEntityVisitor& v) { v.visit(this); }
56+
void apply(std::function<void(const TopoDS_Shape&)> const& lambda) const override;
57+
void applyAndReturn(std::function<TopoDS_Shape(const TopoDS_Shape&)> const& lambda) override;
58+
void accept(ConstGeomEntityVisitor& v) const override{ v.visit(this); }
59+
void accept(GeomEntityVisitor& v) override { v.visit(this); }
6460

6561
/*------------------------------------------------------------------------*/
6662
/** \brief Crée une copie (avec allocation mémoire, appel à new) de l'objet
6763
* courant.
6864
*/
69-
virtual GeomEntity* clone(Internal::Context&);
65+
GeomEntity* clone(Internal::Context&) override;
7066

7167
/*------------------------------------------------------------------------*/
7268
/** \brief Destructeur
7369
*/
7470
virtual ~Curve() = default;
7571

76-
virtual bool isEqual(Geom::Curve* curve);
72+
bool isEqual(Geom::Curve* curve);
7773

7874
/*------------------------------------------------------------------------*/
7975
/** \brief retourne la dimension de l'entité géométrique
8076
*/
81-
virtual int getDim() const {return 1;}
77+
int getDim() const override { return 1; }
8278

8379
/*------------------------------------------------------------------------*/
8480
/** \brief Calcule l'aire d'une entité: Pour une courbe, c'est la
8581
* longueur, pour une surface, l'aire, pour un volume le volume.
8682
*/
87-
virtual double computeArea() const;
83+
double computeArea() const override;
8884

8985
/*------------------------------------------------------------------------*/
9086
/** \brief Calcul de la boite englobante orientée selon les axes Ox,Oy,Oz
9187
*
9288
* \param pmin Les coordonnées min de la boite englobante
9389
* \param pmax Les coordonnées max de la boite englobante
9490
*/
95-
virtual void computeBoundingBox(Utils::Math::Point& pmin, Utils::Math::Point& pmax) const;
91+
void computeBoundingBox(Utils::Math::Point& pmin, Utils::Math::Point& pmax) const override;
9692

9793
/*------------------------------------------------------------------------*/
9894
/** \brief Donne le point en fonction du paramètre sur la courbe
@@ -200,23 +196,18 @@ class Curve: public GeomEntity {
200196
*
201197
* \param liste d'entity
202198
*/
203-
virtual void addAllDownLevelEntity(std::list<GeomEntity*>& l_entity) const;
199+
void addAllDownLevelEntity(std::list<GeomEntity*>& l_entity) const;
204200

205201
/*------------------------------------------------------------------------*/
206202
/** \brief retourne un point sur l'objet au centre si possible
207203
* \author Eric Brière de l'Isle
208204
*/
209-
virtual Utils::Math::Point getCenteredPosition() const;
210-
211-
/*------------------------------------------------------------------------*/
212-
/** \brief Donne le nom du type d'objet (un nom distinct par type d'objet)
213-
*/
214-
virtual std::string getTypeName() const {return typeNameGeomCurve;}
205+
Utils::Math::Point getCenteredPosition() const override;
215206

216207
/*------------------------------------------------------------------------*/
217208
/** \brief Donne le type de l'objet
218209
*/
219-
virtual Utils::Entity::objectType getType() const {return Utils::Entity::GeomCurve;}
210+
Utils::Entity::objectType getType() const override { return Utils::Entity::GeomCurve; }
220211

221212
/*------------------------------------------------------------------------*/
222213
/** \brief Donne le nom court du type d'objet (pour le nommage des entités)

src/Core/protected/Geom/GeomEntity.h

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#define MGX3D_GEOM_GEOMENTITY_H_
33
/*----------------------------------------------------------------------------*/
44
#include <set>
5-
#include <vector>
6-
#include <functional>
75
/*----------------------------------------------------------------------------*/
86
#include <TopoDS_Shape.hxx>
97
/*----------------------------------------------------------------------------*/
@@ -13,27 +11,15 @@
1311
#include "Utils/Point.h"
1412
#include "Geom/GeomProperty.h"
1513
#include "Geom/GeomEntityVisitor.h"
16-
#include "Services/DescriptionService.h"
1714
/*----------------------------------------------------------------------------*/
1815
#include <gmds/math/Triangle.h>
1916
/*----------------------------------------------------------------------------*/
20-
namespace Mgx3D {
21-
/*----------------------------------------------------------------------------*/
2217
/*!
2318
* \namespace Mgx3D::Geom
2419
*
2520
* \brief Espace de nom des classes associées à la géométrie
26-
*
27-
*
2821
*/
29-
namespace Geom {
30-
/*----------------------------------------------------------------------------*/
31-
class Volume;
32-
class Surface;
33-
class Curve;
34-
class Vertex;
35-
class GeomProperty;
36-
class MementoEntity;
22+
namespace Mgx3D::Geom {
3723
/*----------------------------------------------------------------------------*/
3824
/** \enum Orientation gives a list of orientation option for geometric
3925
* entities.
@@ -52,7 +38,7 @@ class MementoEntity;
5238
* sommets, courbes, surfaces et volumes géométriques.
5339
*
5440
*/
55-
class GeomEntity : public Internal::InternalEntity{
41+
class GeomEntity : public Internal::InternalEntity {
5642
protected:
5743
/*------------------------------------------------------------------------*/
5844
/** \brief Constructeur. Une entité délègue un certain nombre de calculs
@@ -74,9 +60,7 @@ class GeomEntity : public Internal::InternalEntity{
7460
/** \brief Crée une copie (avec allocation mémoire, appel à new) de l'objet
7561
* courant.
7662
*/
77-
virtual GeomEntity* clone(Internal::Context&){
78-
throw TkUtil::Exception (TkUtil::UTF8String ("GeomEntity::clone pas implementee.", TkUtil::Charset::UTF_8));
79-
};
63+
virtual GeomEntity* clone(Internal::Context&) = 0;
8064

8165
/*------------------------------------------------------------------------*/
8266
/** \brief Destructeur
@@ -100,7 +84,7 @@ class GeomEntity : public Internal::InternalEntity{
10084
/** \brief Calcule l'aire d'une entité: Pour une courbe, c'est la
10185
* longueur, pour une surface, l'aire, pour un volume le volume.
10286
*/
103-
virtual double computeArea() const =0;
87+
virtual double computeArea() const = 0;
10488

10589
/*------------------------------------------------------------------------*/
10690
/** \brief Retourne l'aire d'une entité: Pour une courbe, c'est la
@@ -111,9 +95,7 @@ class GeomEntity : public Internal::InternalEntity{
11195
/** \brief Stocke l'aire d'une entité: Pour une courbe, c'est la
11296
* longueur, pour une surface, l'aire, pour un volume le volume.
11397
*/
114-
virtual void setArea(double area)
115-
{m_computedArea = area;}
116-
98+
void setArea(double area) { m_computedArea = area; }
11799
void forceComputeArea() { m_computedAreaIsUpToDate = false; }
118100

119101
/*------------------------------------------------------------------------*/
@@ -128,7 +110,7 @@ class GeomEntity : public Internal::InternalEntity{
128110
/** \brief retourne un point sur l'objet au centre si possible
129111
* \author Eric Brière de l'Isle
130112
*/
131-
virtual Utils::Math::Point getCenteredPosition() const =0;
113+
virtual Utils::Math::Point getCenteredPosition() const = 0;
132114

133115
/*------------------------------------------------------------------------*/
134116
/** \brief Fournit l'accès à la propriété de l'entité géométrique
@@ -164,6 +146,12 @@ class GeomEntity : public Internal::InternalEntity{
164146
*/
165147
virtual void setDestroyed(bool b);
166148

149+
/*------------------------------------------------------------------------*/
150+
/** \brief Donne le nom du type d'objet (un nom distinct par type d'objet)
151+
*
152+
*/
153+
std::string getTypeName() const override { return objectTypeToObjectTypeName(getType()); }
154+
167155
private:
168156
/// Propriétés géométriques (qui peut être spécifique, PropertyBox par exemple)
169157
GeomProperty* m_geomProp;
@@ -173,12 +161,8 @@ class GeomEntity : public Internal::InternalEntity{
173161

174162
/// résultat de la commande computeArea, qui peut être longue
175163
mutable double m_computedArea;
176-
177164
};
178165
/*----------------------------------------------------------------------------*/
179-
} // end namespace Geom
180-
/*----------------------------------------------------------------------------*/
181-
} // end namespace Mgx3D
166+
} // end namespace Mgx3D::Geom
182167
/*----------------------------------------------------------------------------*/
183168
#endif /* MGX3D_GEOM_GEOMENTITY_H_ */
184-
/*----------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)