0025266: Debug statements in the source are getting flushed on to the console
[occt.git] / src / MPrsStd / MPrsStd_AISPresentationStorageDriver.cxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <MPrsStd_AISPresentationStorageDriver.ixx>
18
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>
29
30 //=======================================================================
31 //function : MPrsStd_AISPresentationStorageDriver
32 //purpose  : 
33 //=======================================================================
34
35 MPrsStd_AISPresentationStorageDriver::MPrsStd_AISPresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
36 {
37 }
38
39 Standard_Integer MPrsStd_AISPresentationStorageDriver::VersionNumber() const
40 { return 0; }
41
42 Handle(Standard_Type) MPrsStd_AISPresentationStorageDriver::SourceType() const
43 { return STANDARD_TYPE(TPrsStd_AISPresentation); }
44
45 Handle(PDF_Attribute) MPrsStd_AISPresentationStorageDriver::NewEmpty() const
46 {
47 // return new PPrsStd_AISPresentation; 
48   return new PPrsStd_AISPresentation_1;
49 }
50
51 void MPrsStd_AISPresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
52                                                  const Handle(PDF_Attribute)& Target,
53                                                  const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
54 {
55   Handle(TPrsStd_AISPresentation) S = Handle(TPrsStd_AISPresentation)::DownCast (Source);
56
57   // Handle(PPrsStd_AISPresentation) T = Handle(PPrsStd_AISPresentation)::DownCast (Target);
58   Handle(PPrsStd_AISPresentation_1) T = Handle(PPrsStd_AISPresentation_1)::DownCast (Target);
59
60   T->SetDisplayed( S->IsDisplayed() );  
61
62   TCollection_ExtendedString  extstr("00000000-0000-0000-0000-000000000000");  //covert GUID into ExtendedString
63   Standard_PExtCharacter pStr;
64   //
65   pStr=(Standard_PExtCharacter)extstr.ToExtString();
66   S->GetDriverGUID().ToExtString(pStr); 
67
68   Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr ); 
69   T->SetDriverGUID ( guid );    
70
71   if( S->HasOwnColor() ) T->SetColor( (Standard_Integer)(S->Color())  );
72   else T->SetColor(-1);
73
74   if( S->HasOwnMaterial() ) T->SetMaterial( (Standard_Integer)(S->Material())  );
75   else T->SetMaterial(-1);
76
77   if( S->HasOwnTransparency() ) T->SetTransparency( S->Transparency() );
78   else T->SetTransparency(-1.);
79
80   if( S->HasOwnWidth() ) T->SetWidth( S->Width() );
81   else T->SetWidth(-1.);  
82
83    T->SetMode(S->Mode());
84
85 #ifdef MPRSSTD_DEB
86   cout << "AISPresentationStorageDriver "  << "storaged DriverGUID ==> "   << guid->Convert() << endl;
87 #endif
88 }
89
90
91