0027241: Create a complete test case to verify reading of all attribute types from...
[occt.git] / src / StdPersistent / StdPersistent_DataXtd_PatternStd.cxx
CommitLineData
ff205346 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
14#include <StdPersistent_DataXtd_PatternStd.hxx>
15
16#include <TNaming_NamedShape.hxx>
17#include <TDataStd_Real.hxx>
18#include <TDataStd_Integer.hxx>
19
20
21//=======================================================================
22//function : Import
23//purpose : Import transient attribuite from the persistent data
24//=======================================================================
25void StdPersistent_DataXtd_PatternStd::Import
26 (const Handle(TDataXtd_PatternStd)& theAttribute) const
27{
45d8465e 28 theAttribute->Signature (mySignature);
29 theAttribute->Axis1Reversed (myAxis1Reversed);
30 theAttribute->Axis2Reversed (myAxis2Reversed);
31
ff205346 32 if (mySignature < 5)
33 {
34 theAttribute->Axis1 (
35 Handle(TNaming_NamedShape)::DownCast (myAxis1->GetAttribute()));
36
37 theAttribute->Value1 (
38 Handle(TDataStd_Real)::DownCast (myValue1->GetAttribute()));
39
40 theAttribute->NbInstances1 (
41 Handle(TDataStd_Integer)::DownCast (myNb1->GetAttribute()));
42
43 if (mySignature > 2)
44 {
45 theAttribute->Axis2 (
46 Handle(TNaming_NamedShape)::DownCast (myAxis2->GetAttribute()));
47
48 theAttribute->Value2 (
49 Handle(TDataStd_Real)::DownCast (myValue2->GetAttribute()));
50
51 theAttribute->NbInstances2 (
52 Handle(TDataStd_Integer)::DownCast (myNb2->GetAttribute()));
53 }
54 }
55 else
56 {
57 theAttribute->Mirror (
58 Handle(TNaming_NamedShape)::DownCast (myMirror->GetAttribute()));
59 }
60}