0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / TopOpeBRep / TopOpeBRep_Point2d.cxx
1 // Created on: 1998-10-29
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifdef DRAW
18 #include <TopOpeBRepTool_DRAW.hxx>
19 #endif
20
21
22 #include <BRep_Tool.hxx>
23 #include <TopOpeBRep_EdgesIntersector.hxx>
24 #include <TopOpeBRep_Point2d.hxx>
25 #include <TopOpeBRepDS.hxx>
26 #include <TopOpeBRepDS_Transition.hxx>
27
28 //=======================================================================
29 //function : TopOpeBRep_Point2d
30 //purpose  : 
31 //=======================================================================
32 TopOpeBRep_Point2d::TopOpeBRep_Point2d() :
33 myhaspint(Standard_False),
34 myisvertex1(Standard_False),
35 myparameter1(0.),
36 myisvertex2(Standard_False),
37 myparameter2(0.),
38 myispointofsegment(Standard_False),
39 myips1(0),myips2(0),myhasancestors(Standard_False),
40 mystatus(TopOpeBRep_P2DUNK),
41 myindex(0),
42 mykeep(Standard_True),
43 myedgesconfig(TopOpeBRepDS_UNSHGEOMETRY),
44 mytolerance(0.)
45 {
46 }
47
48 //=======================================================================
49 //function : Vertex
50 //purpose  : 
51 //=======================================================================
52 const TopoDS_Vertex& TopOpeBRep_Point2d::Vertex(const Standard_Integer Index) const
53 {
54   if (!IsVertex(Index)) throw Standard_Failure("TopOpeBRep_Point2d::Vertex");
55   if      (Index == 1) return myvertex1;
56   else if (Index == 2) return myvertex2;
57   else throw Standard_Failure("TopOpeBRep_Point2d::Vertex");
58 }
59
60 //=======================================================================
61 //function : Transition
62 //purpose  : 
63 //=======================================================================
64 const TopOpeBRepDS_Transition& TopOpeBRep_Point2d::Transition(const Standard_Integer Index) const
65 {
66   if      (Index == 1) return mytransition1;
67   else if (Index == 2) return mytransition2;
68   else throw Standard_Failure("TopOpeBRep_Point2d::Transition");
69 }
70
71 //=======================================================================
72 //function : ChangeTransition
73 //purpose  : 
74 //=======================================================================
75 TopOpeBRepDS_Transition& TopOpeBRep_Point2d::ChangeTransition(const Standard_Integer Index)
76 {
77   if      (Index == 1) return mytransition1;
78   else if (Index == 2) return mytransition2;
79   else throw Standard_Failure("TopOpeBRep_Point2d::ChangeTransition");
80 }
81
82 //=======================================================================
83 //function : Dump
84 //purpose  : 
85 //=======================================================================
86 #ifdef OCCT_DEBUG
87 void TopOpeBRep_Point2d::Dump(const Standard_Integer E1index,const Standard_Integer E2index) const
88 {
89   Standard_Real par1 = Parameter(1);
90   Standard_Real par2 = Parameter(2);
91   
92   Standard_Integer index = Index();
93   Standard_Boolean keep = Keep();
94   Standard_Integer sts = Status();
95   Standard_Boolean pos = IsPointOfSegment();
96
97   Standard_Boolean isvertex1 = IsVertex(1); TopoDS_Vertex V1; if (isvertex1) V1 = Vertex(1);
98   Standard_Boolean isvertex2 = IsVertex(2); TopoDS_Vertex V2; if (isvertex2) V2 = Vertex(2);
99
100   Standard_Integer ia1,ia2; SegmentAncestors(ia1,ia2);
101   std::cout<<std::endl<<"p2d "<<index<<"  k="<<keep<<" pos="<<pos;
102   switch (sts) {
103   case TopOpeBRep_P2DUNK : std::cout<<" sts=u";break;
104   case TopOpeBRep_P2DSGF : std::cout<<" sts=f";break;
105   case TopOpeBRep_P2DSGL : std::cout<<" sts=l";break;
106   case TopOpeBRep_P2DNEW :
107     std::cout<<" sts=n";
108     std::cout<<" anc="<<ia1<<","<<ia2;
109     break;
110   case TopOpeBRep_P2DINT : std::cout<<" sts=i";break;
111   } // switch
112   std::cout<<" cfg=";TopOpeBRepDS::Print(myedgesconfig,std::cout);
113   std::cout<<std::endl;
114   
115   gp_Pnt P3D = Value();
116 #ifdef DRAW
117   std::cout<<FUN_tool_PRODINP()<<"P"<<Index()<<" "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z()<<"; # tol = "<<tol<<std::endl;
118 #endif
119   std::cout<<"     on (1) :";
120   std::cout<<" vertex(1) : ";
121   std::cout<<(isvertex1?1:0);
122   std::cout<<"  T "<<E1index<<"(1)";
123   std::cout<<" par(1) = "<<par1;
124   if (isvertex1) {
125     P3D = BRep_Tool::Pnt(V1);
126     std::cout<<" PV(1) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
127   }
128   std::cout<<std::endl;
129   
130   std::cout<<"     on (2) :";
131   std::cout<<" vertex(2) : ";
132   std::cout<<(isvertex2?1:0);
133   std::cout<<"  T "<<E2index<<"(2)";
134   std::cout<<" par(2) = "<<par2;
135   if (isvertex2) {
136     P3D = BRep_Tool::Pnt(V2);
137     std::cout<<" PV(2) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
138   }
139   std::cout<<std::endl;
140 }
141 #else
142 void TopOpeBRep_Point2d::Dump(const Standard_Integer,const Standard_Integer) const {}
143 #endif