Skip to content

Commit 22ebc07

Browse files
committed
Group0D to 3D cleaned
1 parent 1969988 commit 22ebc07

31 files changed

+281
-522
lines changed

src/Core/Geom/EntityFactory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "Utils/Vector.h"
1616
#include "Utils/MgxException.h"
1717
#include "Utils/MgxNumeric.h"
18+
#include "SysCoord/SysCoord.h"
1819
/*----------------------------------------------------------------------------*/
1920
#include <TkUtil/MemoryError.h>
2021
/*----------------------------------------------------------------------------*/

src/Core/Geom/GeomEntity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ getRepresentation(Utils::DisplayRepresentation& dr, bool checkDestroyed) const
9292
pts[i] = (barycentre + (pts[i] - barycentre) * shrink);
9393
}
9494
/*----------------------------------------------------------------------------*/
95-
Mgx3D::Utils::SerializedRepresentation* GeomEntity::getDescription (bool alsoComputed) const
95+
Utils::SerializedRepresentation* GeomEntity::getDescription (bool alsoComputed) const
9696
{
9797
return Services::DescriptionService::getDescription(this, alsoComputed);
9898
}

src/Core/Group/CommandAddMeshModification.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
/*----------------------------------------------------------------------------*/
2-
/*
3-
* \file CommandAddMeshModification.cpp
4-
*
5-
* \author Eric Brière de l'Isle
6-
*
7-
* \date 5 déc. 2013
8-
*/
9-
/*----------------------------------------------------------------------------*/
102
#include "Group/CommandAddMeshModification.h"
113
#include "Group/GroupEntity.h"
124
#include "Utils/Command.h"

src/Core/Group/Group0D.cpp

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,23 @@
1-
/*----------------------------------------------------------------------------*/
21
#include "Group/Group0D.h"
32
#include "Internal/Context.h"
4-
#include "Internal/EntitiesHelper.h"
5-
#include "Geom/Vertex.h"
6-
#include "Utils/SerializedRepresentation.h"
7-
/*----------------------------------------------------------------------------*/
8-
namespace Mgx3D {
93
/*----------------------------------------------------------------------------*/
10-
namespace Group {
4+
namespace Mgx3D::Group {
115
/*----------------------------------------------------------------------------*/
126
const char* Group0D::typeNameGroup0D = "Group0D";
137
/*----------------------------------------------------------------------------*/
14-
Group0D::Group0D(Internal::Context& ctx,
15-
const std::string & nom,
16-
bool isDefaultGroup,
17-
uint level)
18-
: GroupEntity (ctx,
19-
ctx.newProperty(Utils::Entity::Group0D, nom),
20-
ctx.newDisplayProperties(Utils::Entity::Group0D),
21-
isDefaultGroup, level)
22-
{
23-
}
24-
/*----------------------------------------------------------------------------*/
25-
Group0D::~Group0D()
8+
Group0D::Group0D(
9+
Internal::Context& ctx,
10+
const std::string & nom,
11+
bool isDefaultGroup,
12+
uint level)
13+
: GroupEntity(
14+
ctx,
15+
ctx.newProperty(Utils::Entity::Group0D, nom),
16+
ctx.newDisplayProperties(Utils::Entity::Group0D),
17+
isDefaultGroup,
18+
level)
2619
{
2720
}
2821
/*----------------------------------------------------------------------------*/
29-
Utils::SerializedRepresentation* Group0D::
30-
getDescription (bool alsoComputed) const
31-
{
32-
std::unique_ptr<Utils::SerializedRepresentation> description (
33-
GroupEntity::getDescription (alsoComputed));
34-
35-
std::vector<Geom::Vertex*> vertices = getFilteredEntities<Geom::Vertex>();
36-
if (!vertices.empty()){
37-
Utils::SerializedRepresentation sr ("Sommets géométriques",
38-
TkUtil::NumericConversions::toStr(vertices.size()));
39-
for (Geom::Vertex* v : vertices)
40-
sr.addProperty(Utils::SerializedRepresentation::Property(v->getName(), *v));
41-
description->addPropertiesSet (sr);
42-
}
43-
44-
std::vector<Topo::Vertex*> topo_vertices = getFilteredEntities<Topo::Vertex>();
45-
if (!topo_vertices.empty()){
46-
Utils::SerializedRepresentation sr ("Sommets topologiques",
47-
TkUtil::NumericConversions::toStr(topo_vertices.size()));
48-
for (Topo::Vertex* v : topo_vertices)
49-
sr.addProperty(Utils::SerializedRepresentation::Property(v->getName(), *v));
50-
description->addPropertiesSet (sr);
51-
}
52-
53-
return description.release ( );
54-
}
55-
/*----------------------------------------------------------------------------*/
56-
} // end namespace Group
57-
/*----------------------------------------------------------------------------*/
58-
} // end namespace Mgx3D
22+
} // end namespace Mgx3D::Group
5923
/*----------------------------------------------------------------------------*/

