1 // Created on: 1999-07-08
2 // Created by: Sergey RUIN
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <MPrsStd_AISPresentationRetrievalDriver.ixx>
19 #include <PPrsStd_AISPresentation.hxx>
20 #include <TPrsStd_AISPresentation.hxx>
21 #include <TCollection_ExtendedString.hxx>
22 #include <PCollection_HExtendedString.hxx>
23 #include <Quantity_NameOfColor.hxx>
24 #include <Graphic3d_NameOfMaterial.hxx>
25 #include <CDM_MessageDriver.hxx>
27 //=======================================================================
28 //function : MPrsStd_AISPresentationRetrievalDriver
30 //=======================================================================
32 MPrsStd_AISPresentationRetrievalDriver::MPrsStd_AISPresentationRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
35 Standard_Integer MPrsStd_AISPresentationRetrievalDriver::VersionNumber() const
38 Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver::SourceType() const
39 { return STANDARD_TYPE(PPrsStd_AISPresentation); }
41 Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver::NewEmpty() const
42 { return new TPrsStd_AISPresentation; }
44 void MPrsStd_AISPresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
45 const Handle(TDF_Attribute)& Target,
46 const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
48 Handle(PPrsStd_AISPresentation) S = Handle(PPrsStd_AISPresentation)::DownCast (Source);
49 Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target);
51 T->SetDisplayed( S->IsDisplayed() );
53 TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();
54 Standard_GUID guid( extstr.ToExtString() );
56 T->SetDriverGUID( guid );
58 if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) );
61 if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) );
62 else T->UnsetMaterial();
64 if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
65 else T->UnsetTransparency();
67 if( S->Width() != -1. ) T->SetWidth( S->Width() );
71 cout << "AISPresentationRetrievalDriver " << "retrieved DriverGUID ==> ";
72 guid.ShallowDump(cout);