1 // Created on: 1999-07-08
2 // Created by: Sergey RUIN
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <MPrsStd_AISPresentationRetrievalDriver.ixx>
25 #include <PPrsStd_AISPresentation.hxx>
26 #include <TPrsStd_AISPresentation.hxx>
27 #include <AIS_Drawer.hxx>
28 #include <TCollection_ExtendedString.hxx>
29 #include <PCollection_HExtendedString.hxx>
30 #include <Quantity_NameOfColor.hxx>
31 #include <Graphic3d_NameOfMaterial.hxx>
32 #include <CDM_MessageDriver.hxx>
34 //=======================================================================
35 //function : MPrsStd_AISPresentationRetrievalDriver
37 //=======================================================================
39 MPrsStd_AISPresentationRetrievalDriver::MPrsStd_AISPresentationRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
42 Standard_Integer MPrsStd_AISPresentationRetrievalDriver::VersionNumber() const
45 Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver::SourceType() const
46 { return STANDARD_TYPE(PPrsStd_AISPresentation); }
48 Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver::NewEmpty() const
49 { return new TPrsStd_AISPresentation; }
51 void MPrsStd_AISPresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,const Handle(TDF_Attribute)& Target,const Handle(MDF_RRelocationTable)& RelocTable) const
53 Handle(PPrsStd_AISPresentation) S = Handle(PPrsStd_AISPresentation)::DownCast (Source);
54 Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target);
56 T->SetDisplayed( S->IsDisplayed() );
58 TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();
59 Standard_GUID guid( extstr.ToExtString() );
61 T->SetDriverGUID( guid );
63 if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) );
66 if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) );
67 else T->UnsetMaterial();
69 if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
70 else T->UnsetTransparency();
72 if( S->Width() != -1. ) T->SetWidth( S->Width() );
76 cout << "AISPresentationRetrievalDriver " << "retrieved DriverGUID ==> ";
77 guid.ShallowDump(cout);