src/Core/Group/Group1D.cpp

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,23 @@
1-
/*----------------------------------------------------------------------------*/
21
#include "Group/Group1D.h"
32
#include "Internal/Context.h"
4-
#include "Internal/EntitiesHelper.h"
5-
#include "Geom/Curve.h"
6-
#include "Utils/SerializedRepresentation.h"
7-
/*----------------------------------------------------------------------------*/
8-
namespace Mgx3D {
93
/*----------------------------------------------------------------------------*/
10-
namespace Group {
4+
namespace Mgx3D::Group {
115
/*----------------------------------------------------------------------------*/
126
const char* Group1D::typeNameGroup1D = "Group1D";
137
/*----------------------------------------------------------------------------*/
14-
Group1D::Group1D(Internal::Context& ctx,
15-
const std::string & nom,
16-
bool isDefaultGroup, uint level)
17-
: GroupEntity (ctx,
18-
ctx.newProperty(Utils::Entity::Group1D, nom),
19-
ctx.newDisplayProperties(Utils::Entity::Group1D),
20-
isDefaultGroup, level)
21-
{
22-
}
23-
/*----------------------------------------------------------------------------*/
24-
Group1D::~Group1D()
8+
Group1D::Group1D(
9+
Internal::Context& ctx,
10+
const std::string & nom,
11+
bool isDefaultGroup,
12+
uint level)
13+
: GroupEntity (
14+
ctx,
15+
ctx.newProperty(Utils::Entity::Group1D, nom),
16+
ctx.newDisplayProperties(Utils::Entity::Group1D),
17+
isDefaultGroup,
18+
level)
2519
{
2620
}
2721
/*----------------------------------------------------------------------------*/
28-
Utils::SerializedRepresentation* Group1D::
29-
getDescription (bool alsoComputed) const
30-
{
31-
std::unique_ptr<Utils::SerializedRepresentation> description (
32-
GroupEntity::getDescription (alsoComputed));
33-
34-
std::vector<Geom::Curve*> curves = getFilteredEntities<Geom::Curve>();
35-
if (!curves.empty()){
36-
Utils::SerializedRepresentation sr ("Courbes géométriques",
37-
TkUtil::NumericConversions::toStr(curves.size()));
38-
for (Geom::Curve* curve : curves)
39-
sr.addProperty(Utils::SerializedRepresentation::Property(curve->getName(), *curve));
40-
description->addPropertiesSet(sr);
41-
}
42-
43-
std::vector<Topo::CoEdge*> coedges = getFilteredEntities<Topo::CoEdge>();
44-
if (!coedges.empty()){
45-
Utils::SerializedRepresentation sr ("Arêtes topologiques",
46-
TkUtil::NumericConversions::toStr(coedges.size()));
47-
for (Topo::CoEdge* coedge : coedges)
48-
sr.addProperty(Utils::SerializedRepresentation::Property(coedge->getName(), *coedge));
49-
description->addPropertiesSet(sr);
50-
}
51-
52-
return description.release ( );
53-
}
54-
/*----------------------------------------------------------------------------*/
55-
} // end namespace Group
56-
/*----------------------------------------------------------------------------*/
57-
} // end namespace Mgx3D
22+
} // end namespace Mgx3D::Group
5823
/*----------------------------------------------------------------------------*/

src/Core/Group/Group2D.cpp

