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.
15 #include <AIS_InteractiveContext.hxx>
16 #include <AIS_InteractiveObject.hxx>
17 #include <AIS_Plane.hxx>
18 #include <Geom_Plane.hxx>
20 #include <Standard_Type.hxx>
21 #include <TDataXtd_Geometry.hxx>
22 #include <TDataXtd_Plane.hxx>
23 #include <TDF_Label.hxx>
24 #include <TNaming_NamedShape.hxx>
25 #include <TNaming_Tool.hxx>
26 #include <TPrsStd_PlaneDriver.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(TPrsStd_PlaneDriver,TPrsStd_Driver)
30 //#include <TDataStd_Datum.hxx>
31 //=======================================================================
34 //=======================================================================
35 TPrsStd_PlaneDriver::TPrsStd_PlaneDriver()
39 //=======================================================================
42 //=======================================================================
43 Standard_Boolean TPrsStd_PlaneDriver::Update (const TDF_Label& aLabel,
44 Handle(AIS_InteractiveObject)& anAISObject)
46 Handle(TDataXtd_Plane) apPlane;
48 if ( !aLabel.FindAttribute(TDataXtd_Plane::GetID(), apPlane) ) {
49 return Standard_False;
53 if (!TDataXtd_Geometry::Plane(aLabel,pln)) {
54 return Standard_False;
56 Handle(Geom_Plane) apt = new Geom_Plane(pln);
59 Handle(AIS_Plane) aisplane;
60 if (anAISObject.IsNull())
61 aisplane = new AIS_Plane(apt,pln.Location());
63 aisplane = Handle(AIS_Plane)::DownCast(anAISObject);
64 if (aisplane.IsNull())
65 aisplane = new AIS_Plane(apt,pln.Location());
67 aisplane->SetComponent(apt);
68 aisplane->SetCenter(pln.Location());
69 aisplane->ResetTransformation();
70 aisplane->SetToUpdate();
71 aisplane->UpdateSelection();
74 anAISObject = aisplane;