1 // Created on: 2009-04-06
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2009-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <BRep_Tool.hxx>
18 #include <BRepBuilderAPI_MakeVertex.hxx>
19 #include <Geom_CartesianPoint.hxx>
21 #include <Standard_GUID.hxx>
22 #include <Standard_Type.hxx>
23 #include <TDataStd.hxx>
24 #include <TDataXtd.hxx>
25 #include <TDataXtd_Point.hxx>
26 #include <TDF_Attribute.hxx>
27 #include <TDF_Label.hxx>
28 #include <TDF_RelocationTable.hxx>
29 #include <TNaming_Builder.hxx>
30 #include <TNaming_NamedShape.hxx>
31 #include <TNaming_Tool.hxx>
34 #include <TopoDS_Vertex.hxx>
36 IMPLEMENT_DERIVED_ATTRIBUTE(TDataXtd_Point, TDataStd_GenericEmpty)
38 //=======================================================================
41 //=======================================================================
42 const Standard_GUID& TDataXtd_Point::GetID()
44 static Standard_GUID TDataXtd_PointID("2a96b60d-ec8b-11d0-bee7-080009dc3333");
45 return TDataXtd_PointID;
49 //=======================================================================
52 //=======================================================================
54 Handle(TDataXtd_Point) TDataXtd_Point::Set (const TDF_Label& L)
56 Handle(TDataXtd_Point) A;
57 if (!L.FindAttribute(TDataXtd_Point::GetID(),A)) {
58 A = new TDataXtd_Point ();
64 //=======================================================================
67 //=======================================================================
69 Handle(TDataXtd_Point) TDataXtd_Point::Set (const TDF_Label& L, const gp_Pnt& P)
71 Handle(TDataXtd_Point) A = Set (L);
73 Handle(TNaming_NamedShape) aNS;
74 if(L.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
75 if(!aNS->Get().IsNull())
76 if(aNS->Get().ShapeType() == TopAbs_VERTEX) {
77 gp_Pnt anOldPnt = BRep_Tool::Pnt(TopoDS::Vertex(aNS->Get()));
78 if(anOldPnt.X() == P.X() &&
79 anOldPnt.Y() == P.Y() &&
87 B.Generated(BRepBuilderAPI_MakeVertex(P));
92 //=======================================================================
93 //function : TDataXtd_Point
95 //=======================================================================
97 TDataXtd_Point::TDataXtd_Point () {}
101 //=======================================================================
104 //=======================================================================
106 const Standard_GUID& TDataXtd_Point::ID() const { return GetID ();}
109 //=======================================================================
112 //=======================================================================
114 Standard_OStream& TDataXtd_Point::Dump (Standard_OStream& anOS) const