b311480e |
1 | // Created on: 1999-07-08 |
2 | // Created by: Sergey RUIN |
3 | // Copyright (c) 1999-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #include <MPrsStd_AISPresentationRetrievalDriver_1.ixx> |
18 | |
19 | #include <PPrsStd_AISPresentation_1.hxx> |
20 | #include <TPrsStd_AISPresentation.hxx> |
21 | #include <AIS_Drawer.hxx> |
22 | #include <TCollection_ExtendedString.hxx> |
23 | #include <PCollection_HExtendedString.hxx> |
24 | #include <Quantity_NameOfColor.hxx> |
25 | #include <Graphic3d_NameOfMaterial.hxx> |
26 | #include <CDM_MessageDriver.hxx> |
27 | |
28 | //======================================================================= |
29 | //function : MPrsStd_AISPresentationRetrievalDriver_1 |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | MPrsStd_AISPresentationRetrievalDriver_1::MPrsStd_AISPresentationRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) |
34 | {} |
35 | |
36 | Standard_Integer MPrsStd_AISPresentationRetrievalDriver_1::VersionNumber() const |
37 | { return 1; } |
38 | |
39 | Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver_1::SourceType() const |
40 | { return STANDARD_TYPE(PPrsStd_AISPresentation_1); } |
41 | |
42 | Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver_1::NewEmpty() const |
43 | { return new TPrsStd_AISPresentation; } |
44 | |
35e08fe8 |
45 | void MPrsStd_AISPresentationRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source, |
46 | const Handle(TDF_Attribute)& Target, |
47 | const Handle(MDF_RRelocationTable)& /*RelocTable*/) const |
7fd59977 |
48 | { |
49 | Handle(PPrsStd_AISPresentation_1) S = Handle(PPrsStd_AISPresentation_1)::DownCast (Source); |
50 | Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target); |
51 | |
52 | T->SetDisplayed( S->IsDisplayed() ); |
53 | |
54 | TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert(); |
55 | Standard_GUID guid( extstr.ToExtString() ); |
56 | |
57 | T->SetDriverGUID( guid ); |
58 | |
59 | if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) ); |
60 | else T->UnsetColor(); |
61 | |
62 | if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) ); |
63 | else T->UnsetMaterial(); |
64 | |
65 | if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() ); |
66 | else T->UnsetTransparency(); |
67 | |
68 | if( S->Width() != -1. ) T->SetWidth( S->Width() ); |
69 | else T->UnsetWidth(); |
70 | |
71 | T->SetMode(S->Mode()); |
72 | |
0797d9d3 |
73 | #ifdef OCCT_DEBUG |
7fd59977 |
74 | cout << "AISPresentationRetrievalDriver " << "retrieved DriverGUID ==> "; |
75 | guid.ShallowDump(cout); |
76 | cout << endl; |
77 | #endif |
78 | } |
79 | |
80 | |