1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0022686: Some Draw commands do not return necessary information in Draw_Interpretor, but write in cout.

This commit is contained in:
VTN 2011-09-02 10:14:02 +00:00 committed by bugmaster
parent 1d07572ce1
commit d2c431925b
3 changed files with 19 additions and 18 deletions

View File

@ -24,7 +24,7 @@
//purpose : Performs checking //purpose : Performs checking
//======================================================================= //=======================================================================
void MeshTest_CheckTopology::Perform () void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
{ {
TopTools_IndexedMapOfShape aMapF; TopTools_IndexedMapOfShape aMapF;
TopTools_IndexedDataMapOfShapeListOfShape aMapEF; TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
@ -107,7 +107,7 @@ void MeshTest_CheckTopology::Perform ()
TopLoc_Location aLoc; TopLoc_Location aLoc;
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc); Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc);
if (aT.IsNull()) { if (aT.IsNull()) {
cout<< "face "<<iF<<" has no triangulation"<<endl; di << "face " <<iF <<" has no triangulation" << "\n";
continue; continue;
} }

View File

@ -10,6 +10,7 @@
#include <NCollection_IndexedDataMap.hxx> #include <NCollection_IndexedDataMap.hxx>
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx> #include <TColStd_SequenceOfReal.hxx>
#include <Draw_Interpretor.hxx>
//! This class checks topology of the mesh presented by //! This class checks topology of the mesh presented by
//! triangulations of faces. //! triangulations of faces.
@ -34,7 +35,7 @@ public:
: myShape(theShape) {} : myShape(theShape) {}
//! performs checking //! performs checking
Standard_EXPORT void Perform(); Standard_EXPORT void Perform(Draw_Interpretor& di);
//! returns the number of faces with free links //! returns the number of faces with free links
Standard_Integer NbFacesWithFL() const Standard_Integer NbFacesWithFL() const

View File

