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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <TopOpeBRepTool_DRAW.hxx>
22 #include <BRep_Tool.hxx>
23 #include <TopOpeBRep_EdgesIntersector.hxx>
24 #include <TopOpeBRep_Point2d.hxx>
25 #include <TopOpeBRepDS.hxx>
26 #include <TopOpeBRepDS_Transition.hxx>
28 //=======================================================================
29 //function : TopOpeBRep_Point2d
31 //=======================================================================
32 TopOpeBRep_Point2d::TopOpeBRep_Point2d() :
33 myhaspint(Standard_False),
34 myisvertex1(Standard_False),
36 myisvertex2(Standard_False),
38 myispointofsegment(Standard_False),
39 myips1(0),myips2(0),myhasancestors(Standard_False),
40 mystatus(TopOpeBRep_P2DUNK),
42 mykeep(Standard_True),
43 myedgesconfig(TopOpeBRepDS_UNSHGEOMETRY),
48 //=======================================================================
51 //=======================================================================
52 const TopoDS_Vertex& TopOpeBRep_Point2d::Vertex(const Standard_Integer Index) const
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");
60 //=======================================================================
61 //function : Transition
63 //=======================================================================
64 const TopOpeBRepDS_Transition& TopOpeBRep_Point2d::Transition(const Standard_Integer Index) const
66 if (Index == 1) return mytransition1;
67 else if (Index == 2) return mytransition2;
68 else throw Standard_Failure("TopOpeBRep_Point2d::Transition");
71 //=======================================================================
72 //function : ChangeTransition
74 //=======================================================================
75 TopOpeBRepDS_Transition& TopOpeBRep_Point2d::ChangeTransition(const Standard_Integer Index)
77 if (Index == 1) return mytransition1;
78 else if (Index == 2) return mytransition2;
79 else throw Standard_Failure("TopOpeBRep_Point2d::ChangeTransition");
82 //=======================================================================
85 //=======================================================================
87 void TopOpeBRep_Point2d::Dump(const Standard_Integer E1index,const Standard_Integer E2index) const
89 Standard_Real par1 = Parameter(1);
90 Standard_Real par2 = Parameter(2);
92 Standard_Integer index = Index();
93 Standard_Boolean keep = Keep();
94 Standard_Integer sts = Status();
95 Standard_Boolean pos = IsPointOfSegment();
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);
100 Standard_Integer ia1,ia2; SegmentAncestors(ia1,ia2);
101 std::cout<<std::endl<<"p2d "<<index<<" k="<<keep<<" pos="<<pos;
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 :
108 std::cout<<" anc="<<ia1<<","<<ia2;
110 case TopOpeBRep_P2DINT : std::cout<<" sts=i";break;
112 std::cout<<" cfg=";TopOpeBRepDS::Print(myedgesconfig,std::cout);
113 std::cout<<std::endl;
115 gp_Pnt P3D = Value();
117 std::cout<<FUN_tool_PRODINP()<<"P"<<Index()<<" "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z()<<"; # tol = "<<tol<<std::endl;
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;
125 P3D = BRep_Tool::Pnt(V1);
126 std::cout<<" PV(1) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
128 std::cout<<std::endl;
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;
136 P3D = BRep_Tool::Pnt(V2);
137 std::cout<<" PV(2) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
139 std::cout<<std::endl;
142 void TopOpeBRep_Point2d::Dump(const Standard_Integer,const Standard_Integer) const {}