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() )
}
res=true;
-
-
+
return res;
}
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
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 ))) {
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 )) {
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 );
}
"IsosColor", // -
// outlines color
"OutlineColor", // -
+ // texture
+ "Texture", // -
};
return ( type >= GEOM::Visibility && type <= GEOM::LastProperty ) ? names[type] : QString();
}
PointColor,
IsosColor,
OutlineColor,
- LastProperty = OutlineColor,
+ Texture,
+ LastProperty = Texture,
};
GEOM_OBJECT_EXPORT double minDeflection();