b311480e |
1 | // Created on: 1997-07-08 |
2 | // Created by: Sergey RUIN |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
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. |
10 | // |
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. |
13 | // |
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. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <MPrsStd_AISPresentationStorageDriver.ixx> |
24 | |
25 | #include <PPrsStd_AISPresentation.hxx> |
26 | #include <PPrsStd_AISPresentation_1.hxx> |
27 | #include <TPrsStd_AISPresentation.hxx> |
28 | #include <AIS_InteractiveObject.hxx> |
29 | #include <AIS_InteractiveContext.hxx> |
30 | #include <AIS_Drawer.hxx> |
31 | #include <V3d_Viewer.hxx> |
32 | #include <TCollection_ExtendedString.hxx> |
33 | #include <PCollection_HExtendedString.hxx> |
34 | #include <CDM_MessageDriver.hxx> |
35 | |
36 | //======================================================================= |
37 | //function : MPrsStd_AISPresentationStorageDriver |
38 | //purpose : |
39 | //======================================================================= |
40 | |
41 | MPrsStd_AISPresentationStorageDriver::MPrsStd_AISPresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
42 | { |
43 | } |
44 | |
45 | Standard_Integer MPrsStd_AISPresentationStorageDriver::VersionNumber() const |
46 | { return 0; } |
47 | |
48 | Handle(Standard_Type) MPrsStd_AISPresentationStorageDriver::SourceType() const |
49 | { return STANDARD_TYPE(TPrsStd_AISPresentation); } |
50 | |
51 | Handle(PDF_Attribute) MPrsStd_AISPresentationStorageDriver::NewEmpty() const |
52 | { |
53 | // return new PPrsStd_AISPresentation; |
54 | return new PPrsStd_AISPresentation_1; |
55 | } |
56 | |
57 | void MPrsStd_AISPresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source, |
58 | const Handle(PDF_Attribute)& Target, |
35e08fe8 |
59 | const Handle(MDF_SRelocationTable)& /*RelocTable*/) const |
7fd59977 |
60 | { |
61 | Handle(TPrsStd_AISPresentation) S = Handle(TPrsStd_AISPresentation)::DownCast (Source); |
62 | |
63 | // Handle(PPrsStd_AISPresentation) T = Handle(PPrsStd_AISPresentation)::DownCast (Target); |
64 | Handle(PPrsStd_AISPresentation_1) T = Handle(PPrsStd_AISPresentation_1)::DownCast (Target); |
65 | |
66 | T->SetDisplayed( S->IsDisplayed() ); |
67 | |
68 | TCollection_ExtendedString extstr("00000000-0000-0000-0000-000000000000"); //covert GUID into ExtendedString |
69 | Standard_PExtCharacter pStr; |
70 | // |
71 | pStr=(Standard_PExtCharacter)extstr.ToExtString(); |
72 | S->GetDriverGUID().ToExtString(pStr); |
73 | |
74 | Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr ); |
75 | T->SetDriverGUID ( guid ); |
76 | |
77 | if( S->HasOwnColor() ) T->SetColor( (Standard_Integer)(S->Color()) ); |
78 | else T->SetColor(-1); |
79 | |
80 | if( S->HasOwnMaterial() ) T->SetMaterial( (Standard_Integer)(S->Material()) ); |
81 | else T->SetMaterial(-1); |
82 | |
83 | if( S->HasOwnTransparency() ) T->SetTransparency( S->Transparency() ); |
84 | else T->SetTransparency(-1.); |
85 | |
86 | if( S->HasOwnWidth() ) T->SetWidth( S->Width() ); |
87 | else T->SetWidth(-1.); |
88 | |
89 | T->SetMode(S->Mode()); |
90 | |
91 | #ifdef DEB |
92 | cout << "AISPresentationStorageDriver " << "storaged DriverGUID ==> " << guid->Convert() << endl; |
93 | #endif |
94 | } |
95 | |
96 | |
97 | |