// Created on: 1996-09-03
// Created by: Olga KOULECHOVA
// Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-
-#include <BRepFeat_MakeDPrism.ixx>
-
-#include <BRepFeat.hxx>
-#include <LocOpe.hxx>
-#include <LocOpe_CSIntersector.hxx>
-#include <TColGeom_SequenceOfCurve.hxx>
-#include <LocOpe_DPrism.hxx>
-#include <LocOpe_SequenceOfLin.hxx>
-#include <LocOpe_PntFace.hxx>
-
-#include <gp_Vec.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Pln.hxx>
-
-#include <Precision.hxx>
-
-#include <Geom_Surface.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Line.hxx>
-#include <Geom2d_Curve.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <TColGeom_SequenceOfCurve.hxx>
#include <Bnd_Box.hxx>
-
-#include <BRepBndLib.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepLib.hxx>
-
#include <BRepAlgo.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:49:46 2002 f
-//#include <BRepAlgo_Cut.hxx>
-//#include <BRepAlgo_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:50:04 2002 t
-
+#include <BRepBndLib.hxx>
+#include <BRepFeat.hxx>
+#include <BRepFeat_MakeDPrism.hxx>
+#include <BRepLib.hxx>
#include <BRepLib_MakeFace.hxx>
-
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepTools.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec.hxx>
+#include <LocOpe.hxx>
+#include <LocOpe_CSIntersector.hxx>
+#include <LocOpe_DPrism.hxx>
+#include <LocOpe_PntFace.hxx>
+#include <LocOpe_SequenceOfLin.hxx>
+#include <Precision.hxx>
+#include <Standard_ConstructionError.hxx>
+#include <TColGeom_SequenceOfCurve.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TopAbs.hxx>
+#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopTools_MapOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS.hxx>
-
-#include <Standard_ConstructionError.hxx>
-
-#include <TopExp.hxx>
-
-#include <BRepFeat.hxx>
-#include <TopAbs.hxx>
+#include <TopTools_MapOfShape.hxx>
-#ifdef DEB
+//modified by NIZNHY-PKV Thu Mar 21 17:49:46 2002 f
+//#include <BRepAlgo_Cut.hxx>
+//#include <BRepAlgo_Fuse.hxx>
+//modified by NIZNHY-PKV Thu Mar 21 17:50:04 2002 t
+#ifdef OCCT_DEBUG
extern Standard_Boolean BRepFeat_GettraceFEAT();
#endif
TopoDS_Shape&, // myFShape
TopoDS_Shape&); // myLShape
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_DPrism&,
- TopTools_DataMapOfShapeShape&);
-
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap);
-#endif
-
static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
const TopoDS_Face& theSkface,
const TopoDS_Shape& theSFrom,
const Standard_Boolean Modify)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::Init" << endl;
#endif
myMap(exp.Current()).Append(exp.Current());
}
myAngle = Angle;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (trc) {
if (myJustFeat) cout << " Just Feature" << endl;
if (myFuse) cout << " Fuse" << endl;
void BRepFeat_MakeDPrism::Add(const TopoDS_Edge& E,
const TopoDS_Face& F)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::Add(Edge,face)" << endl;
#endif
void BRepFeat_MakeDPrism::Perform(const Standard_Real Height)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::Perform(Height)" << endl;
#endif
const TopoDS_Face& ff = TopoDS::Face(exp.Current());
if(ToFuse(ff, FFace)) {
TopTools_DataMapOfShapeListOfShape sl;
- //SetGluedFaces(ff, mySbase, FFace, sl, theDPrism, myGluedF);
break;
}
}
// management of gluing faces
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
if(!myGluedF.IsEmpty()) { // case gluing
myJustGluer = Standard_True;
void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& Until)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::Perform(Until)" << endl;
#endif
return;
}
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
-
-
theDPrism.Curves(myCurves);
myBCurve = theDPrism.BarycCurve();
GlobalPerform();
void BRepFeat_MakeDPrism::Perform(const TopoDS_Shape& From,
const TopoDS_Shape& Until)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::Perform(From,Until)" << endl;
#endif
GeneratedShapeValid();
// management of gluing faces
- //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
// mySbase, myPbase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
theDPrism.Curves(myCurves);
void BRepFeat_MakeDPrism::PerformUntilEnd()
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilEnd()" << endl;
#endif
void BRepFeat_MakeDPrism::PerformFromEnd(const TopoDS_Shape& Until)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::PerformFromEnd(From,Until)" << endl;
#endif
void BRepFeat_MakeDPrism::PerformThruAll()
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::PerformThruAll()" << endl;
#endif
void BRepFeat_MakeDPrism::PerformUntilHeight(const TopoDS_Shape& Until,
const Standard_Real Height)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::PerformUntilHeight(Until,Height)" << endl;
#endif
return;
}
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
-
theDPrism.Curves(myCurves);
myBCurve = theDPrism.BarycCurve();
GlobalPerform();
//============================================================================
void BRepFeat_MakeDPrism::BossEdges (const Standard_Integer signature)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
if (trc) cout << "BRepFeat_MakeDPrism::BossEdges (integer)" << endl;
#endif
// }
// Standard_Real Height = abs(2.*(parmax - parmin));
// return(2.*Height);
-//#ifndef DEB
+//#ifndef OCCT_DEBUG
Standard_Real par = Max( Max( fabs(c[1] - c[0]), fabs(c[3] - c[2]) ), fabs(c[5] - c[4]) );
//#else
// Standard_Real par = Max( Max( abs(c[1] - c[0]), abs(c[3] - c[2]) ), abs(c[5] - c[4]) );
//#endif
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Height = > " << par << endl;
#endif
return par;
return sens;
}
-
- //=======================================================================
-//function : SetGluedFaces
-//purpose :
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- TopExp_Explorer exp;
- if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- theMap.Bind(thePbase,theSkface);
- break;
- }
- }
- }
- else {
- TopExp_Explorer exp2;
- for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(exp.Current());
- for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
- if (exp2.Current().IsSame(fac)) {
- theMap.Bind(fac,fac);
- break;
- }
- }
- }
- }
-
- // Sliding
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
- if(!theSlmap.IsEmpty()) {
- for (; itm.More(); itm.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(itm.Key());
- const TopTools_ListOfShape& ledg = itm.Value();
- for (TopTools_ListIteratorOfListOfShape it(ledg); it.More(); it.Next()) {
- const TopTools_ListOfShape& gfac = theDPrism.Shapes(it.Value());
- if (gfac.Extent() != 1) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " BRepFeat_MakeDPrism : Pb SetGluedFace" << endl;
-#endif
- }
- theMap.Bind(gfac.First(),fac);
- }
- }
- }
-}
-
-
-//=======================================================================
-//function : VerifGluedFaces
-//purpose : Checking intersection Tool/theSkface = thePbase
-// if yes -> OK if no -> case without gluing
-//=======================================================================
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- Standard_Boolean GluedFaces = Standard_True;
- TopoDS_Shape VraiDPrism = theDPrism.Shape();
-
- TColGeom_SequenceOfCurve scur;
- theDPrism.Curves(theCurves);
- theBCurve = theDPrism.BarycCurve();
- scur.Clear();
- scur.Append(theBCurve);
- LocOpe_CSIntersector ASI(theSkface);
- ASI.Perform(scur);
- if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
- TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
- TopoDS_Face FSk = ASI.Point(1,1).Face();
- TopoDS_Shape Comp;
- BRep_Builder B;
- B.MakeCompound(TopoDS::Compound(Comp));
- TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
- if (!S.IsNull()) B.Add(Comp,S);
- //modified by NIZNHY-PKV Thu Mar 21 17:48:45 2002 f
- //BRepAlgo_Cut trP(VraiDPrism,Comp);
- BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
- //modified by NIZNHY-PKV Thu Mar 21 17:48:49 2002 t
- TopoDS_Shape Cutsh = trP.Shape();
- TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
- for(; ex.More(); ex.Next()) {
- TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
- for(; ex1.More(); ex1.Next()) {
- const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
- TopExp_Explorer ex2(thePbase, TopAbs_FACE);
- for(; ex2.More(); ex2.Next()) {
- const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
- if(fac1.IsSame(fac2)) break;
- }
- if (ex2.More()) break;
- }
- if (ex1.More()) continue;
- GluedFaces = Standard_False;
- break;
- }
- if (!GluedFaces) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " Intersection DPrism/skface : no gluing" << endl;
-#endif
- theMap.Clear();
- }
- }
-}
-#endif
-
//=======================================================================
//function : MajMap
//purpose :
typS2 = S2->DynamicType();
if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
- S1 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface();
+ S1 = Handle(Geom_RectangularTrimmedSurface)::DownCast (S1)->BasisSurface();
typS1 = S1->DynamicType();
}
if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
- S2 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface();
+ S2 = Handle(Geom_RectangularTrimmedSurface)::DownCast (S2)->BasisSurface();
typS2 = S2->DynamicType();
}
if (typS1 == STANDARD_TYPE(Geom_Plane)) {
S1 = BRep_Tool::Surface(F1); // to apply the location.
S2 = BRep_Tool::Surface(F2);
- gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln());
- gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln());
+ gp_Pln pl1( Handle(Geom_Plane)::DownCast (S1)->Pln());
+ gp_Pln pl2( Handle(Geom_Plane)::DownCast (S2)->Pln());
if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) {
ValRet = Standard_True;