0026199: Visualization - use NCollection_IndexedMap instead of NCollection_Sequence...
[occt.git] / src / TPrsStd / TPrsStd_PlaneDriver.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#include <TPrsStd_PlaneDriver.ixx>
15
16#include <TDF_Label.hxx>
17#include <TDataXtd_Plane.hxx>
18//#include <TDataStd_Datum.hxx>
19#include <TDataXtd_Geometry.hxx>
20#include <AIS_Plane.hxx>
7fd59977 21#include <AIS_InteractiveContext.hxx>
22#include <TNaming_NamedShape.hxx>
23#include <TNaming_Tool.hxx>
24#include <Geom_Plane.hxx>
25#include <gp_Pln.hxx>
26
27//=======================================================================
28//function :
29//purpose :
30//=======================================================================
31TPrsStd_PlaneDriver::TPrsStd_PlaneDriver()
32{
33}
34
35//=======================================================================
36//function :
37//purpose :
38//=======================================================================
39Standard_Boolean TPrsStd_PlaneDriver::Update (const TDF_Label& aLabel,
40 Handle(AIS_InteractiveObject)& anAISObject)
41{
42 Handle(TDataXtd_Plane) apPlane;
43
44 if ( !aLabel.FindAttribute(TDataXtd_Plane::GetID(), apPlane) ) {
45 return Standard_False;
46 }
47
48 gp_Pln pln;
49 if (!TDataXtd_Geometry::Plane(aLabel,pln)) {
50 return Standard_False;
51 }
52 Handle(Geom_Plane) apt = new Geom_Plane(pln);
53
54 // Update AIS
55 Handle(AIS_Plane) aisplane;
56 if (anAISObject.IsNull())
57 aisplane = new AIS_Plane(apt,pln.Location());
58 else {
59 aisplane = Handle(AIS_Plane)::DownCast(anAISObject);
60 if (aisplane.IsNull())
61 aisplane = new AIS_Plane(apt,pln.Location());
62 else {
63 aisplane->SetComponent(apt);
64 aisplane->SetCenter(pln.Location());
0717ddc1 65 aisplane->ResetTransformation();
7fd59977 66 aisplane->SetToUpdate();
67 aisplane->UpdateSelection();
68 }
69 }
70 anAISObject = aisplane;
71 return Standard_True;
72}
73