b311480e |
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 | |
7fd59977 |
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 | } |
7fd59977 |
52 | default: |
53 | break; |
7fd59977 |
54 | } |
55 | TopOpeBRepDS::Print(K, index, cout); |
56 | cout<<endl; |
57 | } |
58 | |
59 | void TestTopOpe_BOOP::SetTol(const Standard_Integer index,const Standard_Real tol) |
60 | { |
61 | TopoDS_Shape& S = *((TopoDS_Shape*)(&myHDS->Shape(index))); |
62 | TopAbs_ShapeEnum se = S.ShapeType(); |
63 | BRep_Builder BRB; |
64 | if(se == TopAbs_FACE) { |
65 | TopoDS_Face& F = TopoDS::Face(S); |
66 | BRB.UpdateFace(F, tol); |
67 | } |
68 | else if(se == TopAbs_EDGE) { |
69 | TopoDS_Edge& E = TopoDS::Edge(S); |
70 | BRB.UpdateEdge(E, tol); |
71 | } |
72 | else if(se == TopAbs_VERTEX) { |
73 | TopoDS_Vertex& V = TopoDS::Vertex(S); |
74 | BRB.UpdateVertex(V, tol); |
75 | } |
76 | else { |
77 | cout<<"Impossible to change the tolerance of "; |
78 | TopOpeBRepDS::Print(TopOpeBRepDS::ShapeToKind(se),cout); |
79 | cout<<endl; |
80 | return; |
81 | } |
82 | TopOpeBRepDS::Print(se, index, cout); |
83 | cout<<endl; |
84 | } |
85 | |
86 | void TestTopOpe_BOOP::SetPnt(const Standard_Integer i,const Standard_Real x,const Standard_Real y,const Standard_Real z) |
87 | { |
88 | TopOpeBRepDS_Point& Poin = myHDS->ChangeDS().ChangePoint(i); |
89 | gp_Pnt& Pnt = Poin.ChangePoint(); |
90 | Pnt.SetCoord(x,y,z); |
91 | } |