- 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 (Standard_Integer 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++;
- }
+ const TopoDS_Edge & E = wexp.Current();
+
+ // --- IDNodes of first and last Vertex
+
+ TopoDS_Vertex VFirst, VLast;
+ TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
+
+ ASSERT(!VFirst.IsNull());
+ SMDS_Iterator<const SMDS_MeshNode *> * lid=
+ aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+ const SMDS_MeshNode* idFirst = lid->next();
+ delete lid;
+
+ ASSERT(!VLast.IsNull());
+ lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+ const SMDS_MeshNode* idLast = lid->next();
+ delete lid;
+
+ // --- 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);
+
+ SMDS_Iterator<const SMDS_MeshNode *> * ite=
+ aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+
+ bool isForward = (E.Orientation() == TopAbs_FORWARD);
+ map<double, const SMDS_MeshNode*> params;
+
+ while(ite->more())
+ {
+ const SMDS_MeshNode * node = ite->next();
+ const SMDS_EdgePosition* epos
+ = static_cast<const SMDS_EdgePosition*>(node->GetPosition());
+ double param = epos->GetUParameter();
+ params[param] = node;
+ }
+ delete ite;
+ // --- 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, const SMDS_MeshNode*>::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, const SMDS_MeshNode*>::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++;
+ }
+ }