Lines changed: 14 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,23 @@
1-
/*----------------------------------------------------------------------------*/
2-
#include "Group/Group2D.h"
1+
#include "Group/Group0D.h"
32
#include "Internal/Context.h"
4-
#include "Internal/EntitiesHelper.h"
5-
#include "Geom/Surface.h"
6-
#include "Utils/SerializedRepresentation.h"
7-
#include "Mesh/Surface.h"
8-
/*----------------------------------------------------------------------------*/
9-
namespace Mgx3D {
103
/*----------------------------------------------------------------------------*/
11-
namespace Group {
4+
namespace Mgx3D::Group {
125
/*----------------------------------------------------------------------------*/
136
const char* Group2D::typeNameGroup2D = "Group2D";
147
/*----------------------------------------------------------------------------*/
15-
Group2D::Group2D(Internal::Context& ctx,
16-
const std::string & nom,
17-
bool isDefaultGroup,
18-
uint level)
19-
: GroupEntity (ctx,
20-
ctx.newProperty(Utils::Entity::Group2D, nom),
21-
ctx.newDisplayProperties(Utils::Entity::Group2D),
22-
isDefaultGroup, level)
23-
{
24-
}
25-
/*----------------------------------------------------------------------------*/
26-
Group2D::~Group2D()
8+
Group2D::Group2D(
9+
Internal::Context& ctx,
10+
const std::string & nom,
11+
bool isDefaultGroup,
12+
uint level)
13+
: GroupEntity(
14+
ctx,
15+
ctx.newProperty(Utils::Entity::Group2D, nom),
16+
ctx.newDisplayProperties(Utils::Entity::Group2D),
17+
isDefaultGroup,
18+
level)
2719
{
2820
}
2921
/*----------------------------------------------------------------------------*/
30-
Utils::SerializedRepresentation* Group2D::
31-
getDescription (bool alsoComputed) const
32-
{
33-
std::unique_ptr<Utils::SerializedRepresentation> description (
34-
GroupEntity::getDescription (alsoComputed));
35-
36-
std::vector<Geom::Surface*> surfaces = getFilteredEntities<Geom::Surface>();
37-
if (!surfaces.empty()){
38-
Utils::SerializedRepresentation sr ("Surfaces géométriques",
39-
TkUtil::NumericConversions::toStr(surfaces.size()));
40-
for (Geom::Surface* surface : surfaces)
41-
sr.addProperty(Utils::SerializedRepresentation::Property(surface->getName(), *surface));
42-
description->addPropertiesSet(sr);
43-
}
44-
45-
std::vector<Topo::CoFace*> cofaces = getFilteredEntities<Topo::CoFace>();
46-
if (!cofaces.empty()){
47-
Utils::SerializedRepresentation sr ("Faces topologiques",
48-
TkUtil::NumericConversions::toStr(cofaces.size()));
49-
for (Topo::CoFace* coface : cofaces)
50-
sr.addProperty(Utils::SerializedRepresentation::Property(coface->getName ( ), *coface));
51-
description->addPropertiesSet(sr);
52-
}
53-
54-
// recherche du Mesh::Surface associé (suivant le nom)
55-
Mesh::Surface* msurf = getContext().getMeshManager().getSurface(getName(), false);
56-
if (msurf){
57-
Utils::SerializedRepresentation sr ("Surface maillage", std::string("1"));
58-
sr.addProperty(Utils::SerializedRepresentation::Property (msurf->getName(), *msurf));
59-
description->addPropertiesSet(sr);
60-
} else {
61-
description->addProperty (Utils::SerializedRepresentation::Property(
62-
"Surface maillage", std::string("Aucune")));
63-
}
64-
65-
return description.release ( );
66-
}
67-
/*----------------------------------------------------------------------------*/
68-
} // end namespace Group
69-
/*----------------------------------------------------------------------------*/
70-
} // end namespace Mgx3D
22+
} // end namespace Mgx3D::Group
7123
/*----------------------------------------------------------------------------*/

