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>
24 #include <gp_Pnt2d.hxx>
25 #include <IntRes2d_IntersectionPoint.hxx>
26 #include <TopoDS_Vertex.hxx>
27 #include <TopOpeBRep_define.hxx>
28 #include <TopOpeBRep_EdgesIntersector.hxx>
29 #include <TopOpeBRep_Hctxee2d.hxx>
30 #include <TopOpeBRep_Hctxff2d.hxx>
31 #include <TopOpeBRep_Point2d.hxx>
32 #include <TopOpeBRepDS.hxx>
33 #include <TopOpeBRepDS_Transition.hxx>
35 //=======================================================================
36 //function : TopOpeBRep_Point2d
38 //=======================================================================
39 TopOpeBRep_Point2d::TopOpeBRep_Point2d() :
40 myhaspint(Standard_False),
41 myisvertex1(Standard_False),
43 myisvertex2(Standard_False),
45 myispointofsegment(Standard_False),
46 myips1(0),myips2(0),myhasancestors(Standard_False),
47 mystatus(TopOpeBRep_P2DUNK),
49 mykeep(Standard_True),
50 myedgesconfig(TopOpeBRepDS_UNSHGEOMETRY),
55 //=======================================================================
58 //=======================================================================
59 const TopoDS_Vertex& TopOpeBRep_Point2d::Vertex(const Standard_Integer Index) const
61 if (!IsVertex(Index)) throw Standard_Failure("TopOpeBRep_Point2d::Vertex");
62 if (Index == 1) return myvertex1;
63 else if (Index == 2) return myvertex2;
64 else throw Standard_Failure("TopOpeBRep_Point2d::Vertex");
67 //=======================================================================
68 //function : Transition
70 //=======================================================================
71 const TopOpeBRepDS_Transition& TopOpeBRep_Point2d::Transition(const Standard_Integer Index) const
73 if (Index == 1) return mytransition1;
74 else if (Index == 2) return mytransition2;
75 else throw Standard_Failure("TopOpeBRep_Point2d::Transition");
78 //=======================================================================
79 //function : ChangeTransition
81 //=======================================================================
82 TopOpeBRepDS_Transition& TopOpeBRep_Point2d::ChangeTransition(const Standard_Integer Index)
84 if (Index == 1) return mytransition1;
85 else if (Index == 2) return mytransition2;
86 else throw Standard_Failure("TopOpeBRep_Point2d::ChangeTransition");
89 //=======================================================================
92 //=======================================================================
94 void TopOpeBRep_Point2d::Dump(const Standard_Integer E1index,const Standard_Integer E2index) const
96 Standard_Real par1 = Parameter(1);
97 Standard_Real par2 = Parameter(2);
99 Standard_Integer index = Index();
100 Standard_Boolean keep = Keep();
101 Standard_Integer sts = Status();
102 Standard_Boolean pos = IsPointOfSegment();
104 Standard_Boolean isvertex1 = IsVertex(1); TopoDS_Vertex V1; if (isvertex1) V1 = Vertex(1);
105 Standard_Boolean isvertex2 = IsVertex(2); TopoDS_Vertex V2; if (isvertex2) V2 = Vertex(2);
107 Standard_Integer ia1,ia2; SegmentAncestors(ia1,ia2);
108 std::cout<<std::endl<<"p2d "<<index<<" k="<<keep<<" pos="<<pos;
110 case TopOpeBRep_P2DUNK : std::cout<<" sts=u";break;
111 case TopOpeBRep_P2DSGF : std::cout<<" sts=f";break;
112 case TopOpeBRep_P2DSGL : std::cout<<" sts=l";break;
113 case TopOpeBRep_P2DNEW :
115 std::cout<<" anc="<<ia1<<","<<ia2;
117 case TopOpeBRep_P2DINT : std::cout<<" sts=i";break;
119 std::cout<<" cfg=";TopOpeBRepDS::Print(myedgesconfig,std::cout);
120 std::cout<<std::endl;
122 gp_Pnt P3D = Value();
124 std::cout<<FUN_tool_PRODINP()<<"P"<<Index()<<" "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z()<<"; # tol = "<<tol<<std::endl;
126 std::cout<<" on (1) :";
127 std::cout<<" vertex(1) : ";
128 std::cout<<(isvertex1?1:0);
129 std::cout<<" T "<<E1index<<"(1)";
130 std::cout<<" par(1) = "<<par1;
132 P3D = BRep_Tool::Pnt(V1);
133 std::cout<<" PV(1) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
135 std::cout<<std::endl;
137 std::cout<<" on (2) :";
138 std::cout<<" vertex(2) : ";
139 std::cout<<(isvertex2?1:0);
140 std::cout<<" T "<<E2index<<"(2)";
141 std::cout<<" par(2) = "<<par2;
143 P3D = BRep_Tool::Pnt(V2);
144 std::cout<<" PV(2) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
146 std::cout<<std::endl;
149 void TopOpeBRep_Point2d::Dump(const Standard_Integer,const Standard_Integer) const {}