0023350: The null pointer is passed into 'strcmp' function.
[occt.git] / src / TestTopOpe / TestTopOpe_EditBOOP.cxx
1 // Created on: 1996-02-05
2 // Created by: Jea Yves LEBEY
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22 #include <TestTopOpe_BOOP.hxx>
23 #include <TopOpeBRepDS.hxx>
24 #include <TopOpeBRepDS_Surface.hxx>
25 #include <TopOpeBRepDS_Curve.hxx>
26 #include <TopOpeBRepDS_Point.hxx>
27 #include <TopOpeBRepDS_define.hxx>
28 #include <BRep_Builder.hxx>
29 #include <TopoDS.hxx>
30 #include <TopAbs.hxx>
31 #include <gp_Pnt.hxx>
32
33 void TestTopOpe_BOOP::SetTol(const TopOpeBRepDS_Kind K,const Standard_Integer index,const Standard_Real tol)
34 {
35   TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
36   switch(K) {
37   case TopOpeBRepDS_SURFACE: {
38     TopOpeBRepDS_Surface& Surf = BDS.ChangeSurface(index);
39     Surf.Tolerance(tol);
40     break;
41   }
42   case TopOpeBRepDS_CURVE: {
43     TopOpeBRepDS_Curve& Curv = BDS.ChangeCurve(index);
44     Curv.Tolerance(tol);
45     break;
46   }
47   case TopOpeBRepDS_POINT: {
48     TopOpeBRepDS_Point& Poin = BDS.ChangePoint(index);
49     Poin.Tolerance(tol);
50     break;
51   }
52 #ifndef DEB
53   default:
54     break;
55 #endif
56   }
57   TopOpeBRepDS::Print(K, index, cout);
58   cout<<endl;
59 }
60
61 void TestTopOpe_BOOP::SetTol(const Standard_Integer index,const Standard_Real tol)
62 {
63   TopoDS_Shape& S = *((TopoDS_Shape*)(&myHDS->Shape(index)));
64   TopAbs_ShapeEnum se = S.ShapeType();
65   BRep_Builder BRB;
66   if(se == TopAbs_FACE) {
67     TopoDS_Face& F = TopoDS::Face(S);
68     BRB.UpdateFace(F, tol);
69   }
70   else if(se == TopAbs_EDGE) {
71     TopoDS_Edge& E = TopoDS::Edge(S);
72     BRB.UpdateEdge(E, tol);
73   }
74   else if(se == TopAbs_VERTEX) {
75     TopoDS_Vertex& V = TopoDS::Vertex(S);
76     BRB.UpdateVertex(V, tol);
77   }
78   else {
79     cout<<"Impossible to change the tolerance of ";
80     TopOpeBRepDS::Print(TopOpeBRepDS::ShapeToKind(se),cout);
81     cout<<endl;
82     return;
83   }
84   TopOpeBRepDS::Print(se, index, cout);
85   cout<<endl;
86 }
87
88 void TestTopOpe_BOOP::SetPnt(const Standard_Integer i,const Standard_Real x,const Standard_Real y,const Standard_Real z)
89 {
90   TopOpeBRepDS_Point& Poin = myHDS->ChangeDS().ChangePoint(i);
91   gp_Pnt& Pnt = Poin.ChangePoint();
92   Pnt.SetCoord(x,y,z);
93 }