src/Core/Group/Group3D.cpp

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,23 @@
1-
/*----------------------------------------------------------------------------*/
2-
#include "Group/Group3D.h"
1+
#include "Group/Group0D.h"
32
#include "Internal/Context.h"
4-
#include "Internal/EntitiesHelper.h"
5-
#include "Geom/Volume.h"
6-
#include "Mesh/Volume.h"
7-
#include "Utils/SerializedRepresentation.h"
8-
/*----------------------------------------------------------------------------*/
9-
#include <TkUtil/WarningLog.h>
10-
/*----------------------------------------------------------------------------*/
11-
namespace Mgx3D {
123
/*----------------------------------------------------------------------------*/
13-
namespace Group {
4+
namespace Mgx3D::Group {
145
/*----------------------------------------------------------------------------*/
156
const char* Group3D::typeNameGroup3D = "Group3D";
167
/*----------------------------------------------------------------------------*/
17-
Group3D::Group3D(Internal::Context& ctx,
18-
const std::string & nom,
19-
bool isDefaultGroup, uint level)
20-
: GroupEntity (ctx,
21-
ctx.newProperty(Utils::Entity::Group3D, nom),
22-
ctx.newDisplayProperties(Utils::Entity::Group3D),
23-
isDefaultGroup, level)
24-
{
25-
}
26-
/*----------------------------------------------------------------------------*/
27-
Group3D::~Group3D()
8+
Group3D::Group3D(
9+
Internal::Context& ctx,
10+
const std::string & nom,
11+
bool isDefaultGroup,
12+
uint level)
13+
: GroupEntity(
14+
ctx,
15+
ctx.newProperty(Utils::Entity::Group3D, nom),
16+
ctx.newDisplayProperties(Utils::Entity::Group3D),
17+
isDefaultGroup,
18+
level)
2819
{
2920
}
3021
/*----------------------------------------------------------------------------*/
31-
Utils::SerializedRepresentation* Group3D::
32-
getDescription (bool alsoComputed) const
33-
{
34-
std::unique_ptr<Utils::SerializedRepresentation> description (
35-
GroupEntity::getDescription (alsoComputed));
36-
37-
std::vector<Geom::Volume*> volumes = getFilteredEntities<Geom::Volume>();
38-
if (!volumes.empty()){
39-
Utils::SerializedRepresentation sr ("Volumes géométriques",
40-
TkUtil::NumericConversions::toStr(volumes.size()));
41-
for (Geom::Volume* vol : volumes)
42-
sr.addProperty(Utils::SerializedRepresentation::Property(vol->getName ( ), *vol));
43-
description->addPropertiesSet(sr);
44-
}
45-
46-
std::vector<Topo::Block*> blocks = getFilteredEntities<Topo::Block>();
47-
if (!blocks.empty()){
48-
Utils::SerializedRepresentation sr ("Blocs topologiques",
49-
TkUtil::NumericConversions::toStr(blocks.size()));
50-
for (Topo::Block* b : blocks)
51-
sr.addProperty(Utils::SerializedRepresentation::Property(b->getName ( ), *b));
52-
description->addPropertiesSet(sr);
53-
}
54-
55-
// recherche du Mesh::Volume associé (suivant le nom)
56-
Mesh::Volume* mvol = getContext().getMeshManager().getVolume(getName(), false);
57-
if (mvol){
58-
Utils::SerializedRepresentation sr ("Volume maillage", std::string("1"));
59-
sr.addProperty(Utils::SerializedRepresentation::Property (mvol->getName(), *mvol));
60-
description->addPropertiesSet(sr);
61-
} else {
62-
description->addProperty(Utils::SerializedRepresentation::Property(
63-
"Volume maillage", std::string("Aucun")));
64-
}
65-
66-
std::vector<CoordinateSystem::SysCoord*> scs = getFilteredEntities<CoordinateSystem::SysCoord>();
67-
if (!scs.empty()){
68-
Utils::SerializedRepresentation sr ("Repères",
69-
TkUtil::NumericConversions::toStr(scs.size()));
70-
for (CoordinateSystem::SysCoord* sc : scs)
71-
sr.addProperty(Utils::SerializedRepresentation::Property(sc->getName(), *sc));
72-
description->addPropertiesSet(sr);
73-
}
74-
75-
return description.release ( );
76-
}
77-
/*----------------------------------------------------------------------------*/
78-
} // end namespace Group
79-
/*----------------------------------------------------------------------------*/
80-
} // end namespace Mgx3D
22+
} // end namespace Mgx3D::Group
8123
/*----------------------------------------------------------------------------*/

src/Core/Group/GroupEntity.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ GroupEntity::GroupEntity(Internal::Context& ctx,
2323
#endif
2424
}
2525
/*----------------------------------------------------------------------------*/
26-
GroupEntity::~GroupEntity()
27-
{
28-
#ifdef _DEBUG2
29-
std::cout<<"GroupEntity::~GroupEntity() de "<<getName()<<std::endl;
30-
#endif
31-
}
32-
/*----------------------------------------------------------------------------*/
3326
void GroupEntity::setDestroyed(bool b)
3427
{
3528
// cas sans changement
@@ -52,23 +45,7 @@ void GroupEntity::getRepresentation(Utils::DisplayRepresentation& dr, bool check
5245
Utils::SerializedRepresentation* GroupEntity::
5346
getDescription (bool alsoComputed) const
5447
{
55-
std::unique_ptr<Mgx3D::Utils::SerializedRepresentation> description (
56-
InternalEntity::getDescription (alsoComputed));
57-
58-
description->addProperty(Utils::SerializedRepresentation::Property ("Niveau", (long)getLevel()));
59-
60-
if (!m_meshModif.empty()){
61-
Utils::SerializedRepresentation modification (
62-
"Modification du maillage", "");
63-
for (std::vector<Mesh::MeshModificationItf*>::const_iterator iter = m_meshModif.begin();
64-
iter != m_meshModif.end(); ++iter)
65-
66-
(*iter)->addToDescription(&modification);
67-
68-
description->addPropertiesSet(modification);
69-
}
70-
71-
return description.release ( );
48+
return Services::DescriptionService::getDescription(this, alsoComputed);
7249
}
7350
/*----------------------------------------------------------------------------*/
7451
void GroupEntity::remove(Utils::Entity* e, const bool exceptionIfNotFound)

0 commit comments

Comments
 (0)