diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index 4603e32efc..4df263c0c6 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -1125,10 +1125,10 @@ The following obsolete features have been removed: * *AIS_InteractiveObject::SelectionPriority()*. These property was not implemented. * The class *LocOpe_HBuilder* has been removed as obsolete. -* The class *QANewBRepNaming_BooleanOperationFeat* has been removed. The class *QANewBRepNaming_BooleanOperation* should be used instead. * The package *TestTopOpe* has been removed; * The package *TestTopOpeDraw* has been removed; * The package *TestTopOpeTools* has been removed. +* The packages *QANewModTopOpe*, *QANewBRepNaming* and *QANewDBRepNaming* have been removed as containing obsolete features. @subsection upgrade_occt720_correction_of_Offset_API Corrections in BRepOffset API diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 0b3be5ee96..4cbb084519 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -2030,9 +2030,6 @@ TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,cons TopoDS_Shape ShapeCut = aBoolenaOperation.Shape(); -//#ifdef OCC40 -// Handle(TopOpeBRepBuild_HBuilder) build = aBoolenaOperation.Builder(); -//#endif TopTools_ListIteratorOfListOfShape its; TopoDS_Compound result; @@ -2047,11 +2044,7 @@ TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,cons BRepFilletAPI_MakeFillet fill(cutsol); fill.SetParams(ta, t3d, t2d, t3d, t2d, fl); fill.SetContinuity(blend_cont, tapp_angle); -//#ifdef OCC40 -// its = build->Section(); -//#else //OCC40DEV its = aBoolenaOperation.SectionEdges(); -//#endif while (its.More()) { TopoDS_Edge E = TopoDS::Edge(its.Value()); diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx index 569f295fc2..c96f711cc4 100644 --- a/src/QABugs/QABugs_16.cxx +++ b/src/QABugs/QABugs_16.cxx @@ -58,20 +58,11 @@ #include #include -//#include -#include - -//#include -#include - #include #include #include -//#include -#include - #include #include @@ -512,76 +503,6 @@ static Standard_Integer OCC405 (Draw_Interpretor& di, Standard_Integer argc, con else return 1; } -static Standard_Integer OCC252 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - if(!(argc == 4 || argc == 5)) { - di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]\n"; - return 1; - } - - TopoDS_Shape s1 = DBRep::Get(argv[2]); - TopoDS_Shape s2 = DBRep::Get(argv[3]); - if (s1.IsNull() || s2.IsNull()) return 1; - - //QAModTopOpe_ModeOfLimitation ModeOfLimitation = QAModTopOpe_Forward; - QANewModTopOpe_ModeOfLimitation ModeOfLimitation = QANewModTopOpe_Forward; - if(argc==5) { - Standard_Integer ModeOfLimitationInteger = Draw::Atoi(argv[4]); - if(!(ModeOfLimitationInteger == 0 || ModeOfLimitationInteger == 1 || ModeOfLimitationInteger == 2)) { - di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]\n"; - return 1; - } - //if (ModeOfLimitationInteger == 1) ModeOfLimitation = QAModTopOpe_Reversed; - //if (ModeOfLimitationInteger == 2) ModeOfLimitation = QAModTopOpe_BothParts; - if (ModeOfLimitationInteger == 1) ModeOfLimitation = QANewModTopOpe_Reversed; - if (ModeOfLimitationInteger == 2) ModeOfLimitation = QANewModTopOpe_BothParts; - } - - //TopoDS_Shape res = QAModTopOpe_Limitation(s1,s2,ModeOfLimitation); - TopoDS_Shape res = QANewModTopOpe_Limitation(s1,s2,ModeOfLimitation); - if (res.IsNull()) { - di << "Error : result is null\n"; - return 1; - } - - DBRep::Set(argv[1],res); - - return 0; -} - -static Standard_Integer OCC307 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - if(!(argc == 4 || argc == 5)) { - di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]\n"; - return 1; - } - - TopoDS_Shape s1 = DBRep::Get(argv[2]); - TopoDS_Shape s2 = DBRep::Get(argv[3]); - if (s1.IsNull() || s2.IsNull()) return 1; - - Standard_Boolean AllowCutting = Standard_False; - if(argc==5) { - Standard_Integer AllowCuttingInteger = Draw::Atoi(argv[4]); - if(!( AllowCuttingInteger == 0 || AllowCuttingInteger == 1)) { - di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]\n"; - return 1; - } - if (AllowCuttingInteger == 1) AllowCutting = Standard_True; - } - - //TopoDS_Shape res = QAModTopOpe_Glue(s1,s2,AllowCutting); - TopoDS_Shape res = QANewModTopOpe_Glue(s1,s2,AllowCutting); - if (res.IsNull()) { - di << "Error : result is null\n"; - return 1; - } - - DBRep::Set(argv[1],res); - - return 0; -} - static Standard_Integer OCC395 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { if(argc != 4) { @@ -713,30 +634,6 @@ static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, con return 0; } -static Standard_Integer OCC294 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - if(argc < 4) { - di << "Usage : " << argv[0] << " shape_result shape edge\n"; - return 1; - } - TopoDS_Shape Sh1 = DBRep::Get(argv[2]); - TopoDS_Shape Sh2 = DBRep::Get(argv[3]); - if(Sh1.IsNull() || Sh2.IsNull()) return 1; - if(Sh2.ShapeType() != TopAbs_EDGE) return 1; - - //QAModTopOpe_ReShaper ReShaper(Sh1); - QANewModTopOpe_ReShaper ReShaper(Sh1); - ReShaper.Remove(Sh2); - const TopoDS_Shape& ResultShape = ReShaper.GetResult(); - if(ResultShape.IsNull()) { - di << "Faulty " << argv[0] << " : " << argv[1] << " - shape_result is null\n"; - return 1; - } - - DBRep::Set ( argv[1], ResultShape); - return 0; -} - static Standard_Integer OCC60 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); @@ -858,12 +755,9 @@ void QABugs::Commands_16(Draw_Interpretor& theCommands) { theCommands.Add ("OCC49", "OCC49 name", __FILE__, OCC49, group); theCommands.Add ("OCC132", "OCC132 DependentName", __FILE__, OCC132, group); theCommands.Add ("OCC405", "OCC405 edge_result edge1 edge2; merge two edges", __FILE__, OCC405, group); - theCommands.Add ("OCC252", "OCC252 result part tool [ModeOfLimitation=0/1/2]", __FILE__, OCC252, group); - theCommands.Add ("OCC307", "OCC307 result part tool [AllowCutting=0/1]", __FILE__, OCC307, group); theCommands.Add ("OCC395", "OCC395 edge_result edge1 edge2", __FILE__, OCC395, group); theCommands.Add ("OCC394", "OCC394 edge_result edge [tol [mode [tolang]]]", __FILE__, OCC394, group); theCommands.Add ("OCC301", "OCC301 ArcRadius ArrowSize", __FILE__, OCC301, group); - theCommands.Add ("OCC294", "OCC294 shape_result shape edge", __FILE__, OCC294, group); theCommands.Add ("OCC60", "OCC60 xmin ymin xmax ymax; selection window", __FILE__, OCC60, group); theCommands.Add ("OCC70", "OCC70 x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection", __FILE__, OCC70, group); theCommands.Add ("OCC261", "OCC261 Doc", __FILE__, OCC261, group); diff --git a/src/QABugs/QABugs_3.cxx b/src/QABugs/QABugs_3.cxx index cb94d9fc00..cb044cd2f3 100644 --- a/src/QABugs/QABugs_3.cxx +++ b/src/QABugs/QABugs_3.cxx @@ -126,112 +126,6 @@ static int BUC60614(Draw_Interpretor& di, Standard_Integer argc, const char ** a return 0; } -#include -#include -#include -#include -#include -#include -#ifdef _MSC_VER -#include -#endif - -static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { - gp_Pnt2d uvSurf; - TopAbs_State state; - - if (argc == 3) { - // BUC60609 shape name - } else if ( argc == 5 ) { - // BUC60609 shape name U V - } else { - di << "Usage : "<< argv[0] << " shape name [U V]\n"; - return(-1); - } - - TCollection_AsciiString aFilePath(argv[1]); - - filebuf fic; - istream in(&fic); - if (!fic.open(aFilePath.ToCString(),ios::in)) { - di << "Cannot open file for reading : " << aFilePath << "\n"; - return(-1); - } - - TopoDS_Shape theShape; - char typ[255]; - in >> typ; - if (!in.fail()) { - if( !strcmp(typ, "DBRep_DrawableShape") ){ - BRep_Builder B; - BRepTools_ShapeSet S(B); - S.Read(in); - S.Read(theShape,in); - }else{ - di << "Wrong entity type in " << aFilePath << "\n"; - return(-1); - } - } - - const TopoDS_Face &face = TopoDS::Face (theShape); - - if(argc > 2){ - DBRep::Set(argv[2],face); - } - - Standard_Real faceUMin,faceUMax,faceVMin,faceVMax; - - BRepTools::UVBounds (face, faceUMin,faceUMax,faceVMin,faceVMax); - - di << "The bounds of the trimmed face:\n"; - di << faceUMin << " <= U <= " << faceUMax << "\n"; - di << faceVMin << " <= V <= " << faceVMax << "\n"; - - Handle(BRepAdaptor_HSurface) hsurfa = new BRepAdaptor_HSurface(face); - - TopOpeBRep_PointClassifier PClass; - - di << "Now test the point classifier by inputting U,V values\n"; - di << "inside or outside the bounds displayed above\n"; - di << "Type stop to exit\n"; - - // Please register this: - // *********************************************** - // Note also that for periodic surfaces such as nimpod_1.topo, - // the U/V values may be +- 2pi compared to the actual face bounds - // (because U,V is probably coming from a Geom package routine). - // Hence IT WOULD BE USEFUL IF TopOpeBRep_PointClassifier COULD - // COPE WITH PERIODIC SURFACES, i.e. U,V +-Period giving same result. - // ************************************************* - - if (argc == 3) { - uvSurf = gp_Pnt2d(0.14,5.1); - state = PClass.Classify(face,uvSurf,Precision::PConfusion()); - if(state == TopAbs_IN || state == TopAbs_ON){ - di << "U=" << 0.14 << " V=" << 5.1 << " classified INSIDE\n"; - }else{ - di << "U=" << 0.14 << " V=" << 5.1 << " classified OUTSIDE\n"; - } - - uvSurf = gp_Pnt2d(1.28,5.1); - state = PClass.Classify(face,uvSurf,Precision::PConfusion()); - if(state == TopAbs_IN || state == TopAbs_ON){ - di << "U=" << 1.28 << " V=" << 5.1 << " classified INSIDE\n"; - }else{ - di << "U=" << 1.28 << " V=" << 5.1 << " classified OUTSIDE\n"; - } - } else { - uvSurf = gp_Pnt2d(Draw::Atof(argv[3]),Draw::Atof(argv[4])); - state = PClass.Classify(face,uvSurf,Precision::PConfusion()); - if(state == TopAbs_IN || state == TopAbs_ON){ - di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified INSIDE\n"; - }else{ - di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified OUTSIDE\n"; - } - } - return 0; -} - #include #include #include @@ -274,6 +168,7 @@ static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, c } #include +#include static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, const char ** argv ) { @@ -434,7 +329,8 @@ return 0; #include #include #include - +#include + static Standard_Integer BUC60729 (Draw_Interpretor& /*di*/,Standard_Integer /*argc*/, const char ** /*argv*/ ) { Bnd_Box aMainBox; @@ -1552,7 +1448,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) { theCommands.Add("BUC60623","BUC60623 result Shape1 Shape2",__FILE__,BUC60623,group); theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group); theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group); - theCommands.Add("BUC60609","BUC60609 shape name [U V]",__FILE__,BUC60609,group); theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group); theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group); theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group); diff --git a/src/QADraw/QADraw_Additional.cxx b/src/QADraw/QADraw_Additional.cxx index 6b2c3b45ba..7990d64ee6 100644 --- a/src/QADraw/QADraw_Additional.cxx +++ b/src/QADraw/QADraw_Additional.cxx @@ -16,11 +16,6 @@ #include #include #include -//#if defined(WOKC40) -//#include -//#else -#include -//#endif #include void QADraw::AdditionalCommands(Draw_Interpretor& theCommands) @@ -28,11 +23,6 @@ void QADraw::AdditionalCommands(Draw_Interpretor& theCommands) QABugs::Commands(theCommands); QADNaming::AllCommands(theCommands); -//#if defined(WOKC40) -// QADBRepNaming::AllCommands(theCommands); -//#else - QANewDBRepNaming::AllCommands(theCommands); -//#endif QANCollection::Commands(theCommands); return; diff --git a/src/QANewBRepNaming/FILES b/src/QANewBRepNaming/FILES deleted file mode 100644 index ecbf894cf3..0000000000 --- a/src/QANewBRepNaming/FILES +++ /dev/null @@ -1,40 +0,0 @@ -QANewBRepNaming.cxx -QANewBRepNaming.hxx -QANewBRepNaming_BooleanOperation.cxx -QANewBRepNaming_BooleanOperation.hxx -QANewBRepNaming_Box.cxx -QANewBRepNaming_Box.hxx -QANewBRepNaming_Chamfer.cxx -QANewBRepNaming_Chamfer.hxx -QANewBRepNaming_Common.cxx -QANewBRepNaming_Common.hxx -QANewBRepNaming_Cut.cxx -QANewBRepNaming_Cut.hxx -QANewBRepNaming_Cylinder.cxx -QANewBRepNaming_Cylinder.hxx -QANewBRepNaming_Fillet.cxx -QANewBRepNaming_Fillet.hxx -QANewBRepNaming_Fuse.cxx -QANewBRepNaming_Fuse.hxx -QANewBRepNaming_Gluing.cxx -QANewBRepNaming_Gluing.hxx -QANewBRepNaming_ImportShape.cxx -QANewBRepNaming_ImportShape.hxx -QANewBRepNaming_Intersection.cxx -QANewBRepNaming_Intersection.hxx -QANewBRepNaming_Limitation.cxx -QANewBRepNaming_Limitation.hxx -QANewBRepNaming_Loader.cxx -QANewBRepNaming_Loader.hxx -QANewBRepNaming_LoaderParent.cxx -QANewBRepNaming_LoaderParent.hxx -QANewBRepNaming_Prism.cxx -QANewBRepNaming_Prism.hxx -QANewBRepNaming_Revol.cxx -QANewBRepNaming_Revol.hxx -QANewBRepNaming_Sphere.cxx -QANewBRepNaming_Sphere.hxx -QANewBRepNaming_TopNaming.cxx -QANewBRepNaming_TopNaming.hxx -QANewBRepNaming_TopNaming.lxx -QANewBRepNaming_TypeOfPrimitive3D.hxx diff --git a/src/QANewBRepNaming/QANewBRepNaming.cxx b/src/QANewBRepNaming/QANewBRepNaming.cxx deleted file mode 100644 index 429fc452a1..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// Created on: 2003-06-20 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2003-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : CleanStructure -//purpose : -//======================================================================= -void QANewBRepNaming::CleanStructure(const TDF_Label& theLabel) { - - TopTools_ListOfShape Olds; - TopTools_ListOfShape News; - TNaming_Evolution anEvol; - TNaming_Iterator anIt(theLabel); - if (anIt.More()) { - anEvol = anIt.Evolution(); - for ( ; anIt.More(); anIt.Next()) { - Olds.Append(anIt.OldShape()); - News.Append(anIt.NewShape()); - } - - TopTools_ListIteratorOfListOfShape itOlds(Olds); - TopTools_ListIteratorOfListOfShape itNews(News); - TNaming_Builder aBuilder(theLabel); - anEvol = TNaming_DELETE; - - for ( ;itOlds.More() ; itOlds.Next(),itNews.Next()) { - const TopoDS_Shape& OS = itOlds.Value(); - const TopoDS_Shape& NS = itNews.Value(); - LoadNamedShape ( aBuilder, anEvol, OS, NS); - } - } - for (TDF_ChildIterator chlIt(theLabel, Standard_True); chlIt.More(); chlIt.Next()) { - CleanStructure (chlIt.Value()); - } -} - -//======================================================================= -//function : LoadNamedShape -//purpose : -//======================================================================= - -void QANewBRepNaming::LoadNamedShape (TNaming_Builder& theBuilder, - const TNaming_Evolution theEvol, - const TopoDS_Shape& theOS, - const TopoDS_Shape& theNS) -{ - switch (theEvol) { - case TNaming_PRIMITIVE : - { - theBuilder.Generated(theNS); - break; - } - case TNaming_GENERATED : - { - theBuilder.Generated(theOS, theNS); - break; - } - case TNaming_MODIFY : - { - theBuilder.Modify(theOS, theNS); - break; - } - case TNaming_REPLACE : - { - theBuilder.Modify(theOS, theNS); - break; - } // for compatibility -// case TNaming_REPLACE : -// { -// theBuilder.Replace(theOS, theNS); -// break; -// } - case TNaming_DELETE : - { - theBuilder.Delete (theOS); - break; - } - case TNaming_SELECTED : - { - theBuilder.Select(theNS, theOS); - } - default: - break; - } -} - -//======================================================================= -//function : Displace -//purpose : if WithOld == True, dsplace with old subshapes -//======================================================================= - -void QANewBRepNaming::Displace (const TDF_Label& theLabel, - const TopLoc_Location& theLoc, - const Standard_Boolean theWithOld) -{ - TopTools_ListOfShape Olds; - TopTools_ListOfShape News; - TNaming_Evolution Evol; - TNaming_Iterator it(theLabel); - - if (it.More()) { - Evol = it.Evolution(); - for ( ; it.More(); it.Next()) { - Olds.Append(it.OldShape()); - News.Append(it.NewShape()); - } - - TopTools_ListIteratorOfListOfShape itOlds(Olds); - TopTools_ListIteratorOfListOfShape itNews(News); - TNaming_Builder B(theLabel); - - for ( ;itOlds.More() ; itOlds.Next(),itNews.Next()) { - TopoDS_Shape OS,NS; - const TopoDS_Shape& SO = itOlds.Value(); - const TopoDS_Shape& SN = itNews.Value(); - OS = SO; - if (theWithOld && !SO.IsNull()) OS = SO.Moved(theLoc); - if (!SN.IsNull()) NS = SN.Moved(theLoc); - - LoadNamedShape ( B, Evol, OS, NS); - } - } - for (TDF_ChildIterator ciL(theLabel); ciL.More(); ciL.Next()) { - Displace (ciL.Value(),theLoc,theWithOld); - } -} diff --git a/src/QANewBRepNaming/QANewBRepNaming.hxx b/src/QANewBRepNaming/QANewBRepNaming.hxx deleted file mode 100644 index ce705dd450..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming.hxx +++ /dev/null @@ -1,111 +0,0 @@ -// Created on: 1999-09-24 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_HeaderFile -#define _QANewBRepNaming_HeaderFile - -#include -#include -#include - -#include -#include -class TDF_Label; -class TNaming_Builder; -class TopoDS_Shape; -class TopLoc_Location; -class QANewBRepNaming_LoaderParent; -class QANewBRepNaming_Loader; -class QANewBRepNaming_TopNaming; -class QANewBRepNaming_Box; -class QANewBRepNaming_Prism; -class QANewBRepNaming_Revol; -class QANewBRepNaming_Cylinder; -class QANewBRepNaming_Sphere; -class QANewBRepNaming_BooleanOperation; -class QANewBRepNaming_Common; -class QANewBRepNaming_Cut; -class QANewBRepNaming_Fuse; -class QANewBRepNaming_Fillet; -class QANewBRepNaming_Chamfer; -class QANewBRepNaming_ImportShape; -class QANewBRepNaming_Gluing; -class QANewBRepNaming_Intersection; -class QANewBRepNaming_Limitation; - - -//! Implements methods to load the Make Shape -//! operations in the naming data-structure (package -//! TNaming), which provides topological naming -//! facilities. Shape generation, modifications and -//! deletions are recorded in the data-framework -//! (package TDF) using the builder from package -//! TNaming. -class QANewBRepNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT static void CleanStructure (const TDF_Label& theLabel); - - Standard_EXPORT static void LoadNamedShape (TNaming_Builder& theBuilder, const TNaming_Evolution theEvol, const TopoDS_Shape& theOS, const TopoDS_Shape& theNS); - - Standard_EXPORT static void Displace (const TDF_Label& theLabel, const TopLoc_Location& theLoc, const Standard_Boolean theWithOld); - - - - -protected: - - - - - -private: - - - - -friend class QANewBRepNaming_LoaderParent; -friend class QANewBRepNaming_Loader; -friend class QANewBRepNaming_TopNaming; -friend class QANewBRepNaming_Box; -friend class QANewBRepNaming_Prism; -friend class QANewBRepNaming_Revol; -friend class QANewBRepNaming_Cylinder; -friend class QANewBRepNaming_Sphere; -friend class QANewBRepNaming_BooleanOperation; -friend class QANewBRepNaming_Common; -friend class QANewBRepNaming_Cut; -friend class QANewBRepNaming_Fuse; -friend class QANewBRepNaming_Fillet; -friend class QANewBRepNaming_Chamfer; -friend class QANewBRepNaming_ImportShape; -friend class QANewBRepNaming_Gluing; -friend class QANewBRepNaming_Intersection; -friend class QANewBRepNaming_Limitation; - -}; - - - - - - - -#endif // _QANewBRepNaming_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.cxx b/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.cxx deleted file mode 100644 index 69b08733c0..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.cxx +++ /dev/null @@ -1,1617 +0,0 @@ -// Created on: 1999-09-27 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#endif - -#ifdef OCCT_DEBUG -#include -#include -#include -#include -static void ModDbgTools_Write(const TopoDS_Shape& shape, - const Standard_CString filename) -{ - ofstream save; - save.open(filename); - save << "DBRep_DrawableShape" << endl << endl; - if(!shape.IsNull()) BRepTools::Write(shape, save); - save.close(); -} - -#endif - -//======================================================================= -//function : QANewBRepNaming_BooleanOperation -//purpose : -//======================================================================= - -QANewBRepNaming_BooleanOperation::QANewBRepNaming_BooleanOperation() {} - -//======================================================================= -//function : QANewBRepNaming_BooleanOperation -//purpose : -//======================================================================= - -QANewBRepNaming_BooleanOperation::QANewBRepNaming_BooleanOperation(const TDF_Label& ResultLabel):QANewBRepNaming_TopNaming(ResultLabel) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::Init(const TDF_Label& ResultLabel) { - if(ResultLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_BooleanOperation::Init The Result label is Null ..."); - myResultLabel = ResultLabel; -} - -//======================================================================= -//function : ModifiedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::ModifiedFaces() const { -#ifdef OCCT_DEBUG - const TDF_Label& ModifiedFacesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(ModifiedFacesLabel, "ModifiedFaces"); - return ModifiedFacesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : ModifiedEdges -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::ModifiedEdges() const { -#ifdef OCCT_DEBUG - const TDF_Label& ModifiedEdgesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(ModifiedEdgesLabel, "ModifiedEdges"); - return ModifiedEdgesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : DeletedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::DeletedFaces() const { -#ifdef OCCT_DEBUG - const TDF_Label& DeletedFacesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(DeletedFacesLabel, "DeletedFaces"); - return DeletedFacesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : DeletedEdges -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::DeletedEdges() const { -#ifdef OCCT_DEBUG - const TDF_Label& DeletedEdgesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(DeletedEdgesLabel, "DeletedEdges"); - return DeletedEdgesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : DeletedVertices -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::DeletedVertices() const { -#ifdef OCCT_DEBUG - const TDF_Label& DeletedVerticesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(DeletedVerticesLabel, "DeletedVertices"); - return DeletedVerticesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : NewShapes -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::NewShapes() const { -#ifdef OCCT_DEBUG - const TDF_Label& NewShapesLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(NewShapesLabel, "NewShapes"); - return NewShapesLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : Content -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::Content() const { -#ifdef OCCT_DEBUG - const TDF_Label& ContentLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(ContentLabel, "Content"); - return ContentLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : DeletedDegeneratedEdges -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_BooleanOperation::DeletedDegeneratedEdges() const { -#ifdef OCCT_DEBUG - const TDF_Label& DegeneratedLabel = ResultLabel().NewChild(); - TDataStd_Name::Set(DegeneratedLabel, "DeletedDegeneratedEdges"); - return DegeneratedLabel; -#else - return ResultLabel().NewChild(); -#endif -} - -//======================================================================= -//function : ShapeType -//purpose : -//======================================================================= - -TopAbs_ShapeEnum QANewBRepNaming_BooleanOperation::ShapeType(const TopoDS_Shape& theShape) { - TopAbs_ShapeEnum TypeSh = theShape.ShapeType(); - if (TypeSh == TopAbs_COMPOUND || TypeSh == TopAbs_COMPSOLID) { - TopoDS_Iterator itr(theShape); - if (!itr.More()) return TypeSh; - TypeSh = ShapeType(itr.Value()); - if(TypeSh == TopAbs_COMPOUND) return TypeSh; - itr.Next(); - for(; itr.More(); itr.Next()) - if(ShapeType(itr.Value()) != TypeSh) return TopAbs_COMPOUND; - } - return TypeSh; -} - -//======================================================================= -//function : GetShape -//purpose : -//======================================================================= - -TopoDS_Shape QANewBRepNaming_BooleanOperation::GetShape(const TopoDS_Shape& theShape) const { - if (theShape.ShapeType() == TopAbs_COMPOUND || theShape.ShapeType() == TopAbs_COMPSOLID) { - TopoDS_Iterator itr(theShape); - if (itr.More()) return itr.Value(); - } - return theShape; -} - -//======================================================================= -//function : LoadWire -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadWire(BRepAlgoAPI_BooleanOperation& MS) const { - // Naming of modified edges: - TNaming_Builder ModBuilder(ModifiedEdges()); - QANewBRepNaming_Loader::LoadModifiedShapes (MS, MS.Shape1(), TopAbs_EDGE, ModBuilder); - - // load generated vertexes - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape1(), TopAbs_EDGE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape2(), TopAbs_FACE, nBuilder); - } - // Naming of deleted edges, dangle vertices - if(MS.HasDeleted()){ - TNaming_Builder DelEBuilder(DeletedEdges()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape1(), TopAbs_EDGE, DelEBuilder); - TNaming_Builder DelVBuilder(DeletedVertices()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape1(), TopAbs_VERTEX, DelEBuilder); - } - } - -//======================================================================= -//function : LoadShell -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadShell(BRepAlgoAPI_BooleanOperation& MS) const { -// Naming of modified faces and dangle edges - TNaming_Builder ModFBuilder(ModifiedFaces()); - QANewBRepNaming_Loader::LoadModifiedShapes(MS, MS.Shape1(), TopAbs_FACE, ModFBuilder); - TNaming_Builder ModEBuilder(ModifiedEdges()); - QANewBRepNaming_Loader::LoadModifiedShapes(MS, MS.Shape1(), TopAbs_EDGE, ModEBuilder); - - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); -// generated Edges - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape2(), TopAbs_FACE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape1(), TopAbs_FACE, nBuilder); - } - // Naming of deleted faces edges: - if(MS.HasDeleted()){ - TNaming_Builder DelFBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape1(), TopAbs_FACE, DelFBuilder); - - TNaming_Builder DelEBuilder(DeletedEdges()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape1(), TopAbs_EDGE, DelEBuilder); - } -} - -//======================================================================= -//function : LoadContent -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadContent(BRepAlgoAPI_BooleanOperation& MS) const { - if (MS.Shape().ShapeType() == TopAbs_COMPSOLID || MS.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(MS.Shape()); - Standard_Integer nbShapes = 0; - while (itr.More()) { - nbShapes++; - itr.Next(); - } - if (nbShapes > 1) { - for (itr.Initialize(MS.Shape()); itr.More(); itr.Next()) { - TNaming_Builder bContent(Content()); - bContent.Generated(itr.Value()); - } - } - } -} - -//======================================================================= -//function : LoadResult -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadResult(BRepAlgoAPI_BooleanOperation& MS) const { - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - TNaming_Builder Builder (ResultLabel()); - TopoDS_Shape aResult = MS.Shape(); - if (aResult.ShapeType() == TopAbs_COMPOUND) { - Standard_Integer nbSubResults = 0; - TopoDS_Iterator itr(aResult); - for (; itr.More(); itr.Next()) nbSubResults++; - if (nbSubResults == 1) { - itr.Initialize(aResult); - if (itr.More()) aResult = itr.Value(); - } - } - if (MS.Shape1().IsNull()) Builder.Generated(aResult); - else Builder.Modify(MS.Shape1(), aResult); -} - -//======================================================================= -//function : LoadDegenerated -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadDegenerated(BRepAlgoAPI_BooleanOperation& MS) const { - TopTools_IndexedMapOfShape allEdges; - TopExp::MapShapes(MS.Shape1(), TopAbs_EDGE, allEdges); - Standard_Integer i = 1; - for (; i <= allEdges.Extent(); i++) { - if (BRep_Tool::Degenerated(TopoDS::Edge(allEdges.FindKey(i)))) { - if (MS.IsDeleted(allEdges.FindKey(i))) { - TNaming_Builder DegeneratedBuilder(DeletedDegeneratedEdges()); - DegeneratedBuilder.Generated(allEdges.FindKey(i)); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(DegeneratedBuilder.NamedShape()->Label(), "DeletedDegenerated"); -#endif - } - } - } -} - -//======================================================================= -//function : IsResultChanged -//purpose : -//======================================================================= - -Standard_Boolean QANewBRepNaming_BooleanOperation::IsResultChanged(BRepAlgoAPI_BooleanOperation& MS) const { - TopoDS_Shape ResSh = MS.Shape(); - if (MS.Shape().ShapeType() == TopAbs_COMPOUND) { - Standard_Integer nbSubResults = 0; - TopoDS_Iterator itr(MS.Shape()); - for (; itr.More(); itr.Next()) nbSubResults++; - if (nbSubResults == 1) { - itr.Initialize(MS.Shape()); - if (itr.More()) ResSh = itr.Value(); - } - } - return MS.Shape1().IsSame(ResSh); -} -//======================================================================= -// Workaround for evolution 1:n -//======================================================================= -static Standard_Boolean IsValidSurfType(const TopoDS_Face& theFace) { - BRepAdaptor_Surface anAdapt(theFace); - Handle( Adaptor3d_HCurve ) aBasisCurve; - const GeomAbs_SurfaceType& aType = anAdapt.GetType(); - if(aType == GeomAbs_Cylinder || aType == GeomAbs_Cone) - return Standard_True; - else if(aType == GeomAbs_SurfaceOfRevolution){ - aBasisCurve = anAdapt.BasisCurve(); - if (aBasisCurve->GetType() == GeomAbs_Line) - return Standard_True; - } - else if(aType == GeomAbs_SurfaceOfExtrusion) { - aBasisCurve = anAdapt.BasisCurve(); - if (aBasisCurve->GetType() == GeomAbs_Circle || aBasisCurve->GetType() == GeomAbs_Ellipse) - return Standard_True; - } -#ifdef OCCT_DEBUG - ModDbgTools_Write(theFace, "Surf"); -#endif - return Standard_False; -} -//======================================================================= -//function : IsWRCase -//purpose : -//======================================================================= - -Standard_Boolean QANewBRepNaming_BooleanOperation::IsWRCase(const BRepAlgoAPI_BooleanOperation& MS) { - const TopoDS_Shape& ObjSh = MS.Shape1(); - const TopoDS_Shape& ToolSh = MS.Shape2(); - const TopAbs_ShapeEnum& Type1 = ShapeType(ObjSh); - if(Type1 == TopAbs_COMPOUND || Type1 > TopAbs_FACE) return Standard_False; - const TopAbs_ShapeEnum& Type2 = ShapeType(ToolSh); - if(Type2 == TopAbs_COMPOUND || Type2 > TopAbs_FACE) return Standard_False; - TopTools_ListOfShape aList; - - - if(Type1 != TopAbs_FACE) { - TopExp_Explorer anExp(ObjSh, TopAbs_FACE); - for(;anExp.More();anExp.Next()) { - if(IsValidSurfType(TopoDS::Face(anExp.Current()))) - aList.Append(anExp.Current()); - } - } else - if(IsValidSurfType(TopoDS::Face(ObjSh))) - aList.Append(ObjSh); - if(aList.Extent() == 1) { - if(Type2 != TopAbs_FACE) { - TopExp_Explorer anExp(ToolSh, TopAbs_FACE); - for(;anExp.More();anExp.Next()) { - if(IsValidSurfType(TopoDS::Face(anExp.Current()))) - aList.Append(anExp.Current()); - } - } else - if(IsValidSurfType(TopoDS::Face(ToolSh))) - aList.Append(ToolSh); - if(aList.Extent() == 2) return Standard_True; - } - return Standard_False; -} - -//======================================================================= -static gp_Ax1 ComputeAxis(const TopoDS_Shape& theShape) { - TopoDS_Face aFace; - TopExp_Explorer anExp(theShape, TopAbs_FACE); - for(;anExp.More();anExp.Next()) { - aFace = TopoDS::Face(anExp.Current()); - BRepAdaptor_Surface anAdapt(aFace); - Handle( Adaptor3d_HCurve ) aBasisCurve; - const GeomAbs_SurfaceType& aType = anAdapt.GetType(); - if(aType == GeomAbs_Cylinder) - return anAdapt.Cylinder().Axis(); - else if(aType == GeomAbs_Cone) - return anAdapt.Cone().Axis(); - else if(aType == GeomAbs_SurfaceOfRevolution) - return anAdapt.AxeOfRevolution(); - else if(aType == GeomAbs_SurfaceOfExtrusion) { - aBasisCurve = anAdapt.BasisCurve(); - if (aBasisCurve->GetType() == GeomAbs_Circle) - return aBasisCurve->Circle().Axis(); - else if(aBasisCurve->GetType() == GeomAbs_Ellipse) - return aBasisCurve->Ellipse().Axis(); - } - } - return gp::OX(); -} -//============================================================================== -// -//========================================================================== -static Standard_Integer Identify(const TopoDS_Face& theFace, const gp_Ax1& theAx) { - GProp_GProps aGProp; - BRepGProp::SurfaceProperties(theFace, aGProp); - gp_Pnt aPoint = aGProp.CentreOfMass(); - gp_Vec aV1(theAx.Direction()); - gp_Vec aV2(theAx.Location(), aPoint); -#ifdef OCCT_DEBUG - gp_Vec v1 = aV1.Crossed(aV2); - cout <<" Z of V1 = " << v1.XYZ().Z() << endl; -#endif - if((aV1.Crossed(aV2)).XYZ().Z() >= 0) return 1; //right orientation - return (-1); //left orientation -} - -//======================================================================= -//function : LoadModified11 -//purpose : 1 : 1 -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadModified11 (BRepAlgoAPI_BooleanOperation& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape) const - -{ - TopTools_MapOfShape View; - Standard_Boolean found = Standard_False; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if(Shapes.Extent() == 1) {found = Standard_True; break;} - } - - if(found) { - View.Clear(); - ShapeExplorer.Init (ShapeIn, KindOfShape); - TNaming_Builder Builder(ModifiedFaces()); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if(Shapes.Extent() > 1) continue; - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - const TopoDS_Shape& newShape = ShapesIterator.Value (); - if (!Root.IsSame (newShape)) { - //put shapes with evolution 1:1 (may be Compound) -#ifdef OCCT_DEBUG - TCollection_AsciiString entry; - TDF_Tool::Entry(Builder.NamedShape()->Label(), entry); - cout << "Add shape to Compound at Label = "<< entry < i2 - i1=i; - } - theListOut.Append(ArS.Value(i1)); - theListOut.Append(ArS.Value(i2)); - theListOut.Append(ArS.Value(i3)); //single -} -//======================================================================= -//function : Load1nFaces -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::Load1nFaces(BRepAlgoAPI_BooleanOperation& MS, const TopoDS_Shape& ShapeIn) const -{ - - TopTools_MapOfShape View; - TopTools_ListOfShape aListR; - TopExp_Explorer ShapeExplorer (ShapeIn, TopAbs_FACE); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if(Shapes.Extent() < 2) continue; - aListR.Append(Root); - } - if(ShapeIn.IsEqual(MS.Shape1())) - if(aListR.Extent() > 1) SortRootFaces(aListR, ShapeIn); - - TopTools_ListIteratorOfListOfShape Itr(aListR); - for(;Itr.More();Itr.Next()) { - const TopoDS_Shape& Root = Itr.Value(); - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - TopTools_ListOfShape aList; - gp_Ax1 anAx = ComputeAxis(MS.Shape2()); - if(Shapes.Extent() == 2) - Sort2Faces(Shapes, anAx, aList); - else if(Shapes.Extent() == 3) - Sort3Faces(Shapes, aList); - TopTools_ListIteratorOfListOfShape It(aList); - for(;It.More();It.Next()) { - TNaming_Builder aBuilder(NewShapes()); -// aBuilder.Modify(Root,It.Value ()); - aBuilder.Generated(It.Value ()); - } - } -} - -//======================================================================= -//function : LoadModified faces -//purpose : 1 : n modification -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadModified1n (BRepAlgoAPI_BooleanOperation& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape) const - -{ -//fill modification 1:n - TopTools_MapOfShape View; - Standard_Integer aNum = 0; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if(Shapes.Extent() >= 2) aNum += Shapes.Extent(); - } - - View.Clear(); - const TopoDS_Shape& Tool = MS.Shape2(); - ShapeExplorer.Init (Tool, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if(Shapes.Extent() >= 2) aNum += Shapes.Extent(); - } - - Handle(TDataStd_IntegerArray) aSAR; - if(!ResultLabel().FindAttribute(TDataStd_IntegerArray::GetID(), aSAR) ) { - //not find - aSAR = TDataStd_IntegerArray::Set(ResultLabel(), 1, 2); - aSAR->SetValue(1, 0); //tag num for faces structure - aSAR->SetValue(2, 0); //tag num for edges structure - } - - if(aSAR->Value(2)) { - Standard_Integer aNE =0; - TDF_Label aLab = ResultLabel().FindChild(aSAR->Value(2)); - Handle(TDataStd_Integer) anAtt; - if(aLab.FindAttribute(TDataStd_Integer::GetID(), anAtt) ) - aNE = anAtt->Get(); - TDF_Label aFLab = ResultLabel().FindChild(aLab.Tag() + aNE); - if(!aFLab.FindAttribute(TDataStd_Integer::GetID(), anAtt)) - aSAR->SetValue(1, 0); - } - TDF_Label aLabelFDS; - if(aSAR->Value(1)) - aLabelFDS = ResultLabel().FindChild(aSAR->Value(1)); // !=0 -already exist - else { - // initial creation of FDS structure - Handle(TDF_TagSource) aTS; - ResultLabel().FindAttribute (TDF_TagSource::GetID (), aTS); - aLabelFDS = NewShapes(); -// aLabelFDS = ResultLabel().FindChild(aSAR->Value(1)); - aSAR->SetValue(1, aLabelFDS.Tag()); //keep tag - aTS->Set(aLabelFDS.Tag()-1); - } - Handle(TDataStd_Integer) anAtt; - if(aLabelFDS.FindAttribute(TDataStd_Integer::GetID(), anAtt) ) { - // modification : check compatibility - if(anAtt->Get() != aNum) { - cout << "WARNING: Case isn't mantained - Number of Faces was changed!"<Get(); - for(Standard_Integer i=aLabelFDS.Tag(); i < aN; i++) { - TDF_Label aLab = ResultLabel().FindChild(i, Standard_False); - if(!aLab.IsNull()) { - Handle(TNaming_NamedShape) aNS; - if(aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - TopoDS_Shape aShape = aNS->Get(); - TNaming_Builder aBuilder(aLab); - aBuilder.Delete(aShape); //Deleted - } - } - } -// - Handle(TDF_TagSource) aTS; - ResultLabel().FindAttribute (TDF_TagSource::GetID (), aTS); - if(!aTS.IsNull()) - aTS->Set(aLabelFDS.Tag()); - anAtt->Set(aNum); - } - } else - TDataStd_Integer::Set(aLabelFDS, aNum); //keep number of faces - - Load1nFaces(MS, ShapeIn); - Load1nFaces(MS, Tool); -} - - -//====================================================================== -static Standard_Boolean IsDirectionPositive (const gp_Ax1& theAx, const gp_Pnt thePnt1, - const gp_Pnt thePnt2) { - Standard_Boolean isPositive; - gp_Vec aVec1(theAx.Direction()); - gp_Vec aVec2(thePnt1, thePnt2); -#ifdef OCCT_DEBUG -// gp_Vec v1 = aVec1.Crossed(aVec2); -// cout <<" Z of V1 = " << v1.XYZ().Z() << endl; -#endif - if((aVec1.Crossed(aVec2)).XYZ().Z() >= 0) isPositive = Standard_True; - else - isPositive = Standard_False; - return isPositive; -} -//====================================================================== -// i => ArS[i] : ArP[i] ; i = ArI[j] -//====================================================================== -static void SortEdges2(const TColgp_Array1OfPnt& theArP, const gp_Ax1& theAx, - TColStd_Array1OfInteger& theArI) -{ - gp_Pnt aPnt = theAx.Location(); - //sort : the nearest point must be first - Standard_Real aD1 = aPnt.Distance(theArP.Value(1)); - Standard_Real aD2 = aPnt.Distance(theArP.Value(2)); - if(aD1 < aD2) { - theArI.SetValue(1, 1); - theArI.SetValue(2, 2); - } else { - theArI.SetValue(1, 2); //change order - theArI.SetValue(2, 1); - } -} -//====================================================================== -// i => ArS[i] : ArP[i] ; i = ArI[j] -//====================================================================== -static void SortEdges3(const TopTools_Array1OfShape& theArS, const TColgp_Array1OfPnt& theArP, - const gp_Ax1& theAx, TColStd_Array1OfInteger& theArI) -{ - Standard_Integer i, j, i1 = 0,i2 = 0, i3 = 0; - TopoDS_Shape aV; - Standard_Boolean adjacent = Standard_False; - for(i=1;i<=3;i++) { - for(j=1;j<=3;j++) { - if(i==j) continue; - const TopoDS_Shape& aV11 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(i))); - const TopoDS_Shape& aV21 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(j))); - const TopoDS_Shape& aV22 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(j))); - if(aV11.IsSame(aV21) || aV11.IsSame(aV22)) {adjacent = Standard_True;aV = aV11;} - else { - const TopoDS_Shape& aV12 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(i))); - if(aV12.IsSame(aV21) || aV12.IsSame(aV22)) {adjacent = Standard_True;aV = aV12;} - } - if(adjacent) { - Standard_Integer aSum = i+j; - switch(aSum) { - case 3: //12 - i1 = 3;i2 = 1;i3 = 2; - break; - case 4: //13 - i1 = 2; i2 = 1;i3 = 3; - break; - case 5: //23 - i1 = 1; i2 = 2;i3 = 3; - } - break; - } - } - if(adjacent) break; - } - gp_Pnt aPnt = theAx.Location(); -// i1 - index of single edge - Standard_Real aD1 = aPnt.Distance(theArP.Value(i1)); - Standard_Real aD2 = aPnt.Distance(theArP.Value(i2)); - if(aD1 > aD2) { //cyclic shift - Standard_Integer aN = i3;// i1 => i3 - to the end - i3 = i1; i1 = aN; - // pair of adjacent i1, i2 - gp_Pnt aCP = BRep_Tool::Pnt(TopoDS::Vertex(aV)); - if(!IsDirectionPositive(theAx, aCP, theArP.Value(i1))) {//first must be positive direction - // change i1 <=>i2 - aN = i2; i2 = i1; - i1 = aN; - } - } else { - // pair of adjacent i2, i3 - gp_Pnt aCP = BRep_Tool::Pnt(TopoDS::Vertex(aV)); - if(!IsDirectionPositive(theAx, aCP, theArP.Value(i2))) {//first must be positive direction - // change i2 <=>i3 - Standard_Integer aN = i3; i3 = i2; - i2 = aN; - } - } -// order i1, i2, i3 - theArI.SetValue(1, i1); - theArI.SetValue(2, i2); - theArI.SetValue(3, i3); -} - -//====================================================================== -// i => ArS[i] : ArP[i] ; i = ArI[j] -//====================================================================== -static void SortEdges4(const TopTools_Array1OfShape& theArS, const TColgp_Array1OfPnt& theArP, - const gp_Ax1& theAx, TColStd_Array1OfInteger& theArI) -{ -// 1. find adjacent edges, build pairs in ArI -// 2. find nearest pair, reorganize ArI -// 3. sort inside pairs -// ======================================= - Standard_Integer i, j, i1 = 0,i2 = 0, i3 = 0, i4 = 0; -// 1. - TopoDS_Shape aV1; - for(i=1;i<=4;i++) { - const TopoDS_Shape& aV11 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(i))); - const TopoDS_Shape& aV12 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(i))); - Standard_Boolean aDjacent = Standard_False; - for(j=1;j<=4;j++) { - if(i==j) continue; - const TopoDS_Shape& aV21 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(j))); - const TopoDS_Shape& aV22 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(j))); - aDjacent = Standard_False; - if(aV11.IsSame(aV21) || aV11.IsSame(aV22)) {aDjacent = Standard_True;aV1 = aV11;} - else - if(aV12.IsSame(aV21) || aV12.IsSame(aV22)) {aDjacent = Standard_True;aV1 = aV12;} - if(aDjacent) { - aDjacent = Standard_True; - Standard_Integer aSum = i+j; - i1 = i; i2 = j; - switch(aSum) { - case 3: //12 - i3 = 3; i4 = 4; - break; - case 4: //13 - i3 = 2; i4 = 4; - break; - case 5: //14 - i3 = 2; i4 = 3; - break; - } - break; - } - } - if(aDjacent) break; - } -// i1,i2 - first pair of adjacent: aV1. -// i3,i4 - next pair of adjacent: aV2. -// find agjacent V (i3-i4) - TopoDS_Shape aV2; - const TopoDS_Shape& aV11 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(i3))); - const TopoDS_Shape& aV21 = TopExp::FirstVertex(TopoDS::Edge(theArS.Value(i4))); - const TopoDS_Shape& aV22 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(i4))); - if(aV11.IsSame(aV21) || aV11.IsSame(aV22)) aV2 = aV11; - else { - const TopoDS_Shape& aV12 = TopExp::LastVertex(TopoDS::Edge(theArS.Value(i3))); - if(aV12.IsSame(aV21) || aV12.IsSame(aV22)) aV2 = aV12; - } - -// 2. find nearest pair - gp_Pnt aCP1 = BRep_Tool::Pnt(TopoDS::Vertex(aV1)); - gp_Pnt aCP2 = BRep_Tool::Pnt(TopoDS::Vertex(aV2)); - gp_Pnt aPnt = theAx.Location(); - Standard_Real aD1 = aPnt.Distance(aCP1);//i1-i2 - Standard_Real aD2 = aPnt.Distance(aCP2);//i3-i4 - if(aD1 > aD2) { //change order of pairs - Standard_Integer a3 = i3;// i1,i2 => i3,i4 - to the end - Standard_Integer a4 = i4; - i3 = i1; i4 = i2; - i1 = a3; i2 = a4; - gp_Pnt aP = aCP2; - aCP2 = aCP1; - aCP1 = aP; - // pair of adjacent i1-i2 is the nearest - } - -// 3. sort inside pairs - if(!IsDirectionPositive(theAx, aCP1, theArP.Value(i1))) {//first must be positive direction - // change i1 <=> i2 - Standard_Integer aN = i2; i2 = i1; - i1 = aN; - } - - if(!IsDirectionPositive(theAx, aCP2, theArP.Value(i3))) {//first must be positive direction - // change i3 <=> i4 -#ifdef OCCT_DEBUG - cout << "SortEdges4: i3 = "<SetValue(1, 0); //tag num for faces structure - aSAR->SetValue(2, 0); //tag num for edges structure - } - TDF_Label aLabelEDS; - if(aSAR->Value(2)) aLabelEDS = ResultLabel().FindChild(aSAR->Value(2)); // !=0 - else { - // initial creation of EDS structure - aLabelEDS = NewShapes(); - aSAR->SetValue(2, aLabelEDS.Tag()); //keep tag - } - Handle(TDataStd_Integer) anAtt; - if(aLabelEDS.FindAttribute(TDataStd_Integer::GetID(), anAtt) ) { - // modification : check compatibility - if(anAtt->Get() != aNE1+aNE2) { - cout << "WARNING: Case isn't mantained - Number of Edges was changed!"<Get(); - for(Standard_Integer i=aLabelEDS.Tag(); i < aN; i++) { - TDF_Label aLab = ResultLabel().FindChild(i, Standard_False); - if(!aLab.IsNull()) { - Handle(TNaming_NamedShape) aNS; - if(aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - TopoDS_Shape aShape = aNS->Get(); - TNaming_Builder aBuilder(aLab); - aBuilder.Delete(aShape); //Deleted - } - } - } -// - Handle(TDF_TagSource) aTS; - ResultLabel().FindAttribute (TDF_TagSource::GetID (), aTS); - if(!aTS.IsNull()) - aTS->Set(aLabelEDS.Tag()); - anAtt->Set(aNE1+aNE2); - } - - } else - TDataStd_Integer::Set(aLabelEDS, aNE1+aNE2); //keep number of edges - -// Identification -// if(aNE1% 2 > 0) return; - gp_Ax1 anAx = ComputeAxis(MS.Shape2()); - Handle(TDF_TagSource) aTS; - ResultLabel().FindAttribute (TDF_TagSource::GetID (), aTS); - if(!aNE2 && aNE1) { // only 1 ent. -//Top || Bot ? - TopTools_Array1OfShape ArS1(1, aNE1); - SortEdges(aListE1, anAx, ArS1); - for(Standard_Integer i=1; i <= aNE1; i++) { - TopoDS_Shape aShape = ArS1.Value(i); - Standard_Integer aLabTag = aLabelEDS.Tag() + i -1; - TDF_Label aLab = ResultLabel().FindChild(aLabTag); - aTS->Set(aLabTag); - TNaming_Builder aBuilder(aLab); - aBuilder.Generated(aShape); - } - } else if(aNE1 && aNE2) { //2 ent. - TopTools_Array1OfShape ArS1(1, aNE1); - SortEdges(aListE1, anAx, ArS1); - TopTools_Array1OfShape ArS2(1, aNE2); - SortEdges(aListE2, anAx, ArS2); - - gp_Pnt aPnt1 = GetCenterPoint(aListE1.First()); -// gp_Pnt aPnt2 = GetCenterPoint(aListE2.First()); - if(IsDirectionPositive(anAx, anAx.Location(), aPnt1)) { - Standard_Integer i; - for(i=1; i <= aNE1; i++) { - TopoDS_Shape aShape = ArS1.Value(i); - Standard_Integer aLabTag = aLabelEDS.Tag() + i - 1; - TDF_Label aLab = ResultLabel().FindChild(aLabTag); - aTS->Set(aLabTag); - TNaming_Builder aBuilder(aLab); - aBuilder.Generated(aShape); - } - Standard_Integer start = aLabelEDS.Tag() + aNE1; - for(i=1; i <= aNE2; i++) { - TopoDS_Shape aShape = ArS2.Value(i); - Standard_Integer aLabTag = start + i - 1; - TDF_Label aLab = ResultLabel().FindChild(aLabTag); - aTS->Set(aLabTag); - TNaming_Builder aBuilder(aLab); - aBuilder.Generated(aShape); - } - } - else { - Standard_Integer i; - for(i=1; i <= aNE2; i++) { - TopoDS_Shape aShape = ArS2.Value(i); - Standard_Integer aLabTag = aLabelEDS.Tag() + i - 1; - TDF_Label aLab = ResultLabel().FindChild(aLabTag); - aTS->Set(aLabTag); - TNaming_Builder aBuilder(aLab); - aBuilder.Generated(aShape); - } - Standard_Integer start = aLabelEDS.Tag() + aNE2; - for(i=1; i <= aNE1; i++) { - TopoDS_Shape aShape = ArS1.Value(i); - Standard_Integer aLabTag = start + i - 1; - TDF_Label aLab = ResultLabel().FindChild(aLabTag); - aTS->Set(aLabTag); - TNaming_Builder aBuilder(aLab); - aBuilder.Generated(aShape); - } - } - } -} - -//======================================================================= -//function : ISWRCase2 -//purpose : -//======================================================================= -Standard_Boolean QANewBRepNaming_BooleanOperation::IsWRCase2(BRepAlgoAPI_BooleanOperation& MS) { - const TopoDS_Shape& Result = MS.Shape(); - const TopAbs_ShapeEnum& ResType = ShapeType(Result); - if(ResType == TopAbs_COMPOUND || ResType >= TopAbs_FACE) return Standard_False; - - TopExp_Explorer anExp(Result, TopAbs_FACE); - for(;anExp.More();anExp.Next()) { - if(IsValidSurfType(TopoDS::Face(anExp.Current()))) { - TopExp_Explorer anExp1(Result, TopAbs_FACE); - for(;anExp1.More();anExp1.Next()) { - if(!anExp1.Current().IsSame(anExp.Current()) && !IsValidSurfType(TopoDS::Face(anExp1.Current()))) { - TopTools_ListOfShape aList; - aList.Append(anExp.Current()); - aList.Append(anExp1.Current()); - TopTools_ListOfShape anEList; - FindAdjacent2(aList, anEList); - if(anEList.Extent() == 2) { - return Standard_True; - } - } - } - } - } - return Standard_False; -} - -//======================================================================= -//function : LoadWRCase -//purpose : -//======================================================================= - -void QANewBRepNaming_BooleanOperation::LoadWRCase(BRepAlgoAPI_BooleanOperation& MS) const { - const TopoDS_Shape& Result = MS.Shape(); - const TopAbs_ShapeEnum& ResType = ShapeType(Result); - if(ResType == TopAbs_COMPOUND || ResType >= TopAbs_FACE) return; - - TopExp_Explorer anExp(Result, TopAbs_FACE); - for(;anExp.More();anExp.Next()) { - if(IsValidSurfType(TopoDS::Face(anExp.Current()))) { - TopExp_Explorer anExp1(Result, TopAbs_FACE); - for(;anExp1.More();anExp1.Next()) { - if(!anExp1.Current().IsSame(anExp.Current()) && !IsValidSurfType(TopoDS::Face(anExp1.Current()))) { - TopTools_ListOfShape aList; - aList.Append(anExp.Current()); - aList.Append(anExp1.Current()); - TopTools_ListOfShape anEList; - FindAdjacent2(aList, anEList); - if(anEList.Extent() == 2) { - - TopTools_ListIteratorOfListOfShape anEIt(anEList); - GProp_GProps anE1Props, anE2Props; - BRepGProp::LinearProperties(anEList.First(), anE1Props); - BRepGProp::LinearProperties(anEList.Last(), anE2Props); - - const TDF_Label& WRE1Label = ResultLabel().NewChild(); - const TDF_Label& WRE2Label = ResultLabel().NewChild(); - const TDF_Label& WRV1Label = ResultLabel().NewChild(); - const TDF_Label& WRV2Label = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(WRE1Label, "WorkAroundEdge1"); - TDataStd_Name::Set(WRE2Label, "WorkAroundEdge2"); - TDataStd_Name::Set(WRV1Label, "WorkAroundVertex1"); - TDataStd_Name::Set(WRV2Label, "WorkAroundVertex2"); -#endif - - TNaming_Builder anEBuilder1(WRE1Label); - TNaming_Builder anEBuilder2(WRE2Label); - TNaming_Builder aVBuilder1(WRV1Label); - TNaming_Builder aVBuilder2(WRV2Label); - - if(anE1Props.Mass() > anE2Props.Mass()) { - anEBuilder1.Generated(anEList.Last()); - anEBuilder2.Generated(anEList.First()); - aVBuilder1.Generated(TopExp::FirstVertex(TopoDS::Edge(anEList.Last()))); - aVBuilder2.Generated(TopExp::LastVertex(TopoDS::Edge(anEList.Last()))); - } else { - anEBuilder1.Generated(anEList.First()); - anEBuilder2.Generated(anEList.Last()); - aVBuilder1.Generated(TopExp::FirstVertex(TopoDS::Edge(anEList.First()))); - aVBuilder2.Generated(TopExp::LastVertex(TopoDS::Edge(anEList.First()))); - } - } - } - } - } - } -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.hxx b/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.hxx deleted file mode 100644 index 2c1d70cbac..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperation.hxx +++ /dev/null @@ -1,140 +0,0 @@ -// Created on: 1999-09-27 -// Created by: Open CASCADE Support -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_BooleanOperation_HeaderFile -#define _QANewBRepNaming_BooleanOperation_HeaderFile - -#include -#include -#include - -#include -#include -#include -class TDF_Label; -class BRepAlgoAPI_BooleanOperation; -class TopoDS_Shape; - - -//! To load the BooleanOperation results -class QANewBRepNaming_BooleanOperation : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Returns the label to insert modified faces of an Object. - Standard_EXPORT TDF_Label ModifiedFaces() const; - - //! Returns the label to insert modified edges of an Object. - Standard_EXPORT TDF_Label ModifiedEdges() const; - - //! Returns the label to insert deleted faces of an Object. - Standard_EXPORT TDF_Label DeletedFaces() const; - - //! Returns the label to insert deleted edges of an Object. - Standard_EXPORT TDF_Label DeletedEdges() const; - - //! Returns the label to insert deleted vertices of an Object. - Standard_EXPORT TDF_Label DeletedVertices() const; - - //! Returns the label to insert added shapes to an Object - //! (given from tool). - Standard_EXPORT TDF_Label NewShapes() const; - - Standard_EXPORT TDF_Label Content() const; - - Standard_EXPORT TDF_Label DeletedDegeneratedEdges() const; - - //! Returns true if the result is not the same as the object shape. - Standard_EXPORT Standard_Boolean IsResultChanged (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! If the shape is a compound the method - //! returns the underlying shape type. - Standard_EXPORT static TopAbs_ShapeEnum ShapeType (const TopoDS_Shape& theShape); - - //! Returns true if workaround case identified - Standard_EXPORT static Standard_Boolean IsWRCase (const BRepAlgoAPI_BooleanOperation& theMS); - - //! Returns true if workaround case identified - Standard_EXPORT static Standard_Boolean IsWRCase2 (BRepAlgoAPI_BooleanOperation& MS); - - - - -protected: - - - Standard_EXPORT QANewBRepNaming_BooleanOperation(); - - Standard_EXPORT QANewBRepNaming_BooleanOperation(const TDF_Label& ResultLabel); - - //! If the shape is a compound the method - //! returns the underlying shape. - Standard_EXPORT TopoDS_Shape GetShape (const TopoDS_Shape& theShape) const; - - //! A default implementation for naming of a wire as an object of - //! a boolean operation. - Standard_EXPORT void LoadWire (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! A default implementation for naming of a shell as an object of - //! a boolean operation. - Standard_EXPORT void LoadShell (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! Loads the content of the result. - Standard_EXPORT void LoadContent (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! Loads the result. - Standard_EXPORT void LoadResult (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! Loads the deletion of the degenerated edges. - Standard_EXPORT void LoadDegenerated (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - //! To process special cases with evolution 1 to n - Standard_EXPORT void LoadModified1n (BRepAlgoAPI_BooleanOperation& theMS, const TopoDS_Shape& theShapeIn, const TopAbs_ShapeEnum theKindOfShape) const; - - //! To process special cases with evolution 1 to 1 - Standard_EXPORT void LoadModified11 (BRepAlgoAPI_BooleanOperation& theMS, const TopoDS_Shape& theShapeIn, const TopAbs_ShapeEnum theKindOfShape) const; - - //! To process special case when result has symmetrical edges - Standard_EXPORT void LoadSymmetricalEdges (BRepAlgoAPI_BooleanOperation& theMS) const; - - Standard_EXPORT void LoadWRCase (BRepAlgoAPI_BooleanOperation& theMS) const; - - - - -private: - - - //! used inside LoadModified1n - Standard_EXPORT void Load1nFaces (BRepAlgoAPI_BooleanOperation& theMS, const TopoDS_Shape& theShapeIn) const; - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_BooleanOperation_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Box.cxx b/src/QANewBRepNaming/QANewBRepNaming_Box.cxx deleted file mode 100644 index cf3676c4bf..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Box.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// Created on: 1999-09-24 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Box -//purpose : -//======================================================================= -QANewBRepNaming_Box::QANewBRepNaming_Box() {} - -//======================================================================= -//function : QANewBRepNaming_Box -//purpose : -//======================================================================= - -QANewBRepNaming_Box::QANewBRepNaming_Box(const TDF_Label& Label) - : QANewBRepNaming_TopNaming(Label) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Box::Init(const TDF_Label& Label) { - if(Label.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Box::Init The Result label is Null ..."); - myResultLabel = Label; -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Box::Load (BRepPrimAPI_MakeBox& MS, const QANewBRepNaming_TypeOfPrimitive3D Type) const { - //Load the faces of the box : - TopoDS_Face BottomFace = MS.BottomFace (); - TNaming_Builder BottomFaceIns (Bottom ()); - BottomFaceIns.Generated (BottomFace); - - TopoDS_Face TopFace = MS.TopFace (); - TNaming_Builder TopFaceIns (Top ()); - TopFaceIns.Generated (TopFace); - - TopoDS_Face FrontFace = MS.FrontFace (); - TNaming_Builder FrontFaceIns (Front ()); - FrontFaceIns.Generated (FrontFace); - - TopoDS_Face RightFace = MS.RightFace (); - TNaming_Builder RightFaceIns (Right ()); - RightFaceIns.Generated (RightFace); - - TopoDS_Face BackFace = MS.BackFace (); - TNaming_Builder BackFaceIns (Back ()); - BackFaceIns.Generated (BackFace); - - TopoDS_Face LeftFace = MS.LeftFace (); - TNaming_Builder LeftFaceIns (Left ()); - LeftFaceIns.Generated (LeftFace); - - TNaming_Builder Builder (ResultLabel()); - if (Type == QANewBRepNaming_SOLID) Builder.Generated (MS.Solid()); - else if (Type == QANewBRepNaming_SHELL) Builder.Generated (MS.Shell()); - else { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Box::Load(): Unexpected type of result"< -#include -#include - -#include -#include -class TDF_Label; -class BRepPrimAPI_MakeBox; - - -//! To load the Box results -class QANewBRepNaming_Box : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Box(); - - Standard_EXPORT QANewBRepNaming_Box(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Load the box in the data framework - Standard_EXPORT void Load (BRepPrimAPI_MakeBox& MakeShape, const QANewBRepNaming_TypeOfPrimitive3D Type) const; - - //! Returns the label of the back face of a box . - Standard_EXPORT TDF_Label Back() const; - - //! Returns the label of the bottom face of a box . - Standard_EXPORT TDF_Label Bottom() const; - - //! Returns the label of the front face of a box . - Standard_EXPORT TDF_Label Front() const; - - //! Returns the label of the left face of a box . - Standard_EXPORT TDF_Label Left() const; - - //! Returns the label of the right face of a box . - Standard_EXPORT TDF_Label Right() const; - - //! Returns the label of the top face of a box . - Standard_EXPORT TDF_Label Top() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Box_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Chamfer.cxx b/src/QANewBRepNaming/QANewBRepNaming_Chamfer.cxx deleted file mode 100644 index 206d3f3865..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Chamfer.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Created on: 1997-09-22 -// Created by: VAUTHIER Jean-Claude -// Copyright (c) 1997-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Chamfer -//purpose : -//======================================================================= -QANewBRepNaming_Chamfer::QANewBRepNaming_Chamfer() -{} - -//======================================================================= -//function : QANewBRepNaming_Chamfer -//purpose : -//======================================================================= - -QANewBRepNaming_Chamfer::QANewBRepNaming_Chamfer(const TDF_Label& ResultLabel): - QANewBRepNaming_TopNaming(ResultLabel) -{} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Chamfer::Init(const TDF_Label& ResultLabel) -{ - if(ResultLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Chamfer::Init The Result label is Null ..."); - myResultLabel = ResultLabel; -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Chamfer::Load (const TopoDS_Shape& part, - BRepFilletAPI_MakeChamfer& mkChamfer) const -{ - TNaming_Builder Ins(ResultLabel()); - Ins.Modify (part, mkChamfer.Shape()); - - //New Faces generated from edges - TNaming_Builder Builder1(FacesFromEdges()); - QANewBRepNaming_Loader::LoadGeneratedShapes (mkChamfer, part, TopAbs_EDGE, Builder1); - - //Faces of the initial shape modified by MakeChamfer - TNaming_Builder Builder2(ModifiedFaces()); - QANewBRepNaming_Loader::LoadModifiedShapes (mkChamfer, part, TopAbs_FACE, Builder2, Standard_False); - - //Deleted Faces of the initial shape - TNaming_Builder Builder3(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(mkChamfer, part, TopAbs_FACE, Builder3); -} - -//======================================================================= -//function : FacesFromEdges -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Chamfer::FacesFromEdges() const -{ - return ResultLabel().FindChild(1, Standard_True); -} - -//======================================================================= -//function : ModifiedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Chamfer::ModifiedFaces() const -{ - return ResultLabel().FindChild(2, Standard_True); -} - -//======================================================================= -//function : DeletedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Chamfer::DeletedFaces() const -{ - return ResultLabel().FindChild(3, Standard_True); -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Chamfer.hxx b/src/QANewBRepNaming/QANewBRepNaming_Chamfer.hxx deleted file mode 100644 index 837709bec4..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Chamfer.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Created on: 1997-09-22 -// Created by: VAUTHIER Jean-Claude -// Copyright (c) 1997-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_Chamfer_HeaderFile -#define _QANewBRepNaming_Chamfer_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class TopoDS_Shape; -class BRepFilletAPI_MakeChamfer; - - -//! To load the Chamfer results -class QANewBRepNaming_Chamfer : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Chamfer(); - - Standard_EXPORT QANewBRepNaming_Chamfer(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (const TopoDS_Shape& part, BRepFilletAPI_MakeChamfer& mkChamfer) const; - - //! Returns the label of faces generated from edges - Standard_EXPORT TDF_Label FacesFromEdges() const; - - //! Returns the label of modified faces - Standard_EXPORT TDF_Label ModifiedFaces() const; - - //! Returns the label of deleted faces - Standard_EXPORT TDF_Label DeletedFaces() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Chamfer_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Common.cxx b/src/QANewBRepNaming/QANewBRepNaming_Common.cxx deleted file mode 100644 index 5bcd3997d0..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Common.cxx +++ /dev/null @@ -1,215 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Common -//purpose : -//======================================================================= -QANewBRepNaming_Common::QANewBRepNaming_Common() {} - -//======================================================================= -//function : QANewBRepNaming_Common -//purpose : -//======================================================================= - -QANewBRepNaming_Common::QANewBRepNaming_Common(const TDF_Label& ResultLabel) - :QANewBRepNaming_BooleanOperation(ResultLabel) {} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Common::Load(BRepAlgoAPI_BooleanOperation& MS) const { - TopoDS_Shape ResSh = MS.Shape(); - if (ResSh.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Common::Load(): The result of the Common is null"< Wire/Edge - TopoDS_Shape aWire, aSolid; - if(anArg == WIRE_SOLID) { - aWire = ObjSh; aSolid = ToolSh;} - else { - aWire = ToolSh; aSolid = ObjSh;} -//Modified - TNaming_Builder ModEBuilder(ModifiedEdges()); - QANewBRepNaming_Loader::LoadModifiedShapes(MS, aWire, TopAbs_EDGE, ModEBuilder, Standard_True); -//Generated vertexes - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, aWire, TopAbs_EDGE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, aSolid, TopAbs_FACE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, aSolid, TopAbs_VERTEX, nBuilder); - } -//Deleted (Faces, Edges, Vertexes) - if(MS.HasDeleted()){ - TNaming_Builder DelFBuilder(DeletedFaces()); // all deleted shapes - QANewBRepNaming_Loader::LoadDeletedShapes(MS, aSolid, TopAbs_FACE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, aWire, TopAbs_EDGE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, aWire, TopAbs_VERTEX, DelFBuilder); - } - } - else if (anArg == SOLID_SHELL || anArg == SHELL_SOLID) { //Result: Shell/Face - TopoDS_Shape aShell; - if(anArg == SHELL_SOLID) - aShell = ObjSh; - else - aShell = ToolSh; -//Modified - TNaming_Builder ModFBuilder(ModifiedFaces()); - QANewBRepNaming_Loader::LoadModifiedShapes(MS, aShell, TopAbs_FACE, ModFBuilder, Standard_True); - TNaming_Builder ModEBuilder(ModifiedEdges()); - QANewBRepNaming_Loader::LoadModifiedShapes(MS, aShell, TopAbs_EDGE, ModEBuilder, Standard_True); -//Generated edges (edges of free boundaries) - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape1(), TopAbs_FACE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, MS.Shape2(), TopAbs_FACE, nBuilder); - } -//Deleted - if(MS.HasDeleted()){ - TNaming_Builder DelFBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape1(), TopAbs_FACE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, MS.Shape2(), TopAbs_FACE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, aShell, TopAbs_EDGE, DelFBuilder); - } - } - else { //Solid -#ifdef OCCT_DEBUG -// cout <<"Solid case - modified = " << MS.HasModified()<< endl; -#endif - TNaming_Builder ModBuilder(ModifiedFaces()); - QANewBRepNaming_Loader::LoadModifiedShapes (MS, ObjSh, TopAbs_FACE, ModBuilder, Standard_True); - QANewBRepNaming_Loader::LoadModifiedShapes (MS, ToolSh, TopAbs_FACE, ModBuilder, Standard_True); - if(MS.HasGenerated()) { - TNaming_Builder GenBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, GenBuilder); - } - if(MS.HasDeleted()){ - TNaming_Builder DelBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes (MS, ObjSh, TopAbs_FACE, DelBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes (MS, ToolSh, TopAbs_FACE, DelBuilder); - - } - } - LoadDegenerated(MS); - - // Naming of the content: - if (ShapeType(ObjSh) == TopAbs_SOLID) LoadContent(MS); -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Common.hxx b/src/QANewBRepNaming/QANewBRepNaming_Common.hxx deleted file mode 100644 index 92c8acf779..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Common.hxx +++ /dev/null @@ -1,65 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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. - -#ifndef _QANewBRepNaming_Common_HeaderFile -#define _QANewBRepNaming_Common_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class BRepAlgoAPI_BooleanOperation; - - - -class QANewBRepNaming_Common : public QANewBRepNaming_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Common(); - - Standard_EXPORT QANewBRepNaming_Common(const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Common_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Cut.cxx b/src/QANewBRepNaming/QANewBRepNaming_Cut.cxx deleted file mode 100644 index 3de38eb8b5..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Cut.cxx +++ /dev/null @@ -1,168 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Cut -//purpose : -//======================================================================= -QANewBRepNaming_Cut::QANewBRepNaming_Cut() {} - -//======================================================================= -//function : QANewBRepNaming_Cut -//purpose : -//======================================================================= - -QANewBRepNaming_Cut::QANewBRepNaming_Cut(const TDF_Label& ResultLabel) - :QANewBRepNaming_BooleanOperation(ResultLabel) {} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Cut::Load(BRepAlgoAPI_BooleanOperation& MS) const { - - TopoDS_Shape ResSh = MS.Shape(); - const TopoDS_Shape& ObjSh = MS.Shape1(); - const TopoDS_Shape& ToolSh = MS.Shape2(); - const TopAbs_ShapeEnum& TypeSh = ShapeType(ObjSh); - - if (ResSh.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Cut::Load(): The result of the boolean operation is null"< -#include -#include - -#include -class TDF_Label; -class BRepAlgoAPI_BooleanOperation; - - - -class QANewBRepNaming_Cut : public QANewBRepNaming_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Cut(); - - Standard_EXPORT QANewBRepNaming_Cut(const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Cut_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Cylinder.cxx b/src/QANewBRepNaming/QANewBRepNaming_Cylinder.cxx deleted file mode 100644 index bc7aa654a5..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Cylinder.cxx +++ /dev/null @@ -1,159 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#endif - -//======================================================================= -//function : QANewBRepNaming_Cylinder -//purpose : -//======================================================================= - -QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder() {} - -//======================================================================= -//function : QANewBRepNaming_Cylinder -//purpose : -//======================================================================= - -QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder(const TDF_Label& ResultLabel): - QANewBRepNaming_TopNaming(ResultLabel) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Cylinder::Init(const TDF_Label& ResultLabel) { - if(ResultLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Cylinder::Init The Result label is Null ..."); - myResultLabel = ResultLabel; -} - -//======================================================================= -//function : Bottom -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Cylinder::Bottom() const { -#ifdef OCCT_DEBUG - TDataStd_Name::Set(ResultLabel().FindChild(1, Standard_True), "Bottom"); -#endif - return ResultLabel().FindChild(1, Standard_True); -} - -//======================================================================= -//function : Top -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Cylinder::Top() const { -#ifdef OCCT_DEBUG - TDataStd_Name::Set(ResultLabel().FindChild(2, Standard_True), "Top"); -#endif - return ResultLabel().FindChild(2, Standard_True); -} - -//======================================================================= -//function : Lateral -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Cylinder::Lateral() const { -#ifdef OCCT_DEBUG - TDataStd_Name::Set(ResultLabel().FindChild(3, Standard_True), "Lateral"); -#endif - return ResultLabel().FindChild(3, Standard_True); -} - -//======================================================================= -//function : StartSide -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Cylinder::StartSide() const { -#ifdef OCCT_DEBUG - TDataStd_Name::Set(ResultLabel().FindChild(4, Standard_True), "StartSide"); -#endif - return ResultLabel().FindChild(4, Standard_True); -} - -//======================================================================= -//function : EndSide -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Cylinder::EndSide() const { -#ifdef OCCT_DEBUG - TDataStd_Name::Set(ResultLabel().FindChild(5, Standard_True), "EndSide"); -#endif - return ResultLabel().FindChild(5, Standard_True); -} - -//======================================================================= -//function : Load (Cylinder) -//purpose : -//======================================================================= - -void QANewBRepNaming_Cylinder::Load (BRepPrimAPI_MakeCylinder& mkCylinder, - const QANewBRepNaming_TypeOfPrimitive3D Type) const -{ - BRepPrim_Cylinder& S = mkCylinder.Cylinder(); - - if (S.HasBottom()) { - TopoDS_Face BottomFace = S.BottomFace(); - TNaming_Builder BottomFaceIns(Bottom()); - BottomFaceIns.Generated(BottomFace); - } - - if (S.HasTop()) { - TopoDS_Face TopFace = S.TopFace(); - TNaming_Builder TopFaceIns(Top()); - TopFaceIns.Generated(TopFace); - } - - TopoDS_Face LateralFace = S.LateralFace(); - TNaming_Builder LateralFaceIns(Lateral()); - LateralFaceIns.Generated(LateralFace); - - if (S.HasSides()) { - TopoDS_Face StartFace = S.StartFace(); - TNaming_Builder StartFaceIns(StartSide()); - StartFaceIns.Generated(StartFace); - TopoDS_Face EndFace = S.EndFace(); - TNaming_Builder EndFaceIns(EndSide()); - EndFaceIns.Generated(EndFace); - } - - TNaming_Builder Builder (ResultLabel()); - if (Type == QANewBRepNaming_SOLID) Builder.Generated (mkCylinder.Solid()); - else if (Type == QANewBRepNaming_SHELL) Builder.Generated (mkCylinder.Shell()); - else { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Cylinder::Load(): Unexpected type of result"< -#include -#include - -#include -#include -class TDF_Label; -class BRepPrimAPI_MakeCylinder; - - -//! To load the Cylinder results -class QANewBRepNaming_Cylinder : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Cylinder(); - - Standard_EXPORT QANewBRepNaming_Cylinder(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepPrimAPI_MakeCylinder& mkCylinder, const QANewBRepNaming_TypeOfPrimitive3D Type) const; - - //! Returns the label of the bottom - //! face of the cylinder. - Standard_EXPORT TDF_Label Bottom() const; - - //! Returns the label of the top - //! face of the cylinder. - Standard_EXPORT TDF_Label Top() const; - - //! Returns the label of the lateral - //! face of the cylinder. - Standard_EXPORT TDF_Label Lateral() const; - - //! Returns the label of the first - //! side of the cylinder - Standard_EXPORT TDF_Label StartSide() const; - - //! Returns the label of the second - //! side of the cylinder. - Standard_EXPORT TDF_Label EndSide() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Cylinder_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Fillet.cxx b/src/QANewBRepNaming/QANewBRepNaming_Fillet.cxx deleted file mode 100644 index 2f81ffb37c..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Fillet.cxx +++ /dev/null @@ -1,347 +0,0 @@ -// Created on: 2001-07-02 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Fillet -//purpose : -//======================================================================= -QANewBRepNaming_Fillet::QANewBRepNaming_Fillet() -{} - -//======================================================================= -//function : QANewBRepNaming_Fillet -//purpose : -//======================================================================= - -QANewBRepNaming_Fillet::QANewBRepNaming_Fillet(const TDF_Label& theLabel): - QANewBRepNaming_TopNaming(theLabel) -{} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Fillet::Init(const TDF_Label& theLabel) -{ - if(theLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Fillet::Init: The Result label is Null ..."); - myResultLabel = theLabel; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= -static Standard_Boolean IsValidSurfType(const TopoDS_Face& theFace) { - BRepAdaptor_Surface anAdapt(theFace); - Handle( Adaptor3d_HCurve ) aBasisCurve; - const GeomAbs_SurfaceType& aType = anAdapt.GetType(); - if(aType == GeomAbs_Cylinder || aType == GeomAbs_Cone) - return Standard_True; - else if(aType == GeomAbs_SurfaceOfRevolution){ - aBasisCurve = anAdapt.BasisCurve(); - if (aBasisCurve->GetType() == GeomAbs_Line) - return Standard_True; - } - else if(aType == GeomAbs_SurfaceOfExtrusion) { - aBasisCurve = anAdapt.BasisCurve(); - if (aBasisCurve->GetType() == GeomAbs_Circle || aBasisCurve->GetType() == GeomAbs_Ellipse) - return Standard_True; - } - return Standard_False; -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Fillet::Load(const TopoDS_Shape& theContext, - BRepFilletAPI_MakeFillet& theMkFillet) const -{ - TNaming_Builder aFilletBuilder(ResultLabel()); - TopoDS_Shape aResult = theMkFillet.Shape(); - - if (aResult.ShapeType() == TopAbs_COMPOUND) { - Standard_Integer nbSubResults = 0; - TopoDS_Iterator itr(aResult); - for (; itr.More(); itr.Next()) nbSubResults++; - if (nbSubResults == 1) { - itr.Initialize(aResult); - if (itr.More()) aResult = itr.Value(); - } - } - if (aResult.IsNull()) aFilletBuilder.Generated(aResult); - else - aFilletBuilder.Modify(theContext, aResult); - - //WARNING: Not implemented case: - // Cut cylinder by Shpere, shpere cuts lateral and top face of cylinder. - // SIM edges of cylinder and sphere not intersected. - // Result of fillet do not intersects SIM edge of cylinder - - // Try to edintify workaround with intersection of SIM edge. - const TopAbs_ShapeEnum& Type = theContext.ShapeType(); - Standard_Boolean IsFound = Standard_False; - if(Type != TopAbs_COMPOUND || Type < TopAbs_FACE) { - // Check for SIM edge presence in some face - TopExp_Explorer anExp(theContext, TopAbs_FACE); - - for(;anExp.More();anExp.Next()) { - if(IsValidSurfType(TopoDS::Face(anExp.Current()))) { - IsFound = Standard_True; - break; - } - } - } - - Standard_Boolean IsWRCase = Standard_False; - FacesFromEdges().ForgetAllAttributes(); - - if(IsFound) { - TopExp_Explorer ShapeExplorer (theContext, TopAbs_EDGE); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& aRoot = ShapeExplorer.Current (); - const TopTools_ListOfShape& aShapes = theMkFillet.Generated (aRoot); - if(aShapes.Extent() == 2) { - if(aShapes.First().ShapeType() == TopAbs_FACE && aShapes.Last().ShapeType() == TopAbs_FACE) { - IsWRCase = Standard_True; - GProp_GProps aF1Props, aF2Props; - BRepGProp::SurfaceProperties(aShapes.First(), aF1Props); - BRepGProp::SurfaceProperties(aShapes.Last(), aF2Props); - TNaming_Builder aF1Builder(WRFace1()); - TNaming_Builder aF2Builder(WRFace2()); - - // Naming of Faces - TopoDS_Shape aLessFace; - if(aF1Props.Mass() < aF2Props.Mass()) { - aLessFace = aShapes.First(); - aF1Builder.Generated(aShapes.First()); - aF2Builder.Generated(aShapes.Last()); - } else { - aLessFace = aShapes.Last(); - aF1Builder.Generated(aShapes.Last()); - aF2Builder.Generated(aShapes.First()); - } - - // Naming of Common Edges - TopExp_Explorer anExp1(aShapes.First(), TopAbs_EDGE); - TopTools_ListOfShape aCommonEdges; - for(;anExp1.More();anExp1.Next()) { - TopExp_Explorer anExp2(aShapes.Last(), TopAbs_EDGE); - for(;anExp2.More();anExp2.Next()) - if(anExp1.Current().IsSame(anExp2.Current())) { - aCommonEdges.Append(anExp1.Current()); - break; - } - } - - if(aCommonEdges.Extent() != 2) - break; - - anExp1.Init(aLessFace, TopAbs_EDGE); - TopTools_ListOfShape anOtherEdges; - for(;anExp1.More();anExp1.Next()) { - if(!anExp1.Current().IsSame(aCommonEdges.First()) && !anExp1.Current().IsSame(aCommonEdges.Last())) - anOtherEdges.Append(anExp1.Current()); - } - - GProp_GProps anE1Props, anE2Props; - BRepGProp::LinearProperties(anOtherEdges.First(), anE1Props); - BRepGProp::LinearProperties(anOtherEdges.Last(), anE2Props); - gp_Pnt P1, P2; - if(anE1Props.Mass() < anE2Props.Mass()) { - P1 = anE1Props.CentreOfMass(); - P2 = anE2Props.CentreOfMass(); - } else { - P1 = anE2Props.CentreOfMass(); - P2 = anE1Props.CentreOfMass(); - } - - BRepGProp::LinearProperties(aCommonEdges.First(), anE1Props); - BRepGProp::LinearProperties(aCommonEdges.Last(), anE2Props); - - gp_Pnt EP1 = anE1Props.CentreOfMass(); - gp_Pnt EP2 = anE2Props.CentreOfMass(); - - gp_Vec aMainVec(P1, P2); - gp_Vec aV1(P1, EP1); - gp_Vec aV2(P1, EP2); -#ifdef OCCT_DEBUG - cout << "P1=" << P1.X() << " " << P1.Y() << " " << P1.Z() << endl; - cout << "P2=" << P2.X() << " " << P2.Y() << " " << P2.Z() << endl; - cout << "EP1=" << EP1.X() << " " << EP1.Y() << " " << EP1.Z() << endl; - cout << "EP2=" << EP2.X() << " " << EP2.Y() << " " << EP2.Z() << endl; - cout << endl; -#endif - - gp_Vec aCr1 = aMainVec.Crossed(aV1); - gp_Vec aCr2 = aMainVec.Crossed(aV2); - TopoDS_Shape aFirst, aSecond; - if(aCr1.X() > 0 && aCr2.X() < 0) { - aFirst = aCommonEdges.First(); - aSecond = aCommonEdges.Last(); - } else if(aCr2.X() > 0 && aCr1.X() < 0) { - aFirst = aCommonEdges.Last(); - aSecond = aCommonEdges.First(); - } else if(aCr1.Y() > 0 && aCr2.Y() < 0) { - aFirst = aCommonEdges.First(); - aSecond = aCommonEdges.Last(); - } else if(aCr2.Y() > 0 && aCr1.Y() < 0) { - aFirst = aCommonEdges.Last(); - aSecond = aCommonEdges.First(); - } else if(aCr1.Z() > 0 && aCr2.Z() < 0) { - aFirst = aCommonEdges.First(); - aSecond = aCommonEdges.Last(); - } else if(aCr2.Z() > 0 && aCr1.Z() < 0) { - aFirst = aCommonEdges.Last(); - aSecond = aCommonEdges.First(); - } - - TNaming_Builder anE1Builder(WREdge1()); - TNaming_Builder anE2Builder(WREdge2()); - anE1Builder.Generated(aFirst); - anE2Builder.Generated(aSecond); - - break; - } - } - } - } - - if(!IsWRCase) { - WRFace1().ForgetAllAttributes(); - WRFace2().ForgetAllAttributes(); - WREdge1().ForgetAllAttributes(); - WREdge2().ForgetAllAttributes(); - //New faces generated from edges - TNaming_Builder anEFacesBuilder(FacesFromEdges()); - QANewBRepNaming_Loader::LoadGeneratedShapes(theMkFillet, theContext, TopAbs_EDGE, anEFacesBuilder); - } - - //Faces of the initial shape modified by theMkFillet - TNaming_Builder aMFacesBuilder(ModifiedFaces()); - QANewBRepNaming_Loader::LoadModifiedShapes(theMkFillet, theContext, TopAbs_FACE, aMFacesBuilder, Standard_False); - - //Deleted faces of the initial shape - TNaming_Builder aDFacesBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(theMkFillet, theContext, TopAbs_FACE, aDFacesBuilder); - - //New faces generated from vertices - TNaming_Builder aVFacesBuilder(FacesFromVertices()); - QANewBRepNaming_Loader::LoadGeneratedShapes(theMkFillet, theContext, TopAbs_VERTEX, aVFacesBuilder); -} - -//======================================================================= -//function : DeletedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Fillet::DeletedFaces() const -{ - return ResultLabel().FindChild(1, Standard_True); -} - -//======================================================================= -//function : ModifiedFaces -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Fillet::ModifiedFaces() const -{ - return ResultLabel().FindChild(2, Standard_True); -} - -//======================================================================= -//function : FacesFromEdges -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Fillet::FacesFromEdges() const -{ - return ResultLabel().FindChild(4, Standard_True); -} - -//======================================================================= -//function : FacesFromVertices -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Fillet::FacesFromVertices() const -{ - return ResultLabel().FindChild(3, Standard_True); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= -TDF_Label QANewBRepNaming_Fillet::WRFace1() const -{ - return ResultLabel().FindChild(4, Standard_True); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= -TDF_Label QANewBRepNaming_Fillet::WRFace2() const -{ - return ResultLabel().FindChild(5, Standard_True); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= -TDF_Label QANewBRepNaming_Fillet::WREdge1() const -{ - return ResultLabel().FindChild(6, Standard_True); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= -TDF_Label QANewBRepNaming_Fillet::WREdge2() const -{ - return ResultLabel().FindChild(7, Standard_True); -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Fillet.hxx b/src/QANewBRepNaming/QANewBRepNaming_Fillet.hxx deleted file mode 100644 index 0938115da0..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Fillet.hxx +++ /dev/null @@ -1,94 +0,0 @@ -// Created on: 1999-10-08 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_Fillet_HeaderFile -#define _QANewBRepNaming_Fillet_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class TopoDS_Shape; -class BRepFilletAPI_MakeFillet; - - -//! For topological naming of a fillet -class QANewBRepNaming_Fillet : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Fillet(); - - Standard_EXPORT QANewBRepNaming_Fillet(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Loads a fillet in a data framework - Standard_EXPORT void Load (const TopoDS_Shape& part, BRepFilletAPI_MakeFillet& mkFillet) const; - - //! Returns a label for deleted faces of the part. - Standard_EXPORT TDF_Label DeletedFaces() const; - - //! Returns a label for modified faces of the part. - Standard_EXPORT TDF_Label ModifiedFaces() const; - - //! Returns a label for faces generated from edges of the part. - Standard_EXPORT TDF_Label FacesFromEdges() const; - - //! Returns a label for faces generated from vertices of the part. - Standard_EXPORT TDF_Label FacesFromVertices() const; - - //! Returns a label for WorkAround Face number 1 - Standard_EXPORT TDF_Label WRFace1() const; - - //! Returns a label for WorkAround Face number 2 - Standard_EXPORT TDF_Label WRFace2() const; - - //! Returns a label for WorkAround Edge number 1 - Standard_EXPORT TDF_Label WREdge1() const; - - //! Returns a label for WorkAround Edge number 2 - Standard_EXPORT TDF_Label WREdge2() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Fillet_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Fuse.cxx b/src/QANewBRepNaming/QANewBRepNaming_Fuse.cxx deleted file mode 100644 index ee546367c2..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Fuse.cxx +++ /dev/null @@ -1,77 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Fuse -//purpose : -//======================================================================= -QANewBRepNaming_Fuse::QANewBRepNaming_Fuse() {} - -//======================================================================= -//function : QANewBRepNaming_Fuse -//purpose : -//======================================================================= - -QANewBRepNaming_Fuse::QANewBRepNaming_Fuse(const TDF_Label& ResultLabel) - :QANewBRepNaming_BooleanOperation(ResultLabel) {} - - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Fuse::Load(BRepAlgoAPI_BooleanOperation& MS) const { - const TopoDS_Shape& ResSh = MS.Shape(); - const TopoDS_Shape& ObjSh = MS.Shape1(); - const TopoDS_Shape& ToolSh = MS.Shape2(); - - if (ResSh.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Fuse::Load(): The result of the boolean operation is null"< -#include -#include - -#include -class TDF_Label; -class BRepAlgoAPI_BooleanOperation; - - - -class QANewBRepNaming_Fuse : public QANewBRepNaming_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Fuse(); - - Standard_EXPORT QANewBRepNaming_Fuse(const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Fuse_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Gluing.cxx b/src/QANewBRepNaming/QANewBRepNaming_Gluing.cxx deleted file mode 100644 index cbb9a2c51f..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Gluing.cxx +++ /dev/null @@ -1,522 +0,0 @@ -// Created on: 2001-11-26 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#endif - -#define SOURCES_SUBLABEL 1 - -//======================================================================= -//function : QANewBRepNaming_Gluing -//purpose : -//======================================================================= - -QANewBRepNaming_Gluing::QANewBRepNaming_Gluing() {} - -//======================================================================= -//function : QANewBRepNaming_Gluing -//purpose : -//======================================================================= - -QANewBRepNaming_Gluing::QANewBRepNaming_Gluing(const TDF_Label& ResultLabel):QANewBRepNaming_TopNaming(ResultLabel) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Gluing::Init(const TDF_Label& ResultLabel) { - if(ResultLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Gluing::Init The Result label is Null ..."); - myResultLabel = ResultLabel; -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Gluing::Load(QANewModTopOpe_Glue& theMkGluing) { - TopoDS_Shape aResShape = theMkGluing.Shape(); - const TopoDS_Shape& anObjShape = theMkGluing.Shape1(); - - if (aResShape.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Gluing::Load(): The result of the Gluing operation is null"<Set(0); - TNaming_Builder aBuilder (ResultLabel()); - TopoDS_Shape aResult = theMkGluing.Shape(); - if (aResult.ShapeType() == TopAbs_COMPOUND) { - Standard_Integer aNbSubResults = 0; - TopoDS_Iterator anItr(aResult); - for (; anItr.More(); anItr.Next()) aNbSubResults++; - if (aNbSubResults == 1) { - anItr.Initialize(aResult); - if (anItr.More()) aResult = anItr.Value(); - } - } - if (theMkGluing.Shape1().IsNull()) aBuilder.Generated(aResult); - else { - aBuilder.Generated(theMkGluing.Shape1(), aResult); // mpv:? - } -} - - -//======================================================================= -//function : IsResultChanged -//purpose : -//======================================================================= - -Standard_Boolean QANewBRepNaming_Gluing::IsResultChanged(QANewModTopOpe_Glue& theMkGluing) const { - TopoDS_Shape aResShape = theMkGluing.Shape(); - if (theMkGluing.Shape().ShapeType() == TopAbs_COMPOUND) { - Standard_Integer aNbSubResults = 0; - TopoDS_Iterator anItr(theMkGluing.Shape()); - for (; anItr.More(); anItr.Next()) aNbSubResults++; - if (aNbSubResults == 1) { - anItr.Initialize(theMkGluing.Shape()); - if (anItr.More()) aResShape = anItr.Value(); - } - } - return theMkGluing.Shape1().IsSame(aResShape); -} - -//======================================================================= -//function : LoadModifiedShapes -//purpose : -//======================================================================= - -void QANewBRepNaming_Gluing::LoadModifiedShapes(QANewModTopOpe_Glue& theMkGluing) const { - const Standard_Integer aNumTypes = 1; - const TopAbs_ShapeEnum aTypes[] = {TopAbs_FACE/*,TopAbs_EDGE,TopAbs_VERTEX*/}; -#ifdef OCCT_DEBUG - const char aNames[][20] = {"ModifiedFaces"/*,"ModifiedEdges","ModifiedVertexes"*/}; -#endif - Standard_Integer aShapeNum; - - TDF_Label aLabel = ResultLabel().FindChild(1,Standard_True); - Handle(TNaming_NamedShape) aNS; - while(aLabel.FindAttribute(TNaming_NamedShape::GetID(),aNS)) { - if (aNS->Evolution() == TNaming_MODIFY) break; - aLabel = aLabel.Father().FindChild(aLabel.Tag()+1,Standard_True); - } - for(Standard_Integer a=0;aAppend(theIdentifier); - myUnique.Add(theUnique, *aNewList); - } else { - myUnique.ChangeFromKey(theUnique).Append(theIdentifier); - } -} - -//======================================================================= -//function : RecomputeUnique -//purpose : -//======================================================================= -void QANewBRepNaming_Gluing::RecomputeUnique(QANewModTopOpe_Glue& theMkGluing) { - const Standard_Integer aNumTypes = 3; - const TopAbs_ShapeEnum aTypes[] = {TopAbs_FACE,TopAbs_EDGE,TopAbs_VERTEX}; - - // special case: edges may be divided, these edges (new and modified) - // we try to sort in the algorithm returned lists order - myUnique.Clear(); - Standard_Integer aNext; - TopExp_Explorer anExp(myContext, TopAbs_EDGE); - TopTools_ListIteratorOfListOfShape anEdgesIterator; - for(;anExp.More();anExp.Next()) { - for(aNext=0;aNext<2;aNext++) { - TopoDS_Edge aFullEdge = TopoDS::Edge(anExp.Current()); - if (aNext == 0) anEdgesIterator.Initialize(theMkGluing.Generated(aFullEdge)); - else anEdgesIterator.Initialize(theMkGluing.Modified(aFullEdge)); - for (;anEdgesIterator.More();anEdgesIterator.Next()) - if (anEdgesIterator.Value().ShapeType() == TopAbs_EDGE) { - TopoDS_Edge aDivEdge = TopoDS::Edge(anEdgesIterator.Value()); - if (!TopExp::FirstVertex(aDivEdge).IsNull()) { // divided edge must have at least one vertex - if (TopExp::FirstVertex(aFullEdge).IsNull()) AddToTheUnique(aDivEdge,aFullEdge); - else if (!TopExp::LastVertex(aDivEdge).IsNull()) {//if full edge have at least one vertex, subedges must have two - if (TopExp::LastVertex(aFullEdge).IsNull()) { - if (BRep_Tool::Pnt(TopExp::FirstVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::FirstVertex(aDivEdge)),Precision::Confusion())) - AddToTheUnique(aDivEdge,aFullEdge); - else if (BRep_Tool::Pnt(TopExp::FirstVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::LastVertex(aDivEdge)),Precision::Confusion())) - AddToTheUnique(aDivEdge,aFullEdge); - } else { - Standard_Integer aCounter = 0; - if (BRep_Tool::Pnt(TopExp::FirstVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::FirstVertex(aDivEdge)),Precision::Confusion()) || - BRep_Tool::Pnt(TopExp::FirstVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::LastVertex(aDivEdge)),Precision::Confusion())) aCounter++; - if (BRep_Tool::Pnt(TopExp::LastVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::FirstVertex(aDivEdge)),Precision::Confusion()) || - BRep_Tool::Pnt(TopExp::LastVertex(aFullEdge)). - IsEqual(BRep_Tool::Pnt(TopExp::LastVertex(aDivEdge)),Precision::Confusion())) aCounter++; - if (aCounter!=2) AddToTheUnique(aDivEdge,aFullEdge); - } - } - } - } - } - } - aNext = 2; - Standard_Integer aDividedIndex = myUnique.Extent();; - // accumulate all shapes, modifyed from shape1 - while(aNext) { - for(Standard_Integer a=0;aSet(0); - - // get all source shapes (in the given order) - TopTools_MapOfShape aShapes; - TopTools_ListOfShape aSortedShapes; - Standard_Integer anIndex; - for(anIndex=1;anIndex<=myUnique.Extent();anIndex++) { - TopTools_ListIteratorOfListOfShape anIter2(myUnique.FindFromIndex(anIndex)); - for(;anIter2.More();anIter2.Next()) { - if (!aShapes.Contains(anIter2.Value())) { - aShapes.Add(anIter2.Value()); - aSortedShapes.Append(anIter2.Value()); - } - } - } - // put all source shapes to the sources label sublabels - TopTools_ListIteratorOfListOfShape aSortedIterator(aSortedShapes); - for(aLabel = aLabel.NewChild();aShapes.Extent();aLabel = aLabel.Father().NewChild()) { - Handle(TNaming_NamedShape) aNS; - if (aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - // old shape resolving - TDF_LabelMap aValid; - aValid.Assign(myLog); - TNaming_Selector aSel(aLabel); - aSel.Solve(aValid); - TopoDS_Shape aShape = aSel.NamedShape()->Get(); - if (aShapes.Contains(aShape)) { - theSources.Bind(aShape,aLabel.Tag()); - aShapes.Remove(aShape); - } - } else { - // add new shape - for(;aSortedIterator.More();aSortedIterator.Next()) { - TopoDS_Shape aShape = aSortedIterator.Value();; - if (aShapes.Contains(aShape)) { - theSources.Bind(aShape,aLabel.Tag()); - aShapes.Remove(aShape); - TNaming_Selector aSelector(aLabel); - if (!aSelector.Select(aShape,myContext)) { -#ifdef OCCT_DEBUG - cout<<"Can't do naming"<Evolution() == TNaming_MODIFY) continue; - Handle(TDataStd_IntegerArray) anArray; - if (aLabel.FindAttribute(TDataStd_IntegerArray::GetID(),anArray)) { // old unique with dependencies - Standard_Integer a; - for(a = anIndex;a<=myUnique.Extent();a++) { - if (alreadyUsed.Contains(a)) continue; - if (myUnique.FindFromIndex(a).Extent()!=anArray->Upper()) continue; -// cout<<"a="<Upper();a1>=1;a1--) if (anArray->Value(a1) == aValue) break; - if (a1 == 0) aEq = Standard_False; - } -// cout<<"eq="< 1) { - for (itr.Initialize(MS.Shape()); itr.More(); itr.Next()) { - TNaming_Builder bContent(Content()); - bContent.Generated(itr.Value()); - } - } - } -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Gluing.hxx b/src/QANewBRepNaming/QANewBRepNaming_Gluing.hxx deleted file mode 100644 index 2cd0a61839..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Gluing.hxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 2001-11-26 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2001-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. - -#ifndef _QANewBRepNaming_Gluing_HeaderFile -#define _QANewBRepNaming_Gluing_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class Standard_NullObject; -class TDF_Label; -class QANewModTopOpe_Glue; -class TopoDS_Shape; - - -//! Loads a result of Gluing operation in Data Framework -class QANewBRepNaming_Gluing : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Gluing(); - - Standard_EXPORT QANewBRepNaming_Gluing(const TDF_Label& theResultLabel); - - Standard_EXPORT void Init (const TDF_Label& theResultLabel); - - //! Loads a Gluing in a data framework - Standard_EXPORT void Load (QANewModTopOpe_Glue& theMkGluing); - - Standard_EXPORT TDF_Label Content() const; - - Standard_EXPORT void SetContext (const TopoDS_Shape& theObject, const TopoDS_Shape& theTool); - - Standard_EXPORT void SetLog (const TDF_LabelMap& theLog); - - - - -protected: - - - - - -private: - - - //! If the shape is a compound the method - //! returns the underlying shape type. - Standard_EXPORT TopAbs_ShapeEnum ShapeType (const TopoDS_Shape& theShape) const; - - //! If the shape is a compound the method - //! returns the underlying shape. - Standard_EXPORT TopoDS_Shape GetShape (const TopoDS_Shape& theShape) const; - - //! A default implementation for naming of modified shapes of the operation - Standard_EXPORT void LoadModifiedShapes (QANewModTopOpe_Glue& theMakeShape) const; - - //! A default implementation for naming of modified shapes of the operation - Standard_EXPORT void LoadDeletedShapes (QANewModTopOpe_Glue& theMakeShape) const; - - //! Loads the content of the result. - Standard_EXPORT void LoadContent (QANewModTopOpe_Glue& theMakeShape) const; - - //! Loads the result. - Standard_EXPORT void LoadResult (QANewModTopOpe_Glue& theMakeShape) const; - - //! Returns true if the result is not the same as the object shape. - Standard_EXPORT Standard_Boolean IsResultChanged (QANewModTopOpe_Glue& theMakeShape) const; - - //! Loads the deletion of the degenerated edges. - Standard_EXPORT void LoadSectionEdges (QANewModTopOpe_Glue& theMakeShape) const; - - Standard_EXPORT void AddToTheUnique (const TopoDS_Shape& theUnique, const TopoDS_Shape& theIdentifier); - - //! Reset myShared map - shapes, which are modified by both object and tool. - Standard_EXPORT void RecomputeUnique (QANewModTopOpe_Glue& theMakeShape); - - Standard_EXPORT void LoadSourceShapes (TopTools_DataMapOfShapeInteger& theSources) const; - - //! A default implementation for naming of generated shapes of the operation - Standard_EXPORT void LoadUniqueShapes (QANewModTopOpe_Glue& theMakeShape, const TopTools_DataMapOfShapeInteger& theSources); - - - TopTools_IndexedDataMapOfShapeListOfShape myUnique; - TopoDS_Shape myContext; - TDF_LabelMap myLog; - - -}; - - - - - - - -#endif // _QANewBRepNaming_Gluing_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx b/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx deleted file mode 100644 index 7ebe192729..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx +++ /dev/null @@ -1,336 +0,0 @@ -// Created on: 1999-10-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_ImportShape -//purpose : Constructor -//======================================================================= -QANewBRepNaming_ImportShape::QANewBRepNaming_ImportShape() {} - -//======================================================================= -//function : QANewBRepNaming_ImportShape -//purpose : Constructor -//======================================================================= - -QANewBRepNaming_ImportShape::QANewBRepNaming_ImportShape(const TDF_Label& L):QANewBRepNaming_TopNaming(L) {} - -//======================================================================= -//function : Init -//purpose : Initialization -//======================================================================= - -void QANewBRepNaming_ImportShape::Init(const TDF_Label& Label) { - if(Label.IsNull()) - throw Standard_NullObject("QANewBRepNaming_ImportShape::Init The Result label is Null ..."); - myResultLabel = Label; -} - -//======================================================================= -//function : Load -//purpose : To load an ImportShape -// Use this method for a topological naming of an imported shape -//======================================================================= - -void QANewBRepNaming_ImportShape::Load(const TopoDS_Shape& theShape) const { - ResultLabel().ForgetAllAttributes(); - TNaming_Builder b(ResultLabel()); - b.Generated(theShape); - - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - - LoadFirstLevel(theShape, Tagger); - LoadC0Edges(theShape, Tagger); - LoadC0Vertices(theShape, Tagger); -} - -//======================================================================= -//function : LoadPrime -//purpose : -//======================================================================= - -void QANewBRepNaming_ImportShape::LoadPrime(const TopoDS_Shape& theShape) const { - - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - - LoadFirstLevel(theShape, Tagger); - LoadC0Edges(theShape, Tagger); - LoadC0Vertices(theShape, Tagger); -} - -//======================================================================= -//function : LoadFirstLevel -//purpose : Method for internal use. Is used by Load() -//======================================================================= - -void QANewBRepNaming_ImportShape::LoadFirstLevel(const TopoDS_Shape& S, - const Handle(TDF_TagSource)& Tagger) const { - if (S.ShapeType() == TopAbs_COMPOUND || S.ShapeType() == TopAbs_COMPSOLID) { - TopoDS_Iterator itr(S); - for (; itr.More(); itr.Next()) { - TNaming_Builder bIndependantShapes(Tagger->NewChild()); - bIndependantShapes.Generated(itr.Value()); - if (itr.Value().ShapeType() == TopAbs_COMPOUND || itr.Value().ShapeType() == TopAbs_COMPSOLID) { - LoadFirstLevel(itr.Value(), Tagger); - } else LoadNextLevels(itr.Value(), Tagger); - } - } else LoadNextLevels(S, Tagger); -} - -//======================================================================= -//function : LoadNextLevels -//purpose : Method for internal use. Is used by LoadFirstLevel() -//======================================================================= - -void QANewBRepNaming_ImportShape::LoadNextLevels(const TopoDS_Shape& S, - const Handle(TDF_TagSource)& Tagger) const { - - if (S.ShapeType() == TopAbs_SOLID) { - TopExp_Explorer expl(S, TopAbs_FACE); - for (; expl.More(); expl.Next()) { - TNaming_Builder bFace(Tagger->NewChild()); - bFace.Generated(expl.Current()); - } - } else if (S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_FACE) { - // load faces and all the free edges - TopTools_IndexedMapOfShape Faces; - TopExp::MapShapes(S, TopAbs_FACE, Faces); - if (Faces.Extent() > 1 || (S.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) { - TopExp_Explorer expl(S, TopAbs_FACE); - for (; expl.More(); expl.Next()) { - TNaming_Builder bFace(Tagger->NewChild()); - bFace.Generated(expl.Current()); - } - } - TopTools_IndexedDataMapOfShapeListOfShape anEdgeAndNeighbourFaces; - TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, anEdgeAndNeighbourFaces); - for (Standard_Integer i = 1; i <= anEdgeAndNeighbourFaces.Extent(); i++) { - const TopTools_ListOfShape& aLL = anEdgeAndNeighbourFaces.FindFromIndex(i); - if (aLL.Extent() < 2) { - TNaming_Builder bFreeEdges(Tagger->NewChild()); - bFreeEdges.Generated(anEdgeAndNeighbourFaces.FindKey(i)); - } else { - TopTools_ListIteratorOfListOfShape anIter(aLL); - const TopoDS_Face aFace = TopoDS::Face(anIter.Value()); - anIter.Next(); - if(aFace.IsEqual(anIter.Value())) { - TNaming_Builder bFreeEdges(Tagger->NewChild()); - bFreeEdges.Generated(anEdgeAndNeighbourFaces.FindKey(i)); - } - } - } - } else if (S.ShapeType() == TopAbs_WIRE) { - TopTools_IndexedMapOfShape Edges; - BRepTools::Map3DEdges(S, Edges); - if (Edges.Extent() == 1) { - TNaming_Builder bEdge(Tagger->NewChild()); - bEdge.Generated(Edges.FindKey(1)); - TopExp_Explorer expl(S, TopAbs_VERTEX); - for (; expl.More(); expl.Next()) { - TNaming_Builder bVertex(Tagger->NewChild()); - bVertex.Generated(expl.Current()); - } - } else { - TopExp_Explorer expl(S, TopAbs_EDGE); - for (; expl.More(); expl.Next()) { - TNaming_Builder bEdge(Tagger->NewChild()); - bEdge.Generated(expl.Current()); - } - // and load generated vertices. - TopTools_DataMapOfShapeShape generated; - if (QANewBRepNaming_LoaderParent::GetDangleShapes(S, TopAbs_EDGE, generated)) { - TNaming_Builder bGenVertices(Tagger->NewChild()); - QANewBRepNaming_LoaderParent::LoadGeneratedDangleShapes(S, TopAbs_EDGE, bGenVertices); - } - } - } else if (S.ShapeType() == TopAbs_EDGE) { - TopExp_Explorer expl(S, TopAbs_VERTEX); - for (; expl.More(); expl.Next()) { - TNaming_Builder bVertex(Tagger->NewChild()); - bVertex.Generated(expl.Current()); - } - } -} - - -//======================================================================= -//function : LoadC0Edges -//purpose : Method for internal use. It is used by Load() method. -//======================================================================= - -void QANewBRepNaming_ImportShape::LoadC0Edges(const TopoDS_Shape& S, - const Handle(TDF_TagSource)& Tagger) const -{ - TopTools_IndexedDataMapOfShapeListOfShape edgeNaborFaces; - TopExp::MapShapesAndUniqueAncestors(S, TopAbs_EDGE, TopAbs_FACE, edgeNaborFaces); - - TopTools_MapOfShape aEdgesToRemove; - for(Standard_Integer i = 1; i <= edgeNaborFaces.Extent(); i++) { - Standard_Boolean aC0 = Standard_False; - TopoDS_Shape anEdge1 = edgeNaborFaces.FindKey(i); - if (aEdgesToRemove.Add(anEdge1)) { - const TopTools_ListOfShape& aList1 = edgeNaborFaces.FindFromIndex(i); - for(Standard_Integer j = i + 1; j <= edgeNaborFaces.Extent(); j++) { - TopoDS_Shape anEdge2 = edgeNaborFaces.FindKey(j); - const TopTools_ListOfShape& aList2 = edgeNaborFaces.FindFromIndex(j); - // compare lists of the neighbour faces of edge1 and edge2 - if (aList1.Extent() == aList2.Extent()) { - Standard_Integer aMatches = 0; - for(TopTools_ListIteratorOfListOfShape aLIter1(aList1);aLIter1.More();aLIter1.Next()) - for(TopTools_ListIteratorOfListOfShape aLIter2(aList2);aLIter2.More();aLIter2.Next()) - if (aLIter1.Value().IsSame(aLIter2.Value())) aMatches++; - if (aMatches == aList1.Extent()) { - aC0=Standard_True; - TNaming_Builder bC0Edge(Tagger->NewChild()); - bC0Edge.Generated(anEdge2); - aEdgesToRemove.Add(anEdge2); - } - } - } - } - if (aC0) { - TNaming_Builder bC0Edge(Tagger->NewChild()); - bC0Edge.Generated(anEdge1); - } - } -} - - -//======================================================================= -//function : LoadC0Vertices -//purpose : Method for internal use. It is used by Load() method. -//======================================================================= - -void QANewBRepNaming_ImportShape::LoadC0Vertices(const TopoDS_Shape& S, - const Handle(TDF_TagSource)& Tagger) const -{ - TopTools_DataMapOfShapeListOfShape vertexNaborFaces; - TopTools_ListOfShape empty; - TopExp_Explorer explF(S, TopAbs_FACE); - for (; explF.More(); explF.Next()) { - const TopoDS_Shape& aFace = explF.Current(); - TopExp_Explorer explV(aFace, TopAbs_VERTEX); - for (; explV.More(); explV.Next()) { - const TopoDS_Shape& aVertex = explV.Current(); - if (!vertexNaborFaces.IsBound(aVertex)) vertexNaborFaces.Bind(aVertex, empty); - Standard_Boolean faceIsNew = Standard_True; - TopTools_ListIteratorOfListOfShape itrF(vertexNaborFaces.Find(aVertex)); - for (; itrF.More(); itrF.Next()) { - if (itrF.Value().IsSame(aFace)) { - faceIsNew = Standard_False; - break; - } - } - if (faceIsNew) { - vertexNaborFaces.ChangeFind(aVertex).Append(aFace); - } - } - } - - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(vertexNaborFaces); - for (; itr.More(); itr.Next()) { - const TopTools_ListOfShape& naborFaces = itr.Value(); - if (naborFaces.Extent() < 3) { - TNaming_Builder bC0Vertex(Tagger->NewChild()); - bC0Vertex.Generated(itr.Key()); - } - } -} - -//======================================================================= -//function : NamedFaces -//purpose : Returns the labels of all the named faces. Returns the number of faces. -//======================================================================= - -Standard_Integer QANewBRepNaming_ImportShape::NamedFaces(TDF_LabelMap& theNamedFaces) const { - theNamedFaces.Clear(); - Handle(TNaming_NamedShape) aFace; - TDF_ChildIterator itr(ResultLabel()); - for (; itr.More(); itr.Next()) { - if (itr.Value().FindAttribute(TNaming_NamedShape::GetID(), aFace) && - !aFace->IsEmpty() && aFace->Get().ShapeType() == TopAbs_FACE) - theNamedFaces.Add(itr.Value()); - } - return theNamedFaces.Extent(); -} - -//======================================================================= -//function : NamedEdges -//purpose : Returns the labels of all the named free edges. -// Returns the number of edges. -//======================================================================= - -Standard_Integer QANewBRepNaming_ImportShape::NamedEdges(TDF_LabelMap& theNamedEdges) const { - theNamedEdges.Clear(); - Handle(TNaming_NamedShape) anEdge; - TDF_ChildIterator itr(ResultLabel()); - for (; itr.More(); itr.Next()) { - if (itr.Value().FindAttribute(TNaming_NamedShape::GetID(), anEdge) && - !anEdge->IsEmpty() && anEdge->Get().ShapeType() == TopAbs_EDGE) - theNamedEdges.Add(itr.Value()); - } - return theNamedEdges.Extent(); -} - -//======================================================================= -//function : NamedVertices -//purpose : Returns the labels of all the named free vertices. -// Returns the number of verices. -//======================================================================= - -Standard_Integer QANewBRepNaming_ImportShape::NamedVertices(TDF_LabelMap& theNamedVertices) const { - theNamedVertices.Clear(); - Handle(TNaming_NamedShape) aVertex; - TDF_ChildIterator itr(ResultLabel()); - for (; itr.More(); itr.Next()) { - if (itr.Value().FindAttribute(TNaming_NamedShape::GetID(), aVertex) && - !aVertex->IsEmpty() && aVertex->Get().ShapeType() == TopAbs_VERTEX) - theNamedVertices.Add(itr.Value()); - } - return theNamedVertices.Extent(); -} - diff --git a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.hxx b/src/QANewBRepNaming/QANewBRepNaming_ImportShape.hxx deleted file mode 100644 index 3c4d68eba1..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Created on: 1999-10-01 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_ImportShape_HeaderFile -#define _QANewBRepNaming_ImportShape_HeaderFile - -#include -#include -#include - -#include -#include -#include -class TDF_Label; -class TopoDS_Shape; -class TDF_TagSource; - - -//! This class provides a topological naming -//! of a Shape -class QANewBRepNaming_ImportShape : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_ImportShape(); - - Standard_EXPORT QANewBRepNaming_ImportShape(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Use this method for a topological naming of a Shape - Standard_EXPORT void Load (const TopoDS_Shape& S) const; - - Standard_EXPORT void LoadPrime (const TopoDS_Shape& S) const; - - Standard_EXPORT void LoadFirstLevel (const TopoDS_Shape& S, const Handle(TDF_TagSource)& Tagger) const; - - Standard_EXPORT void LoadNextLevels (const TopoDS_Shape& S, const Handle(TDF_TagSource)& Tagger) const; - - //! Method for internal use. It is used by Load(). - //! It loads the edges which couldn't be uniquely identified as - //! an intersection of two faces. - Standard_EXPORT void LoadC0Edges (const TopoDS_Shape& S, const Handle(TDF_TagSource)& Tagger) const; - - Standard_EXPORT void LoadC0Vertices (const TopoDS_Shape& S, const Handle(TDF_TagSource)& Tagger) const; - - Standard_EXPORT Standard_Integer NamedFaces (TDF_LabelMap& theNamedFaces) const; - - Standard_EXPORT Standard_Integer NamedEdges (TDF_LabelMap& theNamedEdges) const; - - Standard_EXPORT Standard_Integer NamedVertices (TDF_LabelMap& theNamedVertices) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_ImportShape_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Intersection.cxx b/src/QANewBRepNaming/QANewBRepNaming_Intersection.cxx deleted file mode 100644 index f82d0c335a..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Intersection.cxx +++ /dev/null @@ -1,219 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#include -#endif -enum BoolArguments { - SOLID_SOLID, - SOLID_SHELL, - SOLID_WIRE, - SHELL_SOLID, - SHELL_SHELL, - SHELL_WIRE, - WIRE_SOLID, - WIRE_SHELL, - WIRE_WIRE, - UNEXPECTED -}; -//======================================================================= -//function : QANewBRepNaming_Intersection -//purpose : -//======================================================================= - -QANewBRepNaming_Intersection::QANewBRepNaming_Intersection() {} - -//======================================================================= -//function : QANewBRepNaming_Intersection -//purpose : -//======================================================================= - -QANewBRepNaming_Intersection::QANewBRepNaming_Intersection(const TDF_Label& ResultLabel) - :QANewBRepNaming_BooleanOperation(ResultLabel) {} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Intersection::Load(BRepAlgoAPI_BooleanOperation& MS) const { - TopoDS_Shape ResSh = MS.Shape(); - if (ResSh.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Intersection::Load(): The result of the Intersection is null"< Vertex - - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_FACE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_EDGE, nBuilder); - } - if(MS.HasDeleted()){ - TNaming_Builder DelFBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_FACE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_FACE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_EDGE, DelFBuilder); - if(anArg == SOLID_WIRE || anArg == SHELL_WIRE) { - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_VERTEX, DelFBuilder); - } else - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_VERTEX, DelFBuilder); - } - } else if (anArg == WIRE_WIRE) { - if(MS.HasGenerated()) { - TNaming_Builder nBuilder (NewShapes()); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder); - QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_EDGE, nBuilder); - } - if(MS.HasDeleted()){ - TNaming_Builder DelFBuilder(DeletedFaces()); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_EDGE, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_VERTEX, DelFBuilder); - QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_VERTEX, DelFBuilder); - } - } - - LoadDegenerated(MS); - - // Naming of the content: -// if (ShapeType(ResSh) == TopAbs_VERTEX) LoadContent(MS); -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Intersection.hxx b/src/QANewBRepNaming/QANewBRepNaming_Intersection.hxx deleted file mode 100644 index d81cc3d519..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Intersection.hxx +++ /dev/null @@ -1,65 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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. - -#ifndef _QANewBRepNaming_Intersection_HeaderFile -#define _QANewBRepNaming_Intersection_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class BRepAlgoAPI_BooleanOperation; - - - -class QANewBRepNaming_Intersection : public QANewBRepNaming_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Intersection(); - - Standard_EXPORT QANewBRepNaming_Intersection(const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepAlgoAPI_BooleanOperation& MakeShape) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Intersection_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Limitation.cxx b/src/QANewBRepNaming/QANewBRepNaming_Limitation.cxx deleted file mode 100644 index eb5faceae8..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Limitation.cxx +++ /dev/null @@ -1,219 +0,0 @@ -// Created on: 2000-12-26 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// OCAF -// Specific -//======================================================================= -//function : QANewBRepNaming_Limitation -//purpose : -//======================================================================= -QANewBRepNaming_Limitation::QANewBRepNaming_Limitation() {} - -//======================================================================= -//function : QANewBRepNaming_Limitation -//purpose : -//======================================================================= - -QANewBRepNaming_Limitation::QANewBRepNaming_Limitation(const TDF_Label& ResultLabel) - :QANewBRepNaming_BooleanOperation(ResultLabel) {} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void QANewBRepNaming_Limitation::Load(QANewModTopOpe_Limitation& MS) const { - TopoDS_Shape ResSh = MS.Shape(); - - const TopoDS_Shape& ObjSh = MS.Shape1(); - const TopAbs_ShapeEnum& ObjType = ShapeType(ObjSh); - - if (ResSh.IsNull()) { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Limitation::Load(): The result of the boolean operation is null"<Set(0); - TNaming_Builder Builder (ResultLabel()); - TopoDS_Shape aResult = MS.Shape(); - if (aResult.ShapeType() == TopAbs_COMPOUND) { - Standard_Integer nbSubResults = 0; - TopoDS_Iterator itr(aResult); - for (; itr.More(); itr.Next()) nbSubResults++; - if (nbSubResults == 1) { - itr.Initialize(aResult); - if (itr.More()) aResult = itr.Value(); - } - } - if (MS.Shape1().IsNull()) Builder.Generated(aResult); - else Builder.Modify(MS.Shape1(), aResult); -} - -//======================================================================= -//function : LoadDegenerated -//purpose : -//======================================================================= - -void QANewBRepNaming_Limitation::LoadDegenerated(QANewModTopOpe_Limitation& MS) const { - TopTools_IndexedMapOfShape allEdges; - TopExp::MapShapes(MS.Shape1(), TopAbs_EDGE, allEdges); - Standard_Integer i = 1; - for (; i <= allEdges.Extent(); i++) { - if (BRep_Tool::Degenerated(TopoDS::Edge(allEdges.FindKey(i)))) { - if (MS.IsDeleted(allEdges.FindKey(i))) { - TNaming_Builder DegeneratedBuilder(DeletedDegeneratedEdges()); - DegeneratedBuilder.Generated(allEdges.FindKey(i)); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(DegeneratedBuilder.NamedShape()->Label(), "DeletedDegenerated"); -#endif - } - } - } -} -//======================================================================= -//function : LoadContent -//purpose : -//======================================================================= - -void QANewBRepNaming_Limitation::LoadContent(QANewModTopOpe_Limitation& MS) const { - if (MS.Shape().ShapeType() == TopAbs_COMPSOLID || MS.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(MS.Shape()); - Standard_Integer nbShapes = 0; - while (itr.More()) { - nbShapes++; - itr.Next(); - } - if (nbShapes > 1) { - for (itr.Initialize(MS.Shape()); itr.More(); itr.Next()) { - TNaming_Builder bContent(Content()); - bContent.Generated(MS.Shape1(),itr.Value()); - bContent.Generated(MS.Shape2(),itr.Value()); - } - } - } -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Limitation.hxx b/src/QANewBRepNaming/QANewBRepNaming_Limitation.hxx deleted file mode 100644 index fbbc46f547..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Limitation.hxx +++ /dev/null @@ -1,82 +0,0 @@ -// Created on: 2000-10-31 -// Created by: Vladislav ROMASHKO -// Copyright (c) 2000-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. - -#ifndef _QANewBRepNaming_Limitation_HeaderFile -#define _QANewBRepNaming_Limitation_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class QANewModTopOpe_Limitation; - - - -class QANewBRepNaming_Limitation : public QANewBRepNaming_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Limitation(); - - Standard_EXPORT QANewBRepNaming_Limitation(const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (QANewModTopOpe_Limitation& MakeShape) const; - - - - -protected: - - - //! Loads the content of the result. - Standard_EXPORT void LoadContent (QANewModTopOpe_Limitation& MakeShape) const; - - //! Loads the result. - Standard_EXPORT void LoadResult (QANewModTopOpe_Limitation& MakeShape) const; - - //! Loads the deletion of the degenerated edges. - Standard_EXPORT void LoadDegenerated (QANewModTopOpe_Limitation& MakeShape) const; - - //! A default implementation for naming of a wire as an object of - //! a boolean operation. - Standard_EXPORT void LoadWire (QANewModTopOpe_Limitation& MakeShape) const; - - //! A default implementation for naming of a shell as an object of - //! a boolean operation. - Standard_EXPORT void LoadShell (QANewModTopOpe_Limitation& MakeShape) const; - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Limitation_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Loader.cxx b/src/QANewBRepNaming/QANewBRepNaming_Loader.cxx deleted file mode 100644 index 91a078d6ac..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Loader.cxx +++ /dev/null @@ -1,424 +0,0 @@ -// Created on: 1999-10-25 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : LoadGeneratedShapes -//purpose : Load in the naming data-structure the shape -// generated from FACE, EDGE, VERTEX,..., after the -// MakeShape operation. is the initial -// shape. defines the kind of -// shape generation to record in the naming -// data-structure. The is used to store the -// set of evolutions in the data-framework of TDF. -//======================================================================= -void QANewBRepNaming_Loader::LoadGeneratedShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder) -{ - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Generated (Root); - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - const TopoDS_Shape& newShape = ShapesIterator.Value (); - if (!Root.IsSame (newShape)) Builder.Generated (Root,newShape ); - } - } -} - - - -//======================================================================= -//function : LoadAndOrientGeneratedShapes -//purpose : The same as LoadGeneratedShapes plus performs orientation of -// loaded shapes according orientation of SubShapes -//======================================================================= - -void QANewBRepNaming_Loader::LoadAndOrientGeneratedShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder, - const TopTools_DataMapOfShapeShape& SubShapes) -{ - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Generated (Root); - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - TopoDS_Shape newShape = ShapesIterator.Value (); - if (SubShapes.IsBound(newShape)) { - newShape.Orientation((SubShapes(newShape)).Orientation()); - } - if (!Root.IsSame (newShape)) Builder.Generated (Root,newShape ); - } - } -} - -//======================================================================= -//function : LoadModifiedShapes -//purpose : Load in the naming data-structure the shape -// modified from FACE, EDGE, VERTEX,..., after the -// MakeShape operation. is the initial -// shape. defines the kind of shape -// modification to record in the naming -// data-structure. The is used to store the -// set of evolutions in the data-framework of TDF. -//======================================================================= - -void QANewBRepNaming_Loader::LoadModifiedShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder, - const Standard_Boolean theBool) -{ - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - TopTools_ListOfShape Shapes; - BRepAlgoAPI_BooleanOperation* pMS = NULL; - if (theBool) - pMS = (reinterpret_cast(&MS)); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; -// const TopTools_ListOfShape& Shapes = MS.Modified (Root); - if (theBool) - Shapes = pMS->Modified (Root); - else - Shapes = MS.Modified (Root); - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - const TopoDS_Shape& newShape = ShapesIterator.Value (); - if (!Root.IsSame (newShape)) { - Builder.Modify (Root,newShape ); - } - } - } -} - - -//======================================================================= -//function : LoadAndOrientModifiedShapes -//purpose : The same as LoadModifiedShapes plus performs orientation of -// loaded shapes according orientation of SubShapes -//======================================================================= - -void QANewBRepNaming_Loader::LoadAndOrientModifiedShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder, - const TopTools_DataMapOfShapeShape& SubShapes) -{ - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified(Root); - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - TopoDS_Shape newShape = ShapesIterator.Value (); - if (SubShapes.IsBound(newShape)) { - newShape.Orientation((SubShapes(newShape)).Orientation()); - } - if (!Root.IsSame (newShape)) Builder.Modify (Root,newShape ); - } - } -} - - -//======================================================================= -//function : LoadDeletedShapes -//purpose : Load in the naming data-structure the shape -// deleted after the MakeShape operation. -// is the initial shape. -// defines the kind of -// deletion to record in the naming data-structure. -// The is used to store the set of evolutions -// in the data-framework of TDF. -//======================================================================= - -void QANewBRepNaming_Loader::LoadDeletedShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder) -{ - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - if (MS.IsDeleted (Root)) Builder.Delete (Root); - } -} - - -//======================================================================= -//function : ModifyPart -//purpose : Internal Tool -//======================================================================= - -void QANewBRepNaming_Loader::ModifyPart (const TopoDS_Shape& PartShape, - const TopoDS_Shape& Primitive, - const TDF_Label& Label) -{ - - TNaming_Builder Builder (Label); - - TopLoc_Location PartLocation = PartShape.Location (); - if (!PartLocation.IsIdentity ()) { - TopLoc_Location Identity; - Builder.Modify (PartShape.Located(Identity), Primitive); - TNaming::Displace (Label, PartLocation); - } - else Builder.Modify (PartShape, Primitive); -} - -//======================================================================= -//function : HasDangleShapes -//purpose : -//======================================================================= - -Standard_Boolean QANewBRepNaming_Loader::HasDangleShapes(const TopoDS_Shape& ShapeIn) { - if (ShapeIn.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(ShapeIn); - for (; itr.More(); itr.Next()) - if (itr.Value().ShapeType() != TopAbs_SOLID) return Standard_True; - return Standard_False; - } else if (ShapeIn.ShapeType() == TopAbs_COMPSOLID || - ShapeIn.ShapeType() == TopAbs_SOLID) { - return Standard_False; - } else if (ShapeIn.ShapeType() == TopAbs_SHELL || - ShapeIn.ShapeType() == TopAbs_FACE || - ShapeIn.ShapeType() == TopAbs_WIRE || - ShapeIn.ShapeType() == TopAbs_EDGE || - ShapeIn.ShapeType() == TopAbs_VERTEX) - return Standard_True; - return Standard_False; -} - -//======================================================================= -//function : GetDangleShapes -//purpose : Returns dangle sub shapes Generator - Dangle. -//======================================================================= - -Standard_Boolean QANewBRepNaming_Loader::GetDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TopTools_DataMapOfShapeShape& Dangles) -{ - Dangles.Clear(); - TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors; - TopAbs_ShapeEnum GeneratedTo; - if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE; - else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX; - else return Standard_False; - TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors); - for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) { - const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i); - const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i); - if (ancestors.Extent() == 1) Dangles.Bind(ancestors.First(), mayBeDangle); - } - return !Dangles.IsEmpty(); -} - -//======================================================================= -//function : GetDangleShapes -//purpose : Returns dangle sub shapes. -//======================================================================= -Standard_Boolean QANewBRepNaming_Loader::GetDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TopTools_MapOfShape& Dangles) -{ - Dangles.Clear(); - TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors; - TopAbs_ShapeEnum GeneratedTo; - if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE; - else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX; - else return Standard_False; - TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors); - for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) { - const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i); - const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i); - if (ancestors.Extent() == 1) Dangles.Add(mayBeDangle); - } - return !Dangles.IsEmpty(); -} - -//======================================================================= -//function : LoadGeneratedDangleShapes -//purpose : -//======================================================================= - -void QANewBRepNaming_Loader::LoadGeneratedDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TNaming_Builder& Builder) -{ - TopTools_DataMapOfShapeShape dangles; - if (!QANewBRepNaming_Loader::GetDangleShapes(ShapeIn, GeneratedFrom, dangles)) return; - TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles); - for (; itr.More(); itr.Next()) Builder.Generated(itr.Key(), itr.Value()); -} - -//======================================================================= -//function : LoadGeneratedDangleShapes -//purpose : -//======================================================================= - -void QANewBRepNaming_Loader::LoadGeneratedDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - const TopTools_MapOfShape& OnlyThese, - TNaming_Builder& Builder) -{ - TopTools_DataMapOfShapeShape dangles; - if (!QANewBRepNaming_Loader::GetDangleShapes(ShapeIn, GeneratedFrom, dangles)) return; - TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles); - for (; itr.More(); itr.Next()) { - if (!OnlyThese.Contains(itr.Value())) continue; - Builder.Generated(itr.Key(), itr.Value()); - } -} - -//======================================================================= -//function : LoadModifiedDangleShapes -//purpose : -//======================================================================= - -void QANewBRepNaming_Loader::LoadModifiedDangleShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder) -{ - TopTools_MapOfShape OnlyThese; - TopAbs_ShapeEnum neighbour = TopAbs_EDGE; - if (KindOfShape == TopAbs_EDGE) neighbour = TopAbs_FACE; - if (!QANewBRepNaming_Loader::GetDangleShapes(ShapeIn, neighbour, OnlyThese)) return; - - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root) || !OnlyThese.Contains(Root)) continue; - const TopTools_ListOfShape& Shapes = MS.Modified (Root); - TopTools_ListIteratorOfListOfShape ShapesIterator (Shapes); - for (;ShapesIterator.More (); ShapesIterator.Next ()) { - const TopoDS_Shape& newShape = ShapesIterator.Value (); - if (!Root.IsSame (newShape)) { - Builder.Modify (Root,newShape ); - } - } - } -} - -//======================================================================= -//function : IsDangle -//purpose : Don't use this method inside an iteration process! -//======================================================================= -Standard_Boolean QANewBRepNaming_Loader::IsDangle (const TopoDS_Shape& theDangle, - const TopoDS_Shape& theShape) { - TopTools_MapOfShape dangles; - TopAbs_ShapeEnum neighbour = TopAbs_EDGE; - if (theDangle.ShapeType() == TopAbs_EDGE) neighbour = TopAbs_FACE; - if (!QANewBRepNaming_Loader::GetDangleShapes(theShape, neighbour, dangles)) return Standard_False; - return dangles.Contains(theDangle); -} - -//======================================================================= -//function : LoadDeletedDangleShapes -//purpose : -//======================================================================= -void QANewBRepNaming_Loader::LoadDeletedDangleShapes (BRepBuilderAPI_MakeShape& MS, - const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum KindOfShape, - TNaming_Builder& Builder) -{ - if (KindOfShape != TopAbs_EDGE && KindOfShape != TopAbs_VERTEX) return; // not implemented ... - TopTools_MapOfShape View; - TopExp_Explorer ShapeExplorer (ShapeIn, KindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& Root = ShapeExplorer.Current (); - if (!View.Add(Root)) continue; - if (!QANewBRepNaming_Loader::IsDangle(Root, ShapeIn)) continue; - if (MS.IsDeleted (Root)) Builder.Delete (Root); - } -} - -//======================================================================= -//function : LoadDangleShapes -//purpose : -//======================================================================= -void QANewBRepNaming_Loader::LoadDangleShapes(const TopoDS_Shape& theShape,const TDF_Label& theLabelGenerator) { - QANewBRepNaming_Loader::LoadDangleShapes(theShape, TopoDS_Shape(), theLabelGenerator); -} - -//======================================================================= -//function : LoadDangleShapes -//purpose : -//======================================================================= -void QANewBRepNaming_Loader::LoadDangleShapes(const TopoDS_Shape& theShape, - const TopoDS_Shape& theIgnoredShape, - const TDF_Label& theLabelGenerator) -{ - TopTools_MapOfShape dangles, ignored; - TopAbs_ShapeEnum GeneratedFrom = TopAbs_EDGE; // theShape.ShapeType() == TopAbs_WIRE or TopAbs_EDGE - if (theShape.ShapeType() == TopAbs_SHELL || theShape.ShapeType() == TopAbs_FACE) - GeneratedFrom = TopAbs_FACE; - if (!QANewBRepNaming_Loader::GetDangleShapes(theShape, GeneratedFrom, dangles)) return; - if (!theIgnoredShape.IsNull()) { - TopoDS_Iterator itrI(theIgnoredShape); - for (; itrI.More(); itrI.Next()) { - TopoDS_Shape ignoredShape = itrI.Value(); - ignored.Add(ignoredShape); - } - } - TopTools_MapIteratorOfMapOfShape itr (dangles); - for (; itr.More(); itr.Next()) { - const TopoDS_Shape& aDangle = itr.Key(); - if (ignored.Contains(aDangle)) continue; - TNaming_Builder aBuilder(theLabelGenerator.NewChild()); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(aBuilder.NamedShape()->Label(), "NewShapes"); -#endif - aBuilder.Generated(aDangle); - } -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_Loader.hxx b/src/QANewBRepNaming/QANewBRepNaming_Loader.hxx deleted file mode 100644 index 8bacedc49b..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Loader.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// Created on: 1999-10-25 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_Loader_HeaderFile -#define _QANewBRepNaming_Loader_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -class BRepBuilderAPI_MakeShape; -class TopoDS_Shape; -class TNaming_Builder; -class TDF_Label; - - - -class QANewBRepNaming_Loader -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Load in the naming data-structure the shape - //! generated from FACE, EDGE, VERTEX,..., after the - //! MakeShape operation. is the initial - //! shape. defines the kind of - //! shape generation to record in the naming - //! data-structure. The is used to store the - //! set of evolutions in the data-framework of TDF. - Standard_EXPORT static void LoadGeneratedShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TNaming_Builder& Buider); - - //! Load in the naming data-structure the shape - //! modified from FACE, EDGE, VERTEX,..., - //! after the MakeShape operation. - //! is the initial shape. - //! defines the kind of shape modification - //! to record in the naming data-structure. - //! The is used to store the set of evolutions - //! in the data-framework of TDF. - Standard_EXPORT static void LoadModifiedShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum ModifiedFrom, TNaming_Builder& Buider, const Standard_Boolean theBool = Standard_False); - - //! Load in the naming data-structure the shape - //! deleted after the MakeShape operation. - //! is the initial shape. - //! defines the kind of - //! deletion to record in the naming data-structure. - //! The is used to store the set of evolutions - //! in the data-framework of TDF. - Standard_EXPORT static void LoadDeletedShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum KindOfDeletedShape, TNaming_Builder& Buider); - - //! The same as LoadGeneratedShapes plus performs orientation of - //! loaded shapes according orientation of SubShapes - Standard_EXPORT static void LoadAndOrientGeneratedShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TNaming_Builder& Buider, const TopTools_DataMapOfShapeShape& SubShapesOfResult); - - //! The same as LoadModifiedShapes plus performs orientation of - //! loaded shapes according orientation of SubShapes - Standard_EXPORT static void LoadAndOrientModifiedShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum ModifiedFrom, TNaming_Builder& Buider, const TopTools_DataMapOfShapeShape& SubShapesOfResult); - - Standard_EXPORT static void ModifyPart (const TopoDS_Shape& PartShape, const TopoDS_Shape& Primitive, const TDF_Label& Label); - - Standard_EXPORT static Standard_Boolean HasDangleShapes (const TopoDS_Shape& ShapeIn); - - Standard_EXPORT static void LoadGeneratedDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TNaming_Builder& GenBuider); - - Standard_EXPORT static void LoadGeneratedDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, const TopTools_MapOfShape& OnlyThese, TNaming_Builder& GenBuider); - - Standard_EXPORT static void LoadModifiedDangleShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TNaming_Builder& GenBuider); - - Standard_EXPORT static void LoadDeletedDangleShapes (BRepBuilderAPI_MakeShape& MakeShape, const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum ShapeType, TNaming_Builder& DelBuider); - - Standard_EXPORT static void LoadDangleShapes (const TopoDS_Shape& theShape, const TDF_Label& theLabelGenerator); - - Standard_EXPORT static void LoadDangleShapes (const TopoDS_Shape& theShape, const TopoDS_Shape& ignoredShape, const TDF_Label& theLabelGenerator); - - //! Returns dangle sub shapes Generator - Dangle. - Standard_EXPORT static Standard_Boolean GetDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TopTools_DataMapOfShapeShape& Dangles); - - //! Returns dangle sub shapes. - Standard_EXPORT static Standard_Boolean GetDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TopTools_MapOfShape& Dangles); - - Standard_EXPORT static Standard_Boolean IsDangle (const TopoDS_Shape& theDangle, const TopoDS_Shape& theShape); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Loader_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.cxx b/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.cxx deleted file mode 100644 index 66c893a593..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.cxx +++ /dev/null @@ -1,99 +0,0 @@ -// Created on: 1999-10-25 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : GetDangleShapes -//purpose : Returns dangle sub shapes Generator - Dangle. -//======================================================================= -Standard_Boolean QANewBRepNaming_LoaderParent::GetDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TopTools_DataMapOfShapeShape& Dangles) -{ - Dangles.Clear(); - TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors; - TopAbs_ShapeEnum GeneratedTo; - if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE; - else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX; - else return Standard_False; - TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors); - for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) { - const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i); - const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i); - if (ancestors.Extent() == 1) Dangles.Bind(ancestors.First(), mayBeDangle); - } - return !Dangles.IsEmpty(); -} - -//======================================================================= -//function : GetDangleShapes -//purpose : Returns dangle sub shapes. -//======================================================================= -/* -Standard_Boolean QANewBRepNaming_LoaderParent::GetDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TopTools_MapOfShape& Dangles) -{ - Dangles.Clear(); - TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors; - TopAbs_ShapeEnum GeneratedTo; - if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE; - else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX; - else return Standard_False; - TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors); - for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) { - const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i); - const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i); - if (ancestors.Extent() == 1) Dangles.Add(mayBeDangle); - } - return !Dangles.IsEmpty(); -} -*/ -//======================================================================= -//function : LoadGeneratedDangleShapes -//purpose : -//======================================================================= - -void QANewBRepNaming_LoaderParent::LoadGeneratedDangleShapes(const TopoDS_Shape& ShapeIn, - const TopAbs_ShapeEnum GeneratedFrom, - TNaming_Builder& Builder) -{ - TopTools_DataMapOfShapeShape dangles; - if (!QANewBRepNaming_LoaderParent::GetDangleShapes(ShapeIn, GeneratedFrom, dangles)) return; - TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles); - for (; itr.More(); itr.Next()) Builder.Generated(itr.Key(), itr.Value()); -} - diff --git a/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.hxx b/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.hxx deleted file mode 100644 index fac9818e75..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_LoaderParent.hxx +++ /dev/null @@ -1,65 +0,0 @@ -// Created on: 2003-05-21 -// Created by: Open CASCADE Support -// Copyright (c) 2003-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. - -#ifndef _QANewBRepNaming_LoaderParent_HeaderFile -#define _QANewBRepNaming_LoaderParent_HeaderFile - -#include -#include -#include - -#include -#include -#include -class TopoDS_Shape; -class TNaming_Builder; - - - -class QANewBRepNaming_LoaderParent -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT static void LoadGeneratedDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TNaming_Builder& GenBuider); - - Standard_EXPORT static Standard_Boolean GetDangleShapes (const TopoDS_Shape& ShapeIn, const TopAbs_ShapeEnum GeneratedFrom, TopTools_DataMapOfShapeShape& Dangles); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_LoaderParent_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Prism.cxx b/src/QANewBRepNaming/QANewBRepNaming_Prism.cxx deleted file mode 100644 index 294384c6b7..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Prism.cxx +++ /dev/null @@ -1,247 +0,0 @@ -// Created on: 1999-11-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999 Matra Datavision -// 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. - -// Modified by vro, Thu Dec 21 10:34:49 2000 -// Modified by vro, Thu Dec 21 10:34:59 2000 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#endif - -//======================================================================= -//function : QANewBRepNaming_Prism -//purpose : -//======================================================================= - -QANewBRepNaming_Prism::QANewBRepNaming_Prism() {} - -//======================================================================= -//function : QANewBRepNaming_Prism -//purpose : -//======================================================================= - -QANewBRepNaming_Prism::QANewBRepNaming_Prism(const TDF_Label& Label):QANewBRepNaming_TopNaming(Label) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Prism::Init(const TDF_Label& Label) { - if(Label.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Prism::Init The Result label is Null ..."); - myResultLabel = Label; -} - -//======================================================================= -//function : Bottom -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Bottom() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Bottom"); -#endif - return L; -} - -//======================================================================= -//function : Top -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Top() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Top"); -#endif - return L; -} - -//======================================================================= -//function : Lateral -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Lateral() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Lateral"); -#endif - return L; -} - -//======================================================================= -//function : Degenerated -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Degenerated() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Degenerated"); -#endif - return L; -} - -//======================================================================= -//function : Dangle -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Dangle() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Dangle"); -#endif - return L; -} - -//======================================================================= -//function : Content -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Prism::Content() const { - const TDF_Label& L = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Content"); -#endif - return L; -} - -//======================================================================= -//function : Load (Prism) -//purpose : -//======================================================================= - -void QANewBRepNaming_Prism::Load (BRepPrimAPI_MakePrism& mkPrism, - const TopoDS_Shape& basis) const -{ - TopTools_DataMapOfShapeShape SubShapes; - for (TopExp_Explorer Exp(mkPrism.Shape(),TopAbs_FACE); Exp.More(); Exp.Next()) { - SubShapes.Bind(Exp.Current(),Exp.Current()); - } - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - - TNaming_Builder Builder (ResultLabel()); - Builder.Generated(basis, mkPrism.Shape()); //szy - 17.06.03 - - //Insert lateral face : Face from Edge - TNaming_Builder LateralFaceBuilder(Lateral()); - QANewBRepNaming_Loader::LoadAndOrientGeneratedShapes(mkPrism, basis, TopAbs_EDGE, - LateralFaceBuilder, SubShapes); - - Standard_Boolean makeTopBottom = Standard_True; - if (basis.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(basis); - if (itr.More() && itr.Value().ShapeType() == TopAbs_WIRE) makeTopBottom = Standard_False; - } else if (basis.ShapeType() == TopAbs_WIRE || basis.ShapeType() == TopAbs_EDGE) { - makeTopBottom = Standard_False; - } - if (makeTopBottom) { - //Insert bottom face - TopoDS_Shape BottomFace = mkPrism.FirstShape(); - if (!BottomFace.IsNull()) { - if (BottomFace.ShapeType() != TopAbs_COMPOUND) { - TNaming_Builder BottomBuilder(Bottom()); - if (SubShapes.IsBound(BottomFace)) { - BottomFace = SubShapes(BottomFace); - } - BottomBuilder.Generated(BottomFace); - } else { - TopoDS_Iterator itr(BottomFace); - for (; itr.More(); itr.Next()) { - TNaming_Builder BottomBuilder(Bottom()); - BottomBuilder.Generated(itr.Value()); - } - } - } - - //Insert top face - TopoDS_Shape TopFace = mkPrism.LastShape(); - if (!TopFace.IsNull()) { - if (TopFace.ShapeType() != TopAbs_COMPOUND) { - TNaming_Builder TopBuilder(Top()); - if (SubShapes.IsBound(TopFace)) { - TopFace = SubShapes(TopFace); - } - TopBuilder.Generated(TopFace); - } else { - TopoDS_Iterator itr(TopFace); - for (; itr.More(); itr.Next()) { - TNaming_Builder TopBuilder(Top()); - TopBuilder.Generated(itr.Value()); - } - } - } - } - - // Insert dangle edges and vertices: - if (QANewBRepNaming_Loader::HasDangleShapes(mkPrism.Shape())) { - if (mkPrism.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(mkPrism.Shape()); - for (; itr.More(); itr.Next()) { - QANewBRepNaming_Loader::LoadDangleShapes(itr.Value(), ResultLabel()); - } - } else { - QANewBRepNaming_Loader::LoadDangleShapes(mkPrism.Shape(), ResultLabel()); - } - } - - // Insert degenerated shapes: - TopTools_IndexedMapOfShape allEdges; - TopExp::MapShapes(mkPrism.Shape(), TopAbs_EDGE, allEdges); - Standard_Integer i = 1; - TColStd_ListOfInteger goodEdges; - for (; i <= allEdges.Extent(); i++) { - if (BRep_Tool::Degenerated(TopoDS::Edge(allEdges.FindKey(i)))) { - TNaming_Builder DegeneratedBuilder(Degenerated()); - DegeneratedBuilder.Generated(allEdges.FindKey(i)); - } - } - - // The content of the result: - if (mkPrism.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(mkPrism.Shape()); - while (itr.More() && itr.Value().ShapeType() == TopAbs_SOLID) { - TNaming_Builder aContentBuilder(Content()); - aContentBuilder.Generated(itr.Value()); - itr.Next(); - } - } -} - diff --git a/src/QANewBRepNaming/QANewBRepNaming_Prism.hxx b/src/QANewBRepNaming/QANewBRepNaming_Prism.hxx deleted file mode 100644 index ef5aaa0a4a..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Prism.hxx +++ /dev/null @@ -1,88 +0,0 @@ -// Created on: 1999-11-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_Prism_HeaderFile -#define _QANewBRepNaming_Prism_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class BRepPrimAPI_MakePrism; -class TopoDS_Shape; - - -//! To load the Prism results -class QANewBRepNaming_Prism : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Prism(); - - Standard_EXPORT QANewBRepNaming_Prism(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Loads the prism in the data framework - Standard_EXPORT void Load (BRepPrimAPI_MakePrism& mkPrism, const TopoDS_Shape& basis) const; - - //! Returns the insertion label of the bottom face of the Prism. - Standard_EXPORT TDF_Label Bottom() const; - - //! Returns the insertion label of the top face of the Prism. - Standard_EXPORT TDF_Label Top() const; - - //! Returns the insertion label of the lateral face of the Prism. - Standard_EXPORT TDF_Label Lateral() const; - - //! Returns the insertion label of the degenerated face of the Prism. - Standard_EXPORT TDF_Label Degenerated() const; - - //! Returns the insertion label of the degenerated face of the Prism. - Standard_EXPORT TDF_Label Dangle() const; - - //! Returns the insertion label of the degenerated face of the Prism. - Standard_EXPORT TDF_Label Content() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Prism_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Revol.cxx b/src/QANewBRepNaming/QANewBRepNaming_Revol.cxx deleted file mode 100644 index 855a4e8d8c..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Revol.cxx +++ /dev/null @@ -1,262 +0,0 @@ -// Created on: 1999-11-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewBRepNaming_Revol -//purpose : -//======================================================================= -QANewBRepNaming_Revol::QANewBRepNaming_Revol() -{} - -//======================================================================= -//function : QANewBRepNaming_Revol -//purpose : -//======================================================================= - -QANewBRepNaming_Revol::QANewBRepNaming_Revol(const TDF_Label& Label) - : QANewBRepNaming_TopNaming(Label) -{} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Revol::Init(const TDF_Label& Label) -{ - if(Label.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Revol::Init The Result label is Null ..."); - myResultLabel = Label; -} - -//======================================================================= -//function : Start -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Revol::Start () const -{ - return ResultLabel().FindChild(1,Standard_True); -} - -//======================================================================= -//function : End -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Revol::End () const -{ - return ResultLabel().FindChild(2,Standard_True); -} - -//======================================================================= -//function : Lateral -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Revol::Lateral () const -{ - return ResultLabel().FindChild(3,Standard_True); -} - - -//======================================================================= -//function : Degenerated -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Revol::Degenerated() const { - //const TDF_Label& L = ResultLabel().NewChild(); - const TDF_Label& L = ResultLabel().FindChild(4, Standard_True); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Degenerated"); -#endif - return L; -} - - -//======================================================================= -//function : Content -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Revol::Content() const { - //const TDF_Label& L = ResultLabel().NewChild(); - const TDF_Label& L = ResultLabel().FindChild(5, Standard_True); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(L, "Content"); -#endif - return L; -} - - -//======================================================================= -//function : Load (Revol) -//purpose : -//======================================================================= - -void QANewBRepNaming_Revol::Load (BRepPrimAPI_MakeRevol& mkRevol, - const TopoDS_Shape& basis) const - -{ -/* TopTools_DataMapOfShapeShape SubShapes; - for (TopExp_Explorer Exp(mkRevol.Shape(), TopAbs_FACE); Exp.More(); Exp.Next()) { - SubShapes.Bind(Exp.Current(),Exp.Current()); - } - - TNaming_Builder Builder(ResultLabel()); - Builder.Generated(mkRevol.Shape()); - - //Insert lateral faces : Face from Edge - TNaming_Builder LateralFaceBuilder(Lateral()); - QANewBRepNaming_Loader::LoadAndOrientGeneratedShapes(mkRevol, basis, TopAbs_EDGE, - LateralFaceBuilder, SubShapes); - - //Insert Start Face - TNaming_Builder StartBuilder(Start()); - TopoDS_Shape StartFace = mkRevol.FirstShape(); - if (!StartFace.IsNull()) { - if (SubShapes.IsBound(StartFace)) { - StartFace = SubShapes(StartFace); - } - StartBuilder.Generated(StartFace); - } - - //Insert End shapes - TNaming_Builder EndBuilder(End()); - TopoDS_Shape EndFace = mkRevol.LastShape(); - if (!EndFace.IsNull()) { - if (SubShapes.IsBound(EndFace)) { - EndFace = SubShapes(EndFace); - } - EndBuilder.Generated(EndFace); - }*/ - TopTools_DataMapOfShapeShape SubShapes; - for (TopExp_Explorer Exp(mkRevol.Shape(), TopAbs_FACE); Exp.More(); Exp.Next()) { - SubShapes.Bind(Exp.Current(),Exp.Current()); - } - - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - - TNaming_Builder Builder(ResultLabel()); - Builder.Generated(basis,mkRevol.Shape()); - - //Insert lateral faces : Face from Edge - TNaming_Builder LateralFaceBuilder(Lateral()); - QANewBRepNaming_Loader::LoadAndOrientGeneratedShapes(mkRevol, basis, TopAbs_EDGE, - LateralFaceBuilder, SubShapes); - - Standard_Boolean makeTopBottom = Standard_True; - if (basis.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(basis); - if (itr.More() && itr.Value().ShapeType() == TopAbs_WIRE) makeTopBottom = Standard_False; - } else if (basis.ShapeType() == TopAbs_WIRE || basis.ShapeType() == TopAbs_EDGE) { - makeTopBottom = Standard_False; - } - if (makeTopBottom) { - //Insert start face - TopoDS_Shape StartFace = mkRevol.FirstShape(); - if (!StartFace.IsNull()) { - if (StartFace.ShapeType() != TopAbs_COMPOUND) { - TNaming_Builder StartBuilder(Start()); - if (SubShapes.IsBound(StartFace)) { - StartFace = SubShapes(StartFace); - } - StartBuilder.Generated(StartFace); - } else { - TopoDS_Iterator itr(StartFace); - for (; itr.More(); itr.Next()) { - TNaming_Builder StartBuilder(Start()); - StartBuilder.Generated(itr.Value()); - } - } - } - - //Insert end face - TopoDS_Shape EndFace = mkRevol.LastShape(); - if (!EndFace.IsNull()) { - if (EndFace.ShapeType() != TopAbs_COMPOUND) { - TNaming_Builder EndBuilder(End()); - if (SubShapes.IsBound(EndFace)) { - EndFace = SubShapes(EndFace); - } - EndBuilder.Generated(EndFace); - } else { - TopoDS_Iterator itr(EndFace); - for (; itr.More(); itr.Next()) { - TNaming_Builder EndBuilder(End()); - EndBuilder.Generated(itr.Value()); - } - } - } - } - - // Insert dangle edges and vertices: - if (QANewBRepNaming_Loader::HasDangleShapes(mkRevol.Shape())) { - if (mkRevol.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(mkRevol.Shape()); - for (; itr.More(); itr.Next()) { - QANewBRepNaming_Loader::LoadDangleShapes(itr.Value(), ResultLabel()); - } - } else { - QANewBRepNaming_Loader::LoadDangleShapes(mkRevol.Shape(), ResultLabel()); - } - } - - // Insert degenerated shapes: - TopTools_IndexedMapOfShape allEdges; - TopExp::MapShapes(mkRevol.Shape(), TopAbs_EDGE, allEdges); - Standard_Integer i = 1; - TColStd_ListOfInteger goodEdges; - for (; i <= allEdges.Extent(); i++) { - if (BRep_Tool::Degenerated(TopoDS::Edge(allEdges.FindKey(i)))) { - TNaming_Builder DegeneratedBuilder(Degenerated()); - DegeneratedBuilder.Generated(allEdges.FindKey(i)); - } - } - - // The content of the result: - if (mkRevol.Shape().ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator itr(mkRevol.Shape()); - while (itr.More() && itr.Value().ShapeType() == TopAbs_SOLID) { - TNaming_Builder aContentBuilder(Content()); - aContentBuilder.Generated(itr.Value()); - itr.Next(); - } - } -} - - - diff --git a/src/QANewBRepNaming/QANewBRepNaming_Revol.hxx b/src/QANewBRepNaming/QANewBRepNaming_Revol.hxx deleted file mode 100644 index 72cf0b166b..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Revol.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// Created on: 1999-11-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_Revol_HeaderFile -#define _QANewBRepNaming_Revol_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; -class BRepPrimAPI_MakeRevol; -class TopoDS_Shape; - - -//! To load the Revol results -class QANewBRepNaming_Revol : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Revol(); - - Standard_EXPORT QANewBRepNaming_Revol(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - //! Loads the revol in the data framework - Standard_EXPORT void Load (BRepPrimAPI_MakeRevol& mkRevol, const TopoDS_Shape& basis) const; - - //! Returns the insertion label of the start face of the Revol. - Standard_EXPORT TDF_Label Start() const; - - //! Returns the insertion label of the end face of the Revol. - Standard_EXPORT TDF_Label End() const; - - //! Returns the insertion label of the lateral faces of the Revol. - Standard_EXPORT TDF_Label Lateral() const; - - //! Returns the label of degenerated edges. - Standard_EXPORT TDF_Label Degenerated() const; - - //! Returns the label of the content of the result. - Standard_EXPORT TDF_Label Content() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Revol_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_Sphere.cxx b/src/QANewBRepNaming/QANewBRepNaming_Sphere.cxx deleted file mode 100644 index dea2ed132d..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_Sphere.cxx +++ /dev/null @@ -1,223 +0,0 @@ -// Created on: 1999-11-05 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OCCT_DEBUG -#include -#endif - - -//======================================================================= -//function : QANewBRepNaming_Sphere -//purpose : -//======================================================================= - -QANewBRepNaming_Sphere::QANewBRepNaming_Sphere() {} - -//======================================================================= -//function : QANewBRepNaming_Sphere -//purpose : -//======================================================================= - -QANewBRepNaming_Sphere::QANewBRepNaming_Sphere(const TDF_Label& ResultLabel):QANewBRepNaming_TopNaming(ResultLabel) {} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= - -void QANewBRepNaming_Sphere::Init(const TDF_Label& ResultLabel) { - if(ResultLabel.IsNull()) - throw Standard_NullObject("QANewBRepNaming_Sphere::Init The Result label is Null ..."); - myResultLabel = ResultLabel; -} - -//======================================================================= -//function : Bottom -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::Bottom() const { - const TDF_Label& BottomL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(BottomL, "Bottom"); -#endif - return BottomL; -} - -//======================================================================= -//function : Top -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::Top() const { - const TDF_Label& TopL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(TopL, "Top"); -#endif - return TopL; -} - -//======================================================================= -//function : Lateral -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::Lateral() const { - const TDF_Label& LateralL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(LateralL, "Lateral"); -#endif - return LateralL; -} - -//======================================================================= -//function : StartSide -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::StartSide() const { - const TDF_Label& StartSideL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(StartSideL, "StartSide"); -#endif - return StartSideL; -} - -//======================================================================= -//function : EndSide -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::EndSide() const { - const TDF_Label& EndSideL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(EndSideL, "EndSide"); -#endif - return EndSideL; -} - -//======================================================================= -//function : Meridian -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::Meridian() const { - const TDF_Label& MeridianL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(MeridianL, "Meridian"); -#endif - return MeridianL; -} - -//======================================================================= -//function : Degenerated -//purpose : -//======================================================================= - -TDF_Label QANewBRepNaming_Sphere::Degenerated() const { - const TDF_Label& DegeneratedL = ResultLabel().NewChild(); -#ifdef OCCT_DEBUG - TDataStd_Name::Set(DegeneratedL, "Degenerated"); -#endif - return DegeneratedL; -} - -//======================================================================= -//function : Load (Sphere) -//purpose : -//======================================================================= - -void QANewBRepNaming_Sphere::Load (BRepPrimAPI_MakeSphere& mkSphere, - const QANewBRepNaming_TypeOfPrimitive3D Type) const -{ - BRepPrim_Sphere& S = mkSphere.Sphere(); - - Handle(TDF_TagSource) Tagger = TDF_TagSource::Set(ResultLabel()); - if (Tagger.IsNull()) return; - Tagger->Set(0); - - TNaming_Builder Builder (ResultLabel()); - if (Type == QANewBRepNaming_SOLID) Builder.Generated (mkSphere.Solid()); - else if (Type == QANewBRepNaming_SHELL) Builder.Generated (mkSphere.Shell()); - else { -#ifdef OCCT_DEBUG - cout<<"QANewBRepNaming_Sphere::Load(): Unexpected type of result"< -#include -#include - -#include -#include -class TDF_Label; -class BRepPrimAPI_MakeSphere; - - -//! To load the Sphere results -class QANewBRepNaming_Sphere : public QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewBRepNaming_Sphere(); - - Standard_EXPORT QANewBRepNaming_Sphere(const TDF_Label& ResultLabel); - - Standard_EXPORT void Init (const TDF_Label& ResultLabel); - - Standard_EXPORT void Load (BRepPrimAPI_MakeSphere& mkSphere, const QANewBRepNaming_TypeOfPrimitive3D Type) const; - - //! Returns the label of the bottom - //! face of the Sphere. - Standard_EXPORT TDF_Label Bottom() const; - - //! Returns the label of the top - //! face of the Sphere. - Standard_EXPORT TDF_Label Top() const; - - //! Returns the label of the lateral - //! face of the Sphere. - Standard_EXPORT TDF_Label Lateral() const; - - //! Returns the label of the first - //! side of the Sphere. - Standard_EXPORT TDF_Label StartSide() const; - - //! Returns the label of the second - //! side of the Sphere. - Standard_EXPORT TDF_Label EndSide() const; - - //! Returns the label of the meridian - //! edges of the Sphere. - Standard_EXPORT TDF_Label Meridian() const; - - //! Returns the label of the degenerated - //! edges of the Sphere. - Standard_EXPORT TDF_Label Degenerated() const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewBRepNaming_Sphere_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.cxx b/src/QANewBRepNaming/QANewBRepNaming_TopNaming.cxx deleted file mode 100644 index db99974a62..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Created on: 1999-09-24 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include - -//======================================================================= -//function : QANewBRepNaming_TopNaming -//purpose : -//======================================================================= -QANewBRepNaming_TopNaming::QANewBRepNaming_TopNaming() -{} - -//======================================================================= -//function : QANewBRepNaming_TopNaming -//purpose : -//======================================================================= - -QANewBRepNaming_TopNaming::QANewBRepNaming_TopNaming(const TDF_Label& Label) -{ - if(Label.IsNull()) - throw Standard_NullObject("QANewBRepNaming_TopNaming:: The Result label is Null ..."); - myResultLabel = Label; -} - diff --git a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.hxx b/src/QANewBRepNaming/QANewBRepNaming_TopNaming.hxx deleted file mode 100644 index 0a46d2c671..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.hxx +++ /dev/null @@ -1,68 +0,0 @@ -// Created on: 1999-09-24 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_TopNaming_HeaderFile -#define _QANewBRepNaming_TopNaming_HeaderFile - -#include -#include -#include - -#include -class TDF_Label; - - -//! The root class for all the primitives, features, ... -class QANewBRepNaming_TopNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Returns the result label. - const TDF_Label& ResultLabel() const; - - - - -protected: - - - Standard_EXPORT QANewBRepNaming_TopNaming(); - - Standard_EXPORT QANewBRepNaming_TopNaming(const TDF_Label& Label); - - - TDF_Label myResultLabel; - - -private: - - - - - -}; - - -#include - - - - - -#endif // _QANewBRepNaming_TopNaming_HeaderFile diff --git a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.lxx b/src/QANewBRepNaming/QANewBRepNaming_TopNaming.lxx deleted file mode 100644 index 0c5813df9b..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_TopNaming.lxx +++ /dev/null @@ -1,25 +0,0 @@ -// Created on: 1999-10-25 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -//======================================================================= -//function : ResultLabel -//purpose : -//======================================================================= - -inline const TDF_Label& QANewBRepNaming_TopNaming::ResultLabel() const -{ - return myResultLabel; -} diff --git a/src/QANewBRepNaming/QANewBRepNaming_TypeOfPrimitive3D.hxx b/src/QANewBRepNaming/QANewBRepNaming_TypeOfPrimitive3D.hxx deleted file mode 100644 index 0d7d0e7c37..0000000000 --- a/src/QANewBRepNaming/QANewBRepNaming_TypeOfPrimitive3D.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// Created on: 1999-09-24 -// Created by: Sergey ZARITCHNY -// Copyright (c) 1999-1999 Matra Datavision -// 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. - -#ifndef _QANewBRepNaming_TypeOfPrimitive3D_HeaderFile -#define _QANewBRepNaming_TypeOfPrimitive3D_HeaderFile - - -enum QANewBRepNaming_TypeOfPrimitive3D -{ -QANewBRepNaming_SHELL, -QANewBRepNaming_SOLID -}; - -#endif // _QANewBRepNaming_TypeOfPrimitive3D_HeaderFile diff --git a/src/QANewDBRepNaming/FILES b/src/QANewDBRepNaming/FILES deleted file mode 100755 index 427cfdbda6..0000000000 --- a/src/QANewDBRepNaming/FILES +++ /dev/null @@ -1,4 +0,0 @@ -QANewDBRepNaming.cxx -QANewDBRepNaming.hxx -QANewDBRepNaming_FeatureCommands.cxx -QANewDBRepNaming_PrimitiveCommands.cxx diff --git a/src/QANewDBRepNaming/QANewDBRepNaming.cxx b/src/QANewDBRepNaming/QANewDBRepNaming.cxx deleted file mode 100644 index c17e32c59b..0000000000 --- a/src/QANewDBRepNaming/QANewDBRepNaming.cxx +++ /dev/null @@ -1,381 +0,0 @@ -// Created on: 1999-12-08 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -//////#include -//////#include -static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor&,Standard_Integer,const char ** a); - -//static Standard_Integer QANewDBRepNaming_myCheckNaming(Draw_Interpretor&,Standard_Integer,const char ** a); - -static Standard_Integer QANewDBRepNaming_CheckSelectShape(Draw_Interpretor&,Standard_Integer,const char ** a); - -static Standard_Integer QANewDBRepNaming_CheckSolve(Draw_Interpretor&,Standard_Integer,const char ** a); - -#include - -//======================================================================= -//function : AllCommands -//purpose : -//======================================================================= - -void QANewDBRepNaming::AllCommands(Draw_Interpretor& theCommands) -{ - static Standard_Boolean done = Standard_False; - if (done) return; - done = Standard_True; - - QANewDBRepNaming::PrimitiveCommands (theCommands); - QANewDBRepNaming::FeatureCommands (theCommands); - - const char* g = "Check Naming command" ; - - theCommands.Add ("CheckNaming", - "CheckNaming Doc TestLabel Full(1/0) (Label/Viewer) [Label] [DX[DY[DZ]]]", - __FILE__, QANewDBRepNaming_CheckNaming, g); - - theCommands.Add ("CheckSelectShape", - "CheckSelectShape Doc Label SubShapeType", - __FILE__, QANewDBRepNaming_CheckSelectShape, g); - - theCommands.Add ("CheckSolve", - "CheckSolve Doc Label", - __FILE__, QANewDBRepNaming_CheckSolve, g); - - const char* com = "set Draw_NamingData 1"; - theCommands.Eval(com); -} - -//======================================================================= -//function : CheckNaming -//purpose : "CheckNaming Doc TestLabel Full(1/0) ShapeFrom(Viewer/Label) [ShapeLabel]" -//======================================================================= - -static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor& di,Standard_Integer nb, const char ** a) -{ - Handle(TDF_Data) DF; - if(!DDF::GetDF(a[1], DF)) return 1; - TDF_Label L; - DDF::AddLabel(DF, a[2], L); - -// cout<<"SELECT A SHAPE ..."<Get()) == Standard_False) - di << "Selection error!!!\n"; - return 1; - } - Handle(TNaming_NamedShape) aNS; - if (!aSubLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - di<<"Selection didn't produced a Named Shape ...\n"; - return 1; - } - const TopoDS_Shape& aResultOfSelection = TNaming_Tool::GetShape(aNS); - if (!aSubShape.IsSame(aResultOfSelection)) { - di<<"Failure of selection\n"; - return 1; - } - } catch (Standard_Failure) { - di<<"!!! Solving Failed !!!\n"; - continue; - } - - } - -// *** - - if (!Draw::Atoi(a[3])) return 0; - Standard_Real aDX = 100.0; - Standard_Real aDY = 100.0; - Standard_Real aDZ = 100.0; - if(nb > 6) { - aDX = Draw::Atof(a[6]); - if(nb > 7) aDY = Draw::Atof(a[7]); - if(nb > 8) aDZ = Draw::Atof(a[8]); - } -// cout<Get()); - TNaming_Selector SLSolving(itr.Value()); - if (!SLSolving.Solve(scope)) { - isFailured = Standard_True; - aNotSolved += " "; - aNotSolved += i; - continue; - } - const Handle(TNaming_NamedShape)& aResultOfSolving = SLSolving.NamedShape(); - if (aResultOfSolving.IsNull()) { -// cout<<"Failure of Solving: it didn't produced a shape!"<Get()); - TopoDS_Shape aSubShape; - if (itr.More()) aSubShape = itr.Value(); - TDF_LabelMap one,two; - TNaming_Tool::FindShape(one, two, aResultOfSolving, aRes); - if (aRes.IsNull()) { -// cout<<"Failure of TNaming_Tool::FindShape()!"<Get(); - if (!aRes.IsSame(allTranslatedSubShapes(i))) { -// cout<<"Failure of solving of "<Get(); - TopExp_Explorer expl(aContext, (TopAbs_ShapeEnum)Draw::Atoi(a[3])); - for (; expl.More(); expl.Next()) { - if (expl.Current().IsSame(aSelectedShape)) { - di<<"QANewDBRepNaming_CheckSelectShape(): The context is found at "; - - //NS->Label().EntryDump(cout); - Standard_SStream aSStream; - NS->Label().EntryDump(aSStream); - di << aSStream; - di<<"\n"; - contextFound = Standard_True; - break; - } - } - if (contextFound) break; - } - aContext = TopoDS_Shape(); - } - // Selection: - TNaming_Selector aSelector(L); - if (aContext.IsNull()) { - aSelector.Select(aSelectedShape); - } else { - aSelector.Select(aSelectedShape, aContext); - } - return 0; -} - -//======================================================================= -//function : CheckSelectShape -//purpose : "CheckSelectShape Doc Label SubShapeType" -//======================================================================= - -static Standard_Integer QANewDBRepNaming_CheckSolve(Draw_Interpretor&,Standard_Integer /*nb*/, const char ** a) -{ - Handle(TDF_Data) DF; - if(!DDF::GetDF(a[1], DF)) return 1; - TDF_Label L; - DDF::AddLabel(DF, a[2], L); - Handle(TNaming_NamedShape) aNS; - L.FindAttribute(TNaming_NamedShape::GetID(), aNS); - - return 0; -} diff --git a/src/QANewDBRepNaming/QANewDBRepNaming.hxx b/src/QANewDBRepNaming/QANewDBRepNaming.hxx deleted file mode 100644 index cd38c04d80..0000000000 --- a/src/QANewDBRepNaming/QANewDBRepNaming.hxx +++ /dev/null @@ -1,64 +0,0 @@ -// Created on: 1999-12-08 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999 Matra Datavision -// 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. - -#ifndef _QANewDBRepNaming_HeaderFile -#define _QANewDBRepNaming_HeaderFile - -#include -#include -#include - -#include - - -//! To test topological naming -class QANewDBRepNaming -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT static void AllCommands (Draw_Interpretor& Di); - - Standard_EXPORT static void PrimitiveCommands (Draw_Interpretor& DI); - - Standard_EXPORT static void FeatureCommands (Draw_Interpretor& DI); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewDBRepNaming_HeaderFile diff --git a/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx b/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx deleted file mode 100644 index 28614e27fd..0000000000 --- a/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx +++ /dev/null @@ -1,393 +0,0 @@ -// Created on: 1999-12-23 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//============================================================== -//function : QANewDBRepNaming_NameBooleanOperation -//purpose : NameBooleanOperation Doc Label Op = 1(Fuse), 2(Cut), 3(Common), 4(Inserction) 5(Limitation) DrawShape1 DrawShape2 [Forward = 0 || Reversed = 1 || BothSides = 2] -//============================================================== -static Standard_Integer QANewDBRepNaming_NameBooleanOperation (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 6 && nb != 7) { - di << "QANewDBRepNaming_NameBooleanOperation : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - - const Standard_Integer Op = (Standard_Integer)Draw::Atoi(arg[3]); - const TopoDS_Shape& S1 = DBRep::Get(arg[4]); - const TopoDS_Shape& S2 = DBRep::Get(arg[5]); - - Standard_Integer Orientation = 0; - if (nb == 7) Orientation = Draw::Atoi(arg[6]); - - switch (Op) { - case 1: { - di << "BRepAlgoAPI_Fuse" << "\n"; - BRepAlgoAPI_Fuse mkFuse(S1, S2); - - Standard_ASSERT_RAISE(mkFuse.IsDone(), "Fuse failed"); - QANewBRepNaming_Fuse nameBool(L); - nameBool.Load(mkFuse); - break; - } - case 2: { - di << "BRepAlgoAPI_Cut" << "\n"; - BRepAlgoAPI_Cut mkCut(S1, S2); - - Standard_ASSERT_RAISE(mkCut.IsDone(), "Cut failed"); - QANewBRepNaming_Cut nameBool(L); - nameBool.Load(mkCut); - break; - } - case 3: { - di << "BRepAlgoAPI_Common" << "\n"; - BRepAlgoAPI_Common mkCommon(S1, S2); - - Standard_ASSERT_RAISE(mkCommon.IsDone(), "Common failed"); - QANewBRepNaming_Common nameBool(L); - nameBool.Load(mkCommon); - break; - } - case 4: { - QANewModTopOpe_Intersection mkSection(S1, S2); - Standard_ASSERT_RAISE(mkSection.IsDone(), "Section failed"); - QANewBRepNaming_Intersection nameBool(L); - nameBool.Load(mkSection); - break; - } - case 5: { - QANewModTopOpe_Limitation mkLimit(S1, S2); - const QANewModTopOpe_ModeOfLimitation aMode = (QANewModTopOpe_ModeOfLimitation) Orientation; - mkLimit.SetMode(aMode); - mkLimit.Cut(); -// if (Orientation = 0) mkLimit.CutForward(); -// else if (Orientation = 1) mkLimit.CutReversed(); -// else if (Orientation = 2) mkLimit.CutBothSides(); - Standard_ASSERT_RAISE(mkLimit.IsDone(),"Limit failed"); - QANewBRepNaming_Limitation nameBool(L); - nameBool.Load(mkLimit); - break; - } - default: - di<<"QANewDBRepNaming_NameBooleanOperation The type of operation must be 1 - fuse, 2 - cut or 3 - common\n"; - } - - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameFuse -//purpose : NameFuse Doc Label DrawShape1 DrawShape2 -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameFuse (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 5) { - di << "QANewDBRepNaming_NameFuse : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const TopoDS_Shape& S1 = DBRep::Get(arg[3]); - const TopoDS_Shape& S2 = DBRep::Get(arg[4]); - QANewBRepNaming_Fuse nameBool(L); - - di << "BRepAlgoAPI_Fuse" << "\n"; - BRepAlgoAPI_Fuse mkFuse(S1, S2); - - Standard_ASSERT_RAISE(mkFuse.IsDone(), "Fuse failed"); - nameBool.Load(mkFuse); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameCut -//purpose : NameCut Doc Label DrawShape1 DrawShape2 -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameCut (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 5) { - di << "QANewDBRepNaming_NameCut : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const TopoDS_Shape& S1 = DBRep::Get(arg[3]); - const TopoDS_Shape& S2 = DBRep::Get(arg[4]); -// DBRep::Set("aShape", S1); - QANewBRepNaming_Cut nameBool(L); -// DBRep::Set("S1", S1); -// DBRep::Set("S2", S2); - - di << "BRepAlgoAPI_Cut" << "\n"; - BRepAlgoAPI_Cut mkCut(S1, S2); - -// DBRep::Set("CutRes", mkCut.Shape()); -// DBRep::Set("Shape1", mkCut.Shape1()); -// DBRep::Set("Shape2", mkCut.Shape2()); -// BRepTools::Write(mkCut.Shape1(), "/dn04/OS/SAMTECH/env/S1.brep"); - Standard_ASSERT_RAISE(mkCut.IsDone(), "Cut failed"); - nameBool.Load(mkCut); -// BRepTools::Write(mkCut.Shape1(), "/dn04/OS/SAMTECH/env/S2.brep"); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameCommon -//purpose : NameCommon Doc Label DrawShape1 DrawShape2 -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameCommon (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 5) { - di << "QANewDBRepNaming_NameCommon : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const TopoDS_Shape& S1 = DBRep::Get(arg[3]); - const TopoDS_Shape& S2 = DBRep::Get(arg[4]); - QANewBRepNaming_Common nameBool(L); - - di << "BRepAlgoAPI_Common" << "\n"; - BRepAlgoAPI_Common mkCommon(S1, S2); - - Standard_ASSERT_RAISE(mkCommon.IsDone(), "Common failed"); - nameBool.Load(mkCommon); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameIntersection -//purpose : NameIntersection Doc Label DrawShape1 DrawShape2 -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameIntersection (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 5) { - di << "QANewDBRepNaming_NameIntersection : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const TopoDS_Shape& S1 = DBRep::Get(arg[3]); - const TopoDS_Shape& S2 = DBRep::Get(arg[4]); - QANewBRepNaming_Intersection nameBool(L); - QANewModTopOpe_Intersection mkIntersection(S1, S2); - Standard_ASSERT_RAISE(mkIntersection.IsDone(), "Section failed"); - nameBool.Load(mkIntersection); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameLimit -//purpose : NameLimit Doc Label DrawShape1 DrawShape2 [Orientation (Forward - 0, Reversed - 1 or BothSise - 2)] -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameLimit (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 5 && nb != 6) { - di << "QANewDBRepNaming_NameLimit : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const TopoDS_Shape& S1 = DBRep::Get(arg[3]); - const TopoDS_Shape& S2 = DBRep::Get(arg[4]); - Standard_Integer Orientation = 0; - if (nb == 6) { - Orientation = Draw::Atoi(arg[5]); - } - QANewBRepNaming_Limitation nameBool(L); - const QANewModTopOpe_ModeOfLimitation aMode = (QANewModTopOpe_ModeOfLimitation) Orientation; - QANewModTopOpe_Limitation mkLimit(S1, S2, aMode); - mkLimit.Cut(); - // if (Orientation == 0) mkLimit.CutForward(); -// else if (Orientation == 1) mkLimit.CutReversed(); -// else if (Orientation == 2) mkLimit.CutBothSides(); - Standard_ASSERT_RAISE(mkLimit.IsDone(), "Limit failed"); - nameBool.Load(mkLimit); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameGlue -//purpose : NameGlue Doc Label ObjectLabel ToolLabel [auxiliary valid labels] -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameGlue (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb < 5) { - di << "QANewDBRepNaming_NameGlue : Error" << "\n"; - return 1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(arg[1],D)) return 1; - TDF_Label L,OL,TL; - if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - if (!DDF::AddLabel(D->GetData(), arg[3], OL)) return 1; - if (!DDF::AddLabel(D->GetData(), arg[4], TL)) return 1; - TDF_LabelMap aLog; - for(Standard_Integer i=5;iGetData(), arg[i], aLabel)) return 1; - aLog.Add(aLabel); - } - Handle(TNaming_NamedShape) anObjectNS,aToolNS; - if (!OL.FindAttribute(TNaming_NamedShape::GetID(),anObjectNS)) return 1; - if (!TL.FindAttribute(TNaming_NamedShape::GetID(),aToolNS)) return 1; - - QANewModTopOpe_Glue aMKGlue(TNaming_Tool::CurrentShape(anObjectNS),TNaming_Tool::CurrentShape(aToolNS)); - if (!aMKGlue.IsDone()) return 1; - aMKGlue.Build(); - if (!aMKGlue.IsDone()) return 1; - - QANewBRepNaming_Gluing aGlue(L); - aGlue.SetContext(TNaming_Tool::CurrentShape(anObjectNS),TNaming_Tool::CurrentShape(aToolNS)); - aGlue.SetLog(aLog); - aGlue.Load(aMKGlue); - return 0; -} - -//======================================================================= -//function : FeatureCommands -//purpose : -//======================================================================= - -void QANewDBRepNaming::FeatureCommands (Draw_Interpretor& theCommands) -{ - static Standard_Boolean done = Standard_False; - if (done) return; - done = Standard_True; - const char* g = "Naming algorithm commands for Booleans"; - - - theCommands.Add ("NameBooleanOperation", - "NameBooleanOperation Doc Label Operation(1, 2, 3, 4 or 5) DrawShape1 DrawShape2 [Forward = 0 || Reversed = 1 || BothSides = 2] ", - __FILE__, QANewDBRepNaming_NameBooleanOperation, g); - - theCommands.Add ("NameFuse", - "NameFuse Doc Label DrawShape1 DrawShape2", - __FILE__, QANewDBRepNaming_NameFuse, g); - - theCommands.Add ("NameCut", - "NameCut Doc Label DrawShape1 DrawShape2", - __FILE__, QANewDBRepNaming_NameCut, g); - - theCommands.Add ("NameCommon", - "NameCommon Doc Label DrawShape1 DrawShape2", - __FILE__, QANewDBRepNaming_NameCommon, g); - - theCommands.Add ("NameIntersection", - "NameIntersection Doc Label DrawShape1 DrawShape2", - __FILE__, QANewDBRepNaming_NameIntersection, g); - - theCommands.Add ("NameLimit", - "NameLimit Doc Label DrawShape1 DrawShape2 [Orientation (Forward - 0, Reversed - 1 or BothSise - 2)]", - __FILE__, QANewDBRepNaming_NameLimit, g); - - theCommands.Add ("NameGlue", - "NameGlue Doc Label ObjectLabel ToolLabel [auxiliary valid labels]", - __FILE__, QANewDBRepNaming_NameGlue, g); - -} diff --git a/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx b/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx deleted file mode 100644 index 25e85d7f67..0000000000 --- a/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx +++ /dev/null @@ -1,455 +0,0 @@ -// Created on: 1999-12-23 -// Created by: Vladislav ROMASHKO -// Copyright (c) 1999-1999 Matra Datavision -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : QANewDBRepNaming_NameBox -//purpose : NameCylinder Doc Label dx dy dz -//======================================================================= -static Standard_Integer QANewDBRepNaming_NameBox (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if(nb == 6) { - TDF_Label L; - if (!QADNaming::Entry(arg, L)) return 1; - - BRepPrimAPI_MakeBox mkBox(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); - mkBox.Build(); - - if(!mkBox.IsDone()) { - di << "The box hasn't been built" << "\n"; - return 1; - } - - QANewBRepNaming_Box nameBox(L); - nameBox.Load(mkBox,QANewBRepNaming_SOLID); - return 0; - } - di << "QANewDBRepNaming_NameBox : Error" << "\n"; - return 1; -} - -//======================================================================= -//function : QANewDBRepNaming_NameCylinder -//purpose : NameCylinder Doc Label R H Angle [ShapeType(Shell/Solid)] -//======================================================================= - -static Standard_Integer QANewDBRepNaming_NameCylinder (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if(nb == 6 || nb == 7) { - TDF_Label L; - if (!QADNaming::Entry(arg, L)) return 1; - - BRepPrimAPI_MakeCylinder mkCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4])); - if (Draw::Atof(arg[5]) != 0.) { - // for Mandrake-10 - mkv,02.06.06 - mkCylinder = BRepPrimAPI_MakeCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); - BRepPrimAPI_MakeCylinder MakeCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); - mkCylinder = MakeCylinder; - } - mkCylinder.Build(); - - if(!mkCylinder.IsDone()) { - di << "The cylinder hasn't been built" << "\n"; - return 1; - } - - QANewBRepNaming_Cylinder nameCylinder(L); - if (nb == 6) nameCylinder.Load(mkCylinder, QANewBRepNaming_SHELL); - else if (Draw::Atoi(arg[6]) == 0) nameCylinder.Load(mkCylinder, QANewBRepNaming_SHELL); - else nameCylinder.Load(mkCylinder, QANewBRepNaming_SOLID); - - return 0; - } - di << "QANewDBRepNaming_NameCylinder : Error" << "\n"; - return 1; -} - - -//======================================================================= -//function : QANewDBRepNaming_NameSphere -//purpose : NameSphere Doc Label R X Y Z Angle1 Angle2 Angle3 [ShapeType(Shell/Solid)] -//======================================================================= - - static Standard_Integer QANewDBRepNaming_NameSphere (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) - { - TDF_Label L; - if (!QADNaming::Entry(arg, L)) return 1; - Standard_Real R = Draw::Atof(arg[3]); - Standard_Real X = Draw::Atof(arg[4]); - Standard_Real Y = Draw::Atof(arg[5]); - Standard_Real Z = Draw::Atof(arg[6]); - Standard_Real DX = Draw::Atof(arg[7]); - Standard_Real DY = Draw::Atof(arg[8]); - Standard_Real DZ = Draw::Atof(arg[9]); - QANewBRepNaming_TypeOfPrimitive3D type = QANewBRepNaming_SHELL; - if (nb == 11) type = (QANewBRepNaming_TypeOfPrimitive3D) Draw::Atoi(arg[10]); - - QANewBRepNaming_Sphere nameSphere(L); - BRepPrimAPI_MakeSphere mkSphere(R); - if (DX == 0 && DY == 0 && DZ == 0) { - // for Mandrake-10 - mkv,02.06.06 - mkSphere = BRepPrimAPI_MakeSphere(gp_Pnt(X, Y, Z), R); - BRepPrimAPI_MakeSphere MakeSphere1(gp_Pnt(X, Y, Z), R); - mkSphere = MakeSphere1; - } else { - // for Mandrake-10 - mkv,02.06.06 - mkSphere = BRepPrimAPI_MakeSphere(gp_Pnt(X, Y, Z), R, DX, DY, DZ); - BRepPrimAPI_MakeSphere MakeSphere2(gp_Pnt(X, Y, Z), R, DX, DY, DZ); - mkSphere = MakeSphere2; - } - mkSphere.Build(); - if(!mkSphere.IsDone()) { - di << "The sphere hasn't been built" << "\n"; - return 1; - } - nameSphere.Load(mkSphere, type); - return 0; - } - -//=========================================================================== -//function : QANewDBRepNaming_NamePrism -//purpose : NamePrism Doc Label BasisLabel H Direction(X Y Z) [Inf/Semi-Inf] -//=========================================================================== - -static Standard_Integer QANewDBRepNaming_NamePrism (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb < 5 || nb > 9 || nb == 6 || nb == 7) { - di << "QANewDBRepNaming_NamePrism : Error" << "\n"; - return 1; - } - - TDF_Label L,BL; - if (!QADNaming::Entry(arg, L)) return 1; - if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; - - Standard_Real H = Draw::Atof(arg[4]); - - Handle(TNaming_NamedShape) BasisNS; - if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; - const TopoDS_Shape& Basis = TNaming_Tool::CurrentShape(BasisNS); - - QANewBRepNaming_Prism namePrism(L); - - if (nb >= 8) { - gp_Dir Direction(Draw::Atof(arg[5]), Draw::Atof(arg[6]), Draw::Atof(arg[7])); - gp_Vec Vector(Direction); - Vector.Normalize(); - Vector *= H; - - if (nb == 8) { - BRepPrimAPI_MakePrism mkPrism(Basis, Vector); - mkPrism.Build(); - - if(!mkPrism.IsDone()) { - di << "The prism hasn't been built" << "\n"; - return 1; - } - - namePrism.Load(mkPrism, Basis); - } - else if (nb == 9) { - BRepPrimAPI_MakePrism mkPrism(Basis, Direction, Draw::Atoi(arg[8]) != 0); - mkPrism.Build(); - - if(!mkPrism.IsDone()) { - di << "The prism hasn't been built" << "\n"; - return 1; - } - - namePrism.Load(mkPrism, Basis); - } - } - - return 0; -} - -//=========================================================================== -//function : QANewDBRepNaming_NameRevol -//purpose : NameRevol Doc Label BasisLabel AxisLabel Angle -//=========================================================================== - -static Standard_Integer QANewDBRepNaming_NameRevol (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb < 5 || nb > 6) { - di << "QANewDBRepNaming_NameRevol : Error" << "\n"; - return 1; - } - - TDF_Label L, BL, AL; - if (!QADNaming::Entry(arg, L)) return 1; - - if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; - if (!DDF::AddLabel(L.Data(), arg[4], AL)) return 1; - - Handle(TNaming_NamedShape) BasisNS, AxisNS; - if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; - if (!AL.FindAttribute(TNaming_NamedShape::GetID(), AxisNS)) return 1; - const TopoDS_Shape& Basis = TNaming_Tool::CurrentShape(BasisNS); - const TopoDS_Shape& Axis = TNaming_Tool::CurrentShape(AxisNS); - - if (Axis.ShapeType() != TopAbs_EDGE) return 1; - - gp_Ax1 axis; - TopoDS_Vertex fV = TopExp::FirstVertex(TopoDS::Edge(Axis), Standard_True); - TopoDS_Vertex lV = TopExp::LastVertex(TopoDS::Edge(Axis), Standard_True); - if (!fV.IsNull() || !lV.IsNull()) { - gp_Vec alocalV(BRep_Tool::Pnt(fV),BRep_Tool::Pnt(lV)); - gp_Dir Direction(alocalV); -// gp_Dir Direction(gp_Vec(BRep_Tool::Pnt(fV), BRep_Tool::Pnt(lV))); - axis.SetLocation(BRep_Tool::Pnt(fV)); - axis.SetDirection(Direction); - } - else { - TDataXtd_Geometry::Axis(AL, axis); - } - - QANewBRepNaming_Revol nameRevol(L); - - if(nb == 5) { - - BRepPrimAPI_MakeRevol mkRevol(Basis, axis); - mkRevol.Build(); - - if(!mkRevol.IsDone()) { - di << "The revol hasn't been built" << "\n"; - return 1; - } - - nameRevol.Load(mkRevol, Basis); - } - else if (nb == 6) { - - Standard_Real Angle = Draw::Atof(arg[5]); - - BRepPrimAPI_MakeRevol mkRevol(Basis, axis, Angle); - mkRevol.Build(); - - if(!mkRevol.IsDone()) { - di << "The revol hasn't been built" << "\n"; - return 1; - } - - nameRevol.Load(mkRevol, Basis); - - } - - return 0; -} - -//=========================================================================== -//function : QANewDBRepNaming_NameFillet -//purpose : NameFillet Doc Label SourceShapeLabel PathLabel Radius -//=========================================================================== - -static Standard_Integer QANewDBRepNaming_NameFillet (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 6) { - di << "QANewDBRepNaming_NameFillet : Error" << "\n"; - return 1; - } - - TDF_Label L, BL, PL; - if (!QADNaming::Entry(arg, L)) return 1; - - if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; - if (!DDF::AddLabel(L.Data(), arg[4], PL)) return 1; - Standard_Real aRadius = Draw::Atoi(arg[5]); - Handle(TNaming_NamedShape) BasisNS, PathNS; - if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; - if (!PL.FindAttribute(TNaming_NamedShape::GetID(), PathNS)) return 1; - const TopoDS_Shape& Basis = TNaming_Tool::CurrentShape(BasisNS); - const TopoDS_Shape& Path = TNaming_Tool::CurrentShape(PathNS); - - BRepFilletAPI_MakeFillet aFillet(Basis); - TopExp_Explorer anExp(Path,TopAbs_EDGE); - if (anExp.More()) { - for(;anExp.More();anExp.Next()) { - aFillet.Add(aRadius,TopoDS::Edge(anExp.Current())); - } - } else aFillet.Add(aRadius,TopoDS::Edge(Path)); - aFillet.Build(); - if (!aFillet.IsDone()) return 1; - QANewBRepNaming_Fillet aNaming(L); - aNaming.Load(Basis, aFillet); - return 0; -} - -//=========================================================================== -//function : QANewDBRepNaming_NameChamfer -//purpose : NameChamfer Doc Label SourceShapeLabel EdgeLabel FaceLabel Distance1 Distance2 -//=========================================================================== - -static Standard_Integer QANewDBRepNaming_NameChamfer (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 8) { - di << "QANewDBRepNaming_NameChamfer : Error" << "\n"; - return 1; - } - - TDF_Label L, BL, EL, FL; - Standard_Real aDist1, aDist2; - - if (!QADNaming::Entry(arg, L)) return 1; - - if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; - if (!DDF::AddLabel(L.Data(), arg[4], EL)) return 1; - if (!DDF::AddLabel(L.Data(), arg[5], FL)) return 1; - aDist1 = Draw::Atoi(arg[6]); - aDist2 = Draw::Atoi(arg[7]); - - Handle(TNaming_NamedShape) BasisNS, EdgeNS, FaceNS; - if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; - if (!EL.FindAttribute(TNaming_NamedShape::GetID(), EdgeNS)) return 1; - if (!FL.FindAttribute(TNaming_NamedShape::GetID(), FaceNS)) return 1; - const TopoDS_Shape& Basis = TNaming_Tool::CurrentShape(BasisNS); - const TopoDS_Shape& Edge = TNaming_Tool::CurrentShape(EdgeNS); - const TopoDS_Shape& Face = TNaming_Tool::CurrentShape(FaceNS); - - BRepFilletAPI_MakeChamfer aChamfer(Basis); - TopExp_Explorer anExp(Edge,TopAbs_EDGE); - if (anExp.More()) { - for(;anExp.More();anExp.Next()) { - aChamfer.Add(aDist1,aDist2,TopoDS::Edge(anExp.Current()),TopoDS::Face(Face)); - } - } else {aChamfer.Add(aDist1,aDist2,TopoDS::Edge(Edge),TopoDS::Face(Face));} - aChamfer.Build(); - if (!aChamfer.IsDone()) return 1; - QANewBRepNaming_Chamfer aNaming(L); - aNaming.Load(Basis, aChamfer); - return 0; -} - -//============================================================== -//function : QANewDBRepNaming_NameImportShape -//purpose : NameImportShape Doc Label DrawShape -//============================================================== - -static Standard_Integer QANewDBRepNaming_NameImportShape (Draw_Interpretor& di, - Standard_Integer nb, - const char ** arg) -{ - if (nb != 4) { - di << "QANewDBRepNaming_NameImportShape : Error" << "\n"; - return 1; - } - - Handle(TDF_Data) D; - if (!DDF::GetDF(arg[1],D)) return 1; - TDF_Label L; - if (!DDF::AddLabel(D, arg[2], L)) return 1; - - const TopoDS_Shape& S = DBRep::Get(arg[3]); - - QANewBRepNaming_ImportShape nameIS(L); - nameIS.Load(S); - - return 0; -} - - -//======================================================================= -//function : PrimitiveCommands -//purpose : -//======================================================================= - -void QANewDBRepNaming::PrimitiveCommands (Draw_Interpretor& theCommands) -{ - static Standard_Boolean done = Standard_False; - if (done) return; - done = Standard_True; - const char* g = "Naming algorithm commands for primitives" ; - - - theCommands.Add ("NameBox", - "NameBox Doc Label dx dy dz", - __FILE__, QANewDBRepNaming_NameBox, g); - - theCommands.Add ("NameCylinder", - "NameCylinder Doc Label R H Angle [ShapeType(Shell/Solid)]", - __FILE__, QANewDBRepNaming_NameCylinder, g); - - theCommands.Add ("NameSphere", - "NameSphere Doc Label R X Y Z Angle1 Angle2 Angle3 [ShapeType(Shell/Solid)]", - __FILE__, QANewDBRepNaming_NameSphere, g); - - theCommands.Add ("NamePrism", - "NamePrism Doc Label BasisLabel H Direction(X Y Z) Inf(1/0, by feafault = 0)", - __FILE__, QANewDBRepNaming_NamePrism, g); - - theCommands.Add ("NameRevol", - "NameRevol Doc Label BasisLabel AxisLabel Angle", - __FILE__, QANewDBRepNaming_NameRevol, g); - - theCommands.Add ("NameFillet", - "NameFillet Doc Label SourceShapeLabel PathLabel Radius", - __FILE__, QANewDBRepNaming_NameFillet, g); - - theCommands.Add ("NameChamfer", - "NameChamfer Doc Label SourceShapeLabel EdgeLabel FaceLabel Distance1 Distance2", - __FILE__, QANewDBRepNaming_NameChamfer, g); - - theCommands.Add ("NameImportShape", - "NameImportShape Doc Label DrawShape", - __FILE__, QANewDBRepNaming_NameImportShape, g); - -} diff --git a/src/QANewModTopOpe/FILES b/src/QANewModTopOpe/FILES deleted file mode 100755 index 23da8dcb00..0000000000 --- a/src/QANewModTopOpe/FILES +++ /dev/null @@ -1,20 +0,0 @@ -QANewModTopOpe.cxx -QANewModTopOpe.hxx -QANewModTopOpe_CommonPtr.hxx -QANewModTopOpe_CutPtr.hxx -QANewModTopOpe_Glue.cxx -QANewModTopOpe_Glue.hxx -QANewModTopOpe_Glue_SDFaces.cxx -QANewModTopOpe_Glue_shell.cxx -QANewModTopOpe_Glue_util.cxx -QANewModTopOpe_Glue_vertex.cxx -QANewModTopOpe_Glue_wire.cxx -QANewModTopOpe_Intersection.cxx -QANewModTopOpe_Intersection.hxx -QANewModTopOpe_Limitation.cxx -QANewModTopOpe_Limitation.hxx -QANewModTopOpe_ModeOfLimitation.hxx -QANewModTopOpe_ReShaper.cxx -QANewModTopOpe_ReShaper.hxx -QANewModTopOpe_Tools.cxx -QANewModTopOpe_Tools.hxx diff --git a/src/QANewModTopOpe/QANewModTopOpe.cxx b/src/QANewModTopOpe/QANewModTopOpe.cxx deleted file mode 100644 index e1a5d6ccfc..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe.cxx +++ /dev/null @@ -1,653 +0,0 @@ -// Created on: 2002-01-28 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2002-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static Standard_Boolean NoInternalVertices(const TopoDS_Shape& TheS); -static Standard_Boolean CorrectOrientation(const TopoDS_Shell& TheS); - -static TopoDS_Shape RemoveIntExtEdges(const TopoDS_Shape& TheS) -{ - - TopoDS_Shape aCopy = TheS; - BRepTools_Substitution aSubst; - TopTools_ListOfShape anEmptyList; - TopAbs_Orientation anOr; - - TopExp_Explorer anExp(aCopy, TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) { - anOr = anExp.Current().Orientation(); - if(anOr == TopAbs_INTERNAL || anOr == TopAbs_EXTERNAL) { - if(!aSubst.IsCopied(anExp.Current())) { - aSubst.Substitute(anExp.Current(), anEmptyList); - } - } - } - - aSubst.Build(aCopy); - - if(aSubst.IsCopied(aCopy)) { - aCopy = aSubst.Copy(aCopy).First(); - } - - return aCopy; -} - -Standard_Boolean QANewModTopOpe::IsValid(const TopoDS_Shape& TheS, const Standard_Boolean GeomControls) -{ - - TopExp_Explorer anExp, anExp1; - TopoDS_Shape aCopy; - - anExp.Init(TheS, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - - aCopy = RemoveIntExtEdges(anExp.Current()); - - BRepCheck_Analyzer anAnlz(aCopy, GeomControls); - - if(anAnlz.IsValid()) continue; - else return Standard_False; - - } - - anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - - aCopy = RemoveIntExtEdges(anExp.Current()); - - Handle(BRepCheck_Shell) aChkSh = new BRepCheck_Shell(TopoDS::Shell(aCopy)); - aChkSh->Minimum(); - aChkSh->Closed(Standard_True); - aChkSh->Orientation(Standard_True); - BRepCheck_ListIteratorOfListOfStatus anItl(aChkSh->Status()); - for (;anItl.More(); anItl.Next()) { - if((anItl.Value() == BRepCheck_NoError) || - (anItl.Value() == BRepCheck_InvalidMultiConnexity) || - (anItl.Value() == BRepCheck_NotClosed) || - (anItl.Value() == BRepCheck_BadOrientationOfSubshape)) continue; - return Standard_False; - } - - anExp1.Init(anExp.Current(), TopAbs_FACE); - for(; anExp1.More(); anExp1.Next()) { - if(IsValid(anExp1.Current())) continue; - else return Standard_False; - } - } - - anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - - aCopy = RemoveIntExtEdges(anExp.Current()); - - BRepCheck_Analyzer anAnlz(aCopy, GeomControls); - - if(anAnlz.IsValid()) continue; - else return Standard_False; - - } - - anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE); - for(; anExp.More(); anExp.Next()) { - - BRepCheck_Analyzer anAnlz(anExp.Current(), GeomControls); - - Handle(BRepCheck_Result) aChkWr = anAnlz.Result(anExp.Current()); - BRepCheck_ListIteratorOfListOfStatus anItl(aChkWr->Status()); - for (;anItl.More(); anItl.Next()) { - - if(anItl.Value() == BRepCheck_NoError || - anItl.Value() == BRepCheck_BadOrientationOfSubshape) continue; - - return Standard_False; - - } - - } - - anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE); - for(; anExp.More(); anExp.Next()) { - - BRepCheck_Analyzer anAnlz(anExp.Current(), GeomControls); - - if(anAnlz.IsValid()) continue; - else return Standard_False; - - } - - return Standard_True; -} - -Standard_Boolean QANewModTopOpe::IsManifold(const TopoDS_Shape& TheS) -{ - - Standard_Boolean aRes = Standard_False; - - if(TheS.IsNull()) return aRes; - - TopAbs_ShapeEnum aType = TheS.ShapeType(); - - switch (aType) { - - case TopAbs_COMPOUND : - { - TopoDS_Iterator anIter(TheS); - if(!anIter.More()) return aRes; - const TopoDS_Shape& aS = anIter.Value(); - anIter.Next(); - if(anIter.More()) aRes = IsCompoundManifold(TopoDS::Compound(TheS)); - else aRes = IsManifold(aS); - } - break; - case TopAbs_COMPSOLID : - aRes = Standard_False; - break; - case TopAbs_SOLID : - { - aRes = NoInternalVertices(TheS); - } - break; - case TopAbs_SHELL : - { - aRes = NoInternalVertices(TheS); - if(aRes) aRes = CorrectOrientation(TopoDS::Shell(TheS)); - } - break; - case TopAbs_FACE : - { - aRes = NoInternalVertices(TheS); - } - break; - case TopAbs_WIRE : - { - aRes = NoInternalVertices(TheS); - } - break; - case TopAbs_EDGE : - aRes = NoInternalVertices(TheS); - break; - case TopAbs_VERTEX : - aRes = Standard_True; - break; - case TopAbs_SHAPE : - default : - ; - } - - - return aRes; - -} - -static Standard_Boolean NoInternalVertices(const TopoDS_Shape& TheS) -{ - - TopAbs_Orientation anOrnt; - TopExp_Explorer anExp(TheS, TopAbs_VERTEX); - for(; anExp.More(); anExp.Next()) { - - anOrnt = anExp.Current().Orientation(); - - if(anOrnt == TopAbs_FORWARD) continue; - if(anOrnt == TopAbs_REVERSED) continue; - - return Standard_False; - - } - - return Standard_True; - -} - -static Standard_Boolean CorrectOrientation(const TopoDS_Shell& TheS) -{ - - TopoDS_Iterator anIter(TheS); - - if(!anIter.More()) return Standard_False; //Empty shell; - anIter.Next(); - if(!anIter.More()) return Standard_True; // only one face - - - TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFace; - TopExp::MapShapesAndAncestors(TheS, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFace); - - Standard_Integer i, nbEdgs = aMapEdgeFace.Extent(); - TopExp_Explorer anExp; - TopAbs_Orientation anOrnt = TopAbs_FORWARD; - - for(i = 1; i <= nbEdgs; i++) { - - const TopTools_ListOfShape& aL = aMapEdgeFace(i); - - if(aL.Extent() > 2) return Standard_False; - if(aL.Extent() == 1) continue; - - const TopoDS_Shape& anE = aMapEdgeFace.FindKey(i); - - anExp.Init(aL.First(), TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) { - if(anE.IsSame(anExp.Current())) { - anOrnt = anExp.Current().Orientation(); - break; - } - } - - anExp.Init(aL.Last(), TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) { - if(anE.IsSame(anExp.Current())) { - if(anOrnt == anExp.Current().Orientation()) return Standard_False; - break; - } - } - - } - - return Standard_True; - -} - -Standard_Boolean QANewModTopOpe::IsCompoundManifold(const TopoDS_Compound& TheS) -{ - Standard_Boolean aRes = Standard_True; - - TopExp_Explorer anExp; - - anExp.Init(TheS, TopAbs_COMPSOLID); - if(anExp.More()) { - - aRes = Standard_False; - return aRes; - - } - - TopTools_ListOfShape aList; - TopExp_Explorer anExp1; - TopTools_DataMapOfShapeInteger aMap; - Standard_Integer n = 0, connect; - - anExp.Init(TheS, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aRes = IsManifold(anExp.Current()); - if(!aRes) return aRes; - ++n; - anExp1.Init(anExp.Current(), TopAbs_FACE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_EDGE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - } - - anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aRes = IsManifold(anExp.Current()); - if(!aRes) return aRes; - ++n; - anExp1.Init(anExp.Current(), TopAbs_FACE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_EDGE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - } - - anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aRes = IsManifold(anExp.Current()); - if(!aRes) return aRes; - ++n; - - anExp1.Init(anExp.Current(), TopAbs_EDGE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - } - - anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE); - for(; anExp.More(); anExp.Next()) { - aRes = IsManifold(anExp.Current()); - if(!aRes) return aRes; - ++n; - - anExp1.Init(anExp.Current(), TopAbs_EDGE); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - - anExp1.Init(anExp.Current(), TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - } - - anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE); - for(; anExp.More(); anExp.Next()) { - aRes = IsManifold(anExp.Current()); - if(!aRes) return aRes; - ++n; - - anExp1.Init(anExp.Current(), TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - if(aMap.IsBound(anExp1.Current())) { - connect = aMap(anExp1.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp1.Current(), n); - } - } - } - - anExp.Init(TheS, TopAbs_VERTEX, TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) { - ++n; - - if(aMap.IsBound(anExp.Current())) { - connect = aMap(anExp.Current()); - if(n != connect) { - aRes = Standard_False; - return aRes; - } - } - else { - aMap.Bind(anExp.Current(), n); - } - } - - return aRes; -} - - -TopAbs_ShapeEnum QANewModTopOpe::TypeOfShape(const TopoDS_Shape& TheS) -{ - if(TheS.ShapeType() != TopAbs_COMPOUND) return TheS.ShapeType(); - - TopAbs_ShapeEnum aType = TopAbs_COMPOUND; - - TopoDS_Iterator anIter(TheS); - - if(!anIter.More()) return aType; - - aType = TypeOfShape(anIter.Value()); - - if(aType == TopAbs_COMPOUND) return aType; - - anIter.Next(); - - for(; anIter.More(); anIter.Next()) { - - if(TypeOfShape(anIter.Value()) != aType) return TopAbs_COMPOUND; - - } - - return aType; - -} - - -Standard_Boolean QANewModTopOpe::IsConnected(const TopoDS_Shape& TheS) -{ - cout << "QANewModTopOpe::IsConnected BEGIN" << endl; - Standard_Boolean aRes = Standard_True; - - if(TheS.IsNull()) return aRes; - - TopAbs_ShapeEnum aType = TheS.ShapeType(); - - if(aType != TopAbs_COMPOUND) return aRes; - - TopTools_ListOfShape aCompList; - TopTools_DataMapOfShapeInteger aMap; - TopTools_MapOfShape aSMap; - TopoDS_Iterator anTDIter; - TopExp_Explorer anExp; - - anTDIter.Initialize(TheS); - for(; anTDIter.More(); anTDIter.Next()) { - if(anTDIter.Value().ShapeType() == TopAbs_COMPOUND) aCompList.Append(anTDIter.Value()); - else aSMap.Add(anTDIter.Value()); - } - - TopTools_ListIteratorOfListOfShape anIter(aCompList); - for(;anIter.More(); anIter.Next()) { - anTDIter.Initialize(anIter.Value()); - for(; anTDIter.More(); anTDIter.Next()) { - if(anTDIter.Value().ShapeType() == TopAbs_COMPOUND) aCompList.Append(anTDIter.Value()); - else aSMap.Add(anTDIter.Value()); - } - } - //cout << "QANewModTopOpe::IsConnected(2)" << endl; - - - Standard_Integer nbs = aSMap.Extent(); - if(nbs <= 1) return aRes; - - math_Matrix aMat(1, nbs, 1, nbs, 0); - - TopTools_MapIteratorOfMapOfShape anMIter(aSMap); - Standard_Integer n = 1; - Standard_Integer connect; - const TopoDS_Shape& aFirstShape = anMIter.Key(); - - aMat(n,n) = 1; - - anExp.Init(aFirstShape, TopAbs_VERTEX); - for(; anExp.More(); anExp.Next()) { - aMap.Bind(anExp.Current(), n); - } - - anMIter.Next(); - - for(; anMIter.More(); anMIter.Next()) { - ++n; - aMat(n,n) = 1; - - const TopoDS_Shape& aShape = anMIter.Key(); - - anExp.Init(aShape, TopAbs_VERTEX); - for(; anExp.More(); anExp.Next()) { - if(aMap.IsBound(anExp.Current())) - { - connect = aMap(anExp.Current()); - aMat(n, connect) = 1; - aMat(connect, n) = 1; - } - else - { - aMap.Bind(anExp.Current(), n); - } - } - } - //cout << "QANewModTopOpe::IsConnected(3)Lnbs=" < 0) - { - aMat(1, n) = 1; - aMat(n, 1) = 1; - aNotChanged = Standard_False; - } - aRes = Standard_False; - } - } - if(aNotChanged) break; - if(aRes) break; - } - - cout << "QANewModTopOpe::IsConnected END: aRes="< -#include -#include - -#include -#include -class TopoDS_Shape; -class TopoDS_Compound; -class QANewModTopOpe_Tools; -class QANewModTopOpe_Limitation; -class QANewModTopOpe_Intersection; -class QANewModTopOpe_Glue; -class QANewModTopOpe_ReShaper; - - -//! QANewModTopOpe package provides classes for limitation, gluing -//! and removing "floating" shapes. -class QANewModTopOpe -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! to remove "floating" objects from compound. - //! "floating" objects are wires, edges, vertices that do not belong - //! solids, shells or faces. - //! to check if TheS is valid or not. - //! in difference with BRepCheck_Analizer, this method allows - //! some kind of non-manifold shapes - Standard_EXPORT static Standard_Boolean IsValid (const TopoDS_Shape& TheS, const Standard_Boolean GeomControls = Standard_True); - - //! to check if TheS is manifol or not. - //! manifold shape is valid SOLID, SHELL, WIRE, EDGE, VERTEX without internal - //! subshapes - faces, wires, edges and vertices that have INTERNAL orientation - //! For SHELL there are additional conditions: orientations of faces must - //! corresponds each other, each edge must be shared not more then two faces. - //! COMPSOLID is non manifold by default. - //! COMPOUND conciders to be manifold if: - //! 1) all shapes in compound are manifold (see above mentioned definitions) - //! 2) all shapes are fully disconnected - there are any shapes in compound that - //! share common subshapes. - Standard_EXPORT static Standard_Boolean IsManifold (const TopoDS_Shape& TheS); - - //! to check if TheS is manifol or not. - //! compound conciders to be manifold if: - //! 1) all shapes in compound are manifold (see comments for method IsManifold) - //! 2) all shapes are fully disconnected - there are any shapes in compound that - //! share common subshapes. - Standard_EXPORT static Standard_Boolean IsCompoundManifold (const TopoDS_Compound& TheS); - - //! to define if COMPOUND is homogeneous - //! (consists of shapes of the same type) and return this shape type. - //! If COMPOUND is mixed, method returns TopAbs_COMPOUND. - //! If TheS is single shape (not COMPOUND), method returns its type. - //! If COMPOUND contains nested compounds, it concideres to be homogeneous - //! if all compounds consist of shapes of the same type. - Standard_EXPORT static TopAbs_ShapeEnum TypeOfShape (const TopoDS_Shape& TheS); - - //! to check if all subshapes in TheS, when TheS is COMPOUND, COMPSOLID, SHELL or WIRE, - //! are linked through common faces, edges or vertices. - //! SOLID, FACE, EDGE, VERTEX concider to be connected by default. - Standard_EXPORT static Standard_Boolean IsConnected (const TopoDS_Shape& TheS); - - - - -protected: - - - - - -private: - - - - -friend class QANewModTopOpe_Tools; -friend class QANewModTopOpe_Limitation; -friend class QANewModTopOpe_Intersection; -friend class QANewModTopOpe_Glue; -friend class QANewModTopOpe_ReShaper; - -}; - - - - - - - -#endif // _QANewModTopOpe_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_CommonPtr.hxx b/src/QANewModTopOpe/QANewModTopOpe_CommonPtr.hxx deleted file mode 100644 index 4cd09e9639..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_CommonPtr.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Created on: 2001-05-03 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2001-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. - -#ifndef _QANewModTopOpe_CommonPtr_HeaderFile -#define _QANewModTopOpe_CommonPtr_HeaderFile - -class BRepAlgoAPI_Common; -typedef BRepAlgoAPI_Common* QANewModTopOpe_CommonPtr; - -#endif // _QANewModTopOpe_CommonPtr_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_CutPtr.hxx b/src/QANewModTopOpe/QANewModTopOpe_CutPtr.hxx deleted file mode 100644 index 4fbff5ac63..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_CutPtr.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Created on: 2001-05-03 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2001-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. - -#ifndef _QANewModTopOpe_CutPtr_HeaderFile -#define _QANewModTopOpe_CutPtr_HeaderFile - -class BRepAlgoAPI_Cut; -typedef BRepAlgoAPI_Cut* QANewModTopOpe_CutPtr; - -#endif // _QANewModTopOpe_CutPtr_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue.cxx deleted file mode 100644 index 32a6f17eb7..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue.cxx +++ /dev/null @@ -1,566 +0,0 @@ -// Created on: 2000-12-08 -// Created by: Michael SAZONOV -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static TopoDS_Shape RemoveCompounds(const TopoDS_Shape& TheS) -{ - - if(TheS.IsNull()) return TheS; - - TopAbs_ShapeEnum aType = TheS.ShapeType(); - - if(aType != TopAbs_COMPOUND) return TheS; - - TopTools_MapOfShape aMap; - TopoDS_Shape aResult; - - BRep_Builder aBld; - aBld.MakeCompound(TopoDS::Compound(aResult)); - Standard_Integer n = 0; - TopExp_Explorer anExp; - - anExp.Init(TheS, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - anExp.Init(TheS, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE); - for(; anExp.More(); anExp.Next()) { - n++; - if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current()); - } - - if(n == 1) { - TopoDS_Iterator anIter(aResult); - aResult = anIter.Value(); - } - - if(n == 0) aResult.Nullify(); - - return aResult; -} - - -//======================================================================= -//function : QANewModTopOpe_Glue -//purpose : -//======================================================================= -QANewModTopOpe_Glue::QANewModTopOpe_Glue(const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2, - const Standard_Boolean theAllowCutting, - const Standard_Boolean thePerformNow) -: BRepAlgoAPI_BooleanOperation (theS1,theS2, BOPAlgo_FUSE), - myCompleted (Standard_False), - myAllowCutting (theAllowCutting) -{ - NotDone(); - myGenerated.Clear(); - myMapModif.Clear(); - myMapGener.Clear(); - if (thePerformNow) - Build(); -} -//======================================================================= -//function : Build -//purpose : -//======================================================================= - -void QANewModTopOpe_Glue::Build() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - if (myCompleted) return; - - TopAbs_ShapeEnum aType1, aType2; - aType1 = myS1.ShapeType(); - aType2 = myS2.ShapeType(); - - TopoDS_Shape aCopyS1 = myS1; - TopoDS_Shape aCopyS2 = myS2; - TopoDS_Shape aResult; - - if(aType2 == TopAbs_VERTEX) { - - PerformVertex(); - - myCompleted = Standard_True; - return; - - } else if (aType1 == TopAbs_VERTEX) { - - myS2 = aCopyS1; - myS1 = aCopyS2; - - PerformVertex(); - - myCompleted = Standard_True; - myS1 = aCopyS1; - myS2 = aCopyS2; - return; - } - - Standard_Boolean aContains1 = Standard_False; - Standard_Boolean aContains2 = Standard_False; - - TopExp_Explorer anExp(myS1, TopAbs_FACE); - aContains1 = anExp.More(); - anExp.Init(myS2, TopAbs_FACE); - aContains2 = anExp.More(); - - if(aContains1 && aContains2) { - - if(myS1.ShapeType() == TopAbs_FACE) { - BRep_Builder aBld; - TopoDS_Shape aCmp; - aBld.MakeCompound(TopoDS::Compound(aCmp)); - aBld.Add(aCmp, myS1); - myS1 = aCmp; - } - if(myS2.ShapeType() == TopAbs_FACE) { - BRep_Builder aBld; - TopoDS_Shape aCmp; - aBld.MakeCompound(TopoDS::Compound(aCmp)); - aBld.Add(aCmp, myS2); - myS2 = aCmp; - } - - mySubst.Clear(); - PerformSDFaces(); - - if(!myShape.IsNull()) { - - TopoDS_Iterator anIter(myShape); - if(anIter.More()) { - myS1 = anIter.Value(); - anIter.Next(); - myS2 = anIter.Value(); - } - - aResult = myShape; - myShape.Nullify(); - - } - - mySubst.Clear(); - PerformShell(); - - if(!myShape.IsNull()) { - - TopoDS_Iterator anIter(myShape); - if(anIter.More()) { - myS1 = anIter.Value(); - anIter.Next(); - myS2 = anIter.Value(); - } - - aResult = myShape; - myShape.Nullify(); - - } - - } - - if(aContains1 || aContains2) { - BRep_Builder aBld; - TopoDS_Shape aS1, aS2; - TopoDS_Shape aCpS1 = myS1, aCpS2 = myS2; - aBld.MakeCompound(TopoDS::Compound(aS1)); - aBld.MakeCompound(TopoDS::Compound(aS2)); - - anExp.Init(myS1, TopAbs_WIRE, TopAbs_FACE); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS1, TopAbs_EDGE, TopAbs_WIRE); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS2, TopAbs_WIRE, TopAbs_FACE); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS2, anExp.Current()); - } - - anExp.Init(myS2, TopAbs_EDGE, TopAbs_WIRE); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS2, anExp.Current()); - } - - TopoDS_Iterator anIt1(aS1); - TopoDS_Iterator anIt2(aS2); - - Standard_Boolean aShellWire = Standard_False; - - if(anIt1.More() && anIt2.More()) { - aShellWire = Standard_True; - myS1 = aS1; - myS2 = aS2; - mySubst.Clear(); - - PerformWires(); - - myS1 = aCpS1; - myS2 = aCpS2; - - if(!myShape.IsNull()) { - aS2 = myShape; - aS1.Nullify(); - aBld.MakeCompound(TopoDS::Compound(aS1)); - } - else { - for(; anIt1.More(); anIt1.Next()) aBld.Add(aS2, anIt1.Value()); - aS1.Nullify(); - aBld.MakeCompound(TopoDS::Compound(aS1)); - } - } - else if(anIt1.More()) { - aShellWire = Standard_True; - aS2 = aS1; - aS1.Nullify(); - aBld.MakeCompound(TopoDS::Compound(aS1)); - } - else if(anIt2.More()) { - aShellWire = Standard_True; - } - - if(aShellWire) { - - if(aContains1) { - - anExp.Init(myS1, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS1, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS1, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS1, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - } - - if(aContains2) { - - anExp.Init(myS2, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS2, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS2, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - anExp.Init(myS2, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(aS1, anExp.Current()); - } - - } - - myS1 = aS1; - myS2 = aS2; - - mySubst.Clear(); - PerformShellWire(); - - if(!myShape.IsNull()) { - aResult = myShape; - } - - } - - } - - if(!aContains1 && !aContains2) { - - mySubst.Clear(); - PerformWires(); - - if(!myShape.IsNull()) { - aResult = myShape; - } - - } - - myS1 = aCopyS1; - myS2 = aCopyS2; - myShape = RemoveCompounds(aResult); - if(myShape.IsNull()) NotDone(); - myCompleted = Standard_True; -} - -//======================================================================= -//function : Generated -//purpose : -//======================================================================= - -const TopTools_ListOfShape& -QANewModTopOpe_Glue::Generated (const TopoDS_Shape& theS) -{ - if (IsDone() && (myMapGener.IsBound(theS) || myMapModif.IsBound(theS))) { - TopTools_ListIteratorOfListOfShape anItl; - if(myMapGener.IsBound(theS)) anItl.Initialize(myMapGener(theS)); - TopTools_ListIteratorOfListOfShape anItl1; - myGenerated.Clear(); - Standard_Boolean aNonEmpty = Standard_False; - TopTools_ListOfShape aL1, aL; - - for(; anItl.More(); anItl.Next()) aL.Append(anItl.Value()); - - TopTools_MapOfShape aMapModif; - anItl.Initialize(Modified(theS)); - for(; anItl.More(); anItl.Next()) aMapModif.Add(anItl.Value()); - myGenerated.Clear(); - - anItl.Initialize(myMapModif(theS)); - for(; anItl.More(); anItl.Next()) { - if(!aMapModif.Contains(anItl.Value())) { - aL.Append(anItl.Value()); - } - } - - do - { - - aNonEmpty = Standard_False; - anItl.Initialize(aL); - - for(; anItl.More(); anItl.Next()) { - - if(myMapGener.IsBound(anItl.Value())) { - aNonEmpty = Standard_True; - anItl1.Initialize(myMapGener(anItl.Value())); - for(; anItl1.More(); anItl1.Next()) { - if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value()); - } - } - else { - if(myMapModif.IsBound(anItl.Value())) { - aNonEmpty = Standard_True; - anItl1.Initialize(myMapModif(anItl.Value())); - for(; anItl1.More(); anItl1.Next()) { - if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value()); - } - } - else { - if(!aMapModif.Contains(anItl.Value())) myGenerated.Append(anItl.Value()); - } - } - - } - - if(!aL1.IsEmpty()) { - aL.Clear(); - aL.Append(aL1); - aL1.Clear(); - } - else aNonEmpty = Standard_False; - - } - while (aNonEmpty); - - return myGenerated; - - } - - - myGenerated.Clear(); - return myGenerated; -} - -//======================================================================= -//function : Modified -//purpose : -//======================================================================= - -const TopTools_ListOfShape& -QANewModTopOpe_Glue::Modified (const TopoDS_Shape& theS) -{ - if (IsDone() && myMapModif.IsBound(theS)) { - TopTools_ListIteratorOfListOfShape anItl(myMapModif(theS)); - TopTools_ListIteratorOfListOfShape anItl1; - myGenerated.Clear(); - Standard_Boolean aNonEmpty = Standard_False; - TopTools_ListOfShape aL1, aL; - for(; anItl.More(); anItl.Next()) aL.Append(anItl.Value()); - - myGenerated.Clear(); - - do - { - - aNonEmpty = Standard_False; - anItl.Initialize(aL); - - for(; anItl.More(); anItl.Next()) { - if(myMapModif.IsBound(anItl.Value())) { - aNonEmpty = Standard_True; - anItl1.Initialize(myMapModif(anItl.Value())); - for(; anItl1.More(); anItl1.Next()) { - if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value()); - } - } - else { - myGenerated.Append(anItl.Value()); - } - } - - if(!aL1.IsEmpty()) { - aL.Clear(); - aL.Append(aL1); - aL1.Clear(); - } - else aNonEmpty = Standard_False; - - } - while (aNonEmpty); - - return myGenerated; - - } - - myGenerated.Clear(); - return myGenerated; -} - -//======================================================================= -//function : IsDeleted -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::IsDeleted (const TopoDS_Shape& theS) -{ - if (IsDone() && myMapModif.IsBound(theS)) { - const TopTools_ListOfShape &aList = myMapModif.Find(theS); - - if (aList.IsEmpty()) - return Standard_True; - - TopTools_ListIteratorOfListOfShape anIter(aList); - - for (; anIter.More(); anIter.Next()) { - const TopoDS_Shape &aSplit = anIter.Value(); - - if (!IsDeleted(aSplit)) - return Standard_False; - } - - return Standard_True; - } - - return Standard_False; -} -//======================================================================= -//function : HasGenerated -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::HasGenerated () const -{ - if (IsDone() && myMapGener.Extent() > 0) - return Standard_True; - return Standard_False; -} -//======================================================================= -//function : HasModified -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::HasModified () const -{ - - if (IsDone() && myMapModif.Extent() > 0) { - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(myMapModif); - for(; anIter.More(); anIter.Next()) { - if(anIter.Value().Extent() > 0) return Standard_True; - } - } - return Standard_False; -} -//======================================================================= -//function : HasDeleted -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::HasDeleted () const -{ - if (IsDone() && myMapModif.Extent() > 0) { - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(myMapModif); - for(; anIter.More(); anIter.Next()) { - if(anIter.Value().Extent() == 0) return Standard_True; - } - } - return Standard_False; -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue.hxx b/src/QANewModTopOpe/QANewModTopOpe_Glue.hxx deleted file mode 100644 index aa7f8b308a..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue.hxx +++ /dev/null @@ -1,163 +0,0 @@ -// Created on: 2001-05-03 -// Created by: Michael SAZONOV -// Copyright (c) 2001-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. - -#ifndef _QANewModTopOpe_Glue_HeaderFile -#define _QANewModTopOpe_Glue_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -class TopoDS_Shape; -class TopoDS_Face; -class gp_Pnt; -class TopoDS_Edge; -class TopoDS_Vertex; - - -//! Perform the gluing topological operation -//! (topological sewing of two topological objects). -class QANewModTopOpe_Glue : public BRepAlgoAPI_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Defines 2 operands. - //! If one of operands is Solid and another is Shell and Shell - //! goes inside Solid, the determines what to do: - //! if True, Shell is cut by Solid during the operation; - //! if False, Null shape is returned, IsDone() returns False. - //! If is False then does not compute immediately. - Standard_EXPORT QANewModTopOpe_Glue(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const Standard_Boolean theAllowCutting = Standard_False, const Standard_Boolean thePerformNow = Standard_True); - - //! Computation; is usefull when Create was called with thePerformNow - //! being False - Standard_EXPORT void Build() Standard_OVERRIDE; - - //! Returns the list of shapes generated from the - //! shape . - Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE; - - //! Returns the list of shapes modified from the shape - //! . - Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE; - - //! Returns True if the shape existed in one of operands - //! and is absent in the result. - Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE; - - //! Returns True if there is at leat one generated shape - Standard_EXPORT virtual Standard_Boolean HasGenerated() const Standard_OVERRIDE; - - //! Returns True if there is at leat one modified shape - Standard_EXPORT virtual Standard_Boolean HasModified() const Standard_OVERRIDE; - - //! Returns True if there is at leat one deleted shape - Standard_EXPORT virtual Standard_Boolean HasDeleted() const Standard_OVERRIDE; - - Standard_EXPORT static Standard_Boolean ProjPointOnEdge (const gp_Pnt& thePnt, const TopoDS_Edge& theEdge, Standard_Real& thePar, Standard_Real& theDist); - - Standard_EXPORT static void InsertVertexInEdge (const TopoDS_Edge& theEdge, const TopoDS_Vertex& theVer, const Standard_Real thePar, TopoDS_Edge& theNewEdge); - - Standard_EXPORT static void SplitEdgeByVertex (const TopoDS_Edge& theEdge, const TopoDS_Vertex& theVer, const Standard_Real thePar, TopTools_ListOfShape& theListE); - - Standard_EXPORT static Standard_Boolean CompareVertices (const TopoDS_Vertex& theV1, const TopoDS_Vertex& theV2, Standard_Real& theDist); - - - - -protected: - - - - - -private: - - - //! Performs gluing Shell-Wire - Standard_EXPORT void PerformShellWire(); - - //! Performs gluing Solid-Vertex and Shell-Vertex - Standard_EXPORT void PerformVertex(); - - //! Performs gluing Solid-Shell and Shell-Shell - Standard_EXPORT void PerformShell(); - - //! Performs gluing Wire-Wire - Standard_EXPORT void PerformWires(); - - //! This function performs gluing operation of same domain - //! faces theFirstSDFace and theSecondSDFace on shapes - //! theNewSolid1 and theNewSolid2 and returns them. - //! theMapOfChangedFaces contains changed faces as keys and - //! lists of their splits as items. - Standard_EXPORT Standard_Boolean SubstitudeSDFaces (const TopoDS_Shape& theFirstSDFace, const TopoDS_Shape& theSecondSDFace, TopoDS_Shape& theNewSolid1, TopoDS_Shape& theNewSolid2, TopTools_DataMapOfShapeListOfShape& theMapOfChangedFaces); - - //! Performs gluing between same domain faces of object and tool - Standard_EXPORT void PerformSDFaces(); - - //! For the case Solid-Shell, is from Shell. - //! Splits onto faces by section edges and - //! add for substitution by list of faces which are "out" - //! of Solid - Standard_EXPORT Standard_Boolean CutFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE); - - //! For the case Solid-Shell, is a split of Shell's face. - //! Returns the state of relatively Solid. - Standard_EXPORT TopAbs_State ClassifyFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE) const; - - //! Inserts "internal" elements (wires, edges, vertices) computed - //! from a list of section edges into . - Standard_EXPORT void SectionInsideFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE, const Standard_Integer theShapeNum, const TopTools_MapOfShape& theGenEdges); - - Standard_EXPORT static const TopoDS_Shape& FindWireOrUpdateMap (const TopoDS_Shape& theWire, TopTools_IndexedDataMapOfShapeListOfShape& theMapELW); - - - Standard_Boolean myCompleted; - Standard_Boolean myAllowCutting; - BRepTools_Substitution mySubst; - TopTools_DataMapOfShapeListOfShape myMapSEdgeFaces1; - TopTools_DataMapOfShapeListOfShape myMapSEdgeFaces2; - TopTools_DataMapOfShapeShape myMapSEdgeCrossFace1; - TopTools_DataMapOfShapeShape myMapSEdgeCrossFace2; - TopTools_IndexedDataMapOfShapeListOfShape myMapEdgeWires; - TopTools_MapOfShape myEdgesToLeave; - TopTools_DataMapOfShapeListOfShape myMapModif; - TopTools_DataMapOfShapeListOfShape myMapGener; - - -}; - - - - - - - -#endif // _QANewModTopOpe_Glue_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx deleted file mode 100644 index 44917a090b..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx +++ /dev/null @@ -1,615 +0,0 @@ -// Created on: 2001-05-05 -// Created by: Sergey KHROMOV -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static Standard_Boolean isAnalitic(const TopoDS_Shape &theShape) -{ - if (theShape.ShapeType() != TopAbs_FACE) - return Standard_False; - - TopoDS_Face aFace = TopoDS::Face(theShape); - BRepAdaptor_Surface aSurf(aFace); - Standard_Boolean isAna = Standard_False; - - switch (aSurf.GetType()) { - case GeomAbs_Plane : - case GeomAbs_Cylinder : - case GeomAbs_Cone : - case GeomAbs_Sphere : - case GeomAbs_Torus : - isAna = Standard_True; - break; - default: - isAna = Standard_False; - } - - return isAna; -} - -static void DoPCurveOnF(const TopoDS_Edge &theEdge, const TopoDS_Face &theFace) -{ - BRep_Builder aBuilder; - TopLoc_Location aCLoc; - TopLoc_Location aSLoc; - Standard_Real aF; - Standard_Real aL; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aCLoc, aF, aL); - Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, aF, aL); - Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace, aSLoc); - TopLoc_Location aCTLoc = aSLoc.Inverted().Multiplied(aCLoc); - - aTrCurve->Transform(aCTLoc.Transformation()); - - Handle(Geom2d_Curve) aCurve2d = GeomProjLib::Curve2d (aTrCurve, aSurface); - - aBuilder.UpdateEdge(theEdge, aCurve2d, aSurface, - aSLoc, Precision::Confusion()); -} - -static TopoDS_Face GetAdjacentFace - (const TopoDS_Shape &theEdge, - const TopoDS_Shape &theFace, - const TopTools_IndexedDataMapOfShapeListOfShape &theAncMap) -{ - TopoDS_Face aFace; - - if (theAncMap.Contains(theEdge)) { - const TopTools_ListOfShape &aLOfFaces = - theAncMap.FindFromKey(theEdge); - TopTools_ListIteratorOfListOfShape anIter(aLOfFaces); - - for (; anIter.More(); anIter.Next()) { - const TopoDS_Shape &aLocalFace = anIter.Value(); - - if (!theFace.IsSame(aLocalFace)) { - aFace = TopoDS::Face(aLocalFace); - break; - } - } - } - - return aFace; -} - -//======================================================================= -//function : SubstitudeSDFaces -//purpose : -//======================================================================= - -Standard_Boolean QANewModTopOpe_Glue::SubstitudeSDFaces - (const TopoDS_Shape &theFirstSDFace, - const TopoDS_Shape &theSecondSDFace, - TopoDS_Shape &theNewSolid1, - TopoDS_Shape &theNewSolid2, - TopTools_DataMapOfShapeListOfShape &theMapOfChangedFaces) -{ -// If the first face is already splited, we use its splits -// to recursively call this function. - if (theMapOfChangedFaces.IsBound(theFirstSDFace)) { - const TopTools_ListOfShape &aLocalList = - theMapOfChangedFaces(theFirstSDFace); - TopTools_ListIteratorOfListOfShape anIter(aLocalList); - - for (;anIter.More(); anIter.Next()) { - const TopoDS_Shape &aNewShape = anIter.Value(); - if (!SubstitudeSDFaces(aNewShape, theSecondSDFace, - theNewSolid1, theNewSolid2, - theMapOfChangedFaces)) - return Standard_False; - } - return Standard_True; - } - -// If the second face is already splited, we use its splits -// to recursively call this function. - if (theMapOfChangedFaces.IsBound(theSecondSDFace)) { - const TopTools_ListOfShape &aLocalList = - theMapOfChangedFaces(theSecondSDFace); - TopTools_ListIteratorOfListOfShape anIter(aLocalList); - - for (;anIter.More(); anIter.Next()) { - const TopoDS_Shape &aNewShape = anIter.Value(); - if (!SubstitudeSDFaces(theFirstSDFace, aNewShape, - theNewSolid1, theNewSolid2, - theMapOfChangedFaces)) - return Standard_False; - } - return Standard_True; - } - - -// If neither the first face nor the second one were -// splited before, we begin calculation: - TopTools_IndexedDataMapOfShapeListOfShape aHistory; - Standard_Boolean isCommonFound; - - if (!QANewModTopOpe_Tools::BoolOpe(theFirstSDFace.Oriented(TopAbs_FORWARD), - theSecondSDFace.Oriented(TopAbs_FORWARD), - isCommonFound, aHistory)) - return Standard_False; - - if (!isCommonFound) - return Standard_True; - - TopTools_IndexedDataMapOfShapeListOfShape anAncMap1; - TopTools_IndexedDataMapOfShapeListOfShape anAncMap2; - - TopExp::MapShapesAndAncestors(theNewSolid1, TopAbs_EDGE, - TopAbs_FACE, anAncMap1); - TopExp::MapShapesAndAncestors(theNewSolid2, TopAbs_EDGE, - TopAbs_FACE, anAncMap2); - -// Creation of a compound of old solids. -// The substitution operation will be built with this -// compound. - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - - aBuilder.MakeCompound(aCompound); - aBuilder.Add(aCompound, theNewSolid1); - aBuilder.Add(aCompound, theNewSolid2); - -// Substitution of updated sub-shapes of the first solid. - BRepTools_Substitution aSubstTool; - Standard_Integer aNbModifShape = aHistory.Extent(); - Standard_Integer i; - - for (i = 1; i <= aNbModifShape; i++) { - TopTools_ListOfShape aModifShapes; - const TopoDS_Shape &anAncestor = aHistory.FindKey(i); - TopTools_ListIteratorOfListOfShape anIter(aHistory.FindFromIndex(i)); - - if (anAncestor.IsSame(theSecondSDFace)) { - for (; anIter.More(); anIter.Next()) - aModifShapes.Append(anIter.Value()); - } else { - for (; anIter.More(); anIter.Next()) - aModifShapes.Append(anIter.Value().Oriented(TopAbs_FORWARD)); - } - - if (anAncestor.ShapeType() == TopAbs_EDGE) { -// Check if the edges from common contain pcurves on both shapes. -// If they do not, create them. - TopoDS_Edge anAncEdge = TopoDS::Edge(anAncestor); - - if (anAncMap1.Contains(anAncestor)) { - TopoDS_Face aFace = GetAdjacentFace(anAncestor, theFirstSDFace, - anAncMap1); - if(!aFace.IsNull()) {//added to fix 4086 - Standard_Real aFirst; - Standard_Real aLast; - - anIter.Initialize(aHistory.FindFromIndex(i)); - for (; anIter.More(); anIter.Next()) { - TopoDS_Edge aSplit = TopoDS::Edge(anIter.Value()); - Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface - (aSplit, aFace, aFirst, aLast); - - if (aPCurve.IsNull()) - DoPCurveOnF(aSplit, aFace); - } - } - } - - if (anAncMap2.Contains(anAncestor)) { - TopoDS_Face aFace = GetAdjacentFace(anAncestor, theSecondSDFace, - anAncMap2); - if(!aFace.IsNull()) {//added to fix 4086 - Standard_Real aFirst; - Standard_Real aLast; - - anIter.Initialize(aHistory.FindFromIndex(i)); - for (; anIter.More(); anIter.Next()) { - TopoDS_Edge aSplit = TopoDS::Edge(anIter.Value()); - Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface - (aSplit, aFace, aFirst, aLast); - - if (aPCurve.IsNull()) - DoPCurveOnF(aSplit, aFace); - } - } - } - } - -//-------------------------------------------------------------- - if (!myMapModif.IsBound(anAncestor)) - myMapModif.Bind(anAncestor, aModifShapes); -//-------------------------------------------------------------- - - aSubstTool.Substitute(anAncestor, aModifShapes); - } - - aSubstTool.Build(aCompound); - -// Update the map theMapOfChangedFaces and -// obtain a new solid from the first one. - if (aSubstTool.IsCopied(theNewSolid1)) { - // Add changed faces of the first solid to theMapOfChangedFaces: - TopExp_Explorer anExp(theNewSolid1, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - // For each face from solid - const TopoDS_Shape &aFace = anExp.Current(); - - if (aSubstTool.IsCopied(aFace)) { - const TopTools_ListOfShape &aList = aSubstTool.Copy(aFace); - - TopTools_ListOfShape aNewList; - if (!theMapOfChangedFaces.IsBound(aFace)) - theMapOfChangedFaces.Bind(aFace, aNewList); - - TopTools_ListIteratorOfListOfShape anIter(aList); - for (; anIter.More(); anIter.Next()) { - TopoDS_Shape aLocalFace = anIter.Value(); - - if (aSubstTool.IsCopied(aLocalFace)) - aLocalFace = aSubstTool.Copy(aLocalFace).First(); - - theMapOfChangedFaces(aFace).Append(aLocalFace); - } - } - } - // Obtain a new solid. - theNewSolid1 = aSubstTool.Copy(theNewSolid1).First(); - } - -// Update the map theMapOfChangedFaces and -// obtain a new solid from the second one. - if (aSubstTool.IsCopied(theNewSolid2)) { - // Add changed faces of the second solid to theMapOfChangedFaces: - TopExp_Explorer anExp(theNewSolid2, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - // For each face from solid - const TopoDS_Shape &aFace = anExp.Current(); - - if (aSubstTool.IsCopied(aFace)) { - const TopTools_ListOfShape &aList = aSubstTool.Copy(aFace); - - TopTools_ListOfShape aNewList; - if (!theMapOfChangedFaces.IsBound(aFace)) - theMapOfChangedFaces.Bind(aFace, aNewList); - - TopTools_ListIteratorOfListOfShape anIter(aList); - for (; anIter.More(); anIter.Next()) { - TopoDS_Shape aLocalFace = anIter.Value(); - - if (aSubstTool.IsCopied(aLocalFace)) - aLocalFace = aSubstTool.Copy(aLocalFace).First(); - - theMapOfChangedFaces(aFace).Append(aLocalFace); - } - } - } - // Obtain a new solid. - theNewSolid2 = aSubstTool.Copy(theNewSolid2).First(); - } - - return Standard_True; -} - -//======================================================================= -//function : PerformSolidSolid -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::PerformSDFaces() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - TopExp_Explorer anExp; - TopoDS_Shape aS1, aS2; - Standard_Boolean aWire1 = Standard_False, aWire2 = Standard_False; - anExp.Init(myS1, TopAbs_WIRE, TopAbs_FACE); - if(anExp.More()) { - aS1 = myS1; - aWire1 = Standard_True; - } - else { - anExp.Init(myS1, TopAbs_EDGE, TopAbs_WIRE); - if(anExp.More()) { - aS1 = myS1; - aWire1 = Standard_True; - } - } - - anExp.Init(myS2, TopAbs_WIRE, TopAbs_FACE); - if(anExp.More()) { - aS2 = myS2; - aWire2 = Standard_True; - } - else { - anExp.Init(myS2, TopAbs_EDGE, TopAbs_WIRE); - if(anExp.More()) { - aS2 = myS2; - aWire2 = Standard_True; - } - } - - if(aWire1) { - BRep_Builder aBld; - myS1.Nullify(); - aBld.MakeCompound(TopoDS::Compound(myS1)); - anExp.Init(aS1, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - } - - if(aWire2) { - BRep_Builder aBld; - myS2.Nullify(); - aBld.MakeCompound(TopoDS::Compound(myS2)); - anExp.Init(aS2, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - } - - BRepAlgoAPI_BooleanOperation::Build(); - if (!BuilderCanWork()) - return; - - if(aWire1) myS1 = aS1; - if(aWire2) myS2 = aS2; - - myShape.Nullify(); - - TopoDS_Shape aNewShape1 = myS1; - TopoDS_Shape aNewShape2 = myS2; - TopTools_DataMapOfShapeListOfShape theMapOfChangedFaces; - - Standard_Boolean aHasSDF = Standard_False; - anExp.Init(myS1, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - TopoDS_Shape aFirstFace = anExp.Current(); - - if (!isAnalitic(aFirstFace)) - continue; - - if (QANewModTopOpe_Tools::HasSameDomain(myBuilder, aFirstFace)) { - - if(!aHasSDF) aHasSDF = Standard_True; - - TopTools_ListOfShape aLOfSDFace; - TopTools_ListIteratorOfListOfShape anIter; - - QANewModTopOpe_Tools::SameDomain(myBuilder, aFirstFace, aLOfSDFace); - anIter.Initialize(aLOfSDFace); - - for(; anIter.More(); anIter.Next()) { - TopoDS_Shape aSecondFace = anIter.Value(); - - if (!isAnalitic(aSecondFace)) - continue; - - if (!SubstitudeSDFaces(aFirstFace, aSecondFace, - aNewShape1, aNewShape2, - theMapOfChangedFaces)) - return; - } - } - } - - if(myS1.IsSame(aNewShape1) && myS2.IsSame(aNewShape2)) return; - - if(aHasSDF) { - BRep_Builder aBuilder; - -// aBuilder.MakeCompSolid(TopoDS::CompSolid(myShape)); - aBuilder.MakeCompound(TopoDS::Compound(myShape)); - - aBuilder.Add(myShape, aNewShape1); - aBuilder.Add(myShape, aNewShape2); - - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(theMapOfChangedFaces); - for(; anIter.More(); anIter.Next()) { - myMapModif.Bind(anIter.Key(), anIter.Value()); - } - - //--------------- creation myMapGener for common faces - - TopExp_Explorer anExp1, anExp2; - TopTools_MapOfShape aM; - anExp1.Init(aNewShape1, TopAbs_FACE); - for(; anExp1.More(); anExp1.Next()) { - const TopoDS_Shape& aF1 = anExp1.Current(); - anExp2.Init(aNewShape2, TopAbs_FACE); - for(; anExp2.More(); anExp2.Next()) { - const TopoDS_Shape& aF2 = anExp2.Current(); - if(aF1.IsSame(aF2)) { - aM.Add(aF1); - } - } - } - - anIter.Initialize(myMapModif); - TopTools_ListIteratorOfListOfShape anI1; - TopTools_MapIteratorOfMapOfShape anI2; - for(; anIter.More(); anIter.Next()) { - const TopoDS_Shape& aS = anIter.Key(); - if(aS.ShapeType() == TopAbs_FACE) { - anI1.Initialize(anIter.Value()); - for(; anI1.More(); anI1.Next()) { - const TopoDS_Shape& aSS1 = anI1.Value(); - anI2.Initialize(aM); - for(; anI2.More(); anI2.Next()) { - const TopoDS_Shape& aSS2 = anI2.Key(); - if(aSS1.IsSame(aSS2)) { - if(!myMapGener.IsBound(aS)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aS, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - myMapGener.Bind(aS, aListOfShape1); - } - myMapGener(aS).Append(aSS1); - myMapModif(aS).Remove(anI1); - } - } - if(!anI1.More()) break; - } - } - -// if(anIter.Value().Extent() == 0) myMapModif.UnBind(aS); - - } - - //--------------- creation myMapGener for common edges - - aM.Clear(); - anExp1.Init(aNewShape1, TopAbs_EDGE); - for(; anExp1.More(); anExp1.Next()) { - const TopoDS_Shape& anE1 = anExp1.Current(); - if(aM.Contains(anE1)) continue; - anExp2.Init(aNewShape2, TopAbs_EDGE); - for(; anExp2.More(); anExp2.Next()) { - const TopoDS_Shape& anE2 = anExp2.Current(); - if(aM.Contains(anE2)) continue; - if(anE1.IsSame(anE2)) { - aM.Add(anE1); - } - } - } - - TopTools_MapOfShape aComVerMap; - TopTools_MapOfShape aLocVerMap; - - anExp1.Init(myS1, TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) aComVerMap.Add(anExp1.Current()); - anExp1.Init(myS2, TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) aComVerMap.Add(anExp1.Current()); - - TopTools_ListOfShape aShapesToRemove; // record items to be removed from the map (should be done after iteration) - anIter.Initialize(myMapModif); - for(; anIter.More(); anIter.Next()) { - const TopoDS_Shape& aS = anIter.Key(); - if(aS.ShapeType() == TopAbs_EDGE) { - aLocVerMap.Clear(); - anI1.Initialize(anIter.Value()); - for(; anI1.More(); anI1.Next()) { - const TopoDS_Shape& aSS1 = anI1.Value(); - anI2.Initialize(aM); - for(; anI2.More(); anI2.Next()) { - const TopoDS_Shape& aSS2 = anI2.Key(); - if(aSS1.IsSame(aSS2)) { - if(!aS.IsSame(aSS1)) { - if(!myMapGener.IsBound(aS)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aS, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - myMapGener.Bind(aS, aListOfShape2); - } - myMapGener(aS).Append(aSS1); - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(TopoDS::Edge(aSS1), aV1, aV2); - if(!aComVerMap.Contains(aV1)) { - if(aLocVerMap.Add(aV1)) { - myMapGener(aS).Append(aV1); - } - } - if(!aComVerMap.Contains(aV2)) { - if(aLocVerMap.Add(aV2)) { - myMapGener(aS).Append(aV2); - } - } - myMapModif(aS).Remove(anI1); - } - else { - aShapesToRemove.Append (aS); - } - } - } - if(!anI1.More()) break; - } - } - } - - // remove items from the data map - for(TopTools_ListIteratorOfListOfShape anIt(aShapesToRemove); anIt.More(); anIt.Next()) - myMapModif.UnBind(anIt.Value()); - - // Deleted vertices - anExp1.Init(myShape, TopAbs_VERTEX); - for(; anExp1.More(); anExp1.Next()) { - const TopoDS_Shape& aV = anExp1.Current(); - aComVerMap.Remove(aV); - } - - anI2.Initialize(aComVerMap); - for(; anI2.More(); anI2.Next()) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(anI2.Key(), TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - myMapModif.Bind(anI2.Key(), aListOfShape3); - } - - Done(); - } - - return; - -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue_shell.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue_shell.cxx deleted file mode 100644 index e2fd4e1e76..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue_shell.cxx +++ /dev/null @@ -1,1509 +0,0 @@ -// Created on: 2001-01-16 -// Created by: Michael SAZONOV -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : SplitEdgeComplete -//purpose : static -//======================================================================= -static void -SplitEdgeComplete (const TopoDS_Edge& theEdge, - TopTools_ListOfShape& theListSplits) -{ - struct ParVer { - Standard_Real myParF, myParL; - TopoDS_Vertex myVerF, myVerL; - }; - ParVer *aParVer = new ParVer[theListSplits.Extent()+1]; - TopTools_DataMapOfShapeInteger aMapEdgeIPV; - TopTools_ListOfShape aListTodo; - aListTodo = theListSplits; - - // prepare structures aMapEdgeIPV and aParVer - - aListTodo.Prepend(theEdge); - TopTools_ListIteratorOfListOfShape aIter(aListTodo); - Standard_Integer iPV; - for (iPV=0; aIter.More(); aIter.Next(), iPV++) { - const TopoDS_Edge& aEdge = TopoDS::Edge(aIter.Value()); - TopoDS_Vertex aVer1, aVer2; - Standard_Real aPar1, aPar2; - - // compute parameters of first and last vertices of aEdge on theEdge - - TopExp::Vertices(aEdge, aVer1, aVer2); - - if(aVer1.IsNull() || aVer2.IsNull()) { - aListTodo.Remove(aIter); - TopTools_ListIteratorOfListOfShape aIter1(theListSplits); - for (; aIter1.More(); aIter1.Next()) { - if(aEdge.IsSame(aIter1.Value())) { - theListSplits.Remove(aIter1); - break; - } - } - if(aIter.More()) continue; - break; - } - - if (iPV == 0) { - // the vertices of theEdge - aPar1 = BRep_Tool::Parameter(aVer1, theEdge); - aPar2 = BRep_Tool::Parameter(aVer2, theEdge); - } - else { - Standard_Real aDist; - // the vertices of an edge from the source list - if (!QANewModTopOpe_Glue::ProjPointOnEdge (BRep_Tool::Pnt(aVer1), - theEdge, aPar1, aDist)) { - // the vertex is out of theEdge => take one from theEdge - Standard_Real aPar; - if (QANewModTopOpe_Glue::ProjPointOnEdge (BRep_Tool::Pnt(aParVer[0].myVerF), - aEdge, aPar, aDist)) { - aVer1 = aParVer[0].myVerF; - aPar1 = aParVer[0].myParF; - } - else { - aVer1 = aParVer[0].myVerL; - aPar1 = aParVer[0].myParL; - } - } - if (!QANewModTopOpe_Glue::ProjPointOnEdge (BRep_Tool::Pnt(aVer2), - theEdge, aPar2, aDist)) { - // the vertex is out of theEdge => take one from theEdge - Standard_Real aPar; - if (QANewModTopOpe_Glue::ProjPointOnEdge (BRep_Tool::Pnt(aParVer[0].myVerL), - aEdge, aPar, aDist)) { - aVer2 = aParVer[0].myVerL; - aPar2 = aParVer[0].myParL; - } - else { - aVer2 = aParVer[0].myVerF; - aPar2 = aParVer[0].myParF; - } - } - } - if (aPar1 < aPar2) { - aParVer[iPV].myParF = aPar1; aParVer[iPV].myVerF = aVer1; - aParVer[iPV].myParL = aPar2; aParVer[iPV].myVerL = aVer2; - } - else { - aParVer[iPV].myParF = aPar2; aParVer[iPV].myVerF = aVer2; - aParVer[iPV].myParL = aPar1; aParVer[iPV].myVerL = aVer1; - if(iPV != 0) { - TopTools_ListIteratorOfListOfShape aIterSplits(theListSplits); - for(; aIterSplits.More(); aIterSplits.Next()) { - if(aEdge.IsSame(aIterSplits.Value())) { - aIterSplits.Value().Reverse(); - } - } - } - } - aMapEdgeIPV.Bind(aEdge,iPV); - } - aListTodo.RemoveFirst(); - - // find holes and make new edges - - BRep_Builder aBld; - Standard_Integer iPVLast = 0; - iPV = -1; - while (iPV != 0) { - - // find the most left edge - iPV = 0; - TopTools_ListIteratorOfListOfShape aIterFound; - Standard_Real aParF = aParVer[0].myParL; - TopoDS_Vertex aVerF = aParVer[0].myVerL; - for (aIter.Initialize(aListTodo); aIter.More(); aIter.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge(aIter.Value()); - Standard_Integer i = aMapEdgeIPV(aEdge); - if (aParVer[i].myParF < aParF) { - aParF = aParVer[i].myParF; - aVerF = aParVer[i].myVerF; - iPV = i; - aIterFound = aIter; - } - } - - // get previous last parameter - Standard_Real aParPrevL; - TopoDS_Vertex aVerPrevL; - if (iPVLast == 0) { - aParPrevL = aParVer[0].myParF; - aVerPrevL = aParVer[0].myVerF; - } - else { - aParPrevL = aParVer[iPVLast].myParL; - aVerPrevL = aParVer[iPVLast].myVerL; - } - - if (aParF > aParPrevL && !BRepTools::Compare(aVerF, aVerPrevL)) { - // make new edge to close the hole - TopoDS_Edge aNewEdge = theEdge; - aNewEdge.EmptyCopy(); - aNewEdge.Orientation(TopAbs_FORWARD); - TopoDS_Vertex aV1 = aVerPrevL; - TopoDS_Vertex aV2 = aVerF; - aV1.Orientation(TopAbs_FORWARD); - aV2.Orientation(TopAbs_REVERSED); - aBld.Add(aNewEdge, aV1); - aBld.Add(aNewEdge, aV2); - aBld.UpdateVertex(aV1, aParPrevL, aNewEdge, BRep_Tool::Tolerance(aV1)); - aBld.UpdateVertex(aV2, aParF, aNewEdge, BRep_Tool::Tolerance(aV2)); - theListSplits.Append(aNewEdge); - } - - iPVLast = iPV; - if (aIterFound.More()) aListTodo.Remove(aIterFound); - } - - delete [] aParVer; -} - -//======================================================================= -//function : SplitEdge -//purpose : static -//======================================================================= - -static void -SplitEdge (const TopoDS_Edge &theEdge, - const BOPAlgo_PPaveFiller &thePDSFiller, - const TopTools_MapOfShape &theEdgesValid, - const Standard_Boolean useMap, - TopTools_ListOfShape &theListSplits) -{ - const TopAbs_State aStates[3] = {TopAbs_ON, TopAbs_IN, TopAbs_OUT}; - - for (Standard_Integer i=0; i < 3; i++) { // for each state {ON, IN, OUT} - if (QANewModTopOpe_Tools::IsSplit(thePDSFiller, theEdge, aStates[i])) { - // get splits according to this state - // and append them to the substitution list - TopTools_ListOfShape aListSplits; - - QANewModTopOpe_Tools::Splits(thePDSFiller, theEdge, aStates[i], aListSplits); - TopTools_ListIteratorOfListOfShape aIterSplits(aListSplits); - for(; aIterSplits.More(); aIterSplits.Next()) { - const TopoDS_Shape& aEdge = aIterSplits.Value(); - if (!useMap || theEdgesValid.Contains (aEdge)) - theListSplits.Append(aEdge.Oriented(TopAbs_FORWARD)); - } - } - } - - if (!theListSplits.IsEmpty()) { - SplitEdgeComplete (theEdge, theListSplits); - } -} - -//======================================================================= -//function : IsEdgeOut -//purpose : static -//remark : the edge is expected to have a pcurve on this face -//======================================================================= - -static Standard_Boolean -IsEdgeOut (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace) -{ - Standard_Real aParF, aParL, aParM; - Handle(Geom2d_Curve) aCrv = BRep_Tool::CurveOnSurface(theEdge, theFace, aParF, aParL); - if (aCrv.IsNull()) return Standard_True; - - Standard_Real aPrec = Precision::PConfusion(); - BRepClass_FaceClassifier aClf; - gp_Pnt2d aPnt; - - if (!Precision::IsNegativeInfinite(aParF)) { - //check first point - aPnt = aCrv->Value(aParF); - aClf.Perform(theFace, aPnt, aPrec); - if(aClf.State() == TopAbs_OUT) return Standard_True; - } - - if (!Precision::IsPositiveInfinite(aParL)) { - //check last point - aPnt = aCrv->Value(aParL); - aClf.Perform(theFace, aPnt, aPrec); - if(aClf.State() == TopAbs_OUT) return Standard_True; - } - - //check middle point - if (!Precision::IsNegativeInfinite(aParF) && - !Precision::IsPositiveInfinite(aParL)) { - aParM = aParF + 0.618 * (aParL - aParF); - } - else { - if (Precision::IsNegativeInfinite(aParF) && - Precision::IsPositiveInfinite(aParL)) - aParM = 0.; - else if (Precision::IsNegativeInfinite(aParF)) - aParM = aParL - 1.; - else - aParM = aParF + 1.; - } - aPnt = aCrv->Value(aParM); - aClf.Perform(theFace, aPnt, aPrec); - if(aClf.State() == TopAbs_OUT) return Standard_True; - - return Standard_False; -} - -//======================================================================= -//function : CorrectAncestorsList -//purpose : static -//======================================================================= - -static void -CorrectAncestorsList (const TopoDS_Edge& theEdge, TopTools_ListOfShape& aListF) -{ - // remove duplicates from list, - // remove faces for which theEdge has the state "OUT" - - // get a middle point on edge - TopTools_MapOfShape aMapF; - TopTools_ListIteratorOfListOfShape aIter(aListF); - while (aIter.More()) { - const TopoDS_Face& aFace = TopoDS::Face(aIter.Value()); - if (!aMapF.Add(aFace)) { - // duplicate -> remove - aListF.Remove(aIter); - continue; - } - if (IsEdgeOut(theEdge, aFace)) { - // this face is not an ancestor -> remove - aListF.Remove(aIter); - continue; - } - aIter.Next(); - } -} - -//======================================================================= -//function : PerformShell -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::PerformShell() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - Standard_Boolean isSolidShell = Standard_False; - Standard_Integer i; - - TopTools_MapOfShape anEdges, aCommonEdges, anOldVertices, aGenEdges; - TopExp_Explorer anExp; - - anExp.Init(myS1, TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) anEdges.Add(anExp.Current()); - - anExp.Init(myS2, TopAbs_EDGE); - for(; anExp.More(); anExp.Next()) { - if(anEdges.Contains(anExp.Current())) aCommonEdges.Add(anExp.Current()); - } - - anExp.ReInit(); - for(; anExp.More(); anExp.Next()) anEdges.Add(anExp.Current()); - - anExp.Init(myS1, TopAbs_VERTEX); - for(; anExp.More(); anExp.Next()) anOldVertices.Add(anExp.Current()); - - anExp.Init(myS2, TopAbs_VERTEX); - for(; anExp.More(); anExp.Next()) anOldVertices.Add(anExp.Current()); - - - // initialization - TopoDS_Shape aS1, aS2; - Standard_Boolean aWire1 = Standard_False, aWire2 = Standard_False; - anExp.Init(myS1, TopAbs_WIRE, TopAbs_FACE); - if(anExp.More()) { - aS1 = myS1; - aWire1 = Standard_True; - } - else { - anExp.Init(myS1, TopAbs_EDGE, TopAbs_WIRE); - if(anExp.More()) { - aS1 = myS1; - aWire1 = Standard_True; - } - } - - anExp.Init(myS2, TopAbs_WIRE, TopAbs_FACE); - if(anExp.More()) { - aS2 = myS2; - aWire2 = Standard_True; - } - else { - anExp.Init(myS2, TopAbs_EDGE, TopAbs_WIRE); - if(anExp.More()) { - aS2 = myS2; - aWire2 = Standard_True; - } - } - - if(aWire1) { - BRep_Builder aBld; - myS1.Nullify(); - aBld.MakeCompound(TopoDS::Compound(myS1)); - anExp.Init(aS1, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - anExp.Init(aS1, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS1, anExp.Current()); - } - - } - - if(aWire2) { - BRep_Builder aBld; - myS2.Nullify(); - aBld.MakeCompound(TopoDS::Compound(myS2)); - anExp.Init(aS2, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_SOLID, TopAbs_COMPSOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_SHELL, TopAbs_SOLID); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - anExp.Init(aS2, TopAbs_FACE, TopAbs_SHELL); - for(; anExp.More(); anExp.Next()) { - aBld.Add(myS2, anExp.Current()); - } - - } - - Standard_Boolean hasSolid1 = Standard_False; - Standard_Boolean hasSolid2 = Standard_False; - - anExp.Init(myS1, TopAbs_SOLID); - - if (anExp.More()) - hasSolid1 = Standard_True; - - anExp.Init(myS2, TopAbs_SOLID); - - if (anExp.More()) - hasSolid2 = Standard_True; - - if (hasSolid1 && hasSolid2) - myOperation = BOPAlgo_FUSE; - else if (hasSolid1) - myOperation = BOPAlgo_CUT21; - else if (hasSolid2) - myOperation = BOPAlgo_CUT; - else - myOperation = BOPAlgo_SECTION; - - BRepAlgoAPI_BooleanOperation::Build(); - if (!BuilderCanWork()) - return; - - if(aWire1) myS1 = aS1; - if(aWire2) myS2 = aS2; - - TopTools_DataMapOfShapeListOfShape* aMapSEdgeFaces[2] = - {&myMapSEdgeFaces1, &myMapSEdgeFaces2}; - TopTools_DataMapOfShapeShape* aMapSEdgeCrossFace[2] = - {&myMapSEdgeCrossFace1, &myMapSEdgeCrossFace2}; - TopTools_MapOfShape aSetFaces[2]; - TopTools_MapOfShape aSetEdges[2]; - - // fill myMapGener for new vertices - TopTools_MapIteratorOfMapOfShape aMapIter(anEdges); - const TopAbs_State aStates[3] = {TopAbs_ON, TopAbs_IN, TopAbs_OUT}; - for(; aMapIter.More(); aMapIter.Next()) { - const TopoDS_Shape& aEdge = aMapIter.Key(); - - if(aCommonEdges.Contains(aEdge)) continue; - - for (i=0; i < 3; i++) { // for each state {ON, IN, OUT} - if (QANewModTopOpe_Tools::IsSplit(myDSFiller, aEdge, aStates[i])) { - TopTools_ListOfShape aListSplits; - - QANewModTopOpe_Tools::Splits(myDSFiller, aEdge, aStates[i], aListSplits); - - TopTools_ListIteratorOfListOfShape aIterSplits(aListSplits); - for(; aIterSplits.More(); aIterSplits.Next()) { - const TopoDS_Shape& aE = aIterSplits.Value(); - TopoDS_Iterator aTDSIter(aE); - for(; aTDSIter.More(); aTDSIter.Next()) { - const TopoDS_Shape& aV = aTDSIter.Value(); - - if(!anOldVertices.Add(aV)) continue; - - if(!myMapGener.IsBound(aEdge)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - myMapGener.Bind(aEdge, aListOfShape1); - } - - myMapGener(aEdge).Append(aV); - } - } - } - } - } - - - // get list of section edges - const TopTools_ListOfShape& aListSE = SectionEdges(); - - // for each section edge remember the face crossed by the edge - // and the faces for which the edge coincides with a face's bound - TopTools_ListIteratorOfListOfShape aIterSE(aListSE); - Standard_Integer aNbUsedSecEdges = 0; - for(; aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSecEdge = TopoDS::Edge(aIterSE.Value()); - - if(!aCommonEdges.Contains(aSecEdge)) { - - aNbUsedSecEdges++; - - TopoDS_Face aFaces[2]; - QANewModTopOpe_Tools::EdgeCurveAncestors(myDSFiller, aSecEdge, aFaces[0], - aFaces[1]); - - TopTools_ListOfShape aListF[2], aListE[2]; - QANewModTopOpe_Tools::EdgeSectionAncestors(myDSFiller, aSecEdge, aListF[0], - aListF[1], aListE[0], aListE[1]); - CorrectAncestorsList (aSecEdge, aListF[0]); - CorrectAncestorsList (aSecEdge, aListF[1]); - - Standard_Integer nbCurveAncestors = 0; - for (i = 0; i < 2; i++) { - if (!aListF[i].IsEmpty()) { - aMapSEdgeFaces[i]->Bind(aSecEdge, aListF[i]); - if (aListE[i].IsEmpty()) - aMapSEdgeCrossFace[i]->Bind(aSecEdge, aListF[i].First()); - TopTools_ListIteratorOfListOfShape aIter (aListF[i]); - for (; aIter.More(); aIter.Next()) - aSetFaces[i].Add(aIter.Value()); - } - else if (!aFaces[i].IsNull()) { - TopTools_ListOfShape aList; - aList.Append(aFaces[i]); - aMapSEdgeFaces[i]->Bind(aSecEdge, aList); - aMapSEdgeCrossFace[i]->Bind(aSecEdge, aFaces[i]); - aSetFaces[i].Add(aFaces[i]); - nbCurveAncestors++; - } - else if (!aListE[i].IsEmpty()) { - myEdgesToLeave.Add (aSecEdge); - TopTools_ListIteratorOfListOfShape aIter (aListE[i]); - for (; aIter.More(); aIter.Next()) - aSetEdges[i].Add(aIter.Value()); - } - } - if (nbCurveAncestors == 2) { - // the edge was computed by intersection of 2 surfaces - aGenEdges.Add(aSecEdge); - if (isSolidShell && !myAllowCutting) { - // Shell goes inside Solid while it is forbidden - return; - } - else { - // force same parameter - const Standard_Real aTol = 1.e-5; - BRep_Builder aBld; - aBld.SameRange (aSecEdge, Standard_False); - aBld.SameParameter (aSecEdge, Standard_False); - BRepLib::SameParameter (aSecEdge, aTol); - } - } - } - } - - //-------------------------------------------------- - if(aNbUsedSecEdges == 0 && aListSE.Extent() != 0) { - // all section edges are common edges - make compound - BRep_Builder aBld; - aBld.MakeCompound (TopoDS::Compound(myShape)); - aBld.Add(myShape, myS1); - aBld.Add(myShape, myS2); - Done(); - return; - } - //-------------------------------------------------- - - // cut faces of shell if another shape is solid - if (isSolidShell) { - // split edges of shape by section edges which are got - // due to coinciding of edges rather than intersecting of faces - TopTools_MapIteratorOfMapOfShape aIter(aSetEdges[1]); - for(; aIter.More(); aIter.Next()) { - const TopoDS_Edge aEdge = TopoDS::Edge (aIter.Key()); - TopTools_ListOfShape aListSplitE; - SplitEdge (aEdge, myDSFiller, myEdgesToLeave, Standard_False, aListSplitE); - if (!aListSplitE.IsEmpty()) { - mySubst.Substitute (aEdge, aListSplitE); - if (mySubst.IsCopied (aEdge)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - myMapModif.Bind(aEdge, aListOfShape2); - myMapModif(aEdge).Append (aListSplitE); - } - } - } - - for(aIter.Initialize (aSetFaces[1]); aIter.More(); aIter.Next()) { - const TopoDS_Face aFace = TopoDS::Face (aIter.Key()); - TopTools_ListOfShape aListSEOnFace; - - // select section edges on this face - for (aIterSE.Initialize(aListSE); aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSecEdge = TopoDS::Edge(aIterSE.Value()); - // check if aFace is an ancestor of aSecEdge - if (aMapSEdgeFaces[1]->IsBound(aSecEdge)) { - TopTools_ListIteratorOfListOfShape - aIterF (aMapSEdgeFaces[1]->Find(aSecEdge)); - for (; aIterF.More(); aIterF.Next()) - if (aIterF.Value().IsSame(aFace)) { - aListSEOnFace.Append(aSecEdge); - break; - } - } - } - if (!aListSEOnFace.IsEmpty()) { - Standard_Boolean isCut = CutFace (aFace, aListSEOnFace); - if (isCut && !myAllowCutting) { - // Shell goes inside Solid while it is forbidden - return; - } - } - } - - // remove from maps all the section edges which are not marked to leave - for (aIterSE.Initialize (aListSE); aIterSE.More(); aIterSE.Next()) { - const TopoDS_Shape& aSecEdge = aIterSE.Value(); - if (!myEdgesToLeave.Contains (aSecEdge)) { - myMapSEdgeFaces1.UnBind (aSecEdge); - myMapSEdgeFaces2.UnBind (aSecEdge); - myMapSEdgeCrossFace1.UnBind (aSecEdge); - myMapSEdgeCrossFace2.UnBind (aSecEdge); - } - } - } - else { // not the case Solid-Shell - for (aIterSE.Initialize (aListSE); aIterSE.More(); aIterSE.Next()) - myEdgesToLeave.Add (aIterSE.Value()); - } - - // process intersected faces - for (i = 0; i < 2; i++) { - if (i == 1 && isSolidShell) continue; - - // split edges of shape by section edges which are got - // due to coinciding of edges rather than intersecting of faces - TopTools_MapIteratorOfMapOfShape aIter(aSetEdges[i]); - for(; aIter.More(); aIter.Next()) { - const TopoDS_Edge aEdge = TopoDS::Edge (aIter.Key()); - TopTools_ListOfShape aListSplitE; - SplitEdge (aEdge, myDSFiller, myEdgesToLeave, Standard_True, aListSplitE); - if (!aListSplitE.IsEmpty()) { - mySubst.Substitute (aEdge, aListSplitE); - //Substitution of vertices at the ends of aEdge. - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(aEdge, aV1, aV2); - TopTools_ListIteratorOfListOfShape anIter(aListSplitE); - for(; anIter.More(); anIter.Next()) { - const TopoDS_Edge& aSpE = TopoDS::Edge(anIter.Value()); - TopoDS_Vertex aSpV1, aSpV2; - TopExp::Vertices(aSpE, aSpV1, aSpV2); - aSpV1.Orientation(TopAbs_FORWARD); - aSpV2.Orientation(TopAbs_FORWARD); - TopTools_ListOfShape aL; - if(BRepTools::Compare(aV1, aSpV1) && (!aV1.IsSame(aSpV1))) { - aL.Clear(); - aL.Append(aSpV1); - if(!mySubst.IsCopied (aV1)) { - mySubst.Substitute(aV1, aL); -// if (mySubst.IsCopied (aV1)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aV1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - myMapModif.Bind(aV1, aListOfShape3); - myMapModif(aV1).Append (aL); -// } - } - } - if(BRepTools::Compare(aV1, aSpV2) && (!aV1.IsSame(aSpV2))) { - aL.Clear(); - aL.Append(aSpV2); - if(!mySubst.IsCopied (aV1)) { - mySubst.Substitute(aV1, aL); -// if (mySubst.IsCopied (aV1)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aV1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - myMapModif.Bind(aV1, aListOfShape4); - myMapModif(aV1).Append (aL); -// } - } - } - if(BRepTools::Compare(aV2, aSpV1) && (!aV2.IsSame(aSpV1))) { - aL.Clear(); - aL.Append(aSpV1); - if (!mySubst.IsCopied (aV2)) { - mySubst.Substitute(aV2, aL); -// if (mySubst.IsCopied (aV2)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aV2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape5; - myMapModif.Bind(aV2, aListOfShape5); - myMapModif(aV2).Append (aL); -// } - } - } - if(BRepTools::Compare(aV2, aSpV2) && (!aV2.IsSame(aSpV2))) { - aL.Clear(); - aL.Append(aSpV2); - if (!mySubst.IsCopied (aV2)) { - mySubst.Substitute(aV2, aL); -// if (mySubst.IsCopied (aV2)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aV2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape6; - myMapModif.Bind(aV2, aListOfShape6); - myMapModif(aV2).Append (aL); -// } - } - } - } - - if (mySubst.IsCopied (aEdge)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape7; - myMapModif.Bind(aEdge, aListOfShape7); - myMapModif(aEdge).Append (aListSplitE); - } - } - } - - for(aIter.Initialize (aSetFaces[i]); aIter.More(); aIter.Next()) { - const TopoDS_Face aFace = TopoDS::Face (aIter.Key()); - TopTools_ListOfShape aListSEOnFace; - - // select section edges on this face - for (aIterSE.Initialize(aListSE); aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSecEdge = TopoDS::Edge(aIterSE.Value()); - // check if aFace is an ancestor of aSecEdge - if (aMapSEdgeFaces[i]->IsBound(aSecEdge)) { - TopTools_ListIteratorOfListOfShape - aIterF (aMapSEdgeFaces[i]->Find(aSecEdge)); - for (; aIterF.More(); aIterF.Next()) - if (aIterF.Value().IsSame(aFace)) { - aListSEOnFace.Append(aSecEdge); - break; - } - } - } - if (!aListSEOnFace.IsEmpty()) - SectionInsideFace (aFace, aListSEOnFace, i, aGenEdges); - } - } - - // construct new shapes from myS1 and myS2 - // and result compound - TopoDS_Shape aNewS[2]; - Standard_Integer nbModified = 0; - Standard_Integer nbDeleted = 0; - Standard_Integer iShape = 0; - - for (i = 0; i < 2; i++) { - const TopoDS_Shape& aOldS = (i==0 ? myS1 : myS2); - mySubst.Build(aOldS); - if (mySubst.IsCopied(aOldS)) { - if (!mySubst.Copy(aOldS).IsEmpty()) { - aNewS[i] = mySubst.Copy(aOldS).First(); - aNewS[i].Orientation(aOldS.Orientation()); - nbModified++; - iShape = i; - } - else if (!myAllowCutting) { - // all Shell is inside Solid while it is forbidden - return; - } - else - nbDeleted++; - } - else { - aNewS[i] = aOldS; - iShape = i; - } - - TopExp_Explorer aExp (aOldS, TopAbs_FACE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aFace = aExp.Current(); - if(myMapModif.IsBound(aFace)) continue; - if (mySubst.IsCopied(aFace)) { - if (!mySubst.Copy(aFace).IsEmpty()) { - myMapModif.Bind(aFace,mySubst.Copy(aFace)); - } - } - } - - } - - if (nbModified > 0 && nbDeleted == 0) { - // the usual case - isSolidShell = Standard_True; - BRep_Builder aBld; - if(isSolidShell) { - aBld.MakeCompound (TopoDS::Compound(myShape)); - aBld.Add(myShape, aNewS[0]); - aBld.Add(myShape, aNewS[1]); - } - else { - aBld.MakeShell (TopoDS::Shell(myShape)); - for(anExp.Init(aNewS[0], TopAbs_FACE); anExp.More(); anExp.Next()) { - aBld.Add(myShape, anExp.Current()); - } - for(anExp.Init(aNewS[1], TopAbs_FACE); anExp.More(); anExp.Next()) { - aBld.Add(myShape, anExp.Current()); - } - } - Done(); - } - else if (nbDeleted == 1) { - // all Shell is inside Solid while it is permitted - myShape = aNewS[iShape]; - Done(); - } else if (nbModified == 0) { - // The case if nothing is changed. - BRep_Builder aBld; - - aBld.MakeCompound (TopoDS::Compound(myShape)); - aBld.Add(myShape, aNewS[0]); - aBld.Add(myShape, aNewS[1]); - Done(); - } - - mySubst.Clear(); - TopExp_Explorer aExp (myShape, TopAbs_EDGE); - Standard_Boolean IsSplit = Standard_False; - for (; aExp.More(); aExp.Next()) { - TopoDS_Edge aE = TopoDS::Edge(aExp.Current()); - if(mySubst.IsCopied(aE)) continue; - aE.Orientation(TopAbs_FORWARD); - TopTools_ListOfShape aListSplits; - if(QANewModTopOpe_Tools::SplitE(aE, aListSplits)) { - if(!IsSplit) IsSplit = Standard_True; - - BRep_Builder aBld; - Standard_Real aTol = Precision::Confusion(); - TopTools_ListIteratorOfListOfShape anISpl(aListSplits); - for(; anISpl.More(); anISpl.Next()) { - const TopoDS_Shape& aSpE = anISpl.Value(); - Standard_Real tol = BRep_Tool::Tolerance(TopoDS::Edge(aSpE)); - if(tol > aTol) { - aBld.UpdateEdge(TopoDS::Edge(aSpE), 1.05*tol); - } - } - - mySubst.Substitute(aE, aListSplits); - myMapModif.Bind(aE, aListSplits); - } - } - - if(IsSplit) { - mySubst.Build(myShape); - if(mySubst.IsCopied(myShape)) { - aExp.Init(myShape, TopAbs_FACE); - for(; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aF = aExp.Current(); - if(mySubst.IsCopied(aF)) { - myMapModif.Bind(aF, mySubst.Copy(aF)); - } - } - myShape = mySubst.Copy(myShape).First(); - } - } - -} - -//======================================================================= -//function : SplitFaceBoundary -//purpose : static -//======================================================================= - -static TopoDS_Face -SplitFaceBoundary (const TopoDS_Face& theFace, - BRepTools_Substitution& theSubst, - const BOPAlgo_PPaveFiller &thePDSFiller, - const TopTools_MapOfShape& theEdgesValid, - const Standard_Boolean useMap, - TopTools_DataMapOfShapeListOfShape& theMapModif) -{ - // split the face's edges by section edges lying on boundary - BRepTools_Substitution aLocalSubst; - TopExp_Explorer aExp (theFace, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge (aExp.Current()); - if (theSubst.IsCopied (aEdge)) continue; - - TopTools_ListOfShape aListSplitE; - SplitEdge (aEdge, thePDSFiller, theEdgesValid, useMap, aListSplitE); - if (aListSplitE.IsEmpty()) continue; - - theSubst.Substitute (aEdge, aListSplitE); - aLocalSubst.Substitute (aEdge, aListSplitE); -//------------------------------------------------------------- - //Substitution of vertices at the ends of aEdge. - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(aEdge, aV1, aV2); - TopTools_ListIteratorOfListOfShape anIter(aListSplitE); - for(; anIter.More(); anIter.Next()) { - const TopoDS_Edge& aSpE = TopoDS::Edge(anIter.Value()); - TopoDS_Vertex aSpV1, aSpV2; - TopExp::Vertices(aSpE, aSpV1, aSpV2); - aSpV1.Orientation(TopAbs_FORWARD); - aSpV2.Orientation(TopAbs_FORWARD); - TopTools_ListOfShape aL; - if(BRepTools::Compare(aV1, aSpV1) && (!aV1.IsSame(aSpV1))) { - aL.Clear(); - aL.Append(aSpV1); - aLocalSubst.Substitute(aV1, aL); - theSubst.Substitute(aV1, aL); - if (aLocalSubst.IsCopied (aV1)) { - // for Mandrake-10 - mkv,02.06.06 - theMapModif.Bind(aV1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - theMapModif.Bind(aV1, aListOfShape1); - theMapModif(aV1).Append (aL); - } - } - if(BRepTools::Compare(aV1, aSpV2) && (!aV1.IsSame(aSpV2))) { - aL.Clear(); - aL.Append(aSpV2); - aLocalSubst.Substitute(aV1, aL); - theSubst.Substitute(aV1, aL); - if (aLocalSubst.IsCopied (aV1)) { - // for Mandrake-10 - mkv,02.06.06 - theMapModif.Bind(aV1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - theMapModif.Bind(aV1, aListOfShape2); - theMapModif(aV1).Append (aL); - } - } - if(BRepTools::Compare(aV2, aSpV1) && (!aV2.IsSame(aSpV1))) { - aL.Clear(); - aL.Append(aSpV1); - aLocalSubst.Substitute(aV2, aL); - theSubst.Substitute(aV2, aL); - if (aLocalSubst.IsCopied (aV2)) { - // for Mandrake-10 - mkv,02.06.06 - theMapModif.Bind(aV2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - theMapModif.Bind(aV2, aListOfShape3); - theMapModif(aV2).Append (aL); - } - } - if(BRepTools::Compare(aV2, aSpV2) && (!aV2.IsSame(aSpV2))) { - aL.Clear(); - aL.Append(aSpV2); - aLocalSubst.Substitute(aV2, aL); - theSubst.Substitute(aV2, aL); - if (aLocalSubst.IsCopied (aV2)) { - // for Mandrake-10 - mkv,02.06.06 - theMapModif.Bind(aV2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - theMapModif.Bind(aV2, aListOfShape4); - theMapModif(aV2).Append (aL); - } - } - } -//------------------------------------------------------------- - if (aLocalSubst.IsCopied (aEdge)) { - // for Mandrake-10 - mkv,02.06.06 - theMapModif.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape5; - theMapModif.Bind(aEdge, aListOfShape5); - theMapModif(aEdge).Append (aListSplitE); - } - } - - aLocalSubst.Build (theFace); - if (aLocalSubst.IsCopied (theFace)) { -// TopoDS_Iterator aIterF (theFace); -// for (; aIterF.More(); aIterF.Next()) { -// const TopoDS_Shape& aWire = aIterF.Value(); -// if (aLocalSubst.IsCopied (aWire)) -// theSubst.Substitute (aWire, aLocalSubst.Copy(aWire)); -// } - aExp.Init(theFace, TopAbs_EDGE); - for(; aExp.More(); aExp.Next()) { - const TopoDS_Shape& anE = aExp.Current(); - - if (aLocalSubst.IsCopied (anE)) { - if(!theSubst.IsCopied (anE)) { - theSubst.Substitute (anE, aLocalSubst.Copy(anE)); - theMapModif.Bind(anE, aLocalSubst.Copy(anE)); - } - } - } - return TopoDS::Face (aLocalSubst.Copy(theFace).First()); - } - return theFace; -} - -//======================================================================= -//function : CutFace -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::CutFace(const TopoDS_Face& theFace, - const TopTools_ListOfShape& theListSE) -{ - Standard_Boolean aRetValue = Standard_False; - if (mySubst.IsCopied(theFace)) return aRetValue; - - // theFace may contain edges which need to be substituted - mySubst.Build(theFace); - TopoDS_Face aFace; - if (mySubst.IsCopied(theFace)) { - if (mySubst.Copy(theFace).IsEmpty()) return Standard_True; - aFace = TopoDS::Face(mySubst.Copy(theFace).First()); - } - else - aFace = theFace; - - // split the face's edges by section edges lying on boundary - TopoDS_Face aFace1 = SplitFaceBoundary (aFace, mySubst, myDSFiller, - myEdgesToLeave, Standard_False, myMapModif); - - // split face on subfaces by section edges lying inside the face - BRepFeat_SplitShape aSpliter (aFace1); - TopTools_ListIteratorOfListOfShape aIterSE (theListSE); - for (; aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSEdge = TopoDS::Edge (aIterSE.Value()); - if (myMapSEdgeCrossFace2.IsBound(aSEdge)) - aSpliter.Add (aSEdge, aFace1); - } - aSpliter.Build(); - const TopTools_ListOfShape& aListSplit = aSpliter.Modified(aFace1); - - // get OUT splits and append them to the substitution list - TopTools_ListOfShape aListToSubst; - TopTools_ListIteratorOfListOfShape aIter(aListSplit); - for(; aIter.More(); aIter.Next()) { - const TopoDS_Face& aFaceNew = TopoDS::Face (aIter.Value()); - TopAbs_State aState = ClassifyFace (aFaceNew, theListSE); - if (aState == TopAbs_OUT) { - aListToSubst.Append(aFaceNew.Oriented(TopAbs_FORWARD)); - // remember in the map the section edges to leave - TopExp_Explorer aExp (aFaceNew, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aEdge = aExp.Current(); - if (myMapSEdgeFaces2.IsBound (aEdge)) - myEdgesToLeave.Add (aEdge); - } - } - else { - aRetValue = Standard_True; - } - } - mySubst.Substitute(aFace, aListToSubst); - - // update history - if (mySubst.IsCopied(aFace)) { - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(theFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape; - myMapModif.Bind(theFace, aListOfShape); - myMapModif(theFace).Append (aListToSubst); - } - - return aRetValue; -} - -//======================================================================= -//function : GetVecIntoFace -//purpose : static -//======================================================================= - -static Standard_Boolean -GetVecIntoFace (const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - gp_Pnt& thePntOnEdge, - gp_Vec& theVecIntoFace) -{ - TopoDS_Shape aDummy = theFace.Oriented(TopAbs_FORWARD); - TopoDS_Face aFace = TopoDS::Face(aDummy); - TopoDS_Edge aEdge; // theEdge extracted from theFace (with orientation) - - TopExp_Explorer aExp (aFace, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - aEdge = TopoDS::Edge (aExp.Current()); - if (aEdge.IsSame(theEdge)) break; - } - if (!aExp.More()) return Standard_False; - - TopAbs_Orientation aOrient = aEdge.Orientation(); - if (aOrient != TopAbs_FORWARD && aOrient != TopAbs_REVERSED) - return Standard_False; - - Standard_Real aParF, aParL; - Handle(Geom2d_Curve) aCrv = BRep_Tool::CurveOnSurface(aEdge, aFace, aParF, aParL); - if (aCrv.IsNull()) return Standard_False; - if (aCrv->Continuity() < GeomAbs_C1) return Standard_False; - - // get middle point on edge and normal - Standard_Real aParM = aParF + (aParL - aParF) * 0.618; - gp_Pnt2d aPntOnCrv; - gp_Vec2d aDeriv; - aCrv->D1(aParM, aPntOnCrv, aDeriv); - gp_Vec2d aNormal(-aDeriv.Y(), aDeriv.X()); - aNormal.Normalize(); - if (aOrient == TopAbs_REVERSED) aNormal.Reverse(); - - // translate middle point along the normal - Standard_Real uMin, uMax, vMin, vMax; - BRepTools::UVBounds(aFace, uMin, uMax, vMin, vMax); - Standard_Real duv = Min(uMax - uMin, vMax - vMin) * 0.1; - Standard_Real dtol = BRep_Tool::Tolerance(aEdge) * 100.; - Standard_Real d = Min(duv, dtol); - gp_Pnt2d aPntOnSurf = aPntOnCrv.Translated(aNormal * d); - - // get 3d points - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); - gp_Pnt aPntOnFace; - aSurf->D0(aPntOnSurf.X(), aPntOnSurf.Y(), aPntOnFace); - aSurf->D0(aPntOnCrv.X(), aPntOnCrv.Y(), thePntOnEdge); - - // compute theVecIntoFace - theVecIntoFace = gp_Vec(thePntOnEdge, aPntOnFace); - Standard_Real aNorm = theVecIntoFace.Magnitude(); - if (aNorm < Precision::Confusion()) - return Standard_False; - theVecIntoFace.Divide(aNorm); - - return Standard_True; -} - -//======================================================================= -//function : ClassifyFace -//purpose : -//======================================================================= - -TopAbs_State -QANewModTopOpe_Glue::ClassifyFace(const TopoDS_Face& theFace, - const TopTools_ListOfShape& theListSE) const -{ - TopAbs_State aState = TopAbs_UNKNOWN; - - TopTools_ListIteratorOfListOfShape aIterSE (theListSE); - for (; aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge (aIterSE.Value()); - - // get a point on edge and a vector directed to inside face - // relatively that point - gp_Pnt aPntOnEdge; - gp_Vec aVecIntoFace; - if (BRep_Tool::Degenerated(aEdge) || - !GetVecIntoFace (theFace, aEdge, aPntOnEdge, aVecIntoFace)) - continue; - - // get faces from solid - if (!myMapSEdgeFaces1.IsBound(aEdge)) continue; - TopTools_ListIteratorOfListOfShape aIterF (myMapSEdgeFaces1(aEdge)); - for (; aIterF.More(); aIterF.Next()) { - const TopoDS_Face& aFaceSol = TopoDS::Face(aIterF.Value()); - TopAbs_Orientation aOrient = aFaceSol.Orientation(); - if (aOrient != TopAbs_FORWARD && aOrient != TopAbs_REVERSED) - continue; - - // classify theFace relatively aFaceSol - - // get normal to the surface at the point aPntOnEdge - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFaceSol); - GeomAPI_ProjectPointOnSurf aProjector(aPntOnEdge, aSurf); - if (!aProjector.IsDone()) continue; - Standard_Real u,v; - aProjector.LowerDistanceParameters(u,v); - gp_Vec d1u,d1v; - gp_Pnt aPntProj; - aSurf->D1(u, v, aPntProj, d1u, d1v); - gp_Vec aNormal = d1u.Crossed(d1v); - if (aOrient == TopAbs_REVERSED) aNormal.Reverse(); - - // compare normal and the vector "into face" - Standard_Real aScalar = aVecIntoFace * aNormal; - if (aScalar > Precision::Confusion()) { - aState = TopAbs_OUT; - break; - } - else if (aScalar < -Precision::Confusion()) - aState = TopAbs_IN; - else - aState = TopAbs_ON; - } - if (aState == TopAbs_IN || aState == TopAbs_ON) - break; - } - - return aState; -} - -//======================================================================= -//function : IsVertexOnFaceBound -//purpose : static -//======================================================================= - -static Standard_Boolean -IsVertexOnFaceBound (const TopoDS_Vertex& theVer, - const TopoDS_Face& theFace, - TopoDS_Edge& theEdgeContacted, - TopoDS_Vertex& theVerContacted, - Standard_Real& thePar, - Standard_Real& theDist) -{ - Standard_Real aDist, aPar, aTol2 = 0.; - theDist = RealLast(); - gp_Pnt aPnt(BRep_Tool::Pnt(theVer)); - Standard_Boolean isContactByVer = Standard_False; - - TopExp_Explorer aExp (theFace.Oriented(TopAbs_FORWARD), TopAbs_EDGE); - for (; aExp.More() && theDist > Precision::Confusion(); aExp.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge (aExp.Current()); - - // first compare by vertices - TopoDS_Iterator aIter (aEdge, Standard_False); - for (; aIter.More(); aIter.Next()) { - const TopoDS_Vertex& aVer = TopoDS::Vertex (aIter.Value()); - if (aVer.IsSame(theVer)) { - theEdgeContacted = aEdge; - theVerContacted = aVer; - return Standard_True; - } - if (QANewModTopOpe_Glue::CompareVertices (aVer, theVer, aDist)) { - if (aDist < theDist) { - theEdgeContacted = aEdge; - theVerContacted = aVer; - theDist = aDist; - thePar = BRep_Tool::Parameter (aVer, aEdge); - aTol2 = BRep_Tool::Tolerance (aVer); - isContactByVer = Standard_True; - } - } - } - - if (!isContactByVer) { - // project on edge - if (!BRep_Tool::Degenerated(aEdge)) { - if (QANewModTopOpe_Glue::ProjPointOnEdge (aPnt, aEdge, aPar, aDist)) { - if (aDist < theDist) { - theEdgeContacted = aEdge; - theVerContacted.Nullify(); - theDist = aDist; - thePar = aPar; - aTol2 = BRep_Tool::Tolerance(aEdge); - } - } - } - } - } - - if (theDist <= BRep_Tool::Tolerance(theVer) || theDist <= aTol2) - return Standard_True; - - return Standard_False; -} - -//======================================================================= -//function : UpdateMapNewOld -//purpose : static -//======================================================================= - -static void -UpdateMapNewOld (const TopoDS_Shape& theSh, const BRepTools_Substitution& theSubst, - TopTools_DataMapOfShapeShape& theMapNewOld) -{ - TopTools_IndexedMapOfShape aMapSh; - TopExp::MapShapes (theSh, aMapSh); - - for (Standard_Integer i=1; i<=aMapSh.Extent(); i++) { - const TopoDS_Shape& aSubSh = aMapSh(i); - if (!aSubSh.IsSame(theSh) && theSubst.IsCopied (aSubSh)) { - TopTools_ListIteratorOfListOfShape aIt (theSubst.Copy(aSubSh)); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aNewSubSh = aIt.Value(); - if (theMapNewOld.IsBound(aSubSh)) { - TopoDS_Shape aOldSubSh = theMapNewOld(aSubSh); - theMapNewOld.UnBind (aSubSh); - theMapNewOld.Bind (aNewSubSh, aOldSubSh); - } - else { - theMapNewOld.Bind (aNewSubSh, aSubSh); - } - } - } - } -} - -//======================================================================= -//function : DoLocalSubstitution -//purpose : static -//======================================================================= - -static void -DoLocalSubstitution (TopoDS_Shape& theSh, const TopoDS_Shape& theSubSh, - const TopoDS_Shape& theNewSubSh, - TopTools_DataMapOfShapeShape& theMapNewOld) -{ - BRepTools_Substitution aLocalSubst; - TopTools_ListOfShape aList; - aList.Append (theNewSubSh.Oriented(TopAbs_FORWARD)); - aLocalSubst.Substitute (theSubSh, aList); - aLocalSubst.Build(theSh); - - if (aLocalSubst.IsCopied(theSh)) { - UpdateMapNewOld (theSh, aLocalSubst, theMapNewOld); - theSh = aLocalSubst.Copy(theSh).First(); - } -} - -//======================================================================= -//function : SectionInsideFace -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::SectionInsideFace(const TopoDS_Face& theFace, - const TopTools_ListOfShape& theListSE, - const Standard_Integer theShapeNum, - const TopTools_MapOfShape& theGenEdges) -{ - if (mySubst.IsCopied(theFace)) return; - - // theFace may contain edges which need to be substituted - mySubst.Build(theFace); - TopoDS_Face aFace; - if (mySubst.IsCopied(theFace)) { - if (mySubst.Copy(theFace).IsEmpty()) return; - aFace = TopoDS::Face(mySubst.Copy(theFace).First()); - } - else - aFace = theFace; - - // split the face's edges by section edges lying on boundary - TopoDS_Face aFace1 = SplitFaceBoundary (aFace, mySubst, myDSFiller, - myEdgesToLeave, Standard_True, myMapModif); - TopTools_DataMapOfShapeShape aMapNewOrig; - UpdateMapNewOld (theFace, mySubst, aMapNewOrig); - - // process section edges contacting the face boundary: - // insert internal vertices in the boundary - const TopTools_DataMapOfShapeShape& aMapEF = - (theShapeNum==0 ? myMapSEdgeCrossFace1 : myMapSEdgeCrossFace2); - BRep_Builder aBld; - TopTools_DataMapOfShapeShape aMapNewOld; - TopTools_ListIteratorOfListOfShape aIterSE (theListSE); - - TopTools_MapOfShape aVerGener; - - for (; aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSEdge = TopoDS::Edge (aIterSE.Value()); - // skip edges lying on the boundary - if (!aMapEF.IsBound (aSEdge)) continue; - - // check if vertices of aSEdge contacts edges of aFace - TopoDS_Iterator aIter (aSEdge, Standard_False); - for (; aIter.More(); aIter.Next()) { - TopoDS_Vertex aSVer = TopoDS::Vertex (aIter.Value()); - if (aSVer.Orientation() != TopAbs_FORWARD && - aSVer.Orientation() != TopAbs_REVERSED) continue; - - TopoDS_Edge aEdge; - TopoDS_Vertex aVer; - Standard_Real aPar=0.0, aDist; - if (IsVertexOnFaceBound (aSVer, aFace1, aEdge, aVer, aPar, aDist)) { - // aSVer contacts aFace's boundary - - if (!aVer.IsNull()) { // vertex contacted - if (!aVer.IsSame(aSVer)) { - // the vertices are coincided but not the same - // => substitute aVer with aSVer - Standard_Real aTol = Max (BRep_Tool::Tolerance(aSVer), - BRep_Tool::Tolerance(aVer) + aDist); - TopAbs_Orientation aOri = aVer.Orientation(); - if (aOri != TopAbs_FORWARD && aOri != TopAbs_REVERSED) { - TopoDS_Shape aDummy = aSVer.Oriented(aOri); - aBld.UpdateVertex (TopoDS::Vertex (aDummy), - aPar, aEdge, aTol); - } - DoLocalSubstitution (aFace1, aVer, aSVer, aMapNewOld); - // update history - TopoDS_Shape aOrig = aMapNewOld(aSVer); - if (aMapNewOrig.IsBound(aOrig)) aOrig = aMapNewOrig(aOrig); - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aOrig, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - myMapModif.Bind(aOrig, aListOfShape1); - myMapModif(aOrig).Append (aSVer); - aVerGener.Add(aSVer); - continue; - } - } - - else { // contact inside edge - // add the vertex as internal to the edge of the face - TopoDS_Edge aNewEdge; - InsertVertexInEdge (aEdge, aSVer, aPar, aNewEdge); - // substitute edge - DoLocalSubstitution (aFace1, aEdge, aNewEdge, aMapNewOld); - // update history - const TopoDS_Shape& aOld = aMapNewOld(aNewEdge); - TopoDS_Shape aOrig; - if (aMapNewOrig.IsBound(aOld)) { - aOrig = aMapNewOrig(aOld); - TopTools_ListOfShape& aListModif = myMapModif(aOrig); - TopTools_ListIteratorOfListOfShape aIt (aListModif); - for (; aIt.More(); aIt.Next()) - if (aIt.Value().IsSame(aOld)) { - aListModif.Remove (aIt); - break; - } - aListModif.Append (aNewEdge); - } - else { - aOrig = aOld; - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aOrig, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - myMapModif.Bind(aOrig, aListOfShape2); - myMapModif(aOrig).Append (aNewEdge); - } - if (!myMapGener.IsBound (aOrig)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aOrig, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - myMapGener.Bind(aOrig, aListOfShape3); - } - myMapGener(aOrig).Append (aSVer); - aVerGener.Add(aSVer); - } - } - } - } - - // add the made replacements in the global substitution list - TopTools_DataMapIteratorOfDataMapOfShapeShape aDIter (aMapNewOld); - for (; aDIter.More(); aDIter.Next()) { - TopTools_ListOfShape aList; - const TopoDS_Shape& aOld = aDIter.Value(); - const TopoDS_Shape& aNew = aDIter.Key(); - aList.Append (aNew); - mySubst.Substitute (aOld, aList); - } - - // make wires from section edges - Handle(BRepAlgo_EdgeConnector) aConnector = new BRepAlgo_EdgeConnector; - TopTools_ListOfShape aListGener; - TopoDS_Vertex aV1, aV2; - for (aIterSE.Initialize (theListSE); aIterSE.More(); aIterSE.Next()) { - const TopoDS_Edge& aSEdge = TopoDS::Edge (aIterSE.Value()); - if (aMapEF.IsBound (aSEdge)) { - aConnector->Add (aSEdge); - aConnector->AddStart (aSEdge); - if(theGenEdges.Contains(aSEdge)) { - aListGener.Append (aSEdge); - TopExp::Vertices(aSEdge, aV1, aV2); - if(aVerGener.Add(aV1)) aListGener.Append (aV1); - if(aVerGener.Add(aV2)) aListGener.Append (aV2); - } - } - } - const TopTools_ListOfShape& aListW = aConnector->MakeBlock(); - if (aConnector->IsDone()) { - // add new wires to face - TopoDS_Face aNewFace = aFace1; - aNewFace.EmptyCopy(); - aNewFace.Orientation(TopAbs_FORWARD); - aBld.NaturalRestriction (aNewFace, BRep_Tool::NaturalRestriction(aFace1)); - // add old subshapes - TopoDS_Iterator aIterF (aFace1, Standard_False); - for (; aIterF.More(); aIterF.Next()) { - aBld.Add (aNewFace, aIterF.Value()); - } - // add new wires as internal - TopTools_ListIteratorOfListOfShape aIterL (aListW); - for (; aIterL.More(); aIterL.Next()) { - TopoDS_Shape aWire = aIterL.Value(); - // check if there is a wire containing the same set of edges; - // in this case use the old wire - aWire = FindWireOrUpdateMap (aWire, myMapEdgeWires); - aBld.Add (aNewFace, aWire.Oriented(TopAbs_INTERNAL)); - } - // substitute face - TopTools_ListOfShape aList; - aList.Append(aNewFace); - mySubst.Substitute(aFace, aList); - // update history - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(theFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - myMapModif.Bind(theFace, aListOfShape4); - myMapModif(theFace).Append (aList); - if(!aListGener.IsEmpty()) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(theFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape5; - myMapGener.Bind(theFace, aListOfShape5); - myMapGener(theFace).Append (aListGener); - } - } -#ifdef OCCT_DEBUG - else if (!aListW.IsEmpty()) { - cout<<"QANewModTopOpe_Glue::SectionInsideFace : can't connect edges"< -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : ProjPointOnEdge -//purpose : -//======================================================================= -Standard_Boolean -QANewModTopOpe_Glue::ProjPointOnEdge (const gp_Pnt& thePnt, const TopoDS_Edge& theEdge, - Standard_Real& thePar, Standard_Real& theDist) -{ - Standard_Real aParF, aParL; - Handle(Geom_Curve) aCurv = BRep_Tool::Curve(theEdge, aParF, aParL); - GeomAPI_ProjectPointOnCurve aProjector(thePnt, aCurv, aParF, aParL); - if (aProjector.NbPoints() == 0) - return Standard_False; - thePar = aProjector.LowerDistanceParameter(); - theDist = aProjector.LowerDistance(); - return Standard_True; -} - -//======================================================================= -//function : InsertVertexInEdge -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::InsertVertexInEdge (const TopoDS_Edge& theEdge, - const TopoDS_Vertex& theVer, - const Standard_Real thePar, - TopoDS_Edge& theNewEdge) -{ - BRep_Builder aBld; - // construct new edge - TopoDS_Shape aDummy = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD); - theNewEdge = TopoDS::Edge (aDummy); - Standard_Real aParF, aParL; - BRep_Tool::Range (theEdge, aParF, aParL); - aBld.Range (theNewEdge, aParF, aParL); - // add old vertices - TopoDS_Iterator aIterE (theEdge, Standard_False); - for (; aIterE.More(); aIterE.Next()) - aBld.Add (theNewEdge, aIterE.Value()); - // add new internal vertex - aBld.Add (theNewEdge, theVer.Oriented(TopAbs_INTERNAL)); - Standard_Real aTol = Max (BRep_Tool::Tolerance(theVer), - BRep_Tool::Tolerance(theEdge)); - aBld.UpdateVertex (theVer, thePar, theNewEdge, aTol); - theNewEdge.Orientation (theEdge.Orientation()); -} - -//======================================================================= -//function : SplitEdgeByVertex -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::SplitEdgeByVertex (const TopoDS_Edge& theEdge, - const TopoDS_Vertex& theVer, - const Standard_Real thePar, - TopTools_ListOfShape& theListE) -{ - BRep_Builder aBld; - // construct 2 new edges - TopoDS_Shape aDummy1 = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD); - TopoDS_Shape aDummy2 = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD); - TopoDS_Edge aNewE1 = TopoDS::Edge (aDummy1); - TopoDS_Edge aNewE2 = TopoDS::Edge (aDummy2); - Standard_Real aParF, aParL; - BRep_Tool::Range (theEdge, aParF, aParL); - aBld.Range (aNewE1, aParF, thePar); - aBld.Range (aNewE2, thePar, aParL); - // add old vertices - TopoDS_Iterator aIterE (theEdge, Standard_False); - for (; aIterE.More(); aIterE.Next()) { - const TopoDS_Vertex& aVer = TopoDS::Vertex (aIterE.Value()); - Standard_Real aParV = BRep_Tool::Parameter (aVer, theEdge); - if (aParV < thePar) aBld.Add (aNewE1, aVer); - else aBld.Add (aNewE2, aVer); - } - // add new vertex - aBld.Add (aNewE1, theVer.Oriented(TopAbs_REVERSED)); - aBld.Add (aNewE2, theVer.Oriented(TopAbs_FORWARD)); - Standard_Real aTol = Max (BRep_Tool::Tolerance(theVer), - BRep_Tool::Tolerance(theEdge)); - aBld.UpdateVertex (theVer, thePar, aNewE1, aTol); - aBld.UpdateVertex (theVer, thePar, aNewE2, aTol); - theListE.Append (aNewE1.Oriented(theEdge.Orientation())); - theListE.Append (aNewE2.Oriented(theEdge.Orientation())); -} - -//======================================================================= -//function : CompareVertices -//purpose : -//======================================================================= - -Standard_Boolean -QANewModTopOpe_Glue::CompareVertices (const TopoDS_Vertex& theV1, const TopoDS_Vertex& theV2, - Standard_Real& theDist) -{ - theDist = BRep_Tool::Pnt(theV1).Distance(BRep_Tool::Pnt(theV2)); - if (theDist <= BRep_Tool::Tolerance(theV1) || - theDist <= BRep_Tool::Tolerance(theV2)) - return Standard_True; - return Standard_False; -} - -//======================================================================= -//function : FindWireOrUpdateMap -//purpose : -//======================================================================= - -const TopoDS_Shape& -QANewModTopOpe_Glue::FindWireOrUpdateMap (const TopoDS_Shape& theWire, - TopTools_IndexedDataMapOfShapeListOfShape& theMapELW) -{ - TopoDS_Iterator aIterW (theWire); -// const TopoDS_Shape& aRefEdge = aIterW.Value(); - TopoDS_Shape aRefEdge = aIterW.Value(); - if (theMapELW.Contains (aRefEdge)) { - // map edges of theWire - Standard_Integer nbEdges = 0; - TopTools_MapOfShape aMapE; - for (; aIterW.More(); aIterW.Next()) { - aMapE.Add (aIterW.Value()); - nbEdges++; - } - - // find in the list a wire with the same set of edges - const TopTools_ListOfShape& aListW = theMapELW.FindFromKey (aRefEdge); - TopTools_ListIteratorOfListOfShape aIterLW (aListW); - for (; aIterLW.More(); aIterLW.Next()) { - const TopoDS_Shape& aWire = aIterLW.Value(); - Standard_Integer nbE = 0; - for (aIterW.Initialize (aWire); aIterW.More(); aIterW.Next()) { - nbE++; - if (nbE > nbEdges || !aMapE.Contains(aIterW.Value())) break; - } - if (nbE == nbEdges && !aIterW.More()) - return aWire; // found - } - } - - // remember the edges of this wire in the map for further reference - for (aIterW.Initialize (theWire); aIterW.More(); aIterW.Next()) { - const TopoDS_Shape& aEdge = aIterW.Value(); - if (!theMapELW.Contains (aEdge)) { - // for Mandrake-10 - mkv,02.06.06 - theMapELW.Add (aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape; - theMapELW.Add (aEdge, aListOfShape); - } - theMapELW.ChangeFromKey(aEdge).Append (theWire); - } - return theWire; -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue_vertex.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue_vertex.cxx deleted file mode 100644 index dbbd4acd09..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue_vertex.cxx +++ /dev/null @@ -1,212 +0,0 @@ -// Created on: 2001-01-16 -// Created by: Michael SAZONOV -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : PerformVertex -//purpose : -//======================================================================= -void -QANewModTopOpe_Glue::PerformVertex() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - BRepExtrema_DistShapeShape aExtrema (myS1, myS2); - if (!aExtrema.IsDone()) return; - if (aExtrema.InnerSolution()) { - if (myS2.ShapeType() != TopAbs_VERTEX) return; - TopoDS_Vertex aV = TopoDS::Vertex(myS2); - BRep_Builder aBld; - aBld.Add(myS1,aV.Oriented(TopAbs_INTERNAL)); - - TopTools_ListOfShape aList; - aList.Append (aV); - myMapGener.Bind(myS1, aList); - - - - myShape = myS1; - myShape.Orientation(myS1.Orientation()); - Done(); - - } - else { - Standard_Integer nbSol = aExtrema.NbSolution(), i; - Standard_Real aDist = aExtrema.Value(); - TopoDS_Shape aDummy = myS2.Oriented(TopAbs_FORWARD); - TopoDS_Vertex aVer2 = TopoDS::Vertex (aDummy); - Standard_Real aTol2 = BRep_Tool::Tolerance(aVer2); - - TopTools_MapOfShape aMapPassed; - aMapPassed.Add (myS2); - TopTools_IndexedDataMapOfShapeListOfShape aMapAnc; - TopExp::MapShapesAndAncestors (myS1, TopAbs_VERTEX, TopAbs_EDGE, aMapAnc); - TopExp::MapShapesAndAncestors (myS1, TopAbs_VERTEX, TopAbs_FACE, aMapAnc); - TopExp::MapShapesAndAncestors (myS1, TopAbs_EDGE, TopAbs_FACE, aMapAnc); - BRep_Builder aBld; - - // pass 1: process contacted vertices - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aShape = aExtrema.SupportOnShape1(i); - if (aShape.ShapeType() != TopAbs_VERTEX || - aMapPassed.Contains(aShape)) continue; - - const TopoDS_Vertex& aVer = TopoDS::Vertex (aShape); - - if(aVer.IsSame(aVer2)) continue; - - Standard_Real aTol1 = BRep_Tool::Tolerance(aVer); - if (aDist > aTol1 && aDist > aTol2) continue; - - aTol2 = Max (aTol2, aTol1 + aDist); - aBld.UpdateVertex (aVer2, aTol2); - - // substitute aVer2 instead of aVer - TopTools_ListOfShape aList; - aList.Append (aVer2); - mySubst.Substitute (aVer, aList); - aMapPassed.Add(aVer); - TopTools_ListIteratorOfListOfShape aIter(aMapAnc.FindFromKey(aVer)); - for (; aIter.More(); aIter.Next()) { - aMapPassed.Add(aIter.Value()); - } - myMapModif.Bind(aVer, aList); - } - - // pass 2: process contacted edges - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aShape = aExtrema.SupportOnShape1(i); - if (aShape.ShapeType() != TopAbs_EDGE || - aMapPassed.Contains(aShape)) continue; - - const TopoDS_Edge& aEdge = TopoDS::Edge (aShape); - Standard_Real aTol1 = BRep_Tool::Tolerance(aEdge); - if (aDist > aTol1 && aDist > aTol2) continue; - Standard_Real aPar; - aExtrema.ParOnEdgeS1(i, aPar); - - // construct new edge - TopoDS_Edge aNewEdge; - InsertVertexInEdge (aEdge, aVer2, aPar, aNewEdge); - - // substitute edge - TopTools_ListOfShape aList; - aList.Append (aNewEdge.Oriented(TopAbs_FORWARD)); - mySubst.Substitute (aEdge, aList); - aMapPassed.Add(aEdge); - TopTools_ListIteratorOfListOfShape aIter(aMapAnc.FindFromKey(aEdge)); - for (; aIter.More(); aIter.Next()) { - aMapPassed.Add(aIter.Value()); - } - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aList1; - myMapModif.Bind(aEdge, aList1); - myMapModif(aEdge).Append (aNewEdge); - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aList2; - myMapGener.Bind(aEdge, aList2); - myMapGener(aEdge).Append (aVer2); - } - - // pass 3: process contacted faces - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aShape = aExtrema.SupportOnShape1(i); - if (aShape.ShapeType() != TopAbs_FACE || - aMapPassed.Contains(aShape)) continue; - - const TopoDS_Face& aFace = TopoDS::Face (aShape); - Standard_Real aTol1 = BRep_Tool::Tolerance(aFace); - if (aDist > aTol1 && aDist > aTol2) continue; - Standard_Real aParU, aParV; - aExtrema.ParOnFaceS1(i, aParU, aParV); - - // construct new face - TopoDS_Face aNewFace = aFace; - aNewFace.EmptyCopy(); - aNewFace.Orientation (TopAbs_FORWARD); - aBld.NaturalRestriction (aNewFace, BRep_Tool::NaturalRestriction(aFace)); - // add old subshapes - TopoDS_Iterator aIterF (aFace, Standard_False); - for (; aIterF.More(); aIterF.Next()) { - aBld.Add (aNewFace, aIterF.Value()); - } - // add new internal vertex - aTol2 = Max (aTol2, aTol1); - aBld.Add (aNewFace, aVer2.Oriented(TopAbs_INTERNAL)); - aBld.UpdateVertex (aVer2, aParU, aParV, aNewFace, aTol2); - - // substitute face - TopTools_ListOfShape aList; - aList.Append (aNewFace); - mySubst.Substitute (aFace, aList); - aMapPassed.Add(aFace); - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aFace, TopTools_ListOfShape()); - TopTools_ListOfShape aList3; - myMapModif.Bind(aFace, aList3); - myMapModif(aFace).Append (aNewFace); - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aFace, TopTools_ListOfShape()); - TopTools_ListOfShape aList4; - myMapGener.Bind(aFace, aList4); - myMapGener(aFace).Append (aVer2); - } - - mySubst.Build(myS1); - - TopExp_Explorer aExp (myS1, TopAbs_FACE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aFace = aExp.Current(); - if(myMapModif.IsBound(aFace)) continue; - if (mySubst.IsCopied(aFace)) { - if (!mySubst.Copy(aFace).IsEmpty()) { - myMapModif.Bind(aFace,mySubst.Copy(aFace)); - } - } - } - - aExp.Init(myS1, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& anEdge = aExp.Current(); - if(myMapModif.IsBound(anEdge)) continue; - if (mySubst.IsCopied(anEdge)) { - if (!mySubst.Copy(anEdge).IsEmpty()) { - myMapModif.Bind(anEdge,mySubst.Copy(anEdge)); - } - } - } - - if (mySubst.IsCopied(myS1)) { - myShape = mySubst.Copy(myS1).First(); - myShape.Orientation(myS1.Orientation()); - Done(); - } - } -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue_wire.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue_wire.cxx deleted file mode 100644 index c22e739cb6..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue_wire.cxx +++ /dev/null @@ -1,1588 +0,0 @@ -// Created on: 2001-01-16 -// Created by: Michael SAZONOV -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//#include -//======================================================================= -//function : IsOnSurface -//purpose : static -//======================================================================= -static Standard_Boolean -IsOnSurface (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace) -{ - Standard_Real aParF, aParL, aTolEdge; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aParF, aParL); - if (aCurve.IsNull()) return Standard_False; - aTolEdge = BRep_Tool::Tolerance(theEdge); - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace); - - // define check points - Standard_Real aParams[4]; - Standard_Real aDeltaRange = aParL - aParF; - aParams[0] = aParF; - aParams[1] = aParF + aDeltaRange * 0.382; - aParams[2] = aParF + aDeltaRange * 0.618; - aParams[3] = aParL; - gp_Pnt aPnt; - - // check distance to the surface - Standard_Real aTol = aTolEdge + BRep_Tool::Tolerance(theFace); - Standard_Integer i; - for (i=0; i < 4; i++) { - aPnt = aCurve->Value(aParams[i]); - GeomAPI_ProjectPointOnSurf aProjector(aPnt, aSurf); - if (!aProjector.IsDone() || aProjector.LowerDistance() > aTol) - return Standard_False; - } - - return Standard_True; -} - -//======================================================================= -//function : ProcessEdgeFaceInterference -//purpose : static -//======================================================================= - -static void -ProcessEdgeFaceInterference (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace, - TopoDS_Shape& theNewFace, - TopTools_ListOfShape& theListE, - TColgp_SequenceOfPnt& thePoints1, - TColgp_SequenceOfPnt& thePoints2, - TColStd_SequenceOfInteger& theEdgeOnSurface, - TopTools_DataMapOfShapeListOfShape& theMapSubst, - TopTools_DataMapOfShapeListOfShape& theMapGener) -{ - BRep_Builder aBld; - - - Standard_Boolean anIsOnSurface = IsOnSurface(theEdge, theFace); - TColgp_SequenceOfPnt aPntOfInter; - TColStd_SequenceOfReal aW; - TopTools_ListOfShape aListOfIntVert; - if(!anIsOnSurface) { - //check intersection points - BRepIntCurveSurface_Inter anInter; - Standard_Real f, l; - const TopoDS_Edge& anE = TopoDS::Edge(theEdge.Oriented(TopAbs_FORWARD)); - Handle(Geom_Curve) aC = - BRep_Tool::Curve(anE, f, l); - GeomAdaptor_Curve anAdC(aC, f, l); - anInter.Init(theFace, anAdC, Precision::PConfusion()); - for(; anInter.More(); anInter.Next()) { - if(anInter.State() == TopAbs_ON) { continue;} - aPntOfInter.Append(anInter.Pnt()); - aW.Append(anInter.W()); - } - // check vertices - - - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(anE, aV1, aV2); - TopoDS_Shape aCmp; - aBld.MakeCompound(TopoDS::Compound(aCmp)); - aBld.Add(aCmp, aV1); - if(!aV1.IsSame(aV2)) aBld.Add(aCmp, aV2); - - TopoDS_Iterator anItV(theEdge); - for(; anItV.More(); anItV.Next()) { - if(anItV.Value().Orientation() == TopAbs_INTERNAL) - aBld.Add(aCmp, anItV.Value()); - } - - BRepExtrema_DistShapeShape aExtrema (theFace, aCmp); - if (aExtrema.IsDone()) { - Standard_Integer nbSol = aExtrema.NbSolution(), i, j; - Standard_Real aDist = aExtrema.Value(), aTol; - Standard_Integer n = aPntOfInter.Length(); - for (i=1; i <= nbSol; i++) { - if(aExtrema.SupportTypeShape1(i) != BRepExtrema_IsInFace) continue; - TopoDS_Shape aS2 = aExtrema.SupportOnShape2(i); - aTol = BRep_Tool::Tolerance(TopoDS::Vertex(aS2)); - if(aDist > aTol) continue; - aListOfIntVert.Append(aS2); - //check intersection points on coincidence with vertex - gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aS2)); - for(j=1; j <= n; j++) { - if(aP.Distance(aPntOfInter(j)) > aTol) continue; - aPntOfInter.Remove(j); - aW.Remove(j); - j--; - n--; - } - } - } - } - - - TopExp_Explorer aExp (theFace.Oriented(TopAbs_FORWARD), TopAbs_EDGE); - Standard_Boolean IsNotInternal = Standard_True; - Standard_Boolean InsertVertexInBoundary = Standard_True; - Standard_Integer aN = thePoints1.Length(); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge (aExp.Current()); - IsNotInternal = Standard_True; - InsertVertexInBoundary = Standard_True; - if(aE.Orientation() == TopAbs_EXTERNAL) continue; - if(aE.Orientation() == TopAbs_INTERNAL) IsNotInternal = Standard_False; -// if (aE.Orientation() != TopAbs_FORWARD && -// aE.Orientation() != TopAbs_REVERSED) continue; - - BRepExtrema_DistShapeShape aExtrema (aE.Oriented(TopAbs_FORWARD), - theEdge.Oriented(TopAbs_FORWARD)); - if (!aExtrema.IsDone()) continue; - Standard_Integer nbSol = aExtrema.NbSolution(), i; - Standard_Real aDist = aExtrema.Value(); - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aS1 = aExtrema.SupportOnShape1(i); - TopoDS_Shape aS2 = aExtrema.SupportOnShape2(i); - - // check distance against tolerances - Standard_Real aTol1, aTol2; - if (aS1.ShapeType() == TopAbs_VERTEX) - aTol1 = BRep_Tool::Tolerance (TopoDS::Vertex(aS1)); - else - aTol1 = BRep_Tool::Tolerance (TopoDS::Edge(aS1)); - if (aS2.ShapeType() == TopAbs_VERTEX) - aTol2 = BRep_Tool::Tolerance (TopoDS::Vertex(aS2)); - else - aTol2 = BRep_Tool::Tolerance (TopoDS::Edge(aS2)); - if (aDist > aTol1 + aTol2) continue; - - // avoid to process the same points twice - gp_Pnt aPnt1 = aExtrema.PointOnShape1(i); - gp_Pnt aPnt2 = aExtrema.PointOnShape2(i); - Standard_Integer j; - for (j=1; j<=thePoints1.Length(); j++) { - if (aPnt1.IsEqual(thePoints1(j),Precision::Confusion()) && - aPnt2.IsEqual(thePoints2(j),Precision::Confusion())) { -// if(anIsOnSurface && (theEdgeOnSurface(j) == 1)) break; -// if(!anIsOnSurface && (theEdgeOnSurface(j) == 0)) break; - break; - } - } - if (j > aN && j <= thePoints1.Length()) continue; - if (j <= aN) { - thePoints1.Remove(j); - thePoints2.Remove(j); - theEdgeOnSurface.Remove(j); - InsertVertexInBoundary = Standard_False; - aN--; - } - thePoints1.Append (aPnt1); - thePoints2.Append (aPnt2); - theEdgeOnSurface.Append(anIsOnSurface ? 1 : 0); - // find or make the intersection vertex - TopoDS_Vertex aVerInt; - if (aS2.ShapeType() == TopAbs_VERTEX) - aVerInt = TopoDS::Vertex (aS2); - else if (aS1.ShapeType() == TopAbs_VERTEX) - aVerInt = TopoDS::Vertex (aS1); - else { - // make new vertex - Standard_Real aTol = Max (aTol1+aDist, aTol2); - aBld.MakeVertex (aVerInt, aPnt2, aTol); - } - - if (aS1.ShapeType() == TopAbs_VERTEX) { - if (!aS1.IsSame(aVerInt) && !theMapSubst.IsBound(aS1)) { - // replace vertex from Face with vertex from Edge - const TopoDS_Vertex& aVer1 = TopoDS::Vertex(aS1); - // update intersection vertex - aTol2 = Max (aTol2, aTol1 + aDist); -// Standard_Real aPar = BRep_Tool::Parameter (aVer1, aE); - gp_Pnt aP = BRep_Tool::Pnt(aVerInt); -// aBld.UpdateVertex (aVerInt, aPar, aE, aTol2); - aBld.UpdateVertex (aVerInt, aP, aTol2); - // do substitution - TopTools_ListOfShape aList; - aList.Append (aVerInt); - theMapSubst.Bind (aVer1, aList); - } - } - - else { // aS1 is the same edge as aE - // insert intersection vertex in edge from Shell as internal - Standard_Real aPar; - aExtrema.ParOnEdgeS1(i, aPar); - - if (!theMapSubst.IsBound(aS1)) { - // for Mandrake-10 - mkv,02.06.06 - theMapSubst.Bind (aE, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - theMapSubst.Bind (aE, aListOfShape1); - } - TopTools_ListOfShape& aListSubst = theMapSubst(aS1); - TopoDS_Edge aEdge; - Standard_Boolean aListWasEmpty = Standard_False; - if (aListSubst.IsEmpty()) { - aListWasEmpty = Standard_True; - aEdge = TopoDS::Edge (aS1); - } - else { - // find split by parameter - TopTools_ListIteratorOfListOfShape aIt (aListSubst); - for (; aIt.More(); aIt.Next()) { - Standard_Real aParF, aParL; - const TopoDS_Edge& aE1 = TopoDS::Edge (aIt.Value()); - BRep_Tool::Range (aE1, aParF, aParL); - if (aParF < aPar && aPar < aParL) { - aEdge = aE1; - break; - } - } - if (aIt.More()) { - aListSubst.Remove (aIt); - } - else - // unusual, needed split not found, skip to next extrema solution - continue; - } - - if(InsertVertexInBoundary) { -// TopoDS_Edge aNewEdge; -// QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVerInt, aPar, aNewEdge); - TopTools_ListOfShape aListE; - QANewModTopOpe_Glue::SplitEdgeByVertex (aEdge, aVerInt, aPar, aListE); -// aListSubst.Append (aNewEdge); - aListSubst.Append (aListE); - if (!theMapGener.IsBound(aS1)) { - // for Mandrake-10 - mkv,02.06.06 - theMapGener.Bind(aS1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - theMapGener.Bind(aS1, aListOfShape2); - } - theMapGener(aS1).Append (aVerInt); - } - else { - if(!aListWasEmpty) aListSubst.Append(aEdge); - } - } - - Standard_Boolean isS2InternalVertex = - (aS2.ShapeType() == TopAbs_VERTEX && aS2.Orientation() == TopAbs_INTERNAL); - - if (aS2.ShapeType() == TopAbs_EDGE || isS2InternalVertex) { - // split theEdge - Standard_Real aPar; - if (isS2InternalVertex) - aPar = BRep_Tool::Parameter (aVerInt, theEdge); - else - aExtrema.ParOnEdgeS2(i, aPar); - - TopoDS_Edge aEdge; - if (theListE.IsEmpty()) { - aEdge = theEdge; - } - else { - // find split by parameter - TopTools_ListIteratorOfListOfShape aIt (theListE); - for (; aIt.More(); aIt.Next()) { - Standard_Real aParF, aParL; - const TopoDS_Edge& aE1 = TopoDS::Edge (aIt.Value()); - BRep_Tool::Range (aE1, aParF, aParL); - if (aParF < aPar && aPar < aParL) { - aEdge = aE1; - break; - } - } - if (aIt.More()) - theListE.Remove (aIt); - else - // unusual, needed split not found, skip to next extrema solution - continue; - } - - TopTools_ListOfShape aListE; - if(anIsOnSurface && IsNotInternal) { - // split aEdge - QANewModTopOpe_Glue::SplitEdgeByVertex (aEdge, aVerInt, aPar, aListE); - theListE.Append (aListE); - } - else { - //insert internal vertex in aEdge - if(!isS2InternalVertex) { - TopoDS_Edge aNewEdge; -// QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVerInt, aPar, aNewEdge); - QANewModTopOpe_Glue::SplitEdgeByVertex (aEdge, aVerInt, aPar, aListE); -// theListE.Append(aNewEdge); - theListE.Append (aListE); - if (!theMapGener.IsBound(aS2)) { - // for Mandrake-10 - mkv,02.06.06 - theMapGener.Bind(aS2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - theMapGener.Bind(aS2, aListOfShape3); - } - theMapGener(aS2).Append (aVerInt); - } - } - - } - } - - } - - // treatmen intersection points - // insert internal vertices in face - TopTools_ListIteratorOfListOfShape aIt (aListOfIntVert); - gp_Pnt aP; - Standard_Real aTol; - theNewFace = theFace; - for(; aIt.More(); aIt.Next()) { - aP = BRep_Tool::Pnt(TopoDS::Vertex(aIt.Value())); - aTol = BRep_Tool::Tolerance(TopoDS::Vertex(aIt.Value())); - Standard_Integer j; - for (j=1; j<=thePoints1.Length(); j++) { - if (aP.IsEqual(thePoints1(j),aTol)) break; - } - if (j <= thePoints1.Length()) continue; - thePoints1.Append (aP); - thePoints2.Append (aP); - theEdgeOnSurface.Append(anIsOnSurface ? 1 : 0); - - // insert internal vertex in face; - QANewModTopOpe_Glue aFVGluing(theNewFace, aIt.Value()); - theNewFace = aFVGluing.Shape(); - } - // insert intersection vertices in face and in edge - Standard_Integer k; - for(k = 1; k <= aPntOfInter.Length(); k++) { - Standard_Integer j; - for (j=1; j<=thePoints1.Length(); j++) { - if (aPntOfInter(k).IsEqual(thePoints1(j),Precision::Confusion())) break; - } - if (j <= thePoints1.Length()) continue; - - thePoints1.Append (aPntOfInter(k)); - thePoints2.Append (aPntOfInter(k)); - theEdgeOnSurface.Append(anIsOnSurface ? 1 : 0); - - Standard_Real aPar = aW(k); - TopoDS_Vertex aV; - aBld.MakeVertex (aV, aPntOfInter(k), Precision::Confusion()); - - QANewModTopOpe_Glue aFVGluing(theNewFace, aV); - theNewFace = aFVGluing.Shape(); - if (!theMapGener.IsBound(theFace)) { - // for Mandrake-10 - mkv,02.06.06 - theMapGener.Bind(theFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - theMapGener.Bind(theFace, aListOfShape4); - } - theMapGener(theFace).Append (aV); - - TopoDS_Edge aEdge; - if (theListE.IsEmpty()) - aEdge = theEdge; - else { - // find split by parameter - aIt.Initialize (theListE); - for (; aIt.More(); aIt.Next()) { - Standard_Real aParF, aParL; - const TopoDS_Edge& aE1 = TopoDS::Edge (aIt.Value()); - BRep_Tool::Range (aE1, aParF, aParL); - if (aParF < aPar && aPar < aParL) { - aEdge = aE1; - break; - } - } - if (aIt.More()) - theListE.Remove (aIt); - else - // unusual, needed split not found, skip to next intersection solution - continue; - } - -// TopoDS_Edge aNewEdge; -// QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aV, aPar, aNewEdge); -// theListE.Append(aNewEdge); - TopTools_ListOfShape aListE; - QANewModTopOpe_Glue::SplitEdgeByVertex (aEdge, aV, aPar, aListE); - theListE.Append (aListE); - if (!theMapGener.IsBound(theEdge)) { - // for Mandrake-10 - mkv,02.06.06 - theMapGener.Bind(theEdge, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape5; - theMapGener.Bind(theEdge, aListOfShape5); - } - theMapGener(theEdge).Append (aV); - - } - - - - if (theListE.IsEmpty()) - theListE.Append (theEdge); -} - - -//======================================================================= -//function : ClassifyEdgeFace -//purpose : static -//======================================================================= - -static TopAbs_State -ClassifyEdgeFace (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace, - TopoDS_Edge& theEdgeOn, - const TopTools_DataMapOfShapeListOfShape& theMapSubst) -{ - Standard_Real aParF, aParL, aTolEdge; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aParF, aParL); - if (aCurve.IsNull()) return TopAbs_OUT; - aTolEdge = BRep_Tool::Tolerance(theEdge); - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace); - - // define check points - Standard_Real aParams[4]; - Standard_Real aDeltaRange = aParL - aParF; - aParams[0] = aParF; - aParams[1] = aParF + aDeltaRange * 0.382; - aParams[2] = aParF + aDeltaRange * 0.618; - aParams[3] = aParL; - gp_Pnt aPnts[4]; - gp_Pnt2d aPnts2d[4]; - - // check distance to the surface - Standard_Real aTol = aTolEdge + BRep_Tool::Tolerance(theFace); - Standard_Integer i; - for (i=0; i < 4; i++) { - aPnts[i] = aCurve->Value(aParams[i]); - GeomAPI_ProjectPointOnSurf aProjector(aPnts[i], aSurf); - if (!aProjector.IsDone() || aProjector.LowerDistance() > aTol) - return TopAbs_OUT; - Standard_Real u,v; - aProjector.LowerDistanceParameters(u,v); - aPnts2d[i].SetCoord(u,v); - } - - // check distance to edges - TopExp_Explorer aExp (theFace, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aE = aExp.Current(); -// if (aE.Orientation() == TopAbs_FORWARD || aE.Orientation() == TopAbs_REVERSED) { - if (aE.Orientation() != TopAbs_EXTERNAL) { - TopTools_ListOfShape aListSingle; - TopTools_ListIteratorOfListOfShape aIt; - if (theMapSubst.IsBound(aE)) { - aIt.Initialize (theMapSubst(aE)); - } - else { - aListSingle.Append (aE); - aIt.Initialize (aListSingle); - } - - for (; aIt.More(); aIt.Next()) { // for each split - const TopoDS_Edge& aE1 = TopoDS::Edge (aIt.Value()); - Standard_Real aPF, aPL; - Handle(Geom_Curve) aCrv = BRep_Tool::Curve(aE1, aPF, aPL); - if (aCrv.IsNull()) continue; - Standard_Real aTol1 = aTolEdge + BRep_Tool::Tolerance(aE1); - - for (i=0; i < 4; i++) { - GeomAPI_ProjectPointOnCurve aProjector(aPnts[i], aCrv, aPF, aPL); - if (aProjector.NbPoints() == 0 || aProjector.LowerDistance() > aTol1) - break; - } - if (i == 4) { // all points are on an edge - theEdgeOn = aE1; - return TopAbs_ON; - } - } - } - } - - // use 2d face classifier -// BRepClass_FaceClassifier aClf; - BRepTopAdaptor_FClass2d aClf(theFace, Precision::PConfusion()); - for (i=0; i < 4; i++) { - if (aClf.Perform (aPnts2d[i]) == TopAbs_OUT) - return TopAbs_OUT; - } - - return TopAbs_IN; -} - -//======================================================================= -//function : UpdateEdgeOnFace -//purpose : static -//======================================================================= - -static Standard_Boolean -UpdateEdgeOnFace (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace) -{ - BRep_Builder aBld; - Standard_Real aPF, aPL, aTolEdge; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aPF, aPL); - if (aCurve.IsNull()) return Standard_False; - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace); - if (aSurf.IsNull()) return Standard_False; - aTolEdge = BRep_Tool::Tolerance(theEdge); - - Standard_Real aTolApprox = Max (aTolEdge, BRep_Tool::Tolerance(theFace)); - Handle(Geom2d_Curve) aCrv2d = GeomProjLib::Curve2d (aCurve, aPF, aPL, aSurf, - aTolApprox); - if (!aCrv2d.IsNull()) { - aTolEdge = Max (aTolEdge, aTolApprox); - aBld.UpdateEdge (theEdge, aCrv2d, theFace, aTolEdge); - return Standard_True; - } - return Standard_False; -} - -//======================================================================= -//function : PerformShellWire -//purpose : -//======================================================================= - -void -QANewModTopOpe_Glue::PerformShellWire() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - Standard_Boolean anOnlyOneFace = Standard_False; - BRep_Builder aBld; - if(myS1.ShapeType() == TopAbs_FACE) { - TopoDS_Shape aShell; - aBld.MakeShell(TopoDS::Shell(aShell)); - aBld.Add(aShell, myS1); - myS1 = aShell; - anOnlyOneFace = Standard_True; - } - - if(myS2.ShapeType() == TopAbs_EDGE) { - myS2 = BRepBuilderAPI_MakeWire(TopoDS::Edge(myS2)); - } - - TopoDS_Shape aS1F = myS1.Oriented(TopAbs_FORWARD); - TopoDS_Shape aS2F = myS2.Oriented(TopAbs_FORWARD); - BRepExtrema_DistShapeShape aExtrema (aS1F, aS2F); - if (!aExtrema.IsDone()) - return; - - TopTools_IndexedDataMapOfShapeListOfShape aMapAnc1; - TopExp::MapShapesAndAncestors (aS1F, TopAbs_VERTEX, TopAbs_EDGE, aMapAnc1); - TopExp::MapShapesAndAncestors (aS1F, TopAbs_VERTEX, TopAbs_FACE, aMapAnc1); - TopExp::MapShapesAndAncestors (aS1F, TopAbs_EDGE, TopAbs_FACE, aMapAnc1); - TopTools_IndexedDataMapOfShapeListOfShape aMapAnc2; - TopExp::MapShapesAndAncestors (aS2F, TopAbs_VERTEX, TopAbs_EDGE, aMapAnc2); - TopExp::MapShapesAndAncestors (aS2F, TopAbs_EDGE, TopAbs_WIRE, aMapAnc2); - TopTools_IndexedDataMapOfShapeListOfShape aMapFE; - - // process extrema points - Standard_Boolean anIsCoincided = Standard_False; - Standard_Integer nbSol = aExtrema.NbSolution(), i; - Standard_Real aDist = aExtrema.Value(); - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aS1 = aExtrema.SupportOnShape1(i); - TopoDS_Shape aS2 = aExtrema.SupportOnShape2(i); - - // check distance against tolerances - Standard_Real aTol1, aTol2; - if (aS1.ShapeType() == TopAbs_VERTEX) - aTol1 = BRep_Tool::Tolerance (TopoDS::Vertex(aS1)); - else if (aS1.ShapeType() == TopAbs_EDGE) - aTol1 = BRep_Tool::Tolerance (TopoDS::Edge(aS1)); - else - aTol1 = BRep_Tool::Tolerance (TopoDS::Face(aS1)); - if (aS2.ShapeType() == TopAbs_VERTEX) - aTol2 = BRep_Tool::Tolerance (TopoDS::Vertex(aS2)); - else - aTol2 = BRep_Tool::Tolerance (TopoDS::Edge(aS2)); - if (aDist > aTol1 + aTol2) continue; - - anIsCoincided = Standard_True; - - // determine contacted faces from Shell and edges from Wire - // and remember them in the map - TopTools_ListOfShape aListF, aListE; - if (aS1.ShapeType() == TopAbs_FACE) { - aListF.Append (aS1); - } - else { - TopTools_ListIteratorOfListOfShape aIt (aMapAnc1.FindFromKey(aS1)); - for (; aIt.More(); aIt.Next()) - if (aIt.Value().ShapeType() == TopAbs_FACE) - aListF.Append (aIt.Value()); - } - if (aS2.ShapeType() == TopAbs_EDGE) { - aListE.Append (aS2); - } - else { - TopTools_ListIteratorOfListOfShape aIt (aMapAnc2.FindFromKey(aS2)); - for (; aIt.More(); aIt.Next()) - aListE.Append (aIt.Value()); - } - TopTools_ListIteratorOfListOfShape aItF (aListF); - for (; aItF.More(); aItF.Next()) { - if (!aMapFE.Contains (aItF.Value())) { - // for Mandrake-10 - mkv,02.06.06 - aMapFE.Add (aItF.Value(), TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - aMapFE.Add (aItF.Value(), aListOfShape1); - } - TopTools_ListOfShape& aLE = aMapFE.ChangeFromKey(aItF.Value()); - TopTools_MapOfShape aMapE; - TopTools_ListIteratorOfListOfShape aItE (aLE); - for (; aItE.More(); aItE.Next()) - aMapE.Add (aItE.Value()); - for (aItE.Initialize (aListE); aItE.More(); aItE.Next()) - if (!aMapE.Contains (aItE.Value())) - aLE.Append(aItE.Value()); - } - } - - - if(!anIsCoincided) return; - - // for each touched face make wire and add it in face as internal - - TopTools_MapOfShape aMapUsedEdges; - TColgp_SequenceOfPnt aPoints1; - TColgp_SequenceOfPnt aPoints2; - TColStd_SequenceOfInteger aEdgeOnSurface; - TopTools_DataMapOfShapeListOfShape aMapSubst; - for (i=1; i <= aMapFE.Extent(); i++) { - const TopoDS_Face& aFace = TopoDS::Face (aMapFE.FindKey(i)); - TopoDS_Shape aNewFace; - - // form the new wire: - // get all edges contacting the face, split them by the face boundary, - // get those splits which are inside the face. - Standard_Boolean isWireMade = Standard_False; - TopoDS_Shape aWire; - aBld.MakeWire (TopoDS::Wire (aWire)); - TopTools_ListIteratorOfListOfShape aIt (aMapFE(i)); - for (; aIt.More(); aIt.Next()) { // for each edge contacting the face - const TopoDS_Shape& aEdge = aIt.Value(); - if (aMapUsedEdges.Contains(aEdge)) continue; - - TopTools_ListOfShape aListSingle; - aListSingle.Append (aEdge); - TopTools_ListOfShape& aListRef = (aMapSubst.IsBound(aEdge) - ? aMapSubst(aEdge) - : aListSingle); - TopTools_ListIteratorOfListOfShape aIt1 (aListRef); - while (aIt1.More()) { // for each old split - const TopoDS_Edge& aE1 = TopoDS::Edge (aIt1.Value()); - if (!aMapUsedEdges.Contains(aE1)) { - TopTools_ListOfShape aListE; - ProcessEdgeFaceInterference (aE1, aFace, aNewFace, aListE, aPoints1, aPoints2, - aEdgeOnSurface, aMapSubst, myMapGener); - TopTools_ListIteratorOfListOfShape aIt2 (aListE); - for (aIt2.Initialize(aListE); aIt2.More(); aIt2.Next()) { - const TopoDS_Edge& aE2 = TopoDS::Edge (aIt2.Value()); - TopoDS_Edge aEon; - TopAbs_State aState = ClassifyEdgeFace (aE2, aFace, aEon, aMapSubst); - if (aState == TopAbs_IN ) { - if (UpdateEdgeOnFace (aE2, aFace)) { - isWireMade = Standard_True; - aBld.Add (aWire, aE2); - aMapUsedEdges.Add (aE2); - if (!myMapGener.IsBound(aFace)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - myMapGener.Bind(aFace, aListOfShape2); - } - myMapGener(aFace).Append (aE2); - } - } - else if(aState == TopAbs_ON) { - aMapUsedEdges.Add (aE2); - } - } - Standard_Boolean IsTheSame = Standard_False; - if(aListE.Extent() == 1) { - IsTheSame = aE1.IsSame(aListE.First()); - } - if (aListE.Extent() > 1 || !IsTheSame) { - // replace old split with new splits - if (aMapSubst.IsBound(aEdge)) { - aListRef.InsertBefore (aListE, aIt1); - aListRef.Remove (aIt1); - continue; - } - else aMapSubst.Bind (aEdge, aListE); - } - } - aIt1.Next(); - } - } - - if(!aNewFace.IsSame(aFace) && !aNewFace.IsNull()) { - if(!aMapSubst.IsBound(aFace)) { - // for Mandrake-10 - mkv,02.06.06 - aMapSubst.Bind (aFace, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - aMapSubst.Bind (aFace, aListOfShape3); - } - aMapSubst(aFace).Append(aNewFace); - } - - if (isWireMade) { - // add new wire to face - TopoDS_Shape aDummy = aNewFace.EmptyCopied().Oriented(TopAbs_FORWARD); - TopoDS_Face aNewFace1 = TopoDS::Face (aDummy); - aBld.NaturalRestriction (aNewFace1, BRep_Tool::NaturalRestriction(aFace)); - TopoDS_Iterator aIterF (aNewFace, Standard_False); - for (; aIterF.More(); aIterF.Next()) { - aBld.Add (aNewFace1, aIterF.Value()); - } - aWire = FindWireOrUpdateMap (aWire, aMapAnc2); - aBld.Add (aNewFace1, aWire.Oriented(TopAbs_INTERNAL)); - // do substitution - TopTools_ListOfShape aList; - aList.Append (aNewFace1.Oriented(aFace.Orientation())); - if(aMapSubst.IsBound(aFace)) aMapSubst.UnBind(aFace); - aMapSubst.Bind (aFace, aList); - } - } - - // make wires from the left edges - -// if (!aMapUsedEdges.IsEmpty()) { - Handle(BRepAlgo_EdgeConnector) aConnector = new BRepAlgo_EdgeConnector; -// TopoDS_Iterator aIterW (myS2, Standard_False); - TopExp_Explorer anExpW (myS2, TopAbs_EDGE); - for (; anExpW.More(); anExpW.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge (anExpW.Current()); - if (aMapUsedEdges.Contains(aEdge)) continue; - - if (aMapSubst.IsBound(aEdge)) { - TopTools_ListIteratorOfListOfShape aIt (aMapSubst(aEdge)); - for (; aIt.More(); aIt.Next()) { // for each old split - if (aMapUsedEdges.Contains(aIt.Value())) continue; - aConnector->Add (TopoDS::Edge(aIt.Value())); - aConnector->AddStart (TopoDS::Edge(aIt.Value())); - } - } - else { - aConnector->Add (aEdge); - aConnector->AddStart (aEdge); - } - } - - // for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind (myS2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - myMapModif.Bind (myS2, aListOfShape4); - TopTools_ListOfShape& aListW = aConnector->MakeBlock(); - if (aConnector->IsDone()) { -// TopAbs_Orientation aOri = myS2.Orientation(); - TopTools_ListIteratorOfListOfShape aIt (aListW); -// for (; aIt.More(); aIt.Next()) aIt.Value().Orientation(aOri); - myMapModif(myS2).Append (aListW); - } -// } - - // construct the result - - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aIterM(aMapSubst); - - for (; aIterM.More(); aIterM.Next()) { - TopAbs_Orientation aOri = TopAbs_FORWARD; - TopTools_ListIteratorOfListOfShape aIt (aIterM.Value()); - for (; aIt.More(); aIt.Next()) aIt.Value().Orientation(aOri); - if(!aIterM.Value().IsEmpty()) mySubst.Substitute (aIterM.Key(), aIterM.Value()); - aOri = aIterM.Key().Orientation(); - aIt.Initialize (aIterM.Value()); - for (; aIt.More(); aIt.Next()) aIt.Value().Orientation(aOri); - if(!aIterM.Value().IsEmpty()) myMapModif.Bind (aIterM.Key(), aIterM.Value()); - } - - if(anIsCoincided) { - TopoDS_Shape aNewS1 = myS1; - mySubst.Build(myS1); - if (mySubst.IsCopied(myS1)) { - aNewS1 = mySubst.Copy(myS1).First(); - if(aNewS1.ShapeType() == TopAbs_SHELL && anOnlyOneFace) { - TopoDS_Iterator anIter(aNewS1); - aNewS1 = anIter.Value(); - } - aNewS1.Orientation(myS1.Orientation()); - } - - if (myMapModif.IsBound (myS2) && myMapModif(myS2).IsEmpty()) { - // all wire is on shell - myShape = aNewS1; - myMapModif.UnBind (myS2); - } - else { - // all wire or part of wire is out of shell - aBld.MakeCompound (TopoDS::Compound(myShape)); - aBld.Add(myShape, aNewS1); - if (myMapModif.IsBound (myS2)) { - TopTools_ListIteratorOfListOfShape aIt (myMapModif(myS2)); - for (; aIt.More(); aIt.Next()) { - // check if wire contains only one edge - TopoDS_Iterator aTDIt(aIt.Value()); - TopoDS_Shape anE = aTDIt.Value(); - aTDIt.Next(); - if(aTDIt.More()) aBld.Add (myShape, aIt.Value()); - else aBld.Add (myShape, anE); - } - } - else aBld.Add (myShape, myS2); - } - - Done(); - } -} - -//======================================================================= -//function : IsOverlapped -//purpose : Checks if theEdge2 lies on theEdge1. It is known that the -// boundary vertices of theEdge2 lie on theEdge1. -//======================================================================= - -static Standard_Boolean IsOverlapped(const TopoDS_Edge &theEdge1, - const TopoDS_Edge &theEdge2) -{ - Standard_Real aParF1, aParL1; - Standard_Real aParF2, aParL2; - Handle(Geom_Curve) aC1 = BRep_Tool::Curve(theEdge1, aParF1, aParL1); - Handle(Geom_Curve) aC2 = BRep_Tool::Curve(theEdge2, aParF2, aParL2); - - if (aC1.IsNull() || aC2.IsNull()) - return Standard_False; - - GeomAdaptor_Curve aGAC1(aC1, aParF1, aParL1); - GeomAdaptor_Curve aGAC2(aC2, aParF2, aParL2); - Extrema_ExtPC anExtPC; - Standard_Integer aNbPoints = 5; - Standard_Real aDelta = (aParL2 - aParF2)/(aNbPoints + 1.); - Standard_Real aCurPar = aParF2 + aDelta; - Standard_Integer i; - Standard_Real aMaxDist = Max(BRep_Tool::Tolerance(theEdge1), - BRep_Tool::Tolerance(theEdge2)); - - anExtPC.Initialize(aGAC1, aParF1, aParL1); - - for (i = 1; i <= aNbPoints; i++) { - gp_Pnt aPnt = aGAC2.Value(aCurPar); - - anExtPC.Perform(aPnt); - - if (!anExtPC.IsDone()) - return Standard_False; - - Standard_Integer j; - Standard_Integer aNbExt = anExtPC.NbExt(); - Standard_Boolean isPOnC1 = Standard_False; - - for (j = 1; j <= aNbExt && !isPOnC1; j++) { - if (anExtPC.IsMin(j)) { - gp_Pnt anExtP = anExtPC.Point(j).Value(); - - isPOnC1 = (aPnt.Distance(anExtP) <= aMaxDist); - } - } - if (!isPOnC1) - return Standard_False; - - aCurPar += aDelta; - } - - return Standard_True; -} - -//======================================================================= -//function : SplitEdge -//purpose : This function splits the edge into subedges by two given vertices. -//======================================================================= - -static void SplitEdge(const TopoDS_Edge &theEdge, - const TopTools_IndexedMapOfShape &theVertices, - TopTools_ListOfShape &theSplits) -{ - //const TopoDS_Edge aNewEdge; - TopoDS_Vertex aV1; - TopoDS_Vertex aV2; - BRep_Builder aBuilder; - - TopoDS_Edge aNewEdge = TopoDS::Edge(theEdge.Oriented(TopAbs_FORWARD).EmptyCopied()); - TopExp::Vertices(theEdge, aV1, aV2); - aBuilder.Add(aNewEdge, aV1); - -// Construction of the copied edge with -// the internal vertices of the map theVertices. - - Standard_Integer i; - - for (i = 1; i <= theVertices.Extent(); i++) - { - const TopoDS_Shape &theVtx = theVertices.FindKey(i); - - if (!aV1.IsSame(theVtx) && !aV2.IsSame(theVtx)) - aBuilder.Add(aNewEdge, theVtx.Oriented(TopAbs_INTERNAL)); - } - - aBuilder.Add(aNewEdge, aV2); - - theSplits.Clear(); - - // Splitting of the new edge. - if (!TopOpeBRepTool_TOOL::SplitE(aNewEdge, theSplits)) { - theSplits.Clear(); - theSplits.Append(theEdge); - - return; - } - - // Addition of the other internal vertices into the corresponding splits. - TopoDS_Iterator anIter(theEdge, Standard_False); - - for (; anIter.More(); anIter.Next()) - { - TopoDS_Vertex aCurVtx = TopoDS::Vertex(anIter.Value()); - - // for each vertex which is not the same as aV1, aV2, theIntV1 or theIntV2. - if (!aCurVtx.IsSame(aV1) && !aCurVtx.IsSame(aV2) && !theVertices.Contains(aCurVtx)) - { - TopTools_ListIteratorOfListOfShape anEdgeIter(theSplits); - Standard_Real aCurPar = BRep_Tool::Parameter(aCurVtx, theEdge); - - // Search for the split the current vertex belongs to. - for (; anEdgeIter.More(); anEdgeIter.Next()) - { - TopoDS_Edge anEdge = TopoDS::Edge(anEdgeIter.Value()); - Standard_Real aFPar; - Standard_Real aLPar; - - BRep_Tool::Range(anEdge, aFPar, aLPar); - - if (aCurPar > aFPar && aCurPar < aLPar) - { - aBuilder.Add(anEdge, aCurVtx); - break; - } - } - } - } - -// Setting the orientation of each split equal to the orientation of theEdge. - TopTools_ListIteratorOfListOfShape anEdgeIter(theSplits); - TopAbs_Orientation anOri = theEdge.Orientation(); - - for (; anEdgeIter.More(); anEdgeIter.Next()) - { - TopoDS_Shape &anEdge = anEdgeIter.Value(); - anEdge.Orientation(anOri); - } -} - -//======================================================================= -//function : RemoveCommonPart -//purpose : -//======================================================================= - -static void RemoveCommonPart - (const TopoDS_Edge &theE1, - const TopoDS_Edge &theE2, - TopTools_DataMapOfShapeListOfShape &theMapSubst) -{ - if (theMapSubst.IsBound(theE1)) { - const TopTools_ListOfShape &aLOfE1 = theMapSubst.Find(theE1); - TopTools_ListIteratorOfListOfShape anIter(aLOfE1); - -// For each split in the list aLOfE1 recursively call this function. - for (; anIter.More(); anIter.Next()) { - TopoDS_Edge anEdge1 = TopoDS::Edge(anIter.Value()); - - RemoveCommonPart(anEdge1, theE2, theMapSubst); - } - - return; - } - - if (theMapSubst.IsBound(theE2)) { - const TopTools_ListOfShape &aLOfE2 = theMapSubst.Find(theE2); - TopTools_ListIteratorOfListOfShape anIter(aLOfE2); - -// For each split in the list aLOfE2 recursively call this function. - for (; anIter.More(); anIter.Next()) { - TopoDS_Edge anEdge2 = TopoDS::Edge(anIter.Value()); - - RemoveCommonPart(theE1, anEdge2, theMapSubst); - } - - return; - } - - TopTools_IndexedMapOfShape aMapVtx; - TopTools_IndexedMapOfShape aMapCommonVtx; - -// Searching for common vertices: - TopExp::MapShapes(theE1, aMapVtx); - TopoDS_Iterator anIter(theE2, Standard_False); - - for (; anIter.More(); anIter.Next()) { - TopoDS_Shape aVtx = anIter.Value(); - - if (aMapVtx.Contains(aVtx)) { - aMapCommonVtx.Add(aVtx); - } - } - -// If there are at least two common vertices we can check overlapping: - if (aMapCommonVtx.Extent() <= 1) - return; - - TopTools_ListOfShape aSplits; - - SplitEdge(theE2, aMapCommonVtx, aSplits); - - TopTools_ListIteratorOfListOfShape aSplitIter(aSplits); - Standard_Boolean isModified = Standard_False; - - for (; aSplitIter.More();) { - TopoDS_Edge aSplit = TopoDS::Edge(aSplitIter.Value()); - - if (IsOverlapped(theE1, aSplit)) { -// Removal of overlapping split from the list of splits - aSplits.Remove(aSplitIter); - isModified = Standard_True; - } else { - aSplitIter.Next(); - } - } - -// If we deleted some splits, we should save the splits -// of theE2 in order to use them in further overlapping checks. - if (isModified) - theMapSubst.Bind(theE2, aSplits); -} - -//======================================================================= -//function : GetSplits -//purpose : This function removes returns the splits build from theEdge. -// If there are no ones the edge itself will be added to theSplits. -//======================================================================= - -static void GetSplits(const TopoDS_Shape &theEdge, - const TopTools_DataMapOfShapeListOfShape &theMapSubst, - TopTools_ListOfShape &theSplits) -{ - if (theMapSubst.IsBound(theEdge)) { - const TopTools_ListOfShape &theList = - theMapSubst.Find(theEdge); - TopTools_ListIteratorOfListOfShape anEdgeIter(theList); - - for (; anEdgeIter.More(); anEdgeIter.Next()) { - const TopoDS_Shape &anEdge = anEdgeIter.Value(); - - GetSplits(anEdge, theMapSubst, theSplits); - } - } else { - theSplits.Append(theEdge); - } -} - -//======================================================================= -//function : isWireModified -//purpose : Checks if the given wire was modified. -//======================================================================= - -static Standard_Boolean isWireModified - (const TopoDS_Shape &theWire, - const TopTools_DataMapOfShapeListOfShape &theMapSubst) -{ - TopExp_Explorer anExp(theWire, TopAbs_EDGE); - - for(; anExp.More(); anExp.Next()) { - const TopoDS_Shape &anEdge = anExp.Current(); - - if (theMapSubst.IsBound(anEdge)) - return Standard_True; - } - - return Standard_False; -} - -//======================================================================= -//function : RemoveOverlappedEdges -//purpose : This function removes doubled common parts of edges from theS2. -//======================================================================= - -static TopoDS_Shape RemoveOverlappedEdges - (const TopoDS_Shape &theS1, - const TopoDS_Shape &theS2, - TopTools_DataMapOfShapeListOfShape &theMapModif) -{ - TopExp_Explorer anExp1(theS1, TopAbs_EDGE); - TopTools_DataMapOfShapeListOfShape aMapModif; - -// For each couple of edges we remove a common part if any. - for(; anExp1.More(); anExp1.Next()) { - TopoDS_Edge anEdge1 = TopoDS::Edge(anExp1.Current()); - TopExp_Explorer anExp2(theS2, TopAbs_EDGE); - - for(; anExp2.More(); anExp2.Next()) { - TopoDS_Edge anEdge2 = TopoDS::Edge(anExp2.Current()); - - RemoveCommonPart(anEdge1, anEdge2, aMapModif); - } - } - -// Searching for built splits for every edge. - TopoDS_Shape aNewS; - TopoDS_Shape aNewS2; - BRep_Builder aBuilder; - - aBuilder.MakeCompound(TopoDS::Compound(aNewS)); - aBuilder.MakeCompound(TopoDS::Compound(aNewS2)); - aBuilder.Add(aNewS, theS1); - - TopExp_Explorer anExpWire(theS2, TopAbs_WIRE); - - for(; anExpWire.More(); anExpWire.Next()) { - const TopoDS_Shape &aWire = anExpWire.Current(); - - if (isWireModified(aWire, aMapModif)) { - TopExp_Explorer anExpEdge(aWire, TopAbs_EDGE); - TopoDS_Shape aNewComp; - - aBuilder.MakeCompound(TopoDS::Compound(aNewComp)); - - for(; anExpEdge.More(); anExpEdge.Next()) { - const TopoDS_Shape &anEdge = anExpEdge.Current(); - TopTools_ListOfShape aSplits; - - GetSplits(anEdge, aMapModif, aSplits); - - if (!aSplits.IsEmpty() && !anEdge.IsSame(aSplits.First())) { - if (!theMapModif.IsBound(anEdge)) - theMapModif.Bind(anEdge, aSplits); - } else if (aSplits.IsEmpty()) { - theMapModif.Bind(anEdge, aSplits); - } - - TopTools_ListIteratorOfListOfShape aSplitIter(aSplits); - - for (; aSplitIter.More(); aSplitIter.Next()) { - const TopoDS_Shape &aSplit = aSplitIter.Value(); - - aBuilder.Add(aNewComp, aSplit); - } - } - -// Addition of new compound if it is not empty - TopoDS_Iterator aSubShIter(aNewComp); - - if (aSubShIter.More()) - aBuilder.Add(aNewS2, aNewComp); - } else { - aBuilder.Add(aNewS2, aWire); - } - } - -// Addition of new shape if it is not empty - TopoDS_Iterator aSubShIter(aNewS2); - - if (aSubShIter.More()) - aBuilder.Add(aNewS, aNewS2); - - return aNewS; -} - -//======================================================================= -//function : FillMapModif -//purpose : This function fills the map of modified sub-shapes of theShape -//======================================================================= - -static void FillMapModif(const BRepTools_Substitution &theSubst, - const TopoDS_Shape &theShape, - TopTools_DataMapOfShapeListOfShape &theMapModif) -{ - TopAbs_ShapeEnum aType = theShape.ShapeType(); - - if (aType == TopAbs_EDGE || aType == TopAbs_VERTEX) { - if (theSubst.IsCopied(theShape)) { - const TopTools_ListOfShape &aModifShapes = theSubst.Copy(theShape); - - if (!theMapModif.IsBound(theShape)) - theMapModif.Bind(theShape, aModifShapes); - } - } - - TopoDS_Iterator anIter(theShape, Standard_False); - TopTools_MapOfShape aUsedShapes; - - for (; anIter.More(); anIter.Next()) { - const TopoDS_Shape &aSubShape = anIter.Value(); - - if (!aUsedShapes.Add(aSubShape)) - continue; - - FillMapModif(theSubst, aSubShape, theMapModif); - } -} - -//======================================================================= -//function : PerformWires -//purpose : gluing two wires -//======================================================================= - -void -QANewModTopOpe_Glue::PerformWires() -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - Standard_Boolean S1IsEdge = Standard_False, S2IsEdge = Standard_False; - if(myS1.ShapeType() == TopAbs_EDGE) { - myS1 = BRepBuilderAPI_MakeWire(TopoDS::Edge(myS1)); - S1IsEdge = Standard_True; - } - if(myS2.ShapeType() == TopAbs_EDGE) { - myS2 = BRepBuilderAPI_MakeWire(TopoDS::Edge(myS2)); - S2IsEdge = Standard_True; - } - - TopoDS_Shape aS1F = myS1.Oriented(TopAbs_FORWARD); - TopoDS_Shape aS2F = myS2.Oriented(TopAbs_FORWARD); - BRepExtrema_DistShapeShape aExtrema (aS1F, aS2F); - if (!aExtrema.IsDone()) - return; - - // process extrema points - - TColStd_SequenceOfInteger VVInt; - TColStd_SequenceOfInteger VEInt; - TColStd_SequenceOfInteger EEInt; - - - Standard_Boolean anIsCoincided = Standard_False; - Standard_Boolean S1IsVert = Standard_True; - Standard_Boolean S2IsVert = Standard_True; - Standard_Real aTol1, aTol2; - Standard_Integer nbSol = aExtrema.NbSolution(), i, j, k; - Standard_Real aDist = aExtrema.Value(); - for (i=1; i <= nbSol; i++) { - TopoDS_Shape aS1 = aExtrema.SupportOnShape1(i); - TopoDS_Shape aS2 = aExtrema.SupportOnShape2(i); - S1IsVert = Standard_True; - S2IsVert = Standard_True; - // check distance against tolerances - if (aS1.ShapeType() == TopAbs_VERTEX) - aTol1 = BRep_Tool::Tolerance (TopoDS::Vertex(aS1)); - else { - aTol1 = BRep_Tool::Tolerance (TopoDS::Edge(aS1)); - S1IsVert = Standard_False; - } - - if (aS2.ShapeType() == TopAbs_VERTEX) - aTol2 = BRep_Tool::Tolerance (TopoDS::Vertex(aS2)); - else { - aTol2 = BRep_Tool::Tolerance (TopoDS::Edge(aS2)); - S2IsVert = Standard_False; - } - - if (aDist > aTol1 + aTol2) continue; - - anIsCoincided = Standard_True; - - if(S1IsVert && S2IsVert) { - if(!aS1.IsSame(aS2)) VVInt.Append(i); - } - else if(S1IsVert || S2IsVert) - VEInt.Append(i); - else - EEInt.Append(i); - } - - if(!anIsCoincided) return; - - BRep_Builder aBld; - TColgp_SequenceOfPnt aPoints1; - TColgp_SequenceOfPnt aPoints2; - TopTools_DataMapOfShapeListOfShape aMapSubst; - - for(k = 1; k <= VVInt.Length(); k++) { - // avoid to process the same points twice - i = VVInt(k); - gp_Pnt aPnt1 = aExtrema.PointOnShape1(i); - gp_Pnt aPnt2 = aExtrema.PointOnShape2(i); - for (j=1; j<=aPoints1.Length(); j++) { - if (aPnt1.IsEqual(aPoints1(j),Precision::Confusion()) && - aPnt2.IsEqual(aPoints2(j),Precision::Confusion())) { - break; - } - } - if (j <= aPoints1.Length()) continue; - aPoints1.Append (aPnt1); - aPoints2.Append (aPnt2); - - const TopoDS_Vertex& aVer1 = TopoDS::Vertex(aExtrema.SupportOnShape1(i)); - const TopoDS_Vertex& aVer2 = TopoDS::Vertex(aExtrema.SupportOnShape2(i)); - aTol1 = BRep_Tool::Tolerance(aVer1); - aTol2 = BRep_Tool::Tolerance(aVer2); - aTol1 = Max(aTol1, aTol2 + aDist); - gp_Pnt aP = BRep_Tool::Pnt(aVer1); - aBld.UpdateVertex (aVer1, aP, aTol1); - TopTools_ListOfShape aList; - aList.Append (aVer1); - aMapSubst.Bind (aVer2, aList); - - } - - for(k = 1; k <= VEInt.Length(); k++) { - // avoid to process the same points twice - i = VEInt(k); - gp_Pnt aPnt1 = aExtrema.PointOnShape1(i); - gp_Pnt aPnt2 = aExtrema.PointOnShape2(i); - for (j=1; j<=aPoints1.Length(); j++) { - if (aPnt1.IsEqual(aPoints1(j),Precision::Confusion()) && - aPnt2.IsEqual(aPoints2(j),Precision::Confusion())) { - break; - } - } - if (j <= aPoints1.Length()) continue; - aPoints1.Append (aPnt1); - aPoints2.Append (aPnt2); - - TopoDS_Shape aS1 = aExtrema.SupportOnShape1(i); - TopoDS_Shape aS2 = aExtrema.SupportOnShape2(i); - - if(aS1.ShapeType() == TopAbs_VERTEX) { - TopoDS_Vertex& aVer1 = TopoDS::Vertex(aS1); - const TopoDS_Edge& aE2 = TopoDS::Edge(aS2); - aTol1 = BRep_Tool::Tolerance(aVer1); - aTol2 = BRep_Tool::Tolerance(aE2); - aTol1 = Max(aTol1, aTol2 + aDist); - gp_Pnt aP = BRep_Tool::Pnt(aVer1); - aBld.UpdateVertex (aVer1, aP, aTol1); - Standard_Real aPar; - aExtrema.ParOnEdgeS2(i, aPar); - if (!aMapSubst.IsBound(aE2)) { - // for Mandrake-10 - mkv,02.06.06 - aMapSubst.Bind (aE2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape1; - aMapSubst.Bind (aE2, aListOfShape1); - } - TopTools_ListOfShape& aListSubst = aMapSubst(aE2); - TopoDS_Edge aEdge; - if (aListSubst.IsEmpty()) { - aEdge = aE2; - } - else { - aEdge = TopoDS::Edge(aListSubst.First()); - aListSubst.Clear(); - } - - TopoDS_Edge aNewEdge; - QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVer1, aPar, aNewEdge); - aListSubst.Append (aNewEdge); - } - else { - TopoDS_Vertex& aVer1 = TopoDS::Vertex(aS2); - const TopoDS_Edge& aE2 = TopoDS::Edge(aS1); - aTol1 = BRep_Tool::Tolerance(aVer1); - aTol2 = BRep_Tool::Tolerance(aE2); - aTol1 = Max(aTol1, aTol2 + aDist); - gp_Pnt aP = BRep_Tool::Pnt(aVer1); - aBld.UpdateVertex (aVer1, aP, aTol1); - Standard_Real aPar; - aExtrema.ParOnEdgeS1(i, aPar); - if (!aMapSubst.IsBound(aE2)) { - // for Mandrake-10 - mkv,02.06.06 - aMapSubst.Bind (aE2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape2; - aMapSubst.Bind (aE2, aListOfShape2); - } - TopTools_ListOfShape& aListSubst = aMapSubst(aE2); - TopoDS_Edge aEdge; - if (aListSubst.IsEmpty()) { - aEdge = aE2; - } - else { - aEdge = TopoDS::Edge(aListSubst.First()); - aListSubst.Clear(); - } - - TopoDS_Edge aNewEdge; - QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVer1, aPar, aNewEdge); - aListSubst.Append (aNewEdge); - } - } - - for(k = 1; k <= EEInt.Length(); k++) { - // avoid to process the same points twice - i = EEInt(k); - gp_Pnt aPnt1 = aExtrema.PointOnShape1(i); - gp_Pnt aPnt2 = aExtrema.PointOnShape2(i); - for (j=1; j<=aPoints1.Length(); j++) { - if (aPnt1.IsEqual(aPoints1(j),Precision::Confusion()) && - aPnt2.IsEqual(aPoints2(j),Precision::Confusion())) { - break; - } - } - if (j <= aPoints1.Length()) continue; - aPoints1.Append (aPnt1); - aPoints2.Append (aPnt2); - - const TopoDS_Edge& aE1 = TopoDS::Edge(aExtrema.SupportOnShape1(i)); - const TopoDS_Edge& aE2 = TopoDS::Edge(aExtrema.SupportOnShape2(i)); - - aTol1 = BRep_Tool::Tolerance(aE1); - aTol2 = BRep_Tool::Tolerance(aE2); - gp_Pnt aP((aPnt1.X() + aPnt2.X())*.5, (aPnt1.Y() + aPnt2.Y())*.5, (aPnt1.Z() + aPnt2.Z())*.5); - aTol1 = Max(aTol1+.5*aDist, aTol2+.5*aDist); - aTol1 = Max(aTol1, Precision::Confusion()); - - TopoDS_Vertex aVer; - aBld.MakeVertex(aVer, aP, aTol1); - - Standard_Real aPar; - aExtrema.ParOnEdgeS1(i, aPar); - if (!aMapSubst.IsBound(aE1)) { - // for Mandrake-10 - mkv,02.06.06 - aMapSubst.Bind (aE1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - aMapSubst.Bind (aE1, aListOfShape3); - } - TopTools_ListOfShape& aListSubst1 = aMapSubst(aE1); - TopoDS_Edge aEdge; - if (aListSubst1.IsEmpty()) { - aEdge = aE1; - } - else { - aEdge = TopoDS::Edge(aListSubst1.First()); - aListSubst1.Clear(); - } - - TopoDS_Edge aNewEdge; - QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVer, aPar, aNewEdge); - aListSubst1.Append (aNewEdge); - - if(!myMapGener.IsBound(aE1)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aE1, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape4; - myMapGener.Bind(aE1, aListOfShape4); - } - myMapGener(aE1).Append(aVer); - - aExtrema.ParOnEdgeS2(i, aPar); - if (!aMapSubst.IsBound(aE2)) { - // for Mandrake-10 - mkv,02.06.06 - aMapSubst.Bind (aE2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape5; - aMapSubst.Bind (aE2, aListOfShape5); - } - TopTools_ListOfShape& aListSubst2 = aMapSubst(aE2); - if (aListSubst2.IsEmpty()) { - aEdge = aE2; - } - else { - aEdge = TopoDS::Edge(aListSubst2.First()); - aListSubst2.Clear(); - } - - QANewModTopOpe_Glue::InsertVertexInEdge (aEdge, aVer, aPar, aNewEdge); - aListSubst2.Append (aNewEdge); - - if(!myMapGener.IsBound(aE2)) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aE2, TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape6; - myMapGener.Bind(aE2, aListOfShape6); - } - myMapGener(aE2).Append(aVer); - - } - - aBld.MakeCompound (TopoDS::Compound(myShape)); - aBld.Add(myShape, myS1); - aBld.Add(myShape, myS2); - - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aIterM(aMapSubst); - for (; aIterM.More(); aIterM.Next()) { - TopAbs_Orientation aOri = TopAbs_FORWARD; - TopTools_ListIteratorOfListOfShape aIt (aIterM.Value()); - for (; aIt.More(); aIt.Next()) aIt.Value().Orientation(aOri); - if(aIterM.Key().ShapeType() == TopAbs_EDGE) { - TopoDS_Edge aEdge = TopoDS::Edge(aIterM.Value().First()); - TopTools_ListOfShape& aListSubst = aMapSubst(aIterM.Key()); - aListSubst.Clear(); - if(!TopOpeBRepTool_TOOL::SplitE(aEdge, aListSubst)) { - aListSubst.Append(aEdge); - } - } - mySubst.Substitute (aIterM.Key(), aIterM.Value()); -// aOri = aIterM.Key().Orientation(); -// aIt.Initialize (aIterM.Value()); -// for (; aIt.More(); aIt.Next()) aIt.Value().Orientation(aOri); -// myMapModif.Bind (aIterM.Key(), aIterM.Value()); - } - - mySubst.Build(myShape); - - FillMapModif(mySubst, myS1, myMapModif); - FillMapModif(mySubst, myS2, myMapModif); - - if (mySubst.IsCopied(myS1) || mySubst.IsCopied(myS2)) { - TopoDS_Shape aNewS1; - TopoDS_Shape aNewS2; - - if (mySubst.IsCopied(myS1)) - aNewS1 = mySubst.Copy(myS1).First(); - else - aNewS1 = myS1; - - if(S1IsEdge) { - TopoDS_Iterator aTDIt(aNewS1); - TopoDS_Shape aE = aTDIt.Value(); - aTDIt.Next(); - if(!aTDIt.More()) aNewS1 = aE; - } - - if (mySubst.IsCopied(myS2)) - aNewS2 = mySubst.Copy(myS2).First(); - else - aNewS2 = myS2; - - if(S2IsEdge) { - TopoDS_Iterator aTDIt(aNewS2); - TopoDS_Shape aE = aTDIt.Value(); - aTDIt.Next(); - if(!aTDIt.More()) aNewS2 = aE; - } - - myShape = RemoveOverlappedEdges(aNewS1, aNewS2, myMapModif); - } - - Done(); -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Intersection.cxx b/src/QANewModTopOpe/QANewModTopOpe_Intersection.cxx deleted file mode 100644 index 7069115a46..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Intersection.cxx +++ /dev/null @@ -1,360 +0,0 @@ -// Created on: 2000-12-25 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2000-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static Standard_Boolean NoFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2) -{ - TopExp_Explorer Ex; - Ex.Init(S1,TopAbs_FACE); - Standard_Boolean f1 = Ex.More(); - Ex.Init(S2,TopAbs_FACE); - Standard_Boolean f2 = Ex.More(); - - return !f1&&!f2; -} - -//======================================================================= -//function : QANewModTopOpe_Intersection -//purpose : -//======================================================================= -QANewModTopOpe_Intersection::QANewModTopOpe_Intersection - ( const TopoDS_Shape& theObject1, - const TopoDS_Shape& theObject2 ) -: - BRepAlgoAPI_BooleanOperation( theObject1, theObject2, BOPAlgo_SECTION) -{ - TopoDS_Shape& myS1=myArguments.First(); - TopoDS_Shape& myS2=myTools.First(); - - myMapGener.Clear(); - - if(NoFaces(myS1, myS2)) { - - BRep_Builder BB; - BB.MakeCompound(TopoDS::Compound(myShape)); - - BRepExtrema_DistShapeShape DSS(myS1, myS2); - - - if(DSS.IsDone() && DSS.NbSolution() > 0) { - Standard_Integer nbs = DSS.NbSolution(); - Standard_Real mindist = DSS.Value(); - Standard_Real maxtol = 0., tol; - TopExp_Explorer ExV; - for(ExV.Init(myS1,TopAbs_VERTEX); ExV.More(); ExV.Next()) { - TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current()); - tol=BRep_Tool::Tolerance(Vertex); - if(tol > maxtol) maxtol = tol; - } - - for(ExV.Init(myS2,TopAbs_VERTEX); ExV.More(); ExV.Next()) { - TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current()); - tol=BRep_Tool::Tolerance(Vertex); - if(tol > maxtol) maxtol = tol; - } - - if(mindist <= maxtol) { - tol = maxtol*maxtol; - Standard_Integer i; - - for(i = 1; i <= nbs; i++) { - gp_Pnt p1 = DSS.PointOnShape1(i); - gp_Pnt p2 = DSS.PointOnShape2(i); - if(p1.SquareDistance(p2) > tol) continue; - BRepExtrema_SupportType aSupTyp = DSS. SupportTypeShape1(i); - if(aSupTyp == BRepExtrema_IsVertex) { - BB.Add(myShape, DSS.SupportOnShape1(i)); - } - else { - aSupTyp = DSS. SupportTypeShape2(i); - if(aSupTyp == BRepExtrema_IsVertex) { - BB.Add(myShape, DSS.SupportOnShape2(i)); - } - else { - gp_Pnt p(.5*(p1.XYZ()+p2.XYZ())); - BRepBuilderAPI_MakeVertex mkV(p); - BB.Add(myShape, mkV.Vertex()); - - if (!myMapGener.IsBound(DSS. SupportOnShape1(i))) { - - TopTools_ListOfShape aListOfShape1; - myMapGener.Bind(DSS.SupportOnShape1(i), aListOfShape1); - } - myMapGener(DSS.SupportOnShape1(i)).Append(mkV.Vertex()); - - if (!myMapGener.IsBound(DSS.SupportOnShape2(i))) { - - TopTools_ListOfShape aListOfShape2; - myMapGener.Bind(DSS.SupportOnShape2(i), aListOfShape2); - } - myMapGener(DSS.SupportOnShape2(i)).Append(mkV.Vertex()); - - } - - } - } - } - } - - Done(); - return; - } - Build(); - - Standard_Boolean bcw = BuilderCanWork(); - - if ( ! bcw ) return; - - BRep_Builder BB; - BB.MakeCompound(TopoDS::Compound(myShape)); - TopTools_ListIteratorOfListOfShape itloe(SectionEdges()); - - if(itloe.More()) { - - for(; itloe.More(); itloe.Next()) BB.Add(myShape,itloe.Value()); - - // try to make wire from set of edges - TopTools_ListOfShape LOEdge; - TopTools_ListOfShape LOSEdge; - Standard_Integer nbe = 0; - TopoDS_Shape aux; - TopExp_Explorer Ex; - BB.MakeCompound(TopoDS::Compound(aux)); - for(Ex.Init(myShape,TopAbs_EDGE); Ex.More(); Ex.Next()) { - LOEdge.Append(Ex.Current()); - LOSEdge.Append(Ex.Current()); - nbe++; - } - BRepAlgo_EdgeConnector EC; - TopoDS_Shape se = LOEdge.First(); - EC.Add(LOEdge); - EC.AddStart(LOSEdge); - const TopTools_ListOfShape& LOWire = EC.MakeBlock(); - TopTools_ListIteratorOfListOfShape its; - for(its.Initialize(LOWire);its.More();its.Next()) { - BB.Add(aux,its.Value()); - } - for(Ex.Init(aux,TopAbs_EDGE); Ex.More(); Ex.Next()) { - nbe--; - } - if(nbe == 0) myShape = aux; - - } - else { - // check if there are new vertices - IFV - - Standard_Integer nbp = QANewModTopOpe_Tools::NbPoints(myDSFiller); - - if(nbp > 0) { - - TopoDS_Shape aux1, aux2; - BB.MakeCompound(TopoDS::Compound(aux1)); - BB.MakeCompound(TopoDS::Compound(aux2)); - - BB.Add(aux1, myS1); - BB.Add(aux1, myS2); - - Standard_Integer i; - Standard_Real maxtol = 0., tol; - - for(i = 1; i <= nbp; i++) { - TopoDS_Vertex aVertex= - TopoDS::Vertex(QANewModTopOpe_Tools::NewVertex(myDSFiller, i)); - - tol=BRep_Tool::Tolerance(aVertex); - if(tol > maxtol) maxtol = tol; - BB.Add(aux2, aVertex); - } - - BRepExtrema_DistShapeShape DSS(aux1, aux2); - if(DSS.IsDone() && DSS.NbSolution() > 0) { - Standard_Integer nbs = DSS.NbSolution(); - Standard_Real mindist = DSS.Value(); - if(mindist <= maxtol) { - tol = maxtol*maxtol; - - TopTools_MapOfShape aMap; - - for(i = 1; i <= nbs; i++) { - gp_Pnt p1 = DSS.PointOnShape1(i); - gp_Pnt p2 = DSS.PointOnShape2(i); - if(p1.SquareDistance(p2) > tol) continue; - BRepExtrema_SupportType aSupTyp = DSS.SupportTypeShape1(i); - TopoDS_Vertex aVertex; - if(aSupTyp == BRepExtrema_IsVertex) { - aVertex = TopoDS::Vertex(DSS.SupportOnShape1(i)); - TopoDS_Iterator anIter(myShape); - Standard_Boolean anIsNew = Standard_True; - for(; anIter.More(); anIter.Next()) { - if(BRepTools::Compare(aVertex, TopoDS::Vertex(anIter.Value()))) { - anIsNew = Standard_False; - break; - } - } - if(anIsNew) { - BB.Add(myShape, aVertex); - } - } - else { - aVertex = TopoDS::Vertex(DSS.SupportOnShape2(i)); - if(aMap.Add(aVertex)) BB.Add(myShape, aVertex); - if (!myMapGener.IsBound(DSS.SupportOnShape1(i))) { - // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape1(i), TopTools_ListOfShape()); - TopTools_ListOfShape aListOfShape3; - myMapGener.Bind(DSS.SupportOnShape1(i), aListOfShape3); - } - myMapGener(DSS.SupportOnShape1(i)).Append(aVertex); - - } - } // end for - } - } - } - } - - - Done(); - -} - -//======================================================================= -//function : Generated -//purpose : gives list of shape generated from shape S -//======================================================================= -const TopTools_ListOfShape& QANewModTopOpe_Intersection::Generated(const TopoDS_Shape& theS) -{ - myGenerated.Clear(); - - if(theS.ShapeType() == TopAbs_FACE || theS.ShapeType() == TopAbs_EDGE) { - if (BRepAlgoAPI_BooleanOperation::HasGenerated()) { - const TopTools_ListOfShape &aLOfShape = - BRepAlgoAPI_BooleanOperation::Generated(theS); - TopTools_ListIteratorOfListOfShape anIter(aLOfShape); - - for (; anIter.More(); anIter.Next()) { - const TopoDS_Shape &aGenShape = anIter.Value(); - - if (aGenShape.ShapeType() == TopAbs_VERTEX) - continue; - - myGenerated.Append(aGenShape); - } - } - - if(myMapGener.IsBound(theS)) { - TopTools_ListIteratorOfListOfShape anIter(myMapGener(theS)); - - for(; anIter.More(); anIter.Next()) - myGenerated.Append(anIter.Value()); - } - } - - return myGenerated; - -} - -//======================================================================= -//function : HasGenerated -//purpose : -//======================================================================= -Standard_Boolean QANewModTopOpe_Intersection::HasGenerated() const -{ - Standard_Boolean aHasGenerated = Standard_False; - - if (BRepAlgoAPI_BooleanOperation::HasGenerated()) { - aHasGenerated = Standard_True; - } - else { - aHasGenerated = !myMapGener.IsEmpty(); - } - return aHasGenerated; -} - - -//======================================================================= -//function : IsDeleted -//purpose : -//======================================================================= -Standard_Boolean QANewModTopOpe_Intersection::IsDeleted(const TopoDS_Shape& aS) -{ - if(BRepAlgoAPI_BooleanOperation::IsDeleted(aS)) - return Standard_True; - - if(myMapGener.IsBound(aS)) - return Standard_False; - return Standard_True; -} - -//======================================================================= -//function : HasDeleted -//purpose : -//======================================================================= -Standard_Boolean QANewModTopOpe_Intersection::HasDeleted() const -{ - const TopoDS_Shape& myS1=myArguments.First(); - const TopoDS_Shape& myS2=myTools.First(); - - TopExp_Explorer anExp; - - for(Standard_Integer argit = 0; argit < 2; argit++) { - Standard_Boolean bTillVertex = Standard_True; - - if(argit == 0) - anExp.Init(myS1, TopAbs_FACE); - else - anExp.Init(myS2, TopAbs_FACE); - - if(anExp.More()) - bTillVertex = Standard_False; - Standard_Integer nb = (bTillVertex) ? 3 : 2; - - for(Standard_Integer i = 0; i < nb; i++) { - TopAbs_ShapeEnum aType = (i == 0) ? TopAbs_FACE : ((i == 1) ? TopAbs_EDGE : TopAbs_VERTEX); - - if(argit == 0) - anExp.Init(myS1, aType); - else - anExp.Init(myS2, aType); - - for(; anExp.More(); anExp.Next()) { - if(!myMapGener.IsBound(anExp.Current())) { - return Standard_True; - } - } - } - } - return Standard_False; -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Intersection.hxx b/src/QANewModTopOpe/QANewModTopOpe_Intersection.hxx deleted file mode 100644 index 4983886e8b..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Intersection.hxx +++ /dev/null @@ -1,77 +0,0 @@ -// Created on: 2000-12-25 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2000-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. - -#ifndef _QANewModTopOpe_Intersection_HeaderFile -#define _QANewModTopOpe_Intersection_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -class TopoDS_Shape; - - -//! provides intersection of two shapes; -class QANewModTopOpe_Intersection : public BRepAlgoAPI_BooleanOperation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT QANewModTopOpe_Intersection(const TopoDS_Shape& theObject1, const TopoDS_Shape& theObject2); - - //! Returns the list of shapes generated from the shape . - Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE; - - //! Returns true if there is at least one generated shape. - //! For use in BRepNaming. - Standard_EXPORT virtual Standard_Boolean HasGenerated() const Standard_OVERRIDE; - - Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& aS) Standard_OVERRIDE; - - //! Returns true if there is at least one deleted shape. - //! For use in BRepNaming. - Standard_EXPORT virtual Standard_Boolean HasDeleted() const Standard_OVERRIDE; - - - - -protected: - - - - - -private: - - - - TopTools_DataMapOfShapeListOfShape myMapGener; - - -}; - - - - - - - -#endif // _QANewModTopOpe_Intersection_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_Limitation.cxx b/src/QANewModTopOpe/QANewModTopOpe_Limitation.cxx deleted file mode 100644 index 87023de185..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Limitation.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// Created on: 2001-05-06 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2001-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static TopoDS_Shape MakeCutTool(const TopoDS_Shape& theS2) -{ - TopoDS_Shape aRealCutTool, aSh; - BRep_Builder aBB; - - aBB.MakeSolid(TopoDS::Solid(aRealCutTool)); - aBB.MakeShell(TopoDS::Shell(aSh)); - - TopExp_Explorer anExp; - - anExp.Init(theS2,TopAbs_FACE); - - for(; anExp.More(); anExp.Next()) aBB.Add(aSh, anExp.Current()); - aBB.Add(aRealCutTool, aSh); - - return aRealCutTool; -} - - -QANewModTopOpe_Limitation::QANewModTopOpe_Limitation(const TopoDS_Shape& theObjectToCut, - const TopoDS_Shape& theCutTool, - const QANewModTopOpe_ModeOfLimitation theMode) : - myObjectToCut(theObjectToCut), - myCut(NULL), - myCommon(NULL), - myFwdIsDone(Standard_False), - myRevIsDone(Standard_False), - myMode(theMode) -{ - - TopExp_Explorer anExp; - anExp.Init(theCutTool,TopAbs_FACE); - - if(!anExp.More()) return; - - myCutTool = MakeCutTool(theCutTool); - - Cut(); - -} - -void QANewModTopOpe_Limitation::Cut() -{ - - NotDone(); - - if(myMode == QANewModTopOpe_Forward) { - if(!myFwdIsDone) { - myCut = new BRepAlgoAPI_Cut(myObjectToCut, myCutTool); - if(myCut->IsDone()) { - myResultFwd = myCut->Shape(); - myFwdIsDone = Standard_True; - } - } - if(myFwdIsDone) { - myShape = myResultFwd; - Done(); - } - } - else if (myMode == QANewModTopOpe_Reversed) { - if(!myRevIsDone) { - myCommon = new BRepAlgoAPI_Common(myObjectToCut, myCutTool); - if(myCommon->IsDone()) { - myResultRvs = myCommon->Shape(); - myRevIsDone = Standard_True; - } - } - if(myRevIsDone) { - myShape = myResultRvs; - Done(); - } - } - else if (myMode == QANewModTopOpe_BothParts) { - if(!myFwdIsDone) { - myCut = new BRepAlgoAPI_Cut(myObjectToCut, myCutTool); - if(myCut->IsDone()) { - myResultFwd = myCut->Shape(); - myFwdIsDone = Standard_True; - } - } - - if(!myRevIsDone) { - myCommon = new BRepAlgoAPI_Common(myObjectToCut, myCutTool); - if(myCommon->IsDone()) { - myResultRvs = myCommon->Shape(); - myRevIsDone = Standard_True; - } - } - - if(myFwdIsDone && myRevIsDone) { - myShape.Nullify(); - BRep_Builder aBB; - aBB.MakeCompound(TopoDS::Compound(myShape)); - TopoDS_Iterator aItr; - aItr.Initialize(myResultFwd, Standard_False, Standard_False); - for(; aItr.More(); aItr.Next()) aBB.Add(myShape, aItr.Value()); - - aItr.Initialize(myResultRvs, Standard_False, Standard_False); - for(; aItr.More(); aItr.Next()) aBB.Add(myShape, aItr.Value()); - - Done(); - } - - } - else { - throw Standard_ConstructionError("QANewModTopOpe_Limitation : wrong mode"); - } - - -} - -void QANewModTopOpe_Limitation::SetMode(const QANewModTopOpe_ModeOfLimitation theMode) -{ - myMode = theMode; -} - -QANewModTopOpe_ModeOfLimitation QANewModTopOpe_Limitation::GetMode() const -{ - return myMode; -} - -const TopoDS_Shape& QANewModTopOpe_Limitation::Shape1() const -{ - return myObjectToCut; -} - -const TopoDS_Shape& QANewModTopOpe_Limitation::Shape2() const -{ - return myCutTool; -} - - -//======================================================================= -//function : Modified -//purpose : -//======================================================================= - -const TopTools_ListOfShape& QANewModTopOpe_Limitation::Modified(const TopoDS_Shape& S) -{ - Check(); - myGenerated.Clear(); - if(myMode == QANewModTopOpe_Forward) { - myGenerated = myCut->Modified(S); - } - else if(myMode == QANewModTopOpe_Reversed) { - myGenerated = myCommon->Modified(S); - } - else { - myGenerated = myCut->Modified(S); - - TopTools_MapOfShape aMap; // to check if shape can be added in list more then one time - TopTools_ListIteratorOfListOfShape It(myGenerated); - for(;It.More();It.Next()) { - aMap.Add(It.Value()); - } - - It.Initialize(myCommon->Modified(S)); - for(;It.More();It.Next()) { - if(aMap.Add(It.Value())) myGenerated.Append(It.Value()); - } - } - - return myGenerated; -} - -// ================================================================================================ -// function: Generated -// purpose: -// ================================================================================================ -const TopTools_ListOfShape& QANewModTopOpe_Limitation::Generated(const TopoDS_Shape& S) -{ - Check(); - myGenerated.Clear(); - if(myMode == QANewModTopOpe_Forward) { - myGenerated = myCut->Generated(S); - } - else if(myMode == QANewModTopOpe_Reversed) { - myGenerated = myCommon->Generated(S); - } - else { - myGenerated = myCut->Generated(S); - - TopTools_MapOfShape aMap; // to check if shape can be added in list more then one time - TopTools_ListIteratorOfListOfShape It(myGenerated); - for(;It.More();It.Next()) { - aMap.Add(It.Value()); - } - - It.Initialize(myCommon->Generated(S)); - for(;It.More();It.Next()) { - if(aMap.Add(It.Value())) myGenerated.Append(It.Value()); - } - } - - return myGenerated; -} - -// ================================================================================================ -// function: HasModified -// purpose: -// ================================================================================================ -Standard_Boolean QANewModTopOpe_Limitation::HasModified() const -{ - Check(); - if(myMode == QANewModTopOpe_Forward) { - return myCut->HasModified(); - } - else if(myMode == QANewModTopOpe_Reversed) { - return myCommon->HasModified(); - } - else { - return myCut->HasModified() || myCommon->HasModified(); - } -} - -// ================================================================================================ -// function: HasGenerated -// purpose: -// ================================================================================================ -Standard_Boolean QANewModTopOpe_Limitation::HasGenerated() const -{ - Check(); - if(myMode == QANewModTopOpe_Forward) { - return myCut->HasGenerated(); - } - else if(myMode == QANewModTopOpe_Reversed) { - return myCommon->HasGenerated(); - } - else { - return myCut->HasGenerated() || myCommon->HasGenerated(); - } -} - -// ================================================================================================ -// function: HasDeleted -// purpose: -// ================================================================================================ -Standard_Boolean QANewModTopOpe_Limitation::HasDeleted() const -{ - Check(); - if(myMode == QANewModTopOpe_Forward) { - return myCut->HasDeleted(); - } - else if(myMode == QANewModTopOpe_Reversed) { - return myCommon->HasDeleted(); - } - else { - return myCut->HasDeleted() || myCommon->HasDeleted(); - } -} - -Standard_Boolean QANewModTopOpe_Limitation::IsDeleted(const TopoDS_Shape& S) -{ - - Check(); - if(myMode == QANewModTopOpe_Forward) { - return myCut->IsDeleted(S); - } - else if(myMode == QANewModTopOpe_Reversed) { - return myCommon->IsDeleted(S); - } - else { - return myCut->IsDeleted(S) && myCommon->IsDeleted(S); - } - -} - -QANewModTopOpe_Limitation::~QANewModTopOpe_Limitation() -{ - delete myCut; - delete myCommon; -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Limitation.hxx b/src/QANewModTopOpe/QANewModTopOpe_Limitation.hxx deleted file mode 100644 index 1aef94f1b6..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Limitation.hxx +++ /dev/null @@ -1,109 +0,0 @@ -// Created on: 2001-05-03 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2001-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. - -#ifndef _QANewModTopOpe_Limitation_HeaderFile -#define _QANewModTopOpe_Limitation_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class TopoDS_Shape; - - -//! provides cutting shape by face or shell; -class QANewModTopOpe_Limitation : public BRepBuilderAPI_MakeShape -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! initializes and fills data structure for cutting and - //! makes cutting according to orientation theCutTool and - //! theMode. - //! if theCutTool is not face or shell does nothing. - Standard_EXPORT QANewModTopOpe_Limitation(const TopoDS_Shape& theObjectToCut, const TopoDS_Shape& theCutTool, const QANewModTopOpe_ModeOfLimitation theMode = QANewModTopOpe_Forward); - - //! makes cutting according to orientation theCutTool - //! and current value of myMode. Does nothing if - //! result already exists. - Standard_EXPORT void Cut(); - - Standard_EXPORT void SetMode (const QANewModTopOpe_ModeOfLimitation theMode); - - Standard_EXPORT QANewModTopOpe_ModeOfLimitation GetMode() const; - - //! Returns the first shape. - Standard_EXPORT const TopoDS_Shape& Shape1() const; - - //! Returns the second shape. - Standard_EXPORT const TopoDS_Shape& Shape2() const; - - //! Returns the list of shapes modified from the shape - //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE; - - //! Returns the list of shapes generated from the shape . - //! For use in BRepNaming. - Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE; - - //! Returns true if there is at least one modified shape. - //! For use in BRepNaming. - Standard_EXPORT virtual Standard_Boolean HasModified() const; - - //! Returns true if there is at least one generated shape. - //! For use in BRepNaming. - Standard_EXPORT virtual Standard_Boolean HasGenerated() const; - - //! Returns true if there is at least one deleted shape. - //! For use in BRepNaming. - Standard_EXPORT virtual Standard_Boolean HasDeleted() const; - - Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE; - - Standard_EXPORT ~QANewModTopOpe_Limitation(); - -private: - - - - TopoDS_Shape myResultFwd; - TopoDS_Shape myResultRvs; - TopoDS_Shape myObjectToCut; - TopoDS_Shape myCutTool; - QANewModTopOpe_CutPtr myCut; - QANewModTopOpe_CommonPtr myCommon; - Standard_Boolean myFwdIsDone; - Standard_Boolean myRevIsDone; - QANewModTopOpe_ModeOfLimitation myMode; - - -}; - - - - - - - -#endif // _QANewModTopOpe_Limitation_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_ModeOfLimitation.hxx b/src/QANewModTopOpe/QANewModTopOpe_ModeOfLimitation.hxx deleted file mode 100644 index a5d3ebc7e3..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_ModeOfLimitation.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// Created on: 2001-05-03 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2001-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. - -#ifndef _QANewModTopOpe_ModeOfLimitation_HeaderFile -#define _QANewModTopOpe_ModeOfLimitation_HeaderFile - - -enum QANewModTopOpe_ModeOfLimitation -{ -QANewModTopOpe_Forward, -QANewModTopOpe_Reversed, -QANewModTopOpe_BothParts -}; - -#endif // _QANewModTopOpe_ModeOfLimitation_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_ReShaper.cxx b/src/QANewModTopOpe/QANewModTopOpe_ReShaper.cxx deleted file mode 100644 index 2d8142f4e1..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_ReShaper.cxx +++ /dev/null @@ -1,123 +0,0 @@ -// Created on: 2002-02-07 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2002-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 -#include -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(QANewModTopOpe_ReShaper,MMgt_TShared) - -QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape): - myInitShape(TheInitialShape) -{ - -} -QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape, - const TopTools_MapOfShape& TheMap): - myInitShape(TheInitialShape) -{ - myMap.Assign(TheMap); -} - -QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape, - const Handle(TopTools_HSequenceOfShape)& TheShapeToBeRemoved): - myInitShape(TheInitialShape) -{ - - Standard_Integer i, n = TheShapeToBeRemoved->Length(); - for(i = 1; i <= n; i++) { - myMap.Add(TheShapeToBeRemoved->Value(i)); - } - -} - -void QANewModTopOpe_ReShaper::Remove(const TopoDS_Shape& TheS) -{ - myMap.Add(TheS); -} - -void QANewModTopOpe_ReShaper::Perform() -{ - - BRepBuilderAPI_Copy aCopier; - - if(myMap.IsEmpty()) { - - aCopier.Perform(myInitShape); - myResult = aCopier.Shape(); - return; - - } - - BRep_Builder aBB; - myResult.Nullify(); - aBB.MakeCompound(TopoDS::Compound(myResult)); - TopoDS_Iterator anIter(myInitShape); - - for(; anIter.More(); anIter.Next()) { - - const TopoDS_Shape& aS = anIter.Value(); - - if(myMap.Contains(aS)) continue; - - if(aS.ShapeType() != TopAbs_COMPOUND) { - aCopier.Perform(aS); - aBB.Add(myResult, aCopier.Shape()); - } - else { - Handle(QANewModTopOpe_ReShaper) aR = new QANewModTopOpe_ReShaper(aS, myMap); - aR->Perform(); - const TopoDS_Shape& aSp = aR->GetResult(); - if(aSp.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator anIt(aSp); - if(anIt.More()) { - aBB.Add(myResult, aSp); - } - } - else { - aBB.Add(myResult, aSp); - } - } - - } - - if(myResult.ShapeType() == TopAbs_COMPOUND) { - anIter.Initialize(myResult); - if(anIter.More()) { - const TopoDS_Shape& aSp = anIter.Value(); - anIter.Next(); - if(!anIter.More()) myResult = aSp; - } - } - -} - -const TopoDS_Shape& QANewModTopOpe_ReShaper::GetResult() const -{ - return myResult; -} - -void QANewModTopOpe_ReShaper::Clear() -{ - myMap.Clear(); - myResult.Nullify(); -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_ReShaper.hxx b/src/QANewModTopOpe/QANewModTopOpe_ReShaper.hxx deleted file mode 100644 index a0ea7f7697..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_ReShaper.hxx +++ /dev/null @@ -1,83 +0,0 @@ -// Created on: 2002-02-07 -// Created by: Igor FEOKTISTOV -// Copyright (c) 2002-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. - -#ifndef _QANewModTopOpe_ReShaper_HeaderFile -#define _QANewModTopOpe_ReShaper_HeaderFile - -#include -#include - -#include -#include -#include -#include -class TopoDS_Shape; - - -class QANewModTopOpe_ReShaper; -DEFINE_STANDARD_HANDLE(QANewModTopOpe_ReShaper, MMgt_TShared) - -//! to remove "floating" objects from compound. -//! "floating" objects are wires, edges, vertices that do not belong -//! solids, shells or faces. -class QANewModTopOpe_ReShaper : public MMgt_TShared -{ - -public: - - - Standard_EXPORT QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape); - - Standard_EXPORT QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape, const TopTools_MapOfShape& TheMap); - - Standard_EXPORT QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape, const Handle(TopTools_HSequenceOfShape)& TheShapeToBeRemoved); - - Standard_EXPORT void Remove (const TopoDS_Shape& TheS); - - Standard_EXPORT void Perform(); - - //! to clear all added for removing shapes from inner map. - Standard_EXPORT void Clear(); - - Standard_EXPORT const TopoDS_Shape& GetResult() const; -Standard_EXPORT operator TopoDS_Shape() const; - - - - - DEFINE_STANDARD_RTTIEXT(QANewModTopOpe_ReShaper,MMgt_TShared) - -protected: - - - - -private: - - - TopoDS_Shape myInitShape; - TopoDS_Shape myResult; - TopTools_MapOfShape myMap; - - -}; - - - - - - - -#endif // _QANewModTopOpe_ReShaper_HeaderFile diff --git a/src/QANewModTopOpe/QANewModTopOpe_Tools.cxx b/src/QANewModTopOpe/QANewModTopOpe_Tools.cxx deleted file mode 100644 index eb05ed3d6b..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Tools.cxx +++ /dev/null @@ -1,860 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -static Standard_Boolean AddShapeToHistoryMap(const TopoDS_Shape& theOldShape, - const TopoDS_Shape& theNewShape, - TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap); - -static void FillEdgeHistoryMap(BRepAlgoAPI_BooleanOperation& theBOP, - TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap); - -static void SortVertexOnEdge(const TopoDS_Edge& theEdge, - const TopTools_ListOfShape& theListOfVertex, - TopTools_ListOfShape& theListOfVertexSorted); - -static TopAbs_State GetEdgeState(const BOPDS_PDS& pDS, - const Handle(BOPDS_PaveBlock)& aPB); - -// ======================================================================================== -// function: NbPoints -// purpose: -// ======================================================================================== -Standard_Integer QANewModTopOpe_Tools::NbPoints(const BOPAlgo_PPaveFiller& theDSFiller) -{ - Standard_Integer i, anbpoints, aNb; - // - const BOPDS_PDS& pDS = theDSFiller->PDS(); - anbpoints = 0; - - //FF - BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF(); - aNb=aFFs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfFF& aFF=aFFs(i); - const BOPDS_VectorOfPoint& aVP=aFF.Points(); - anbpoints += aVP.Extent(); - } - - //EF - BOPDS_VectorOfInterfEF& aEFs=pDS->InterfEF(); - aNb = aEFs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfEF& aEF=aEFs(i); - IntTools_CommonPrt aCP = aEF.CommonPart(); - if(aCP.Type() == TopAbs_VERTEX) { - anbpoints++; - } - } - - //EE - BOPDS_VectorOfInterfEE& aEEs=pDS->InterfEE(); - aNb = aEEs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfEE& aEE=aEEs(i); - IntTools_CommonPrt aCP = aEE.CommonPart(); - if(aCP.Type() == TopAbs_VERTEX) { - anbpoints++; - } - } - - return anbpoints; -} - -// ======================================================================================== -// function: NewVertex -// purpose: -// ======================================================================================== -TopoDS_Shape QANewModTopOpe_Tools::NewVertex(const BOPAlgo_PPaveFiller& theDSFiller, - const Standard_Integer theIndex) -{ - TopoDS_Shape aVertex; - Standard_Integer i, j, anbpoints, aNb, aNbP; - // - const BOPDS_PDS& pDS = theDSFiller->PDS(); - anbpoints = 0; - - //FF - BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF(); - aNb=aFFs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfFF& aFF=aFFs(i); - const BOPDS_VectorOfPoint& aVP=aFF.Points(); - aNbP = aVP.Extent(); - for(j = 0; j < aNbP; ++j) { - anbpoints++; - // - if (theIndex == anbpoints) { - const BOPDS_Point& aNP = aVP(j); - return pDS->Shape(aNP.Index()); - } - } - } - - //EF - BOPDS_VectorOfInterfEF& aEFs=pDS->InterfEF(); - aNb = aEFs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfEF& aEF=aEFs(i); - IntTools_CommonPrt aCP = aEF.CommonPart(); - if(aCP.Type() == TopAbs_VERTEX) { - anbpoints++; - // - if (theIndex == anbpoints) { - return pDS->Shape(aEF.IndexNew()); - } - } - } - - //EE - BOPDS_VectorOfInterfEE& aEEs=pDS->InterfEE(); - aNb = aEEs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfEE& aEE=aEEs(i); - IntTools_CommonPrt aCP = aEE.CommonPart(); - if(aCP.Type() == TopAbs_VERTEX) { - anbpoints++; - // - if (theIndex == anbpoints) { - return pDS->Shape(aEE.IndexNew()); - } - } - } - - return aVertex; -} - - -// ======================================================================================== -// function: HasDomain -// purpose: -// ======================================================================================== -Standard_Boolean QANewModTopOpe_Tools::HasSameDomain - (const BOPAlgo_PBuilder& theBuilder, - const TopoDS_Shape& theFace) -{ - if(theFace.IsNull() || (theFace.ShapeType() != TopAbs_FACE)) - return Standard_False; - - BOPCol_ListIteratorOfListOfShape aIt; - const BOPCol_DataMapOfShapeListOfShape& aImages = theBuilder->Images(); - if (!aImages.IsBound(theFace)) { - return Standard_False; - } - const BOPCol_ListOfShape& aLF=aImages.Find(theFace); - - if (aLF.Extent() == 0) { - return Standard_False; - } - const BOPCol_DataMapOfShapeShape& aShapesSD = theBuilder->ShapesSD(); - - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aFsp = aIt.Value(); - if (aShapesSD.IsBound(aFsp)) { - return Standard_True; - } - } - - return Standard_False; -} - -// ======================================================================================== -// function: SameDomain -// purpose: -// ======================================================================================== -void QANewModTopOpe_Tools::SameDomain - (const BOPAlgo_PBuilder& theBuilder, - const TopoDS_Shape& theFace, - TopTools_ListOfShape& theResultList) -{ - theResultList.Clear(); - - if(theFace.IsNull() || (theFace.ShapeType() != TopAbs_FACE)) - return; - - BOPCol_ListIteratorOfListOfShape aIt; - const BOPCol_ListOfShape& aLF=theBuilder->Splits().Find(theFace); - - if (aLF.Extent() == 0) { - return; - } - const BOPCol_DataMapOfShapeShape& aShapesSD = theBuilder->ShapesSD(); - const BOPCol_DataMapOfShapeShape& aOrigins = theBuilder->Origins(); - - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aFSp = aIt.Value(); - if (aShapesSD.IsBound(aFSp)) { - const TopoDS_Shape& aFSD = aShapesSD.Find(aFSp); - const TopoDS_Shape& aFOr = aOrigins.Find(aFSD); - if (theFace.IsEqual(aFOr)) { - BOPCol_DataMapIteratorOfDataMapOfShapeShape aItSD; - aItSD.Initialize(aShapesSD); - for (; aItSD.More(); aItSD.Next()) { - const TopoDS_Shape& aS = aItSD.Value(); - if (aFSD.IsEqual(aS)) { - const TopoDS_Shape& aSK = aItSD.Key(); - const TopoDS_Shape& aSKOr = aOrigins.Find(aSK); - if (!aSKOr.IsEqual(theFace)) { - theResultList.Append(aSKOr); - } - } - } - } else { - theResultList.Append(aFOr); - } - } - } -} - -// ======================================================================================== -// function: IsSplit -// purpose: -// ======================================================================================== -Standard_Boolean QANewModTopOpe_Tools::IsSplit(const BOPAlgo_PPaveFiller& theDSFiller, - const TopoDS_Shape& theEdge, - const TopAbs_State theState) -{ - if(theEdge.IsNull() || (theEdge.ShapeType() != TopAbs_EDGE)) - return Standard_False; - - Standard_Integer index; - // - const BOPDS_PDS& pDS = theDSFiller->PDS(); - index = pDS->Index(theEdge); - if (index == -1) { - return Standard_False; - } - - const BOPDS_ListOfPaveBlock& aLPB = pDS->PaveBlocks(index); - BOPDS_ListIteratorOfListOfPaveBlock aPBIt; - aPBIt.Initialize(aLPB); - for (; aPBIt.More(); aPBIt.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value(); - - TopAbs_State aSplitState = GetEdgeState(pDS, aPB); - - if(aSplitState == theState) { - return Standard_True; - } - } - - return Standard_False; -} - -// ======================================================================================== -// function: Splits -// purpose: -// ======================================================================================== -void QANewModTopOpe_Tools::Splits(const BOPAlgo_PPaveFiller& theDSFiller, - const TopoDS_Shape& theEdge, - const TopAbs_State theState, - TopTools_ListOfShape& theResultList) -{ - theResultList.Clear(); - - if(theEdge.IsNull() || (theEdge.ShapeType() != TopAbs_EDGE)) - return; - - Standard_Integer index, nSp; - // - const BOPDS_PDS& pDS = theDSFiller->PDS(); - index = pDS->Index(theEdge); - if (index == -1) { - return; - } - - const BOPDS_ListOfPaveBlock& aLPB = pDS->PaveBlocks(index); - BOPDS_ListIteratorOfListOfPaveBlock aPBIt; - aPBIt.Initialize(aLPB); - for (; aPBIt.More(); aPBIt.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value(); - nSp = aPB->Edge(); - - TopAbs_State aSplitState = GetEdgeState(pDS, aPB); - - if(aSplitState == theState) { - TopoDS_Shape aSplit = pDS->Shape(nSp); - theResultList.Append(aSplit); - } - } -} - -// ======================================================================================== -// function: SplitE -// purpose: -// ======================================================================================== -Standard_Boolean QANewModTopOpe_Tools::SplitE(const TopoDS_Edge& theEdge, - TopTools_ListOfShape& theSplits) -{ - // prequesitory : is a valid edge. - TopAbs_Orientation oEanc = theEdge.Orientation(); - TopoDS_Shape aLocalShape = theEdge.Oriented(TopAbs_FORWARD); - TopoDS_Edge EFOR = TopoDS::Edge(aLocalShape); - TopTools_ListOfShape aListOfVertex; - TopExp_Explorer exv(EFOR,TopAbs_VERTEX); - - for (;exv.More(); exv.Next()) { - const TopoDS_Shape& v = exv.Current(); - aListOfVertex.Append(v); - } - Standard_Integer nv = aListOfVertex.Extent(); - - if (nv <= 2) return Standard_False; - TopTools_ListOfShape aListOfVertexSorted; - - SortVertexOnEdge(EFOR, aListOfVertex, aListOfVertexSorted); - - TopoDS_Vertex v0; - TopTools_ListIteratorOfListOfShape anIt(aListOfVertexSorted); - - if (anIt.More()) { - v0 = TopoDS::Vertex(anIt.Value()); - anIt.Next(); - } - else return Standard_False; - - for (; anIt.More(); anIt.Next()) { - TopoDS_Vertex v = TopoDS::Vertex(anIt.Value()); - - // prequesitory: par0 < par - Standard_Real par0 = BRep_Tool::Parameter(v0, EFOR); - Standard_Real par = BRep_Tool::Parameter(v, EFOR); - - // here, ed has the same geometries than Ein, but with no subshapes. - TopoDS_Edge ed = TopoDS::Edge(EFOR.EmptyCopied()); - BRep_Builder BB; - v0.Orientation(TopAbs_FORWARD); - BB.Add(ed, v0); - v.Orientation(TopAbs_REVERSED); - BB.Add(ed, v); - BB.Range(ed, par0, par); - - theSplits.Append(ed.Oriented(oEanc)); - v0 = v; - } - return Standard_True; -} - - -// ======================================================================================== -// function: EdgeCurveAncestors -// purpose: -// ======================================================================================== - Standard_Boolean QANewModTopOpe_Tools::EdgeCurveAncestors(const BOPAlgo_PPaveFiller& theDSFiller, - const TopoDS_Shape& theEdge, - TopoDS_Shape& theFace1, - TopoDS_Shape& theFace2) -{ - theFace1.Nullify(); - theFace2.Nullify(); - // - Standard_Integer i, j, aNb, aNbC, nE, nF1, nF2; - BOPDS_ListIteratorOfListOfPaveBlock aIt; - - const BOPDS_PDS& pDS = theDSFiller->PDS(); - BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF(); - - aNb=aFFs.Extent(); - for (i = 0; i < aNb; ++i) { - BOPDS_InterfFF& aFF=aFFs(i); - - const BOPDS_VectorOfCurve& aVC = aFF.Curves(); - aNbC = aVC.Extent(); - for (j = 0; j < aNbC; ++j) { - const BOPDS_Curve& aNC = aVC(j); - const BOPDS_ListOfPaveBlock& aLPB = aNC.PaveBlocks(); - aIt.Initialize(aLPB); - for (; aIt.More(); aIt.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aIt.Value(); - nE = aPB->Edge(); - const TopoDS_Shape& aE = pDS->Shape(nE); - if (theEdge.IsSame(aE)) { - aFF.Indices(nF1, nF2); - theFace1 = pDS->Shape(nF1); - theFace2 = pDS->Shape(nF2); - return Standard_True; - } - } - } - } - - return Standard_False; -} - -// ======================================================================================== -// function: EdgeSectionAncestors -// purpose: -// ======================================================================================== -Standard_Boolean QANewModTopOpe_Tools::EdgeSectionAncestors(const BOPAlgo_PPaveFiller& theDSFiller, - const TopoDS_Shape& theEdge, - TopTools_ListOfShape& LF1, - TopTools_ListOfShape& LF2, - TopTools_ListOfShape& LE1, - TopTools_ListOfShape& LE2) -{ - if(theEdge.ShapeType() != TopAbs_EDGE) - return Standard_False; - - const BOPDS_PDS& pDS = theDSFiller->PDS(); - Standard_Integer i = 0, nb = 0, nF, nE, nEOr; - BOPCol_MapOfInteger aMIF; - nb = pDS->NbSourceShapes(); - - nE = pDS->Index(theEdge); - // - if (nE<0) { - return Standard_False; - } - // - const BOPDS_ListOfPaveBlock& aLPB1 = pDS->PaveBlocks(nE); - if (!aLPB1.Extent()) { - return Standard_False; - } - - const Handle(BOPDS_PaveBlock)& aPB1 = aLPB1.First(); - const Handle(BOPDS_CommonBlock)& aCB=pDS->CommonBlock(aPB1); - if (aCB.IsNull()) { - return Standard_False; - } - - const BOPCol_ListOfInteger& aLIF = aCB->Faces(); - BOPCol_ListIteratorOfListOfInteger aItLI; - aItLI.Initialize(aLIF); - for ( ; aItLI.More(); aItLI.Next()) { - nF = aItLI.Value(); - if(pDS->Rank(nF) == 0) - LF1.Append(pDS->Shape(nF)); - else - LF2.Append(pDS->Shape(nF)); - - aMIF.Add(nF); - } - - const BOPDS_ListOfPaveBlock& aLPB = aCB->PaveBlocks(); - BOPDS_ListIteratorOfListOfPaveBlock aItPB; - aItPB.Initialize(aLPB); - for (; aItPB.More(); aItPB.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); - nEOr = aPB->OriginalEdge(); - - if(pDS->Rank(nEOr) == 0) - LE1.Append(pDS->Shape(nEOr)); - else - LE2.Append(pDS->Shape(nEOr)); - - //find edge ancestors - for(i = 0; i < nb; ++i) { - const BOPDS_ShapeInfo& aSI = pDS->ShapeInfo(i); - if(aSI.ShapeType() != TopAbs_FACE) { - continue; - } - const BOPCol_ListOfInteger& aSubShapes = aSI.SubShapes(); - aItLI.Initialize(aSubShapes); - for (; aItLI.More(); aItLI.Next()) { - if (nEOr == aItLI.Value()) { - if (aMIF.Add(i)) { - if(pDS->Rank(i) == 0) LF1.Append(pDS->Shape(i)); - else LF2.Append(pDS->Shape(i)); - }//if (aMIF.Add(i)) { - }//if (nEOr == aItLI.Value()) { - }//for (; aItLI.More(); aItLI.Next()) { - }//for(i = 0; i < nb; ++i) { - } - - Standard_Boolean r = (!LF1.IsEmpty() && !LF2.IsEmpty()); - r = r && (!LE1.IsEmpty() || !LE2.IsEmpty()); - return r; -} - -// ======================================================================================== -// function: BoolOpe -// purpose: -// ======================================================================================== -Standard_Boolean QANewModTopOpe_Tools::BoolOpe(const TopoDS_Shape& theFace1, - const TopoDS_Shape& theFace2, - Standard_Boolean& IsCommonFound, - TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap) -{ - IsCommonFound = Standard_False; - theHistoryMap.Clear(); - gp_Dir aDNF1, aDNF2; - Standard_Integer iSenseFlag; - - BOPAlgo_PaveFiller aDSFiller; - BOPCol_ListOfShape aLS; - aLS.Append(theFace1); - aLS.Append(theFace2); - aDSFiller.SetArguments(aLS); - - aDSFiller.Perform(); - if (aDSFiller.ErrorStatus()) { - return Standard_False; - } - - const BOPDS_PDS& pDS = aDSFiller.PDS(); - - Standard_Integer aNb = 0, aNbSps; - Standard_Integer i = 0; - TopTools_IndexedMapOfShape aMapV; - - { - BRepAlgoAPI_Common aCommon(theFace1, theFace2, aDSFiller); - - if(!aCommon.IsDone()) { - return Standard_False; - } - - TopExp_Explorer anExp(aCommon.Shape(), TopAbs_FACE); - if(!anExp.More()) { - IsCommonFound = Standard_False; - return Standard_True; - } - - const Handle(IntTools_Context)& aContext = aDSFiller.Context(); - // - IsCommonFound = Standard_True; - TopExp::MapShapes(aCommon.Shape(), TopAbs_VERTEX, aMapV); - // fill edge history.begin - FillEdgeHistoryMap(aCommon, theHistoryMap); - // fill edge history.end - - // fill face history.begin - BOPDS_VectorOfInterfFF& aFFs = pDS->InterfFF(); - aNb = aFFs.Extent(); - Standard_Boolean bReverseFlag = Standard_True; - Standard_Boolean fillhistory = Standard_True; - - for (i=0; iShape(nF1)); - const TopoDS_Face& aF2 = *(TopoDS_Face*)(&pDS->Shape(nF2)); - - BOPCol_ListOfInteger aLSE; - pDS->SharedEdges(nF1, nF2, aLSE, aDSFiller.Allocator()); - aNbSps = aLSE.Extent(); - - if (!aNbSps) { - fillhistory = Standard_False; - continue; - } - - Standard_Integer nE = aLSE.First(); - const TopoDS_Edge& aSpE = *(TopoDS_Edge*)(&pDS->Shape(nE)); - - BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1, aContext); - BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2, aContext); - iSenseFlag=BOPTools_AlgoTools3D::SenseFlag (aDNF1, aDNF2); - - if(iSenseFlag == 1) { - fillhistory = Standard_True; - bReverseFlag = Standard_False; - } - else if(iSenseFlag == -1) { - fillhistory = Standard_True; - bReverseFlag = Standard_True; - } - else - fillhistory = Standard_False; - } - - if(fillhistory) { - - for(; anExp.More(); anExp.Next()) { - TopoDS_Shape aResShape = anExp.Current(); - - if(theFace1.Orientation() == aResShape.Orientation()) { - AddShapeToHistoryMap(theFace1, aResShape, theHistoryMap); - - if(bReverseFlag) - aResShape.Reverse(); - AddShapeToHistoryMap(theFace2, aResShape, theHistoryMap); - } - else if(theFace2.Orientation() == aResShape.Orientation()) { - AddShapeToHistoryMap(theFace2, aResShape, theHistoryMap); - - if(bReverseFlag) - aResShape.Reverse(); - AddShapeToHistoryMap(theFace1, aResShape, theHistoryMap); - } - else { - aResShape.Orientation(theFace1.Orientation()); - AddShapeToHistoryMap(theFace1, aResShape, theHistoryMap); - aResShape.Orientation(theFace2.Orientation()); - - if(bReverseFlag) - aResShape.Reverse(); - AddShapeToHistoryMap(theFace2, aResShape, theHistoryMap); - } - } - } - // fill face history.end - } - { - BRepAlgoAPI_Cut aCut1(theFace1, theFace2, aDSFiller); - - if(!aCut1.IsDone()) - return Standard_False; - TopExp::MapShapes(aCut1.Shape(), TopAbs_VERTEX, aMapV); - // fill edge history.begin - FillEdgeHistoryMap(aCut1, theHistoryMap); - // fill edge history.end - - // fill face history.begin - TopExp_Explorer anExp(aCut1.Shape(), TopAbs_FACE); - - for(; anExp.More(); anExp.Next()) { - TopoDS_Shape aResShape = anExp.Current(); - aResShape.Orientation(theFace1.Orientation()); - AddShapeToHistoryMap(theFace1, aResShape, theHistoryMap); - } - // fill face history.end - } - - { - BRepAlgoAPI_Cut aCut2(theFace1, theFace2, aDSFiller, Standard_False); - - if(!aCut2.IsDone()) - return Standard_False; - TopExp::MapShapes(aCut2.Shape(), TopAbs_VERTEX, aMapV); - // fill edge history.begin - FillEdgeHistoryMap(aCut2, theHistoryMap); - // fill edge history.end - - // fill face history.begin - TopExp_Explorer anExp(aCut2.Shape(), TopAbs_FACE); - - for(; anExp.More(); anExp.Next()) { - TopoDS_Shape aResShape = anExp.Current(); - aResShape.Orientation(theFace2.Orientation()); - AddShapeToHistoryMap(theFace2, aResShape, theHistoryMap); - } - // fill face history.end - } - - // fill vertex history.begin - BOPDS_VectorOfInterfVV& aVVs = pDS->InterfVV(); - aNb = aVVs.Extent(); - - for (i = 0; i < aNb; ++i) { - BOPDS_InterfVV& aVVi = aVVs(i); - if (!aVVi.HasIndexNew()) { - continue; - } - Standard_Integer aNewShapeIndex = aVVi.IndexNew(); - - const TopoDS_Shape& aNewVertex = pDS->Shape(aNewShapeIndex); - - if(!aMapV.Contains(aNewVertex)) { - continue; - } - - const TopoDS_Shape& aV1 = pDS->Shape(aVVi.Index1()); - const TopoDS_Shape& aV2 = pDS->Shape(aVVi.Index2()); - AddShapeToHistoryMap(aV1, aNewVertex, theHistoryMap); - AddShapeToHistoryMap(aV2, aNewVertex, theHistoryMap); - } - - BOPDS_VectorOfInterfVE& aVEs = pDS->InterfVE(); - aNb = aVEs.Extent(); - - for (i = 0; i < aNb; ++i) { - BOPDS_InterfVE& aVEi = aVEs(i); - - Standard_Integer anIndex = aVEi.Index1(); - const TopoDS_Shape& aNewVertex = pDS->Shape(anIndex); - - if(!aMapV.Contains(aNewVertex)) - continue; - - AddShapeToHistoryMap(aNewVertex, aNewVertex, theHistoryMap); - } - - BOPDS_VectorOfInterfVF& aVSs = pDS->InterfVF(); - aNb = aVSs.Extent(); - - for (i = 0; i < aNb; ++i) { - BOPDS_InterfVF& aVSi = aVSs(i); - - Standard_Integer anIndex = aVSi.Index1(); - const TopoDS_Shape& aNewVertex = pDS->Shape(anIndex); - - if(!aMapV.Contains(aNewVertex)) - continue; - - AddShapeToHistoryMap(aNewVertex, aNewVertex, theHistoryMap); - } - // fill vertex history.end - return Standard_True; -} - -// -------------------------------------------------------------------------------------------- -// static function: AddShapeToHistoryMap -// purpose: -// -------------------------------------------------------------------------------------------- -Standard_Boolean AddShapeToHistoryMap(const TopoDS_Shape& theOldShape, - const TopoDS_Shape& theNewShape, - TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap) { - - if(!theHistoryMap.Contains(theOldShape)) { - TopTools_ListOfShape aList; - aList.Append(theNewShape); - theHistoryMap.Add(theOldShape, aList); - return Standard_True; - } - - Standard_Boolean found = Standard_False; - TopTools_ListOfShape& aList = theHistoryMap.ChangeFromKey(theOldShape); - TopTools_ListIteratorOfListOfShape aVIt(aList); - - for(; aVIt.More(); aVIt.Next()) { - if(theNewShape.IsSame(aVIt.Value())) { - found = Standard_True; - break; - } - } - - if(!found) { - aList.Append(theNewShape); - } - return !found; -} - -// -------------------------------------------------------------------------------------------- -// static function: FillEdgeHistoryMap -// purpose: -// -------------------------------------------------------------------------------------------- -void FillEdgeHistoryMap(BRepAlgoAPI_BooleanOperation& theBOP, - TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap) { - - TopExp_Explorer anExp; - anExp.Init(theBOP.Shape1(), TopAbs_EDGE); - - for(; anExp.More(); anExp.Next()) { - const TopTools_ListOfShape& aList = theBOP.Modified(anExp.Current()); - TopTools_ListIteratorOfListOfShape anIt(aList); - - for(; anIt.More(); anIt.Next()) { - AddShapeToHistoryMap(anExp.Current(), anIt.Value(), theHistoryMap); - } - } - - anExp.Init(theBOP.Shape2(), TopAbs_EDGE); - - for(; anExp.More(); anExp.Next()) { - const TopTools_ListOfShape& aList = theBOP.Modified(anExp.Current()); - TopTools_ListIteratorOfListOfShape anIt(aList); - - for(; anIt.More(); anIt.Next()) { - AddShapeToHistoryMap(anExp.Current(), anIt.Value(), theHistoryMap); - } - } -} - -// -------------------------------------------------------------------------------------------- -// static function: SortVertexOnEdge -// purpose: -// -------------------------------------------------------------------------------------------- -void SortVertexOnEdge(const TopoDS_Edge& theEdge, - const TopTools_ListOfShape& theListOfVertex, - TopTools_ListOfShape& theListOfVertexSorted) { - - TopTools_DataMapOfIntegerShape mapiv;// mapiv.Find(iV) = V - TColStd_IndexedMapOfReal mappar; // mappar.FindIndex(parV) = iV - TopTools_ListIteratorOfListOfShape itlove(theListOfVertex); - - for (; itlove.More(); itlove.Next()){ - const TopoDS_Vertex& v = TopoDS::Vertex(itlove.Value()); - Standard_Real par = BRep_Tool::Parameter(v, theEdge); - Standard_Integer iv = mappar.Add(par); - mapiv.Bind(iv,v); - } - Standard_Integer nv = mapiv.Extent(); - NCollection_Array1 tabpar(1,nv); - Standard_Integer i = 0; - - for ( i = 1; i <= nv; i++) { - Standard_Real p = mappar.FindKey(i); - tabpar.SetValue(i,p); - } - theListOfVertexSorted.Clear(); - std::sort (tabpar.begin(), tabpar.end()); - - for (i = 1; i <= nv; i++) { - Standard_Real par = tabpar.Value(i); - Standard_Integer iv = mappar.FindIndex(par); - const TopoDS_Shape& v = mapiv.Find(iv); - theListOfVertexSorted.Append(v); - } -} - -// -------------------------------------------------------------------------------------------- -// static function: GetEdgeState -// purpose: -// -------------------------------------------------------------------------------------------- - static TopAbs_State GetEdgeState(const BOPDS_PDS& pDS, - const Handle(BOPDS_PaveBlock)& aPB) -{ - Standard_Integer j, aNbFI; - Standard_Boolean bIn; - TopAbs_State aState = TopAbs_ON; - // - const BOPDS_VectorOfFaceInfo& aVFI = pDS->FaceInfoPool(); - aNbFI = aVFI.Extent(); - // - for (j = 0; j < aNbFI; ++j) { - const BOPDS_FaceInfo& aFI = aVFI(j); - bIn = aFI.PaveBlocksIn().Contains(aPB); - if (bIn) { - aState = TopAbs_IN; - break; - } - } - return aState; -} diff --git a/src/QANewModTopOpe/QANewModTopOpe_Tools.hxx b/src/QANewModTopOpe/QANewModTopOpe_Tools.hxx deleted file mode 100644 index efa577bdbe..0000000000 --- a/src/QANewModTopOpe/QANewModTopOpe_Tools.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// Created on: 2003-05-06 -// Created by: Michael KLOKOV -// Copyright (c) 2003-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. - -#ifndef _QANewModTopOpe_Tools_HeaderFile -#define _QANewModTopOpe_Tools_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class TopoDS_Shape; -class TopoDS_Edge; - - -//! to provide several tools for porting to OCC 5.0 (mkk) -class QANewModTopOpe_Tools -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT static Standard_Integer NbPoints (const BOPAlgo_PPaveFiller& theDSFiller); - - Standard_EXPORT static TopoDS_Shape NewVertex (const BOPAlgo_PPaveFiller& theDSFiller, const Standard_Integer theIndex); - - Standard_EXPORT static Standard_Boolean HasSameDomain (const BOPAlgo_PBuilder& theBuilder, const TopoDS_Shape& theFace); - - Standard_EXPORT static void SameDomain (const BOPAlgo_PBuilder& theBuilder, const TopoDS_Shape& theFace, TopTools_ListOfShape& theResultList); - - Standard_EXPORT static Standard_Boolean IsSplit (const BOPAlgo_PPaveFiller& theDSFiller, const TopoDS_Shape& theEdge, const TopAbs_State theState); - - Standard_EXPORT static void Splits (const BOPAlgo_PPaveFiller& theDSFiller, const TopoDS_Shape& theEdge, const TopAbs_State theState, TopTools_ListOfShape& theResultList); - - Standard_EXPORT static Standard_Boolean SplitE (const TopoDS_Edge& theEdge, TopTools_ListOfShape& theSplits); - - Standard_EXPORT static Standard_Boolean EdgeCurveAncestors (const BOPAlgo_PPaveFiller& theDSFiller, const TopoDS_Shape& theEdge, TopoDS_Shape& theFace1, TopoDS_Shape& theFace2); - - Standard_EXPORT static Standard_Boolean EdgeSectionAncestors (const BOPAlgo_PPaveFiller& theDSFiller, const TopoDS_Shape& theEdge, TopTools_ListOfShape& LF1, TopTools_ListOfShape& LF2, TopTools_ListOfShape& LE1, TopTools_ListOfShape& LE2); - - Standard_EXPORT static Standard_Boolean BoolOpe (const TopoDS_Shape& theFace1, const TopoDS_Shape& theFace2, Standard_Boolean& IsCommonFound, TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _QANewModTopOpe_Tools_HeaderFile diff --git a/src/TKQADraw/PACKAGES b/src/TKQADraw/PACKAGES index 864fba1e92..c18d1ea793 100755 --- a/src/TKQADraw/PACKAGES +++ b/src/TKQADraw/PACKAGES @@ -1,8 +1,4 @@ - QABugs QADNaming QADraw -QANCollection -QANewBRepNaming -QANewDBRepNaming -QANewModTopOpe +QANCollection \ No newline at end of file diff --git a/tests/bugs/caf/bug282 b/tests/bugs/caf/bug282 deleted file mode 100755 index e6f91439c3..0000000000 --- a/tests/bugs/caf/bug282 +++ /dev/null @@ -1,21 +0,0 @@ -puts "===========" -puts "OCC282" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf - -circle acirc 0 0 0 20 -mkedge anEdge acirc -wire aWire anEdge - -plane pl 0 0 1 -mkface aface pl aWire - -NameImportShape D 0:1 aface - -if [catch { CheckNaming D 0:2 1 Label 0:1 1 1 1 } res] { - puts "OCC282: Error" -} - diff --git a/tests/bugs/caf/bug350 b/tests/bugs/caf/bug350 deleted file mode 100755 index 4baf374ab2..0000000000 --- a/tests/bugs/caf/bug350 +++ /dev/null @@ -1,31 +0,0 @@ -puts "===========" -puts "OCC350" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf - -vertex v1 0 0 -50 -vertex v2 0 100 -50 -vertex v3 100 0 -50 -line l1 0 0 -50 0 1 0 -line l2 0 100 -50 1 -1 0 -line l3 100 0 -50 -1 0 0 -mkedge e1 l1 v1 v2 -mkedge e2 l2 v2 v3 -mkedge e3 l3 v3 v1 -wire w e1 e2 e3 -plane pl 0 0 -50 0 0 1 -mkface f pl w -NameImportShape D 0:1 f -NamePrism D 0:2 0:1 250 0 0 1 -NameBox D 0:3 150 150 150 -GetShape D 0:2 aPrism -GetShape D 0:3 aBox -NameCut D 0:4 aPrism aBox - -if [catch { CheckNaming D 0:9 1 Label 0:4 1 1 1 } res] { - puts "OCC350: Error" -} - diff --git a/tests/bugs/caf/bug351 b/tests/bugs/caf/bug351 deleted file mode 100755 index c102916324..0000000000 --- a/tests/bugs/caf/bug351 +++ /dev/null @@ -1,15 +0,0 @@ -puts "===========" -puts "OCC351" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf - -NameBox D 0:1 100 100 100 -NamePrism D 0:2 0:1:1 200 -1 0 0 - -if [catch { CheckNaming D 0:3 1 Label 0:2 1 1 1 } res] { - puts "OCC351: Error" -} - diff --git a/tests/bugs/caf/bug352 b/tests/bugs/caf/bug352 deleted file mode 100755 index 1e5ae08160..0000000000 --- a/tests/bugs/caf/bug352 +++ /dev/null @@ -1,18 +0,0 @@ -puts "===========" -puts "OCC352" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf - -NameBox D 0:1 100 100 100 -box abox 100 100 100 -ttranslate abox 100 0 50 -NameImportShape D 0:2 abox - -NameGlue D 0:3 0:1 0:2 - -if [catch { CheckNaming D 0:4 1 Label 0:3 1 1 1 } res] { - puts "OCC352: Error" -} diff --git a/tests/bugs/caf/bug355 b/tests/bugs/caf/bug355 deleted file mode 100755 index e9e82f5cdb..0000000000 --- a/tests/bugs/caf/bug355 +++ /dev/null @@ -1,15 +0,0 @@ -puts "===========" -puts "OCC355" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf - -NameCylinder D 0:1 20 100 0 Solid -NamePrism D 0:2 0:1:2 50 0 0 1 - -if [catch { CheckNaming D 0:3 1 Label 0:2 1 1 1 } res] { - puts "OCC355: Error" -} - diff --git a/tests/bugs/modalg_2/bug307_1 b/tests/bugs/modalg_2/bug307_1 deleted file mode 100755 index 70de092a90..0000000000 --- a/tests/bugs/modalg_2/bug307_1 +++ /dev/null @@ -1,37 +0,0 @@ -puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_1" -puts "TODO OCC12345 ALL: Error : The area of result shape is" - -pload QAcommands - -puts "================" -puts "OCC307" -puts "SAM1265" -puts "================" -puts "" - -restore [locate_data_file OCC307.brep] f - -set che [checkshape f] -if { [regexp {Faulty} $che ] == 1} { - puts "Warning OCC307: Source shape is invalid. It was detected by Checkshape command" -} else { - puts "OCC307 OK: Source shape is valid" -} - -explode f f - -renamevar f w - -explode w w - -OCC307 result1 f_4 w_6 0 -OCC307 result2 f_5 result1 0 - -checkshape result1 -renamevar result2 result - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png - - diff --git a/tests/bugs/modalg_2/bug307_2 b/tests/bugs/modalg_2/bug307_2 deleted file mode 100755 index bec9293060..0000000000 --- a/tests/bugs/modalg_2/bug307_2 +++ /dev/null @@ -1,35 +0,0 @@ -puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_1" -puts "TODO OCC12345 ALL: Error : The area of result shape is" - -pload QAcommands - -puts "================" -puts "OCC307" -puts "SAM1265" -puts "================" -puts "" - -restore [locate_data_file OCC307.brep] f - -set che [checkshape f] -if { [regexp {Faulty} $che] == 1} { - puts "Warning OCC307: Source shape is invalid. It was detected by Checkshape command" -} else { - puts "OCC307 OK: Source shape is valid" -} - -explode f f - -renamevar f w - -explode w w - -OCC307 result1 f_4 w_6 1 -OCC307 result2 f_5 result1 1 - -checkshape result1 -renamevar result2 result - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug6272_1 b/tests/bugs/modalg_4/bug6272_1 deleted file mode 100755 index 611091bdc4..0000000000 --- a/tests/bugs/modalg_4/bug6272_1 +++ /dev/null @@ -1,23 +0,0 @@ -#puts "TODO OCC111111 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC111111 ALL: Error : The area of result shape is" -pload QAcommands - -puts "============" -puts "OCC6272" -puts "============" -puts "" -###################################################### -# Incorrect results of gluing operation -###################################################### - -set BugNumber OCC6272 - -restore [locate_data_file OCC6272_bridge2.brep] a1 -restore [locate_data_file OCC6272_revolution.brep] a2 - -OCC307 result a1 a2 0 - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png - diff --git a/tests/bugs/modalg_4/bug6272_2 b/tests/bugs/modalg_4/bug6272_2 deleted file mode 100755 index 9f89c0485b..0000000000 --- a/tests/bugs/modalg_4/bug6272_2 +++ /dev/null @@ -1,23 +0,0 @@ -#puts "TODO OCC111111 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC111111 ALL: Error : The area of result shape is" - -pload QAcommands - -puts "============" -puts "OCC6272" -puts "============" -puts "" -###################################################### -# Incorrect results of gluing operation -###################################################### - -set BugNumber OCC6272 - -restore [locate_data_file OCC6272_bridge2.brep] a1 -restore [locate_data_file OCC6272_revolution.brep] a2 - -OCC307 result a1 a2 1 - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug6272_3 b/tests/bugs/modalg_4/bug6272_3 deleted file mode 100755 index decdf6fbec..0000000000 --- a/tests/bugs/modalg_4/bug6272_3 +++ /dev/null @@ -1,24 +0,0 @@ -puts "TODO OCC111111 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC111111 ALL: Error : The area of result shape is" - -pload QAcommands - -puts "============" -puts "OCC6272" -puts "============" -puts "" -###################################################### -# Incorrect results of gluing operation -###################################################### - -set BugNumber OCC6272 - -restore [locate_data_file OCC6272_bridge2.brep] a1 - -explode a1 -OCC307 result a1_1 a1_2 0 - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png - diff --git a/tests/bugs/modalg_4/bug6272_4 b/tests/bugs/modalg_4/bug6272_4 deleted file mode 100755 index b8cbb10979..0000000000 --- a/tests/bugs/modalg_4/bug6272_4 +++ /dev/null @@ -1,23 +0,0 @@ -puts "TODO OCC111111 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC111111 ALL: Error : The area of result shape is" - -pload QAcommands - -puts "============" -puts "OCC6272" -puts "============" -puts "" -###################################################### -# Incorrect results of gluing operation -###################################################### - -set BugNumber OCC6272 - -restore [locate_data_file OCC6272_bridge2.brep] a1 - -explode a1 -OCC307 result a1_1 a1_2 1 - -checkprops result -s 0 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_1/buc60609 b/tests/bugs/moddata_1/buc60609 index ea76ac398c..d3c1737dbc 100755 --- a/tests/bugs/moddata_1/buc60609 +++ b/tests/bugs/moddata_1/buc60609 @@ -2,25 +2,20 @@ puts "================" puts "BUC60609" puts "================" -pload QAcommands +restore [locate_data_file buc60609a.brep] a -set INF [BUC60609 [locate_data_file buc60609a.brep] a] -set ll [llength $INF] -set first [lindex $INF [expr $ll - 5]] -set second [lindex $INF [expr $ll - 1]] +# two points will be classified +point p1 0.14 5.1 +point p2 1.28 5.1 -if {$first != "INSIDE" && $first != "inside"} { - puts "Faulty BUC60609 first: $first is not right result. It should be INSIDE" +if {![regexp "IN" [b2dclassify a p1]]} { + puts "Faulty BUC60609 first: $first is not right result. It should be INSIDE" } else { - puts "BUC60609 first OK: It is INSIDE" + puts "BUC60609 first OK: It is INSIDE" } -if {$second != "INSIDE"} { - puts "Faulty BUC60609 second: $second is not right result. It should be INSIDE" +if {![regexp "IN" [b2dclassify a p2]]} { + puts "Faulty BUC60609 second: $second is not right result. It should be INSIDE" } else { - puts "BUC60609 second OK: It is INSIDE" + puts "BUC60609 second OK: It is INSIDE" } - -renamevar a result -checkview -display result -2d -path ${imagedir}/${test_image}.png - diff --git a/tests/bugs/moddata_2/bug252_1 b/tests/bugs/moddata_2/bug252_1 deleted file mode 100755 index aefa3c9da1..0000000000 --- a/tests/bugs/moddata_2/bug252_1 +++ /dev/null @@ -1,23 +0,0 @@ - -puts "================" -puts "OCC252" -puts "================" -puts "" - -pload QAcommands - -restore [locate_data_file OCC252.brep] a - -checkshape a - -explode a w - -OCC252 result a_466 a 0 - -regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full len - -if { ${len} <= 0 } { - puts "Error : OCC252" -} - -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_2/bug252_2 b/tests/bugs/moddata_2/bug252_2 deleted file mode 100755 index 4c69f8f6de..0000000000 --- a/tests/bugs/moddata_2/bug252_2 +++ /dev/null @@ -1,22 +0,0 @@ - -puts "================" -puts "OCC252" -puts "================" -puts "" - -pload QAcommands - -restore [locate_data_file OCC252.brep] a -checkshape a - -explode a w - -OCC252 result a_466 a 1 - -regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full len - -if { ${len} != 0 } { - puts "Error : OCC252" -} - -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_2/bug252_3 b/tests/bugs/moddata_2/bug252_3 deleted file mode 100755 index 559e575d89..0000000000 --- a/tests/bugs/moddata_2/bug252_3 +++ /dev/null @@ -1,22 +0,0 @@ - -puts "================" -puts "OCC252" -puts "================" -puts "" - -pload QAcommands - -restore [locate_data_file OCC252.brep] a -checkshape a - -explode a w - -OCC252 result a_466 a 2 - -regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full len - -if { ${len} <= 0 } { - puts "Error : OCC252" -} - -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/step/buc60906 b/tests/bugs/step/buc60906 deleted file mode 100755 index 2a53411820..0000000000 --- a/tests/bugs/step/buc60906 +++ /dev/null @@ -1,74 +0,0 @@ -# by apn master-master 03.12.2012 -#puts "TODO OCC12345 ALL: An exception was caught" -#puts "TODO OCC12345 ALL: \\*\\* Exception \\*\\*.*" -puts "TODO OCC12345 ALL: Faulty OCC294" -puts "TODO OCC12345 ALL: Error : OCC294" -#puts "TODO OCC12345 ALL: TEST INCOMPLETE" - -puts "========================" -puts " BUC60906 " -puts "========================" - -cpulimit 3000 -pload QAcommands - -stepread [locate_data_file carcasse_gauche_simpl3.stp] a * - -tpcompound com - -set AllEdgesList [explode com e] -set list [split ${AllEdgesList}] -set NumbEdges [llength ${list}] -set delta 0.03 -set IsSmallEdges 0 - -set IsOK 1 - -for {set i 1} {${i} <= ${NumbEdges}} {incr i} { - set i_tolerance [maxtolerance com_${i}] - set i_list [split ${i_tolerance} "\n\t"] - set i_listLength [llength ${i_list}] - if { ${i_listLength} < 7 } then { - puts "BUC60906 - Error : i = ${i}" - puts "BUC60906 - Error : i_listLength = ${i_listLength}" - } - set i_EdgeList [lindex ${i_list} 3] - set i_MaxEdgeTolerance [lindex [split ${i_EdgeList}] [expr [llength [split ${i_EdgeList}] ] - 2] ] - #puts "i_MaxEdgeTolerance = ${i_MaxEdgeTolerance}" - if { ${i_MaxEdgeTolerance} > ${delta} } then { - set IsSmallEdges 1 - puts "Remove ${i}-th small edge with a tolerance of ${delta} mm" - - if [catch { OCC294 shape_result com com_${i} } result] { - puts "Error : OCC294" - set IsOK 0 - break - } - - renamevar shape_result com - } -} -if { ${IsOK} == 1 } { - if { ${IsSmallEdges} == 0 } { - puts "Error : here are not small edges" - set IsOK 0 - } -} - -if { ${IsOK} == 1 } { - set fullness [nbshapes com] - regexp {VERTEX +: +([-0-9.+eE]+)} $fullness full vert - regexp {EDGE +: +([-0-9.+eE]+)} $fullness full edg - if { $edg == 0 || $vert == 0 } { - puts "Error : it is Faulty result" - set IsOK 0 - } -} - -if { ${IsOK} == 1 } { - fixshape result com ${delta} - checkshape result - checkshape result r -} - -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/vis/bug294 b/tests/bugs/vis/bug294 deleted file mode 100644 index 6da82a342e..0000000000 --- a/tests/bugs/vis/bug294 +++ /dev/null @@ -1,29 +0,0 @@ -puts "TODO OCC12345 ALL: Faulty OCC294 : result - shape_result is null" - -puts "================" -puts "OCC294" -puts "SAM1293" -puts "================" -puts "" - -restore [locate_data_file OCC294.brep] a -checkshape a - -set a_fullness [nbshapes a] -regexp {EDGE +: +([-0-9.+eE]+)} $a_fullness full a_edg - -explode a e -if [catch { OCC294 result a a_1 } ] { - puts "OCC294: FAULTY" -} else { - set b_fullness [ nbshapes b] - regexp {EDGE +: +([-0-9.+eE]+)} $b_fullness full b_edg - - puts "a_edg = ${a_edg}" - puts "b_edg = ${b_edg}" - if { ${b_edg} >= ${a_edg} } { - puts "OCC294: FAULTY" - } else { - puts "OCC294: OK" - } -} diff --git a/tests/caf/nam/A6 b/tests/caf/nam/A6 deleted file mode 100644 index c547804be9..0000000000 --- a/tests/caf/nam/A6 +++ /dev/null @@ -1,52 +0,0 @@ -set Test "Primitives naming test" -set IsDone 1 -set TestError "" - -if {[catch {set TestLab}] == 1} { - NewDocument D - set TestLab 0:1 -} - -set myLab [set TestLab]:1 -set myNameLab [set TestLab]:101 - -#################### box #################### -NameBox D $myLab 10 20 30 -Checking "Box as solid" - -#################### cylinder: cutted and full #################### -NameCylinder D $myLab 10 20 1 1 -Checking "Cutted cylinder as solid" - -NameCylinder D $myLab 20 30 0 1 -Checking "Cylinder as solid" - -NameCylinder D $myLab 15 15 0 0 -Checking "Cylinder as shell" - -#################### sphere: cutted and full #################### -NameSphere D $myLab 20 10 15 5 0.1 0.2 0.3 1 -Checking "Cutted sphere as solid" - -NameSphere D $myLab 5 15 15 5 0.1 0.2 0.3 0 -Checking "Cutted sphere as shell" - -NameSphere D $myLab 10 5 15 5 0 0 0 1 -Checking "Sphere as solid" - -NameSphere D $myLab 15 20 15 5 0 0 0 0 -Checking "Sphere as shell" - -#################### import brep shapes from "forimport" directory #################### - -erase -set shapes_list {compound.brep compsol.brep HV_O1.brep HV_T1.brep HW_T0.brep HW_T3.brep SH_O.brep solid1.brep} -foreach shape $shapes_list { - restore [locate_data_file ${shape}] s - disp s - fit - NameImportShape D $myLab s - erase -} - -# if {$IsDone==0} {puts "not done"} else {puts done} diff --git a/tests/caf/nam/A7 b/tests/caf/nam/A7 deleted file mode 100644 index 11f938a32c..0000000000 --- a/tests/caf/nam/A7 +++ /dev/null @@ -1,167 +0,0 @@ -set Test "Primitives at selection naming test" -set IsDone 1 -set TestError "" - -if {[catch {set TestLab}] == 1} { - NewDocument D - set TestLab 0:1 -} - -set myLab [set TestLab]:1 -set myNameLab [set TestLab]:105 - -#################### prepare source shapes #################### -# label #1 - box -NameBox D $myLab 10 20 30 -GetShape D $myLab b -explode b F -NextLabel myLab - -# label #2 - cutted cylinder -NameCylinder D $myLab 10 20 1 1 -NextLabel myLab - -# label #3 - full cylinder -NameCylinder D $myLab 20 30 0 1 -NextLabel myLab - -# label #4 - spere -NameSphere D $myLab 10 5 15 5 0 0 0 1 -NextLabel myLab - -#################### prism: infinite, at box and cylinder faces, at closed wire #################### - -### MPV:naming is not allowed for infinity prism -#SelectShape D $myLab b_1 b -#set PrevLab $myLab -#NextLabel myLab -#NamePrism D $myLab $PrevLab 10 1 1 1 1 -#Checking "NamePrism infinity" - - -SelectShape D $myLab b_2 b -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -NamePrism D $myLab $PrevLab 10 1 1 1 -Checking NamePrism - -GetShape D [set TestLab]:3 c -explode c F -set vv [explode c_1 V] -set cf c_1 -if {[llength $vv] > 1} { - set vv [explode c_2 V] - set cf c_2 -} - -SelectShape D $myLab $cf c -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -NamePrism D $myLab $PrevLab 10 1 1 1 -Checking "NamePrism at circle" - -GetShape D [set TestLab]:2 cutc -explode cutc F - -set cc [explode cutc_2 W] -SelectShape D $myLab $cc cutc -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -NamePrism D $myLab $PrevLab 10 1 1 1 -Checking "NamePrism at wire" - -#################### revolution: box face and cylinder closed wire #################### -GetShape D [set TestLab]:1 b -explode b F -SelectShape D $myLab b_2 b -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -explode b_2 E -set cb [CopyShape b_2_1] -ttranslate $cb 30 30 0 -BuildNamedShape D $myLab SELECTION $cb $cb -set Axis $myLab -NextLabel myLab -NextLabel myNameLab -NameRevol D $myLab $PrevLab $Axis 10 -Checking "NameRevol at box face" - -GetShape D [set TestLab]:2 cutc -explode cutc W -NameImportShape D $myLab cutc_1 -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -explode cutc_1 E -set cc [CopyShape cutc_1_2] -ttranslate $cc 20 40 0 -BuildNamedShape D $myLab SELECTION $cc $cc -set Axis $myLab -NextLabel myLab -NextLabel myNameLab -NameRevol D $myLab $PrevLab $Axis -Checking "NameRevol at cylinder face" - -#################### fillet: at box wire, cylinder (not lateral) edge #################### -GetShape D [set TestLab]:1 b -explode b F -explode b_3 W -SelectShape D $myLab b_3_1 b -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -NameFillet D $myLab [set TestLab]:1 $PrevLab 3 -Checking "NameFillet at box wire" - -GetShape D [set TestLab]:3 c -explode c E -set ce c_1 -if {[llength [explode $ce V]] > 1} {set ce c_2} -SelectShape D $myLab $ce c -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -NameFillet D $myLab [set TestLab]:3 $PrevLab 3 -Checking "NameFillet at cylinder edge" - -#################### chamfer: at cutted cylinder top wire, cylinder (not lateral) edge #################### -GetShape D [set TestLab]:2 cutc -set cutf [explode cutc F] -set cuttop cutc_1 -for {set i 1} {[lindex $cutf $i]!=""} {incr i} { - if {[lindex [CenterOfShape [lindex $cutf $i]] 2] > [lindex [CenterOfShape $cuttop] 2]} {set cuttop [lindex $cutf $i]} -} -SelectShape D $myLab $cuttop cutc -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -set cutw [explode $cuttop W] -SelectShape D $myLab $cutw cutc -set WireLab $myLab -NextLabel myLab -NextLabel myNameLab -NameChamfer D $myLab [set TestLab]:2 $WireLab $PrevLab 2 3 -Checking "NameChamfer at cutted cylinder wire" - -GetShape D [set TestLab]:3 c -set cf [explode c F] -set cbottom c_1 -for {set i 1} {[lindex $cf $i]!=""} {incr i} { - if {[lindex [CenterOfShape [lindex $cf $i]] 2] < [lindex [CenterOfShape $cbottom] 2]} {set cbottom [lindex $cf $i]} -} -SelectShape D $myLab $cbottom c -set PrevLab $myLab -NextLabel myLab -NextLabel myNameLab -set ce [explode $cbottom E] -SelectShape D $myLab $ce c -set WireLab $myLab -NextLabel myLab -NextLabel myNameLab -NameChamfer D $myLab [set TestLab]:3 $WireLab $PrevLab 4 3 -Checking "NameChamfer at cylinder bottom edge" - diff --git a/tests/caf/nam/A8 b/tests/caf/nam/A8 deleted file mode 100755 index 4da1343321..0000000000 --- a/tests/caf/nam/A8 +++ /dev/null @@ -1,206 +0,0 @@ -puts "TODO OCC24025 ALL: Two opened shells intersection" -puts "TODO OCC24025 ALL: Two shells intersection \\(one opened\\)" -puts "TODO OCC24025 ALL: ERROR OCCURS DURING TEST - FAULTY" - -set Test "Boolean operations naming test" -set IsDone 1 -set TestError "" - -if {[catch {set TestLab}] == 1} { - NewDocument D - set TestLab 0:1 -} - -set myLab [set TestLab]:1 -set myNameLab [set TestLab]:105 - -#################### four boxes: fuse, cut, common, intersection #################### -NameBox D $myLab 20 30 25 -GetShape D $myLab b1 -set Box1Lab $myLab -NextLabel myLab -box b2 10 15 10 15 20 25 -BuildNamedShape D $myLab PRIMITIVE b2 -set Box2Lab $myLab -set bf [explode b2 F] -for {set i 0} {[lindex $bf $i]!=""} {incr i} { - BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i] -} -NextLabel myLab -box b3 20 25 30 20 20 20 -BuildNamedShape D $myLab PRIMITIVE b3 -set Box3Lab $myLab -set bf [explode b3 F] -for {set i 0} {[lindex $bf $i]!=""} {incr i} { - BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i] -} -NextLabel myLab -box b4 15 10 20 20 20 20 -#box b4 5 5 5 20 20 20 -BuildNamedShape D $myLab PRIMITIVE b4 -set Box4Lab $myLab -set bf [explode b4 F] -for {set i 0} {[lindex $bf $i]!=""} {incr i} { - BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i] -} -NextLabel myLab - -NameFuse D $myLab b1 b2 -set FuseLab $myLab -Checking "Two boxes fuse" -GetShape D $FuseLab FuseShape -GetShape D $Box3Lab b3 -NameCut D $myLab FuseShape b3 -set CutLab $myLab -Checking "Fuse result and box cut" -GetShape D $CutLab CutShape -GetShape D $Box4Lab b4 -NameCommon D $myLab b4 CutShape -set CommonLab $myLab -Checking "Fuse cut result and box common" -GetShape D $CommonLab CommonShape -GetShape D $Box2Lab b2 -#NameIntersection D $myLab CommonShape b2 -#Checking "Fuse cut common result and box intersection" - -#################### limit operation #################### -NameBox D $myLab 20 10 30 -GetShape D $myLab b1 -NextLabel myLab -NextLabel myNameLab -vertex v1 -10 -10 15 -vertex v2 -10 100 15 -vertex v3 100 -10 15 -line l1 -10 -10 15 0 1 0 -line l2 -10 100 15 1 -1 0 -line l3 100 -10 15 -1 0 0 -mkedge e1 l1 v1 v2 -mkedge e2 l2 v2 v3 -mkedge e3 l3 v3 v1 -wire w e1 e2 e3 -plane pl 0 0 15 0 0 15 -mkface f pl w -NameImportShape D $myLab f -NextLabel myLab -NextLabel myNameLab -NameLimit D $myLab b1 f -Checking "Limit naming (box and planar face)" - -#################### Intersection operation #################### -restore [locate_data_file Int_Sh1_3.brep] Obj1 -NameImportShape D $myLab Obj1 -NextLabel myLab -NextLabel myNameLab - -restore [locate_data_file Int_Sh2_3.brep] Tool1 -NameImportShape D $myLab Tool1 -NextLabel myLab -NextLabel myNameLab - -NameIntersection D $myLab Obj1 Tool1 -Checking "Two opened shells intersection" - -restore [locate_data_file Int_shell1.brep] Obj2 -NameImportShape D $myLab Obj2 -NextLabel myLab -NextLabel myNameLab - -restore [locate_data_file Int_Sh1_3.brep] Tool2 -NameImportShape D $myLab Tool2 -NextLabel myLab -NextLabel myNameLab - -NameIntersection D $myLab Obj2 Tool2 -Checking "Two shells intersection (one opened)" - - -restore [locate_data_file Int_shell.brep] Obj3 -NameImportShape D $myLab Obj3 -NextLabel myLab -NextLabel myNameLab - -restore [locate_data_file Int_wire.brep] Tool3 -NameImportShape D $myLab Tool3 -NextLabel myLab -NextLabel myNameLab - -NameIntersection D $myLab Obj3 Tool3 -Checking "Shell and wire intersection" - -#################### bug with premature "IDENTIFY" naming: one cylinder cut another in the middle #################### -NameCylinder D $myLab 20 100 0 1 -GetShape D $myLab c1 -NextLabel myLab -NextLabel myNameLab -pcylinder c2 20 30 -ttranslate c2 0 0 30 -BuildNamedShape D $myLab PRIMITIVE c2 -set cf [explode c2 F] -for {set i 0} {[lindex $cf $i]!=""} {incr i} { - BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $cf $i] -} -NextLabel myLab -NextLabel myNameLab -NameCut D $myLab c1 c2 -Checking "Cut of two cylinders ( = = )" - -#################### bug with MODIFUNTIL conceit: three cutted cylinders #################### -NameCylinder D $myLab 20 100 0 1 -GetShape D $myLab c1 -NextLabel myLab -NextLabel myNameLab -NameCylinder D $myLab 10 100 0 1 -GetShape D $myLab c2 -NextLabel myLab -NextLabel myNameLab -pcylinder c3 20 30 -ttranslate c3 0 0 30 -BuildNamedShape D $myLab PRIMITIVE c3 -set cf [explode c3 F] -for {set i 0} {[lindex $cf $i]!=""} {incr i} { - BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $cf $i] -} -NextLabel myLab -NextLabel myNameLab -NameCut D $myLab c1 c2 -GetShape D $myLab CutShape -NextLabel myLab -NextLabel myNameLab -NameCut D $myLab CutShape c3 -#Checking "Cut of three cylinders ( 0=) 0=) )" - -# mpv: BRepNaming_Fillet is not ready now for this test -#################### bug with FILTERBYNEIGHBOURGS confusion: cylinder, cutted by shpere + fillet #################### -#NameCylinder D $myLab 20 100 0 1 -#GetShape D $myLab c1 -#NextLabel myLab -#NextLabel myNameLab -#psphere s 20 -#ttranslate s 30 20 50 -#BuildNamedShape D $myLab PRIMITIVE s -#explode s F -##name only face of sphere: it's enoth for this example -#BuildNamedShape D [set myLab]:1 PRIMITIVE s_1 -#NextLabel myLab -#NextLabel myNameLab -#NameCut D $myLab c1 s -#set CutLab $myLab -#GetShape D $myLab CutShape -#NextLabel myLab -#NextLabel myNameLab -#set se [explode CutShape E] -#set CutEdge CutShape_1 -#set minX [lindex [CenterOfShape CutShape_1] 0] -#for {set i 1} {[lindex $se $i]!=""} {incr i} { -# set minC [lindex [CenterOfShape [lindex $se $i]] 0] -# if {$minC < $minX} { -# set minX $minC -# set CutEdge [lindex $se $i] -# } -#} -#SelectShape D $myLab $CutEdge CutShape -#set EdgeLab $myLab -#NextLabel myLab -#NextLabel myNameLab -#NameFillet D $myLab $CutLab $EdgeLab 10 -#Checking "Fillet at cut cylinder by sphere ( \[( )" diff --git a/tests/caf/nam/A9 b/tests/caf/nam/A9 deleted file mode 100644 index 978efb29bf..0000000000 --- a/tests/caf/nam/A9 +++ /dev/null @@ -1,45 +0,0 @@ -set Test "Specific operations naming test" -set IsDone 1 -set TestError "" - -if {[catch {set TestLab}] == 1} { - NewDocument D - set TestLab 0:1 -} - -set myLab [set TestLab]:1 -set myNameLab [set TestLab]:100 - -#################### two boxes glueing #################### -NameBox D $myLab 20 30 40 -set Box1Lab $myLab -NextLabel myLab -NextLabel myNameLab -box b 20 10 20 20 30 40 -NameImportShape D $myLab b -set Box2Lab $myLab -NextLabel myLab -NextLabel myNameLab -NameGlue D $myLab $Box1Lab $Box2Lab -Checking "Two boxes glueing" - -#################### 3-faces shell and 2-faces shell glueing #################### -restore [locate_data_file HH_O.brep] object -restore [locate_data_file HH_T.brep] tool -global object -NameImportShape D $myLab object -set ObjectLab $myLab -NextLabel myLab -NextLabel myNameLab -global tool -NameImportShape D $myLab tool -set ToolLab $myLab -NextLabel myLab -NextLabel myNameLab -NameGlue D $myLab $ObjectLab $ToolLab -Checking "Two shells glueing" - -#################### import box with broken edges and internal vertex at the face #################### -restore [locate_data_file brockenedgesbox.brep] bbox -NameImportShape D $myLab object -Checking "Box with broken edges"