-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
- const TopoDS_Face & FF,
- const TopoDS_Wire & WW, R2 * uvslf, int &m,
- map<int, const SMDS_MeshNode*>&mefistoToDS)
-{
- MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
-
- SMDS_Mesh * meshDS = aMesh.GetMeshDS();
-
- double scalex;
- double scaley;
- TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
- ComputeScaleOnFace(aMesh, F, scalex, scaley);
-
- TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
- BRepTools_WireExplorer wexp(W, F);
- for (wexp.Init(W, F); wexp.More(); wexp.Next())
- {
- 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_NodeIteratorPtr lid=
- aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode* idFirst = lid->next();
-
- ASSERT(!VLast.IsNull());
- lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode* idLast = lid->next();
-
- // --- 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_NodeIteratorPtr 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().get());
- double param = epos->GetUParameter();
- params[param] = node;
- }
- // --- 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++;
- }
- }
- }
-}