1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <TPrsStd_PointDriver.ixx>
16 #include <TDF_Label.hxx>
17 #include <TDataXtd_Point.hxx>
18 #include <TDataXtd_Geometry.hxx>
19 //#include <TDataStd_Datum.hxx>
20 #include <AIS_Point.hxx>
21 #include <AIS_InteractiveContext.hxx>
22 #include <Geom_Point.hxx>
23 #include <Geom_CartesianPoint.hxx>
28 //=======================================================================
31 //=======================================================================
32 TPrsStd_PointDriver::TPrsStd_PointDriver()
36 //=======================================================================
39 //=======================================================================
40 Standard_Boolean TPrsStd_PointDriver::Update (const TDF_Label& aLabel,
41 Handle(AIS_InteractiveObject)& anAISObject)
43 Handle(TDataXtd_Point) appoint;
45 if ( !aLabel.FindAttribute(TDataXtd_Point::GetID(), appoint) ) {
46 return Standard_False;
50 if (!TDataXtd_Geometry::Point(aLabel,pnt)) {
51 return Standard_False;
53 Handle(Geom_CartesianPoint) apt = new Geom_CartesianPoint(pnt);
56 Handle(AIS_Point) aistrihed;
57 if (anAISObject.IsNull())
58 aistrihed = new AIS_Point(apt);
60 aistrihed = Handle(AIS_Point)::DownCast(anAISObject);
61 if (aistrihed.IsNull())
62 aistrihed = new AIS_Point(apt);
64 aistrihed->SetComponent(apt);
65 aistrihed->ResetTransformation();
66 aistrihed->SetToUpdate();
67 aistrihed->UpdateSelection();
70 anAISObject = aistrihed;