From 063121e205686a5040a786ce8142a2c89cace432 Mon Sep 17 00:00:00 2001 From: azn Date: Thu, 28 May 2015 16:02:31 +0300 Subject: [PATCH] TKCAF has been separated on two parts: - The sources which independent from visualization are remained in this TK. - Visualisation dependencies are moved to the new TK: TKVCAF. - Some dependencies which are connected with persistent objects (from other TK) have been corrected. --- adm/UDLIST | 5 +- src/BinDrivers/BinDrivers.cxx | 2 - src/BinLDrivers/BinLDrivers.cxx | 1 - src/BinMDataXtd/BinMDataXtd.cdl | 4 + src/BinMDataXtd/BinMDataXtd.cxx | 4 + .../BinMDataXtd_PositionDriver.cdl} | 6 +- .../BinMDataXtd_PositionDriver.cxx} | 12 +- .../BinMDataXtd_PresentationDriver.cdl} | 12 +- .../BinMDataXtd_PresentationDriver.cxx | 155 +++ src/BinMPrsStd/BinMPrsStd.cdl | 37 - src/BinMPrsStd/BinMPrsStd.cxx | 32 - .../BinMPrsStd_AISPresentationDriver.cxx | 133 -- src/MDataXtd/MDataXtd.cdl | 9 + src/MDataXtd/MDataXtd.cxx | 10 + .../MDataXtd_PositionRetrievalDriver.cdl} | 9 +- .../MDataXtd_PositionRetrievalDriver.cxx} | 35 +- .../MDataXtd_PositionStorageDriver.cdl} | 4 +- .../MDataXtd_PositionStorageDriver.cxx} | 18 +- .../MDataXtd_PresentationRetrievalDriver.cdl} | 14 +- .../MDataXtd_PresentationRetrievalDriver.cxx} | 52 +- ...DataXtd_PresentationRetrievalDriver_1.cdl} | 11 +- ...DataXtd_PresentationRetrievalDriver_1.cxx} | 60 +- .../MDataXtd_PresentationStorageDriver.cdl} | 11 +- .../MDataXtd_PresentationStorageDriver.cxx | 85 ++ src/MPrsStd/MPrsStd.cdl | 60 - src/MPrsStd/MPrsStd.cxx | 56 - .../MPrsStd_AISPresentationStorageDriver.cxx | 91 -- src/OS/ApplicationFramework.tcl | 1 + src/PDataXtd/PDataXtd.cdl | 6 +- .../PDataXtd_Presentation.cdl} | 6 +- .../PDataXtd_Presentation.cxx} | 46 +- .../PDataXtd_Presentation_1.cdl} | 6 +- .../PDataXtd_Presentation_1.cxx} | 34 +- src/PPrsStd/PPrsStd.cdl | 34 - .../StdDrivers_DocumentRetrievalDriver.cxx | 2 - .../StdDrivers_DocumentStorageDriver.cxx | 2 - src/StdSchema/StdSchema.cdl | 1 - src/TDataXtd/TDataXtd.cdl | 2 + src/TDataXtd/TDataXtd_Presentation.cdl | 162 +++ src/TDataXtd/TDataXtd_Presentation.cxx | 566 ++++++++ src/TKBin/EXTERNLIB | 1 - src/TKBin/PACKAGES | 1 - src/TKCAF/EXTERNLIB | 1 - src/TKCAF/PACKAGES | 1 - src/TKDCAF/EXTERNLIB | 1 + src/TKPCAF/EXTERNLIB | 1 - src/TKPCAF/PACKAGES | 1 - src/TKQADraw/EXTERNLIB | 1 + src/TKVCAF/EXTERNLIB | 13 + src/TKVCAF/FILES | 2 + src/TKVCAF/PACKAGES | 1 + src/TKXCAF/EXTERNLIB | 1 + src/TKXDEDRAW/EXTERNLIB | 1 + src/TKXml/EXTERNLIB | 1 - src/TKXml/PACKAGES | 1 - src/TPrsStd/GUID.txt | 2 +- src/TPrsStd/TPrsStd_AISPresentation.cdl | 244 ++-- src/TPrsStd/TPrsStd_AISPresentation.cxx | 1208 +++++++++-------- src/TPrsStd/TPrsStd_AISViewer.cxx | 16 +- src/XmlDrivers/XmlDrivers.cxx | 2 - src/XmlMDataXtd/XmlMDataXtd.cdl | 4 + src/XmlMDataXtd/XmlMDataXtd.cxx | 20 +- .../XmlMDataXtd_PositionDriver.cdl} | 4 +- .../XmlMDataXtd_PositionDriver.cxx} | 14 +- .../XmlMDataXtd_PresentationDriver.cdl} | 6 +- .../XmlMDataXtd_PresentationDriver.cxx} | 56 +- src/XmlMPrsStd/XmlMPrsStd.cdl | 37 - src/XmlMPrsStd/XmlMPrsStd.cxx | 30 - 68 files changed, 2008 insertions(+), 1459 deletions(-) rename src/{BinMPrsStd/BinMPrsStd_PositionDriver.cdl => BinMDataXtd/BinMDataXtd_PositionDriver.cdl} (89%) rename src/{BinMPrsStd/BinMPrsStd_PositionDriver.cxx => BinMDataXtd/BinMDataXtd_PositionDriver.cxx} (88%) rename src/{BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl => BinMDataXtd/BinMDataXtd_PresentationDriver.cdl} (84%) create mode 100644 src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx delete mode 100644 src/BinMPrsStd/BinMPrsStd.cdl delete mode 100644 src/BinMPrsStd/BinMPrsStd.cxx delete mode 100644 src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx rename src/{MPrsStd/MPrsStd_PositionRetrievalDriver.cdl => MDataXtd/MDataXtd_PositionRetrievalDriver.cdl} (86%) rename src/{MPrsStd/MPrsStd_PositionRetrievalDriver.cxx => MDataXtd/MDataXtd_PositionRetrievalDriver.cxx} (69%) rename src/{MPrsStd/MPrsStd_PositionStorageDriver.cdl => MDataXtd/MDataXtd_PositionStorageDriver.cdl} (92%) rename src/{MPrsStd/MPrsStd_PositionStorageDriver.cxx => MDataXtd/MDataXtd_PositionStorageDriver.cxx} (74%) rename src/{MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl => MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl} (78%) rename src/{MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx => MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx} (57%) rename src/{MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl => MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl} (80%) rename src/{MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx => MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx} (54%) rename src/{MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl => MDataXtd/MDataXtd_PresentationStorageDriver.cdl} (81%) create mode 100644 src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx delete mode 100644 src/MPrsStd/MPrsStd.cdl delete mode 100644 src/MPrsStd/MPrsStd.cxx delete mode 100644 src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx rename src/{PPrsStd/PPrsStd_AISPresentation.cdl => PDataXtd/PDataXtd_Presentation.cdl} (94%) rename src/{PPrsStd/PPrsStd_AISPresentation.cxx => PDataXtd/PDataXtd_Presentation.cxx} (75%) rename src/{PPrsStd/PPrsStd_AISPresentation_1.cdl => PDataXtd/PDataXtd_Presentation_1.cdl} (94%) rename src/{PPrsStd/PPrsStd_AISPresentation_1.cxx => PDataXtd/PDataXtd_Presentation_1.cxx} (78%) delete mode 100644 src/PPrsStd/PPrsStd.cdl create mode 100644 src/TDataXtd/TDataXtd_Presentation.cdl create mode 100644 src/TDataXtd/TDataXtd_Presentation.cxx create mode 100644 src/TKVCAF/EXTERNLIB create mode 100644 src/TKVCAF/FILES create mode 100644 src/TKVCAF/PACKAGES rename src/{XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl => XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl} (92%) rename src/{XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx => XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx} (92%) rename src/{XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl => XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl} (89%) rename src/{XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx => XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx} (79%) delete mode 100644 src/XmlMPrsStd/XmlMPrsStd.cdl delete mode 100644 src/XmlMPrsStd/XmlMPrsStd.cxx diff --git a/adm/UDLIST b/adm/UDLIST index 001c993309..80e94fe0fa 100644 --- a/adm/UDLIST +++ b/adm/UDLIST @@ -248,7 +248,6 @@ p BinMDataXtd p BinMDocStd p BinMFunction p BinMNaming -p BinMPrsStd p BinObjMgt p BinTools p CDF @@ -261,7 +260,6 @@ p MDataXtd p MDocStd p MFunction p MNaming -p MPrsStd p MgtBRep p MgtGeom p MgtGeom2d @@ -287,7 +285,6 @@ p PGeom2d p PMMgt p PNaming p PPoly -p PPrsStd p PShort p PStandard p PTColStd @@ -311,7 +308,6 @@ p XmlMDataXtd p XmlMDocStd p XmlMFunction p XmlMNaming -p XmlMPrsStd p XmlObjMgt r StdResource r XmlOcafResource @@ -328,6 +324,7 @@ t TKCDF t TKLCAF t TKPCAF t TKPLCAF +t TKVCAF t TKPShape t TKShapeSchema t TKStdLSchema diff --git a/src/BinDrivers/BinDrivers.cxx b/src/BinDrivers/BinDrivers.cxx index ed0861c936..e8ef0ec83f 100644 --- a/src/BinDrivers/BinDrivers.cxx +++ b/src/BinDrivers/BinDrivers.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -72,7 +71,6 @@ Handle(BinMDF_ADriverTable) BinDrivers::AttributeDrivers BinMNaming ::AddDrivers (aTable, aMsgDrv); BinMDocStd ::AddDrivers (aTable, aMsgDrv); BinMFunction ::AddDrivers (aTable, aMsgDrv); - BinMPrsStd ::AddDrivers (aTable, aMsgDrv); return aTable; } diff --git a/src/BinLDrivers/BinLDrivers.cxx b/src/BinLDrivers/BinLDrivers.cxx index b93c60913b..9e970fa904 100644 --- a/src/BinLDrivers/BinLDrivers.cxx +++ b/src/BinLDrivers/BinLDrivers.cxx @@ -70,7 +70,6 @@ Handle(BinMDF_ADriverTable) BinLDrivers::AttributeDrivers BinMDocStd ::AddDrivers (aTable, aMsgDrv); // BinMNaming ::AddDrivers (aTable, aMsgDrv); -// BinMPrsStd ::AddDrivers (aTable, aMsgDrv); return aTable; } diff --git a/src/BinMDataXtd/BinMDataXtd.cdl b/src/BinMDataXtd/BinMDataXtd.cdl index f7e87372eb..219e084c2d 100644 --- a/src/BinMDataXtd/BinMDataXtd.cdl +++ b/src/BinMDataXtd/BinMDataXtd.cdl @@ -43,6 +43,10 @@ is class PatternStdDriver; class ShapeDriver; + + class PresentationDriver; + + class PositionDriver; AddDrivers (theDriverTable : ADriverTable from BinMDF; diff --git a/src/BinMDataXtd/BinMDataXtd.cxx b/src/BinMDataXtd/BinMDataXtd.cxx index 545ba817a4..f5b571fce3 100644 --- a/src/BinMDataXtd/BinMDataXtd.cxx +++ b/src/BinMDataXtd/BinMDataXtd.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include static Standard_Integer myDocumentVersion = -1; //======================================================================= @@ -42,6 +44,8 @@ void BinMDataXtd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, theDriverTable->AddDriver (new BinMDataXtd_AxisDriver (theMsgDriver) ); theDriverTable->AddDriver (new BinMDataXtd_PlaneDriver (theMsgDriver) ); theDriverTable->AddDriver (new BinMDataXtd_PlacementDriver (theMsgDriver) ); + theDriverTable->AddDriver (new BinMDataXtd_PresentationDriver(theMsgDriver) ); + theDriverTable->AddDriver (new BinMDataXtd_PositionDriver (theMsgDriver) ); } diff --git a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl similarity index 89% rename from src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl rename to src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl index 8f4aea8693..9067eb8a6d 100644 --- a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl +++ b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl @@ -13,7 +13,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class PositionDriver from BinMPrsStd inherits ADriver from BinMDF +class PositionDriver from BinMDataXtd inherits ADriver from BinMDF ---Purpose: Position Attribute Driver. @@ -26,8 +26,8 @@ uses is -Create (theMessageDriver:MessageDriver from CDM) - returns mutable PositionDriver from BinMPrsStd; + Create (theMessageDriver:MessageDriver from CDM) + returns PositionDriver from BinMDataXtd; NewEmpty (me) returns mutable Attribute from TDF; diff --git a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx similarity index 88% rename from src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx rename to src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx index 792a5cd9e4..bc87cc8539 100644 --- a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx +++ b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx @@ -15,7 +15,7 @@ // modified 13.04.2009 Sergey ZARITCHNY -#include +#include #include #include #include @@ -25,9 +25,9 @@ //purpose : Constructor //======================================================================= -BinMPrsStd_PositionDriver::BinMPrsStd_PositionDriver +BinMDataXtd_PositionDriver::BinMDataXtd_PositionDriver (const Handle(CDM_MessageDriver)& theMsgDriver) - : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name()) +: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name()) { } @@ -36,7 +36,7 @@ BinMPrsStd_PositionDriver::BinMPrsStd_PositionDriver //purpose : //======================================================================= -Handle(TDF_Attribute) BinMPrsStd_PositionDriver::NewEmpty() const +Handle(TDF_Attribute) BinMDataXtd_PositionDriver::NewEmpty() const { return new TDataXtd_Position(); } @@ -46,7 +46,7 @@ Handle(TDF_Attribute) BinMPrsStd_PositionDriver::NewEmpty() const //purpose : persistent -> transient (retrieve) //======================================================================= -Standard_Boolean BinMPrsStd_PositionDriver::Paste +Standard_Boolean BinMDataXtd_PositionDriver::Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& ) const @@ -76,7 +76,7 @@ Standard_Boolean BinMPrsStd_PositionDriver::Paste //purpose : transient -> persistent (store) //======================================================================= -void BinMPrsStd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource, +void BinMDataXtd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& ) const { diff --git a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl similarity index 84% rename from src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl rename to src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl index fda569b00f..2140939f6b 100644 --- a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl +++ b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl @@ -13,9 +13,9 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentationDriver from BinMPrsStd inherits ADriver from BinMDF +class PresentationDriver from BinMDataXtd inherits ADriver from BinMDF - ---Purpose: AISPresentation Attribute Driver. + ---Purpose: Presentation Attribute Driver. uses SRelocationTable from BinObjMgt, @@ -27,18 +27,18 @@ uses is Create (theMessageDriver:MessageDriver from CDM) - returns mutable AISPresentationDriver from BinMPrsStd; + returns PresentationDriver from BinMDataXtd; NewEmpty (me) returns mutable Attribute from TDF; Paste(me; Source : Persistent from BinObjMgt; Target : mutable Attribute from TDF; RelocTable : out RRelocationTable from BinObjMgt) - returns Boolean from Standard; + returns Boolean from Standard; Paste(me; Source : Attribute from TDF; Target : in out Persistent from BinObjMgt; RelocTable : out SRelocationTable from BinObjMgt); - -end AISPresentationDriver; + +end PresentationDriver; diff --git a/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx new file mode 100644 index 0000000000..5332009385 --- /dev/null +++ b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx @@ -0,0 +1,155 @@ +// Created on: 2004-05-17 +// Created by: Sergey ZARITCHNY +// Copyright (c) 2004-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include + +//======================================================================= +//function : BinMDataStd_AISPresentationDriver +//purpose : Constructor +//======================================================================= +BinMDataXtd_PresentationDriver::BinMDataXtd_PresentationDriver + (const Handle(CDM_MessageDriver)& theMsgDriver) +: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(TDataXtd_Presentation)->Name()) +{ +} + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= + +Handle(TDF_Attribute) BinMDataXtd_PresentationDriver::NewEmpty() const +{ + return new TDataXtd_Presentation(); +} + +//======================================================================= +//function : Paste +//purpose : persistent -> transient (retrieve) +//======================================================================= + +Standard_Boolean BinMDataXtd_PresentationDriver::Paste + (const BinObjMgt_Persistent& theSource, + const Handle(TDF_Attribute)& theTarget, + BinObjMgt_RRelocationTable& /*theRT*/) const +{ + Standard_Boolean ok = Standard_False; + Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget); + + // Display status + Standard_Integer aValue; + ok = theSource >> aValue; + if (!ok) return ok; + anAttribute->SetDisplayed(static_cast(aValue)); + + // GUID + Standard_GUID aGUID; + ok = theSource >> aGUID; + if (!ok) return ok; + anAttribute->SetDriverGUID(aGUID); + + // Color + ok = theSource >> aValue; + if (!ok) return ok; + if ( aValue != -1 ) + anAttribute->SetColor(aValue); + else + anAttribute->UnsetColor(); + + // Material + ok = theSource >> aValue; + if ( !ok ) return ok; + if (aValue != -1) + anAttribute->SetMaterial(aValue); + else + anAttribute->UnsetMaterial(); + + // Transparency + Standard_Real aRValue; + ok = theSource >> aRValue; + if ( !ok ) return ok; + if ( aRValue != -1. ) + anAttribute->SetTransparency(aRValue); + else + anAttribute->UnsetTransparency(); + + // Width + ok = theSource >> aRValue; + if ( !ok ) return ok; + if ( aRValue != -1. ) + anAttribute->SetWidth(aRValue); + else + anAttribute->UnsetWidth(); + + // Mode + ok = theSource >> aValue; + if ( !ok ) return ok; + if ( aValue != -1 ) + anAttribute->SetMode(aValue); + else + anAttribute->UnsetMode(); + + return ok; +} + +//======================================================================= +//function : Paste +//purpose : transient -> persistent (store) +//======================================================================= + +void BinMDataXtd_PresentationDriver::Paste(const Handle(TDF_Attribute)& theSource, + BinObjMgt_Persistent& theTarget, + BinObjMgt_SRelocationTable& /*theSRT*/) const +{ + Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theSource); + + // Display status + theTarget.PutBoolean(anAttribute->IsDisplayed()); + + // GUID + theTarget.PutGUID(anAttribute->GetDriverGUID()); + + // Color + if (anAttribute->IsHasOwnColor()) + theTarget.PutInteger(anAttribute->Color()); + else + theTarget.PutInteger(-1); + + // Material + if (anAttribute->IsHasOwnMaterial()) + theTarget.PutInteger(anAttribute->Material()); + else + theTarget.PutInteger(-1); + + // Transparency + if (anAttribute->IsHasOwnTransparency()) + theTarget.PutReal(anAttribute->Transparency()); + else + theTarget.PutReal(-1.); + + // Width + if (anAttribute->IsHasOwnWidth()) + theTarget.PutReal(anAttribute->Width()); + else + theTarget.PutReal(-1.); + + // Mode + if (anAttribute->IsHasOwnMode()) + theTarget.PutInteger(anAttribute->Mode()); + else + theTarget.PutInteger(-1); +} diff --git a/src/BinMPrsStd/BinMPrsStd.cdl b/src/BinMPrsStd/BinMPrsStd.cdl deleted file mode 100644 index 24e5c4339e..0000000000 --- a/src/BinMPrsStd/BinMPrsStd.cdl +++ /dev/null @@ -1,37 +0,0 @@ --- Created on: 2004-05-17 --- Created by: Sergey ZARITCHNY --- Copyright (c) 2004-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -package BinMPrsStd - - ---Purpose: - -uses - BinObjMgt, - TDF, - BinMDF, - CDM -is - ---Purpose: Storage-Retrieval drivers for graphic attributes from - -- TPrsStd - - class AISPresentationDriver; - - class PositionDriver; - - AddDrivers(theDriverTable : ADriverTable from BinMDF; - theMessageDriver : MessageDriver from CDM); - ---Purpose: Adds the attribute storage-retrieval driver to . - -end BinMPrsStd; diff --git a/src/BinMPrsStd/BinMPrsStd.cxx b/src/BinMPrsStd/BinMPrsStd.cxx deleted file mode 100644 index 2f3a3a4a59..0000000000 --- a/src/BinMPrsStd/BinMPrsStd.cxx +++ /dev/null @@ -1,32 +0,0 @@ -// Created on: 2004-05-17 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2004-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include - -//======================================================================= -//function : AddDrivers -//purpose : -//======================================================================= - -void BinMPrsStd::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable, - const Handle(CDM_MessageDriver)& aMessageDriver) -{ - aDriverTable->AddDriver (new BinMPrsStd_AISPresentationDriver(aMessageDriver)); - aDriverTable->AddDriver (new BinMPrsStd_PositionDriver(aMessageDriver)); -} diff --git a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx b/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx deleted file mode 100644 index 687224a68a..0000000000 --- a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx +++ /dev/null @@ -1,133 +0,0 @@ -// Created on: 2004-05-17 -// Created by: Sergey ZARITCHNY -// Copyright (c) 2004-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include -//======================================================================= -//function : BinMDataStd_AISPresentationDriver -//purpose : Constructor -//======================================================================= - -BinMPrsStd_AISPresentationDriver::BinMPrsStd_AISPresentationDriver - (const Handle(CDM_MessageDriver)& theMsgDriver) - : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TPrsStd_AISPresentation)->Name()) -{ -} - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) BinMPrsStd_AISPresentationDriver::NewEmpty() const -{ - return new TPrsStd_AISPresentation(); -} - -//======================================================================= -//function : Paste -//purpose : persistent -> transient (retrieve) -//======================================================================= - -Standard_Boolean BinMPrsStd_AISPresentationDriver::Paste - (const BinObjMgt_Persistent& theSource, - const Handle(TDF_Attribute)& theTarget, - BinObjMgt_RRelocationTable& ) const -{ - Handle(TPrsStd_AISPresentation) anAtt = Handle(TPrsStd_AISPresentation)::DownCast(theTarget); - Standard_Integer aValue; -//Display status - Standard_Boolean ok = theSource >> aValue; - if (!ok) return ok; - anAtt->SetDisplayed((Standard_Boolean)aValue); - -//GUID - Standard_GUID aGUID; - ok = theSource >> aGUID; - if (!ok) return ok; - anAtt->SetDriverGUID(aGUID); - -//Color - ok = theSource >> aValue; - if (!ok) return ok; - if(aValue != -1) anAtt->SetColor( (Quantity_NameOfColor)(aValue) ); - else anAtt->UnsetColor(); - -//Material - ok = theSource >> aValue; - if (!ok) return ok; - if(aValue != -1) anAtt->SetMaterial( (Graphic3d_NameOfMaterial)(aValue) ); - else anAtt->UnsetMaterial(); - -//Transparency - Standard_Real aRValue; - ok = theSource >> aRValue; - if (!ok) return ok; - if(aRValue != -1.) anAtt->SetTransparency(aRValue); - else anAtt->UnsetTransparency(); - -//Width - ok = theSource >> aRValue; - if (!ok) return ok; - if(aRValue != -1.) anAtt->SetWidth( aRValue ); - else anAtt->UnsetWidth(); - -//Mode - ok = theSource >> aValue; - if (!ok) return ok; - if(aValue != -1) anAtt->SetMode(aValue); - else anAtt->UnsetMode(); - - return ok; -} - -//======================================================================= -//function : Paste -//purpose : transient -> persistent (store) -//======================================================================= - -void BinMPrsStd_AISPresentationDriver::Paste (const Handle(TDF_Attribute)& theSource, - BinObjMgt_Persistent& theTarget, - BinObjMgt_SRelocationTable& ) const -{ - Handle(TPrsStd_AISPresentation) anAtt = Handle(TPrsStd_AISPresentation)::DownCast(theSource); -//1 - theTarget.PutBoolean(anAtt->IsDisplayed());//Bool -//2 - theTarget.PutGUID(anAtt->GetDriverGUID());//GUID -//3 - if(anAtt->HasOwnColor()) - theTarget.PutInteger((Standard_Integer)anAtt->Color());//Color - else theTarget.PutInteger(-1); -//4 - if(anAtt->HasOwnMaterial()) - theTarget.PutInteger((Standard_Integer)anAtt->Material()); - else theTarget.PutInteger(-1); -//5 - if(anAtt->HasOwnTransparency()) - theTarget.PutReal(anAtt->Transparency()); //Real - else theTarget.PutReal(-1.); -//6 - if(anAtt->HasOwnWidth()) - theTarget.PutReal(anAtt->Width());// Real - else theTarget.PutReal(-1.); -//7 - if(anAtt->HasOwnMode()) - theTarget.PutInteger(anAtt->Mode()); //Int - else theTarget.PutInteger(-1); -} diff --git a/src/MDataXtd/MDataXtd.cdl b/src/MDataXtd/MDataXtd.cdl index 0b8ba847ee..e179f96fb1 100644 --- a/src/MDataXtd/MDataXtd.cdl +++ b/src/MDataXtd/MDataXtd.cdl @@ -55,6 +55,9 @@ is class PatternStdStorageDriver; + class PresentationStorageDriver; + + class PositionStorageDriver; ---Purpose: Retrieval drivers for PDataXtd attributes @@ -76,6 +79,12 @@ is class PatternStdRetrievalDriver; + class PresentationRetrievalDriver; + + class PresentationRetrievalDriver_1; + + class PositionRetrievalDriver; + AddStorageDrivers(aDriverSeq : ASDriverHSequence from MDF; theMessageDriver : MessageDriver from CDM); diff --git a/src/MDataXtd/MDataXtd.cxx b/src/MDataXtd/MDataXtd.cxx index b42ac20b21..0775b8c0c7 100644 --- a/src/MDataXtd/MDataXtd.cxx +++ b/src/MDataXtd/MDataXtd.cxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include // Retrieval #include @@ -44,6 +46,9 @@ #include #include #include +#include +#include +#include // enums #include @@ -83,6 +88,8 @@ void MDataXtd::AddStorageDrivers aDriverSeq->Append(new MDataXtd_ConstraintStorageDriver(theMsgDriver)); aDriverSeq->Append(new MDataXtd_PlacementStorageDriver(theMsgDriver)); aDriverSeq->Append(new MDataXtd_PatternStdStorageDriver(theMsgDriver)); + aDriverSeq->Append(new MDataXtd_PresentationStorageDriver(theMsgDriver)); + aDriverSeq->Append(new MDataXtd_PositionStorageDriver(theMsgDriver)); } @@ -102,6 +109,9 @@ void MDataXtd::AddRetrievalDrivers aDriverSeq->Append(new MDataXtd_ConstraintRetrievalDriver(theMsgDriver)); aDriverSeq->Append(new MDataXtd_PlacementRetrievalDriver(theMsgDriver)); aDriverSeq->Append(new MDataXtd_PatternStdRetrievalDriver(theMsgDriver)); + aDriverSeq->Append(new MDataXtd_PresentationRetrievalDriver(theMsgDriver)); + aDriverSeq->Append(new MDataXtd_PresentationRetrievalDriver_1(theMsgDriver)); + aDriverSeq->Append(new MDataXtd_PositionRetrievalDriver(theMsgDriver)); } //======================================================================= diff --git a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl similarity index 86% rename from src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl rename to src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl index 6d0b968c48..5c644d6f69 100644 --- a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl +++ b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl @@ -14,8 +14,9 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class PositionRetrievalDriver from MPrsStd inherits ARDriver from MDF - ---Purpose: +class PositionRetrievalDriver from MDataXtd inherits ARDriver from MDF + ---Purpose: Retrieval drivers for graphic attributes from + -- PDataXtd @@ -28,8 +29,8 @@ is Create(theMessageDriver : MessageDriver from CDM) -- Version 0 - returns mutable PositionRetrievalDriver from MPrsStd; - + returns mutable PositionRetrievalDriver from MDataXtd; + VersionNumber(me) returns Integer from Standard; ---Purpose: Returns the version number from which the driver diff --git a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx similarity index 69% rename from src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx rename to src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx index f4fc72d666..339ad4a068 100644 --- a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx +++ b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx @@ -14,50 +14,57 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include //======================================================================= -//function : MPrsStd_PositionRetrievalDriver +//function : MDataXtd_PositionRetrievalDriver //purpose : //======================================================================= -MPrsStd_PositionRetrievalDriver::MPrsStd_PositionRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) +MDataXtd_PositionRetrievalDriver::MDataXtd_PositionRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver) +: MDF_ARDriver(theMsgDriver) {} //======================================================================= //function : VersionNumber //purpose : //======================================================================= -Standard_Integer MPrsStd_PositionRetrievalDriver::VersionNumber() const -{ return 0; } +Standard_Integer MDataXtd_PositionRetrievalDriver::VersionNumber() const +{ + return 0; +} //======================================================================= //function : SourceType //purpose : //======================================================================= -Handle(Standard_Type) MPrsStd_PositionRetrievalDriver::SourceType() const -{ return STANDARD_TYPE(PDataXtd_Position); } +Handle(Standard_Type) MDataXtd_PositionRetrievalDriver::SourceType() const +{ + return STANDARD_TYPE(PDataXtd_Position); +} //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) MPrsStd_PositionRetrievalDriver::NewEmpty() const -{ return new TDataXtd_Position; } +Handle(TDF_Attribute) MDataXtd_PositionRetrievalDriver::NewEmpty() const +{ + return new TDataXtd_Position; +} //======================================================================= //function : Paste //purpose : //======================================================================= -void MPrsStd_PositionRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, - const Handle(TDF_Attribute)& Target, - const Handle(MDF_RRelocationTable)& /*RelocTable*/) const +void MDataXtd_PositionRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, + const Handle(TDF_Attribute)& Target, + const Handle(MDF_RRelocationTable)& /*RelocTable*/) const { - Handle(PDataXtd_Position) S = Handle(PDataXtd_Position)::DownCast (Source); - Handle(TDataXtd_Position) T = Handle(TDataXtd_Position)::DownCast (Target); + Handle(PDataXtd_Position) S = Handle(PDataXtd_Position)::DownCast(Source); + Handle(TDataXtd_Position) T = Handle(TDataXtd_Position)::DownCast(Target); T->SetPosition(S->GetPosition()); } diff --git a/src/MPrsStd/MPrsStd_PositionStorageDriver.cdl b/src/MDataXtd/MDataXtd_PositionStorageDriver.cdl similarity index 92% rename from src/MPrsStd/MPrsStd_PositionStorageDriver.cdl rename to src/MDataXtd/MDataXtd_PositionStorageDriver.cdl index 9491e6a78c..46a195d75f 100644 --- a/src/MPrsStd/MPrsStd_PositionStorageDriver.cdl +++ b/src/MDataXtd/MDataXtd_PositionStorageDriver.cdl @@ -14,7 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class PositionStorageDriver from MPrsStd inherits ASDriver from MDF +class PositionStorageDriver from MDataXtd inherits ASDriver from MDF ---Purpose: @@ -27,7 +27,7 @@ uses SRelocationTable from MDF, is Create(theMessageDriver : MessageDriver from CDM) - returns mutable PositionStorageDriver from MPrsStd; + returns mutable PositionStorageDriver from MDataXtd; VersionNumber(me) returns Integer from Standard; diff --git a/src/MPrsStd/MPrsStd_PositionStorageDriver.cxx b/src/MDataXtd/MDataXtd_PositionStorageDriver.cxx similarity index 74% rename from src/MPrsStd/MPrsStd_PositionStorageDriver.cxx rename to src/MDataXtd/MDataXtd_PositionStorageDriver.cxx index 081223713e..ea6d7a756d 100644 --- a/src/MPrsStd/MPrsStd_PositionStorageDriver.cxx +++ b/src/MDataXtd/MDataXtd_PositionStorageDriver.cxx @@ -14,17 +14,17 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include #include //======================================================================= -//function : MPrsStd_PositionStorageDriver +//function : MDataXtd_PositionStorageDriver //purpose : //======================================================================= -MPrsStd_PositionStorageDriver::MPrsStd_PositionStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) +MDataXtd_PositionStorageDriver::MDataXtd_PositionStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) { } @@ -32,30 +32,30 @@ MPrsStd_PositionStorageDriver::MPrsStd_PositionStorageDriver(const Handle(CDM_Me //function : VersionNumber //purpose : //======================================================================= -Standard_Integer MPrsStd_PositionStorageDriver::VersionNumber() const +Standard_Integer MDataXtd_PositionStorageDriver::VersionNumber() const { return 0; } //======================================================================= //function : SourceType //purpose : //======================================================================= -Handle(Standard_Type) MPrsStd_PositionStorageDriver::SourceType() const +Handle(Standard_Type) MDataXtd_PositionStorageDriver::SourceType() const { return STANDARD_TYPE(TDataXtd_Position); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(PDF_Attribute) MPrsStd_PositionStorageDriver::NewEmpty() const +Handle(PDF_Attribute) MDataXtd_PositionStorageDriver::NewEmpty() const { return new PDataXtd_Position; } //======================================================================= //function : Paste //purpose : //======================================================================= -void MPrsStd_PositionStorageDriver::Paste(const Handle(TDF_Attribute)& Source, - const Handle(PDF_Attribute)& Target, - const Handle(MDF_SRelocationTable)& /*RelocTable*/) const +void MDataXtd_PositionStorageDriver::Paste(const Handle(TDF_Attribute)& Source, + const Handle(PDF_Attribute)& Target, + const Handle(MDF_SRelocationTable)& /*RelocTable*/) const { Handle(TDataXtd_Position) S = Handle(TDataXtd_Position)::DownCast (Source); Handle(PDataXtd_Position) T = Handle(PDataXtd_Position)::DownCast (Target); diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl similarity index 78% rename from src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl rename to src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl index 896d6dafcb..c4b2c316fd 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl +++ b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl @@ -14,9 +14,10 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentationRetrievalDriver from MPrsStd inherits ARDriver from MDF +class PresentationRetrievalDriver from MDataXtd inherits ARDriver from MDF - ---Purpose: + ---Purpose: Retrieval drivers for graphic attributes from + -- MDataXtd uses RRelocationTable from MDF, Attribute from PDF, @@ -25,9 +26,8 @@ uses RRelocationTable from MDF, is - Create(theMessageDriver : MessageDriver from CDM) -- Version 0 - returns mutable AISPresentationRetrievalDriver from MPrsStd; + returns mutable PresentationRetrievalDriver from MDataXtd; VersionNumber(me) returns Integer from Standard; @@ -35,14 +35,14 @@ is -- is available: 0. SourceType(me) returns Type from Standard; - ---Purpose: Returns the type: AISPresentation from PPrsStd. + ---Purpose: Returns the type: Presentation from PDataXtd. NewEmpty (me) returns mutable Attribute from TDF; Paste(me; - Source : Attribute from PDF; + Source : Attribute from PDF; Target : mutable Attribute from TDF; RelocTable : RRelocationTable from MDF); -end AISPresentationRetrievalDriver; +end PresentationRetrievalDriver; diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx similarity index 57% rename from src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx rename to src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx index f897859c28..e1989e3cb5 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx +++ b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx @@ -14,52 +14,59 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include -#include -#include +#include +#include #include #include #include -#include -#include #include //======================================================================= -//function : MPrsStd_AISPresentationRetrievalDriver +//function : MDataXtd_PresentationRetrievalDriver //purpose : //======================================================================= -MPrsStd_AISPresentationRetrievalDriver::MPrsStd_AISPresentationRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) -{} +MDataXtd_PresentationRetrievalDriver::MDataXtd_PresentationRetrievalDriver + (const Handle(CDM_MessageDriver)& theMsgDriver) +: MDF_ARDriver(theMsgDriver) +{ +} -Standard_Integer MPrsStd_AISPresentationRetrievalDriver::VersionNumber() const -{ return 0; } +Standard_Integer MDataXtd_PresentationRetrievalDriver::VersionNumber() const +{ + return 0; +} -Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver::SourceType() const -{ return STANDARD_TYPE(PPrsStd_AISPresentation); } +Handle(Standard_Type) MDataXtd_PresentationRetrievalDriver::SourceType() const +{ + return STANDARD_TYPE(PDataXtd_Presentation); +} -Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver::NewEmpty() const -{ return new TPrsStd_AISPresentation; } +Handle(TDF_Attribute) MDataXtd_PresentationRetrievalDriver::NewEmpty() const +{ + return new TDataXtd_Presentation; +} -void MPrsStd_AISPresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, +void MDataXtd_PresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, const Handle(TDF_Attribute)& Target, const Handle(MDF_RRelocationTable)& /*RelocTable*/) const { - Handle(PPrsStd_AISPresentation) S = Handle(PPrsStd_AISPresentation)::DownCast (Source); - Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target); + Handle(PDataXtd_Presentation) S = Handle(PDataXtd_Presentation)::DownCast (Source); + Handle(TDataXtd_Presentation) T = Handle(TDataXtd_Presentation)::DownCast (Target); - T->SetDisplayed( S->IsDisplayed() ); + T->SetDisplayed( S->IsDisplayed() ); - TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert(); - Standard_GUID guid( extstr.ToExtString() ); + TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert(); + Standard_GUID guid( extstr.ToExtString() ); T->SetDriverGUID( guid ); - if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) ); + if( S->Color() != -1 ) T->SetColor( S->Color() ); else T->UnsetColor(); - if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) ); + if( S->Material() != -1 ) T->SetMaterial( S->Material() ); else T->UnsetMaterial(); if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() ); @@ -74,4 +81,3 @@ void MPrsStd_AISPresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& cout << endl; #endif } - diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl similarity index 80% rename from src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl rename to src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl index c12f49cbed..3f0311f419 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl +++ b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl @@ -14,9 +14,10 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentationRetrievalDriver_1 from MPrsStd inherits ARDriver from MDF +class PresentationRetrievalDriver_1 from MDataXtd inherits ARDriver from MDF - ---Purpose: + ---Purpose: Retrieval drivers for graphic attributes from + -- PDataXtd uses RRelocationTable from MDF, Attribute from PDF, @@ -27,7 +28,7 @@ is Create (theMessageDriver : MessageDriver from CDM) -- Version 1 - returns mutable AISPresentationRetrievalDriver_1 from MPrsStd; + returns mutable PresentationRetrievalDriver_1 from MDataXtd; VersionNumber(me) returns Integer from Standard; @@ -35,7 +36,7 @@ is -- is available: 1. SourceType(me) returns Type from Standard; - ---Purpose: Returns the type: AISPresentation from PPrsStd. + ---Purpose: Returns the type: Presentation from PDataXtd. NewEmpty (me) returns mutable Attribute from TDF; @@ -46,4 +47,4 @@ is RelocTable : RRelocationTable from MDF); -end AISPresentationRetrievalDriver_1; +end PresentationRetrievalDriver_1; diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx similarity index 54% rename from src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx rename to src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx index 783b4d7b79..0a36cd0cdc 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx +++ b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx @@ -14,67 +14,69 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include -#include -#include +#include +#include #include #include #include -#include -#include #include //======================================================================= -//function : MPrsStd_AISPresentationRetrievalDriver_1 +//function : MDataXtd_PresentationRetrievalDriver_1 //purpose : //======================================================================= - -MPrsStd_AISPresentationRetrievalDriver_1::MPrsStd_AISPresentationRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) +MDataXtd_PresentationRetrievalDriver_1::MDataXtd_PresentationRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver) +:MDF_ARDriver(theMsgDriver) {} -Standard_Integer MPrsStd_AISPresentationRetrievalDriver_1::VersionNumber() const -{ return 1; } +Standard_Integer MDataXtd_PresentationRetrievalDriver_1::VersionNumber() const +{ + return 1; +} -Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver_1::SourceType() const -{ return STANDARD_TYPE(PPrsStd_AISPresentation_1); } +Handle(Standard_Type) MDataXtd_PresentationRetrievalDriver_1::SourceType() const +{ + return STANDARD_TYPE(PDataXtd_Presentation_1); +} -Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver_1::NewEmpty() const -{ return new TPrsStd_AISPresentation; } +Handle(TDF_Attribute) MDataXtd_PresentationRetrievalDriver_1::NewEmpty() const +{ + return new TDataXtd_Presentation; +} -void MPrsStd_AISPresentationRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source, +void MDataXtd_PresentationRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source, const Handle(TDF_Attribute)& Target, const Handle(MDF_RRelocationTable)& /*RelocTable*/) const { - Handle(PPrsStd_AISPresentation_1) S = Handle(PPrsStd_AISPresentation_1)::DownCast (Source); - Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target); + Handle(PDataXtd_Presentation_1) S = Handle(PDataXtd_Presentation_1)::DownCast (Source); + Handle(TDataXtd_Presentation) T = Handle(TDataXtd_Presentation)::DownCast (Target); + + T->SetDisplayed( S->IsDisplayed() ); - T->SetDisplayed( S->IsDisplayed() ); + TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert(); + Standard_GUID guid( extstr.ToExtString() ); - TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert(); - Standard_GUID guid( extstr.ToExtString() ); - - T->SetDriverGUID( guid ); + T->SetDriverGUID( guid ); - if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) ); + if( S->Color() != -1 ) T->SetColor( S->Color() ); else T->UnsetColor(); - if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) ); - else T->UnsetMaterial(); + if( S->Material() != -1 ) T->SetMaterial( S->Material() ); + else T->UnsetMaterial(); if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() ); else T->UnsetTransparency(); if( S->Width() != -1. ) T->SetWidth( S->Width() ); - else T->UnsetWidth(); + else T->UnsetWidth(); T->SetMode(S->Mode()); - + #ifdef DEB cout << "AISPresentationRetrievalDriver " << "retrieved DriverGUID ==> "; guid.ShallowDump(cout); cout << endl; #endif } - - diff --git a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl similarity index 81% rename from src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl rename to src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl index a0e3865fb1..91b30d3038 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl +++ b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl @@ -14,9 +14,10 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentationStorageDriver from MPrsStd inherits ASDriver from MDF +class PresentationStorageDriver from MDataXtd inherits ASDriver from MDF - ---Purpose: + ---Purpose: Storage driver for graphic attributes from + -- TDataXtd uses SRelocationTable from MDF, Attribute from TDF, @@ -27,7 +28,7 @@ uses SRelocationTable from MDF, is Create (theMessageDriver : MessageDriver from CDM) - returns mutable AISPresentationStorageDriver from MPrsStd; + returns mutable PresentationStorageDriver from MDataXtd; VersionNumber(me) returns Integer from Standard; @@ -35,7 +36,7 @@ is -- is available: 0. SourceType(me) returns Type from Standard; - ---Purpose: Returns the type: AISPresentation from TPrsStd. + ---Purpose: Returns the type: Presentation from TDataXtd. NewEmpty (me) returns mutable Attribute from PDF; @@ -46,5 +47,5 @@ is RelocTable : SRelocationTable from MDF); -end AISPresentationStorageDriver; +end PresentationStorageDriver; diff --git a/src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx new file mode 100644 index 0000000000..34cf3c9269 --- /dev/null +++ b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx @@ -0,0 +1,85 @@ +// Created on: 1997-07-08 +// Created by: Sergey RUIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : MDataXtd_PresentationStorageDriver +//purpose : +//======================================================================= + +MDataXtd_PresentationStorageDriver::MDataXtd_PresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver) +: MDF_ASDriver(theMsgDriver) +{ +} + +Standard_Integer MDataXtd_PresentationStorageDriver::VersionNumber() const +{ + return 0; +} + +Handle(Standard_Type) MDataXtd_PresentationStorageDriver::SourceType() const +{ + return STANDARD_TYPE(TDataXtd_Presentation); +} + +Handle(PDF_Attribute) MDataXtd_PresentationStorageDriver::NewEmpty() const +{ + return new PDataXtd_Presentation_1; +} + +void MDataXtd_PresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source, + const Handle(PDF_Attribute)& Target, + const Handle(MDF_SRelocationTable)& /*RelocTable*/) const +{ + Handle(TDataXtd_Presentation) S = Handle(TDataXtd_Presentation)::DownCast(Source); + + Handle(PDataXtd_Presentation_1) T = Handle(PDataXtd_Presentation_1)::DownCast(Target); + + T->SetDisplayed( S->IsDisplayed() ); + + TCollection_ExtendedString extstr("00000000-0000-0000-0000-000000000000"); //covert GUID into ExtendedString + Standard_PExtCharacter pStr = const_cast(extstr.ToExtString()); + S->GetDriverGUID().ToExtString(pStr); + + Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr ); + T->SetDriverGUID ( guid ); + + if( S->IsHasOwnColor() ) T->SetColor( S->Color() ); + else T->SetColor(-1); + + if( S->IsHasOwnMaterial() ) T->SetMaterial( S->Material() ); + else T->SetMaterial(-1); + + if( S->IsHasOwnTransparency() ) T->SetTransparency( S->Transparency() ); + else T->SetTransparency(-1.); + + if( S->IsHasOwnWidth() ) T->SetWidth( S->Width() ); + else T->SetWidth(-1.); + + T->SetMode(S->Mode()); + +#ifdef OCCT_DEBUG + cout << "AISPresentationStorageDriver " << "storaged DriverGUID ==> " << guid->Convert() << endl; +#endif +} diff --git a/src/MPrsStd/MPrsStd.cdl b/src/MPrsStd/MPrsStd.cdl deleted file mode 100644 index 2d15fd7437..0000000000 --- a/src/MPrsStd/MPrsStd.cdl +++ /dev/null @@ -1,60 +0,0 @@ --- Created on: 1997-08-26 --- Created by: SMO --- Copyright (c) 1997-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -package MPrsStd - - ---Purpose: Storage and Retrieval drivers for graphic - -- attributes. Transient attributes are defined in - -- package TPrsStd and persistent one are defined in - -- package PPrsStd - -uses TDF, - PDF, - MDF, - CDM - -is - - ---Purpose: Storage drivers for graphic attributes from - -- TPrsStd - ---Category: StorageDriver - - class AISPresentationStorageDriver; - class PositionStorageDriver; - - ---Purpose: Retrieval drivers for graphic attributes from - -- PPrsStd - ---Category: RetrievalDriver - - - class AISPresentationRetrievalDriver; - class AISPresentationRetrievalDriver_1; - class PositionRetrievalDriver; - - AddStorageDrivers(aDriverTable : ASDriverHSequence from MDF;theMessageDriver : MessageDriver from CDM); - ---Purpose: Adds the attribute storage drivers to . - ---Category: StorageDriversTable - - - AddRetrievalDrivers(aDriverTable : ARDriverHSequence from MDF;theMessageDriver : MessageDriver from CDM); - ---Purpose: Adds the attribute retrieval drivers to . - ---Category: RetrievalDriversTable - - -end MPrsStd; - - - diff --git a/src/MPrsStd/MPrsStd.cxx b/src/MPrsStd/MPrsStd.cxx deleted file mode 100644 index 4fe10b5d4b..0000000000 --- a/src/MPrsStd/MPrsStd.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Created on: 1997-08-26 -// Created by: Guest Design -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -//#include -//#include -#include -#include - -//======================================================================= -//function : AddStorageDriver -//purpose : -//======================================================================= - -void MPrsStd::AddStorageDrivers -(const Handle(MDF_ASDriverHSequence)& aDriverSeq, const Handle(CDM_MessageDriver)& theMsgDriver) -{ - aDriverSeq->Append(new MPrsStd_AISPresentationStorageDriver(theMsgDriver)); -// aDriverSeq->Append(new MPrsStd_AISViewerStorageDriver()); - aDriverSeq->Append(new MPrsStd_PositionStorageDriver(theMsgDriver)); -} - - -//======================================================================= -//function : AddRetrievalDriver -//purpose : -//======================================================================= - -void MPrsStd::AddRetrievalDrivers -(const Handle(MDF_ARDriverHSequence)& aDriverSeq, const Handle(CDM_MessageDriver)& theMsgDriver) -{ - aDriverSeq->Append(new MPrsStd_AISPresentationRetrievalDriver(theMsgDriver)); - aDriverSeq->Append(new MPrsStd_AISPresentationRetrievalDriver_1(theMsgDriver)); -// aDriverSeq->Append(new MPrsStd_AISViewerRetrievalDriver()); - aDriverSeq->Append(new MPrsStd_PositionRetrievalDriver(theMsgDriver)); -} - - diff --git a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx b/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx deleted file mode 100644 index 8ce0e31aa0..0000000000 --- a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx +++ /dev/null @@ -1,91 +0,0 @@ -// Created on: 1997-07-08 -// Created by: Sergey RUIN -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : MPrsStd_AISPresentationStorageDriver -//purpose : -//======================================================================= - -MPrsStd_AISPresentationStorageDriver::MPrsStd_AISPresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) -{ -} - -Standard_Integer MPrsStd_AISPresentationStorageDriver::VersionNumber() const -{ return 0; } - -Handle(Standard_Type) MPrsStd_AISPresentationStorageDriver::SourceType() const -{ return STANDARD_TYPE(TPrsStd_AISPresentation); } - -Handle(PDF_Attribute) MPrsStd_AISPresentationStorageDriver::NewEmpty() const -{ -// return new PPrsStd_AISPresentation; - return new PPrsStd_AISPresentation_1; -} - -void MPrsStd_AISPresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source, - const Handle(PDF_Attribute)& Target, - const Handle(MDF_SRelocationTable)& /*RelocTable*/) const -{ - Handle(TPrsStd_AISPresentation) S = Handle(TPrsStd_AISPresentation)::DownCast (Source); - - // Handle(PPrsStd_AISPresentation) T = Handle(PPrsStd_AISPresentation)::DownCast (Target); - Handle(PPrsStd_AISPresentation_1) T = Handle(PPrsStd_AISPresentation_1)::DownCast (Target); - - T->SetDisplayed( S->IsDisplayed() ); - - TCollection_ExtendedString extstr("00000000-0000-0000-0000-000000000000"); //covert GUID into ExtendedString - Standard_PExtCharacter pStr; - // - pStr=(Standard_PExtCharacter)extstr.ToExtString(); - S->GetDriverGUID().ToExtString(pStr); - - Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr ); - T->SetDriverGUID ( guid ); - - if( S->HasOwnColor() ) T->SetColor( (Standard_Integer)(S->Color()) ); - else T->SetColor(-1); - - if( S->HasOwnMaterial() ) T->SetMaterial( (Standard_Integer)(S->Material()) ); - else T->SetMaterial(-1); - - if( S->HasOwnTransparency() ) T->SetTransparency( S->Transparency() ); - else T->SetTransparency(-1.); - - if( S->HasOwnWidth() ) T->SetWidth( S->Width() ); - else T->SetWidth(-1.); - - T->SetMode(S->Mode()); - -#ifdef DEB - cout << "AISPresentationStorageDriver " << "storaged DriverGUID ==> " << guid->Convert() << endl; -#endif -} - - - diff --git a/src/OS/ApplicationFramework.tcl b/src/OS/ApplicationFramework.tcl index 372d10d0ea..ce58f9fcb9 100644 --- a/src/OS/ApplicationFramework.tcl +++ b/src/OS/ApplicationFramework.tcl @@ -21,6 +21,7 @@ proc ApplicationFramework:toolkits { } { TKCDF \ TKLCAF \ TKCAF \ + TKVCAF \ TKBinL \ TKXmlL \ TKShapeSchema \ diff --git a/src/PDataXtd/PDataXtd.cdl b/src/PDataXtd/PDataXtd.cdl index 0843dd64c4..4298badf6d 100644 --- a/src/PDataXtd/PDataXtd.cdl +++ b/src/PDataXtd/PDataXtd.cdl @@ -58,7 +58,11 @@ is class PatternStd; - class Shape; + class Shape; + + class Presentation; + + class Presentation_1; end PDataXtd; diff --git a/src/PPrsStd/PPrsStd_AISPresentation.cdl b/src/PDataXtd/PDataXtd_Presentation.cdl similarity index 94% rename from src/PPrsStd/PPrsStd_AISPresentation.cdl rename to src/PDataXtd/PDataXtd_Presentation.cdl index 8d2aac1cf6..b42e9d7372 100644 --- a/src/PPrsStd/PPrsStd_AISPresentation.cdl +++ b/src/PDataXtd/PDataXtd_Presentation.cdl @@ -14,7 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentation from PPrsStd +class Presentation from PDataXtd inherits Attribute from PDF ---Purpose: @@ -22,7 +22,7 @@ class AISPresentation from PPrsStd uses HExtendedString from PCollection is - Create returns mutable AISPresentation from PPrsStd; + Create returns mutable Presentation from PDataXtd; IsDisplayed(me) returns Boolean from Standard; SetDisplayed(me : mutable; B : Boolean from Standard); @@ -51,4 +51,4 @@ fields myColor : Integer from Standard; myMaterial : Integer from Standard; myWidth : Real from Standard; -end AISPresentation; +end Presentation; diff --git a/src/PPrsStd/PPrsStd_AISPresentation.cxx b/src/PDataXtd/PDataXtd_Presentation.cxx similarity index 75% rename from src/PPrsStd/PPrsStd_AISPresentation.cxx rename to src/PDataXtd/PDataXtd_Presentation.cxx index 9b6865dd25..ccc9bf8c11 100644 --- a/src/PPrsStd/PPrsStd_AISPresentation.cxx +++ b/src/PDataXtd/PDataXtd_Presentation.cxx @@ -14,20 +14,20 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include //======================================================================= -//function : PPrsStd_AISPresentation +//function : PDataXtd_Presentation //purpose : //======================================================================= -PPrsStd_AISPresentation::PPrsStd_AISPresentation() : - myIsDisplayed(Standard_False), - myTransparency(0.), - myColor(0), - myMaterial(0), - myWidth(0.) +PDataXtd_Presentation::PDataXtd_Presentation() : + myIsDisplayed(Standard_False), + myTransparency(0.), + myColor(0), + myMaterial(0), + myWidth(0.) {} @@ -36,7 +36,7 @@ PPrsStd_AISPresentation::PPrsStd_AISPresentation() : //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetDisplayed (const Standard_Boolean B) +void PDataXtd_Presentation::SetDisplayed (const Standard_Boolean B) { myIsDisplayed = B ; } @@ -46,9 +46,9 @@ void PPrsStd_AISPresentation::SetDisplayed (const Standard_Boolean B) //purpose : //======================================================================= -Standard_Boolean PPrsStd_AISPresentation::IsDisplayed() const +Standard_Boolean PDataXtd_Presentation::IsDisplayed() const { - return myIsDisplayed; + return myIsDisplayed; } @@ -56,7 +56,7 @@ Standard_Boolean PPrsStd_AISPresentation::IsDisplayed() const //function : SetDriverGUID //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetDriverGUID( const Handle(PCollection_HExtendedString)& guid) +void PDataXtd_Presentation::SetDriverGUID( const Handle(PCollection_HExtendedString)& guid) { myDriverGUID = guid; } @@ -65,7 +65,7 @@ void PPrsStd_AISPresentation::SetDriverGUID( const Handle(PCollection_HExtendedS //function : GetDriverGUID //purpose : //======================================================================= -Handle(PCollection_HExtendedString) PPrsStd_AISPresentation::GetDriverGUID( void ) const +Handle(PCollection_HExtendedString) PDataXtd_Presentation::GetDriverGUID( void ) const { return myDriverGUID; } @@ -74,7 +74,7 @@ Handle(PCollection_HExtendedString) PPrsStd_AISPresentation::GetDriverGUID( void //function : Color //purpose : //======================================================================= -Standard_Integer PPrsStd_AISPresentation::Color() const +Standard_Integer PDataXtd_Presentation::Color() const { return myColor; } @@ -83,7 +83,7 @@ Standard_Integer PPrsStd_AISPresentation::Color() const //function : SetColor //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetColor(const Standard_Integer C) +void PDataXtd_Presentation::SetColor(const Standard_Integer C) { myColor = C; } @@ -92,7 +92,7 @@ void PPrsStd_AISPresentation::SetColor(const Standard_Integer C) //function : Transparency //purpose : //======================================================================= -Standard_Real PPrsStd_AISPresentation::Transparency() const +Standard_Real PDataXtd_Presentation::Transparency() const { return myTransparency; } @@ -101,7 +101,7 @@ Standard_Real PPrsStd_AISPresentation::Transparency() const //function : SetTransparency //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetTransparency(const Standard_Real T) +void PDataXtd_Presentation::SetTransparency(const Standard_Real T) { myTransparency = T; } @@ -110,7 +110,7 @@ void PPrsStd_AISPresentation::SetTransparency(const Standard_Real T) //function : Material //purpose : //======================================================================= -Standard_Integer PPrsStd_AISPresentation::Material() const +Standard_Integer PDataXtd_Presentation::Material() const { return myMaterial; } @@ -119,25 +119,25 @@ Standard_Integer PPrsStd_AISPresentation::Material() const //function : SetMaterial //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetMaterial(const Standard_Integer M) +void PDataXtd_Presentation::SetMaterial(const Standard_Integer M) { - myMaterial = M; + myMaterial = M; } //======================================================================= //function : Width //purpose : //======================================================================= -Standard_Real PPrsStd_AISPresentation::Width() const +Standard_Real PDataXtd_Presentation::Width() const { - return myWidth; + return myWidth; } //======================================================================= //function : SetWidth //purpose : //======================================================================= -void PPrsStd_AISPresentation::SetWidth(const Standard_Real W) +void PDataXtd_Presentation::SetWidth(const Standard_Real W) { myWidth = W; } diff --git a/src/PPrsStd/PPrsStd_AISPresentation_1.cdl b/src/PDataXtd/PDataXtd_Presentation_1.cdl similarity index 94% rename from src/PPrsStd/PPrsStd_AISPresentation_1.cdl rename to src/PDataXtd/PDataXtd_Presentation_1.cdl index c8cfbc89b2..dc5dbbae39 100644 --- a/src/PPrsStd/PPrsStd_AISPresentation_1.cdl +++ b/src/PDataXtd/PDataXtd_Presentation_1.cdl @@ -14,7 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentation_1 from PPrsStd +class Presentation_1 from PDataXtd inherits Attribute from PDF ---Purpose: @@ -22,7 +22,7 @@ class AISPresentation_1 from PPrsStd uses HExtendedString from PCollection is - Create returns mutable AISPresentation_1 from PPrsStd; + Create returns mutable Presentation_1 from PDataXtd; IsDisplayed(me) returns Boolean from Standard; SetDisplayed(me : mutable; B : Boolean from Standard); @@ -53,4 +53,4 @@ fields myMaterial : Integer from Standard; myWidth : Real from Standard; myMode : Integer from Standard; -end AISPresentation_1; +end Presentation_1; diff --git a/src/PPrsStd/PPrsStd_AISPresentation_1.cxx b/src/PDataXtd/PDataXtd_Presentation_1.cxx similarity index 78% rename from src/PPrsStd/PPrsStd_AISPresentation_1.cxx rename to src/PDataXtd/PDataXtd_Presentation_1.cxx index 1001cf0d21..61eddfc8b9 100644 --- a/src/PPrsStd/PPrsStd_AISPresentation_1.cxx +++ b/src/PDataXtd/PDataXtd_Presentation_1.cxx @@ -14,15 +14,15 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include //======================================================================= -//function : PPrsStd_AISPresentation +//function : PDataXtd_Presentation_1 //purpose : //======================================================================= -PPrsStd_AISPresentation_1::PPrsStd_AISPresentation_1() : +PDataXtd_Presentation_1::PDataXtd_Presentation_1() : myIsDisplayed(Standard_False), myTransparency(0.), myColor(0), @@ -38,7 +38,7 @@ PPrsStd_AISPresentation_1::PPrsStd_AISPresentation_1() : //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetDisplayed (const Standard_Boolean B) +void PDataXtd_Presentation_1::SetDisplayed (const Standard_Boolean B) { myIsDisplayed = B ; } @@ -48,7 +48,7 @@ void PPrsStd_AISPresentation_1::SetDisplayed (const Standard_Boolean B) //purpose : //======================================================================= -Standard_Boolean PPrsStd_AISPresentation_1::IsDisplayed() const +Standard_Boolean PDataXtd_Presentation_1::IsDisplayed() const { return myIsDisplayed; } @@ -58,7 +58,7 @@ Standard_Boolean PPrsStd_AISPresentation_1::IsDisplayed() const //function : SetDriverGUID //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetDriverGUID( const Handle(PCollection_HExtendedString)& guid) +void PDataXtd_Presentation_1::SetDriverGUID( const Handle(PCollection_HExtendedString)& guid) { myDriverGUID = guid; } @@ -67,7 +67,7 @@ void PPrsStd_AISPresentation_1::SetDriverGUID( const Handle(PCollection_HExtende //function : GetDriverGUID //purpose : //======================================================================= -Handle(PCollection_HExtendedString) PPrsStd_AISPresentation_1::GetDriverGUID( void ) const +Handle(PCollection_HExtendedString) PDataXtd_Presentation_1::GetDriverGUID( void ) const { return myDriverGUID; } @@ -76,7 +76,7 @@ Handle(PCollection_HExtendedString) PPrsStd_AISPresentation_1::GetDriverGUID( vo //function : Color //purpose : //======================================================================= -Standard_Integer PPrsStd_AISPresentation_1::Color() const +Standard_Integer PDataXtd_Presentation_1::Color() const { return myColor; } @@ -85,7 +85,7 @@ Standard_Integer PPrsStd_AISPresentation_1::Color() const //function : SetColor //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetColor(const Standard_Integer C) +void PDataXtd_Presentation_1::SetColor(const Standard_Integer C) { myColor = C; } @@ -94,7 +94,7 @@ void PPrsStd_AISPresentation_1::SetColor(const Standard_Integer C) //function : Transparency //purpose : //======================================================================= -Standard_Real PPrsStd_AISPresentation_1::Transparency() const +Standard_Real PDataXtd_Presentation_1::Transparency() const { return myTransparency; } @@ -103,7 +103,7 @@ Standard_Real PPrsStd_AISPresentation_1::Transparency() const //function : SetTransparency //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetTransparency(const Standard_Real T) +void PDataXtd_Presentation_1::SetTransparency(const Standard_Real T) { myTransparency = T; } @@ -112,7 +112,7 @@ void PPrsStd_AISPresentation_1::SetTransparency(const Standard_Real T) //function : Material //purpose : //======================================================================= -Standard_Integer PPrsStd_AISPresentation_1::Material() const +Standard_Integer PDataXtd_Presentation_1::Material() const { return myMaterial; } @@ -121,7 +121,7 @@ Standard_Integer PPrsStd_AISPresentation_1::Material() const //function : SetMaterial //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetMaterial(const Standard_Integer M) +void PDataXtd_Presentation_1::SetMaterial(const Standard_Integer M) { myMaterial = M; } @@ -130,7 +130,7 @@ void PPrsStd_AISPresentation_1::SetMaterial(const Standard_Integer M) //function : Width //purpose : //======================================================================= -Standard_Real PPrsStd_AISPresentation_1::Width() const +Standard_Real PDataXtd_Presentation_1::Width() const { return myWidth; } @@ -143,7 +143,7 @@ Standard_Real PPrsStd_AISPresentation_1::Width() const //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetWidth(const Standard_Real W) +void PDataXtd_Presentation_1::SetWidth(const Standard_Real W) { myWidth = W; } @@ -155,7 +155,7 @@ void PPrsStd_AISPresentation_1::SetWidth(const Standard_Real W) //purpose : //======================================================================= -Standard_Integer PPrsStd_AISPresentation_1::Mode() const +Standard_Integer PDataXtd_Presentation_1::Mode() const { return myMode; } @@ -166,7 +166,7 @@ Standard_Integer PPrsStd_AISPresentation_1::Mode() const //purpose : //======================================================================= -void PPrsStd_AISPresentation_1::SetMode(const Standard_Integer M) +void PDataXtd_Presentation_1::SetMode(const Standard_Integer M) { myMode = M; } diff --git a/src/PPrsStd/PPrsStd.cdl b/src/PPrsStd/PPrsStd.cdl deleted file mode 100644 index 96b26a7848..0000000000 --- a/src/PPrsStd/PPrsStd.cdl +++ /dev/null @@ -1,34 +0,0 @@ --- Created on: 1997-08-26 --- Created by: SMO --- Copyright (c) 1997-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -package PPrsStd - -uses - - Standard, - Quantity, - PDF, - PCollection, - gp - -is - class AISPresentation; - class AISPresentation_1; - --class Position; now it is in PDataStd - -end PPrsStd; - - diff --git a/src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx b/src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx index 331e725048..2f6c72ead8 100644 --- a/src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx +++ b/src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include //======================================================================= //function : PAppStd_DocumentRetrievalDriver @@ -47,7 +46,6 @@ Handle(MDF_ARDriverTable) StdDrivers_DocumentRetrievalDriver::AttributeDrivers(c MDocStd::AddRetrievalDrivers(HARSeq, theMsgDriver); MFunction::AddRetrievalDrivers(HARSeq, theMsgDriver); MNaming::AddRetrievalDrivers(HARSeq, theMsgDriver); - MPrsStd::AddRetrievalDrivers(HARSeq, theMsgDriver); // aRetrievalTable->SetDrivers(HARSeq); diff --git a/src/StdDrivers/StdDrivers_DocumentStorageDriver.cxx b/src/StdDrivers/StdDrivers_DocumentStorageDriver.cxx index 6511faa1df..62b5a5a84d 100644 --- a/src/StdDrivers/StdDrivers_DocumentStorageDriver.cxx +++ b/src/StdDrivers/StdDrivers_DocumentStorageDriver.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -58,7 +57,6 @@ Handle(MDF_ASDriverTable) StdDrivers_DocumentStorageDriver::AttributeDrivers(con MDocStd::AddStorageDrivers(HASSeq, theMsgDriver); MFunction::AddStorageDrivers(HASSeq, theMsgDriver); MNaming::AddStorageDrivers(HASSeq, theMsgDriver); - MPrsStd::AddStorageDrivers(HASSeq, theMsgDriver); // aStorageTable->SetDrivers(HASSeq); return aStorageTable; diff --git a/src/StdSchema/StdSchema.cdl b/src/StdSchema/StdSchema.cdl index fc780b1af5..e8dab7f0be 100644 --- a/src/StdSchema/StdSchema.cdl +++ b/src/StdSchema/StdSchema.cdl @@ -18,7 +18,6 @@ schema StdSchema is package PDataXtd; package PNaming; - package PPrsStd; end StdSchema; diff --git a/src/TDataXtd/TDataXtd.cdl b/src/TDataXtd/TDataXtd.cdl index ab074e6ae0..da680fdf87 100644 --- a/src/TDataXtd/TDataXtd.cdl +++ b/src/TDataXtd/TDataXtd.cdl @@ -105,6 +105,8 @@ is class Axis; class Plane; + + class Presentation; deferred class Pattern; diff --git a/src/TDataXtd/TDataXtd_Presentation.cdl b/src/TDataXtd/TDataXtd_Presentation.cdl new file mode 100644 index 0000000000..9cee6d28b0 --- /dev/null +++ b/src/TDataXtd/TDataXtd_Presentation.cdl @@ -0,0 +1,162 @@ +-- Created on: 1998-09-30 +-- Created by: Denis PASCAL +-- Copyright (c) 1998-1999 Matra Datavision +-- Copyright (c) 1999-2014 OPEN CASCADE SAS +-- +-- This file is part of Open CASCADE Technology software library. +-- +-- This library is free software; you can redistribute it and/or modify it under +-- the terms of the GNU Lesser General Public License version 2.1 as published +-- by the Free Software Foundation, with special exception defined in the file +-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +-- distribution for complete text of the license and disclaimer of any warranty. +-- +-- Alternatively, this file may be used under the terms of Open CASCADE +-- commercial license or contractual agreement. + +class Presentation from TDataXtd inherits Attribute from TDF + +---Purpose: An attribute to associate an +-- AIS_InteractiveObject to a label in an AIS viewer. +-- This attribute works in collaboration with TPrsStd_AISViewer. +-- Note that all the Set... and Unset... attribute +-- methods as well as the query methods for +-- visualization attributes and the HasOwn... test +-- methods are shortcuts to the respective +-- AIS_InteractiveObject settings. + +uses GUID from Standard, + AttributeIndexedMap from TDF, + DataSet from TDF, + AttributeDelta from TDF, + Label from TDF, + RelocationTable from TDF + +is + + Create returns Presentation from TDataXtd; + ---Purpose: Default constructor. + + Set(myclass; theLabel : Label from TDF; theDriverId : GUID from Standard) + returns Presentation from TDataXtd; + ---Purpose: Creates or retrieves the presentation attribute on + -- the label, and sets the GUID driver. + + Set(myclass; theMaster : Attribute from TDF) returns Presentation from TDataXtd; + ---Purpose: Creates or retrieves the presentation attribute attached to master. + -- The GUID of the driver will be the GUID of master. + -- Master is the attribute you want to display. + + Unset(myclass; theLabel : Label from TDF); + ---Purpose: Delete (if exist) the presentation attribute associated to the input label. + + GetID(myclass) returns GUID from Standard; + ---Purpose: Returns the GUID for TDataXtd_Presentation attributes. + ---C++: return const & + + GetDriverGUID(me) returns GUID from Standard; + + SetDriverGUID(me: mutable ; theGUID : GUID from Standard); + + ID(me)returns GUID from Standard; + ---C++: return const & + + + IsDisplayed(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute is displayed. + + IsHasOwnMaterial(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute already has a material setting. + + IsHasOwnTransparency(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute already has a transparency setting. + + IsHasOwnColor(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute already has a color setting. + + IsHasOwnWidth(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute already has a width setting. + + IsHasOwnMode(me) returns Boolean from Standard; + + IsHasOwnSelectionMode(me) returns Boolean from Standard; + + + SetDisplayed(me : mutable; theIsDisplayed : Boolean from Standard); + + SetMaterial(me : mutable; theName : Integer from Standard); + ---Purpose: Sets the material for this presentation attribute. + + SetTransparency(me : mutable; theValue : Real from Standard = 0.6); + ---Purpose: + -- Sets the transparency value for this presentation attribute. + -- @param theValue - parameter of transparency, this value is 0.6 by default. + + SetColor(me: mutable; theColor : Integer from Standard); + ---Purpose: Sets the color aColor for this presentation attribute. + + SetWidth(me: mutable; theWidth : Real from Standard); + ---Purpose: Sets the width for this presentation attribute. + + SetMode(me: mutable; theMode : Integer from Standard); + + SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard); + + + Material(me) returns Integer from Standard; + ---Purpose: Returns the material setting for this presentation attribute. + + Transparency(me) returns Real from Standard; + + Color(me) returns Integer from Standard; + + Width(me) returns Real from Standard; + + Mode(me) returns Integer from Standard; + + SelectionMode(me) returns Integer from Standard; + + + UnsetMaterial(me : mutable); + ---Purpose: Removes the material setting from this presentation attribute. + + UnsetTransparency(me : mutable); + ---Purpose: Removes the transparency setting from this presentation attribute. + + UnsetColor(me : mutable); + ---Purpose: Removes the color setting from this presentation attribute. + + UnsetWidth(me : mutable); + ---Purpose: Removes the width setting from this presentation attribute. + + UnsetMode(me : mutable); + + UnsetSelectionMode(me : mutable); + + + NewEmpty(me) returns Attribute from TDF; + + Restore(me: mutable; theAttribute : Attribute from TDF); + + Paste(me; theInto : mutable Attribute from TDF; theRT : mutable RelocationTable from TDF); + + BackupCopy(me) returns Attribute from TDF is redefined; + +fields + + myDriverGUID : GUID from Standard; + myColor : Integer from Standard; + myMaterial : Integer from Standard; + myMode : Integer from Standard; + mySelectionMode : Integer from Standard; + myTransparency : Real from Standard; + myWidth : Real from Standard; + myIsDisplayed : Boolean from Standard; + myIsHasOwnColor : Boolean from Standard; + myIsHasOwnMaterial : Boolean from Standard; + myIsHasOwnTransparency : Boolean from Standard; + myIsHasOwnWidth : Boolean from Standard; + myIsHasOwnMode : Boolean from Standard; + myIsHasOwnSelectionMode: Boolean from Standard; + +end Presentation; \ No newline at end of file diff --git a/src/TDataXtd/TDataXtd_Presentation.cxx b/src/TDataXtd/TDataXtd_Presentation.cxx new file mode 100644 index 0000000000..7253935e8b --- /dev/null +++ b/src/TDataXtd/TDataXtd_Presentation.cxx @@ -0,0 +1,566 @@ +// Created on: 2015-04-20 +// Created by: Alexander Zaikin +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : TDataXtd_Presentation +//purpose : Default constructor. +//======================================================================= +TDataXtd_Presentation::TDataXtd_Presentation() +: myDriverGUID ("00000000-0000-0000-0000-000000000000"), + myColor (516), // Quantity_NOC_WHITE + myMaterial (0), // Graphic3d_NOM_BRASS + myMode (0), + mySelectionMode (0), + myTransparency (0.0), + myWidth (0.0), + myIsDisplayed (Standard_False), + myIsHasOwnColor (Standard_False), + myIsHasOwnMaterial (Standard_False), + myIsHasOwnTransparency (Standard_False), + myIsHasOwnWidth (Standard_False), + myIsHasOwnMode (Standard_False), + myIsHasOwnSelectionMode(Standard_False) +{} + + +//======================================================================= +//function : Set +//purpose : +//======================================================================= +Handle(TDataXtd_Presentation) TDataXtd_Presentation::Set(const TDF_Label& theLabel, + const Standard_GUID& theDriverId) +{ + Handle(TDataXtd_Presentation) aPresentation; + + if ( !theLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { + aPresentation = new TDataXtd_Presentation(); + theLabel.AddAttribute(aPresentation); + } + + aPresentation->SetDriverGUID(theDriverId); + return aPresentation; +} + + +//======================================================================= +//function : Set +//purpose : +//======================================================================= +Handle(TDataXtd_Presentation) TDataXtd_Presentation::Set(const Handle(TDF_Attribute)& theMaster) +{ + Handle(TDataXtd_Presentation) aPresentation; + + const TDF_Label aLabel = theMaster->Label(); + if (!aLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation)) + { + aPresentation = new TDataXtd_Presentation(); + aLabel.AddAttribute(aPresentation); + } + + aPresentation->SetDriverGUID( theMaster->ID() ); + return aPresentation; +} + + +//======================================================================= +//function : Unset +//purpose : +//======================================================================= +void TDataXtd_Presentation::Unset(const TDF_Label& theLabel) +{ + Handle(TDataXtd_Presentation) aPresentation; + if (theLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation)) + theLabel.ForgetAttribute(aPresentation); +} + + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& TDataXtd_Presentation::GetID() +{ + static Standard_GUID TDataXtd_PresentationID("04fb4d00-5690-11d1-8940-080009dc3333"); + return TDataXtd_PresentationID; +} + + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const Standard_GUID& TDataXtd_Presentation::ID() const +{ + return GetID(); +} + + +//======================================================================= +//function :GetDriverGUID +//purpose : +//======================================================================= +Standard_GUID TDataXtd_Presentation::GetDriverGUID() const +{ + return myDriverGUID; +} + + +//======================================================================= +//function :SetDriverGUID +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetDriverGUID(const Standard_GUID& theGUID) +{ + if ( myDriverGUID != theGUID ) + { + Backup(); + myDriverGUID = theGUID; + } +} + + +//======================================================================= +//function : IsDisplayed +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsDisplayed() const +{ + return myIsDisplayed; +} + + +//======================================================================= +//function : IsHasOwnMaterial +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnMaterial() const +{ + return myIsHasOwnMaterial; +} + + +//======================================================================= +//function : IsHasOwnTransparency +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnTransparency() const +{ + return myIsHasOwnTransparency; +} + + +//======================================================================= +//function : IsHasOwnColor +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnColor() const +{ + return myIsHasOwnColor; +} + + +//======================================================================= +//function : IsHasOwnWidth +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnWidth() const +{ + return myIsHasOwnWidth; +} + + +//======================================================================= +//function : IsHasOwnMode +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnMode() const +{ + return myIsHasOwnMode; +} + + +//======================================================================= +//function : IsHasOwnSelectionMode +//purpose : +//======================================================================= +Standard_Boolean TDataXtd_Presentation::IsHasOwnSelectionMode() const +{ + return myIsHasOwnSelectionMode; +} + + +//======================================================================= +//function : SetDisplayed +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetDisplayed(const Standard_Boolean theIsDisplayed) +{ + Backup(); + myIsDisplayed = theIsDisplayed; +} + + +//======================================================================= +//function : SetMaterial +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetMaterial(const Standard_Integer theName) +{ + Backup(); + myMaterial = theName; + myIsHasOwnMaterial = Standard_True; +} + + +//======================================================================= +//function : SetTransparency +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetTransparency(const Standard_Real theValue) +{ + Backup(); + myTransparency = theValue; + myIsHasOwnTransparency = Standard_True; +} + + +//======================================================================= +//function : SetColor +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetColor(const Standard_Integer theColor) +{ + Backup(); + myColor = theColor; + myIsHasOwnColor = Standard_True; +} + + +//======================================================================= +//function : SetWidth +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetWidth(const Standard_Real theWidth) +{ + Backup(); + myWidth = theWidth; + myIsHasOwnWidth = Standard_True; +} + + +//======================================================================= +//function : SetMode +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetMode(const Standard_Integer theMode) +{ + Backup(); + myMode = theMode; + myIsHasOwnMode = Standard_True; +} + + +//======================================================================= +//function : SetSelectionMode +//purpose : +//======================================================================= +void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode) +{ + Backup(); + myIsHasOwnSelectionMode = Standard_True; + mySelectionMode = theSelectionMode; +} + + +//======================================================================= +//function : Material +//purpose : +//======================================================================= +Standard_Integer TDataXtd_Presentation::Material() const +{ + return myMaterial; +} + + +//======================================================================= +//function : Transparency +//purpose : +//======================================================================= +Standard_Real TDataXtd_Presentation::Transparency() const +{ + return myTransparency; +} + + +//======================================================================= +//function : Color +//purpose : +//======================================================================= +Standard_Integer TDataXtd_Presentation::Color() const +{ + return myColor; +} + + +//======================================================================= +//function : Width +//purpose : +//======================================================================= +Standard_Real TDataXtd_Presentation::Width() const +{ + return myWidth; +} + + +//======================================================================= +//function : Mode +//purpose : +//======================================================================= +Standard_Integer TDataXtd_Presentation::Mode() const +{ + return myMode; +} + + +//======================================================================= +//function : SelectionMode +//purpose : +//======================================================================= +Standard_Integer TDataXtd_Presentation::SelectionMode() const +{ + return mySelectionMode; +} + + +//======================================================================= +//function : UnsetMaterial +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetMaterial() +{ + Backup(); + myIsHasOwnMaterial = Standard_False; +} + + +//======================================================================= +//function : UnsetTransparency +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetTransparency() +{ + myIsHasOwnTransparency = Standard_False; +} + + +//======================================================================= +//function : UnsetColor +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetColor() +{ + Backup(); + myIsHasOwnColor = Standard_False; +} + + +//======================================================================= +//function : UnsetWidth +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetWidth() +{ + Backup(); + myIsHasOwnWidth = Standard_False; +} + + +//======================================================================= +//function : UnsetMode +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetMode() +{ + Backup(); + myIsHasOwnMode = Standard_False; +} + + +//======================================================================= +//function : UnsetSelectionMode +//purpose : +//======================================================================= +void TDataXtd_Presentation::UnsetSelectionMode() +{ + Backup(); + myIsHasOwnSelectionMode = Standard_False; +} + + +//======================================================================= +//function : BackupCopy +//purpose : +//======================================================================= +Handle(TDF_Attribute) TDataXtd_Presentation::BackupCopy() const +{ + Handle(TDataXtd_Presentation) aCopy = new TDataXtd_Presentation; + + aCopy->myIsDisplayed = myIsDisplayed; + aCopy->myDriverGUID = myDriverGUID; + aCopy->mySelectionMode = mySelectionMode; + aCopy->myTransparency = myTransparency; + aCopy->myColor = myColor; + aCopy->myMode = myMode; + aCopy->myWidth = myWidth; + aCopy->myMaterial = myMaterial; + + aCopy->myIsHasOwnColor = myIsHasOwnColor; + aCopy->myIsHasOwnMaterial = myIsHasOwnMaterial; + aCopy->myIsHasOwnWidth = myIsHasOwnWidth; + aCopy->myIsHasOwnMode = myIsHasOwnMode; + aCopy->myIsHasOwnTransparency = myIsHasOwnTransparency; + aCopy->myIsHasOwnSelectionMode = myIsHasOwnSelectionMode; + + return aCopy; +} + + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +Handle(TDF_Attribute) TDataXtd_Presentation::NewEmpty() const +{ + return new TDataXtd_Presentation(); +} + + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= +void TDataXtd_Presentation::Restore(const Handle(TDF_Attribute)& theAttribute) +{ + Handle(TDataXtd_Presentation) aPresentation = + Handle(TDataXtd_Presentation)::DownCast(theAttribute); + + myIsHasOwnMaterial = aPresentation->IsHasOwnMaterial(); + myMaterial = aPresentation->Material(); + + myIsHasOwnColor = aPresentation->IsHasOwnColor(); + myColor = aPresentation->Color(); + + myIsHasOwnWidth = aPresentation->IsHasOwnWidth(); + myWidth = aPresentation->Width(); + + myIsHasOwnMode = aPresentation->IsHasOwnMode(); + myMode = aPresentation->Mode(); + + myIsHasOwnSelectionMode = aPresentation->IsHasOwnSelectionMode(); + mySelectionMode = aPresentation->SelectionMode(); + + myIsHasOwnTransparency = aPresentation->IsHasOwnTransparency(); + myTransparency = aPresentation->Transparency(); + + myIsDisplayed = aPresentation->IsDisplayed(); + myDriverGUID = aPresentation->GetDriverGUID(); +} + + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= +void TDataXtd_Presentation::Paste(const Handle(TDF_Attribute)& theInto, + const Handle(TDF_RelocationTable)&) const +{ + Handle(TDataXtd_Presentation) anInto = + Handle(TDataXtd_Presentation)::DownCast(theInto); + + anInto->Backup(); + + if (myIsHasOwnMaterial) + { + anInto->myMaterial = myMaterial; + anInto->myIsHasOwnMaterial = Standard_True; + } + else + { + anInto->myIsHasOwnMaterial = Standard_False; + } + + if (myIsHasOwnColor) + { + anInto->myColor = myColor; + anInto->myIsHasOwnColor = Standard_True; + } + else + { + anInto->myIsHasOwnColor = Standard_False; + } + + if(myIsHasOwnWidth) + { + anInto->myWidth = myWidth; + anInto->myIsHasOwnWidth = Standard_True; + } + else + { + anInto->myIsHasOwnWidth = Standard_False; + } + + if (myIsHasOwnMode) + { + anInto->myMode = myMode; + anInto->myIsHasOwnMode = Standard_True; + } + else + { + anInto->myIsHasOwnMode = Standard_False; + } + + if (myIsHasOwnSelectionMode) + { + anInto->mySelectionMode = mySelectionMode; + anInto->myIsHasOwnSelectionMode = Standard_True; + } + else + { + anInto->myIsHasOwnSelectionMode = Standard_False; + } + + if (myIsHasOwnTransparency) + { + anInto->myTransparency = myTransparency; + anInto->myIsHasOwnTransparency = Standard_True; + } + else + { + anInto->myIsHasOwnTransparency = Standard_False; + } + + anInto->myIsDisplayed = myIsDisplayed; + anInto->myDriverGUID = myDriverGUID; +} diff --git a/src/TKBin/EXTERNLIB b/src/TKBin/EXTERNLIB index 27b51d73ab..5f24c3518f 100755 --- a/src/TKBin/EXTERNLIB +++ b/src/TKBin/EXTERNLIB @@ -6,5 +6,4 @@ TKG3d TKCAF TKCDF TKLCAF -TKV3d TKBinL diff --git a/src/TKBin/PACKAGES b/src/TKBin/PACKAGES index 75a278132e..3cf1af101c 100755 --- a/src/TKBin/PACKAGES +++ b/src/TKBin/PACKAGES @@ -1,5 +1,4 @@ BinDrivers BinMDataXtd -BinMPrsStd BinMNaming BinTools diff --git a/src/TKCAF/EXTERNLIB b/src/TKCAF/EXTERNLIB index e1cae0b332..d78418f962 100755 --- a/src/TKCAF/EXTERNLIB +++ b/src/TKCAF/EXTERNLIB @@ -8,5 +8,4 @@ TKG2d TKG3d TKCDF TKLCAF -TKV3d TKBO diff --git a/src/TKCAF/PACKAGES b/src/TKCAF/PACKAGES index 241a01ff1e..6c5156383f 100755 --- a/src/TKCAF/PACKAGES +++ b/src/TKCAF/PACKAGES @@ -1,4 +1,3 @@ TDataXtd TNaming -TPrsStd AppStd diff --git a/src/TKDCAF/EXTERNLIB b/src/TKDCAF/EXTERNLIB index f368834083..476e0a6bb5 100755 --- a/src/TKDCAF/EXTERNLIB +++ b/src/TKDCAF/EXTERNLIB @@ -17,4 +17,5 @@ TKPrim TKBool TKBO TKCAF +TKVCAF TKViewerTest diff --git a/src/TKPCAF/EXTERNLIB b/src/TKPCAF/EXTERNLIB index 26e986d08e..f5c94dccf9 100755 --- a/src/TKPCAF/EXTERNLIB +++ b/src/TKPCAF/EXTERNLIB @@ -4,7 +4,6 @@ TKMath TKernel TKCDF TKG2d -TKV3d TKService TKG3d TKPShape diff --git a/src/TKPCAF/PACKAGES b/src/TKPCAF/PACKAGES index 10549ef0b9..27634a3dc9 100755 --- a/src/TKPCAF/PACKAGES +++ b/src/TKPCAF/PACKAGES @@ -1,6 +1,5 @@ PDataXtd PNaming -PPrsStd MDataXtd MPrsStd MNaming diff --git a/src/TKQADraw/EXTERNLIB b/src/TKQADraw/EXTERNLIB index bcc87e134f..22c4fa9d43 100755 --- a/src/TKQADraw/EXTERNLIB +++ b/src/TKQADraw/EXTERNLIB @@ -24,6 +24,7 @@ TKShHealing TKOffset TKFeat TKCAF +TKVCAF TKIGES TKXSBase TKMesh diff --git a/src/TKVCAF/EXTERNLIB b/src/TKVCAF/EXTERNLIB new file mode 100644 index 0000000000..593952685b --- /dev/null +++ b/src/TKVCAF/EXTERNLIB @@ -0,0 +1,13 @@ +TKernel +TKGeomBase +TKBRep +TKTopAlgo +TKMath +TKService +TKG2d +TKG3d +TKCDF +TKLCAF +TKBO +TKCAF +TKV3d diff --git a/src/TKVCAF/FILES b/src/TKVCAF/FILES new file mode 100644 index 0000000000..ca4f0e567b --- /dev/null +++ b/src/TKVCAF/FILES @@ -0,0 +1,2 @@ +EXTERNLIB +PACKAGES diff --git a/src/TKVCAF/PACKAGES b/src/TKVCAF/PACKAGES new file mode 100644 index 0000000000..7acb218afa --- /dev/null +++ b/src/TKVCAF/PACKAGES @@ -0,0 +1 @@ +TPrsStd diff --git a/src/TKXCAF/EXTERNLIB b/src/TKXCAF/EXTERNLIB index a82c32bc9d..b23eb5c108 100755 --- a/src/TKXCAF/EXTERNLIB +++ b/src/TKXCAF/EXTERNLIB @@ -9,3 +9,4 @@ TKCDF TKLCAF TKG3d TKCAF +TKVCAF diff --git a/src/TKXDEDRAW/EXTERNLIB b/src/TKXDEDRAW/EXTERNLIB index 0dcdadc526..6a4ffc5f17 100755 --- a/src/TKXDEDRAW/EXTERNLIB +++ b/src/TKXDEDRAW/EXTERNLIB @@ -10,6 +10,7 @@ TKService TKXSBase TKG2d TKCAF +TKVCAF TKDraw TKTopAlgo TKLCAF diff --git a/src/TKXml/EXTERNLIB b/src/TKXml/EXTERNLIB index 28cccd904f..73dccbb240 100755 --- a/src/TKXml/EXTERNLIB +++ b/src/TKXml/EXTERNLIB @@ -5,7 +5,6 @@ TKMath TKBRep TKG2d TKGeomBase -TKG3d TKLCAF TKCAF TKXmlL diff --git a/src/TKXml/PACKAGES b/src/TKXml/PACKAGES index aa2c6823df..be38b360a3 100755 --- a/src/TKXml/PACKAGES +++ b/src/TKXml/PACKAGES @@ -1,4 +1,3 @@ XmlDrivers XmlMDataXtd XmlMNaming -XmlMPrsStd diff --git a/src/TPrsStd/GUID.txt b/src/TPrsStd/GUID.txt index fb50befa12..bc9b7e7de1 100755 --- a/src/TPrsStd/GUID.txt +++ b/src/TPrsStd/GUID.txt @@ -1,7 +1,7 @@ 00000000-0000-0000-0000-000000000000 Reserved ffffffff-ffff-ffff-ffff-ffffffffffff Reserved -04fb4d00-5690-11d1-8940-080009dc3333 TPrsStd_AISPresentation +3680ac6c-47ae-4366-bb94-26abb6e07341 TPrsStd_AISPresentation 04fb4d01-5690-11d1-8940-080009dc3333 TPrsStd_ColorAttribute 04fb4d02-5690-11d1-8940-080009dc3333 TPrsStd_TransparencyAttribute 04fb4d04-5690-11d1-8940-080009dc3333 TPrsStd_GraphicAttribute diff --git a/src/TPrsStd/TPrsStd_AISPresentation.cdl b/src/TPrsStd/TPrsStd_AISPresentation.cdl index 7895d97344..bf8c0b14d7 100644 --- a/src/TPrsStd/TPrsStd_AISPresentation.cdl +++ b/src/TPrsStd/TPrsStd_AISPresentation.cdl @@ -1,7 +1,7 @@ -- Created on: 1998-09-30 -- Created by: Denis PASCAL -- Copyright (c) 1998-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS +-- Copyright (c) 1999-2015 OPEN CASCADE SAS -- -- This file is part of Open CASCADE Technology software library. -- @@ -14,16 +14,9 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. --- Lastly modified by : --- +---------------------------------------------------------------------------+ --- ! ivan ! SetMode ! 5-04-2001! 3.0-00-1! --- +---------------------------------------------------------------------------+ - - - class AISPresentation from TPrsStd inherits Attribute from TDF - ---Purpose: An attribute to associate an +---Purpose: An attribute to associate an -- AIS_InteractiveObject to a label in an AIS viewer. -- This attribute works in collaboration with TPrsStd_AISViewer. -- Note that all the Set... and Unset... attribute @@ -38,8 +31,9 @@ uses GUID from Standard, AttributeDelta from TDF, Label from TDF, RelocationTable from TDF, + Presentation from TDataXtd, InteractiveObject from AIS, - Length from Quantity, + InteractiveContext from AIS, NameOfColor from Quantity, PlaneAngle from Quantity, NameOfMaterial from Graphic3d, @@ -47,189 +41,185 @@ uses GUID from Standard, is GetID (myclass) returns GUID from Standard; - ---Purpose: Returns the GUID for TPrsStd_AISPresentation attributes. - ---C++: return const & + ---Purpose: Returns the GUID for TPrsStd_AISPresentation attributes. + ---C++: return const & Set (myclass; L : Label from TDF; driver : GUID from Standard) - ---Purpose: Creates or retrieves the presentation attribute on - -- the label L, and sets the GUID driver. + ---Purpose: Creates or retrieves the presentation attribute on + -- the label L, and sets the GUID driver. returns AISPresentation from TPrsStd; - Unset (myclass; L : Label from TDF); + Unset (myclass; theLabel : Label from TDF); ---Purpose: Delete (if exist) the presentation attribute associated to the label . - Set (myclass; master : Attribute from TDF) - ---Purpose: Creates or retrieves the AISPresentation - -- attribute attached to master. - -- The GUID of the driver will be the GUID of master. - -- master is the attribute you want to display. + ---Purpose: Creates or retrieves the AISPresentation + -- attribute attached to master. + -- The GUID of the driver will be the GUID of master. + -- master is the attribute you want to display. returns AISPresentation from TPrsStd; ---Category: Presentation attribute implementation -- ====================================== - + Create returns mutable AISPresentation from TPrsStd; - + SetDisplayed(me : mutable; B : Boolean from Standard); - + Display (me : mutable; update : Boolean from Standard = Standard_False); - ---Purpose: Display presentation of object in AIS viewer. - -- If = True then AISObject is recomputed and all - -- the visualization settings are applied - + ---Purpose: Display presentation of object in AIS viewer. + -- If = True then AISObject is recomputed and all + -- the visualization settings are applied + Erase (me : mutable; remove : Boolean from Standard = Standard_False); - ---Purpose: Removes the presentation of this AIS - -- presentation attribute from the TPrsStd_AISViewer. - -- If remove is true, this AIS presentation attribute - -- is removed from the interactive context. - + ---Purpose: Removes the presentation of this AIS + -- presentation attribute from the TPrsStd_AISViewer. + -- If remove is true, this AIS presentation attribute + -- is removed from the interactive context. + Update (me : mutable); ---Purpose: Recompute presentation of object and apply the visualization settings - - + GetDriverGUID (me) returns GUID from Standard; - + SetDriverGUID (me: mutable ; guid : GUID from Standard); - - IsDisplayed (me) - returns Boolean from Standard; ----Purpose: --- Returns true if this AIS presentation attribute is displayed. - GetAIS (me) returns InteractiveObject from AIS; - ---Purpose: Returns AIS_InteractiveObject stored in the presentation attribute - - AISUpdate (me : mutable) - ---Purpose: Updates AIS_InteractiveObject stored in the attribute - -- and applies the visualization settings - is private; - AISDisplay (me : mutable) - ---Purpose: Displays AIS_InteractiveObject stored in the attribute - is private; + IsDisplayed (me) returns Boolean from Standard; + ---Purpose: Returns true if this AIS presentation attribute is displayed. - AISErase (me : mutable; remove : Boolean from Standard = Standard_False) - ---Purpose: Erases AIS_InteractiveObject stored in the attribute in - -- the viewer; If = True then AISObject is removed - -- from AIS_InteractiveContext instead of simple erasing in the viewer - is private; - ---Category: Visualization settings of AIS_InteractiveObject -- ================================================ - + Material(me) returns NameOfMaterial from Graphic3d; + ---Purpose: + -- Returns the material setting for this presentation attribute. + + SetMaterial(me : mutable; aName : NameOfMaterial from Graphic3d); + ---Purpose: Sets the material aName for this presentation attribute. + + HasOwnMaterial(me) returns Boolean from Standard; + ---Purpose: Returns true if this presentation attribute already has a material setting. ----Purpose: --- Returns the material setting for this presentation attribute. - SetMaterial(me : mutable; aName : NameOfMaterial from Graphic3d); ----Purpose: Sets the material aName for this presentation attribute. - HasOwnMaterial(me) returns Boolean from Standard; ----Purpose: Returns true if this presentation attribute already has a material setting. UnsetMaterial(me : mutable); ----Purpose: Removes the material setting from this presentation attribute. + ---Purpose: Removes the material setting from this presentation attribute. + SetTransparency(me : mutable; aValue : Real from Standard=0.6); ---- Purpose: --- Sets the transparency value aValue for this --- presentation attribute. --- This value is 0.6 by default. + --- Purpose: + -- Sets the transparency value aValue for this presentation attribute. + -- This value is 0.6 by default. + Transparency(me) returns Real from Standard; - + HasOwnTransparency(me) returns Boolean from Standard; ----Purpose: Returns true if this presentation attribute already has a transparency setting. + ---Purpose: Returns true if this presentation attribute already has a transparency setting. + UnsetTransparency(me : mutable); ----Purpose: Removes the transparency setting from this presentation attribute. + ---Purpose: Removes the transparency setting from this presentation attribute. + Color(me) returns NameOfColor from Quantity; - + SetColor(me: mutable; aColor : NameOfColor from Quantity); ----Purpose: Sets the color aColor for this presentation attribute. + ---Purpose: Sets the color aColor for this presentation attribute. + HasOwnColor(me) returns Boolean from Standard; ----Purpose: Returns true if this presentation attribute already has a color setting. - UnsetColor(me : mutable); ----Purpose: Removes the color setting from this presentation attribute. - Width(me) returns Real from Standard ; - + ---Purpose: Returns true if this presentation attribute already has a color setting. + + UnsetColor(me : mutable); + ---Purpose: Removes the color setting from this presentation attribute. + + Width(me) returns Real from Standard; + SetWidth(me: mutable; aWidth : Real from Standard); ----Purpose: Sets the width aWidth for this presentation attribute. + ---Purpose: Sets the width aWidth for this presentation attribute. + HasOwnWidth(me) returns Boolean from Standard; ----Purpose: Returns true if this presentation attribute already has a width setting. - UnsetWidth(me : mutable); ----Purpose: Removes the width setting from this presentation attribute. - Mode(me) returns Integer from Standard; - - SetMode(me: mutable; theMode : Integer from Standard); - + ---Purpose: Returns true if this presentation attribute already has a width setting. + + UnsetWidth(me : mutable); + ---Purpose: Removes the width setting from this presentation attribute. + + Mode(me) returns Integer from Standard; + + SetMode(me: mutable; theMode : Integer from Standard); + HasOwnMode(me) returns Boolean from Standard; - - UnsetMode(me : mutable); + + UnsetMode(me : mutable); SelectionMode(me) returns Integer from Standard; - - SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard); + + SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard); HasOwnSelectionMode(me) returns Boolean from Standard; - + UnsetSelectionMode(me : mutable); - ---Category: Methods of TDF_Attribute -- ======================== - + ID(me)returns GUID from Standard; ---C++: return const & NewEmpty(me) returns mutable Attribute from TDF; - + Restore(me: mutable; with : Attribute from TDF); Paste (me; into : mutable Attribute from TDF; RT : mutable RelocationTable from TDF); BackupCopy(me) returns mutable Attribute from TDF is redefined; - + ---Category: Callbacks for viewer updating -- ============================= - AfterAddition (me: mutable) - is redefined; + AfterAddition (me: mutable) is redefined; - BeforeRemoval (me: mutable) - is redefined; + BeforeRemoval (me: mutable) is redefined; - BeforeForget(me: mutable) - is redefined; + BeforeForget(me: mutable) is redefined; + + AfterResume(me: mutable) is redefined; - AfterResume(me: mutable) - is redefined; - BeforeUndo (me: mutable; anAttDelta : AttributeDelta from TDF; - forceIt : Boolean from Standard = Standard_False) - returns Boolean from Standard - is redefined; - + forceIt : Boolean from Standard = Standard_False) + returns Boolean from Standard is redefined; + AfterUndo (me: mutable; anAttDelta : AttributeDelta from TDF; - forceIt : Boolean from Standard = Standard_False) + forceIt : Boolean from Standard = Standard_False) ---Purpose: update AIS viewer according to delta - returns Boolean from Standard - is redefined; - + returns Boolean from Standard is redefined; + + getAISContext(me) returns InteractiveContext from AIS + ---Purpose: Returns interactive context associated with presentation. + is private; + + getData(me) returns Presentation from TDataXtd + ---Purpose: Returns data presentation attribute connected associated with presentation. + is private; + + GetAIS(me) returns InteractiveObject from AIS; + ---Purpose: Returns AIS_InteractiveObject stored in the presentation attribute. + + AISUpdate (me : mutable) + ---Purpose: Updates AIS_InteractiveObject stored in the attribute + -- and applies the visualization settings + is private; + + AISDisplay (me : mutable) + ---Purpose: Displays AIS_InteractiveObject stored in the attribute + is private; + + AISErase (me : mutable; remove : Boolean from Standard = Standard_False) + ---Purpose: Erases AIS_InteractiveObject stored in the attribute in + -- the viewer; If = True then AISObject is removed + -- from AIS_InteractiveContext instead of simple erasing in the viewer + is private; + fields - myDriverGUID : GUID from Standard; - myTransparency : Real from Standard; - myColor : NameOfColor from Quantity; - myMaterial : NameOfMaterial from Graphic3d; - myWidth : Real from Standard; - myMode : Integer from Standard; - mySelectionMode : Integer from Standard; - isDisplayed : Boolean from Standard; - hasOwnColor : Boolean from Standard; - hasOwnMaterial : Boolean from Standard; - hasOwnTransparency : Boolean from Standard; - hasOwnWidth : Boolean from Standard; - hasOwnMode : Boolean from Standard; - hasOwnSelectionMode: Boolean from Standard; - myAIS : InteractiveObject from AIS; + myDriverGUID : GUID from Standard; + myAIS : InteractiveObject from AIS; end AISPresentation; diff --git a/src/TPrsStd/TPrsStd_AISPresentation.cxx b/src/TPrsStd/TPrsStd_AISPresentation.cxx index e3f3129cce..d57fee5ee4 100644 --- a/src/TPrsStd/TPrsStd_AISPresentation.cxx +++ b/src/TPrsStd/TPrsStd_AISPresentation.cxx @@ -14,10 +14,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -// Lastly modified by : -// +---------------------------------------------------------------------------+ -// ! ivan ! SetMode ! 5-04-2001! 3.0-00-1! -// +---------------------------------------------------------------------------+ #include #include @@ -25,38 +21,42 @@ #include #include #include +#include #include #include #include #include #include - -#define BUC60917 #define BUC61050 -#define OCC1029 -#define OCC1030 -#define OCC1031 -#define OCC1032 -#define OCC1033 -#define OCC1034 +//======================================================================= +//function : TPrsStd_AISPresentation +//purpose : Constructor +//======================================================================= +TPrsStd_AISPresentation::TPrsStd_AISPresentation () +: myDriverGUID("00000000-0000-0000-0000-000000000000") +{ +} + //======================================================================= //function : Set //purpose : //======================================================================= -Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const TDF_Label& L,const Standard_GUID& driver) -{ - - Handle(TPrsStd_AISPresentation) P; +Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set + ( const TDF_Label& theLabel, const Standard_GUID& theDriver ) +{ + Handle(TPrsStd_AISPresentation) aPresentation; - if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { - P = new TPrsStd_AISPresentation (); - L.AddAttribute(P); + if ( !theLabel.FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) ) + { + aPresentation = new TPrsStd_AISPresentation(); + theLabel.AddAttribute(aPresentation); } - P->SetDriverGUID(driver); - return P; + + aPresentation->SetDriverGUID(theDriver); + return aPresentation; } @@ -64,13 +64,12 @@ Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const TDF_Label& L, //function : Unset //purpose : //======================================================================= -void TPrsStd_AISPresentation::Unset (const TDF_Label& L) -{ - Handle(TPrsStd_AISPresentation) P; +void TPrsStd_AISPresentation::Unset (const TDF_Label& theLabel) +{ + Handle(TPrsStd_AISPresentation) aPresentation; - if (L.FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { - L.ForgetAttribute(P); - } + if ( theLabel.FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) ) + theLabel.ForgetAttribute(aPresentation); } @@ -78,71 +77,41 @@ void TPrsStd_AISPresentation::Unset (const TDF_Label& L) //function : Set //purpose : //======================================================================= -Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set (const Handle(TDF_Attribute)& master) -{ - Handle(TPrsStd_AISPresentation) P; - - if (!master->Label().FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { - P = new TPrsStd_AISPresentation (); - master->Label().AddAttribute(P); - } - - P->SetDriverGUID( master->ID() ); +Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const Handle(TDF_Attribute)& theMaster) +{ + Handle(TPrsStd_AISPresentation) aPresentation; + if ( !theMaster->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) ) + { + aPresentation = new TPrsStd_AISPresentation (); + theMaster->Label().AddAttribute(aPresentation); + } - return P; + aPresentation->SetDriverGUID( theMaster->ID() ); + return aPresentation; } - - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& TPrsStd_AISPresentation::GetID() +const Standard_GUID& TPrsStd_AISPresentation::GetID() { - static Standard_GUID TPrsStd_AISPresentationID("04fb4d00-5690-11d1-8940-080009dc3333"); + static Standard_GUID TPrsStd_AISPresentationID("3680ac6c-47ae-4366-bb94-26abb6e07341"); return TPrsStd_AISPresentationID; } -//======================================================================= -//function : TPrsStd_AISPresentation -//purpose : -//======================================================================= -TPrsStd_AISPresentation::TPrsStd_AISPresentation () : -myDriverGUID("00000000-0000-0000-0000-000000000000"), -myTransparency(0.), -myColor(Quantity_NOC_WHITE), -myMaterial(Graphic3d_NOM_BRASS), -myWidth(0.), -#ifdef BUC61050 -myMode(0), -mySelectionMode(0), -#endif -isDisplayed(Standard_False), -hasOwnColor(Standard_False), -hasOwnMaterial(Standard_False), -hasOwnTransparency(Standard_False), -hasOwnWidth(Standard_False) -#ifdef BUC61050 -,hasOwnMode(Standard_False), -hasOwnSelectionMode(Standard_False) -#endif -{} - - //======================================================================= //function : Display //purpose : //======================================================================= -void TPrsStd_AISPresentation::Display (const Standard_Boolean update) +void TPrsStd_AISPresentation::Display(const Standard_Boolean theIsUpdate) { - - if( update || myAIS.IsNull() ) { + if ( theIsUpdate || myAIS.IsNull() ) AISUpdate(); - } - AISDisplay(); + + AISDisplay(); } @@ -150,17 +119,23 @@ void TPrsStd_AISPresentation::Display (const Standard_Boolean update) //function : Erase //purpose : //======================================================================= -void TPrsStd_AISPresentation::Erase (const Standard_Boolean remove) -{ - if( isDisplayed ) AISErase(remove); +void TPrsStd_AISPresentation::Erase(const Standard_Boolean theIsRemove) +{ + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { + if ( aPresentation.IsNull() == Standard_False && aPresentation->IsDisplayed() ) + AISErase(theIsRemove); + } } + //======================================================================= //function : Update //purpose : //======================================================================= -void TPrsStd_AISPresentation::Update () -{ +void TPrsStd_AISPresentation::Update() +{ AISUpdate(); } @@ -169,9 +144,24 @@ void TPrsStd_AISPresentation::Update () //function : IsDisplayed //purpose : //======================================================================= -Standard_Boolean TPrsStd_AISPresentation::IsDisplayed () const +Standard_Boolean TPrsStd_AISPresentation::IsDisplayed() const +{ + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsDisplayed(); + + return Standard_False; +} + + +//======================================================================= +//function : SetDisplayed +//purpose : +//======================================================================= +void TPrsStd_AISPresentation::SetDisplayed(const Standard_Boolean theIsDisplayed) { - return isDisplayed; + Handle(TDataXtd_Presentation) aPresentation = getData(); + return aPresentation->SetDisplayed(theIsDisplayed); } @@ -179,13 +169,13 @@ Standard_Boolean TPrsStd_AISPresentation::IsDisplayed () const //function :SetDriverGUID //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetDriverGUID(const Standard_GUID& guid) +void TPrsStd_AISPresentation::SetDriverGUID(const Standard_GUID& theGUID) { - // OCC2932 correction - if(myDriverGUID == guid) return; + if ( myDriverGUID == theGUID ) + return; - Backup(); - myDriverGUID = guid; + Backup(); + myDriverGUID = theGUID; } @@ -205,210 +195,270 @@ Standard_GUID TPrsStd_AISPresentation::GetDriverGUID() const //======================================================================= Graphic3d_NameOfMaterial TPrsStd_AISPresentation::Material() const { - return myMaterial; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return static_cast( aPresentation->Material() ); + + return Graphic3d_NOM_BRASS; } + //======================================================================= //function :HasMaterial //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnMaterial() const { - return hasOwnMaterial; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnMaterial(); + + return Standard_False; } + //======================================================================= -//function :UnsetMaterial +//function : UnsetMaterial //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetMaterial() { - // OCC2932 correction - if(hasOwnMaterial == Standard_False && !myAIS.IsNull()) { - if(!myAIS->HasMaterial()) - return; - } - - Backup(); - hasOwnMaterial = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() && myAIS->HasMaterial() ) { - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->UnsetMaterial(myAIS, Standard_False); - else + Handle(TDataXtd_Presentation) aPresentation; + if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return; + + if ( !aPresentation->IsHasOwnMaterial() ) + if( !myAIS.IsNull() && !myAIS->HasMaterial() ) + return; + + aPresentation->UnsetMaterial(); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() && myAIS->HasMaterial() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->UnsetMaterial(myAIS, Standard_False); + else myAIS->UnsetMaterial(); } } + //======================================================================= -//function :SetMaterial +//function : SetMaterial //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetMaterial(const Graphic3d_NameOfMaterial aName) +void TPrsStd_AISPresentation::SetMaterial(const Graphic3d_NameOfMaterial theName) { - // OCC2932 correction - if(myMaterial == aName && hasOwnMaterial == Standard_True && !myAIS.IsNull()) { - if(myAIS->HasMaterial() && myAIS->Material() == aName) - return; - } + const Standard_Integer aName = static_cast(theName); - Backup(); - myMaterial = aName; - hasOwnMaterial = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->HasMaterial() && myAIS->Material() == aName ) return; // AIS has already had that material - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->SetMaterial(myAIS, aName, Standard_False); - else - myAIS->SetMaterial(aName); + Handle(TDataXtd_Presentation) aPresentation = getData(); + + if ( aPresentation->IsHasOwnMode() && aPresentation->Material() == aName ) + if ( !myAIS.IsNull() && myAIS->HasMaterial() && myAIS->Material() == theName ) + return; + + aPresentation->SetMaterial(aName); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + if ( myAIS->HasMaterial() && myAIS->Material() == theName ) + return; // AIS has already had that material + + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->SetMaterial(myAIS, theName, Standard_False); + else + myAIS->SetMaterial(theName); } } //======================================================================= -//function :SetTransparency +//function :Transparency //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetTransparency(const Standard_Real aValue) +Standard_Real TPrsStd_AISPresentation::Transparency() const { - // OCC2932 correction - if(hasOwnTransparency == Standard_True && myTransparency == aValue && !myAIS.IsNull()) - if(myAIS->Transparency() == aValue) - return; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->Transparency(); - Backup(); - myTransparency = aValue; - hasOwnTransparency = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->Transparency() == aValue ) return; // AIS has already had that transparency - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->SetTransparency(myAIS, aValue, Standard_False); - else - myAIS->SetTransparency(aValue); - } + return 0.0; } //======================================================================= -//function :Transparency +//function :SetTransparency //purpose : //======================================================================= -Standard_Real TPrsStd_AISPresentation::Transparency() const +void TPrsStd_AISPresentation::SetTransparency(const Standard_Real theValue) { - return myTransparency; + Handle(TDataXtd_Presentation) aPresentation = getData(); + + if( aPresentation->IsHasOwnTransparency() && aPresentation->Transparency() == theValue ) + if ( !myAIS.IsNull() && myAIS->Transparency() == theValue ) + return; + + aPresentation->SetTransparency(theValue); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + if ( myAIS->Transparency() == theValue ) + return; // AIS has already had that transparency + + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->SetTransparency(myAIS, theValue, Standard_False); + else + myAIS->SetTransparency(theValue); + } } + //======================================================================= //function :UnsetTransparency //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetTransparency() { - // OCC2932 correction - if(!hasOwnTransparency) - return; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { + if ( !aPresentation->IsHasOwnTransparency() ) + return; + + aPresentation->UnsetTransparency(); + } + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); - Backup(); - hasOwnTransparency = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->UnsetTransparency(myAIS, Standard_False); - else + if( !aContext.IsNull() ) + aContext->UnsetTransparency(myAIS, Standard_False); + else myAIS->UnsetTransparency(); } } + //======================================================================= -//function :HasTransparency +//function : HasTransparency //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnTransparency() const { - return hasOwnTransparency; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnTransparency(); + + return Standard_False; } + //======================================================================= -//function :Color +//function : Color //purpose : //======================================================================= Quantity_NameOfColor TPrsStd_AISPresentation::Color() const { - return myColor; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return static_cast(aPresentation->Color()); + + return Quantity_NOC_WHITE; } //======================================================================= -//function :HasColor +//function : HasOwnColor //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnColor() const { - return hasOwnColor; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnColor(); + + return Standard_False; } + //======================================================================= -//function :UnsetColor +//function : UnsetColor //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetColor() { - // OCC2932 correction - if(!hasOwnColor && !myAIS.IsNull()) - if(!myAIS->HasColor()) - return; - - Backup(); - hasOwnColor = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() && myAIS->HasColor() ) { - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->UnsetColor(myAIS, Standard_False); - else + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { + if ( aPresentation->IsHasOwnColor() ) + if ( !myAIS.IsNull() && !myAIS->HasColor() ) + return; + + aPresentation->UnsetColor(); + } + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() && myAIS->HasColor() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->UnsetColor(myAIS, Standard_False); + else myAIS->UnsetColor(); } } + //======================================================================= -//function :SetColor +//function : SetColor //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor aColor) +void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor theColor) { - // OCC2932 correction - if(hasOwnColor && myColor == aColor && ! myAIS.IsNull()) - if(myAIS->HasColor() && myAIS->Color() == aColor ) + Handle(TDataXtd_Presentation) aPresentation = getData(); + + const Standard_Integer aColor = static_cast(theColor); + if ( aPresentation->IsHasOwnColor() && aPresentation->Color() == aColor ) + if ( !myAIS.IsNull() && myAIS->HasColor() && myAIS->Color() == theColor ) return; - - Backup(); - myColor = aColor; - hasOwnColor = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->HasColor() && myAIS->Color() == aColor ) return; // AIS has already had that color - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->SetColor(myAIS, aColor, Standard_False); + + aPresentation->SetColor(aColor); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + if ( myAIS->HasColor() && myAIS->Color() == theColor ) + return; // AIS has already had that color + + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if( !aContext.IsNull() ) + aContext->SetColor(myAIS, theColor, Standard_False); else - myAIS->SetColor(aColor); + myAIS->SetColor(theColor); } } @@ -419,211 +469,273 @@ void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor aColor) //======================================================================= Standard_Real TPrsStd_AISPresentation::Width() const { - return myWidth; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->Width(); + + return 0.0; } + //======================================================================= -//function :HasWidth +//function : HasWidth //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnWidth() const { - return hasOwnWidth; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnWidth(); + + return Standard_False; } + //======================================================================= -//function :SetWidth +//function : SetWidth //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetWidth(const Standard_Real aWidth) +void TPrsStd_AISPresentation::SetWidth(const Standard_Real theWidth) { - // OCC2932 correction - if(hasOwnWidth && myWidth == aWidth && myAIS.IsNull()) - if(myAIS->HasWidth() && myAIS->Width() == aWidth ) + Handle(TDataXtd_Presentation) aPresentation = getData(); + + if ( aPresentation->IsHasOwnWidth() && aPresentation->Width() == theWidth ) + if ( !myAIS.IsNull() && myAIS->HasWidth() && myAIS->Width() == theWidth ) return; - Backup(); - myWidth = aWidth; - hasOwnWidth = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->HasWidth() && myAIS->Width() == aWidth ) return; // AIS has already had that width - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->SetWidth(myAIS, aWidth, Standard_False); + aPresentation->SetWidth(theWidth); + + if( !myAIS.IsNull() ) + { + if ( myAIS->HasWidth() && myAIS->Width() == theWidth ) + return; // AIS has already had that width + + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if( !aContext.IsNull() ) + aContext->SetWidth(myAIS, theWidth, Standard_False); else - myAIS->SetWidth(aWidth); + myAIS->SetWidth(theWidth); } } + //======================================================================= -//function :UnsetWidth +//function : UnsetWidth //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetWidth() { - // OCC2932 correction - if(!hasOwnWidth && !myAIS.IsNull()) - if(!myAIS->HasWidth()) + Handle(TDataXtd_Presentation) aPresentation; + if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { + // create new + return; + } + + if ( !aPresentation->IsHasOwnWidth() ) + if ( !myAIS.IsNull() && !myAIS->HasWidth() ) return; - Backup(); - hasOwnWidth = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() && myAIS->HasWidth() ) { - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->UnsetWidth(myAIS, Standard_False); - else + aPresentation->UnsetWidth(); + + if( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() && myAIS->HasWidth() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->UnsetWidth(myAIS, Standard_False); + else myAIS->UnsetWidth(); } } - //======================================================================= //function : Mode //purpose : //======================================================================= - Standard_Integer TPrsStd_AISPresentation::Mode() const { - return myMode; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->Mode(); + + return 0; } + //======================================================================= -//function :HasOwnMode +//function : HasOwnMode //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnMode() const { - return hasOwnMode; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnMode(); + + return Standard_False; } + //======================================================================= -//function :SetMode +//function : SetMode //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetMode(const Standard_Integer theMode) +void TPrsStd_AISPresentation::SetMode(const Standard_Integer theMode) { - // OCC2932 correction - if(hasOwnMode && myMode == theMode && !myAIS.IsNull()) - if(myAIS->DisplayMode() == theMode ) + Handle(TDataXtd_Presentation) aPresentation = getData(); + + if ( aPresentation->IsHasOwnMode() && aPresentation->Mode() == theMode ) + if ( !myAIS.IsNull() && myAIS->DisplayMode() == theMode ) return; - Backup(); - myMode = theMode; - hasOwnMode = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->DisplayMode() == theMode ) return; // AIS has already had that mode - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) - ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->SetDisplayMode(myAIS, theMode, Standard_False); + aPresentation->SetMode(theMode); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + if ( myAIS->DisplayMode() == theMode ) + return; // AIS has already had that mode + + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if( !aContext.IsNull() ) + aContext->SetDisplayMode(myAIS, theMode, Standard_False); else myAIS->SetDisplayMode(theMode); } } + //======================================================================= -//function :UnsetMode +//function : UnsetMode //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetMode() { - // OCC2932 correction - if(HasOwnMode() == Standard_False && myAIS.IsNull() == Standard_False) - if(!myAIS->HasDisplayMode()) + Handle(TDataXtd_Presentation) aPresentation; + if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return; + + if ( !aPresentation->IsHasOwnMode() ) + if ( !myAIS.IsNull() && !myAIS->HasDisplayMode() ) return; - Backup(); - hasOwnMode = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() && myAIS->HasDisplayMode() ) { - Handle(AIS_InteractiveContext) ctx; - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) - ctx = viewer->GetInteractiveContext(); - if( !ctx.IsNull() ) - ctx->UnsetDisplayMode(myAIS, Standard_False); - else - myAIS->UnsetDisplayMode(); + aPresentation->UnsetMode(); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if( !myAIS.IsNull() && myAIS->HasDisplayMode() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); + + if ( !aContext.IsNull() ) + aContext->UnsetDisplayMode(myAIS, Standard_False); + else + myAIS->UnsetDisplayMode(); } } -#ifdef BUC61050 + //======================================================================= //function : SelectionMode //purpose : //======================================================================= - Standard_Integer TPrsStd_AISPresentation::SelectionMode() const { - return mySelectionMode; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->SelectionMode(); + + return 0; } + //======================================================================= -//function :HasOwnSelectionMode +//function : HasOwnSelectionMode //purpose : //======================================================================= Standard_Boolean TPrsStd_AISPresentation::HasOwnSelectionMode() const { - return hasOwnSelectionMode; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + return aPresentation->IsHasOwnSelectionMode(); + + return Standard_False; } +#ifdef BUC61050 //======================================================================= -//function :SetSelectionMode +//function : SetSelectionMode //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode) +void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode) { - // OCC2932 correction - if(hasOwnSelectionMode && mySelectionMode == theSelectionMode && !myAIS.IsNull()) - if(myAIS->SelectionMode() == theSelectionMode ) + Handle(TDataXtd_Presentation) aPresentation = getData(); + + if ( aPresentation->IsHasOwnSelectionMode() && + aPresentation->SelectionMode() == theSelectionMode ) + { + if ( !myAIS.IsNull() && myAIS->SelectionMode() == theSelectionMode ) + return; + } + + aPresentation->SetSelectionMode(theSelectionMode); + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() ) + { + if ( myAIS->SelectionMode() == theSelectionMode ) return; - Backup(); - mySelectionMode = theSelectionMode; - hasOwnSelectionMode = Standard_True; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() ) { - if( myAIS->SelectionMode() == theSelectionMode ) return; myAIS->SetSelectionMode(theSelectionMode); } } + //======================================================================= -//function :UnsetSelectionMode +//function : UnsetSelectionMode //purpose : //======================================================================= void TPrsStd_AISPresentation::UnsetSelectionMode() { - if(!hasOwnSelectionMode && !myAIS.IsNull()) - if(!myAIS->HasSelectionMode()) - return; + Handle(TDataXtd_Presentation) aPresentation; + if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) ) + { - Backup(); - hasOwnSelectionMode = Standard_False; - if( myAIS.IsNull() ) AISUpdate(); - if( !myAIS.IsNull() && myAIS->HasSelectionMode() ) { - myAIS->UnsetSelectionMode(); + if ( !aPresentation->IsHasOwnSelectionMode() ) + if ( !myAIS.IsNull() && !myAIS->HasSelectionMode() ) + return; + + aPresentation->UnsetSelectionMode(); } + + if ( myAIS.IsNull() ) + AISUpdate(); + + if ( !myAIS.IsNull() && myAIS->HasSelectionMode() ) + myAIS->UnsetSelectionMode(); } #endif - //======================================================================= //function : ID //purpose : //======================================================================= -const Standard_GUID& TPrsStd_AISPresentation::ID() const { return GetID(); } +const Standard_GUID& TPrsStd_AISPresentation::ID() const +{ + return GetID(); +} //======================================================================= @@ -632,27 +744,7 @@ const Standard_GUID& TPrsStd_AISPresentation::ID() const { return GetID(); } //======================================================================= Handle(TDF_Attribute) TPrsStd_AISPresentation::BackupCopy() const { - Handle(TPrsStd_AISPresentation) copy = new TPrsStd_AISPresentation; - copy->myTransparency = myTransparency; - copy->myColor = myColor; - copy->myMode= myMode; -#ifdef BUC60917 - copy->myWidth= myWidth; -#endif - copy->myMaterial = myMaterial; - copy->hasOwnColor = hasOwnColor; - copy->hasOwnMaterial = hasOwnMaterial; - copy->hasOwnWidth = hasOwnWidth; - copy->hasOwnMode=hasOwnMode; - copy->hasOwnTransparency = hasOwnTransparency; - copy->myAIS.Nullify(); - copy->isDisplayed = isDisplayed; - copy->myDriverGUID = myDriverGUID; -#ifdef BUC61050 - copy->mySelectionMode= mySelectionMode; - copy->hasOwnSelectionMode = hasOwnSelectionMode; -#endif - return copy; + return new TPrsStd_AISPresentation; } @@ -662,174 +754,68 @@ Handle(TDF_Attribute) TPrsStd_AISPresentation::BackupCopy() const //======================================================================= Handle(TDF_Attribute) TPrsStd_AISPresentation::NewEmpty() const { - return new TPrsStd_AISPresentation (); + return new TPrsStd_AISPresentation(); } + //======================================================================= //function : Restore //purpose : //======================================================================= -void TPrsStd_AISPresentation::Restore (const Handle(TDF_Attribute)& With) -{ - Handle(TPrsStd_AISPresentation) with = Handle(TPrsStd_AISPresentation)::DownCast(With); +void TPrsStd_AISPresentation::Restore(const Handle(TDF_Attribute)& theWith) +{ + Handle(TPrsStd_AISPresentation) aWith = + Handle(TPrsStd_AISPresentation)::DownCast(theWith); myAIS.Nullify(); - - if(!with->HasOwnMaterial()) hasOwnMaterial = Standard_False; - else { -#ifndef OCC1031 - myMaterial = with->Material(); -#endif - hasOwnMaterial = Standard_True; - } -#ifdef OCC1031 - myMaterial = with->Material(); -#endif - - if(!with->HasOwnColor()) hasOwnColor = Standard_False; - else { -#ifndef OCC1030 - myColor = with->Color(); -#endif - hasOwnColor = Standard_True; - } -#ifdef OCC1030 - myColor = with->Color(); -#endif - - if(!with->HasOwnWidth()) hasOwnWidth = Standard_False; - else { -#ifndef OCC1032 - myWidth = with->Width(); -#endif - hasOwnWidth = Standard_True; - } -#ifdef OCC1032 - myWidth = with->Width(); -#endif - - if(!with->HasOwnMode()) hasOwnMode = Standard_False; - else { -#ifndef OCC1033 - myMode = with->Mode(); -#endif - hasOwnMode = Standard_True; - } -#ifdef OCC1033 - myMode = with->Mode(); -#endif - -#ifdef BUC61050 - if(!with->HasOwnSelectionMode()) hasOwnSelectionMode = Standard_False; - else { -#ifndef OCC1034 - mySelectionMode = with->SelectionMode(); -#endif - hasOwnSelectionMode = Standard_True; - } -#ifdef OCC1034 - mySelectionMode = with->SelectionMode(); -#endif -#endif - - if(!with->HasOwnTransparency()) hasOwnTransparency = Standard_False; - else { -#ifndef OCC1029 - myTransparency = with->Transparency(); -#endif - hasOwnTransparency = Standard_True; - } -#ifdef OCC1029 - myTransparency = with->Transparency(); -#endif - - isDisplayed = with->IsDisplayed(); - myDriverGUID = with->GetDriverGUID(); + myDriverGUID = aWith->GetDriverGUID(); } + //======================================================================= //function : Paste //purpose : //======================================================================= -void TPrsStd_AISPresentation::Paste (const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(TPrsStd_AISPresentation) into = Handle(TPrsStd_AISPresentation)::DownCast(Into); - - into->Backup(); - - if(!hasOwnMaterial) into->hasOwnMaterial = Standard_False; - else { - into->myMaterial = myMaterial; - into->hasOwnMaterial = Standard_True; - } - - if(!hasOwnColor) into->hasOwnColor = Standard_False; - else { - into->myColor = myColor; - into->hasOwnColor = Standard_True; - } - - if(!hasOwnWidth) into->hasOwnWidth = Standard_False; - else { - into->myWidth = myWidth; - into->hasOwnWidth = Standard_True; - } - if(!hasOwnMode) into->hasOwnMode = Standard_False; - else { - into->myMode = myMode; - into->hasOwnMode = Standard_True; - } - -#ifdef BUC61050 - if(!hasOwnSelectionMode) into->hasOwnSelectionMode = Standard_False; - else { - into->mySelectionMode = mySelectionMode; - into->hasOwnSelectionMode = Standard_True; - } -#endif - - if(!hasOwnTransparency) into->hasOwnTransparency = Standard_False; - else { - into->myTransparency = myTransparency; - into->hasOwnTransparency = Standard_True; - } - - if (into->isDisplayed) - into->AISErase(Standard_True); - - into->isDisplayed = isDisplayed; - into->myDriverGUID = myDriverGUID; +void TPrsStd_AISPresentation::Paste (const Handle(TDF_Attribute)& theInto, + const Handle(TDF_RelocationTable)& ) const +{ + Handle(TPrsStd_AISPresentation) anInto = + Handle(TPrsStd_AISPresentation)::DownCast(theInto); - into->myAIS.Nullify(); + anInto->Backup(); + anInto->myAIS.Nullify(); } + //======================================================================= //function : AfterAddition //purpose : erase if displayed //======================================================================= void TPrsStd_AISPresentation::AfterAddition() -{ +{ AfterResume(); } + //======================================================================= //function : BeforeRemoval //purpose : erase if displayed //======================================================================= void TPrsStd_AISPresentation::BeforeRemoval() -{ - BeforeForget(); +{ + BeforeForget(); } + //======================================================================= //function : BeforeForget //purpose : erase if displayed //======================================================================= void TPrsStd_AISPresentation::BeforeForget() { - if( !myAIS.IsNull() ) { - AISErase(Standard_True); //Remove AISObject from context + if ( !myAIS.IsNull() ) + { // Remove AISObject from context. + AISErase(Standard_True); myAIS.Nullify(); } } @@ -839,32 +825,39 @@ void TPrsStd_AISPresentation::BeforeForget() //function : AfterResume //purpose : display if displayed //======================================================================= -void TPrsStd_AISPresentation::AfterResume() +void TPrsStd_AISPresentation::AfterResume() { AISUpdate(); - if( IsDisplayed() ) AISDisplay(); - else AISErase(); + + if ( IsDisplayed() ) + AISDisplay(); + else + AISErase(); } + //======================================================================= //function : BeforeUndo //purpose : le NamedShape associe doit etre present //======================================================================= - Standard_Boolean TPrsStd_AISPresentation::BeforeUndo (const Handle(TDF_AttributeDelta)& AD, - const Standard_Boolean ) + const Standard_Boolean ) { Handle(TPrsStd_AISPresentation) P; - AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P); + AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P); - if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) { - if( !P.IsNull() ) P->BeforeForget(); + if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) + { + if ( !P.IsNull() ) + P->BeforeForget(); } else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval))) { - } - else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) { - if( !P.IsNull() ) P->BeforeForget(); - } + } + else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) + { + if ( !P.IsNull() ) + P->BeforeForget(); + } return Standard_True; } @@ -874,115 +867,136 @@ Standard_Boolean TPrsStd_AISPresentation::BeforeUndo (const Handle(TDF_Attribute //function : AfterUndo //purpose : le NamedShape associe doit etre present //======================================================================= - Standard_Boolean TPrsStd_AISPresentation::AfterUndo (const Handle(TDF_AttributeDelta)& AD, - const Standard_Boolean ) + const Standard_Boolean ) { Handle(TPrsStd_AISPresentation) P; AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P); - if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) { + if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) + {} + else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval))) + { + if ( !P.IsNull() ) + P->AfterAddition(); } - else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval))) { - if( !P.IsNull() ) P->AfterAddition(); - } - else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) { - if( !P.IsNull() ) P->AfterResume(); + else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) + { + if ( !P.IsNull() ) + P->AfterResume(); } return Standard_True; } - //======================================================================= //function : AISUpdate //purpose : //======================================================================= - -void TPrsStd_AISPresentation::AISUpdate () -{ +void TPrsStd_AISPresentation::AISUpdate() +{ Backup(); - Handle(AIS_InteractiveContext) ctx; - if(!Label().IsNull()) { - Handle(TPrsStd_AISViewer) viewer; - if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); - - Handle(TPrsStd_Driver) driver; - if (TPrsStd_DriverTable::Get()->FindDriver(GetDriverGUID(), driver)) { - if (myAIS.IsNull()) { // build a new AIS - Handle(AIS_InteractiveObject) newais; - if (driver->Update (Label(), newais)) { - myAIS = newais; - newais->SetOwner(this); - } + Handle(AIS_InteractiveContext) aContext; + if ( !Label().IsNull() ) + { + aContext = getAISContext(); + + Handle(TPrsStd_Driver) aDriver; + if ( TPrsStd_DriverTable::Get()->FindDriver(GetDriverGUID(), aDriver) ) + { + // Build a new AIS. + if ( myAIS.IsNull() ) + { + Handle(AIS_InteractiveObject) aNewObj; + if ( aDriver->Update(Label(), aNewObj) ) + { + myAIS = aNewObj; + aNewObj->SetOwner(this); + } } - else { - Handle(AIS_InteractiveObject) theais = myAIS; - if (driver->Update (Label(), theais)) { - if (! (theais == myAIS)) { - if(!ctx.IsNull()) ctx->Remove(myAIS); - myAIS = theais; //Driver has built new AIS - theais->SetOwner(this); - } - } + else + { + Handle(AIS_InteractiveObject) anObj = myAIS; + if ( aDriver->Update(Label(), anObj) ) + if ( !(anObj == myAIS) ) + { + if ( !aContext.IsNull() ) + aContext->Remove(myAIS); + + // Driver has built new AIS. + myAIS = anObj; + anObj->SetOwner(this); + } } } } else return; -//Apply the visualization settings - if( !myAIS.IsNull() ) { - - if( hasOwnColor ) { - if( !(myAIS->HasColor()) || (myAIS->HasColor() && myAIS->Color() != myColor) ) { - if(!ctx.IsNull()) ctx->SetColor(myAIS, myColor, Standard_False); - else myAIS->SetColor(myColor); - } - } + // Apply the visualization settings. + if ( !myAIS.IsNull() ) + { + if ( HasOwnColor() ) + { + Quantity_NameOfColor aColor = Color(); + if ( !(myAIS->HasColor()) || (myAIS->HasColor() && myAIS->Color() != aColor) ) + if ( !aContext.IsNull() ) + aContext->SetColor(myAIS, aColor, Standard_False); + else + myAIS->SetColor(aColor); + } - if( hasOwnMaterial ) { - if( !(myAIS->HasMaterial()) || (myAIS->HasMaterial() && myAIS->Material() != myMaterial) ) { - if(!ctx.IsNull()) ctx->SetMaterial(myAIS, myMaterial, Standard_False ); - else myAIS->SetMaterial(myMaterial); - } - } - - if( hasOwnTransparency ) { - if( myAIS->Transparency() != myTransparency ) { - if(!ctx.IsNull()) ctx->SetTransparency(myAIS, myTransparency, Standard_False); - else myAIS->SetTransparency(myTransparency); - } + if ( HasOwnMaterial() ) + { + Graphic3d_NameOfMaterial aMaterial = Material(); + if ( !(myAIS->HasMaterial()) || (myAIS->HasMaterial() && myAIS->Material() != aMaterial) ) + if ( !aContext.IsNull() ) + aContext->SetMaterial(myAIS, aMaterial, Standard_False ); + else + myAIS->SetMaterial(aMaterial); } - if( hasOwnWidth ) { - if( !(myAIS->HasWidth()) || (myAIS->HasWidth() && myAIS->Width() != myWidth) ) { - if(!ctx.IsNull()) ctx->SetWidth(myAIS, myWidth, Standard_False); - else myAIS->SetWidth(myWidth); - } + if ( HasOwnTransparency() ) + { + const Standard_Real aTransparency = Transparency(); + if ( myAIS->Transparency() != aTransparency ) + if( !aContext.IsNull() ) + aContext->SetTransparency(myAIS, aTransparency, Standard_False); + else + myAIS->SetTransparency(aTransparency); } - if( hasOwnMode) { - if( myAIS->DisplayMode() != myMode ) { - myAIS->SetDisplayMode(myMode); - } - - + if ( HasOwnWidth() ) + { + const Standard_Real aWidth = Width(); + if ( !(myAIS->HasWidth()) || (myAIS->HasWidth() && myAIS->Width() != aWidth) ) + if ( !aContext.IsNull() ) + aContext->SetWidth(myAIS, aWidth, Standard_False); + else + myAIS->SetWidth(aWidth); } -#ifdef BUC61050 - if (hasOwnSelectionMode) { - if (myAIS->SelectionMode() != mySelectionMode ) { - myAIS->SetSelectionMode(mySelectionMode); - } + if ( HasOwnMode() ) + { + const Standard_Integer aMode = Mode(); + if ( myAIS->DisplayMode() != aMode ) + myAIS->SetDisplayMode(aMode); } -#endif + #ifdef BUC61050 + if ( HasOwnSelectionMode() ) + { + const Standard_Integer aMode = SelectionMode(); + if (myAIS->SelectionMode() != aMode ) + myAIS->SetSelectionMode(aMode); + } + #endif } - - if( isDisplayed && !ctx.IsNull() ) ctx->Redisplay(myAIS, Standard_False); - + + if ( !aContext.IsNull() && IsDisplayed() ) + aContext->Redisplay(myAIS, Standard_False); + return; } @@ -990,25 +1004,27 @@ void TPrsStd_AISPresentation::AISUpdate () //function : AISDisplay //purpose : //======================================================================= +void TPrsStd_AISPresentation::AISDisplay() +{ + if ( !Label().IsNull() ) + { + Handle(AIS_InteractiveContext) aContext = getAISContext(); -void TPrsStd_AISPresentation::AISDisplay () -{ - - if (!Label().IsNull()) { - Handle(TPrsStd_AISViewer) viewer; - if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return; - Handle(AIS_InteractiveContext) ctx = viewer->GetInteractiveContext(); - if( ctx.IsNull() ) return; - - if (!myAIS.IsNull()) { - - if( !(myAIS->GetContext()).IsNull() && (myAIS->GetContext()) != ctx ) myAIS->GetContext()->Remove(myAIS); - - if( isDisplayed && ctx->IsDisplayed(myAIS) ) return; - - ctx->Display(myAIS, Standard_False); - - if( ctx->IsDisplayed(myAIS) ) SetDisplayed(Standard_True); + if ( aContext.IsNull() ) + return; + + if ( !myAIS.IsNull() ) + { + if ( !(myAIS->GetContext()).IsNull() && (myAIS->GetContext()) != aContext ) + myAIS->GetContext()->Remove(myAIS); + + if ( IsDisplayed() && aContext->IsDisplayed(myAIS) ) + return; + + aContext->Display(myAIS, Standard_False); + + if ( aContext->IsDisplayed(myAIS) ) + SetDisplayed(Standard_True); } } } @@ -1018,37 +1034,51 @@ void TPrsStd_AISPresentation::AISDisplay () //function : AISErase //purpose : //======================================================================= +void TPrsStd_AISPresentation::AISErase(const Standard_Boolean theIsRemove) +{ + SetDisplayed(Standard_False); + Handle(AIS_InteractiveContext) aContext, anOwnContext; -void TPrsStd_AISPresentation::AISErase (const Standard_Boolean remove) -{ - SetDisplayed(Standard_False); - Handle(AIS_InteractiveContext) ctx, ownctx; - - if ( !myAIS.IsNull() ) { - - if ( !Label().IsNull()) { + if ( !myAIS.IsNull() ) + { + if ( !Label().IsNull() ) + { Handle(TPrsStd_AISViewer) viewer; - if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return; - ownctx = myAIS->GetContext(); - ctx = viewer->GetInteractiveContext(); - if( remove ) { - if( !ctx.IsNull() ) ctx->Remove (myAIS,Standard_False); - if( !ownctx.IsNull() && ownctx != ctx ) ownctx->Remove (myAIS,Standard_False); + if( !TPrsStd_AISViewer::Find(Label(), viewer) ) + return; + anOwnContext = myAIS->GetContext(); + aContext = viewer->GetInteractiveContext(); + + if ( theIsRemove ) + { + if ( !aContext.IsNull() ) + aContext->Remove(myAIS, Standard_False); + if ( !anOwnContext.IsNull() && anOwnContext != aContext ) + anOwnContext->Remove(myAIS, Standard_False); + myAIS->SetToUpdate(); } - else { - if( !ctx.IsNull() ) ctx->Erase (myAIS,Standard_False); - if( !ownctx.IsNull() && ownctx != ctx ) ownctx->Erase (myAIS,Standard_False); + else + { + if ( !aContext.IsNull() ) + aContext->Erase(myAIS, Standard_False); + if ( !anOwnContext.IsNull() && anOwnContext != aContext ) + anOwnContext->Erase(myAIS, Standard_False); } } - else { - if( remove ) { - if( !ownctx.IsNull() ) { - ownctx->Remove (myAIS,Standard_False); - myAIS->SetToUpdate(); + else + { + if ( theIsRemove ) + { + if ( !anOwnContext.IsNull() ) + { + anOwnContext->Remove(myAIS, Standard_False); + myAIS->SetToUpdate(); + } } - } else - if( !ownctx.IsNull() ) ownctx->Erase (myAIS,Standard_False); + else + if( !anOwnContext.IsNull() ) + anOwnContext->Erase(myAIS, Standard_False); } } } @@ -1065,12 +1095,24 @@ Handle(AIS_InteractiveObject) TPrsStd_AISPresentation::GetAIS() const //======================================================================= -//function :SetDisplayed +//function : getAISContext //purpose : //======================================================================= -void TPrsStd_AISPresentation::SetDisplayed(const Standard_Boolean B) +Handle(AIS_InteractiveContext) TPrsStd_AISPresentation::getAISContext() const { - Backup(); - isDisplayed = B; + Handle(TPrsStd_AISViewer) aViewer; + if ( TPrsStd_AISViewer::Find(Label(), aViewer) ) + return aViewer->GetInteractiveContext(); + + return Handle_AIS_InteractiveContext(); } + +//======================================================================= +//function : getData +//purpose : +//======================================================================= +Handle(TDataXtd_Presentation) TPrsStd_AISPresentation::getData() const +{ + return TDataXtd_Presentation::Set(this); +} diff --git a/src/TPrsStd/TPrsStd_AISViewer.cxx b/src/TPrsStd/TPrsStd_AISViewer.cxx index 5f2e9163c5..9a92a3381b 100644 --- a/src/TPrsStd/TPrsStd_AISViewer.cxx +++ b/src/TPrsStd/TPrsStd_AISViewer.cxx @@ -33,7 +33,7 @@ const Standard_GUID& TPrsStd_AISViewer::GetID () //======================================================================= Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, - const Handle(V3d_Viewer)& viewer) + const Handle(V3d_Viewer)& viewer) { Handle(TPrsStd_AISViewer) V; if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { @@ -50,7 +50,7 @@ Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, //purpose : //======================================================================= Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, - const Handle(AIS_InteractiveContext)& IC) + const Handle(AIS_InteractiveContext)& IC) { Handle(TPrsStd_AISViewer) V; if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { @@ -67,7 +67,7 @@ Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, //purpose : //======================================================================= Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, - Handle(TPrsStd_AISViewer)& V) + Handle(TPrsStd_AISViewer)& V) { return (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)); } @@ -77,7 +77,7 @@ Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, //purpose : //======================================================================= Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, - Handle(AIS_InteractiveContext)& IC) + Handle(AIS_InteractiveContext)& IC) { Handle(TPrsStd_AISViewer) V; if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { @@ -93,7 +93,7 @@ Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, //======================================================================= Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, - Handle(V3d_Viewer)& VIEW) + Handle(V3d_Viewer)& VIEW) { Handle(TPrsStd_AISViewer) V; if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { @@ -139,9 +139,9 @@ TPrsStd_AISViewer::TPrsStd_AISViewer() void TPrsStd_AISViewer::Update () const { - myInteractiveContext->UpdateCurrentViewer(); + myInteractiveContext->UpdateCurrentViewer(); } - + //======================================================================= //function : SetInteractiveContext //purpose : @@ -196,7 +196,7 @@ Handle(TDF_Attribute) TPrsStd_AISViewer::NewEmpty() const //======================================================================= void TPrsStd_AISViewer::Paste (const Handle(TDF_Attribute)&, - const Handle(TDF_RelocationTable)&) const + const Handle(TDF_RelocationTable)&) const { } diff --git a/src/XmlDrivers/XmlDrivers.cxx b/src/XmlDrivers/XmlDrivers.cxx index 5db6efad11..b4e8873be6 100644 --- a/src/XmlDrivers/XmlDrivers.cxx +++ b/src/XmlDrivers/XmlDrivers.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -78,7 +77,6 @@ Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers XmlMNaming ::AddDrivers (aTable, theMessageDriver); XmlMFunction ::AddDrivers (aTable, theMessageDriver); XmlMDocStd ::AddDrivers (aTable, theMessageDriver); - XmlMPrsStd ::AddDrivers (aTable, theMessageDriver); // return aTable; } diff --git a/src/XmlMDataXtd/XmlMDataXtd.cdl b/src/XmlMDataXtd/XmlMDataXtd.cdl index 2e81457021..d5287d02c9 100644 --- a/src/XmlMDataXtd/XmlMDataXtd.cdl +++ b/src/XmlMDataXtd/XmlMDataXtd.cdl @@ -40,6 +40,10 @@ is class PlacementDriver; class PatternStdDriver; + + class PresentationDriver; + + class PositionDriver; AddDrivers (aDriverTable : ADriverTable from XmlMDF; diff --git a/src/XmlMDataXtd/XmlMDataXtd.cxx b/src/XmlMDataXtd/XmlMDataXtd.cxx index b8fc213ce3..1d0f959b57 100644 --- a/src/XmlMDataXtd/XmlMDataXtd.cxx +++ b/src/XmlMDataXtd/XmlMDataXtd.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include static Standard_Integer myDocumentVersion = -1; //======================================================================= @@ -34,14 +36,16 @@ static Standard_Integer myDocumentVersion = -1; void XmlMDataXtd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(CDM_MessageDriver)& anMsgDrv) { - aDriverTable-> AddDriver (new XmlMDataXtd_ShapeDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_PointDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_AxisDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_PlaneDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_GeometryDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_ConstraintDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_PlacementDriver (anMsgDrv)); - aDriverTable-> AddDriver (new XmlMDataXtd_PatternStdDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_ShapeDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PointDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_AxisDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PlaneDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_GeometryDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_ConstraintDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PlacementDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PatternStdDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PositionDriver (anMsgDrv)); + aDriverTable->AddDriver(new XmlMDataXtd_PresentationDriver (anMsgDrv)); } //======================================================================= diff --git a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl similarity index 92% rename from src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl rename to src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl index 91d1f4f8fd..aea5adce18 100644 --- a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl +++ b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl @@ -13,7 +13,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class PositionDriver from XmlMPrsStd inherits ADriver from XmlMDF +class PositionDriver from XmlMDataXtd inherits ADriver from XmlMDF ---Purpose: Attribute Driver. @@ -26,7 +26,7 @@ uses is Create (theMessageDriver:MessageDriver from CDM) - returns mutable PositionDriver from XmlMPrsStd; + returns mutable PositionDriver from XmlMDataXtd; NewEmpty (me) returns mutable Attribute from TDF; diff --git a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx similarity index 92% rename from src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx rename to src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx index bf575b5ce8..7403efcbca 100644 --- a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx +++ b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx @@ -13,7 +13,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include @@ -22,19 +22,19 @@ #include //======================================================================= -//function : XmlMPrsStd_PositionDriver +//function : XmlMDataXtd_PositionDriver //purpose : Constructor //======================================================================= -XmlMPrsStd_PositionDriver::XmlMPrsStd_PositionDriver +XmlMDataXtd_PositionDriver::XmlMDataXtd_PositionDriver (const Handle(CDM_MessageDriver)& theMsgDriver) - : XmlMDF_ADriver (theMsgDriver, NULL) +: XmlMDF_ADriver (theMsgDriver, NULL) {} //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) XmlMPrsStd_PositionDriver::NewEmpty() const +Handle(TDF_Attribute) XmlMDataXtd_PositionDriver::NewEmpty() const { return (new TDataXtd_Position()); } @@ -43,7 +43,7 @@ Handle(TDF_Attribute) XmlMPrsStd_PositionDriver::NewEmpty() const //function : Paste //purpose : persistent -> transient (retrieve) //======================================================================= -Standard_Boolean XmlMPrsStd_PositionDriver::Paste +Standard_Boolean XmlMDataXtd_PositionDriver::Paste (const XmlObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, XmlObjMgt_RRelocationTable& ) const @@ -107,7 +107,7 @@ Standard_Boolean XmlMPrsStd_PositionDriver::Paste //function : Paste //purpose : transient -> persistent (store) //======================================================================= -void XmlMPrsStd_PositionDriver::Paste +void XmlMDataXtd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource, XmlObjMgt_Persistent& theTarget, XmlObjMgt_SRelocationTable& ) const diff --git a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl similarity index 89% rename from src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl rename to src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl index f1567b8bcc..2b5b09a27c 100644 --- a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl +++ b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl @@ -13,7 +13,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -class AISPresentationDriver from XmlMPrsStd inherits ADriver from XmlMDF +class PresentationDriver from XmlMDataXtd inherits ADriver from XmlMDF ---Purpose: Attribute Driver. @@ -26,7 +26,7 @@ uses is Create (theMessageDriver:MessageDriver from CDM) - returns mutable AISPresentationDriver from XmlMPrsStd; + returns mutable PresentationDriver from XmlMDataXtd; NewEmpty (me) returns mutable Attribute from TDF; @@ -39,4 +39,4 @@ is Target : in out Persistent from XmlObjMgt; RelocTable : out SRelocationTable from XmlObjMgt); -end AISPresentationDriver; +end PresentationDriver; diff --git a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx similarity index 79% rename from src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx rename to src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx index 3de88f6096..b7f0651771 100644 --- a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx +++ b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx @@ -13,11 +13,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include -#include +#include #define OCC6010 // vro: 09.06.2004 @@ -32,37 +32,37 @@ IMPLEMENT_DOMSTRING (ModeString, "mode") IMPLEMENT_DOMSTRING (DisplayedString, "true") //======================================================================= -//function : XmlMPrsStd_AISPresentationDriver +//function : XmlMDataXtd_PresentationDriver //purpose : Constructor //======================================================================= -XmlMPrsStd_AISPresentationDriver::XmlMPrsStd_AISPresentationDriver - (const Handle(CDM_MessageDriver)& theMsgDriver) - : XmlMDF_ADriver (theMsgDriver, NULL) +XmlMDataXtd_PresentationDriver::XmlMDataXtd_PresentationDriver + (const Handle(CDM_MessageDriver)& theMsgDriver) + : XmlMDF_ADriver (theMsgDriver, NULL) {} //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) XmlMPrsStd_AISPresentationDriver::NewEmpty() const +Handle(TDF_Attribute) XmlMDataXtd_PresentationDriver::NewEmpty() const { - return (new TPrsStd_AISPresentation()); + return (new TDataXtd_Presentation()); } //======================================================================= //function : Paste //purpose : persistent -> transient (retrieve) //======================================================================= -Standard_Boolean XmlMPrsStd_AISPresentationDriver::Paste - (const XmlObjMgt_Persistent& theSource, - const Handle(TDF_Attribute)& theTarget, - XmlObjMgt_RRelocationTable& ) const +Standard_Boolean XmlMDataXtd_PresentationDriver::Paste + (const XmlObjMgt_Persistent& theSource, + const Handle(TDF_Attribute)& theTarget, + XmlObjMgt_RRelocationTable& ) const { TCollection_ExtendedString aMessageString; XmlObjMgt_DOMString aDOMStr; - Handle(TPrsStd_AISPresentation) aTPrs = - Handle(TPrsStd_AISPresentation)::DownCast(theTarget); + Handle(TDataXtd_Presentation) aTPrs = + Handle(TDataXtd_Presentation)::DownCast(theTarget); const XmlObjMgt_Element& anElem = theSource; //convert attribute value into GUID @@ -92,7 +92,7 @@ Standard_Boolean XmlMPrsStd_AISPresentationDriver::Paste WriteMessage (aMessageString); return Standard_False; } - aTPrs->SetColor((Quantity_NameOfColor)anIValue); + aTPrs->SetColor(anIValue); } else { @@ -110,7 +110,7 @@ Standard_Boolean XmlMPrsStd_AISPresentationDriver::Paste WriteMessage (aMessageString); return Standard_False; } - aTPrs->SetMaterial((Graphic3d_NameOfMaterial)anIValue); + aTPrs->SetMaterial(anIValue); } else { @@ -182,13 +182,13 @@ Standard_Boolean XmlMPrsStd_AISPresentationDriver::Paste //function : Paste //purpose : transient -> persistent (store) //======================================================================= -void XmlMPrsStd_AISPresentationDriver::Paste - (const Handle(TDF_Attribute)& theSource, - XmlObjMgt_Persistent& theTarget, - XmlObjMgt_SRelocationTable& ) const +void XmlMDataXtd_PresentationDriver::Paste + (const Handle(TDF_Attribute)& theSource, + XmlObjMgt_Persistent& theTarget, + XmlObjMgt_SRelocationTable&) const { - Handle(TPrsStd_AISPresentation) aTPrs = - Handle(TPrsStd_AISPresentation)::DownCast(theSource); + Handle(TDataXtd_Presentation) aTPrs = + Handle(TDataXtd_Presentation)::DownCast(theSource); if (aTPrs.IsNull()) return; //convert GUID into attribute value @@ -205,28 +205,28 @@ void XmlMPrsStd_AISPresentationDriver::Paste Standard_Integer aNb; // color - if (aTPrs->HasOwnColor()) + if (aTPrs->IsHasOwnColor()) { - aNb = (Standard_Integer)(aTPrs->Color()); + aNb = aTPrs->Color(); theTarget.Element().setAttribute(::ColorString(), aNb); } // material - if (aTPrs->HasOwnMaterial()) + if (aTPrs->IsHasOwnMaterial()) { aNb = (Standard_Integer)(aTPrs->Material()); theTarget.Element().setAttribute(::MaterialString(), aNb); } // transparency - if (aTPrs->HasOwnTransparency()) + if (aTPrs->IsHasOwnTransparency()) { TCollection_AsciiString aRNbStr (aTPrs->Transparency()); theTarget.Element().setAttribute(::TransparencyString(), aRNbStr.ToCString()); } // width - if (aTPrs->HasOwnWidth()) + if (aTPrs->IsHasOwnWidth()) { TCollection_AsciiString aRNbStr (aTPrs->Width()); theTarget.Element().setAttribute(::WidthString(), aRNbStr.ToCString()); @@ -234,7 +234,7 @@ void XmlMPrsStd_AISPresentationDriver::Paste #ifdef OCC6010 // mode - if (aTPrs->HasOwnMode()) + if (aTPrs->IsHasOwnMode()) { aNb = aTPrs->Mode(); theTarget.Element().setAttribute(::ModeString(), aNb); diff --git a/src/XmlMPrsStd/XmlMPrsStd.cdl b/src/XmlMPrsStd/XmlMPrsStd.cdl deleted file mode 100644 index 667308b1cd..0000000000 --- a/src/XmlMPrsStd/XmlMPrsStd.cdl +++ /dev/null @@ -1,37 +0,0 @@ --- Created on: 2001-07-09 --- Created by: Julia DOROVSKIKH --- Copyright (c) 2001-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -package XmlMPrsStd - - -uses - TDF, - CDM, - XmlMDF, - XmlObjMgt - -is - ---Category: Classes - -- ============================================================= - - class PositionDriver; - - class AISPresentationDriver; - - AddDrivers (aDriverTable : ADriverTable from XmlMDF; - theMessageDriver: MessageDriver from CDM); - ---Purpose: Adds the attribute storage drivers to . - -end XmlMPrsStd; diff --git a/src/XmlMPrsStd/XmlMPrsStd.cxx b/src/XmlMPrsStd/XmlMPrsStd.cxx deleted file mode 100644 index 9989ab3c0e..0000000000 --- a/src/XmlMPrsStd/XmlMPrsStd.cxx +++ /dev/null @@ -1,30 +0,0 @@ -// Created on: 2001-07-09 -// Created by: Julia DOROVSKIKH -// Copyright (c) 2001-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include - -///======================================================================= -//function : AddDrivers -//purpose : -//======================================================================= -void XmlMPrsStd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, - const Handle(CDM_MessageDriver)& aMessageDriver) -{ - aDriverTable->AddDriver(new XmlMPrsStd_PositionDriver(aMessageDriver)); - aDriverTable->AddDriver(new XmlMPrsStd_AISPresentationDriver(aMessageDriver)); -} -- 2.39.5