0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[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
7fd59977 15#include <AIS_InteractiveContext.hxx>
42cf5bc1 16#include <AIS_InteractiveObject.hxx>
17#include <AIS_Plane.hxx>
7fd59977 18#include <Geom_Plane.hxx>
19#include <gp_Pln.hxx>
42cf5bc1 20#include <Standard_Type.hxx>
21#include <TDataXtd_Geometry.hxx>
22#include <TDataXtd_Plane.hxx>
23#include <TDF_Label.hxx>
42cf5bc1 24#include <TNaming_Tool.hxx>
25#include <TPrsStd_PlaneDriver.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(TPrsStd_PlaneDriver,TPrsStd_Driver)
28
42cf5bc1 29//#include <TDataStd_Datum.hxx>
7fd59977 30//=======================================================================
31//function :
32//purpose :
33//=======================================================================
34TPrsStd_PlaneDriver::TPrsStd_PlaneDriver()
35{
36}
37
38//=======================================================================
39//function :
40//purpose :
41//=======================================================================
42Standard_Boolean TPrsStd_PlaneDriver::Update (const TDF_Label& aLabel,
43 Handle(AIS_InteractiveObject)& anAISObject)
44{
45 Handle(TDataXtd_Plane) apPlane;
46
47 if ( !aLabel.FindAttribute(TDataXtd_Plane::GetID(), apPlane) ) {
48 return Standard_False;
49 }
50
51 gp_Pln pln;
52 if (!TDataXtd_Geometry::Plane(aLabel,pln)) {
53 return Standard_False;
54 }
55 Handle(Geom_Plane) apt = new Geom_Plane(pln);
56
57 // Update AIS
58 Handle(AIS_Plane) aisplane;
59 if (anAISObject.IsNull())
60 aisplane = new AIS_Plane(apt,pln.Location());
61 else {
62 aisplane = Handle(AIS_Plane)::DownCast(anAISObject);
63 if (aisplane.IsNull())
64 aisplane = new AIS_Plane(apt,pln.Location());
65 else {
66 aisplane->SetComponent(apt);
67 aisplane->SetCenter(pln.Location());
0717ddc1 68 aisplane->ResetTransformation();
7fd59977 69 aisplane->SetToUpdate();
70 aisplane->UpdateSelection();
71 }
72 }
73 anAISObject = aisplane;
74 return Standard_True;
75}
76