From b0d96eb7539b3f1f54249ad68f4b22d9eacd3b1e Mon Sep 17 00:00:00 2001 From: abv Date: Thu, 2 Feb 2017 16:22:33 +0300 Subject: [PATCH] 0028403: Avoid useless calls to BRepTools::Write() Useless writes of intermediate shapes to hardcoded paths are removed in samples\mfc\standard\02_Modeling\src\ModelingDoc.cpp Methods IGESBRep::WriteShape(), XSControl_Utils::WriteShape() are deleted; BRepTools::Write() can be used instead. Method TopOpeBRepBuild_Tools::DumpMapOfShapeWithState() is moved to where it is used -- TopOpeBRepBuild_Builder1_1.cxx as static function (commented out). Unused DRAW command OCC18612 is removed. Upgrade Guide is corrected to avoid Doxygen warnings. --- dox/dev_guides/upgrade/upgrade.md | 6 +- .../standard/02_Modeling/src/ModelingDoc.cpp | 10 - src/IGESToBRep/IGESToBRep.cxx | 24 -- src/IGESToBRep/IGESToBRep.hxx | 36 -- src/QABugs/QABugs_11.cxx | 307 ------------------ .../TopOpeBRepBuild_Builder1_1.cxx | 116 ++++++- src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx | 110 ------- src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.hxx | 2 - src/XSControl/XSControl_Utils.cxx | 20 -- src/XSControl/XSControl_Utils.hxx | 17 - src/XSDRAW/FILES | 1 - src/XSDRAW/XSDRAW_Commands.hxx | 25 -- src/XSDRAWIGES/XSDRAWIGES.cxx | 48 ++- 13 files changed, 151 insertions(+), 571 deletions(-) delete mode 100644 src/XSDRAW/XSDRAW_Commands.hxx diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index 710c9d8de2..2654c04619 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -950,7 +950,7 @@ The related classes, e.g. *AIS_LocalContext*, and methods ( AIS_InteractiveCo The main functionality provided by Local Context - selection of object subparts - can be now used within Neutral Point without opening any Local Context. -The property *::SelectionMode()* has been removed from the class *AIS_InteractiveObject*. +The property *SelectionMode()* has been removed from the class *AIS_InteractiveObject*. This property contradicts to selection logic, since it is allowed to activate several Selection modes at once. Therefore keeping one selection mode as object field makes no sense. Applications that used this method should implement selection mode caching at application level, if it is necessary for some reason. @@ -1120,7 +1120,7 @@ The following classes have been changed: @subsection upgrade_720_removed Removed features The following obsolete features have been removed: -* *AIS_InteractiveContext::PreSelectionColor()*, *::DefaultColor()*, *::WasCurrentTouched()*, *::ZDetection()*. +* *AIS_InteractiveContext::PreSelectionColor()*, *DefaultColor()*, *WasCurrentTouched()*, *ZDetection()*. These properties were unused, and therefore application should remove occurrences of these methods. * *AIS_InteractiveObject::SelectionPriority()*. These property was not implemented. @@ -1170,7 +1170,7 @@ Management of highlight attributes has been revised and might require modificati * Since Highlight and Selection styles within *AIS_InteractiveContext* are now defined by *Prs3d_Drawer* inheriting from *Graphic3d_PresentationAttributes*, it is now possible to customize default highlight attributes like *Display Mode* and *ZLayer*, which previously could be defined only on Object level. * Properties *Prs3d_Drawer::HighlightStyle()* and *Prs3d_Drawer::SelectionStyle()* have been removed. - Instead, *AIS_InteractiveObject* now defines *::DynamicHilightAttributes()* for dynamic highlighting in addition to *::HilightAttributes()* used for highlighting in selected state. + Instead, *AIS_InteractiveObject* now defines *DynamicHilightAttributes()* for dynamic highlighting in addition to *HilightAttributes()* used for highlighting in selected state. * The following protected fields have been removed from class *AIS_InteractiveObject*: - *myOwnColor*, replaced by *myDrawer->Color()* - *myTransparency*, replaced by *myDrawer->Transparency()* diff --git a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp index ee0b7140b4..36c2ff5659 100755 --- a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp +++ b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp @@ -2504,7 +2504,6 @@ void CModelingDoc::OnSplitLocal() asect.Approximation(Standard_True); asect.Build(); TopoDS_Shape R = asect.Shape(); - BRepTools::Write(R,"E:\\temp\\R"); BRepFeat_SplitShape asplit(S); @@ -3143,9 +3142,6 @@ void CModelingDoc::OnFace() PinkFace = BRepBuilderAPI_MakeFace(aFace,Wire1); BRepLib::BuildCurves3d(PinkFace); - BRepTools::Write(PinkFace,"E:\\temp\\PinkFace.rle"); - - /////////////Display Handle(AIS_Shape) white = new AIS_Shape(WhiteFace); myAISContext->SetColor(white,Quantity_NOC_WHITE,Standard_False); @@ -3758,8 +3754,6 @@ void CModelingDoc::OnBuilder() B.Add(FXMAX,W); - BRepTools::Write(FXMAX,"E:\\temp\\f1.rle"); - //Face FXMIN P = new Geom_Plane(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(-1,0,0),gp_Dir(0,0,1))); B.MakeFace(FXMIN,P,precision); @@ -3937,9 +3931,6 @@ void CModelingDoc::OnBuilder() FYMAX.Orientation(TopAbs_REVERSED); - BRepTools::Write(FZMIN,"E:\\temp\\f3.rle"); - BRepTools::Write(FYMAX,"E:\\temp\\f2.rle"); - //Shell TopoDS_Shell Sh; B.MakeShell(Sh); @@ -3955,7 +3946,6 @@ void CModelingDoc::OnBuilder() B.MakeSolid(Sol); B.Add(Sol,Sh); - BRepTools::Write(Sol,"e://temp//solid"); Handle(AIS_Shape) borne = new AIS_Shape(Sol); myAISContext->SetDisplayMode (borne, 1, Standard_False); myAISContext->SetColor (borne, Quantity_NOC_RED, Standard_False); diff --git a/src/IGESToBRep/IGESToBRep.cxx b/src/IGESToBRep/IGESToBRep.cxx index c8b0493a63..f6629248ae 100644 --- a/src/IGESToBRep/IGESToBRep.cxx +++ b/src/IGESToBRep/IGESToBRep.cxx @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -78,12 +77,6 @@ #include #include -#include -/* Just used for WriteShape */ -//:21 -// ========================= -// == Selection Members == -// ========================= static Handle(IGESToBRep_AlgoContainer) theContainer; //======================================================================= @@ -247,23 +240,6 @@ Standard_Boolean IGESToBRep::IsBRepEntity(const Handle(IGESData_IGESEntity)& sta return Standard_False; } -//======================================================================= -//function : WriteShape -//purpose : Creates a file Shape_'number' -//======================================================================= -void IGESToBRep::WriteShape(const TopoDS_Shape& shape, - const Standard_Integer number) -{ - char fname[110]; - sprintf(fname, "Shape_%d",number); - ofstream f(fname,ios::out); - cout << "Output file name : " << fname << endl; - f << "DBRep_DrawableShape\n"; - - BRepTools::Write(shape, f); - f.close(); -} - //======================================================================= //function : IGESCurveToSequenceOfIGESCurve //purpose : Creates a sequence of IGES curves from IGES curve: diff --git a/src/IGESToBRep/IGESToBRep.hxx b/src/IGESToBRep/IGESToBRep.hxx index 15e464bc57..4c27108f2e 100644 --- a/src/IGESToBRep/IGESToBRep.hxx +++ b/src/IGESToBRep/IGESToBRep.hxx @@ -97,46 +97,10 @@ public: //! 502, 504, 508, 510, 514, 186. Standard_EXPORT static Standard_Boolean IsBRepEntity (const Handle(IGESData_IGESEntity)& start); - //! Creates a file Shape_'number' with the shape being - //! able to be restored by Draw. - Standard_EXPORT static void WriteShape (const TopoDS_Shape& shape, const Standard_Integer number); - Standard_EXPORT static Standard_Integer IGESCurveToSequenceOfIGESCurve (const Handle(IGESData_IGESEntity)& curve, Handle(TColStd_HSequenceOfTransient)& sequence); Standard_EXPORT static Standard_Boolean TransferPCurve (const TopoDS_Edge& fromedge, const TopoDS_Edge& toedge, const TopoDS_Face& face); - - - -protected: - - - - - -private: - - - - -friend class IGESToBRep_CurveAndSurface; -friend class IGESToBRep_BasicSurface; -friend class IGESToBRep_BasicCurve; -friend class IGESToBRep_TopoSurface; -friend class IGESToBRep_TopoCurve; -friend class IGESToBRep_BRepEntity; -friend class IGESToBRep_IGESBoundary; -friend class IGESToBRep_Reader; -friend class IGESToBRep_Actor; -friend class IGESToBRep_AlgoContainer; -friend class IGESToBRep_ToolContainer; - }; - - - - - - #endif // _IGESToBRep_HeaderFile diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 6d6f6bb794..f7a97ce062 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -4590,316 +4590,10 @@ static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, c #include #include #include -#include #include #include #include -static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller()); - if (ctl.IsNull()) XSDRAW::SetNorm("IGES"); - - // Progress indicator - Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 ); - progress->SetScale ( 0, 100, 1 ); - progress->Show(); - - IGESControl_Reader Reader (XSDRAW::Session(),Standard_False); - if (ctl.IsNull()) - ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller()); - - TCollection_AsciiString fnom,rnom; - - Standard_Boolean modfic = XSDRAW::FileAndVar - (argv[1],argv[2],"IGESBREP",fnom,rnom); - if (modfic) di<<" File IGES to read : "<NewScope ( 20, "Loading" ); // On average loading takes 20% - progress->Show(); - - // *New* - //In order to decrease number of produced edges during translation it is possible to set following parameter - Interface_Static::SetIVal("read.iges.bspline.continuity",0); - // *New* - - if (modfic) readstat = Reader.ReadFile (fnom.ToCString()); - else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone; - - progress->EndScope(); - progress->Show(); - - if (readstat != IFSelect_RetDone) { - if (modfic) di<<"Could not read file "< 3); - Standard_Integer modepri = 1, nent, nbs; - if (fromtcl) modepri = 4; - - while (modepri) { - //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka - //mode OnlyVisible does not work. - // nent = Reader.NbRootsForTransfer(); - if (!fromtcl) { - cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<>str; - modepri = Draw::Atoi(str); - } - - if (modepri == 0) { //fin - di << "Bye and good luck! \n"; - break; - } - - else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots - di << "All Geometry Transfer\n"; - di<<"spline_continuity (read) : "<ClearContext(); - XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess()); - progress->NewScope ( 80, "Translation" ); - progress->Show(); - thesession->TransferReader()->TransientProcess()->SetProgress ( progress ); - - if (modepri == 1) Reader.SetReadVisible (Standard_True); - Reader.TransferRoots(); - - thesession->TransferReader()->TransientProcess()->SetProgress ( 0 ); - progress->EndScope(); - progress->Show(); - // result in only one shape for all the roots - // or in one shape for one root. - di<<"Count of shapes produced : "< 1) { - cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush; - answer = -1; - //amv 26.09.2003 - char str_a[80]; - cin >> str_a; - answer = Draw::Atoi(str_a); - } - if ( answer == 0) continue; - if ( answer == 1 || answer == 3) { - TopoDS_Shape shape = Reader.OneShape(); - // save the shape - if (shape.IsNull()) { di<<"No Shape produced\n"; continue; } - char fname[110]; - Sprintf(fname, "%s", rnom.ToCString()); - di << "Saving shape in variable Draw : " << fname << "\n"; - if (answer == 3) IGESToBRep::WriteShape (shape,1); - try { - OCC_CATCH_SIGNALS - DBRep::Set(fname,shape); - } - catch(Standard_Failure) { - di << "** Exception : "; - di << Standard_Failure::Caught()->GetMessageString(); - di<<" ** Skip\n"; - di << "Saving shape in variable Draw : " << fname << "\n"; - IGESToBRep::WriteShape (shape,1); - } - } - - else if (answer == 2 || answer == 4) { - Standard_Integer numshape = Reader.NbShapes(); - for (Standard_Integer inum = 1; inum <= numshape; inum++) { - // save all the shapes - TopoDS_Shape shape = Reader.Shape(inum); - if (shape.IsNull()) { di<<"No Shape produced\n"; continue; } - char fname[110]; - Sprintf(fname, "%s_%d", rnom.ToCString(),inum); - di << "Saving shape in variable Draw : " << fname << "\n"; - if (answer == 4) IGESToBRep::WriteShape (shape,inum); - try { - OCC_CATCH_SIGNALS - DBRep::Set(fname,shape); - } - catch(Standard_Failure) { - di << "** Exception : "; - di << Standard_Failure::Caught()->GetMessageString(); - di<<" ** Skip\n"; - } - } - } - else return 0; - } - - else if (modepri == 3) { // One Entity - cout << "Only One Entity"< DRAW Shape: "<ClearContext(); - XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess()); - progress->NewScope ( 80, "Translation" ); - progress->Show(); - thesession->TransferReader()->TransientProcess()->SetProgress ( progress ); - - Reader.SetReadVisible (Standard_True); - Reader.TransferRoots(); - - thesession->TransferReader()->TransientProcess()->SetProgress ( 0 ); - progress->EndScope(); - progress->Show(); - - // result in only one shape for all the roots - TopoDS_Shape shape = Reader.OneShape(); - // save the shape - char fname[110]; - Sprintf(fname, "%s", rnom.ToCString()); - di << "Saving shape in variable Draw : " << fname << "\n"; - try { - OCC_CATCH_SIGNALS - DBRep::Set(fname,shape); - } - catch(Standard_Failure) { - di << "** Exception : "; - di << Standard_Failure::Caught()->GetMessageString(); - di<<" ** Skip\n"; - di << "Saving shape in variable Draw : " << fname << "\n"; - IGESToBRep::WriteShape (shape,1); - } - return 0; - } - - if(fromtcl) { - modepri = 0; // d office, une seule passe - if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') { - di<<"All Roots : "; - list = XSDRAW::GetList ("xst-model-roots"); - } - else { - TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3); - di<<"List given by "<Length(); - di<<"Nb entities selected : "<>str_answer; - answer = Draw::Atoi(str_answer); - } - if (answer <= 0 || answer > 3) continue; - if (answer == 3) { - for (Standard_Integer ill = 1; ill <= nbl; ill ++) { - Handle(Standard_Transient) ent = list->Value(ill); - di<<" ";// model->Print(ent,di); - } - di<<"\n"; - } - if (answer == 1 || answer == 2) { - Standard_Integer nbt = 0; - Handle(XSControl_WorkSession) thesession = Reader.WS(); - - XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess()); - progress->NewScope ( 80, "Translation" ); - progress->Show(); - thesession->TransferReader()->TransientProcess()->SetProgress ( progress ); - - Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 ); - for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) { - - nent = Reader.Model()->Number(list->Value(ill)); - if (nent == 0) continue; - if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "< DRAW Shape: "<TransferReader()->TransientProcess()->SetProgress ( 0 ); - progress->EndScope(); - progress->Show(); - di<<"Nb Shapes successfully produced : "<TransferReader(); - const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); - TP->Clear(); - TR->Clear(2); - Reader.WS()->Model()->Clear(); - Standard_Integer i =1; - for( ; i <= 7; i++) - Reader.WS()->ClearData(i); - // *New* - - return 0; -} - #include static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { @@ -5347,7 +5041,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) { theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group); theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group); theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group); - theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group); theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group); theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group); theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx index a23853e3ec..3aa89067b3 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx @@ -85,7 +85,6 @@ static TopTools_MapOfShape theUnkStateVer; extern Standard_Boolean GLOBAL_faces2d; -//modified by NIZNHY-PKV Mon Dec 16 11:38:55 2002 f //======================================================================= //function : ~TopOpeBRepBuild_Builder1 //purpose : @@ -96,7 +95,116 @@ TopOpeBRepBuild_Builder1::~TopOpeBRepBuild_Builder1() theUsedVertexMap.Clear(); theUnkStateVer.Clear(); } -//modified by NIZNHY-PKV Mon Dec 16 11:38:59 2002 t + +/* +namespace { + +void DumpMapOfShapeWithState (const Standard_Integer iP, + const TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState) +{ + static Standard_Integer cnt=0; + TCollection_AsciiString aFName1 ("/DEBUG/TOPOPE/"), postfix; + + Standard_CString ShapeType [9] = {"COMPO", "COMPS", "SOLID", "SHELL", "FACE ", "WIRE ", "EDGE ", "VERTX"}; + Standard_CString ShapeState[4] = {"IN ", "OUT", "ON ", "UNKNOWN"}; + + printf("\n\n********************************\n"); + printf("* *\n"); + Standard_Integer i, n=aMapOfShapeWithState.Extent(); + if (!iP) { + printf("* Object comparing with TOOL *\n"); + postfix=TCollection_AsciiString("Obj"); + } + + else { + printf("* Tool comparing with Object *\n"); + postfix=TCollection_AsciiString("Tool"); + } + + printf("* *\n"); + printf("********************************\n"); + printf("*** aMapOfShapeWithState.Extent()=%d\n", n); + printf(" C O N T E N T S\n"); + + TCollection_AsciiString aFName; + aFName+=aFName1; + aFName+=postfix; + + for (i=1; i<=n; i++) { + TCollection_AsciiString aI(i), aName;; + aName+=aFName; aName+=aI; + + const TopoDS_Shape& aShape=aMapOfShapeWithState.FindKey(i); + const TopOpeBRepDS_ShapeWithState& aShapeWithState= + aMapOfShapeWithState.FindFromIndex(i); + + BRepTools::Write (aShape, aName.ToCString()); + + TCollection_AsciiString ann; + ann+=postfix; ann+=aI; + + printf("Key: %-8s , " , ann.ToCString()); + printf("%s, ", ShapeType[aShape.ShapeType()]); + if (!iP) + printf("State comp.with Tool=%s\n", ShapeState[aShapeWithState.State()]); + + else + printf("State comp.with Obj =%s\n", ShapeState[aShapeWithState.State()]); + + if (aShapeWithState.IsSplitted()) { + + const TopTools_ListOfShape& aListOfShape=aShapeWithState.Part(TopAbs_IN); + TopTools_ListIteratorOfListOfShape anIt(aListOfShape); + for (;anIt.More(); anIt.Next()) { + const TopoDS_Shape& aS=anIt.Value(); + + TCollection_AsciiString cn(cnt), prefix("_S_"), sn; + sn+=aFName; sn+=prefix; sn+=cn; + BRepTools::Write (aS, sn.ToCString()); + + TCollection_AsciiString an;//=postfix+prefix+cn; + an+=postfix; an+=prefix; an+=cn; + printf(" -> Splitted Part IN : %s\n", an.ToCString()); + cnt++; + } + + const TopTools_ListOfShape& aListOfShapeOut=aShapeWithState.Part(TopAbs_OUT); + anIt.Initialize (aListOfShapeOut); + for (;anIt.More(); anIt.Next()) { + const TopoDS_Shape& aS=anIt.Value(); + + TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn; + sn+=aFName; sn+=prefix; sn+=cn; + BRepTools::Write (aS, sn.ToCString()); + + TCollection_AsciiString an;//=postfix+prefix+cn; + an+=postfix; an+=prefix; an+=cn; + printf(" -> Splitted Part OUT: %-s\n", an.ToCString()); + cnt++; + } + + const TopTools_ListOfShape& aListOfShapeOn=aShapeWithState.Part(TopAbs_ON); + anIt.Initialize (aListOfShapeOn); + for (;anIt.More(); anIt.Next()) { + const TopoDS_Shape& aS=anIt.Value(); + + TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn; + sn+=aFName; sn+=prefix; sn+=cn; + BRepTools::Write (aS, sn.ToCString()); + + TCollection_AsciiString an;//=postfix+prefix+cn; + an+=postfix; an+=prefix; an+=cn; + printf(" -> Splitted Part ON : %s\n", an.ToCString()); + cnt++; + } + } + + } + cnt=0; +} + +} // anonymous namespace +*/ //======================================================================= //function : PerformShapeWithStates @@ -252,8 +360,8 @@ TopOpeBRepBuild_Builder1::~TopOpeBRepBuild_Builder1() TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithStateTool= aDS.ChangeMapOfShapeWithStateTool(); - TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(0, aMapOfShapeWithStateObj); - TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(1, aMapOfShapeWithStateTool); + DumpMapOfShapeWithState(0, aMapOfShapeWithStateObj); + DumpMapOfShapeWithState(1, aMapOfShapeWithStateTool); */ // Phase#2 Phase ON diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx index 2ae02a7a26..4ee0bba00a 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.cxx @@ -76,116 +76,6 @@ //define parameter division number as 10*e^(-PI) = 0.43213918 const Standard_Real PAR_T = 0.43213918; -//======================================================================= -//function TopOpeBRepBuild_Tools::DumpMapOfShapeWithState -//purpose : -//======================================================================= - void TopOpeBRepBuild_Tools::DumpMapOfShapeWithState(const Standard_Integer iP, - const TopOpeBRepDS_IndexedDataMapOfShapeWithState& - aMapOfShapeWithState) -{ - static Standard_Integer cnt=0; - TCollection_AsciiString aFName1 ("/DEBUG/TOPOPE/"), postfix; - - Standard_CString ShapeType [9] = {"COMPO", "COMPS", "SOLID", "SHELL", "FACE ", "WIRE ", "EDGE ", "VERTX"}; - Standard_CString ShapeState[4] = {"IN ", "OUT", "ON ", "UNKNOWN"}; - - printf("\n\n********************************\n"); - printf("* *\n"); - Standard_Integer i, n=aMapOfShapeWithState.Extent(); - if (!iP) { - printf("* Object comparing with TOOL *\n"); - postfix=TCollection_AsciiString("Obj"); - } - - else { - printf("* Tool comparing with Object *\n"); - postfix=TCollection_AsciiString("Tool"); - } - - printf("* *\n"); - printf("********************************\n"); - printf("*** aMapOfShapeWithState.Extent()=%d\n", n); - printf(" C O N T E N T S\n"); - - TCollection_AsciiString aFName; - aFName+=aFName1; - aFName+=postfix; - - for (i=1; i<=n; i++) { - TCollection_AsciiString aI(i), aName;; - aName+=aFName; aName+=aI; - - const TopoDS_Shape& aShape=aMapOfShapeWithState.FindKey(i); - const TopOpeBRepDS_ShapeWithState& aShapeWithState= - aMapOfShapeWithState.FindFromIndex(i); - - BRepTools::Write (aShape, aName.ToCString()); - - TCollection_AsciiString ann; - ann+=postfix; ann+=aI; - - printf("Key: %-8s , " , ann.ToCString()); - printf("%s, ", ShapeType[aShape.ShapeType()]); - if (!iP) - printf("State comp.with Tool=%s\n", ShapeState[aShapeWithState.State()]); - - else - printf("State comp.with Obj =%s\n", ShapeState[aShapeWithState.State()]); - - if (aShapeWithState.IsSplitted()) { - - const TopTools_ListOfShape& aListOfShape=aShapeWithState.Part(TopAbs_IN); - TopTools_ListIteratorOfListOfShape anIt(aListOfShape); - for (;anIt.More(); anIt.Next()) { - const TopoDS_Shape& aS=anIt.Value(); - - TCollection_AsciiString cn(cnt), prefix("_S_"), sn; - sn+=aFName; sn+=prefix; sn+=cn; - BRepTools::Write (aS, sn.ToCString()); - - TCollection_AsciiString an;//=postfix+prefix+cn; - an+=postfix; an+=prefix; an+=cn; - printf(" -> Splitted Part IN : %s\n", an.ToCString()); - cnt++; - } - - const TopTools_ListOfShape& aListOfShapeOut=aShapeWithState.Part(TopAbs_OUT); - anIt.Initialize (aListOfShapeOut); - for (;anIt.More(); anIt.Next()) { - const TopoDS_Shape& aS=anIt.Value(); - - TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn; - sn+=aFName; sn+=prefix; sn+=cn; - BRepTools::Write (aS, sn.ToCString()); - - TCollection_AsciiString an;//=postfix+prefix+cn; - an+=postfix; an+=prefix; an+=cn; - printf(" -> Splitted Part OUT: %-s\n", an.ToCString()); - cnt++; - } - - const TopTools_ListOfShape& aListOfShapeOn=aShapeWithState.Part(TopAbs_ON); - anIt.Initialize (aListOfShapeOn); - for (;anIt.More(); anIt.Next()) { - const TopoDS_Shape& aS=anIt.Value(); - - TCollection_AsciiString cn(cnt), prefix("_S_"), sn;//=aFName+prefix+cn; - sn+=aFName; sn+=prefix; sn+=cn; - BRepTools::Write (aS, sn.ToCString()); - - TCollection_AsciiString an;//=postfix+prefix+cn; - an+=postfix; an+=prefix; an+=cn; - printf(" -> Splitted Part ON : %s\n", an.ToCString()); - cnt++; - } - } - - } - cnt=0; -} - - //======================================================================= //function TopOpeBRepBuild_Tools::FindState //purpose : diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.hxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.hxx index 3a2b955b28..19a5a95433 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.hxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools.hxx @@ -49,8 +49,6 @@ public: DEFINE_STANDARD_ALLOC - Standard_EXPORT static void DumpMapOfShapeWithState (const Standard_Integer iP, const TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState); - Standard_EXPORT static void FindState (const TopoDS_Shape& aVertex, const TopAbs_State aState, const TopAbs_ShapeEnum aShapeEnum, const TopTools_IndexedDataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapProcessedVertices, TopOpeBRepDS_DataMapOfShapeState& aMapVs); Standard_EXPORT static void PropagateState (const TopOpeBRepDS_DataMapOfShapeState& aSplEdgesState, const TopTools_IndexedMapOfShape& anEdgesToRestMap, const TopAbs_ShapeEnum aShapeEnum1, const TopAbs_ShapeEnum aShapeEnum2, TopOpeBRepTool_ShapeClassifier& aShapeClassifier, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState, const TopTools_MapOfShape& anUnkStateShapes); diff --git a/src/XSControl/XSControl_Utils.cxx b/src/XSControl/XSControl_Utils.cxx index 645ef09467..f0ca0c216b 100644 --- a/src/XSControl/XSControl_Utils.cxx +++ b/src/XSControl/XSControl_Utils.cxx @@ -335,26 +335,6 @@ static const Standard_ExtString voidext = { 0 }; // ########################################################## // ####### SHAPES : Acces de base ####### - Standard_Boolean XSControl_Utils::WriteShape - (const TopoDS_Shape& shape, - const Standard_CString filename) const - { return BRepTools::Write (shape,filename); } - - TopoDS_Shape XSControl_Utils::NewShape () const - { TopoDS_Shape shape; return shape; } - - Standard_Boolean XSControl_Utils::ReadShape - (TopoDS_Shape& shape, - const Standard_CString filename) const -{ - BRep_Builder B; - return BRepTools::Read (shape,filename,B); -} - - Standard_Boolean XSControl_Utils::IsNullShape (const TopoDS_Shape& shape) const - { return shape.IsNull(); } - - TopoDS_Shape XSControl_Utils::CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const { diff --git a/src/XSControl/XSControl_Utils.hxx b/src/XSControl/XSControl_Utils.hxx index 7392030e84..82626dd859 100644 --- a/src/XSControl/XSControl_Utils.hxx +++ b/src/XSControl/XSControl_Utils.hxx @@ -127,23 +127,6 @@ public: Standard_EXPORT void AppendEStr (const Handle(TColStd_HSequenceOfHExtendedString)& seqval, const Standard_ExtString strval) const; - //! Writes a Shape under the internal BRepTools form - //! (an internal help utility) - //! Returns True if writing has succeeded, False else - Standard_EXPORT Standard_Boolean WriteShape (const TopoDS_Shape& shape, const Standard_CString filename) const; - - //! Returns a new empty, undefined Shape, which can then be filled - //! by ReadShape - Standard_EXPORT TopoDS_Shape NewShape() const; - - //! Reads a Shape from the internal BRepTools form and returns it - //! (an internal help utility) - //! Returns True if reading has succeeded, False else - Standard_EXPORT Standard_Boolean ReadShape (TopoDS_Shape& shape, const Standard_CString filename) const; - - //! Returns True if a Shape is Null - Standard_EXPORT Standard_Boolean IsNullShape (const TopoDS_Shape& shape) const; - //! Converts a list of Shapes to a Compound (a kind of Shape) Standard_EXPORT TopoDS_Shape CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const; diff --git a/src/XSDRAW/FILES b/src/XSDRAW/FILES index 5f443e2f1d..8d3ba0efb1 100755 --- a/src/XSDRAW/FILES +++ b/src/XSDRAW/FILES @@ -1,6 +1,5 @@ XSDRAW.cxx XSDRAW.hxx -XSDRAW_Commands.hxx XSDRAW_Functions.cxx XSDRAW_Functions.hxx XSDRAW_Vars.cxx diff --git a/src/XSDRAW/XSDRAW_Commands.hxx b/src/XSDRAW/XSDRAW_Commands.hxx deleted file mode 100644 index 1e40cddae1..0000000000 --- a/src/XSDRAW/XSDRAW_Commands.hxx +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -static TCollection_AsciiString XSDRAW_CommandPart - (Standard_Integer argc, const char** argv, const Standard_Integer argf) -{ - TCollection_AsciiString res; - for (Standard_Integer i = argf; i < argc; i ++) { - if (i > argf) res.AssignCat(" "); - res.AssignCat (argv[i]); - } - return res; -} diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 38a73fa693..07c31522c6 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -14,6 +14,7 @@ //gka 06.01.99 S3767 new function TPSTAT (first version) //pdn 11.01.99 putting "return" statement for compilation on NT +#include #include #include #include @@ -61,17 +62,40 @@ #include #include #include -#include #include #include -// #include -// pour igeslist -//#include essai CKY 4-AUT-1998 -//#include essai CKY 4-AUT-1998 -//#include essai CKY 4-AUT-1998 -// Init functions -// + tplosttrim + +namespace { + + //======================================================================= +//function : WriteShape +//purpose : Creates a file Shape_'number' +//======================================================================= +void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number) +{ + char fname[110]; + sprintf(fname, "Shape_%d",number); + ofstream f(fname,ios::out); + cout << "Output file name : " << fname << endl; + f << "DBRep_DrawableShape\n"; + + BRepTools::Write(shape, f); + f.close(); +} + +TCollection_AsciiString XSDRAW_CommandPart + (Standard_Integer argc, const char** argv, const Standard_Integer argf) +{ + TCollection_AsciiString res; + for (Standard_Integer i = argf; i < argc; i ++) { + if (i > argf) res.AssignCat(" "); + res.AssignCat (argv[i]); + } + return res; +} +} + //-------------------------------------------------------------- // Function : igesbrep //-------------------------------------------------------------- @@ -182,7 +206,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c char fname[110]; Sprintf(fname, "%s", rnom.ToCString()); di << "Saving shape in variable Draw : " << fname << "\n"; - if (answer == 3) IGESToBRep::WriteShape (shape,1); + if (answer == 3) WriteShape (shape,1); try { OCC_CATCH_SIGNALS DBRep::Set(fname,shape); @@ -192,7 +216,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c di << Standard_Failure::Caught()->GetMessageString(); di<<" ** Skip\n"; di << "Saving shape in variable Draw : " << fname << "\n"; - IGESToBRep::WriteShape (shape,1); + WriteShape (shape,1); } } @@ -205,7 +229,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c char fname[110]; Sprintf(fname, "%s_%d", rnom.ToCString(),inum); di << "Saving shape in variable Draw : " << fname << "\n"; - if (answer == 4) IGESToBRep::WriteShape (shape,inum); + if (answer == 4) WriteShape (shape,inum); try { OCC_CATCH_SIGNALS DBRep::Set(fname,shape); @@ -279,7 +303,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c di << Standard_Failure::Caught()->GetMessageString(); di<<" ** Skip\n"; di << "Saving shape in variable Draw : " << fname << "\n"; - IGESToBRep::WriteShape (shape,1); + WriteShape (shape,1); } return 0; }