@@ -113,6 +113,7 @@ void ImportMDLImplementation::performGeom(Internal::InfoCommand* icmd)
113113 bool isFiltered = getFilter (filter);
114114
115115 // les surfaces
116+ Group::GroupManager& gm = m_context.getGroupManager ();
116117 for (std::vector<const T_MdlCommand*>::const_iterator iter = m_vCmdArea.begin (); iter!=m_vCmdArea.end (); ++iter){
117118 const T_MdlCommand& current_command = **iter;
118119
@@ -137,25 +138,24 @@ void ImportMDLImplementation::performGeom(Internal::InfoCommand* icmd)
137138 id_grp++;
138139 if (!m_prefixName.empty ())
139140 name = m_prefixName + name;
140- Group::Group1D* group = m_context. getGroupManager (). getNewGroup1D (name, icmd);
141+ Group::Group1D* group = gm. getNewGroup <Group::Group1D> (name, icmd);
141142 if (id_grp == 1 )
142143 group->setLevel (2 );
143144 else
144145 group->setLevel (3 );
145146 if (!group->find (crv)){
146147 // il faut peut-être enlever le groupe par défaut
147- if (crv-> getNbGroups () == 1 ){
148- std::vector<std::string> gn;
149- crv-> getGroupsName (gn) ;
150- if (gn[ 0 ] == m_context. getGroupManager () .getDefaultName (1 )){
151- Group::Group1D* grp = m_context. getGroupManager (). getGroup1D (gn[ 0 ], icmd );
148+ std::vector<Group::GroupEntity*> crv_groups = gm. getGroupsFor (crv);
149+ if (crv_groups. size () == 1 ){
150+ Group::GroupEntity* grp = crv_groups[ 0 ] ;
151+ if (grp-> getName () == gm .getDefaultName (1 )){
152+ gm. removeGroupFor (crv, grp );
152153 grp->remove (crv);
153- crv->remove (grp);
154- icmd->addGroupInfoEntity (grp,Internal::InfoCommand::DISPMODIFIED);
154+ icmd->addGroupInfoEntity (grp, Internal::InfoCommand::DISPMODIFIED);
155155 }
156156 }
157157
158- crv-> add ( group);
158+ gm. addGroupFor (crv, group);
159159 group->add (crv);
160160 }
161161 }
@@ -197,12 +197,12 @@ void ImportMDLImplementation::performGeom(Internal::InfoCommand* icmd)
197197 id_grp++;
198198 if (!m_prefixName.empty ())
199199 name = m_prefixName + name;
200- Group::Group2D* group = m_context. getGroupManager (). getNewGroup2D (name, icmd);
200+ Group::Group2D* group = gm. getNewGroup <Group::Group2D> (name, icmd);
201201 if (id_grp == 1 )
202202 group->setLevel (2 );
203203 else
204204 group->setLevel (3 );
205- surf-> add ( group);
205+ gm. addGroupFor (surf, group);
206206 group->add (surf);
207207 }
208208 }
@@ -215,9 +215,9 @@ void ImportMDLImplementation::performGeom(Internal::InfoCommand* icmd)
215215 std::string nomDef = current_command.name .str ();
216216 if (!m_prefixName.empty ())
217217 nomDef = m_prefixName + nomDef;
218- Group::Group2D* group = m_context. getGroupManager (). getNewGroup2D (nomDef, icmd);
218+ Group::Group2D* group = gm. getNewGroup <Group::Group2D> (nomDef, icmd);
219219 group->setLevel (1 );
220- surf-> add ( group);
220+ gm. addGroupFor (surf, group);
221221 group->add (surf);
222222 }
223223
@@ -246,12 +246,12 @@ void ImportMDLImplementation::performGeom(Internal::InfoCommand* icmd)
246246 id_grp++;
247247 if (!m_prefixName.empty ())
248248 name = m_prefixName + name;
249- Group::Group0D* group = m_context. getGroupManager (). getNewGroup0D (name, icmd);
249+ Group::Group0D* group = gm. getNewGroup <Group::Group0D> (name, icmd);
250250 if (id_grp == 1 )
251251 group->setLevel (2 );
252252 else
253253 group->setLevel (3 );
254- v-> add ( group);
254+ gm. addGroupFor (v, group);
255255 group->add (v);
256256 }
257257 }
@@ -592,14 +592,15 @@ MAJInterpolated(std::vector<Topo::CoEdge*>& coedges, Topo::CoFace* coface)
592592Geom::Vertex* ImportMDLImplementation::getVertex (uint ptId)
593593{
594594 Geom::Vertex* vtx = m_cor_ptId_vertex[ptId];
595+ Group::GroupManager& gm = m_context.getGroupManager ();
595596
596597 if (!vtx){
597598 const T_MdlCommand& command_pt = *m_vCmdPt[ptId];
598599 vtx = Geom::EntityFactory (m_context).newVertex (Utils::Math::Point (command_pt.u .point .cd .x1 ,command_pt.u .point .cd .x2 , 0.0 )*m_scale_factor);
599600 m_newGeomEntities.push_back (vtx);
600601 m_cor_ptId_vertex[ptId] = vtx;
601- Group::Group0D* group = m_context. getGroupManager (). getNewGroup0D (" " , m_icmd);
602- vtx-> add ( group);
602+ Group::Group0D* group = gm. getNewGroup <Group::Group0D> (" " , m_icmd);
603+ gm. addGroupFor (vtx, group);
603604 group->add (vtx);
604605 }
605606
@@ -619,6 +620,7 @@ Geom::Vertex* ImportMDLImplementation::getVertex(uint ptId)
619620Geom::Curve* ImportMDLImplementation::getCurve (const std::string name)
620621{
621622 Geom::Curve* crv = m_cor_name_curve[name];
623+ Group::GroupManager& gm = m_context.getGroupManager ();
622624
623625 if (!crv){
624626 T_MdlCommand* ptr_current_command = m_cor_name_mdlCmd[name];
@@ -744,9 +746,9 @@ Geom::Curve* ImportMDLImplementation::getCurve(const std::string name)
744746 m_newGeomEntities.push_back (vtx1);
745747 m_newGeomEntities.push_back (vtx2);
746748
747- Group::Group0D* group = m_context. getGroupManager (). getNewGroup0D (" " , m_icmd);
748- vtx1-> add ( group);
749- vtx2-> add ( group);
749+ Group::Group0D* group = gm. getNewGroup <Group::Group0D> (" " , m_icmd);
750+ gm. addGroupFor (vtx1, group);
751+ gm. addGroupFor (vtx2, group);
750752 group->add (vtx1);
751753 group->add (vtx2);
752754
@@ -764,8 +766,8 @@ Geom::Curve* ImportMDLImplementation::getCurve(const std::string name)
764766 m_newGeomEntities.push_back (crv);
765767 m_cor_name_curve[name] = crv;
766768
767- Group::Group1D* group = m_context. getGroupManager (). getNewGroup1D (" " , m_icmd);
768- crv-> add ( group);
769+ Group::Group1D* group = gm. getNewGroup <Group::Group1D> (" " , m_icmd);
770+ gm. addGroupFor (crv, group);
769771 group->add (crv);
770772 }
771773 }
0 commit comments