mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 10:30:32 +05:00
Fix of 0022437: EDF GEOM: Texture is lost when hiding and showing again a shape. Commit of patch from Renaud NEDELEC with one correction: don't put an empty texture property into default property map.
This commit is contained in:
parent
2c88eef4af
commit
60b70427a4
@ -184,12 +184,15 @@ bool EntityGUI_PictureImportDlg::execute( ObjectList& objects )
|
||||
int height = pixmap->height();
|
||||
int width = pixmap->width();
|
||||
|
||||
delete pixmap;
|
||||
|
||||
GEOM::GEOM_Object_var P1 = aBasicOperations->MakePointXYZ( -0.5*width, -0.5*height, 0 );
|
||||
GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( -0.5*width, 0.5*height, 0 );
|
||||
GEOM::GEOM_Object_var P3 = aBasicOperations->MakePointXYZ( 0.5*width, 0.5*height, 0 );
|
||||
GEOM::GEOM_Object_var P4 = aBasicOperations->MakePointXYZ( 0.5*width, -0.5*height, 0 );
|
||||
|
||||
GEOM::GEOM_Object_var aFace = aBlocksOperations->MakeQuad4Vertices(P1,P2,P3,P4);
|
||||
getDisplayer()->SetDisplayMode(3);
|
||||
getDisplayer()->SetTexture(theImgFileName.toStdString());
|
||||
|
||||
if ( !aFace->_is_nil() )
|
||||
@ -198,8 +201,7 @@ bool EntityGUI_PictureImportDlg::execute( ObjectList& objects )
|
||||
}
|
||||
|
||||
res=true;
|
||||
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -697,12 +697,36 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
|
||||
AISShape->SetOwnDeviationCoefficient( qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ) );
|
||||
|
||||
// set texture
|
||||
bool textureAdded = false;
|
||||
if ( HasTexture() ) {
|
||||
// predefined display texture, manually set to displayer via GEOM_Displayer::SetTexture() function
|
||||
AISShape->SetTextureFileName( TCollection_AsciiString( GetTexture().c_str() ) );
|
||||
if ( ! entry.isEmpty() ) {
|
||||
// check that study is active
|
||||
SalomeApp_Study* study = getActiveStudy();
|
||||
if ( study ) {
|
||||
// Store the texture in object properties for next displays
|
||||
study->setObjectProperty( aMgrId, entry, GEOM::propertyName( GEOM::Texture ), QString( GetTexture().c_str() ) );
|
||||
study->setObjectProperty( aMgrId, entry, GEOM::propertyName( GEOM::DisplayMode ), 3 );
|
||||
|
||||
// Update porpeties map
|
||||
propMap = getObjectProperties( study, entry, myViewFrame );
|
||||
}
|
||||
}
|
||||
textureAdded = true;
|
||||
}
|
||||
else {
|
||||
// Texture from properties
|
||||
QString aTexture = propMap.value( GEOM::propertyName( GEOM::Texture ) ).toString();
|
||||
if ( !aTexture.isEmpty() ) {
|
||||
AISShape->SetTextureFileName( TCollection_AsciiString( aTexture.toStdString().c_str() ) );
|
||||
textureAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( textureAdded ){
|
||||
AISShape->SetTextureMapOn();
|
||||
AISShape->DisableTextureModulate();
|
||||
AISShape->SetDisplayMode( 3 );
|
||||
}
|
||||
|
||||
// set line width
|
||||
|
@ -2671,6 +2671,11 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
param = occParam + GEOM::propertyName( GEOM::Color );
|
||||
ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
|
||||
}
|
||||
|
||||
if (aProps.contains(GEOM::propertyName( GEOM::Texture ))) {
|
||||
param = occParam + GEOM::propertyName( GEOM::Texture );
|
||||
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Texture )).toString().toStdString());
|
||||
}
|
||||
|
||||
if (vType == SVTK_Viewer::Type()) {
|
||||
if (aProps.contains(GEOM::propertyName( GEOM::Opacity ))) {
|
||||
@ -2821,6 +2826,8 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
QColor c = QColor::fromRgbF(rgb[0].toDouble(), rgb[1].toDouble(), rgb[2].toDouble());
|
||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Color ), c);
|
||||
}
|
||||
} else if (paramNameStr == GEOM::propertyName( GEOM::Texture )) {
|
||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Texture ), val );
|
||||
} else if (paramNameStr == GEOM::propertyName( GEOM::EdgesDirection )) {
|
||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val == "true" || val == "1");
|
||||
} else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
|
||||
|
@ -298,9 +298,9 @@ void GEOMToolsGUI::OnTexture()
|
||||
|
||||
QString aTexture = QFileDialog::getOpenFileName( dynamic_cast< SUIT_ViewWindow* >( window ),tr("GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES"));
|
||||
if( !aTexture.isEmpty() ) {
|
||||
displayer.SetTexture( aTexture.toStdString() );
|
||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||
Handle( SALOME_InteractiveObject ) io = It.Value();
|
||||
appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Texture ), aTexture );
|
||||
appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), 3 );
|
||||
if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
|
||||
}
|
||||
|
@ -95,6 +95,8 @@ namespace GEOM
|
||||
"IsosColor", // -
|
||||
// outlines color
|
||||
"OutlineColor", // -
|
||||
// texture
|
||||
"Texture", // -
|
||||
};
|
||||
return ( type >= GEOM::Visibility && type <= GEOM::LastProperty ) ? names[type] : QString();
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ namespace GEOM
|
||||
PointColor,
|
||||
IsosColor,
|
||||
OutlineColor,
|
||||
LastProperty = OutlineColor,
|
||||
Texture,
|
||||
LastProperty = Texture,
|
||||
};
|
||||
|
||||
GEOM_OBJECT_EXPORT double minDeflection();
|
||||
|
Loading…
Reference in New Issue
Block a user