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_AxisDriver.ixx>
16 #include <TDF_Label.hxx>
17 #include <TDataXtd_Axis.hxx>
18 #include <TDataXtd_Geometry.hxx>
19 #include <AIS_Axis.hxx>
20 #include <AIS_InteractiveContext.hxx>
21 #include <Geom_Line.hxx>
23 #include <TNaming_Tool.hxx>
24 #include <TNaming_NamedShape.hxx>
25 #include <TopoDS_Shape.hxx>
29 //=======================================================================
32 //=======================================================================
33 TPrsStd_AxisDriver::TPrsStd_AxisDriver()
38 //=======================================================================
41 //=======================================================================
42 Standard_Boolean TPrsStd_AxisDriver::Update (const TDF_Label& aLabel,
43 Handle(AIS_InteractiveObject)& anAISObject)
46 Handle(TDataXtd_Axis) apAxis;
47 if ( !aLabel.FindAttribute(TDataXtd_Axis::GetID(), apAxis) ) {
48 return Standard_False;
52 Handle(TNaming_NamedShape) NS;
53 if(aLabel.FindAttribute(TNaming_NamedShape::GetID(),NS)){
54 if(TNaming_Tool::GetShape(NS).IsNull()){
55 return Standard_False;
59 Handle(AIS_Axis) aistrihed;
60 if (TDataXtd_Geometry::Line(aLabel,lin)) {
61 Handle(Geom_Line) apt = new Geom_Line (lin);
64 if (anAISObject.IsNull())
65 aistrihed = new AIS_Axis(apt);
67 aistrihed = Handle(AIS_Axis)::DownCast(anAISObject);
68 if (aistrihed.IsNull())
69 aistrihed = new AIS_Axis(apt);
71 aistrihed->SetComponent(apt);
72 aistrihed->ResetTransformation();
73 aistrihed->SetToUpdate();
74 aistrihed->UpdateSelection();
77 anAISObject = aistrihed;
80 return Standard_False;