diff --git a/adm/UDLIST b/adm/UDLIST
index 6470a2ad50..7d23aeed13 100644
--- a/adm/UDLIST
+++ b/adm/UDLIST
@@ -398,9 +398,6 @@ n HLRTest
n MeshTest
n SWDRAW
n TObjDRAW
-n TestTopOpe
-n TestTopOpeDraw
-n TestTopOpeTools
n ViewerTest
n XDEDRAW
n XSDRAW
diff --git a/adm/upgrade.dat b/adm/upgrade.dat
index d917e09d61..36deb7169a 100644
--- a/adm/upgrade.dat
+++ b/adm/upgrade.dat
@@ -801,13 +801,6 @@ TDF_LabelSequence
TDocStd_LabelIDMapDataMap
TDocStd_SequenceOfApplicationDelta
TDocStd_SequenceOfDocument
-TestTopOpeDraw_Array1OfDrawableMesure
-TestTopOpeDraw_Array1OfDrawableP3D
-TestTopOpeDraw_HArray1OfDrawableMesure
-TestTopOpeDraw_HArray1OfDrawableP3D
-TestTopOpeDraw_ListOfPnt2d
-TestTopOpeTools_Array1OfMesure
-TestTopOpeTools_HArray1OfMesure
TFunction_Array1OfDataMapOfGUIDDriver
TFunction_DataMapOfGUIDDriver
TFunction_DataMapOfLabelListOfLabel
diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md
index 7be91788cc..4603e32efc 100644
--- a/dox/dev_guides/upgrade/upgrade.md
+++ b/dox/dev_guides/upgrade/upgrade.md
@@ -1126,6 +1126,9 @@ The following obsolete features have been removed:
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.
@subsection upgrade_occt720_correction_of_Offset_API Corrections in BRepOffset API
diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md
index d4f54d1994..a2da869de8 100644
--- a/dox/user_guides/draw_test_harness/draw_test_harness.md
+++ b/dox/user_guides/draw_test_harness/draw_test_harness.md
@@ -5439,7 +5439,7 @@ parameters p 5 5 5 u v
# the values of u and v are : 0 5
~~~~~
-@subsubsection occt_draw_6_6_6 proj, dproj
+@subsubsection occt_draw_6_6_6 proj, 2dproj
Syntax:
~~~~~
@@ -5571,13 +5571,50 @@ surfapp s 3 4 \
0 30 0 10 30 0 20 30 0
~~~~~
-@subsection occt_draw_6_9 Constraints
+@subsection occt_draw_6_9 Projections
+
+Draw provides commands to project points/curves on curves/surfaces.
+
+* **proj** projects point on the curve/surface (see @ref occt_draw_6_6_6 "proj command description");
+* **project** projects 3D curve on the surface (see @ref occt_draw_6_2_11 "project command description");
+* **projponf** projects point on the face.
+
+@subsubsection occt_draw_6_9_1 projponf
+
+Syntax:
+~~~~~
+projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]
+~~~~~
+
+**projponf** projects point *pnt* on the face *face*.
+You can change the Extrema options:
+* To change the Extrema search algorithm use the following options:
+ -g - for Grad algorithm;
+ -t - for Tree algorithm;
+* To change the Extrema search solutions use the following options:
+ -min - to look for Min solutions;
+ -max - to look for Max solutions;
+ -minmax - to look for MinMax solutions.
+
+**Example**
+~~~~~
+plane p 0 0 0 0 0 1
+mkface f p
+point pnt 5 5 10
+
+projponf f pnt
+# proj dist = 10
+# uvproj = 5 5
+# pproj = 5 5 0
+~~~~~
+
+@subsection occt_draw_6_10 Constraints
* **cirtang** constructs 2d circles tangent to curves;
* **lintan** constructs 2d lines tangent to curves.
-@subsubsection occt_draw_6_9_1 cirtang
+@subsubsection occt_draw_6_10_1 cirtang
Syntax:
~~~~~
@@ -5595,7 +5632,7 @@ cirtang c p 1 4
== c_1 c_2
~~~~~
-@subsubsection occt_draw_6_9_2 lintan
+@subsubsection occt_draw_6_10_2 lintan
Syntax:
~~~~~
@@ -5618,7 +5655,7 @@ line l 2 0 1 1
lintan l1 c1 l 15
~~~~~
-@subsection occt_draw_6_10 Display
+@subsection occt_draw_6_11 Display
Draw provides commands to control the display of geometric objects. Some display parameters are used for all objects, others are valid for surfaces only, some for bezier and bspline only, and others for bspline only.
@@ -5631,7 +5668,7 @@ On bezier and bspline curve and surface you can toggle the display of the contro
On bspline curves and surfaces you can toggle the display of the knots with the **shknots** and **clknots** commands.
-@subsubsection occt_draw_6_10_1 dmod, discr, defle
+@subsubsection occt_draw_6_11_1 dmod, discr, defle
Syntax:
~~~~~
@@ -5658,7 +5695,7 @@ discr 100
dmode c u
~~~~~
-@subsubsection occt_draw_6_10_2 nbiso
+@subsubsection occt_draw_6_11_2 nbiso
Syntax:
~~~~~
@@ -5675,7 +5712,7 @@ sphere s 20
nbiso s 35 15
~~~~~
-@subsubsection occt_draw_6_10_3 clpoles, shpoles
+@subsubsection occt_draw_6_11_3 clpoles, shpoles
Syntax:
~~~~~
@@ -5694,7 +5731,7 @@ beziercurve c 3 0 0 0 10 0 0 10 10 0
clpoles c
~~~~~
-@subsubsection occt_draw_6_10_4 clknots, shknots
+@subsubsection occt_draw_6_11_4 clknots, shknots
Syntax:
~~~~~
@@ -5931,6 +5968,49 @@ this shape seems to be valid
**Note** that this test is performed using the tolerance set in the algorithm.
+@subsubsection occt_draw_7_1_6 compare
+
+Syntax:
+~~~~~
+compare shape1 shape2
+~~~~~
+
+**compare** compares the two shapes *shape1* and *shape2* using the methods *TopoDS_Shape::IsSame()* and *TopoDS_Shape::IsEqual()*.
+
+**Example**
+~~~~~
+box b1 1 1 1
+copy b1 b2
+compare b1 b2
+# same shapes
+# equal shapes
+
+orientation b2 R
+compare b1 b2
+# same shapes
+
+box b2 1 1 1
+compare b1 b2
+# shapes are not same
+~~~~~
+
+@subsubsection occt_draw_7_1_7 issubshape
+
+Syntax:
+~~~~~
+issubshape subshape shape
+~~~~~
+
+**issubshape** checks if the shape *subshape* is sub-shape of the shape *shape* and gets its index in the shape.
+
+**Example**
+~~~~~
+box b 1 1 1
+explode b f
+issubshape b_2 b
+# b_2 is sub-shape of b. Index in the shape: 2.
+~~~~~
+
@subsection occt_draw_7_2 Curve and surface topology
diff --git a/src/BOPTest/BOPTest.cxx b/src/BOPTest/BOPTest.cxx
index 2055ddb5c3..661e8cfcc7 100644
--- a/src/BOPTest/BOPTest.cxx
+++ b/src/BOPTest/BOPTest.cxx
@@ -18,10 +18,12 @@
#include
#include
#include
+#include
#include
#include
#include
#include
+#include
//=======================================================================
//function : AllCommands
@@ -64,4 +66,7 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
MeshTest::Commands(theCommands);
HLRTest::Commands(theCommands);
BOPTest::AllCommands(theCommands);
+ SWDRAW::Init (theCommands);
}
+// Declare entry point PLUGINFACTORY
+DPLUGIN(BOPTest)
diff --git a/src/BRepAlgo/BRepAlgo_DSAccess.cxx b/src/BRepAlgo/BRepAlgo_DSAccess.cxx
index 1440ccbf9e..f659555a93 100644
--- a/src/BRepAlgo/BRepAlgo_DSAccess.cxx
+++ b/src/BRepAlgo/BRepAlgo_DSAccess.cxx
@@ -52,9 +52,6 @@
#include
#include
-#ifdef DRAW
-//#include
-#endif
//=======================================================================
//function : Create
@@ -145,10 +142,6 @@ void BRepAlgo_DSAccess::Load(TopoDS_Shape& S1,
myS1 = S1;
myS2 = S2;
-#ifdef DRAW
-// TestTopOpe::CurrentDS(myHDS);
-// TestTopOpe::Shapes(myS1,myS2);
-#endif
}
//=======================================================================
diff --git a/src/BRepTest/BRepTest_BasicCommands.cxx b/src/BRepTest/BRepTest_BasicCommands.cxx
index b195b67d38..0d0a9ff496 100644
--- a/src/BRepTest/BRepTest_BasicCommands.cxx
+++ b/src/BRepTest/BRepTest_BasicCommands.cxx
@@ -977,6 +977,83 @@ static Standard_Integer scalexyz(Draw_Interpretor& /*di*/, Standard_Integer n, c
return 0;
}
+//=======================================================================
+//function : compareshapes
+//purpose :
+//=======================================================================
+static Standard_Integer compareshapes(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n != 3) {
+ di << "Compare shapes. Usage: compare shape1 shape2\n";
+ return 1;
+ }
+ // get shapes
+ TopoDS_Shape aS1 = DBRep::Get(a[1]);
+ TopoDS_Shape aS2 = DBRep::Get(a[2]);
+ // check shapes
+ if (aS1.IsNull() || aS2.IsNull()) {
+ di << "null shapes\n";
+ return 0;
+ }
+ // compare shapes
+ if (aS1.IsSame(aS2)) {
+ di << "same shapes\n";
+ if (aS1.IsEqual(aS2)) {
+ di << "equal shapes\n";
+ }
+ }
+ else {
+ di << "shapes are not same\n";
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : issubshape
+//purpose :
+//=======================================================================
+static Standard_Integer issubshape(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n != 3) {
+ di << "Check if the shape is sub-shape of other shape and get its index in the shape.\n";
+ di << "Usage: issubshape subshape shape\n";
+ return 1;
+ }
+ // get shapes
+ TopoDS_Shape aSubShape = DBRep::Get(a[1]);
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ // check shapes
+ if (aSubShape.IsNull() || aShape.IsNull()) {
+ di << "null shapes\n";
+ return 0;
+ }
+ // find index of the sub-shape in the shape
+ TopTools_MapOfShape aMShapes;
+ // try to find the SubShape in Shape
+ TopExp_Explorer anExp(aShape, aSubShape.ShapeType());
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape& aSS = anExp.Current();
+ if (aMShapes.Add(aSS)) {
+ if (aSS.IsSame(aSubShape)) {
+ break;
+ }
+ }
+ }
+ //
+ if (anExp.More()) {
+ di << a[1] << " is sub-shape of " << a[2] << ". Index in the shape: " << aMShapes.Extent() << ".\n";
+ }
+ else {
+ di << a[1] << " is NOT sub-shape of " << a[2] << ".\n";
+ }
+ //
+ return 0;
+}
+
void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
@@ -1149,4 +1226,15 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
"scalexyz res shape factor_x factor_y factor_z",
__FILE__,
scalexyz, g);
+
+ theCommands.Add("compare",
+ "Compare shapes. Usage: compare shape1 shape2",
+ __FILE__,
+ compareshapes, g);
+
+ theCommands.Add("issubshape",
+ "issubshape subshape shape\n"
+ "\t\tCheck if the shape is sub-shape of other shape and get its index in the shape.",
+ __FILE__,
+ issubshape, g);
}
diff --git a/src/BRepTest/BRepTest_SurfaceCommands.cxx b/src/BRepTest/BRepTest_SurfaceCommands.cxx
index dfe883e83d..2cfd440451 100644
--- a/src/BRepTest/BRepTest_SurfaceCommands.cxx
+++ b/src/BRepTest/BRepTest_SurfaceCommands.cxx
@@ -45,6 +45,8 @@
#include
#include
+#include
+
#ifdef _WIN32
//#define strcasecmp strcmp Already defined
#include
@@ -575,6 +577,104 @@ static Standard_Integer getedgeregul
return 0; // Done
}
+//=======================================================================
+//function : projponf
+//purpose :
+//=======================================================================
+static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n < 3 || n > 5) {
+ di << "Project point on the face.\n";
+ di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
+ return 1;
+ }
+ // get face
+ TopoDS_Shape aS = DBRep::Get(a[1]);
+ if (aS.IsNull()) {
+ di << "the face is a null shape\n";
+ return 0;
+ }
+ //
+ if (aS.ShapeType() != TopAbs_FACE) {
+ di << "not a face\n";
+ return 0;
+ }
+ //
+ const TopoDS_Face& aFace = *(TopoDS_Face*)&aS;
+ //
+ // get point
+ gp_Pnt aP;
+ DrawTrSurf::GetPoint(a[2], aP);
+ //
+ // get projection options
+ // default values;
+ Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
+ Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
+ //
+ for (Standard_Integer i = 3; i < n; ++i) {
+ if (!strcasecmp(a[i], "-min")) {
+ anExtFlag = Extrema_ExtFlag_MIN;
+ }
+ else if (!strcasecmp(a[i], "-max")) {
+ anExtFlag = Extrema_ExtFlag_MAX;
+ }
+ else if (!strcasecmp(a[i], "-minmax")) {
+ anExtFlag = Extrema_ExtFlag_MINMAX;
+ }
+ else if (!strcasecmp(a[i], "-t")) {
+ anExtAlgo = Extrema_ExtAlgo_Tree;
+ }
+ else if (!strcasecmp(a[i], "-g")) {
+ anExtAlgo = Extrema_ExtAlgo_Grad;
+ }
+ }
+ //
+ // get surface
+ TopLoc_Location aLoc;
+ const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aLoc);
+ // move point to surface location
+ aP.Transform(aLoc.Transformation().Inverted());
+ //
+ // get bounds of the surface
+ Standard_Real aUMin, aUMax, aVMin, aVMax;
+ aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
+ //
+ // initialize projector
+ GeomAPI_ProjectPointOnSurf aProjPS;
+ aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
+ // set the options
+ aProjPS.SetExtremaAlgo(anExtAlgo);
+ aProjPS.SetExtremaFlag(anExtFlag);
+ // perform projection
+ aProjPS.Perform(aP);
+ //
+ if (aProjPS.NbPoints()) {
+ // lower distance
+ Standard_Real aDist = aProjPS.LowerDistance();
+ // lower distance parameters
+ Standard_Real U, V;
+ aProjPS.LowerDistanceParameters(U, V);
+ // nearest point
+ gp_Pnt aPProj = aProjPS.NearestPoint();
+ // translate projection point to face location
+ aPProj.Transform(aLoc.Transformation());
+ //
+ // print the projection values
+ di << "proj dist = " << aDist << "\n";
+ di << "uvproj = " << U << " " << V << "\n";
+ di << "pproj = " << aPProj.X() << " " << aPProj.Y() << " " << aPProj.Z() << "\n";
+ }
+ else {
+ if (!aProjPS.IsDone()) {
+ di << "projection failed\n";
+ }
+ else {
+ di << "no projection found\n";
+ }
+ }
+ return 0;
+}
+
//=======================================================================
//function : SurfaceCommands
//purpose :
@@ -630,5 +730,10 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add ("fastsewing", "fastsewing result [-tol ] ",
__FILE__, fastsewing, g);
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
+
+ theCommands.Add ("projponf",
+ "projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
+ "\t\tProject point on the face.",
+ __FILE__, projponf, g);
}
diff --git a/src/ChFi3d/ChFi3d_Builder.cxx b/src/ChFi3d/ChFi3d_Builder.cxx
index cd1d2658b0..9514f7cc10 100644
--- a/src/ChFi3d/ChFi3d_Builder.cxx
+++ b/src/ChFi3d/ChFi3d_Builder.cxx
@@ -80,10 +80,6 @@
#include
#include
-#ifdef DRAW
-#include
-#include
-#endif
#ifdef OCCT_DEBUG
#include
@@ -237,11 +233,6 @@ void ChFi3d_Builder::Compute()
TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
done = Standard_True;
hasresult=Standard_False;
-#ifdef DRAW
- TestTopOpe::CurrentDS(myDS);
- TopoDS_Shape bids;
- TestTopOpe::Shapes(myShape,bids);
-#endif
// filling of myVDatatMap
ChFiDS_ListIteratorOfListOfStripe itel;
diff --git a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.hxx b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.hxx
index 43dfc11020..2619f446b8 100644
--- a/src/GeomAPI/GeomAPI_ProjectPointOnSurf.hxx
+++ b/src/GeomAPI/GeomAPI_ProjectPointOnSurf.hxx
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -84,7 +85,21 @@ public:
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Quantity_Parameter Umin, const Quantity_Parameter Usup, const Quantity_Parameter Vmin, const Quantity_Parameter Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Quantity_Parameter Umin, const Quantity_Parameter Usup, const Quantity_Parameter Vmin, const Quantity_Parameter Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
-
+
+ //! Sets the Extrema search algorithm - Grad or Tree.
+ //! By default the Extrema is initialized with Grad algorithm.
+ void SetExtremaAlgo(const Extrema_ExtAlgo theAlgo)
+ {
+ myExtPS.SetAlgo(theAlgo);
+ }
+
+ //! Sets the Extrema search flag - MIN or MAX or MINMAX.
+ //! By default the Extrema is set to search the MinMax solutions.
+ void SetExtremaFlag(const Extrema_ExtFlag theExtFlag)
+ {
+ myExtPS.SetFlag(theExtFlag);
+ }
+
//! Performs the projection of a point on the current surface.
Standard_EXPORT void Perform (const gp_Pnt& P);
diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx
index 0ba725b007..903a0e38f9 100644
--- a/src/IntTools/IntTools_Context.cxx
+++ b/src/IntTools/IntTools_Context.cxx
@@ -282,9 +282,8 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
//
pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
new (pProjPS) GeomAPI_ProjectPointOnSurf();
- pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, myPOnSTolerance/*, Extrema_ExtAlgo_Tree*/);
- Extrema_ExtPS& anExtAlgo = const_cast(pProjPS->Extrema());
- anExtAlgo.SetFlag(Extrema_ExtFlag_MIN);
+ pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, myPOnSTolerance);
+ pProjPS->SetExtremaFlag(Extrema_ExtFlag_MIN);
//
anAdr=(Standard_Address)pProjPS;
myProjPSMap.Bind(aF, anAdr);
diff --git a/src/TKTopTest/PACKAGES b/src/TKTopTest/PACKAGES
index e69da69576..90d24dd3c7 100755
--- a/src/TKTopTest/PACKAGES
+++ b/src/TKTopTest/PACKAGES
@@ -1,6 +1,3 @@
-TestTopOpeDraw
-TestTopOpeTools
-TestTopOpe
BRepTest
GeometryTest
HLRTest
diff --git a/src/TestTopOpe/FILES b/src/TestTopOpe/FILES
deleted file mode 100755
index 9b1fe72f57..0000000000
--- a/src/TestTopOpe/FILES
+++ /dev/null
@@ -1,18 +0,0 @@
-FILES
-TestTopOpe.cxx
-TestTopOpe.hxx
-TestTopOpe_BOOP.cxx
-TestTopOpe_BOOP.hxx
-TestTopOpe_BOOPCommands.cxx
-TestTopOpe_CORCommands.cxx
-TestTopOpe_DSF.cxx
-TestTopOpe_EditBOOP.cxx
-TestTopOpe_HDSCommands.cxx
-TestTopOpe_HDSDisplayer.cxx
-TestTopOpe_HDSDisplayer.hxx
-TestTopOpe_KroBOOP.cxx
-TestTopOpe_MesureCommands.cxx
-TestTopOpe_MiscBOOP.cxx
-TestTopOpe_OtherCommands.cxx
-TestTopOpe_VarsTopo.cxx
-TestTopOpe_VarsTopo.hxx
diff --git a/src/TestTopOpe/TestTopOpe.cxx b/src/TestTopOpe/TestTopOpe.cxx
deleted file mode 100644
index b32f08e164..0000000000
--- a/src/TestTopOpe/TestTopOpe.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-// Created on: 1994-10-24
-// Created by: Jean Yves LEBEY
-// Copyright (c) 1994-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
-
-#ifdef _MSC_VER
-#pragma warning(4:4190)
-#endif
-
-//=======================================================================
-//function : AllCommands
-//purpose :
-//=======================================================================
-
-void TestTopOpe::AllCommands(Draw_Interpretor& theCommands)
-{
- static Standard_Boolean done = Standard_False;
- if (done) return;
-
- done = Standard_True;
-
- TestTopOpe::BOOPCommands(theCommands);
- TestTopOpe::HDSCommands(theCommands);
- TestTopOpe::MesureCommands(theCommands);
- TestTopOpe::CORCommands(theCommands);
- //TestTopOpe::DSACommands(theCommands);
- TestTopOpe::OtherCommands(theCommands);
- TestTopOpeTools::AllCommands(theCommands);
- TestTopOpeDraw::AllCommands(theCommands);
-}
-
-extern TestTopOpe_HDSDisplayer* PHDSD;
-extern TestTopOpe_BOOP* PBOOP;
-
-//=======================================================================
-//function : Shapes
-//purpose :
-//=======================================================================
-void TestTopOpe::Shapes(const TopoDS_Shape& S1,const TopoDS_Shape& S2)
-{
- if (PHDSD != NULL) { PHDSD->SetShape1(S1);PHDSD->SetShape2(S2); }
- if (PBOOP != NULL) { PBOOP->SetShape1(S1);PBOOP->SetShape2(S2); }
-}
-
-//=======================================================================
-//function : CurrentHDS
-//purpose :
-//=======================================================================
-void TestTopOpe::CurrentDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
-{
- if (PHDSD != NULL) { PHDSD->SetCurrentHDS(HDS); }
- if (PBOOP != NULL) { PBOOP->SetCurrentHDS(HDS); }
-}
-
-//=======================================================================
-//function : CurrentHB
-//purpose :
-//=======================================================================
-void TestTopOpe::CurrentHB(const Handle(TopOpeBRepBuild_HBuilder)& HB)
-{
- if (PBOOP != NULL) { PBOOP->SetCurrentHB(HB); }
-}
-
-//==============================================================================
-// TestTopOpe::Factory
-//==============================================================================
-void TestTopOpe::Factory(Draw_Interpretor& theDI)
-{
- static Standard_Boolean FactoryDone = Standard_False;
- if (FactoryDone) return;
-
- FactoryDone = Standard_True;
-
- TestTopOpe::AllCommands(theDI);
-
- BOPTest::Factory(theDI);
-
- SWDRAW::Init (theDI);
-
-#ifdef OCCT_DEBUG
- cout << "Draw Plugin : All topological operations kernel commands are loaded" << endl;
-#endif
-}
-// Declare entry point PLUGINFACTORY
-DPLUGIN(TestTopOpe)
diff --git a/src/TestTopOpe/TestTopOpe.hxx b/src/TestTopOpe/TestTopOpe.hxx
deleted file mode 100644
index dfd74a620a..0000000000
--- a/src/TestTopOpe/TestTopOpe.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-// Created on: 1996-10-21
-// Created by: Jean Yves LEBEY
-// Copyright (c) 1996-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 _TestTopOpe_HeaderFile
-#define _TestTopOpe_HeaderFile
-
-#include
-#include
-#include
-
-#include
-class TopOpeBRepBuild_HBuilder;
-class TopOpeBRepDS_HDataStructure;
-class TopoDS_Shape;
-
-
-
-class TestTopOpe
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Defines all Top. Ope. test commands
- Standard_EXPORT static void AllCommands (Draw_Interpretor& I);
-
- Standard_EXPORT static void TOPOCommands (Draw_Interpretor& I);
-
- Standard_EXPORT static void BOOPCommands (Draw_Interpretor& I);
-
- //! commands on a HDS involved in topological operations
- Standard_EXPORT static void HDSCommands (Draw_Interpretor& I);
-
- //! Defines the HBuilder on which BOOPCommands will operate.
- Standard_EXPORT static void CurrentHB (const Handle(TopOpeBRepBuild_HBuilder)& HDS);
-
- //! Defines the HDS on which HDSCommands/BOOPCommands will operate.
- Standard_EXPORT static void CurrentDS (const Handle(TopOpeBRepDS_HDataStructure)& HDS);
-
- //! Defines current shapes of current topological operation
- Standard_EXPORT static void Shapes (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
-
- Standard_EXPORT static void MesureCommands (Draw_Interpretor& I);
-
- Standard_EXPORT static void CORCommands (Draw_Interpretor& I);
-
- Standard_EXPORT static void DSACommands (Draw_Interpretor& I);
-
- Standard_EXPORT static void OtherCommands (Draw_Interpretor& I);
-
- //! Loads all Draw commands of TKDrawDEB. Used for plugin.
- Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _TestTopOpe_HeaderFile
diff --git a/src/TestTopOpe/TestTopOpe_BOOP.cxx b/src/TestTopOpe/TestTopOpe_BOOP.cxx
deleted file mode 100644
index 0d9d43878c..0000000000
--- a/src/TestTopOpe/TestTopOpe_BOOP.cxx
+++ /dev/null
@@ -1,493 +0,0 @@
-// Created on: 1996-02-05
-// Created by: Jea Yves LEBEY
-// Copyright (c) 1996-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
-#ifdef _WIN32
-Standard_IMPORT Draw_Viewer dout;
-#endif
-
-extern Standard_Integer TOPOPE_SeeShape(char *name);
-
-#ifdef OCCT_DEBUG
-#include
-extern Standard_Boolean TopOpeBRepTool_GettraceKRO();
-extern void PrintKRO_PREPA();
-#endif
-
-Standard_Integer TestTopOpe_BOOP::Prepare(const char* ns1,const char* ns2)
-{
- Standard_Integer anErrorCode = 0;
- anErrorCode = LoadShapes(ns1,ns2); // mylastPREP is 0
- if (anErrorCode)
- return anErrorCode;
-
- anErrorCode = LoadnewDS(); // mylastPREP is 100
- if (anErrorCode)
- return anErrorCode;
-
- anErrorCode = DSF_Insert(); // mylastPREP is (100,200)
- if (anErrorCode)
- return anErrorCode;
-
- anErrorCode = LoadnewHB(); // mylastPREP is 200
- if (anErrorCode)
- return anErrorCode;
-
- anErrorCode = Builder_Perform(); // mylastPREP is (200,300)
- return anErrorCode;
-}
-
-Standard_Integer TestTopOpe_BOOP::LoadShapes(const char* ns1, const char* ns2)
-{
- if (ns1==NULL) return 1;TopoDS_Shape S1=DBRep::Get(ns1);if (S1.IsNull()) return 1;
- if (ns2==NULL) return 1;TopoDS_Shape S2=DBRep::Get(ns2);if (S2.IsNull()) return 1;
- SetShape1(S1); mynameS1 = ns1;
- SetShape2(S2); mynameS2 = ns2;
- mylastPREP = 0;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::LoadnewDS()
-{
- myHDS = new TopOpeBRepDS_HDataStructure();
- TestTopOpe::Shapes(myS1,myS2);
- TestTopOpe::CurrentDS(myHDS);
- if (myPDSF != NULL) { free((TopOpeBRep_DSFiller*)myPDSF); myPDSF = NULL; }
- myPDSF = new TopOpeBRep_DSFiller();
- mylastPREP = 100;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert()
-{
- TopOpeBRep_DSFiller DSF;
- DSF_Insert(DSF);
- mylastPREP = 190;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::LoadnewHB()
-{
- TopOpeBRepTool_GeomTool GT;
- Standard_Boolean c2d = myVarsTopo.GetC2D();
- GT.Define(myVarsTopo.GetOCT(),Standard_True,c2d, c2d);
- Standard_Real t3,t2; myVarsTopo.GetTolx(t3,t2);
- GT.SetTolerances(t3,t2);
- TopOpeBRepDS_BuildTool BT(GT);
- myHB = new TopOpeBRepBuild_HBuilder(BT);
- mylastPREP = 200;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::Builder_Perform()
-{
- myHB->Perform(myHDS,myS1,myS2);
-#ifdef OCCT_DEBUG
- if ( TopOpeBRepTool_GettraceKRO() ) PrintKRO_PREPA();
-#endif
- myESP = myHDS->EdgesSameParameter();
- myPREPdone = Standard_True;
- myBOOdone = Standard_False;
- mylastPREP = 290;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::FaceFilter()
-{
- TopOpeBRepDS_Filter F(myHDS);
- F.ProcessFaceInterferences(myHB->ChangeBuilder().MSplit(TopAbs_ON));
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::FaceReducer()
-{
- TopOpeBRepDS_Reducer R(myHDS);
- R.ProcessFaceInterferences(myHB->ChangeBuilder().MSplit(TopAbs_ON));
- return 0;
-}
-
-Standard_Boolean TestTopOpe_BOOP::CheckBooope(const char* key)
-{
- Standard_Boolean res = Standard_True;
- Operation_t o = Operation(key);
- if (o == BOOP_UND) return Standard_False;
-
- if ( !myPREPdone) {
- cout<<"pas de preparation"<NbShapes();
- Standard_Integer i1 = 0, i2 = 0;
- if (is != 0) {
- if (is > ns || ns < 1) {
- cout<<"index "<Shape(ids).ShapeType(),ix)<<" of "<Shape(ids).ShapeType(),ix)<<" of "<Shape(ids);
- Standard_Integer i = FindShape(S,Sref);
- return i;
-}
-
-Standard_Integer TestTopOpe_BOOP::FindShape(const TopoDS_Shape& S,const TopoDS_Shape& Sref)
-{
- if (Sref.IsNull()) return 0; TopExp_Explorer x; Standard_Integer i;
- for (i=1,x.Init(Sref,S.ShapeType());x.More();x.Next(),i++)
- if (x.Current().IsSame(S)) return i;
- return 0;
-}
-
-void TestTopOpe_BOOP::Booope(const char* key,const char *namres)
-{
- Standard_Boolean res = CheckBooope(key);
- if (!res) return;
- if (myHB.IsNull()) return;
-
- Operation_t o = Operation(key);
-
- if (o == BOOP_SECC || o == BOOP_SECE || o == BOOP_SEC) {
- Standard_Integer k;
- if (o == BOOP_SECC) k = 1; // section sur courbes
- else if (o == BOOP_SECE) k = 2; // section sur aretes
- else if (o == BOOP_SEC) k = 3; // toutes sections
- else return;
- TopTools_ListOfShape LE; myHB->InitSection(k);
- for (;myHB->MoreSection();myHB->NextSection())
- LE.Append(myHB->CurrentSection());
- MakeResult(LE); StoreResult(key,namres);
- }
-
- else if (o == BOOP_C12 || o == BOOP_C21 || o == BOOP_COM || o == BOOP_FUS) {
-
- TopAbs_State t1=TopAbs_UNKNOWN,t2=TopAbs_UNKNOWN;
- if (o == BOOP_C12) { t1 = TopAbs_OUT; t2 = TopAbs_IN; }
- else if (o == BOOP_C21) { t1 = TopAbs_IN; t2 = TopAbs_OUT; }
- else if (o == BOOP_COM) { t1 = TopAbs_IN; t2 = TopAbs_IN; }
- else if (o == BOOP_FUS) { t1 = TopAbs_OUT; t2 = TopAbs_OUT; }
-
- if((myS2type > TopAbs_WIRE) && (o == BOOP_COM)) {
- BRepAlgo_BooleanOperations babo;
- babo.Shapes2d(myS1,myS2);
- TestTopOpe::CurrentDS(babo.DataStructure());
- babo.Common();
- myHB = babo.Builder();
- const TopTools_ListOfShape& LE = myHB->Splits(myS2, TopAbs_IN);
- MakeResult(LE); StoreResult(key,namres);
- return;
- }
-
- myHB->Clear();
- myHB->MergeShapes(myS1,t1,myS2,t2);
- cout<<"MergeShapes done"<Merged(myS1,t1);
- MakeResult(L1);
- StoreResult(key,namres);
- }
-
- myBOOdone = Standard_True;
-}
-
-void TestTopOpe_BOOP::ClearResult()
-{
- BRep_Builder BB;
- BB.MakeCompound(myCresult);
- myNresult = 0;
-}
-
-void TestTopOpe_BOOP::AddResult(const TopTools_ListOfShape& L)
-{
- BRep_Builder BB;
- TopTools_ListIteratorOfListOfShape it(L);
- for (; it.More(); it.Next(), myNresult++) BB.Add(myCresult,it.Value());
-}
-
-void TestTopOpe_BOOP::MakeResult(const TopTools_ListOfShape& L)
-{
- ClearResult();
- AddResult(L);
-}
-
-void TestTopOpe_BOOP::StoreResult
-(const char* key,const char* namres, char* extent) const
-{
- const char* nam = (namres == NULL) ? myresnamdef : namres;
- if (nam == NULL) return;
- char na[100]; strcpy(na,nam);if (extent!=NULL) strcat(na,extent);
-
- if (Operation(key) != BOOP_SEC && myVarsTopo.GetClear()) dout.Clear();
- DBRep::Set(na,myCresult);
- if (key != NULL) {
- cout<<"("<DataStructure().IsNull() ) return;
- ClearResult();
- Standard_Integer ns = myHB->DataStructure()->DS().NbShapes();
- for (Standard_Integer is = 1; is <= ns; is++) {
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(is);
- Standard_Boolean issplit = myHB->IsSplit(S,sta);
- if (issplit) {
- GetSplit(typ,sta,is);
- }
- }
-}
-
-void TestTopOpe_BOOP::GetSplit(const TopAbs_ShapeEnum typ,
- const TopAbs_State sta,
- const Standard_Integer isha)
-{
- if (isha == 0) return;
- if ( myHB.IsNull() ) return;
- if ( myHB->DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<IsSplit(S,sta);
- if (issplit) {
- const TopTools_ListOfShape& LS = myHB->Splits(S,sta);
- ClearResult();
- AddResult(LS);
- TCollection_AsciiString namres;
-
- if (typ==TopAbs_EDGE) namres = "e";
- else if (typ==TopAbs_FACE) namres = "f";
- else if (typ==TopAbs_SOLID) namres = "s";
- namres += TCollection_AsciiString(isha);
-// namres += "sp";
- if (sta==TopAbs_IN) namres += "in";
- else if (sta==TopAbs_OUT) namres += "ou";
- else if (sta==TopAbs_ON) namres += "on";
-
- cout< "<DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<IsSplit(S,sta);
- if (issplit) {
- GetSplit(typ,sta,isha);
- }
-}
-
-void TestTopOpe_BOOP::GetSplit(const Standard_Integer isha)
-{
- if (isha == 0) return;
- if ( myHB.IsNull() ) return;
- if ( myHB->DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<DataStructure().IsNull() ) return;
- GetSplit(TopAbs_SOLID,sta);
- GetSplit(TopAbs_FACE,sta);
- GetSplit(TopAbs_EDGE,sta);
-}
-
-void TestTopOpe_BOOP::GetMerged(const TopAbs_ShapeEnum typ,const TopAbs_State sta)
-{
- if ( myHB.IsNull() ) return;
- if ( myHB->DataStructure().IsNull() ) return;
- ClearResult();
- Standard_Integer ns = myHB->DataStructure()->DS().NbShapes();
- for (Standard_Integer is = 1; is <= ns; is++) {
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(is);
- Standard_Boolean isMerged = myHB->IsMerged(S,sta);
- if (isMerged) {
- GetMerged(typ,sta,is);
- }
- }
-}
-
-void TestTopOpe_BOOP::GetMerged(const TopAbs_ShapeEnum typ,const TopAbs_State sta,const Standard_Integer isha)
-{
- if (isha == 0) return;
- if ( myHB.IsNull() ) return;
- if ( myHB->DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<IsMerged(S,sta);
- if (isMerged) {
- const TopTools_ListOfShape& LS = myHB->Merged(S,sta);
- ClearResult();
- AddResult(LS);
- TCollection_AsciiString namres;
-
- if (typ==TopAbs_EDGE) namres = "e";
- else if (typ==TopAbs_FACE) namres = "f";
- else if (typ==TopAbs_SOLID) namres = "s";
- namres += TCollection_AsciiString(isha);
- namres += "me";
- if (sta==TopAbs_IN) namres += "IN";
- else if (sta==TopAbs_OUT) namres += "OUT";
- else if (sta==TopAbs_ON) namres += "ON";
-
- cout< "<DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<IsMerged(S,sta);
- if (isMerged) {
- GetMerged(typ,sta,isha);
- }
-}
-
-void TestTopOpe_BOOP::GetMerged(const Standard_Integer isha)
-{
- if (isha == 0) return;
- if ( myHB.IsNull() ) return;
- if ( myHB->DataStructure().IsNull() ) return;
- const TopoDS_Shape& S = myHB->DataStructure()->Shape(isha);
- if (S.IsNull()) { cout<<"shape "<DataStructure().IsNull() ) return;
- GetMerged(TopAbs_SOLID,sta);
- GetMerged(TopAbs_FACE,sta);
- GetMerged(TopAbs_EDGE,sta);
-}
-
-// NYI void ChkIntg();
-// NYI void ChkIntgInterf();
-// NYI void ChkIntgSamDomain();
-// NYI void ChkVertex();
diff --git a/src/TestTopOpe/TestTopOpe_BOOP.hxx b/src/TestTopOpe/TestTopOpe_BOOP.hxx
deleted file mode 100644
index 285cf6da45..0000000000
--- a/src/TestTopOpe/TestTopOpe_BOOP.hxx
+++ /dev/null
@@ -1,137 +0,0 @@
-// Created on: 1996-02-05
-// Created by: Jean Yves LEBEY
-// Copyright (c) 1996-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 _TestTopOpe_BOOP_HeaderFile
-#define _TestTopOpe_BOOP_HeaderFile
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define TESTTOPOPE_NKEYS 8
-enum Operation_t {BOOP_UND = -1,BOOP_TOPX = 0,BOOP_SECC = 1,BOOP_SECE = 2,BOOP_SEC = 3,
- BOOP_COM = 4,BOOP_C12 = 5,BOOP_C21 = 6,BOOP_FUS = 7} ;
-
-#define TESTTOPOPE_NTKEYS 20
-
-class TestTopOpe_BOOP {
-
-public:
-
- TestTopOpe_BOOP(const char*[],const char* resnamdef);
- Operation_t Operation(const char* key) const;
- Standard_Boolean IsBooope(const char* key) const;
-
- void Tinit();
- const TCollection_AsciiString& Tkeys(const Standard_Integer ik) const;
- const TCollection_AsciiString& Thelp(const Standard_Integer ik) const;
- Standard_Integer Tstep(const TCollection_AsciiString& s) const;
- Standard_Integer Tnb() const;
- Standard_Boolean Tadd(const TCollection_AsciiString& k,const Standard_Integer ic,const TCollection_AsciiString& h);
-
- VarsTopo& ChangeVarsTopo();
- void SetCurrentHB(const Handle(TopOpeBRepBuild_HBuilder)& HB);
- void SetCurrentHDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS);
- void SetShape1(const TopoDS_Shape& S);
- void SetShape2(const TopoDS_Shape& S);
- Handle(TopOpeBRepBuild_HBuilder)& ChangeCurrentHB();
- Handle(TopOpeBRepDS_HDataStructure)& ChangeCurrentDS();
- TopoDS_Shape& ChangeShape1();
- TopoDS_Shape& ChangeShape2();
- const TCollection_AsciiString& nameS1() const;
- const TCollection_AsciiString& nameS2() const;
- //
- Standard_Integer Prepare(const char* ns1,const char* ns2);
- Standard_Integer LoadShapes(const char* ns1,const char* ns2);
- Standard_Integer LoadnewDS();
- Standard_Integer DSF_SetInterTolerances(TopOpeBRep_DSFiller& DSF); //
- Standard_Integer DSF_Insert(); //
- Standard_Integer DSF_Insert(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_InsertIntersection(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_GapFiller(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_CompleteDS(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_Filter(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_Reducer(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_RemoveUnsharedGeometry(TopOpeBRep_DSFiller& DSF);
- Standard_Integer DSF_Insert_Complete_Checker(TopOpeBRep_DSFiller& DSF);
- Standard_Integer LoadnewHB();
- Standard_Integer Builder_Perform();
- Standard_Integer FaceFilter();
- Standard_Integer FaceReducer();
- //
- void SetTol(const TopOpeBRepDS_Kind K,const Standard_Integer index,const Standard_Real tol);
- void SetTol(const Standard_Integer index,const Standard_Real tol);
- void SetPnt(const Standard_Integer index,const Standard_Real x,const Standard_Real y,const Standard_Real z);
-
- void Booope(const char* key, const char* namres);
- void GetSplit(const TopAbs_ShapeEnum Typ,const TopAbs_State sta);
- void GetSplit(const TopAbs_ShapeEnum Typ,const TopAbs_State sta,const Standard_Integer is);
- void GetSplit(const TopAbs_State sta,const Standard_Integer is);
- void GetSplit(const TopAbs_State sta);
- void GetSplit(const Standard_Integer is);
-
- void GetMerged(const TopAbs_ShapeEnum Typ,const TopAbs_State sta);
- void GetMerged(const TopAbs_ShapeEnum Typ,const TopAbs_State sta,const Standard_Integer is);
- void GetMerged(const TopAbs_State sta,const Standard_Integer is);
- void GetMerged(const TopAbs_State sta);
- void GetMerged(const Standard_Integer is);
-
- void ClearResult();
- void AddResult(const TopTools_ListOfShape& L);
- void MakeResult(const TopTools_ListOfShape& L);
- void StoreResult(const char* key, const char* namres, char* extent=NULL) const;
- const Handle(TopOpeBRepBuild_HBuilder)& HBuilder() const;
- void SetMode(const Standard_Integer mode);
- Standard_Integer GetMode() const;
- Standard_Boolean CheckBooope(const char* key);
- Standard_Integer FindShape(const TCollection_AsciiString& str);
- Standard_Integer FindShape(const Standard_Integer ids,const TopoDS_Shape& Sref);
- Standard_Integer FindShape(const TopoDS_Shape& S,const TopoDS_Shape& Sref);
-
- Standard_Integer mylastPREP;
- Standard_Integer mytodoPREP;
- Standard_Integer mymet[100];
- Standard_Integer mynmet;
- TopOpeBRep_DSFiller* myPDSF;
-
-private:
-
- const char* mykeys[TESTTOPOPE_NKEYS];
- const char* myresnamdef;
- VarsTopo myVarsTopo;
- Handle(TopOpeBRepDS_HDataStructure) myHDS;
- Handle(TopOpeBRepBuild_HBuilder) myHB;
- TCollection_AsciiString mynameS1,mynameS2;
- TopoDS_Shape myS1,myS2;
- TopAbs_ShapeEnum myS1type,myS2type;
- Standard_Boolean myESP;
- Standard_Boolean myPREPdone;
- TopoDS_Compound myCresult;
- Standard_Integer myNresult;
- Standard_Boolean myBOOdone;
-
- Standard_Integer mycomn;
- TCollection_AsciiString mycomk[TESTTOPOPE_NTKEYS];
- TCollection_AsciiString mycomh[TESTTOPOPE_NTKEYS];
- Standard_Integer mycomi[TESTTOPOPE_NTKEYS];
-};
-
-#define ISINTEGER(Mstr) ((strspn((Mstr),"0123456789")==strlen((Mstr))))
-
-#endif
diff --git a/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx b/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx
deleted file mode 100644
index 36a8db520f..0000000000
--- a/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx
+++ /dev/null
@@ -1,631 +0,0 @@
-// Created on: 1996-10-21
-// Created by: Jean Yves LEBEY
-// Copyright (c) 1996-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
-
-extern void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d);
-#ifdef OCCT_DEBUG
-extern void TopOpeBRepTool_SettraceEND(const Standard_Boolean);
-extern Standard_Boolean TopOpeBRepTool_GettraceEND();
-#endif
-
-static const char* kboo[TESTTOPOPE_NKEYS] = {"topo","secc","sece","sec","com","c12","c21","fus"};
-static TestTopOpe_BOOP LOCALBOOP(kboo, "r");
-TestTopOpe_BOOP* PBOOP=&LOCALBOOP;
-
-void CATIND
-(TCollection_AsciiString& s,const Standard_Integer I,const TCollection_AsciiString& a,const TCollection_AsciiString& b) {s=s+a+TCollection_AsciiString(I)+b;}
-void CATSHA
-(TCollection_AsciiString& s,const TopoDS_Shape& S,const TopOpeBRepDS_DataStructure& BDS,const TCollection_AsciiString& a,const TCollection_AsciiString& b)
-{if (S.IsNull()) return;::CATIND(s,BDS.Shape(S),a,b);}
-void CATLOSHA
-(TCollection_AsciiString& s,const TopTools_ListOfShape& L,const TopOpeBRepDS_DataStructure& BDS,const TCollection_AsciiString& a,const TCollection_AsciiString& aa,const TCollection_AsciiString& bb,const TCollection_AsciiString& b)
-{
- if (!L.Extent()) return;
- s=s+a;for(TopTools_ListIteratorOfListOfShape i(L);i.More();i.Next())::CATSHA(s,i.Value(),BDS,aa,bb);s=s+b;
-}
-
-Standard_Integer TOPOCHKCOMMANDS(TestTopOpe_BOOP& P,Standard_Integer na,const char**a);
-Standard_Integer TOPOSETCOMMANDS(TestTopOpe_BOOP& P,Standard_Integer na,const char**a, Draw_Interpretor& di);
-Standard_Integer TOPOCOMMANDS(TestTopOpe_BOOP& PT,Standard_Integer na,const char**a, Draw_Interpretor& di);
-
-// ----------------------------------------------------------------------
-Standard_Integer TOPOC(Draw_Interpretor& interpretor,Standard_Integer na,const char** a)
-{
- if (PBOOP == NULL) return 0;
- Standard_Integer err=0, i;
-
- if (!strncmp(a[0],kboo[BOOP_TOPX],4)) {
- err = TOPOCOMMANDS((*PBOOP),na,a,interpretor);
- return err;
- }
- else if (PBOOP->IsBooope(a[0])) {
- PBOOP->Booope(a[0],(na >= 2) ? a[1] : NULL);
- return 0;
- }
- else if (!strcmp(a[0],"toposet")) {
- err = TOPOSETCOMMANDS((*PBOOP),na,a,interpretor);
- return err;
- }
- else if (!strcmp(a[0],"tsp") ) {
- TopAbs_State sta = TopAbs_UNKNOWN;
- if (na >= 2) {
- if (!strcmp(a[1],"IN")) sta = TopAbs_IN;
- else if (!strcmp(a[1],"OUT")) sta = TopAbs_OUT;
- else if (!strcmp(a[1],"ON")) sta = TopAbs_ON;
-
- if (sta != TopAbs_UNKNOWN) {
- if (na==2) { PBOOP->GetSplit(sta); } // tsp IN/ON/OUT
- else if ( na > 2 ) {
- TopAbs_ShapeEnum typ = TopAbs_SHAPE;
- if (!strcmp(a[2],"e")) typ = TopAbs_EDGE;
- else if (!strcmp(a[2],"f")) typ = TopAbs_FACE;
- else if (!strcmp(a[2],"s")) typ = TopAbs_SOLID;
- if (typ != TopAbs_SHAPE) {
- if (na == 3) {
- // tsp IN/ON/OUT e/f/s
- PBOOP->GetSplit(typ,sta);
- }
- else if (na > 3) {
- // tsp IN/ON/OUT e/f/s i1 i2 ...
- for(i=3;iGetSplit(typ,sta,Draw::Atoi(a[i]));
- }
- }
- else {
- // tsp IN/ON/OUT i1 i2 ...
- for(i=2;iGetSplit(sta,Draw::Atoi(a[i]));
- }
- }
- }
- else { // tsp i1 i2 ...
- for (i = 1; i < na; i++) {
- if ( ISINTEGER(a[i]) ) PBOOP->GetSplit(Draw::Atoi(a[i]));
- }
- }
- }
- else {
- PBOOP->GetSplit(TopAbs_IN);
- PBOOP->GetSplit(TopAbs_ON);
- PBOOP->GetSplit(TopAbs_OUT);
- } // tsp
- } // arg0 = tsp
-
- else if (!strcmp(a[0],"tme") ) {
- TopAbs_State sta = TopAbs_UNKNOWN;
- if (na >= 2) {
- if (!strcmp(a[1],"IN")) sta = TopAbs_IN;
- else if (!strcmp(a[1],"OUT")) sta = TopAbs_OUT;
- else if (!strcmp(a[1],"ON")) sta = TopAbs_ON;
-
- if (sta != TopAbs_UNKNOWN) {
- if (na==2) { PBOOP->GetMerged(sta); } // tme IN/ON/OUT
- else if ( na > 2 ) {
- TopAbs_ShapeEnum typ = TopAbs_SHAPE;
- if (!strcmp(a[2],"e")) typ = TopAbs_EDGE;
- else if (!strcmp(a[2],"f")) typ = TopAbs_FACE;
- else if (!strcmp(a[2],"s")) typ = TopAbs_SOLID;
- if (typ != TopAbs_SHAPE) {
- if (na == 3) {
- // tme IN/ON/OUT e/f/s
- PBOOP->GetMerged(typ,sta);
- }
- else if (na > 3) {
- // tme IN/ON/OUT e/f/s i1 i2 ...
- for(i=3;iGetMerged(typ,sta,Draw::Atoi(a[i]));
- }
- }
- else {
- // tme IN/ON/OUT i1 i2 ...
- for(i=2;iGetMerged(sta,Draw::Atoi(a[i]));
- }
- }
- }
- else { // tme i1 i2 ...
- for (i = 1; i < na; i++) {
- if ( ISINTEGER(a[i]) ) PBOOP->GetMerged(Draw::Atoi(a[i]));
- }
- }
- }
- else {
- PBOOP->GetMerged(TopAbs_IN);
- PBOOP->GetMerged(TopAbs_ON);
- PBOOP->GetMerged(TopAbs_OUT);
- } // tme
- } // arg0 = tme
-
- else if (!strcmp(a[0],"csecanc") ) {
- Standard_Integer ia;
-
- Standard_Boolean outdraw = Standard_False,outclear = Standard_False,outAB = Standard_False;
- for (ia=1; iaHBuilder();
- Handle(TopOpeBRepDS_HDataStructure) HDS = HB->DataStructure();
- const TopOpeBRepDS_DataStructure& BDS = HDS->DS();
- const TopTools_ListOfShape& loe = HB->Section();
-
- Standard_Boolean onedef = Standard_False;
- Standard_Integer n = loe.Extent();
- Handle(TColStd_HArray1OfBoolean) tabloe = new TColStd_HArray1OfBoolean(1,n,Standard_False);
- for (ia=1; ia=1 && ie<=n) { onedef = Standard_True; tabloe->SetValue(ie,Standard_True); }
- }
- if (!onedef) tabloe->Init(Standard_True);
-
- TopTools_ListIteratorOfListOfShape itloe(loe);
- for (Standard_Integer ie=1;itloe.More();itloe.Next(),ie++) {
- if (!tabloe->Value(ie)) continue;
- const TopoDS_Shape& es = itloe.Value();
- TopoDS_Shape F1,F2; Standard_Integer IC; TopTools_ListOfShape LF1,LF2,LE1,LE2;
- Standard_Boolean eca = HB->EdgeCurveAncestors(es,F1,F2,IC);
- Standard_Boolean esa = HB->EdgeSectionAncestors(es,LF1,LF2,LE1,LE2);
- TCollection_AsciiString namie("se"); namie = namie + TCollection_AsciiString(ie);
- DBRep::Set(namie.ToCString(),es);
- if (eca) {
- TCollection_AsciiString s;
-
- if (outdraw) {
- if (outclear) s = s + "clear; ";
- ::CATSHA(s,F1,BDS,"tsee f ","; ");
- ::CATSHA(s,F2,BDS,"tsee f ","; ");
- ::CATIND(s,IC,"tsee c ","; ");
- s = s + "cdins " + namie;
- interpretor<= 2 ) TopOpeBRepTool_BOOOPE_CHECK_DEB = (Draw::Atoi(a[1])) ? 1 : 0;
- return 0;
- }
- return 0;
-}
-#else
-Standard_Integer BOOPCHK(Draw_Interpretor& ,Standard_Integer,const char**) {return 0;}
-#endif
-
-// ----------------------------------------------------
-Standard_Integer TOPOSETCOMMANDS(TestTopOpe_BOOP& PT,Standard_Integer na,const char** a, Draw_Interpretor& di)
-{
- switch(na) {
- case 1:
- di<<"toposet \n";
- di<<"toposet \n";
- di<<"kind = p | c | s | v | e | f | w \n";
- return 1;
- case 4:
- if(!strcasecmp(a[1],"p"))
- PT.SetTol(TopOpeBRepDS_POINT,Draw::Atoi(a[2]),Draw::Atof(a[3]));
- else if(!strcasecmp(a[1],"c"))// c ou C
- PT.SetTol(TopOpeBRepDS_CURVE,Draw::Atoi(a[2]),Draw::Atof(a[3]));
- else if(!strcasecmp(a[1],"s"))
- PT.SetTol(TopOpeBRepDS_SURFACE,Draw::Atoi(a[2]),Draw::Atof(a[3]));
- else if(!strcasecmp(a[1],"sh") ||
- !strcasecmp(a[1],"v") ||
- !strcasecmp(a[1],"e") ||
- !strcasecmp(a[1],"f") ||
- !strcasecmp(a[1],"w"))
- PT.SetTol(Draw::Atoi(a[2]),Draw::Atof(a[3]));
- break;
- case 6:
- if(!strcasecmp(a[1],"p"))
- PT.SetPnt(Draw::Atoi(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
- else
- return 1;
- break;
- default:
- break;
- } // switch na
- return 0;
-}
-
-// -----------------------------------------------------
-void TOPOHELP(TestTopOpe_BOOP& PT, Draw_Interpretor& di)
-{
- di<<"\n";
- di<<"Help on topo command :\n";
- di<<"----------------------\n";
- for (Standard_Integer ic=0;ic among input shapes (exploration index)\n";
- di<<"-v [0]/1 : do not trace / trace methods name\n";
- di<<"-d : dump all control variables\n";
- di<<"-i : initialize control variables to default values\n";
- di<<"-h : help\n";
- di<<"----------------------\n";
-}
-
-// -------------------------------------------------------
-Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const char** a, Draw_Interpretor& di)
-{
- VarsTopo& VT = PT.ChangeVarsTopo();
-
- Standard_Boolean dump = Standard_False;
- Standard_Boolean help = Standard_False;
- Standard_Integer ia = 1;
- while (ia < na) {
- const char *thea = a[ia];
- if (!strcmp(thea,"-f")) {
- suppressarg(na,a,ia);
- if (ia < na) {
- PT.FindShape(a[ia]);
- suppressarg(na,a,ia);
- }
- else {
- PT.FindShape(0);
- }
- }
- else if (!strcasecmp(thea,"-2d")) {
- VT.SetC2D(Standard_True);
- suppressarg(na,a,ia);
- }
- else if (!strcasecmp(thea,"-no2d")){
- VT.SetC2D(Standard_False);
- suppressarg(na,a,ia);
- }
- else if (!strcasecmp(thea,"-a")) {
- VT.SetOCT(TopOpeBRepTool_APPROX);
- suppressarg(na,a,ia);
- }
- else if (!strcasecmp(thea,"-p")) {
- VT.SetOCT(TopOpeBRepTool_BSPLINE1);
- suppressarg(na,a,ia);
- }
- else if (!strcmp(thea,"-tx")) {
- suppressarg(na,a,ia);
- if (ia + 1 < na) {
- VT.SetTolx(Draw::Atof(a[ia]),Draw::Atof(a[ia + 1]));
- suppressarg(na,a,ia);
- suppressarg(na,a,ia);
- }
- else if (ia < na) {
- if (!strcmp(a[ia],"default")) {
- VT.SetTolxDef();
- suppressarg(na,a,ia);
- }
- else {
- VT.SetTolx(Draw::Atof(a[ia]),Draw::Atof(a[ia]));
- suppressarg(na,a,ia);
- }
- }
- }
- else if (!strcmp(thea,"-ti")) {
- suppressarg(na,a,ia);
- if (ia + 1 < na) {
- VT.SetToli(Draw::Atof(a[ia]),Draw::Atof(a[ia + 1]));
- suppressarg(na,a,ia);
- suppressarg(na,a,ia);
- }
- else if (ia < na) {
- if (!strcmp(a[ia],"shape")) {
- VT.SetToliDef();
- suppressarg(na,a,ia);
- }
- else {
- VT.SetToli(Draw::Atof(a[ia]),Draw::Atof(a[ia]));
- suppressarg(na,a,ia);
- }
- }
- }
- else if (!strcmp(thea,"-c")) {
- suppressarg(na,a,ia);
- if (ia < na) {
- VT.SetClear (Draw::Atoi(a[ia]) != 0);
- suppressarg(na,a,ia);
- }
- else VT.SetClear(Standard_True);
- }
- else if (!strcasecmp(thea,"-d")) {
- dump = Standard_True;
- suppressarg(na,a,ia);
- }
- else if (!strcasecmp(thea,"-i")) {
- VT.Init();
- suppressarg(na,a,ia);
- }
- else if (!strcmp(thea,"-m")) {
- suppressarg(na,a,ia);
- if (ia < na) {
- VT.SetMode(Draw::Atoi(a[ia]));
- suppressarg(na,a,ia);
- }
- else VT.SetMode(0);
- }
- else if (!strcmp(thea,"-v")) {
- suppressarg(na,a,ia);
- if (ia < na) {
- VT.SetVerbose(Draw::Atoi(a[ia]));
- suppressarg(na,a,ia);
- }
- else VT.SetVerbose(0);
- }
- else if (!strcasecmp(thea,"-h")) {
- help = Standard_True;
- suppressarg(na,a,ia);
- }
- else {
- ia++;
- }
- } // while (ia < na)
- if (dump) VT.Dump(cout);
- if (help) TOPOHELP(PT, di);
- return 0;
-
-} // VARSTOPOARGS
-
-// ----------------------------------------------------
-Standard_Integer SETTOPOCOMMANDS(TestTopOpe_BOOP& PT)
-{
- PT.Tinit();
- PT.Tadd("-def",0 ,"[a b] : load shapes");
- PT.Tadd("-iss",100,"[a b] : intersection");
- PT.Tadd("-gap",110,"[a b] : gap filler");
- PT.Tadd("-cds",115,"[a b] : complete DS");
- PT.Tadd("-fil",120,"[a b] : filter");
- PT.Tadd("-red",130,"[a b] : reducer");
- PT.Tadd("-rug",140,"[a b] : remove unshared geometry");
- PT.Tadd("-chk",150,"[a b] : check DS");
- PT.Tadd("-bui",200,"[a b] : section building");
- PT.Tadd("-all",290,"[a b] : all");
- return 0;
-}
-
-// ----------------------------------------------------
-Standard_Integer SETTOPOPREP(TestTopOpe_BOOP& PT,Standard_Integer& na,const char** a)
-{
- if (na < 2) return 0;
- const char* thea = a[0];
- PT.mytodoPREP = 999;
- if (!strcasecmp(thea,"topo") && na == 3) {
- PT.mylastPREP = -1;
- return 0;
- }
- if (na == 4) {
- PT.mylastPREP = -1;
- }
-
- Standard_Integer ia = 1;
- while (ia < na) {
- thea = a[ia];
- Standard_Integer ik = PT.Tstep(thea);
- if (ik != -1) {
- PT.mytodoPREP = ik;
- suppressarg(na,a,ia);
- }
- else {
- ia++;
- }
- }
- return 0;
-}
-
-// ----------------------------------------------------
-Standard_Integer TOPOCOMMANDS(TestTopOpe_BOOP& PT,Standard_Integer na,const char** a, Draw_Interpretor& di)
-{
- Standard_Integer err = 0;
- if (strncmp(a[0],"topo",4)) return 1;
- if (na == 2 && !strcasecmp(a[1],"-h")) { TOPOHELP(PT, di); return 0; }
- err = VARSTOPOARGS(PT,na,a, di); if (err) return err;
- if (na == 1) return 0;
- err = SETTOPOPREP(PT,na,a); if (err) return err;
-
-#ifdef OCCT_DEBUG
- Standard_Boolean tend = TopOpeBRepTool_GettraceEND();
- TopOpeBRepTool_SettraceEND(PT.ChangeVarsTopo().GetVerbose() != 0);
-#endif
-
- err = 0;
- TopOpeBRep_DSFiller* PDSF = PT.myPDSF;
- while (PT.mylastPREP <= PT.mytodoPREP) {
- switch (PT.mylastPREP) {
- case -1 : if (na >= 3) err = PT.LoadShapes(a[1],a[2]);break;
- case 0 : err = PT.LoadnewDS(); PDSF = PT.myPDSF; break;
- case 100 : err = PT.DSF_Insert_InsertIntersection(*PDSF); break;
- case 110 : err = PT.DSF_Insert_Complete_GapFiller(*PDSF);break;
- case 115 : err = PT.DSF_Insert_Complete_CompleteDS(*PDSF); break;
- case 120 : err = PT.DSF_Insert_Complete_Filter(*PDSF); break;
- case 130 : err = PT.DSF_Insert_Complete_Reducer(*PDSF); break;
- case 140 : err = PT.DSF_Insert_Complete_RemoveUnsharedGeometry(*PDSF); break;
- case 150 : err = PT.DSF_Insert_Complete_Checker(*PDSF); break;
- case 160 : err = PT.LoadnewHB(); break;
- case 200 : err = PT.Builder_Perform(); break;
- case 290 : PT.mylastPREP = 1000; break;
- default : PT.mylastPREP = 1000; break;
- }
- if (err) return err;
- }
-
-#ifdef OCCT_DEBUG
- TopOpeBRepTool_SettraceEND(tend);
-#endif
- return 0;
-}
-
-//=======================================================================
-//function : BOOPCommands
-//purpose :
-//=======================================================================
-void TestTopOpe::BOOPCommands(Draw_Interpretor& theCommands)
-{
- SETTOPOCOMMANDS(*PBOOP);
- theCommands.Add(kboo[BOOP_TOPX],"-h for help",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_SECC],"secc [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_SECE],"sece [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_SEC],"sec [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_C12],"c12 [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_C21],"c21 [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_COM],"com [r]",__FILE__,TOPOC);
- theCommands.Add(kboo[BOOP_FUS],"fus [r]",__FILE__,TOPOC);
- theCommands.Add("toposet","",__FILE__,TOPOC);
- theCommands.Add("tsp","tsp [state] iS1 : get split parts",__FILE__,TOPOC);
- theCommands.Add("tme","tme [state] iS1 : get merged parts",__FILE__,TOPOC);
- theCommands.Add("csecanc","section edge ancestors. use : puts [csecanc]",__FILE__,TOPOC);
- theCommands.Add("parvi","parvi : get parameter of internal vertices",__FILE__,TOPOC);
- theCommands.Add("parvi2d","parvi : get parameter of internal vertices",__FILE__,TOPOC);
- theCommands.Add("tchk","tchk 1/0 : check SameParameter edges or not in BRepBuilderAPI",__FILE__,BOOPCHK);
-}
-
-#if 0
- if (!strcasecmp(thea,"-def")) { PT.mytodoPREP = 0; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-iss")) { PT.mytodoPREP = 100; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-gap")) { PT.mytodoPREP = 110; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-cds")) { PT.mytodoPREP = 115; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-fil")) { PT.mytodoPREP = 120; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-red")) { PT.mytodoPREP = 130; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-rug")) { PT.mytodoPREP = 140; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-chk")) { PT.mytodoPREP = 150; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-bui")) { PT.mytodoPREP = 200; suppressarg(na,a,ia); }
- else if (!strcasecmp(thea,"-all")) { PT.mytodoPREP = 290; suppressarg(na,a,ia); }
-#endif
diff --git a/src/TestTopOpe/TestTopOpe_CORCommands.cxx b/src/TestTopOpe/TestTopOpe_CORCommands.cxx
deleted file mode 100644
index 1879250e1d..0000000000
--- a/src/TestTopOpe/TestTopOpe_CORCommands.cxx
+++ /dev/null
@@ -1,873 +0,0 @@
-// Created on: 1997-07-24
-// Created by: Xuan PHAM PHU
-// 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
-#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
-
-#ifdef DRAW
-#include
-#endif
-
-Standard_IMPORT Draw_Color DrawTrSurf_CurveColor(const Draw_Color col);
-Standard_IMPORT void DBRep_WriteColorOrientation ();
-Standard_IMPORT Draw_Color DBRep_ColorOrientation (const TopAbs_Orientation Or);
-
-Standard_IMPORT Draw_Color DrawTrSurf_CurveColor(const Draw_Color col);
-Standard_IMPORT void DBRep_WriteColorOrientation ();
-Standard_IMPORT Draw_Color DBRep_ColorOrientation (const TopAbs_Orientation Or);
-Standard_EXPORT void FUN_tool_mkBnd2d(const TopoDS_Shape& W, const TopoDS_Shape& F,Bnd_Box2d& B2d);
-Standard_EXPORT void FUN_tool_UpdateBnd2d(Bnd_Box2d& B2d, const Bnd_Box2d& newB2d);
-Standard_IMPORT Standard_Integer FUN_tool_classiBnd2d(const Bnd_Array1OfBox2d& B,const Standard_Boolean chklarge = Standard_True);
-Standard_IMPORT Standard_Boolean FUN_tool_chkp2dFORinE(const gp_Pnt2d& p2d,const TopoDS_Edge& E,
- const TopoDS_Face& F, Standard_Real& tol2d);
-Standard_IMPORT TopoDS_Vertex FUN_tool_getv(const Standard_Integer Index,const TopoDS_Edge& E);
-
-
-#define SAME (-1)
-#define DIFF (-2)
-#define UNKNOWN ( 0)
-#define oneINtwo ( 1)
-#define twoINone ( 2)
-
-static void FUN_test_draw(TCollection_AsciiString aa,
- const TopoDS_Edge& E, const TopoDS_Face& F,
- const Standard_Integer ie,
- Draw_Interpretor& di)
-{
- if (E.IsNull()) {di<<"************* null edge\n"; return;}
- Standard_Real f,l; const Handle(Geom2d_Curve)& PC = BRep_Tool::CurveOnSurface(E,F,f,l);
- if (PC.IsNull()) {di<<"************* no curv on surf\n"; return;}
- TCollection_AsciiString bb(aa); bb += TCollection_AsciiString(ie);
- char* aaa = (char *)bb.ToCString();
-
- Standard_Boolean coldef = Standard_False;
- TopExp_Explorer ex(F,TopAbs_EDGE);
- Draw_Color col;
- DrawTrSurf_CurveColor(Draw_Color(Draw_rouge));
- for (; ex.More(); ex.Next())
- if (E.IsEqual(ex.Current()))
- {col = DBRep_ColorOrientation(ex.Current().Orientation());
- coldef = Standard_True;
- break;}
- if (!coldef) col = DBRep_ColorOrientation(E.Orientation());
-
- DrawTrSurf_CurveColor(col);
- DrawTrSurf::Set(aaa,new Geom2d_TrimmedCurve(PC,f,l));
-}
-
-void FUN_draw(const TCollection_AsciiString aa,const TopoDS_Shape& s)
-{char* aaa = (char *)aa.ToCString(); DBRep::Set(aaa,s);}
-
-void FUN_cout(const gp_Pnt2d& p2d, Draw_Interpretor& di)
-{di <<" = ("<
- TopTools_ListOfShape lfyE; Standard_Boolean topurge = CORRISO.PurgeFyClosingE(cEds,lfyE);
- if (!topurge) {lWs.Append(W); continue;}
-
- TopoDS_Wire Wi; BB.MakeWire(Wi); // Add une TShape
- Wi.Free(Standard_True);
- ite.Initialize(CORRISO.Eds());
- for (; ite.More(); ite.Next()) {
- const TopoDS_Edge& ed = TopoDS::Edge(ite.Value());
- Standard_Boolean equ = Standard_False;
- for (TopTools_ListIteratorOfListOfShape itlfyE(lfyE);itlfyE.More();itlfyE.Next()) {
- const TopoDS_Shape& fyE = itlfyE.Value();
- if (ed.IsEqual(fyE)) {
- equ = Standard_True;
- break;
- }
- }
- if (equ) {
- continue;
- }
- BB.Add(Wi,ed);
- }
- lWs.Append(Wi);
- } // exw
-
- if (!hasnew) return 1;
-
- // Building up the new face :
- aLocalShape = fa.EmptyCopied();
- TopoDS_Face newF = TopoDS::Face(aLocalShape);
-// TopoDS_Face newF = TopoDS::Face(fa.EmptyCopied());
- TopTools_ListIteratorOfListOfShape itw(lWs);
- for (; itw.More(); itw.Next()) BB.Add(newF, TopoDS::Wire(itw.Value()));
-
- di <<"New face built is newF\n";
- TCollection_AsciiString aa("newF");
- FUN_draw(aa, newF);
- return 0;
-}
-
-
-Standard_Integer correctONISO(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape aLocalShape = DBRep::Get(a[1]);
- TopoDS_Face F = TopoDS::Face(aLocalShape);
- aLocalShape = DBRep::Get(a[2]);
- TopoDS_Face Fsp = TopoDS::Face(aLocalShape);
-// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[1]));
-// TopoDS_Face Fsp = TopoDS::Face(DBRep::Get(a[2]));
-
- FC2D_Prepare(F,F);
-
- if (F.IsNull() || Fsp.IsNull()) {di<<"NULL shape(s)\n";return 1;}
-
- TopOpeBRepTool::CorrectONUVISO(F,Fsp);
- TCollection_AsciiString aa("newFsp");
- FUN_draw(aa,Fsp);
- di<<"-> newFsp\n";
-
- return 0;
-}
-
-// ======================================================================
-// useful commands :
-// ======================================================================
-
-static Standard_Integer isclosingE(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape aLocalShape = DBRep::Get(a[1]) ;
- TopoDS_Edge ed = TopoDS::Edge(aLocalShape);
- aLocalShape = DBRep::Get(a[2]);
- TopoDS_Face fa = TopoDS::Face(aLocalShape);
-// TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(a[1]));
-// TopoDS_Face fa = TopoDS::Face(DBRep::Get(a[2]));
- Standard_Boolean isclosing = BRep_Tool::IsClosed(ed,fa);
- TopAbs_Orientation oriE = ed.Orientation();
- if (isclosing) {di <<"edge is ";
- //TopAbs::Print(oriE,cout);
- Standard_SStream aSStream;
- TopAbs::Print(oriE,aSStream);
- di << aSStream;
- di<<" closing edge\n";}
- else di <<"edge is NOT closing edge\n";
- return 0;
-}
-
-static Standard_Integer compareshsh(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape sh1 = DBRep::Get(a[1]);
- TopoDS_Shape sh2 = DBRep::Get(a[2]);
- Standard_Boolean issame = sh1.IsSame(sh2);
- if (issame) di<<" same shapes\n";
- else di <<" shapes are not same\n";
- Standard_Boolean isequal = sh1.IsEqual(sh2); if (isequal) di<<" equal shapes\n";
- return 0;
-}
-static Standard_Integer pcurveedgeonface(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape ed = DBRep::Get(a[1]);
- TopoDS_Shape fa = DBRep::Get(a[2]);
- TCollection_AsciiString aa("edonfa_");
- FUN_test_draw(aa,TopoDS::Edge(ed),TopoDS::Face(fa),0,di);
- return 0;
-}
-
-static Standard_Integer pcurvesonface(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape sh = DBRep::Get(a[2]);
- TopoDS_Shape fa = DBRep::Get(a[3]);
- TopExp_Explorer exe(sh, TopAbs_EDGE);
- Standard_Integer i = 0;
- for (; exe.More(); exe.Next()){
- i++;
- TCollection_AsciiString aa(a[1]);
- FUN_test_draw(aa,TopoDS::Edge(exe.Current()),TopoDS::Face(fa),i,di);
- }
- return 0;
-}
-
-static Standard_Integer orivine(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape aLocalShape = DBRep::Get(a[1]);
- TopoDS_Vertex v = TopoDS::Vertex(aLocalShape);
- aLocalShape = DBRep::Get(a[2]);
- TopoDS_Edge ed = TopoDS::Edge(aLocalShape);
-// TopoDS_Vertex v = TopoDS::Vertex(DBRep::Get(a[1]));
-// TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(a[2]));
-
- Standard_Integer ori = TopOpeBRepTool_TOOL::OriinSor(v,ed);
- if (ori==0) di<<"v not in ed\n";
- else if (ori==1) di<<"v FORWARD in ed\n";
- else if (ori==2) di<<"v REVERSED in ed\n";
- else if (ori==3) di<<"v INTERNAL in ed\n";
- else if (ori==4) di<<"v EXTERNAL in ed\n";
- else if (ori==5) di<<"v CLOSING in ed\n";
- return 0;
-}
-
-static Standard_Integer vine(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 4) return 1;
- TopoDS_Shape aLocalShape = DBRep::Get(a[1]);
- TopoDS_Vertex v = TopoDS::Vertex(aLocalShape);
- aLocalShape = DBRep::Get(a[2]);
- TopoDS_Edge ed = TopoDS::Edge(aLocalShape);
- aLocalShape = DBRep::Get(a[3]);
- TopoDS_Face fa = TopoDS::Face(aLocalShape);
-// TopoDS_Vertex v = TopoDS::Vertex(DBRep::Get(a[1]));
-// TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(a[2]));
-// TopoDS_Face fa = TopoDS::Face(DBRep::Get(a[3]));
-
- Standard_Real pf,pl;
- const Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(ed,fa,pf,pl);
- gp_Pnt2d p2df, p2dl; PC->D0(pf,p2df); PC->D0(pl,p2dl);
- di << "p2df";FUN_cout(p2df,di); di << "p2dl";FUN_cout(p2dl,di);di<<"\n";
-
- Standard_Integer ori = TopOpeBRepTool_TOOL::OriinSor(v,ed);
- if (ori==0) {di<<"v not in ed\n"; return 0;}
- else if (ori==1) di<<"v FORWARD in ed\n";
- else if (ori==2) di<<"v REVERSED in ed\n";
- else if (ori==3) di<<"v INTERNAL in ed\n";
- else if (ori==4) di<<"v EXTERNAL in ed\n";
- else if (ori==5) di<<"v CLOSING in ed\n";
-
- if ((ori == 1) || (ori == 2)) {
- Standard_Real par = TopOpeBRepTool_TOOL::ParE(ori,ed);//FUN_tool_parOnE(ind,ed,fa);
- gp_Pnt2d p2d; PC->D0(par,p2d);
- di <<"p2d : with TopOpeBRepTool_TOOL::ParE";FUN_cout(p2d,di);di<<"\n";
- }
-
- Standard_Real par = BRep_Tool::Parameter(v,ed,fa);
- gp_Pnt2d pp2d; PC->D0(par,pp2d);
- di <<"p2d computed with BRep_Tool::Parameter";FUN_cout(pp2d,di);di<<"\n";
-
- return 0;
-}
-
-static Standard_Integer issubshape(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape subshape = DBRep::Get(a[1]);
- TopoDS_Shape shape = DBRep::Get(a[2]);
- TopExp_Explorer ex(shape, subshape.ShapeType());
- Standard_Boolean issubs = Standard_False;
- for (; ex.More(); ex.Next())
- if (ex.Current().IsSame(subshape)) {issubs = Standard_True; break;}
-
- if (issubs) di<<" is subshape\n";
- else di<<" is NOT subshape\n";
- return 0;
-}
-
-void FUN_mkBnd2dBREP(const TopoDS_Shape& W, const TopoDS_Shape& F,Bnd_Box2d& B2d,const Standard_Integer& i)
-{
- // greater with 's UV representation on
- Standard_Real tol = 1.e-8;
- TopExp_Explorer ex;
- for (ex.Init(W, TopAbs_EDGE); ex.More(); ex.Next()) {
-// for (TopExp_Explorer ex(W, TopAbs_EDGE); ex.More(); ex.Next()) {
- if (i == 0) {
- FUN_tool_mkBnd2d(W,F,B2d);
- }
- if (i == 1) {
- BRepAdaptor_Curve2d BC2d(TopoDS::Edge(ex.Current()), TopoDS::Face(F));
- BndLib_Add2dCurve::Add(BC2d, tol, B2d);
- }
- if (i == 2) {
- Standard_Real f,l;
- Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(TopoDS::Edge(ex.Current()),TopoDS::Face(F),f,l);
- Geom2dAdaptor_Curve GC2d(PC);
- BndLib_Add2dCurve::Add(GC2d, tol, B2d);
- }
- if (i == 3) {
- TopLoc_Location L; Standard_Real f,l;
- const Handle(Geom_Surface)& S = BRep_Tool::Surface(TopoDS::Face(F),L);
- const Handle(Geom2d_Curve)& PC = BRep_Tool::CurveOnSurface(TopoDS::Edge(ex.Current()),S,L,f,l);
- Geom2dAdaptor_Curve GC2d(PC);
- BndLib_Add2dCurve::Add(GC2d, tol, B2d);
- }
-
- } //ex(W,EDGE)
-}
-
-static Standard_Integer drawbnd2d(Draw_Interpretor& , Standard_Integer n, const char** a)
-{
- if (n < 5) return 1;
- Standard_Integer i = Draw::Atoi(a[4]);
- TopoDS_Shape W = DBRep::Get(a[2]);
- TopoDS_Shape F = DBRep::Get(a[3]);
- if (W.IsNull() || F.IsNull()) return 1;
- Bnd_Box2d B2d;
- Standard_Real umin,vmin,umax,vmax;
- FUN_mkBnd2dBREP(W,F,B2d,i);
- B2d.Get(umin,vmin,umax,vmax);
-
- Handle(Geom2d_Line) cx = new Geom2d_Line(gp_Pnt2d(umin,vmin),gp_Dir2d(1.,0.));
- Handle(Geom2d_Line) cy = new Geom2d_Line(gp_Pnt2d(umin,vmin),gp_Dir2d(0.,1.));
- gp_Trsf2d tx; gp_Vec2d vx(umax-umin,0.); tx.SetTranslation(vx);
- gp_Trsf2d ty; gp_Vec2d vy(0.,vmax-vmin); ty.SetTranslation(vy);
-
- Handle(Geom2d_Curve) tcx = new Geom2d_TrimmedCurve(cx,0.,umax-umin);
- Handle(Geom2d_Curve) tcy = new Geom2d_TrimmedCurve(cy,0.,vmax-vmin);
- Handle(Geom2d_Curve) tccx = Handle(Geom2d_Curve)::DownCast (tcx->Copy());
- tccx->Transform(ty);
- Handle(Geom2d_Curve) tccy = Handle(Geom2d_Curve)::DownCast (tcy->Copy());
- tccy->Transform(tx);
-
- Draw_Color col(Draw_blanc);
- DrawTrSurf_CurveColor(col);
-
- TCollection_AsciiString aa3 = TCollection_AsciiString(a[1]); aa3 += TCollection_AsciiString(3);
- TCollection_AsciiString aa4 = TCollection_AsciiString(a[1]); aa4 += TCollection_AsciiString(4);
-
- TCollection_AsciiString aa;
- aa=TCollection_AsciiString(a[1]); aa+=TCollection_AsciiString(1); char* aaa = (char *)aa.ToCString(); DrawTrSurf::Set(aaa,tcx);
- aa=TCollection_AsciiString(a[1]); aa+=TCollection_AsciiString(2); aaa=(char *)aa.ToCString(); DrawTrSurf::Set(aaa,tcy);
- aa=TCollection_AsciiString(a[1]); aa+=TCollection_AsciiString(3); aaa=(char *)aa.ToCString(); DrawTrSurf::Set(aaa,tccx);
- aa=TCollection_AsciiString(a[1]); aa+=TCollection_AsciiString(4); aaa=(char *)aa.ToCString(); DrawTrSurf::Set(aaa,tccy);
- return 0;
-}
-
-static Standard_Integer classifBnd2d(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 5) return 1;
- TopoDS_Shape W1 = DBRep::Get(a[1]);
- TopoDS_Shape W2 = DBRep::Get(a[2]);
- TopoDS_Shape F = DBRep::Get(a[3]);
-
- TopoDS_Wire w1 = TopoDS::Wire(W1);
- TopoDS_Wire w2 = TopoDS::Wire(W2);
- TopoDS_Face Fref = TopoDS::Face(F);
-
- TopOpeBRepTool_CLASSI classi; classi.Init2d(Fref);
- Standard_Real tolF = BRep_Tool::Tolerance(Fref);
- Standard_Real toluv = TopOpeBRepTool_TOOL::TolUV(Fref,tolF);
-
- if (w1.IsNull() || w2.IsNull() || Fref.IsNull()) return 1;
-
-#ifdef OCCT_DEBUG
- Standard_Integer sta =
-#endif
- classi.ClassiBnd2d(w1,w2,toluv,Standard_True);
- di <<"wires classification : checklarge=true ";
-#ifdef OCCT_DEBUG
- FUN_tool_coutsta(sta,1,2);
-#endif
-
-#ifdef OCCT_DEBUG
- sta =
-#endif
- classi.ClassiBnd2d(w1,w2,toluv,Standard_False);
- di <<"wires classification : checklarge=false ";
-#ifdef OCCT_DEBUG
- FUN_tool_coutsta(sta,1,2);
-#endif
-
- return 0;
-}
-
-static Standard_Integer pntonc(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- Standard_Real x = Draw::Atof(a[1]);
- Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]);
- if (C.IsNull()) {di<<"null curve\n"; return 1;}
- gp_Pnt p = C->Value(x);
- di<<"point on curve of parameter "<Value(x);
- di<<"point on curve of parameter "<Value(p2d.X(),p2d.Y());
- di<<"point on curve of parameter "< 3) {
- const char* key1 = a[3];
- const char* key2 = (n > 4) ? a[4] : NULL;
- if (key1) {
- if (!strcasecmp(key1,"-min")) {
- anExtFlag = Extrema_ExtFlag_MIN;
- } else if (!strcasecmp(key1,"-max")) {
- anExtFlag = Extrema_ExtFlag_MAX;
- } else {
- anExtAlgo = (!strcasecmp(key1,"-t")) ? Extrema_ExtAlgo_Tree : anExtAlgo;
- }
- }
- if (key2) {
- anExtAlgo = (!strcasecmp(key2,"-t")) ? Extrema_ExtAlgo_Tree : anExtAlgo;
- }
- }
- ok = FUN_tool_projPonF(p, f, uv, dist, anExtFlag, anExtAlgo);
- //
- if (!ok) {
- di<<"projection failed\n";
- return 1;
- }
- //
- ok = FUN_tool_value(uv,f,pproj);
- if (!ok) {
- di<<"projection failed\n";
- return 1;
- }
- //
- di<<"proj dist = "< KO\n"; return 1;}
-
- sta = soclassi.State();
- di<<"point is ";
- //TopAbs::Print(sta,cout);
- Standard_SStream aSStream;
- TopAbs::Print(sta,aSStream);
- di << aSStream;
- di<<" shape s\n";
- return 0;
-}
-
-static Standard_Integer class3dclassifier(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 4) return 1;
- TopoDS_Shape s = DBRep::Get(a[1]);
- if (s.IsNull()) {di<<"null shape\n";return 1;}
- gp_Pnt p; DrawTrSurf::GetPoint(a[2], p);
- Standard_Real tol = Draw::Atof(a[3]);
-
- BRepClass3d_SolidClassifier soclassi(s);
- TopAbs_State sta = TopAbs_UNKNOWN;
- soclassi.Perform(p,tol);
-
- sta = soclassi.State();
- di<<"point is ";
- //TopAbs::Print(sta,cout);
- Standard_SStream aSStream;
- TopAbs::Print(sta,aSStream);
- di << aSStream;
- di<<" shape s\n";
- return 0;
-}
-static Standard_Integer shapeclassifier(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 3) return 1;
- TopoDS_Shape sh = DBRep::Get(a[1]);
- if (sh.IsNull()) {di<<"null shape\n";return 1;}
- TopoDS_Shape shref = DBRep::Get(a[2]);
- if (shref.IsNull()) {di<<"null reference shape\n";return 1;}
- Standard_Boolean hastoavoid = (n > 3);
- TopTools_ListOfShape toavoid;
- if (hastoavoid) {
- for (Standard_Integer i=3; i<=n; i++) {
- TopoDS_Shape shtoavoid = DBRep::Get(a[i]);
- if (shtoavoid.IsNull()) {di<<"null toavoid shape\n";return 1;}
- toavoid.Append(shtoavoid);
- }
- }
-
- TopOpeBRepTool_ShapeClassifier shclassi;
- TopAbs_State sta = TopAbs_UNKNOWN;
- if (hastoavoid) sta = shclassi.StateShapeShape(sh,shref);
- else if (toavoid.Extent() == 1) sta = shclassi.StateShapeShape(sh,toavoid.First(),shref);
- else sta = shclassi.StateShapeShape(sh,toavoid,shref);
-
- di<<"shape is ";
- //TopAbs::Print(sta,cout);
- Standard_SStream aSStream;
- TopAbs::Print(sta,aSStream);
- di << aSStream;
- di<<" shape ref\n";
- return 0;
-}
-
-static Standard_Integer curvature(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
- if (n < 5) return 1;
- TopoDS_Shape aLocalShape = DBRep::Get(a[1]);
- TopoDS_Face f = TopoDS::Face(aLocalShape);
-// TopoDS_Face f = TopoDS::Face(DBRep::Get(a[1]));
- if (f.IsNull()) {di<<"null shape\n";return 1;}
- Standard_Real x = Draw::Atof(a[2]);
- Standard_Real y = Draw::Atof(a[3]);
- Standard_Real z = Draw::Atof(a[4]);
- Handle(Geom_Line) line = new Geom_Line(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Dir(x,y,z)));
- BRepAdaptor_Surface BS(f);
- Handle(Geom_Surface) su = BRep_Tool::Surface(f);
- GeomAPI_IntCS intcs(line,su);
- Standard_Boolean done = intcs.IsDone();
- if (!done) {di<<"intersection point on surface not found\n"; return 1;}
- Standard_Integer npnts = intcs.NbPoints();
- if (npnts < 1) {di<<"intersection point on surface not found\n"; return 1;}
-
- Standard_Real tol = Precision::Confusion();
- BRepLProp_SLProps props(BS,2,tol);
- gp_Dir Norm,D1,D2;
- for (Standard_Integer i = 1; i <= npnts; i++) {
- gp_Pnt p = intcs.Point(i);
- Standard_Real u,v,w; intcs.Parameters(i,u,v,w);
- di<<"point("<", __FILE__, shapeclassifier, g);
- theCommands.Add("clclass", "clclass sh shref ", __FILE__, class3dclassifier, g);
-
- // useful commands :
- theCommands.Add("cled", "cled ed f", __FILE__, isclosingE, g);
- theCommands.Add("compare", "compare s1 s2", __FILE__, compareshsh, g);
- theCommands.Add("edonfa", "edonfa ed f", __FILE__, pcurveedgeonface, g);
- theCommands.Add("pconfa", "pconfa name s f", __FILE__, pcurvesonface, g);
- theCommands.Add("orivine", "orivine v ed", __FILE__, orivine, g);
- theCommands.Add("vine", "vine v ed fa", __FILE__, vine, g);
- theCommands.Add("issubsh", "issubsh subsh sh", __FILE__, issubshape, g);
- theCommands.Add("bnd2d", "bnd2d name W F i", __FILE__, drawbnd2d, g);
- theCommands.Add("classibnd2d","classibnd2d W1 W2 F i", __FILE__, classifBnd2d, g);
- theCommands.Add("pntonc", "pntonc par C3d", __FILE__, pntonc, g);
- theCommands.Add("pntonc2d", "pntonc2d par C2d S", __FILE__, pntonc2d, g);
- theCommands.Add("projponf",
- "projponf f pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]",
- __FILE__, projponf, g);
- theCommands.Add("curvature", "curvature f x y z", __FILE__, curvature , g);
-}
diff --git a/src/TestTopOpe/TestTopOpe_DSF.cxx b/src/TestTopOpe/TestTopOpe_DSF.cxx
deleted file mode 100644
index 077c31622b..0000000000
--- a/src/TestTopOpe/TestTopOpe_DSF.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-// Created on: 1996-02-05
-// Created by: Jea Yves LEBEY
-// Copyright (c) 1996-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
-
-Standard_Integer TestTopOpe_BOOP::DSF_SetInterTolerances(TopOpeBRep_DSFiller& DSF)
-{
- if (myVarsTopo.GetForceToli()) {
- TopOpeBRep_ShapeIntersector& tobsi = DSF.ChangeShapeIntersector();
- Standard_Real tola,tolt; myVarsTopo.GetToli(tola,tolt);
- TopOpeBRep_FacesIntersector& tobfi = tobsi.ChangeFacesIntersector();
- tobfi.ForceTolerances(tola,tolt);
- TopOpeBRep_EdgesIntersector& tobei = tobsi.ChangeEdgesIntersector();
- tobei.ForceTolerances(tola,tolt);
- }
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF_Insert_InsertIntersection(DSF);
- DSF_Insert_Complete_CompleteDS(DSF);
- DSF_Insert_Complete_Filter(DSF);
- DSF_Insert_Complete_Reducer(DSF);
- DSF_Insert_Complete_RemoveUnsharedGeometry(DSF);
- DSF_Insert_Complete_Checker(DSF);
- mylastPREP = 190;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_InsertIntersection(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF_SetInterTolerances(DSF);
- DSF.InsertIntersection(myS1,myS2,myHDS);
- mylastPREP = 110;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_GapFiller(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.GapFiller(myHDS);
- mylastPREP = 115;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_CompleteDS(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.CompleteDS(myHDS);
- mylastPREP = 120;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_Filter(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.Filter(myHDS);
- mylastPREP = 130;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_Reducer(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.Reducer(myHDS);
- mylastPREP = 140;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_RemoveUnsharedGeometry(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.RemoveUnsharedGeometry(myHDS);
- mylastPREP = 150;
- return 0;
-}
-
-Standard_Integer TestTopOpe_BOOP::DSF_Insert_Complete_Checker(TopOpeBRep_DSFiller& DSF)
-{
-// Standard_Integer err = 0;
- DSF.Checker(myHDS);
- mylastPREP = 160;
- return 0;
-}
diff --git a/src/TestTopOpe/TestTopOpe_EditBOOP.cxx b/src/TestTopOpe/TestTopOpe_EditBOOP.cxx
deleted file mode 100644
index ad83485ce1..0000000000
--- a/src/TestTopOpe/TestTopOpe_EditBOOP.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-// Created on: 1996-02-05
-// Created by: Jea Yves LEBEY
-// Copyright (c) 1996-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
-
-void TestTopOpe_BOOP::SetTol(const TopOpeBRepDS_Kind K,const Standard_Integer index,const Standard_Real tol)
-{
- TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
- switch(K) {
- case TopOpeBRepDS_SURFACE: {
- TopOpeBRepDS_Surface& Surf = BDS.ChangeSurface(index);
- Surf.Tolerance(tol);
- break;
- }
- case TopOpeBRepDS_CURVE: {
- TopOpeBRepDS_Curve& Curv = BDS.ChangeCurve(index);
- Curv.Tolerance(tol);
- break;
- }
- case TopOpeBRepDS_POINT: {
- TopOpeBRepDS_Point& Poin = BDS.ChangePoint(index);
- Poin.Tolerance(tol);
- break;
- }
- default:
- break;
- }
- TopOpeBRepDS::Print(K, index, cout);
- cout<Shape(index)));
- TopAbs_ShapeEnum se = S.ShapeType();
- BRep_Builder BRB;
- if(se == TopAbs_FACE) {
- TopoDS_Face& F = TopoDS::Face(S);
- BRB.UpdateFace(F, tol);
- }
- else if(se == TopAbs_EDGE) {
- TopoDS_Edge& E = TopoDS::Edge(S);
- BRB.UpdateEdge(E, tol);
- }
- else if(se == TopAbs_VERTEX) {
- TopoDS_Vertex& V = TopoDS::Vertex(S);
- BRB.UpdateVertex(V, tol);
- }
- else {
- cout<<"Impossible to change the tolerance of ";
- TopOpeBRepDS::Print(TopOpeBRepDS::ShapeToKind(se),cout);
- cout<ChangeDS().ChangePoint(i);
- gp_Pnt& Pnt = Poin.ChangePoint();
- Pnt.SetCoord(x,y,z);
-}
diff --git a/src/TestTopOpe/TestTopOpe_HDSCommands.cxx b/src/TestTopOpe/TestTopOpe_HDSCommands.cxx
deleted file mode 100644
index fc166fb6a4..0000000000
--- a/src/TestTopOpe/TestTopOpe_HDSCommands.cxx
+++ /dev/null
@@ -1,1259 +0,0 @@
-// Created on: 1994-10-24
-// Created by: Jean Yves LEBEY
-// Copyright (c) 1994-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
-
-class TSEEpar {
-public:
- TSEEpar(const TCollection_AsciiString& s) { set(s); }
- void set(const TCollection_AsciiString& s) {
- miskind = misshap = misgeom = missect = misdege = misafev = misedcu = Standard_False;
- mTK = TopOpeBRepDS_UNKNOWN; mTS = TopAbs_SHAPE;
- char* sK = (char *)s.ToCString();
- miskind = TestTopOpeDraw_TTOT::StringToKind(s,mTK);
- if ( miskind ) {
- misshap = TopOpeBRepDS::IsTopology(mTK);
- if (misshap) mTS = TopOpeBRepDS::KindToShape(mTK);
- else misgeom = TopOpeBRepDS::IsGeometry(mTK);
- }
- else if ( ! strcasecmp(sK,"s") ) {
- misshap = Standard_True; mTS = TopAbs_SHAPE;
- }
- else if ( ! strcasecmp(sK,"se") ) {
- missect = Standard_True; mTK = TopOpeBRepDS_EDGE;
- }
- else if ( ! strcasecmp(sK,"de") ) {
- misdege = Standard_True; mTK = TopOpeBRepDS_EDGE;
- }
- else if ( ! strcasecmp(sK,"fev") ) {
- misafev = Standard_True;
- }
- else if ( ! strcasecmp(sK,"ec") ) {
- misedcu = Standard_True;
- }
- }
- Standard_Boolean iskind() { return miskind;}
- Standard_Boolean isshap() { return misshap;}
- Standard_Boolean isgeom() { return misgeom;}
- Standard_Boolean issect() { return missect;}
- Standard_Boolean isdege() { return misdege;}
- Standard_Boolean isafev() { return misafev;}
- Standard_Boolean isedcu() { return misedcu;}
- TopOpeBRepDS_Kind TK() {return mTK;}
- TopAbs_ShapeEnum TS() {return mTS;}
-private:
- Standard_Boolean miskind,misshap,misgeom,missect,misdege,misafev,misedcu;
- TopOpeBRepDS_Kind mTK; TopAbs_ShapeEnum mTS;
-};
-
-class TDSpar : public TSEEpar {
-public:
- TDSpar(const TCollection_AsciiString& s) : TSEEpar(s) {}
-};
-
-#define ISINTEGER(MMstr) ((strspn((MMstr),"0123456789") == strlen((MMstr))))
-
-TestTopOpe_HDSDisplayer* PHDSD = NULL;
-static TestTopOpeDraw_Displayer* POCD = NULL;
-
-static Standard_Boolean SFindKeep = Standard_False;
-static Standard_Boolean GFindKeep = Standard_False;
-static Standard_Boolean PrintDistancePP = Standard_False;
-static Standard_Integer SelectRankShape = 0;
-static Standard_Boolean DisOri = Standard_False;
-static Standard_Boolean TolFlag = Standard_False;
-static Standard_Real OldParFlag = -1.0;
-static Standard_Real ParFlag = -1.0;
-
-class tsee_entity {
-public:
- Standard_Boolean myEOK;
- TestTopOpe_HDSDisplayer* myEPHDSD;
- Handle(TopOpeBRepDS_HDataStructure) myEHDS; TopOpeBRepDS_DataStructure *myEPDS;
- TopOpeBRepDS_Kind myETK;TopAbs_ShapeEnum myETS;Standard_Integer myEindex;
- Standard_Boolean myEiskind,myEisshape,myEisgeome,myEissect;
- TCollection_AsciiString myEnamedbrep,myEnamedisp; Draw_ColorKind myEnamecolor;
-
-//JR/Hp :
- tsee_entity() {
-// tsee_entity::tsee_entity() {
- myEOK = Standard_False;
- if (PHDSD == NULL) return; myEPHDSD = PHDSD;
- myEHDS = myEPHDSD->CurrentHDS(); myEPDS = (TopOpeBRepDS_DataStructure*)&myEHDS->ChangeDS();
- myETK = TopOpeBRepDS_UNKNOWN;myETS = TopAbs_SHAPE; myEindex = 0;
- myEiskind = myEisshape = myEisgeome = myEissect = Standard_False;
- myEnamedbrep = ""; myEnamedisp = ""; myEnamecolor = Draw_blanc;
- myEOK = Standard_True;
- }
-
- Standard_Boolean IsP() const { return (myETK == TopOpeBRepDS_POINT); }
- Standard_Boolean IsV() const { return (myETK == TopOpeBRepDS_VERTEX); }
- Standard_Boolean Is0() const { return IsP() || IsV(); }
- Standard_Integer Set(Standard_Integer na,const char** a,Standard_Integer iargK,Standard_Integer iargI);
-
- virtual ~tsee_entity() {}
- void virtual See() = 0;
-};
-
-Standard_Integer tsee_entity::Set(Standard_Integer na,const char** a,Standard_Integer iargK,Standard_Integer iargI) {
- myEOK = Standard_False;
- if (iargK>=na) return 1; if (iargI>=na) return 1;
- TCollection_AsciiString ascK = a[iargK]; myEindex = Draw::Atoi(a[iargI]);
- myEiskind = TestTopOpeDraw_TTOT::StringToKind(ascK,myETK);
- if (!myEiskind) return 1; if (myETK == TopOpeBRepDS_UNKNOWN) return 1;
-
- myEisshape = TopOpeBRepDS::IsTopology(myETK);
- if (myEisshape) {
- if ((myEindex < 1) || (myEindex > myEPDS->NbShapes())) return 0;
- myETS = TopOpeBRepDS::KindToShape(myETK);
- const TopoDS_Shape& S = myEPDS->Shape(myEindex);
- if (myETS != S.ShapeType()) return 0;
- myEPHDSD->ShapeName(myEindex,S,myEnamedbrep);
- myEPHDSD->ShapeDisplayName(myEindex,S,myEnamedisp);
- }
-
- myEisgeome = TopOpeBRepDS::IsGeometry(myETK);
- if (myEisgeome) {
- if (IsP()) {
- TopOpeBRepDS_PointExplorer pex(myEHDS->DS());
- if (!pex.IsPoint(myEindex)) return 1;
- }
- TestTopOpeDraw_TTOT::GeometryName(myEindex,myETK,myEnamedbrep);
- myEPHDSD->GeometryDisplayName(myEindex,myETK,myEnamedisp);
- }
-
- myEnamecolor = TestTopOpeDraw_TTOT::GeometryColor(myETK);
- myEOK = Standard_True;
- return 0;
-}
-
-class tsee_entity0 : public tsee_entity {
-public:
- gp_Pnt Pnt() const;
- void See();
-};
-
-gp_Pnt tsee_entity0::Pnt() const
-{
- if (!Is0()) throw Standard_Failure("not 0d");
- gp_Pnt P;
- if (IsP()) P = myEPDS->Point(myEindex).Point();
- else if (IsV()) P = BRep_Tool::Pnt(TopoDS::Vertex(myEPDS->Shape(myEindex)));
- return P;
-}
-
-static void SetPoint
-(const TCollection_AsciiString& namedbrep,const TCollection_AsciiString& namedisp,const Draw_Color& namecolor,const TopOpeBRepDS_Point& P)
-{
- Handle(TestTopOpeDraw_DrawableP3D) D;
- if(TolFlag) {
- D = new TestTopOpeDraw_DrawableP3D(P.Point(),Draw_CircleZoom,namecolor,
- namedisp.ToCString(),namecolor,
- P.Tolerance());
- } else {
- D = new TestTopOpeDraw_DrawableP3D(P.Point(),Draw_Square,namecolor,
- namedisp.ToCString(),namecolor);
- }
- char *pname = (char *)namedbrep.ToCString();
- Draw::Set(pname,D);
-
-}
-void tsee_entity0::See()
-{
- if (IsP()) ::SetPoint(myEnamedbrep,myEnamedisp,myEnamecolor,myEPDS->Point(myEindex));
- if (IsV()) POCD->DisplayShape(myEnamedbrep,myEnamedisp,myEPDS->Shape(myEindex));
-}
-
-//-----------------------------------------------
-static void SetCurve
-//-----------------------------------------------
-(const TCollection_AsciiString& namedbrep,
- const TCollection_AsciiString& namedisp,
- const Draw_Color& namecolor,
- const TopOpeBRepDS_Curve& DSC,
- const Standard_Integer iC)
-{
- if ( !PHDSD ) return;
- const Handle(Geom_Curve) GC = DSC.Curve();
- if ( GC.IsNull() ) { cout<<"Curve() nulle"<FirstParameter();
- Standard_Real l = GC->LastParameter();
-
- GeomAdaptor_Curve GAC(GC);
- GeomAbs_CurveType GACt = GAC.GetType();
- if ( GACt == GeomAbs_Line ) {
- Standard_Real fline = RealLast(),lline = RealFirst();
- Standard_Integer imother = DSC.Mother(),igood;
- if(imother) igood = imother;
- else igood = iC;
- TopOpeBRepDS_PointIterator it = PHDSD->CurrentHDS()->CurvePoints(igood);
- for(; it.More(); it.Next()) {
- Standard_Real p = it.Parameter();
- fline = Min(fline,p); lline = Max(fline,p);
- }
- f = fline;
- l = lline;
- }
-
- Handle(Geom_TrimmedCurve) GTC = new Geom_TrimmedCurve(GC,f,l);
- Handle(TestTopOpeDraw_DrawableC3D) D;
- D = new TestTopOpeDraw_DrawableC3D(GTC,namecolor,namedisp.ToCString(),namecolor);
- char *pname = (char *)namedbrep.ToCString();
- Draw::Set(pname,D);
-}
-
-static TopoDS_Shape bidbid;
-static const TopoDS_Shape& GetShape(const Standard_Integer IS,const TopAbs_ShapeEnum TS)
-{
- Standard_Boolean TypeControl = Standard_True;
- if ( !PHDSD ) return bidbid;
-
- static TopoDS_Shape ShapeNull;
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
-
- // check on shape index and on shape kind if kind differs from TopAbs_SHAPE
- Standard_Integer ns = BDS.NbShapes();
- if ( IS < 1 || IS > ns) {
- TopAbs::Print(TS,cout);cout<<" "<ShapeKind(IS,TS) ) {
- if ( TypeControl ) {
- cout<<"Shape "<CurrentBDS();
- const TopoDS_Shape& S = BDS.Shape(IS);
- return S;
-}
-
-//-----------------------------------------------------------------------
-// SeeSectionEdge
-//-----------------------------------------------------------------------
-static Standard_Integer SeeSectionEdge(const Standard_Integer ISE)
-{
- if ( !PHDSD || !POCD ) return 0;
-
- Standard_Integer nse = PHDSD->CurrentBDS().NbSectionEdges();
- if ( ISE < 1 || ISE > nse ) return 0;
- const TopoDS_Shape& SE = PHDSD->CurrentBDS().SectionEdge(ISE);
- if (SE.IsNull()) return 0;
-
- TCollection_AsciiString namedbrep; PHDSD->SectionEdgeName(ISE,SE,namedbrep);
- TCollection_AsciiString namedisp; PHDSD->SectionEdgeDisplayName(ISE,SE,namedisp);
- POCD->DisplayGeometry(Standard_True);
- POCD->DisplayShape(namedbrep,namedisp,SE);
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeeShapeIS
-//-----------------------------------------------------------------------
-Standard_Integer SeeShapeIS(const Standard_Integer I,const TopoDS_Shape& S)
-{
- if ( !PHDSD || !POCD) return 0;
-
- if (S.IsNull()) return 0;
- TCollection_AsciiString namedbrep; PHDSD->ShapeName(I,S,namedbrep);
- TCollection_AsciiString namedisp = namedbrep;
- // NameDisplay = *name/name* if S subshape of shape1/shape2
- TCollection_AsciiString ast = "*";
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
- // if the Shape was removed from the DS, "*" is replaced by "~"
- if(!BDS.HasShape(S))
- ast = "~";
- Standard_Boolean of1 = PHDSD->SubShape(S,1);if(of1) namedisp = ast+namedisp;
- Standard_Boolean of2 = PHDSD->SubShape(S,2);if(of2) namedisp = namedisp+ast;
- if (SelectRankShape == 1 && !of1) return 0;
- if (SelectRankShape == 2 && !of2) return 0;
-
- if (S.ShapeType()==TopAbs_EDGE) POCD->DisplayGeometry(Standard_True);
- else POCD->DisplayGeometry(DisOri);
- if((S.ShapeType()==TopAbs_VERTEX) && TolFlag) {
- const TopoDS_Vertex& V = TopoDS::Vertex(S);
- Standard_Real Tol = BRep_Tool::Tolerance(V);
- POCD->SetTol(Tol);
- }
- POCD->DisplayShape(namedbrep,namedisp,S);
-
- return 0;
-}
-
-
-//-----------------------------------------------------------------------
-// SeeShape
-//-----------------------------------------------------------------------
-static Standard_Integer SeeShape(TCollection_AsciiString namedbrep)
-{
- if ( !PHDSD || !POCD ) return 0;
-
- const char* pname = (const char *)namedbrep.ToCString();
- TopoDS_Shape S = DBRep::Get(pname);
- if ( S.IsNull() ) return 0;
- TCollection_AsciiString namedisp;
- PHDSD->ShapeDisplayName(namedbrep,S,namedisp);
- POCD->DisplayShape(namedbrep,namedisp,S);
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeePoint
-//-----------------------------------------------------------------------
-static Standard_Integer SeePoint(const Standard_Integer I)
-{
- if ( !PHDSD ) return 0;
-
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
- if (I < 1 || I > BDS.NbPoints()) return 0;
-
- TopOpeBRepDS_PointExplorer pex(BDS);
- Standard_Boolean isp = pex.IsPoint(I);
- if (!isp) return 0;
-
- const TopOpeBRepDS_Point& P = BDS.Point(I);
- TopOpeBRepDS_Kind K = TopOpeBRepDS_POINT;
- TCollection_AsciiString namedbrep; TestTopOpeDraw_TTOT::GeometryName(I,K,namedbrep);
- TCollection_AsciiString namedisp; PHDSD->GeometryDisplayName(I,K,namedisp);
- Draw_ColorKind namecolor = TestTopOpeDraw_TTOT::GeometryColor(K);
- SetPoint(namedbrep,namedisp,namecolor,P);
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeeCurve
-//-----------------------------------------------------------------------
-static Standard_Integer SeeCurve(const Standard_Integer I)
-{
- if ( !PHDSD ) return 0;
-
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
- if (I < 1 || I > BDS.NbCurves()) return 0;
-
- TopOpeBRepDS_CurveExplorer cex(BDS,GFindKeep);
- Standard_Boolean isc = cex.IsCurve(I);
- if (!isc) return 0;
-
- const TopOpeBRepDS_Curve& C = BDS.Curve(I);
- TopOpeBRepDS_Kind K = TopOpeBRepDS_CURVE;
- TCollection_AsciiString namedbrep; TestTopOpeDraw_TTOT::GeometryName(I,K,namedbrep);
- TCollection_AsciiString namedisp; PHDSD->GeometryDisplayName(I,K,namedisp);
- Draw_ColorKind namecolor = TestTopOpeDraw_TTOT::GeometryColor(K);
- SetCurve(namedbrep,namedisp,namecolor,C,I);
- return 0;
-}
-
-
-//-----------------------------------------------------------------------
-// SeeSurface NYI
-//-----------------------------------------------------------------------
-Standard_Integer SeeSurface(const Standard_Integer I) // NYI
-{
- if ( !PHDSD ) return 0;
-
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
- if (I < 1 || I > BDS.NbSurfaces()) return 0;
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeeEdgeCurve
-//-----------------------------------------------------------------------
-static Standard_Integer SeeEdgeCurve(const Standard_Integer IE,const TopoDS_Shape& SE)
-{
- if ( !POCD ) return 0;
-
- if (SE.IsNull()) return 0;
- const TopoDS_Edge& E = TopoDS::Edge(SE);
- TopLoc_Location L;Standard_Real f,l;Handle(Geom_Curve) GC=BRep_Tool::Curve(E,L,f,l);
- TCollection_AsciiString namedbrep="E";TestTopOpeDraw_TTOT::CatCurveName(IE,namedbrep);
- TCollection_AsciiString namedisp="E";TestTopOpeDraw_TTOT::CatCurveDisplayName(IE,GC,namedisp);
- POCD->DisplayGeometry(Standard_True);
- POCD->DisplayShape(namedbrep,namedisp,SE);
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeeGeometry
-//-----------------------------------------------------------------------
-static Standard_Integer SeeGeometry(const Standard_Integer IG,const TopOpeBRepDS_Kind TK)
-{
- if (TK == TopOpeBRepDS_POINT) return SeePoint(IG);
- else if (TK == TopOpeBRepDS_CURVE) return SeeCurve(IG);
- else if (TK == TopOpeBRepDS_SURFACE) return SeeSurface(IG);
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// SeeGeometry
-//-----------------------------------------------------------------------
-static Standard_Integer SeeGeometry(const TopOpeBRepDS_Kind TK)
-{
- if ( !PHDSD ) return 0;
-
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
-
- if (TK == TopOpeBRepDS_POINT) {
- TopOpeBRepDS_PointExplorer pex(BDS,GFindKeep);
- for (; pex.More(); pex.Next()) {
- Standard_Integer ig = pex.Index();
- SeeGeometry(ig,TK);
- }
- }
- else if (TK == TopOpeBRepDS_CURVE) {
- TopOpeBRepDS_CurveExplorer cex(BDS,GFindKeep);
- for (; cex.More(); cex.Next()) {
- Standard_Integer ig = cex.Index();
- SeeGeometry(ig,TK);
- }
- }
- else if (TK == TopOpeBRepDS_SURFACE) { //NYI
- }
- return 0;
-}
-
-//-----------------------------------------------------------------------
-// TOPOPE_SeeShape
-//-----------------------------------------------------------------------
-Standard_Integer TOPOPE_SeeShape(char* name)
-{
- TCollection_AsciiString asc = name;
- Standard_Integer res = SeeShape(asc);
- return res;
-}
-
-//-----------------------------------------------------------------------
-// suppressarg : remove a[d],modify na--
-//-----------------------------------------------------------------------
-void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d)
-{
- for(Standard_Integer i=d;i to ,modify na = na - (l - f)
-//-----------------------------------------------------------------------
-Standard_EXPORT void suppressargs(Standard_Integer& na,const char** a,const Standard_Integer f,const Standard_Integer l)
-{
- if(l == f)
- suppressarg(na,a,l);
- if(l <= f) return;
- for(Standard_Integer i=0;i s_4 is subshape of the 1st argument
- suppressarg(na,a,ia);
- SelectRankShape = 1;
- }
- else if (!strcasecmp(a[ia],"-2")) {
- // tsee -2 s 4 : display s_4 <=> s_4 is subshape of the 2nd argument
- suppressarg(na,a,ia);
- SelectRankShape = 2;
- }
- else if (!strcasecmp(a[ia],"-p") && (ia < na-1)) {
- suppressargs(na,a,ia,ia+1);
- Standard_Real t = Draw::Atof(a[ia+1]);
- if (t >= 0. && t <= 1.) {
- OldParFlag = ParFlag; ParFlag = t;
- }
- }
- }
-}
-
-void OthersCommands_help(const char* CommandName,const char* syntaxe = "");
-//-----------------------------------------------------------------------
-// tsee_help
-//-----------------------------------------------------------------------
-static void tsee_help(const char* CommandName, Draw_Interpretor& di)
-{
- di<<"\n";
- di<<"tsee : Draw entities of data structure (DS) loaded by TestTopOpe::CurrentDS().\n";
- di<<"DS entities are shapes and geometries accessed by a