Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
65fd0fe
Templated methods in group manager
lelandaisb Oct 15, 2025
200a06b
Template group entity
lelandaisb Oct 17, 2025
813e00e
Group0D to 3D cleaned
lelandaisb Oct 17, 2025
7df5f2e
Group0D to 3D templated
lelandaisb Oct 21, 2025
9be4dff
Reduce GroupHelperForCommand code
lelandaisb Oct 22, 2025
39f2103
Reduce dependencencies Geom --> Group
lelandaisb Oct 24, 2025
c1835d1
Small cleanings in geometry
lelandaisb Oct 28, 2025
8c150bd
Removed unused getIndexOf methods
lelandaisb Oct 30, 2025
c4a80bd
Remove unused files
lelandaisb Oct 30, 2025
1e87339
Remove home made container from topo entities
lelandaisb Oct 31, 2025
9608c6d
Remove home made container for mesh entities
lelandaisb Nov 19, 2025
00450b1
Home made container removed
lelandaisb Nov 19, 2025
2c3ca1e
Code refactoring
lelandaisb Nov 21, 2025
d1f0724
Minor modificiations
lelandaisb Nov 26, 2025
f01b4d6
Modifications due to rebase on main
lelandaisb Nov 27, 2025
77e0354
Remove internalSpecificUndo and internalSpecificRedo methods
lelandaisb Nov 27, 2025
1f6d9e5
Rebase with main
lelandaisb Nov 28, 2025
34135b2
Fix build error in mdl parser
lelandaisb Dec 15, 2025
b27a47a
Sort returns in accessors
lelandaisb Dec 15, 2025
59ba481
Fix bug on CommandMakeBlocksByRevol
lelandaisb Dec 16, 2025
4edd1f1
With unsorted list of entities
lelandaisb Dec 17, 2025
22ccd75
Revert "With unsorted list of entities"
lelandaisb Dec 17, 2025
773768a
Remove getAllVertices from TopoEntity and create visitor
lelandaisb Dec 17, 2025
3f69173
Remove unused operations
lelandaisb Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Core/Geom/CommandCreateGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
#include "Geom/Vertex.h"
#include "Geom/GeomSplitImplementation.h"
#include "Group/GroupManager.h"
#include "Group/Group3D.h"
#include "Group/Group2D.h"
#include "Group/Group1D.h"
#include "Group/Group0D.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/TraceLog.h>
#include <TkUtil/UTF8String.h>
Expand Down
63 changes: 8 additions & 55 deletions src/Core/Geom/CommandEditGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
#include "Geom/Curve.h"
#include "Geom/Vertex.h"
#include "Group/GroupManager.h"
#include "Group/Group3D.h"
#include "Group/Group2D.h"
#include "Group/Group1D.h"
#include "Group/Group0D.h"
#include "Group/GroupEntity.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/TraceLog.h>
#include <TkUtil/UTF8String.h>
Expand Down Expand Up @@ -73,7 +70,6 @@ void CommandEditGeom::internalExecute()
std::vector<GeomEntity*> mod_entities = getKeepedEntities();
std::vector<GeomEntity*> mov_entities = getMovedEntities();
std::vector<GeomEntity*>& rem_entities = getRemovedEntities();
std::map<GeomEntity*,std::vector<GeomEntity*> >& rep_entities = getReplacedEntities();

for(int i=0;i<new_entities.size();i++){
GeomEntity* ge = new_entities[i];
Expand Down Expand Up @@ -106,6 +102,7 @@ void CommandEditGeom::internalExecute()
}