@ -302,7 +302,7 @@ static Standard_Integer triarea (Draw_Interpretor& di, int n, const char ** a)
BRepGProp::SurfaceProperties(shape, props, anEps); BRepGProp::SurfaceProperties(shape, props, anEps);
double aGeomArea = props.Mass(); double aGeomArea = props.Mass();
di << aTriArea << " " << aGeomArea << " "; di << aTriArea << " " << aGeomArea << "\n";
return 0; return 0;
} }
@ -320,7 +320,7 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
// execute check // execute check
MeshTest_CheckTopology aCheck(shape); MeshTest_CheckTopology aCheck(shape);
aCheck.Perform(); aCheck.Perform(di);
// dump info on free links inside the triangulation // dump info on free links inside the triangulation
Standard_Integer nbFree = 0; Standard_Integer nbFree = 0;
@ -330,7 +330,7 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
Standard_Integer nbEdge = aCheck.NbFreeLinks(k); Standard_Integer nbEdge = aCheck.NbFreeLinks(k);
Standard_Integer iF = aCheck.GetFaceNumWithFL(k); Standard_Integer iF = aCheck.GetFaceNumWithFL(k);
nbFree += nbEdge; nbFree += nbEdge;
cout<<"free links of face "<<iF<<endl; di << "free links of face " << iF << "\n";
const TopoDS_Face& aFace = TopoDS::Face(aMapF.FindKey(iF)); const TopoDS_Face& aFace = TopoDS::Face(aMapF.FindKey(iF));
TopLoc_Location aLoc; TopLoc_Location aLoc;
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc); Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc);
@ -342,7 +342,7 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
for (i=1; i <= nbEdge; i++) { for (i=1; i <= nbEdge; i++) {
Standard_Integer n1, n2; Standard_Integer n1, n2;
aCheck.GetFreeLink(k, i, n1, n2); aCheck.GetFreeLink(k, i, n1, n2);
cout<<"{"<<n1<<" "<<n2<<"} "; di << "{" << n1 << " " << n2 << "} ";
pnts(1) = aPoints(n1).Transformed(trsf); pnts(1) = aPoints(n1).Transformed(trsf);
pnts(2) = aPoints(n2).Transformed(trsf); pnts(2) = aPoints(n2).Transformed(trsf);
Handle(Poly_Polygon3D) poly = new Poly_Polygon3D (pnts); Handle(Poly_Polygon3D) poly = new Poly_Polygon3D (pnts);
@ -356,44 +356,44 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
DrawTrSurf::Set (name, pnts2d(1)); DrawTrSurf::Set (name, pnts2d(1));
DrawTrSurf::Set (name, pnts2d(2)); DrawTrSurf::Set (name, pnts2d(2));
} }
cout<<endl; di << "\n";
} }
} }
// dump info on cross face errors // dump info on cross face errors
Standard_Integer nbErr = aCheck.NbCrossFaceErrors(); Standard_Integer nbErr = aCheck.NbCrossFaceErrors();
if (nbErr > 0) { if (nbErr > 0) {
cout<<"cross face errors: {face1, node1, face2, node2, distance}"<<endl; di << "cross face errors: {face1, node1, face2, node2, distance}" << "\n";
for (i=1; i <= nbErr; i++) { for (i=1; i <= nbErr; i++) {
Standard_Integer iF1, n1, iF2, n2; Standard_Integer iF1, n1, iF2, n2;
Standard_Real aVal; Standard_Real aVal;
aCheck.GetCrossFaceError(i, iF1, n1, iF2, n2, aVal); aCheck.GetCrossFaceError(i, iF1, n1, iF2, n2, aVal);
cout<<"{"<<iF1<<" "<<n1<<" "<<iF2<<" "<<n2<<" "<<aVal<<"} "; di << "{" << iF1 << " " << n1 << " " << iF2 << " " << n2 << " " << aVal << "} ";
} }
cout<<endl; di << "\n";
} }
// dump info on edges // dump info on edges
Standard_Integer nbAsync = aCheck.NbAsyncEdges(); Standard_Integer nbAsync = aCheck.NbAsyncEdges();
if (nbAsync > 0) { if (nbAsync > 0) {
cout<<"async edges:"<<endl; di << "async edges:" << "\n";
for (i=1; i <= nbAsync; i++) { for (i=1; i <= nbAsync; i++) {
Standard_Integer ie = aCheck.GetAsyncEdgeNum(i); Standard_Integer ie = aCheck.GetAsyncEdgeNum(i);
cout<<ie<<" "; di << ie << " ";
} }
cout<<endl; di << "\n";
} }
// dump info on free nodes // dump info on free nodes
Standard_Integer nbFreeNodes = aCheck.NbFreeNodes(); Standard_Integer nbFreeNodes = aCheck.NbFreeNodes();
if (nbFreeNodes > 0) { if (nbFreeNodes > 0) {
cout << "free nodes (in pairs: face / node): " << endl; di << "free nodes (in pairs: face / node): " << "\n";
for (i=1; i <= nbFreeNodes; i++) { for (i=1; i <= nbFreeNodes; i++) {
Standard_Integer iface, inode; Standard_Integer iface, inode;
aCheck.GetFreeNodeNum(i, iface, inode); aCheck.GetFreeNodeNum(i, iface, inode);
cout << "{" << iface << " " << inode << "} "; di << "{" << iface << " " << inode << "} ";
} }
cout << endl; di << "\n";
} }
// output errors summary to DRAW // output errors summary to DRAW
@ -401,6 +401,6 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a)
di << "Free_links " << nbFree di << "Free_links " << nbFree
<< " Cross_face_errors " << nbErr << " Cross_face_errors " << nbErr
<< " Async_edges " << nbAsync << " Async_edges " << nbAsync
<< " Free_nodes " << nbFreeNodes << " "; << " Free_nodes " << nbFreeNodes << "\n";
return 0; return 0;
} }