1 // Created on: 1997-07-08
2 // Created by: Sergey RUIN
3 // Copyright (c) 1997-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_AISPresentationStorageDriver.ixx>
19 #include <PPrsStd_AISPresentation.hxx>
20 #include <PPrsStd_AISPresentation_1.hxx>
21 #include <TPrsStd_AISPresentation.hxx>
22 #include <AIS_InteractiveObject.hxx>
23 #include <AIS_InteractiveContext.hxx>
24 #include <AIS_Drawer.hxx>
25 #include <V3d_Viewer.hxx>
26 #include <TCollection_ExtendedString.hxx>
27 #include <PCollection_HExtendedString.hxx>
28 #include <CDM_MessageDriver.hxx>
30 //=======================================================================
31 //function : MPrsStd_AISPresentationStorageDriver
33 //=======================================================================
35 MPrsStd_AISPresentationStorageDriver::MPrsStd_AISPresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
39 Standard_Integer MPrsStd_AISPresentationStorageDriver::VersionNumber() const
42 Handle(Standard_Type) MPrsStd_AISPresentationStorageDriver::SourceType() const
43 { return STANDARD_TYPE(TPrsStd_AISPresentation); }
45 Handle(PDF_Attribute) MPrsStd_AISPresentationStorageDriver::NewEmpty() const
47 // return new PPrsStd_AISPresentation;
48 return new PPrsStd_AISPresentation_1;
51 void MPrsStd_AISPresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
52 const Handle(PDF_Attribute)& Target,
53 const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
55 Handle(TPrsStd_AISPresentation) S = Handle(TPrsStd_AISPresentation)::DownCast (Source);
57 // Handle(PPrsStd_AISPresentation) T = Handle(PPrsStd_AISPresentation)::DownCast (Target);
58 Handle(PPrsStd_AISPresentation_1) T = Handle(PPrsStd_AISPresentation_1)::DownCast (Target);
60 T->SetDisplayed( S->IsDisplayed() );
62 TCollection_ExtendedString extstr("00000000-0000-0000-0000-000000000000"); //covert GUID into ExtendedString
63 Standard_PExtCharacter pStr;
65 pStr=(Standard_PExtCharacter)extstr.ToExtString();
66 S->GetDriverGUID().ToExtString(pStr);
68 Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr );
69 T->SetDriverGUID ( guid );
71 if( S->HasOwnColor() ) T->SetColor( (Standard_Integer)(S->Color()) );
74 if( S->HasOwnMaterial() ) T->SetMaterial( (Standard_Integer)(S->Material()) );
75 else T->SetMaterial(-1);
77 if( S->HasOwnTransparency() ) T->SetTransparency( S->Transparency() );
78 else T->SetTransparency(-1.);
80 if( S->HasOwnWidth() ) T->SetWidth( S->Width() );
81 else T->SetWidth(-1.);
83 T->SetMode(S->Mode());
86 cout << "AISPresentationStorageDriver " << "storaged DriverGUID ==> " << guid->Convert() << endl;