- // --- edge internal IDNodes (relies on good order storage, not checked)
-
- int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
- //SCRUTE(nbPoints);
-
- Standard_Real f,l;
- Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l);
-
- const TColStd_ListOfInteger& indElt
- = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes();
- TColStd_ListIteratorOfListOfInteger ite(indElt);
- //SCRUTE(nbPoints);
- //SCRUTE(indElt.Extent());
- ASSERT(nbPoints == indElt.Extent());
- bool isForward = (E.Orientation() == TopAbs_FORWARD);
- map<double,int> params;
- for (; ite.More(); ite.Next())
- {
- int nodeId = ite.Value();
- Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId);
- Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt);
- Handle (SMDS_EdgePosition) epos
- = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition());
- double param = epos->GetUParameter();
- params[param] = nodeId;
-// MESSAGE(" " << param << " " << params[param]);
- }
-
- // --- load 2D values into MEFISTO structure,
- // add IDNodes in mefistoToDS map
-
- if (E.Orientation() == TopAbs_FORWARD)
- {
- gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
- uvslf [m].x = scalex * p.X();
- uvslf [m].y = scaley * p.Y();
- mefistoToDS[m+1] = idFirst;
- //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
- //MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- map<double,int>::iterator itp = params.begin();
- for (Standard_Integer i = 1; i<=nbPoints; i++) // nbPoints internal
- {
- double param = (*itp).first;
- gp_Pnt2d p = C2d->Value(param);
- uvslf [m].x = scalex * p.X();
- uvslf [m].y = scaley * p.Y();
- mefistoToDS[m+1] = (*itp).second;
-// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
-// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- itp++;
- }
+ // --- edge internal IDNodes (relies on good order storage, not checked)
+
+ int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+ //SCRUTE(nbPoints);
+
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+
+ const vector<int> & indElt
+ = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes();
+
+ ASSERT(nbPoints == indElt.size());
+ bool isForward = (E.Orientation() == TopAbs_FORWARD);
+ map < double, int >params;
+ for (int ite=0; ite<indElt.size(); ite++)
+ {
+ int nodeId = indElt[ite];
+ const SMDS_MeshNode * node = meshDS->FindNode(nodeId);
+ const SMDS_EdgePosition* epos
+ = static_cast<const SMDS_EdgePosition*>(node->GetPosition());
+ double param = epos->GetUParameter();
+ params[param] = nodeId;
+ }
+
+ // --- load 2D values into MEFISTO structure,
+ // add IDNodes in mefistoToDS map
+
+ if (E.Orientation() == TopAbs_FORWARD)
+ {
+ gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
+ uvslf[m].x = scalex * p.X();
+ uvslf[m].y = scaley * p.Y();
+ mefistoToDS[m + 1] = idFirst;
+ //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+ //MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ map < double, int >::iterator itp = params.begin();
+ for (int i = 1; i <= nbPoints; i++) // nbPoints internal
+ {
+ double param = (*itp).first;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[m].x = scalex * p.X();
+ uvslf[m].y = scaley * p.Y();
+ mefistoToDS[m + 1] = (*itp).second;
+// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ itp++;
+ }
+ }
+ else
+ {
+ gp_Pnt2d p = C2d->Value(l); // last point = Vertex Reversed
+ uvslf[m].x = scalex * p.X();
+ uvslf[m].y = scaley * p.Y();
+ mefistoToDS[m + 1] = idLast;
+// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+// MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ map < double, int >::reverse_iterator itp = params.rbegin();
+ for (int i = nbPoints; i >= 1; i--)
+ {
+ double param = (*itp).first;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[m].x = scalex * p.X();
+ uvslf[m].y = scaley * p.Y();
+ mefistoToDS[m + 1] = (*itp).second;
+// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ itp++;
+ }
+ }