#ifdef _DEBUG2
std::map<GeomEntity*,std::vector<GeomEntity*> >& rep_entities = getReplacedEntities();
for (std::map<GeomEntity*,std::vector<GeomEntity*> >::iterator iter1 = rep_entities.begin();
iter1!=rep_entities.end(); ++iter1){
std::cerr<<"Remplace "<<iter1->first->getName()<<" par";
Expand Down Expand Up @@ -166,8 +163,7 @@ void CommandEditGeom::internalUndo()
// les entités détruites sont dites créées et inversement
getInfoCommand().permCreatedDeleted();

// Annulation de la commande pour les entités dont l'état n'est pas mémorisé (cas des FcetedSurface)
internalSpecificUndo();
if (m_impl) m_impl->performUndo();

log (TkUtil::TraceLog (message, TkUtil::Log::TRACE_1));
}
Expand All @@ -188,8 +184,7 @@ void CommandEditGeom::internalRedo()
// les entités détruites sont dites créées et inversement
getInfoCommand().permCreatedDeleted();

// Rejoue la commande pour les entités dont l'état n'est pas mémorisé (cas des FcetedSurface)
internalSpecificRedo();
if (m_impl) m_impl->performRedo();

startingOrcompletionLog (false);

Expand All @@ -211,52 +206,10 @@ saveMementos(std::map<GeomEntity*,Services::Memento> & candidates)
/*----------------------------------------------------------------------------*/
void CommandEditGeom::copyGroups(GeomEntity* ge1, GeomEntity* ge2)
{
if (ge1->getDim() == 3 && ge2->getDim() == 3){
std::vector<Group::GroupEntity*> grp;
ge1->getGroups(grp);
Volume* res = dynamic_cast<Volume*>(ge2);
for (std::vector<Group::GroupEntity*>::iterator iter = grp.begin();
iter != grp.end(); ++iter){
Group::Group3D* grp = dynamic_cast<Group::Group3D*>(*iter);
if (res && grp && !res->find(grp)){
m_group_helper.addToGroup(grp->getName(), res);
}
}
}
else if (ge1->getDim() == 2 && ge2->getDim() == 2){
std::vector<Group::GroupEntity*> grp;
ge1->getGroups(grp);
Surface* res = dynamic_cast<Surface*>(ge2);
for (std::vector<Group::GroupEntity*>::iterator iter = grp.begin();
iter != grp.end(); ++iter){
Group::Group2D* grp = dynamic_cast<Group::Group2D*>(*iter);
if (res && grp && !res->find(grp)){
m_group_helper.addToGroup(grp->getName(), res);
}
}
}
else if (ge1->getDim() == 1 && ge2->getDim() == 1){
std::vector<Group::GroupEntity*> grp;
ge1->getGroups(grp);
Curve* res = dynamic_cast<Curve*>(ge2);
for (std::vector<Group::GroupEntity*>::iterator iter = grp.begin();
iter != grp.end(); ++iter){
Group::Group1D* grp = dynamic_cast<Group::Group1D*>(*iter);
if (res && grp && !res->find(grp)){
m_group_helper.addToGroup(grp->getName(), res);
}
}
}
else if (ge1->getDim() == 0 && ge2->getDim() == 0){
Vertex* res = dynamic_cast<Vertex*>(ge2);
for (Group::Group0D* grp : res->getGroups()) {
if (res && grp && !res->find(grp)){
m_group_helper.addToGroup(grp->getName(), res);
}
}
}
else {
throw TkUtil::Exception(TkUtil::UTF8String ("Copie des groupes pour une dimension non prévue", TkUtil::Charset::UTF_8));
Group::GroupManager& gm = getContext().getGroupManager();
for (Group::GroupEntity* grp : gm.getGroupsFor(ge1)) {
if (!gm.hasGroupFor(ge2, grp))
m_group_helper.addToGroup(grp->getName(), ge2);
}
}
/*----------------------------------------------------------------------------*/
Expand Down
1 change: 0 additions & 1 deletion src/Core/Geom/CommandExtrudeDirection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "Geom/Surface.h"
#include "Geom/Curve.h"
#include "Geom/Vertex.h"
#include "Group/Group3D.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/Exception.h>
#include <TkUtil/ReferencedMutex.h>
Expand Down
2 changes: 0 additions & 2 deletions src/Core/Geom/CommandExtrudeRevolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "Geom/GeomRevolImplementation.h"
#include "Geom/Curve.h"
#include "Geom/Vertex.h"
#include "Group/Group3D.h"
#include "Group/Group1D.h"
#include "Group/GroupManager.h"
#include "Utils/Rotation.h"
/*----------------------------------------------------------------------------*/
Expand Down
69 changes: 28 additions & 41 deletions src/Core/Geom/CommandExtrusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
#include "Geom/Surface.h"
#include "Geom/Curve.h"
#include "Geom/Vertex.h"
#include "Group/Group3D.h"
#include "Group/Group2D.h"
#include "Group/Group1D.h"
#include "Group/Group0D.h"
#include "Group/GroupEntity.h"
#include "Group/GroupManager.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/MemoryError.h>
Expand Down Expand Up @@ -154,54 +151,48 @@ groups2DTo3D()
// Les nouveaux objets ont été mis "hors groupe" à la création
// On se sert de la correspondance entre les entités initiales et finales
// pour transmetre les groupes de la dimension N à la dimension N+1
Group::GroupManager& gm = getContext().getGroupManager();

for (std::map<Geom::Surface*,Geom::Volume*>::iterator iter = m_s2v.begin();
for (std::map<Geom::Surface*, Geom::Volume*>::iterator iter = m_s2v.begin();
iter != m_s2v.end(); ++iter){
Geom::Surface* surf = iter->first;
Geom::Volume* vol = iter->second;
if (vol){
std::vector<Group::GroupEntity*> grp;
surf->getGroups(grp);

for (uint i=0; i<grp.size(); i++){
std::string nom = grp[i]->getName();
if (nom != getContext().getGroupManager().getDefaultName(2)) {
Group::Group3D* new_grp = m_group_helper.addToGroup(nom, vol);
new_grp->setLevel(grp[i]->getLevel());
for (Group::GroupEntity* grp : gm.getGroupsFor(surf)) {
std::string nom = grp->getName();
if (nom != gm.getDefaultName(2)) {
Group::GroupEntity* new_grp = m_group_helper.addToGroup(nom, vol);
new_grp->setLevel(grp->getLevel());
}
}
}
}

for (std::map<Geom::Curve* ,Geom::Surface*>::iterator iter = m_c2s.begin();
for (std::map<Geom::Curve*, Geom::Surface*>::iterator iter = m_c2s.begin();
iter != m_c2s.end(); ++iter){
Geom::Curve* curve = iter->first;
Geom::Surface* surf = iter->second;
if (surf){
std::vector<Group::GroupEntity*> grp;
curve->getGroups(grp);
for (uint i=0; i<grp.size(); i++){
std::string nom = grp[i]->getName();
if (nom != getContext().getGroupManager().getDefaultName(1)) {
Group::Group2D* new_grp = m_group_helper.addToGroup(nom, surf);
new_grp->setLevel(grp[i]->getLevel());
for (Group::GroupEntity* grp : gm.getGroupsFor(curve)) {
std::string nom = grp->getName();
if (nom != gm.getDefaultName(1)) {
Group::GroupEntity* new_grp = m_group_helper.addToGroup(nom, surf);
new_grp->setLevel(grp->getLevel());
}
}
}
}

for (std::map<Geom::Vertex* ,Geom::Curve*>::iterator iter = m_v2c.begin();
for (std::map<Geom::Vertex*, Geom::Curve*>::iterator iter = m_v2c.begin();
iter != m_v2c.end(); ++iter){
Geom::Vertex* vtx = iter->first;
Geom::Curve* curve = iter->second;
if (curve){
std::vector<Group::GroupEntity*> grp;
vtx->getGroups(grp);
for (uint i=0; i<grp.size(); i++){
std::string nom = grp[i]->getName();
if (nom != getContext().getGroupManager().getDefaultName(0)) {
Group::Group1D* new_grp = m_group_helper.addToGroup(nom, curve);
new_grp->setLevel(grp[i]->getLevel());
for (Group::GroupEntity* grp : gm.getGroupsFor(vtx)) {
std::string nom = grp->getName();
if (nom != gm.getDefaultName(0)) {
Group::GroupEntity* new_grp = m_group_helper.addToGroup(nom, curve);
new_grp->setLevel(grp->getLevel());
}
}
}
Expand All @@ -213,17 +204,17 @@ void CommandExtrusion::prefixGroupsName(const std::string& pre,
std::map<Geom::Curve* ,Geom::Curve*>& c2c,
std::map<Geom::Surface*,Geom::Surface*>& s2s)
{
Group::GroupManager& gm = getContext().getGroupManager();

// le groupe commun pour toutes les surfaces
for (std::map<Geom::Surface*,Geom::Surface*>::iterator iter = s2s.begin();
iter != s2s.end(); ++iter){
Geom::Surface* surf1 = iter->first;
Geom::Surface* surf2 = iter->second;

if (surf2){
std::vector<std::string> gn;
surf1->getGroupsName(gn);
for (uint i=0; i<gn.size(); i++){
std::string& nom = gn[i];
for (Group::GroupEntity* grp : gm.getGroupsFor(surf1)) {
std::string nom = grp->getName();
m_group_helper.addToGroup(pre + "_" + nom, surf2);
}

Expand All @@ -238,10 +229,8 @@ void CommandExtrusion::prefixGroupsName(const std::string& pre,
Geom::Curve* crv2 = iter->second;

if (crv2){
std::vector<std::string> gn;
crv1->getGroupsName(gn);
for (uint i=0; i<gn.size(); i++){
std::string& nom = gn[i];
for (Group::GroupEntity* grp : gm.getGroupsFor(crv1)) {
std::string nom = grp->getName();
m_group_helper.addToGroup(pre + "_" + nom, crv2);
}
}
Expand All @@ -253,10 +242,8 @@ void CommandExtrusion::prefixGroupsName(const std::string& pre,
Geom::Vertex* vtx2 = iter->second;

if (vtx2){
std::vector<std::string> gn;
vtx1->getGroupsName(gn);
for (uint i=0; i<gn.size(); i++){
std::string& nom = gn[i];
for (Group::GroupEntity* grp : gm.getGroupsFor(vtx1)) {
std::string nom = grp->getName();
m_group_helper.addToGroup(pre + "_" + nom, vtx2);
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/Core/Geom/CommandJoinCurves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Geom/Curve.h"
#include "Geom/Surface.h"
#include "Geom/CommandJoinCurves.h"
#include "Group/Group1D.h"
#include "Group/GroupEntity.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/Exception.h>
#include <TkUtil/UTF8String.h>
Expand Down Expand Up @@ -142,10 +142,9 @@ internalSpecificExecute()
m_newEntities.push_back(newCurve);

// reprise des groupes de la première courbe
std::vector<Group::GroupEntity*> grp;
m_entities[0]->getGroups(grp);
for (uint i=0; i<grp.size(); i++){
m_group_helper.addToGroup(grp[i]->getName(), newCurve);
Group::GroupManager& gm = getContext().getGroupManager();
for (Group::GroupEntity* grp : gm.getGroupsFor(m_entities[0])) {
m_group_helper.addToGroup(grp->getName(), newCurve);
}

// destruction des anciennes courbes
Expand Down
9 changes: 4 additions & 5 deletions src/Core/Geom/CommandJoinSurfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Geom/Surface.h"
#include "Geom/Volume.h"
#include "Geom/CommandJoinSurfaces.h"
#include "Group/Group2D.h"
#include "Group/GroupEntity.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/Exception.h>
#include <TkUtil/UTF8String.h>
Expand Down Expand Up @@ -107,10 +107,9 @@ void CommandJoinSurfaces::internalSpecificExecute()
m_newEntities.push_back(newSurface);

// reprise des groupes de la première surface
std::vector<Group::GroupEntity*> grp;
m_entities[0]->getGroups(grp);
for (uint i=0; i<grp.size(); i++){
m_group_helper.addToGroup(grp[i]->getName(), newSurface);
Group::GroupManager& gm = getContext().getGroupManager();
for (Group::GroupEntity* grp : gm.getGroupsFor(m_entities[0])) {
m_group_helper.addToGroup(grp->getName(), newSurface);
}

// destruction des anciennes surfaces
Expand Down
10 changes: 0 additions & 10 deletions src/Core/Geom/CommandMirroring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ void CommandMirroring::internalSpecificPreExecute() {
m_impl->prePerform();
}
/*----------------------------------------------------------------------------*/
void CommandMirroring::internalSpecificUndo()
{
m_impl->performUndo();
}
/*----------------------------------------------------------------------------*/
void CommandMirroring::internalSpecificRedo()
{
m_impl->performRedo();
}
/*----------------------------------------------------------------------------*/
} // end namespace Geom
/*----------------------------------------------------------------------------*/
} // end namespace Mgx3D
Expand Down
1 change: 1 addition & 0 deletions src/Core/Geom/CommandNewArcCircleWithAngles.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*----------------------------------------------------------------------------*/
#include "Geom/CommandNewArcCircleWithAngles.h"
#include "Geom/EntityFactory.h"
#include "SysCoord/SysCoord.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/TraceLog.h>
#include <TkUtil/UTF8String.h>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Geom/CommandRemove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ CommandRemove::~CommandRemove()
if(m_impl)
delete m_impl;
}

/*----------------------------------------------------------------------------*/
void CommandRemove::internalSpecificPreExecute()
{
m_impl->prePerform();
}/*----------------------------------------------------------------------------*/
}
/*----------------------------------------------------------------------------*/
void CommandRemove::
internalSpecificExecute()
{
Expand Down
10 changes: 0 additions & 10 deletions src/Core/Geom/CommandRotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ void CommandRotation::internalSpecificPreExecute()
m_impl->prePerform();
}
/*----------------------------------------------------------------------------*/
void CommandRotation::internalSpecificUndo()
{
m_impl->performUndo();
}
/*----------------------------------------------------------------------------*/
void CommandRotation::internalSpecificRedo()
{
m_impl->performRedo();
}
/*----------------------------------------------------------------------------*/
} // end namespace Geom
/*----------------------------------------------------------------------------*/
} // end namespace Mgx3D
Expand Down
10 changes: 0 additions & 10 deletions src/Core/Geom/CommandScaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,6 @@ void CommandScaling::internalSpecificPreExecute() {
m_impl->prePerform();
}
/*----------------------------------------------------------------------------*/
void CommandScaling::internalSpecificUndo()
{
m_impl->performUndo();
}
/*----------------------------------------------------------------------------*/
void CommandScaling::internalSpecificRedo()
{
m_impl->performRedo();
}
/*----------------------------------------------------------------------------*/
} // end namespace Geom
/*----------------------------------------------------------------------------*/
} // end namespace Mgx3D
Expand Down
5 changes: 1 addition & 4 deletions src/Core/Geom/CommandSectionByPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
#include "Geom/Curve.h"
#include "Geom/Vertex.h"
#include "Group/GroupManager.h"
#include "Group/Group3D.h"
#include "Group/Group2D.h"
#include "Group/Group1D.h"
#include "Group/Group0D.h"
#include "Group/GroupEntity.h"
/*----------------------------------------------------------------------------*/
#include <TkUtil/Exception.h>
#include <TkUtil/ReferencedMutex.h>
Expand Down
Loading