mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-05 05:34:17 +05:00
IPAL52528: TC7.5.0: Dump study - transparency is lost
Properly process visibility state on Show/Hide operations
This commit is contained in:
parent
bd37ceaf56
commit
aa8b2914fb
@ -381,7 +381,7 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs,
|
|||||||
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
||||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
||||||
if (aView)
|
if (aView)
|
||||||
aView->Display( prs );
|
aView->Display( getDisplayer(), prs );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add prs to the preview list
|
// Add prs to the preview list
|
||||||
@ -401,19 +401,20 @@ void GEOMBase_Helper::erasePreview( const bool update )
|
|||||||
// check view frame where the preview was displayed
|
// check view frame where the preview was displayed
|
||||||
bool vfOK = checkViewWindow() && myViewWindow;
|
bool vfOK = checkViewWindow() && myViewWindow;
|
||||||
// Iterate through presentations and delete them
|
// Iterate through presentations and delete them
|
||||||
for ( PrsList::iterator anIter = myPreview.begin(); anIter != myPreview.end(); ++anIter ) {
|
for ( PrsList::iterator anIter = myPreview.begin(); anIter != myPreview.end(); ++anIter )
|
||||||
|
{
|
||||||
if ( vfOK )
|
if ( vfOK )
|
||||||
|
{
|
||||||
|
SUIT_ViewManager* aViewManager = myViewWindow->getViewManager();
|
||||||
|
if ( aViewManager->getType() == OCCViewer_Viewer::Type() ||
|
||||||
|
aViewManager->getType() == SVTK_Viewer::Type() )
|
||||||
{
|
{
|
||||||
SUIT_ViewManager* aViewManager = myViewWindow->getViewManager();
|
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
||||||
if ( aViewManager->getType() == OCCViewer_Viewer::Type() ||
|
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
||||||
aViewManager->getType() == SVTK_Viewer::Type() )
|
if (aView)
|
||||||
{
|
aView->Erase( getDisplayer(), *anIter, true );
|
||||||
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
|
||||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
|
||||||
if (aView)
|
|
||||||
aView->Erase( *anIter, true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete *anIter;
|
delete *anIter;
|
||||||
}
|
}
|
||||||
myPreview.clear();
|
myPreview.clear();
|
||||||
|
@ -525,18 +525,12 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
if ( prs )
|
if ( prs )
|
||||||
{
|
{
|
||||||
vf->BeforeDisplay( this, prs );
|
vf->BeforeDisplay( this, prs );
|
||||||
vf->Display( prs );
|
vf->Display( this, prs );
|
||||||
vf->AfterDisplay( this, prs );
|
vf->AfterDisplay( this, prs );
|
||||||
|
|
||||||
if ( updateViewer )
|
if ( updateViewer )
|
||||||
vf->Repaint();
|
vf->Repaint();
|
||||||
|
|
||||||
int aMgrId = getViewManagerId(vf);
|
|
||||||
SalomeApp_Study* aStudy = getStudy();
|
|
||||||
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 1 );
|
|
||||||
|
|
||||||
setVisibilityState(theIO->getEntry(), Qtx::ShownState);
|
|
||||||
|
|
||||||
delete prs; // delete presentation because displayer is its owner
|
delete prs; // delete presentation because displayer is its owner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,17 +575,11 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() );
|
SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() );
|
||||||
if ( prs ) {
|
if ( prs ) {
|
||||||
vf->BeforeErase( this, prs );
|
vf->BeforeErase( this, prs );
|
||||||
vf->Erase( prs, forced );
|
vf->Erase( this, prs, forced );
|
||||||
vf->AfterErase( this, prs );
|
vf->AfterErase( this, prs );
|
||||||
if ( updateViewer )
|
if ( updateViewer )
|
||||||
vf->Repaint();
|
vf->Repaint();
|
||||||
delete prs; // delete presentation because displayer is its owner
|
delete prs; // delete presentation because displayer is its owner
|
||||||
|
|
||||||
int aMgrId = getViewManagerId(vf);
|
|
||||||
SalomeApp_Study* aStudy = getStudy();
|
|
||||||
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 0 );
|
|
||||||
|
|
||||||
setVisibilityState(theIO->getEntry(), Qtx::HiddenState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,6 +682,27 @@ void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateV
|
|||||||
UpdateViewer();
|
UpdateViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool on )
|
||||||
|
{
|
||||||
|
SalomeApp_Study* aStudy = getStudy();
|
||||||
|
int vId = -1;
|
||||||
|
if ( v ) vId = getViewManagerId( v );
|
||||||
|
|
||||||
|
if ( p ) {
|
||||||
|
QString entry = p->GetEntry();
|
||||||
|
if ( !entry.isEmpty() ) {
|
||||||
|
if ( vId != -1 )
|
||||||
|
aStudy->setObjectProperty( vId, entry, GEOM::propertyName( GEOM::Visibility ), on );
|
||||||
|
setVisibilityState( entry, on ? Qtx::ShownState : Qtx::HiddenState );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( vId != -1 ) {
|
||||||
|
aStudy->setObjectProperty( vId, GEOM::propertyName( GEOM::Visibility ), on );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Quantity_Color GEOM_Displayer::qColorFromResources( const QString& property, const QColor& defColor )
|
Quantity_Color GEOM_Displayer::qColorFromResources( const QString& property, const QColor& defColor )
|
||||||
{
|
{
|
||||||
// VSR: this method can be improved in future:
|
// VSR: this method can be improved in future:
|
||||||
@ -952,7 +961,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
|
|||||||
|
|
||||||
if ( create && !isTemporary && aMgrId != -1 ) {
|
if ( create && !isTemporary && aMgrId != -1 ) {
|
||||||
// set properties to the study
|
// set properties to the study
|
||||||
study->setObjectPropMap( aMgrId, entry, propMap );
|
study->setObjectProperties( aMgrId, entry, propMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
// AISShape->SetName(???); ??? necessary to set name ???
|
// AISShape->SetName(???); ??? necessary to set name ???
|
||||||
@ -1106,7 +1115,7 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
|
|||||||
|
|
||||||
if ( create && !isTemporary && aMgrId != -1 ) {
|
if ( create && !isTemporary && aMgrId != -1 ) {
|
||||||
// set properties to the study
|
// set properties to the study
|
||||||
study->setObjectPropMap( aMgrId, entry, propMap );
|
study->setObjectProperties( aMgrId, entry, propMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2336,7 +2345,7 @@ PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
|
|||||||
|
|
||||||
if ( viewModel && viewId != -1 ) {
|
if ( viewModel && viewId != -1 ) {
|
||||||
// get properties from the study
|
// get properties from the study
|
||||||
PropMap storedMap = study->getObjectPropMap( viewId, entry );
|
PropMap storedMap = study->getObjectProperties( viewId, entry );
|
||||||
// overwrite default properties from stored ones (that are specified)
|
// overwrite default properties from stored ones (that are specified)
|
||||||
for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
|
for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
|
||||||
if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
|
if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
|
||||||
@ -2946,7 +2955,7 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
|
|||||||
{
|
{
|
||||||
if( SUIT_ViewManager* aViewManager = *vmIt )
|
if( SUIT_ViewManager* aViewManager = *vmIt )
|
||||||
{
|
{
|
||||||
const ObjMap anObjects = aStudy->getObjectMap( aViewManager->getGlobalId() );
|
const ObjMap& anObjects = aStudy->getObjectProperties( aViewManager->getGlobalId() );
|
||||||
for( ObjMap::ConstIterator objIt = anObjects.begin(); objIt != anObjects.end(); objIt++ )
|
for( ObjMap::ConstIterator objIt = anObjects.begin(); objIt != anObjects.end(); objIt++ )
|
||||||
{
|
{
|
||||||
_PTR(SObject) aSObj( aStudyDS->FindObjectID( objIt.key().toLatin1().constData() ) );
|
_PTR(SObject) aSObj( aStudyDS->FindObjectID( objIt.key().toLatin1().constData() ) );
|
||||||
|
@ -128,6 +128,9 @@ public:
|
|||||||
const bool theUpdateViewer,
|
const bool theUpdateViewer,
|
||||||
SALOME_View* theViewFrame );
|
SALOME_View* theViewFrame );
|
||||||
|
|
||||||
|
/* Update visibility state */
|
||||||
|
void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
|
||||||
|
|
||||||
/* build presentation accordint to the current viewer type*/
|
/* build presentation accordint to the current viewer type*/
|
||||||
SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
|
SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
|
||||||
SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
|
SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
|
||||||
|
@ -2702,10 +2702,10 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
// saving VTK actors properties
|
// saving VTK actors properties
|
||||||
QVector<SUIT_ViewWindow*> views = vman->getViews();
|
QVector<SUIT_ViewWindow*> views = vman->getViews();
|
||||||
for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) {
|
for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) {
|
||||||
const ObjMap anObjects = appStudy->getObjectMap(aMgrId);
|
const ObjMap& anObjects = appStudy->getObjectProperties(aMgrId);
|
||||||
ObjMap::ConstIterator o_it = anObjects.begin();
|
ObjMap::ConstIterator o_it = anObjects.begin();
|
||||||
for (; o_it != anObjects.end(); o_it++) {
|
for (; o_it != anObjects.end(); o_it++) {
|
||||||
const PropMap aProps = o_it.value();
|
const PropMap& aProps = o_it.value();
|
||||||
|
|
||||||
//Check that object exists in the study
|
//Check that object exists in the study
|
||||||
_PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
|
_PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
|
||||||
@ -2977,8 +2977,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
|
QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
|
||||||
|
|
||||||
for (int index = 0; index < aListOfMap.count(); index++) {
|
for (int index = 0; index < aListOfMap.count(); index++) {
|
||||||
|
appStudy->setObjectProperties(index, entry, aListOfMap[index]);
|
||||||
appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
|
|
||||||
|
|
||||||
//Get Visibility property of the current PropMap
|
//Get Visibility property of the current PropMap
|
||||||
if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
|
if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
|
||||||
|
@ -543,7 +543,7 @@ void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj,
|
|||||||
if (!CORBA::is_nil(geomObj)) {
|
if (!CORBA::is_nil(geomObj)) {
|
||||||
|
|
||||||
//Remove visual properties of the object
|
//Remove visual properties of the object
|
||||||
appStudy->removeObjectFromAll(obj->GetID().c_str());
|
appStudy->removeObjectProperties(obj->GetID().c_str());
|
||||||
|
|
||||||
// Erase graphical object
|
// Erase graphical object
|
||||||
QListIterator<SALOME_View*> it( views );
|
QListIterator<SALOME_View*> it( views );
|
||||||
|
@ -328,7 +328,7 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||||
if ( window ) {
|
if ( window ) {
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window->getViewManager()->getGlobalId();
|
||||||
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
|
PropMap propMap = study->getObjectProperties( mgrId, io->getEntry() );
|
||||||
QString matProp = propMap.value(GEOM::propertyName( GEOM::Material )).toString();
|
QString matProp = propMap.value(GEOM::propertyName( GEOM::Material )).toString();
|
||||||
if ( !matProp.isEmpty() )
|
if ( !matProp.isEmpty() )
|
||||||
myCurrentModel.fromProperties( matProp );
|
myCurrentModel.fromProperties( matProp );
|
||||||
|
@ -446,7 +446,7 @@ void GEOMToolsGUI_ReduceStudyDlg::removeObject( std::string& theStudyEntry )
|
|||||||
_PTR(SObject) obj ( myStudy->FindObjectID( theStudyEntry.c_str() ) );
|
_PTR(SObject) obj ( myStudy->FindObjectID( theStudyEntry.c_str() ) );
|
||||||
if ( obj ) {
|
if ( obj ) {
|
||||||
// remove visual properties of the object
|
// remove visual properties of the object
|
||||||
appStudy->removeObjectFromAll(obj->GetID().c_str());
|
appStudy->removeObjectProperties(obj->GetID().c_str());
|
||||||
// remove references to this object
|
// remove references to this object
|
||||||
appStudy->deleteReferencesTo( obj );
|
appStudy->deleteReferencesTo( obj );
|
||||||
// remove objects from study
|
// remove objects from study
|
||||||
|
Loading…
Reference in New Issue
Block a user