7ed7467d |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
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. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
ff205346 |
14 | #include <StdObject_Location.hxx> |
15 | #include <StdPersistent_TopLoc.hxx> |
7ed7467d |
16 | |
ec964372 |
17 | //======================================================================= |
18 | //function : Translate |
19 | //purpose : Creates a persistent wrapper object for a location |
20 | //======================================================================= |
21 | StdObject_Location |
22 | StdObject_Location::Translate (const TopLoc_Location& theLoc, |
23 | StdObjMgt_TransientPersistentMap& theMap) |
24 | { |
25 | StdObject_Location aLoc; |
26 | if (!theLoc.IsIdentity()) |
27 | aLoc.myData = StdPersistent_TopLoc::Translate(theLoc, theMap); |
28 | return aLoc; |
29 | } |
30 | |
31 | //======================================================================= |
32 | //function : Location |
33 | //purpose : Changes current location |
34 | //======================================================================= |
35 | void StdObject_Location::PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const |
36 | { |
37 | theChildren.Append(myData); |
38 | } |
7ed7467d |
39 | |
40 | //======================================================================= |
ff205346 |
41 | //function : Import |
42 | //purpose : Import transient object from the persistent data |
7ed7467d |
43 | //======================================================================= |
ff205346 |
44 | TopLoc_Location StdObject_Location::Import() const |
7ed7467d |
45 | { |
45d8465e |
46 | Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation = |
47 | Handle(StdPersistent_TopLoc::ItemLocation)::DownCast (myData); |
48 | return anItemLocation ? anItemLocation->Import() : TopLoc_Location(); |
7ed7467d |
49 | } |