// of auto-color picking up
#define SIMPLE_AUTOCOLOR
+// Hard-coded value of shape deflection coefficient for VTK viewer
+const double VTK_MIN_DEFLECTION = 0.001;
+
//================================================================
// Function : getActiveStudy
// Purpose : Get active study, returns 0 if no open study frame
myShadingColor = SalomeApp_Tools::color( col );
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
+ myHasDisplayMode = false;
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
int aMgrId = getViewManagerId(vf);
SalomeApp_Study* aStudy = getStudy();
- aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 1 );
+ aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 1 );
setVisibilityState(theIO->getEntry(), Qtx::ShownState);
int aMgrId = getViewManagerId(vf);
SalomeApp_Study* aStudy = getStudy();
- aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 0 );
+ aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 0 );
setVisibilityState(theIO->getEntry(), Qtx::HiddenState);
}
return SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", property, defColor );
}
-bool GEOM_Displayer::setPointMarker( const Handle(GEOM_AISShape)& AISShape, const QString& markerData, const Quantity_Color color )
-{
- bool result = true;
-
- QStringList aList = markerData.split( DIGIT_SEPARATOR );
- if ( aList.size() == 2 ) {
- // standard marker string contains "TypeOfMarker:ScaleOfMarker"
- int aTypeOfMarker = aList[0].toInt();
- double aScaleOfMarker = aList[1].toDouble();
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( aScaleOfMarker );
- anAspect->SetTypeOfMarker( (Aspect_TypeOfMarker)( aTypeOfMarker-1 ) );
- anAspect->SetColor( color );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- else if ( aList.size() == 1 ) {
- // custom marker string contains "IdOfTexture"
- int textureId = aList[0].toInt();
- Standard_Integer aWidth, aHeight;
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture =
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture =
-#endif
- GeometryGUI::getTexture( getStudy(), textureId, aWidth, aHeight );
- if ( !aTexture.IsNull() ) {
- static int TextureId = 0;
- Handle(Prs3d_PointAspect) aTextureAspect =
- new Prs3d_PointAspect( color,
- ++TextureId,
- aWidth, aHeight,
- aTexture );
- AISShape->Attributes()->SetPointAspect( aTextureAspect );
- }
- else {
- // texture is not loaded to GUI
- result = false;
- }
- }
- else {
- // wrong point marker data stored
- result = false;
- }
- return result;
-}
-
-void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape )
+void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create )
{
- // get study
+ // check that shape is not null
+ if ( AISShape.IsNull() ) return;
+
+ // check that study is active
SalomeApp_Study* study = getStudy();
if ( !study ) return;
- // get resource manager
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-
if ( myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points
!TopoDS_Iterator(myShape).More() )
return; // NPAL15983 (Bug when displaying empty groups)
+ // set interactive object
+
+ Handle( SALOME_InteractiveObject ) anIO;
+
+ if ( !myIO.IsNull() ) {
+ AISShape->setIO( myIO );
+ AISShape->SetOwner( myIO );
+ anIO = myIO;
+ }
+ else if ( !myName.empty() ) {
+ // workaround to allow selection of temporary objects
+ static int tempId = 0;
+ anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
+ AISShape->setIO( anIO );
+ AISShape->SetOwner( anIO );
+ }
+
// flag: only vertex or compound of vertices is processed (specific handling)
- bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape ));
+ bool onlyVertex = myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape );
// presentation study entry (empty for temporary objects like preview)
- QString anEntry = !myIO.IsNull() ? QString( myIO->getEntry() ) : QString();
+ QString entry = !anIO.IsNull() ? QString( anIO->getEntry() ) : QString();
// flag: temporary object
- bool isTemporary = anEntry.isEmpty() || anEntry.startsWith( "TEMP_" );
+ bool isTemporary = entry.isEmpty() || entry.startsWith( "TEMP_" );
// currently active view window's ID (-1 if no active view)
- int aMgrId = !myIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
-
- // stored properties
- PropMap aPropMap = study->getObjectPropMap( aMgrId, anEntry );
- // default properties
- PropMap aDefPropMap = getDefaultPropertyMap( SOCC_Viewer::Type() );
-
- // use properties stored in study
- bool useStudy = !isTemporary && aMgrId != -1; // anEntry.isEmpty()
- // use GEOM object color (from engine side)
- bool useObjColor = !aPropMap.contains( COLOR_PROP );
- // use GEOM object marker (rom engine side)
- bool useObjMarker = !aPropMap.contains( MARKER_TYPE_PROP );
-
- MergePropertyMaps( aPropMap, aDefPropMap );
-
- // default properties
- double transparency = 0.0;
- int uIsos = 1;
- int vIsos = 1;
- int dispMode = myDisplayMode; // take from resource manager ???
- Quantity_Color shadingColor = myShadingColor; // take from resource manager ???
- Standard_Boolean isTopLevel = Standard_False; // bool ???
- bool isDisplayVectors = false;
- double deflection = 0.001;
- Material_Model material;
+ int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
- if ( useStudy ) {
- // take proprties from stored properties:
- // - shading color
- shadingColor = SalomeApp_Tools::color( aPropMap.value( COLOR_PROP ).value<QColor>() );
- // - display mode
- dispMode = aPropMap.value( DISPLAY_MODE_PROP ).toInt();
- // - nb of isos
- uIsos = aPropMap.value( ISOS_PROP ).toString().split( DIGIT_SEPARATOR )[0].toInt();
- vIsos = aPropMap.value( ISOS_PROP ).toString().split( DIGIT_SEPARATOR )[1].toInt();
- // - transparency
- transparency = aPropMap.value( TRANSPARENCY_PROP ).toDouble();
- // - top-level flag
- isTopLevel = aPropMap.value( TOP_LEVEL_PROP ).value<Standard_Boolean>();
- // - display vectors flag
- isDisplayVectors = aPropMap.value( VECTOR_MODE_PROP ).toBool();
- // - deflection coefficient
- deflection = aPropMap.value( DEFLECTION_COEFF_PROP ).toDouble();
- // - line width
- SetWidth( aPropMap.value( EDGE_WIDTH_PROP ).toInt() );
- // - isos width
- SetIsosWidth( aPropMap.value( ISOS_WIDTH_PROP ).toInt() );
- // - material
- material.fromProperties( aPropMap.value( MATERIAL_PROP ).toString() );
- }
- else {
- // take nb of isos from resources:
- // - nb of isos
- uIsos = aResMgr->integerValue( "Geometry", "iso_number_u", 1 );
- vIsos = aResMgr->integerValue( "Geometry", "iso_number_v", 1 );
- // - deflection coefficient
- deflection = aResMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 );
- // - material
- QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
- material.fromResources( mname );
- }
+ // get presentation properties
+ PropMap propMap = getObjectProperties( study, entry, myViewFrame );
// Temporary staff: vertex must be infinite for correct visualization
AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
// set material
+ Material_Model material;
+ material.fromProperties( propMap.value( GEOM::propertyName( GEOM::Material ) ).toString() );
// - set front material properties
- AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_FRONT_SIDE );
AISShape->SetMaterial( material.getMaterialOCCAspect( true ) );
// - set back material properties
- AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_BACK_SIDE );
AISShape->SetMaterial( material.getMaterialOCCAspect( false ) );
- // - switch default facing mode
- AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
+ // - switch to default (both sides) facing mode
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_BOTH_SIDE );
+
+ // set colors
- // set shading color
- if ( !material.isPhysical() )
- AISShape->SetShadingColor( shadingColor );
+ // - shading color
+ if ( HasColor() ) {
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function;
+ // we set it to the shape not taking into account material properties
+ AISShape->SetShadingColor( (Quantity_NameOfColor)GetColor() );
+ }
+ else if ( !material.isPhysical() ) {
+ // shading color from properties is used only for non-physical materials
+ AISShape->SetShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::ShadingColor ) ).value<QColor>() ) );
+ }
+
+ // - wireframe color
+ Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetLineAspect( anAspect );
+
+ // - unfree boundaries color
+ anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
+
+ // - free boundaries color
+ anAspect = AISShape->Attributes()->FreeBoundaryAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
+
+ // - standalone edges color
+ anAspect = AISShape->Attributes()->WireAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::LineColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetWireAspect( anAspect );
+
+ // - color for edges in shading+edges mode
+ AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
+
+ // ???
+ AISShape->storeBoundaryColors();
// set display mode
- AISShape->SetDisplayMode( dispMode );
+ AISShape->SetDisplayMode( HasDisplayMode() ?
+ // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
+ GetDisplayMode() :
+ // display mode from properties
+ propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
+
+ // set display vectors flag
+ AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
+
+ // set transparency ????????????????????????????????????????????????????
+ //AISShape->SetTransparency( propMap.value( GEOM::propertyName( GEOM::Transparency ) ).toDouble() );
// set iso properties
+ int uIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[0].toInt();
+ int vIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[1].toInt();
+ Quantity_Color isosColor = SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>() );
+ int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
- uIsoAspect->SetColor( qColorFromResources( "isos_color", QColor::fromRgbF( 0.5, 0.5, 0.5 ) ) );
- vIsoAspect->SetColor( qColorFromResources( "isos_color", QColor::fromRgbF( 0.5, 0.5, 0.5 ) ) );
- if ( HasIsosWidth() ) {
- uIsoAspect->SetWidth( GetIsosWidth() );
- vIsoAspect->SetWidth( GetIsosWidth() );
- }
+ uIsoAspect->SetColor( isosColor );
+ uIsoAspect->SetWidth( isosWidth );
uIsoAspect->SetNumber( uIsos );
+ vIsoAspect->SetColor( isosColor );
+ vIsoAspect->SetWidth( isosWidth );
vIsoAspect->SetNumber( vIsos );
AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
- // set transparency
- AISShape->SetTransparency( transparency );
-
- // set top-level flag
- AISShape->setTopLevel( isTopLevel );
-
- // set display vectors flag
- AISShape->SetDisplayVectors( isDisplayVectors );
-
- // set point marker (for vertex / compound of vertices only)
- if ( onlyVertex && !useObjMarker ) {
- useObjMarker = !setPointMarker( AISShape,
- aPropMap.value( MARKER_TYPE_PROP ).toString(),
- HasColor() ? (Quantity_NameOfColor)GetColor() : qColorFromResources( "point_color", QColor( 255, 255, 0 ) ) );
- }
- if ( HasColor() ) {
- AISShape->SetShadingColor( (Quantity_NameOfColor)GetColor() );
- AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
- }
- else {
- // Set line aspect
- Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
- anAspect->SetColor( qColorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
- AISShape->Attributes()->SetLineAspect( anAspect );
-
- // Set unfree boundaries aspect
- anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
- anAspect->SetColor( qColorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
- AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
- AISShape->storeBoundaryColors();
-
- // Set free boundaries aspect
- anAspect = AISShape->Attributes()->FreeBoundaryAspect();
- anAspect->SetColor( qColorFromResources( "free_bound_color", QColor( 0, 255, 0 ) ) );
- AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
-
- // Set wire aspect
- anAspect = AISShape->Attributes()->WireAspect();
- anAspect->SetColor( qColorFromResources( "line_color", QColor( 255, 0, 0 ) ) );
- AISShape->Attributes()->SetWireAspect( anAspect );
-
- // Set color for edges in shading
- AISShape->SetEdgesInShadingColor( qColorFromResources( "edges_in_shading_color", QColor( 255, 255, 0 ) ) );
-
- // Set deflection coefficient
- AISShape->SetOwnDeviationCoefficient( qMax( deflection, DEFLECTION_MIN ) ); // to avoid to small values of the coefficient
- }
+ // set deflection coefficient
+ // ... to avoid to small values of the coefficient, its lower value is limited
+ AISShape->SetOwnDeviationCoefficient( qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ) );
// set texture
if ( HasTexture() ) {
- AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str()));
+ // predefined display texture, manually set to displayer via GEOM_Displayer::SetTexture() function
+ AISShape->SetTextureFileName( TCollection_AsciiString( GetTexture().c_str() ) );
AISShape->SetTextureMapOn();
AISShape->DisableTextureModulate();
- AISShape->SetDisplayMode(3);
+ AISShape->SetDisplayMode( 3 );
}
// set line width
- if ( HasWidth() )
- AISShape->SetWidth( GetWidth() );
+ AISShape->SetWidth( HasWidth() ?
+ // predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
+ GetWidth() :
+ // libe width from properties
+ propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
- // set interactive object
- if ( !myIO.IsNull() ) {
- AISShape->setIO( myIO );
- AISShape->SetOwner( myIO );
- }
- else if ( !myName.empty() ) {
- // Workaround to allow selection of temporary objects
- static int tempId = 0;
- Handle( SALOME_InteractiveObject ) anObj =
- new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
- AISShape->setIO( anObj );
- AISShape->SetOwner( anObj );
- }
-
- Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
- if ( !anIO.IsNull() ) {
- _PTR(SObject) SO ( study->studyDS()->FindObjectID( anIO->getEntry() ) );
- if ( SO ) {
- // get CORBA reference to data object
- CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
- if ( !CORBA::is_nil( object ) ) {
- // downcast to GEOM object
- GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
- bool hasColor = false;
- SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
- if ( hasColor && useObjColor ) {
- Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- if ( !material.isPhysical() ) {
- AISShape->SetColor( aQuanColor );
- AISShape->SetShadingColor( aQuanColor );
- }
- if ( onlyVertex ) {
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetColor( aQuanColor );
- anAspect->SetScale( myScaleOfMarker );
- anAspect->SetTypeOfMarker( myTypeOfMarker );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- study->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, SalomeApp_Tools::color( aQuanColor ) );
- }
- else if ( !hasColor && !isTemporary ) {
- //In case if color wasn't defined in the property map of the object
- //and GEOM_Object color also wasn't defined get default color from Resource Mgr.
- QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( col );
- if ( !material.isPhysical() ) {
- AISShape->SetShadingColor( aQuanColor );
- }
- study->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
- }
+ // set top-level flag
+ AISShape->setTopLevel( propMap.value( GEOM::propertyName( GEOM::TopLevel ) ).toBool() );
- // ... marker type
- if ( useObjMarker ) {
- GEOM::marker_type aType = aGeomObject->GetMarkerType();
- GEOM::marker_size aSize = aGeomObject->GetMarkerSize();
- if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) {
- Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 );
- double aMSize = ((int)aSize+1)*0.5;
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( aMSize );
- anAspect->SetTypeOfMarker( aMType );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor )
- aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- anAspect->SetColor( aQuanColor );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- else if ( aType == GEOM::MT_USER ) {
- int aTextureId = aGeomObject->GetMarkerTexture();
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- Standard_Integer aWidth, aHeight;
+ // set point marker (for vertex / compound of vertices only)
+ if ( onlyVertex ) {
+ QStringList aList = propMap.value( GEOM::propertyName( GEOM::PointMarker ) ).toString().split( GEOM::subSectionSeparator() );
+ if ( aList.size() == 2 ) {
+ // standard marker string contains "TypeOfMarker:ScaleOfMarker"
+ int aTypeOfMarker = aList[0].toInt();
+ double aScaleOfMarker = (aList[1].toInt() + 1) * 0.5;
+ Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+ anAspect->SetScale( aScaleOfMarker );
+ anAspect->SetTypeOfMarker( (Aspect_TypeOfMarker)( aTypeOfMarker-1 ) );
+ anAspect->SetColor( HasColor() ?
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetPointAspect( anAspect );
+ }
+ else if ( aList.size() == 1 ) {
+ // custom marker string contains "IdOfTexture"
+ int textureId = aList[0].toInt();
+ Standard_Integer aWidth, aHeight;
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture =
+ Handle(TColStd_HArray1OfByte) aTexture =
#else
- Handle(Graphic3d_HArray1OfBytes) aTexture =
+ Handle(Graphic3d_HArray1OfBytes) aTexture =
#endif
- GeometryGUI::getTexture( study, aTextureId, aWidth, aHeight);
- if (!aTexture.IsNull()) {
- static int TextureId = 0;
- Handle(Prs3d_PointAspect) aTextureAspect =
- new Prs3d_PointAspect(aQuanColor, ++TextureId, aWidth, aHeight, aTexture );
- AISShape->Attributes()->SetPointAspect( aTextureAspect );
- }
- }
- else { //Use marker from the preferences
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( myScaleOfMarker );
- anAspect->SetTypeOfMarker( myTypeOfMarker );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor )
- aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- anAspect->SetColor( aQuanColor );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- }
+ GeometryGUI::getTexture( study, textureId, aWidth, aHeight );
+ if ( !aTexture.IsNull() ) {
+ static int TextureId = 0;
+ Handle(Prs3d_PointAspect) aTextureAspect =
+ new Prs3d_PointAspect( HasColor() ?
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
+ ++TextureId,
+ aWidth, aHeight,
+ aTexture );
+ AISShape->Attributes()->SetPointAspect( aTextureAspect );
}
}
+ }
- if ( !isTemporary )
- study->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
-
- if ( HasWidth() )
- study->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
- if ( HasIsosWidth() )
- study->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
+ if ( create && !isTemporary && aMgrId != -1 ) {
+ // set properties to the study
+ study->setObjectPropMap( aMgrId, entry, propMap );
}
// AISShape->SetName(???); ??? necessary to set name ???
Handle(GEOM_AISShape) AISShape = ( myType == GEOM_VECTOR ) ? new GEOM_AISVector( myShape, "" )
: new GEOM_AISShape ( myShape, "" );
// update shape properties
- updateShapeProperties( AISShape );
+ updateShapeProperties( AISShape, true );
// add shape to the presentation
occPrs->AddObject( AISShape );
if ( AISShape->Shape() != myShape )
AISShape->Set( myShape );
// update shape properties
- updateShapeProperties( AISShape );
+ updateShapeProperties( AISShape, false );
// re-set interactive object
if ( !myIO.IsNull() )
{
theActors->AddItem( aTrh );
}
else {
- PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
+ PropMap aDefPropMap = getDefaultPropertyMap();
if(!myIO.IsNull()) {
aMgrId = getViewManagerId(myViewFrame);
theActors = vtkActorCollection::New();
GEOM_Actor* aGeomActor = GEOM_Actor::New();
- aGeomActor->SetShape(myShape,aDefPropMap.value(DEFLECTION_COEFF_PROP).toDouble(),myType == GEOM_VECTOR);
+ /////////////////////////////////////////////////////////////////////////
+ // VSR: for VTK viewer currently deflection coefficient is hardcoded
+ // due to performance problem
+ // aGeomActor->SetShape(myShape,aDefPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble(),myType == GEOM_VECTOR);
+ /////////////////////////////////////////////////////////////////////////
+ aGeomActor->SetShape(myShape, VTK_MIN_DEFLECTION, myType == GEOM_VECTOR);
theActors->AddItem(aGeomActor);
aGeomActor->Delete();
if(useStudy) {
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
- if(!aPropMap.contains(COLOR_PROP))
+ if(!aPropMap.contains(GEOM::propertyName( GEOM::Color )))
useObjCol = true;
MergePropertyMaps(aPropMap, aDefPropMap);
}
int aIsos[2]= { 1, 1 };
if(useStudy) {
- QString anIsos = aPropMap.value(ISOS_PROP).toString();
- QStringList uv = anIsos.split(DIGIT_SEPARATOR);
+ QString anIsos = aPropMap.value(GEOM::propertyName( GEOM::NbIsos )).toString();
+ QStringList uv = anIsos.split( GEOM::subSectionSeparator() );
aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
aGeomGActor->SetNbIsos(aIsos);
- aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
- SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
- SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
- aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toBool());
- int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
+ aGeomGActor->SetOpacity(1.0 - aPropMap.value(GEOM::propertyName( GEOM::Transparency )).toDouble());
+ SetWidth(aPropMap.value(GEOM::propertyName( GEOM::LineWidth )).toInt());
+ SetIsosWidth(aPropMap.value(GEOM::propertyName( GEOM::IsosWidth )).toInt());
+ aGeomGActor->SetVectorMode(aPropMap.value(GEOM::propertyName( GEOM::EdgesDirection )).toBool());
+ int aDispModeId = aPropMap.value(GEOM::propertyName( GEOM::DisplayMode )).toInt();
// Specially processing of 'Shading with edges' mode from preferences,
// because there is the following enum in VTK viewer:
// Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
// enum in GEOM_Actor (and further to VTKViewer::Representation enum)
aDispModeId++;
aGeomGActor->setDisplayMode(aDispModeId);
- aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble());
+ /////////////////////////////////////////////////////////////////////////
+ // VSR: for VTK viewer currently deflection coefficient is hardcoded
+ // due to performance problem;
+ // aGeomGActor->SetDeflection(aPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble());
+ /////////////////////////////////////////////////////////////////////////
+ aGeomGActor->SetDeflection(VTK_MIN_DEFLECTION);
// Create material model
Material_Model material;
- material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() );
+ material.fromProperties( aPropMap.value(GEOM::propertyName( GEOM::Material )).toString() );
// Set material properties for the object
- aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
+ aStudy->setObjectProperty( aMgrId, anEntry, GEOM::propertyName( GEOM::Material ), material.toProperties() );
// Set the same front and back materials for the selected shape
std::vector<vtkProperty*> aProps;
aProps.push_back( material.getMaterialVTKProperty( true ) );
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
}
}
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), GEOM::propertyName( GEOM::Color ), QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
}
}
}
} else {
- QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
+ QColor c = aPropMap.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
}
QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
material.fromResources( mname );
// Set material properties for the object
- aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
+ aStudy->setObjectProperty( aMgrId, anEntry, GEOM::propertyName( GEOM::Material ), material.toProperties() );
// Set material for the selected shape
std::vector<vtkProperty*> aProps;
aProps.push_back( material.getMaterialVTKProperty( true ) );
Handle(SALOME_InteractiveObject) IO = sh->getIO();
if ( IO.IsNull() ) continue;
PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
- if ( aPropMap.contains( TRANSPARENCY_PROP ) ) {
- double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble();
+ if ( aPropMap.contains( GEOM::propertyName( GEOM::Transparency ) ) ) {
+ double transparency = aPropMap.value(GEOM::propertyName( GEOM::Transparency )).toDouble();
ic->SetTransparency( sh, transparency, true );
}
}
int GEOM_Displayer::SetDisplayMode( const int theMode )
{
int aPrevMode = myDisplayMode;
- if ( theMode != -1 )
+ if ( theMode != -1 ) {
myDisplayMode = theMode;
- else
- {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
+ myHasDisplayMode = true;
+ }
+ else {
+ UnsetDisplayMode();
}
return aPrevMode;
}
int aPrevMode = myDisplayMode;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
+ myHasDisplayMode = false;
return aPrevMode;
}
+bool GEOM_Displayer::HasDisplayMode() const
+{
+ return myHasDisplayMode;
+}
+
SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
{
static QList<QColor> colors;
return aSColor;
}
+PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
+ const QString& entry,
+ SALOME_View* view )
+{
+ // get default properties for the explicitly specified default view type
+ PropMap propMap = GEOM_Displayer::getDefaultPropertyMap();
+
+ if ( study && view ) {
+ SUIT_ViewModel* viewModel = dynamic_cast<SUIT_ViewModel*>( view );
+ SUIT_ViewManager* viewMgr = ( viewModel != 0 ) ? viewModel->getViewManager() : 0;
+ int viewId = ( viewMgr != 0 ) ? viewMgr->getGlobalId() : -1;
+
+ if ( viewModel && viewId != -1 ) {
+ // get properties from the study
+ PropMap storedMap = study->getObjectPropMap( viewId, entry );
+ // overwrite default properties from stored ones (that are specified)
+ for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
+ if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
+ propMap.insert( GEOM::propertyName( (GEOM::Property)prop ),
+ storedMap.value( GEOM::propertyName( (GEOM::Property)prop ) ) );
+ }
+ // ... specific processing for color
+ // ... current implementation is to use same stored color for all aspects
+ // ... (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
+ if ( storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ }
+ if ( !entry.isEmpty() ) {
+ // get CORBA reference to geom object
+ _PTR(SObject) SO( study->studyDS()->FindObjectID( entry.toStdString() ) );
+ if ( SO ) {
+ CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
+ if ( !CORBA::is_nil( object ) ) {
+ GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );
+ // check that geom object has color properly set
+ bool hasColor = false;
+ SALOMEDS::Color aSColor = getColor( geomObject, hasColor );
+ // set color from geometry object (only once, if it is not yet set in GUI)
+ // current implementation is to use same color for all aspects
+ // (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
+ if ( hasColor && !storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
+ QColor objColor = QColor::fromRgbF( aSColor.R, aSColor.G, aSColor.B );
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ), objColor );
+ }
+ // check that object has point marker properly set
+ GEOM::marker_type mType = geomObject->GetMarkerType();
+ GEOM::marker_size mSize = geomObject->GetMarkerSize();
+ int mTextureId = geomObject->GetMarkerTexture();
+ bool hasMarker = ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER && mSize > GEOM::MS_NONE && mSize <= GEOM::MS_70 ) ||
+ ( mType == GEOM::MT_USER && mTextureId > 0 );
+ // set point marker from geometry object (only once, if it is not yet set in GUI)
+ if ( hasMarker && !storedMap.contains( GEOM::propertyName( GEOM::PointMarker ) ) ) {
+ if ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER ) {
+ // standard type
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
+ QString( "%1%2%3" ).arg( (int)mType ).arg( GEOM::subSectionSeparator() ).arg( (int)mSize ) );
+ }
+ else if ( mType == GEOM::MT_USER ) {
+ // custom texture
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ), QString::number( mTextureId ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return propMap;
+}
-PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type)
+PropMap GEOM_Displayer::getDefaultPropertyMap()
{
- PropMap aDefaultMap;
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ PropMap propMap;
+
+ // get resource manager
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- //1. Visibility
- aDefaultMap.insert( VISIBILITY_PROP, 1 );
+ // fill in the properties map with default values
- //2. Nb Isos
- aDefaultMap.insert( ISOS_PROP,
- QString( "%1%2%3" ).
- arg( aResMgr->integerValue( "Geometry", "iso_number_u", 1 ) ).
- arg( DIGIT_SEPARATOR ).
- arg( aResMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
+ // - visibility (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::Visibility ), false );
- //3. Transparency
- aDefaultMap.insert( TRANSPARENCY_PROP, 0.0 );
+ // - nb isos (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::NbIsos ),
+ QString( "%1%2%3" ).
+ arg( resMgr->integerValue( "Geometry", "iso_number_u", 1 ) ).
+ arg( GEOM::subSectionSeparator() ).
+ arg( resMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
- //4. Display Mode
- aDefaultMap.insert( DISPLAY_MODE_PROP,
- aResMgr->integerValue( "Geometry", "display_mode", 0 ) );
+ // - transparency (opacity = 1-transparency)
+ propMap.insert( GEOM::propertyName( GEOM::Transparency ), 0.0 );
- //5. Vector Mode
- aDefaultMap.insert( VECTOR_MODE_PROP, false );
+ // - display mode (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
+ resMgr->integerValue( "Geometry", "display_mode", 0 ) );
- //6. Color
- aDefaultMap.insert( COLOR_PROP,
- aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) );
+ // - show edges direction flag (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::EdgesDirection ), false );
- //7. Deflection Coeff
- if ( viewer_type == SOCC_Viewer::Type() ) {
- aDefaultMap.insert( DEFLECTION_COEFF_PROP,
- aResMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 ) );
- }
- else {
- aDefaultMap.insert( DEFLECTION_COEFF_PROP, 0.001 );
- }
+ // - shading color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
+ colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
+
+ // - wireframe color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ),
+ colorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
+
+ // - standalone edges color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ),
+ colorFromResources( "line_color", QColor( 255, 0, 0 ) ) );
- //8. Material
+ // - free boundaries color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ),
+ colorFromResources( "free_bound_color", QColor( 0, 255, 0 ) ) );
+
+ // - points color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ),
+ colorFromResources( "point_color", QColor( 255, 255, 0 ) ) );
+
+ // - isos color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::IsosColor ),
+ colorFromResources( "isos_color", QColor( 200, 200, 200 ) ) );
+
+ // - outlines color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::OutlineColor ),
+ colorFromResources( "edges_in_shading_color", QColor( 180, 180, 180 ) ) );
+
+ // - deflection coefficient (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::Deflection ),
+ resMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 ) );
+
+ // - material (take default value from preferences)
Material_Model material;
- material.fromResources( aResMgr->stringValue( "Geometry", "material", "Plastic" ) );
- aDefaultMap.insert( MATERIAL_PROP, material.toProperties() );
+ material.fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) );
+ propMap.insert( GEOM::propertyName( GEOM::Material ), material.toProperties() );
+
+ // - edge width (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::LineWidth ),
+ resMgr->integerValue( "Geometry", "edge_width", 1 ) );
- //9. Width of the edges
- aDefaultMap.insert( EDGE_WIDTH_PROP,
- aResMgr->integerValue( "Geometry", "edge_width", 1 ) );
+ // - isos width (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::IsosWidth ),
+ resMgr->integerValue( "Geometry", "isolines_width", 1 ) );
- //10. Width of iso-lines
- aDefaultMap.insert( ISOS_WIDTH_PROP,
- aResMgr->integerValue( "Geometry", "isolines_width", 1 ) );
+ // - point marker (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
+ QString( "%1%2%3" ).
+ arg( resMgr->integerValue( "Geometry", "type_of_marker", 1 ) + 1 ).
+ arg( GEOM::subSectionSeparator() ).
+ arg( resMgr->integerValue( "Geometry", "marker_scale", 1 ) ) );
- //11. Top-level flag
- aDefaultMap.insert( TOP_LEVEL_PROP, Standard_False );
+ // - top-level flag (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::TopLevel ), false );
- return aDefaultMap;
+ return propMap;
}
bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
{
int nbInserted = 0;
- if(!theOrigin.contains(VISIBILITY_PROP)) {
- theOrigin.insert(VISIBILITY_PROP, 0);
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::Visibility ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::Visibility ), 0);
nbInserted++;
}
- if(!theOrigin.contains(TRANSPARENCY_PROP)) {
- theOrigin.insert(TRANSPARENCY_PROP, theDefault.value(TRANSPARENCY_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::Transparency ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::Transparency ), theDefault.value(GEOM::propertyName( GEOM::Transparency )));
nbInserted++;
}
- if(!theOrigin.contains(DISPLAY_MODE_PROP)) {
- theOrigin.insert(DISPLAY_MODE_PROP, theDefault.value(DISPLAY_MODE_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::DisplayMode ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::DisplayMode ), theDefault.value(GEOM::propertyName( GEOM::DisplayMode )));
nbInserted++;
}
- if(!theOrigin.contains(ISOS_PROP)) {
- theOrigin.insert(ISOS_PROP, theDefault.value(ISOS_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::NbIsos ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::NbIsos ), theDefault.value(GEOM::propertyName( GEOM::NbIsos )));
nbInserted++;
}
- if(!theOrigin.contains(VECTOR_MODE_PROP)) {
- theOrigin.insert(VECTOR_MODE_PROP, theDefault.value(VECTOR_MODE_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::EdgesDirection ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::EdgesDirection ), theDefault.value(GEOM::propertyName( GEOM::EdgesDirection )));
nbInserted++;
}
- if(!theOrigin.contains(DEFLECTION_COEFF_PROP)) {
- theOrigin.insert(DEFLECTION_COEFF_PROP, theDefault.value(DEFLECTION_COEFF_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::Deflection ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::Deflection ), theDefault.value(GEOM::propertyName( GEOM::Deflection )));
nbInserted++;
}
- if(!theOrigin.contains(MATERIAL_PROP)) {
- theOrigin.insert(MATERIAL_PROP, theDefault.value(MATERIAL_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::Material ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::Material ), theDefault.value(GEOM::propertyName( GEOM::Material )));
nbInserted++;
}
- if(!theOrigin.contains(EDGE_WIDTH_PROP)) {
- theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::LineWidth ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::LineWidth ), theDefault.value(GEOM::propertyName( GEOM::LineWidth )));
nbInserted++;
}
- if(!theOrigin.contains(ISOS_WIDTH_PROP)) {
- theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::IsosWidth ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::IsosWidth ), theDefault.value(GEOM::propertyName( GEOM::IsosWidth )));
nbInserted++;
}
- if(!theOrigin.contains(COLOR_PROP)) {
- theOrigin.insert(COLOR_PROP, theDefault.value(COLOR_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::Color ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::Color ), theDefault.value(GEOM::propertyName( GEOM::Color )));
nbInserted++;
}
- if(!theOrigin.contains(TOP_LEVEL_PROP)) {
- theOrigin.insert(TOP_LEVEL_PROP, theDefault.value(TOP_LEVEL_PROP));
+ if(!theOrigin.contains(GEOM::propertyName( GEOM::TopLevel ))) {
+ theOrigin.insert(GEOM::propertyName( GEOM::TopLevel ), theDefault.value(GEOM::propertyName( GEOM::TopLevel )));
nbInserted++;
}
if ( anApp && anApp->activeViewManager() ) {
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
if( aStudy ) {
- v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), MATERIAL_PROP, QVariant() );
+ v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), GEOM::propertyName( GEOM::Material ), QVariant() );
}
}
QString curModel = "";
setPreferenceProperty( step, "precision", 3 );
// Set property for deflection value for spinboxes
- setPreferenceProperty( defl, "min", DEFLECTION_MIN );
+ setPreferenceProperty( defl, "min", GEOM::minDeflection() );
setPreferenceProperty( defl, "max", 1.0 );
setPreferenceProperty( defl, "step", 1.0e-04 );
setPreferenceProperty( defl, "precision", 6 );
if (!obj->FindAttribute(anAttr, "AttributeIOR"))
continue;
- std::string param,occParam = vType.toLatin1().data();
- occParam += NAME_SEPARATOR;
- occParam += QString::number(aMgrId).toLatin1().data();
- occParam += NAME_SEPARATOR;
+ QString param, occParam = vType;
+ occParam += GEOM::sectionSeparator();
+ occParam += QString::number(aMgrId);
+ occParam += GEOM::sectionSeparator();
- if (aProps.contains(VISIBILITY_PROP)) {
- param = occParam + VISIBILITY_PROP;
- ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+ if (aProps.contains(GEOM::propertyName( GEOM::Visibility ))) {
+ param = occParam + GEOM::propertyName( GEOM::Visibility );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Visibility )).toBool() ? "On" : "Off");
}
- if (aProps.contains(DISPLAY_MODE_PROP)) {
- param = occParam + DISPLAY_MODE_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::DisplayMode ))) {
+ param = occParam + GEOM::propertyName( GEOM::DisplayMode );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::DisplayMode )).toString().toStdString());
}
- if (aProps.contains(COLOR_PROP)) {
- QColor c = aProps.value(COLOR_PROP).value<QColor>();
- QString colorStr = QString::number(c.red()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
- param = occParam + COLOR_PROP;
- ip->setParameter(entry, param, colorStr.toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Color ))) {
+ QColor c = aProps.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
+ QStringList val;
+ val << QString::number(c.redF());
+ val << QString::number(c.greenF());
+ val << QString::number(c.blueF());
+ param = occParam + GEOM::propertyName( GEOM::Color );
+ ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
}
if (vType == SVTK_Viewer::Type()) {
- if (aProps.contains(OPACITY_PROP)) {
- param = occParam + OPACITY_PROP;
- ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Opacity ))) {
+ param = occParam + GEOM::propertyName( GEOM::Opacity );
+ ip->setParameter(entry, param.toStdString(), QString::number(1. - aProps.value(GEOM::propertyName( GEOM::Transparency )).toDouble()).toStdString());
}
} else if (vType == SOCC_Viewer::Type()) {
- if (aProps.contains(TRANSPARENCY_PROP)) {
- param = occParam + TRANSPARENCY_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Transparency ))) {
+ param = occParam + GEOM::propertyName( GEOM::Transparency );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Transparency )).toString().toStdString());
}
- if (aProps.contains(TOP_LEVEL_PROP)) {
- param = occParam + TOP_LEVEL_PROP;
- Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
- if (val == Standard_True)
- ip->setParameter(entry, param, "1");
+ if (aProps.contains(GEOM::propertyName( GEOM::TopLevel ))) {
+ param = occParam + GEOM::propertyName( GEOM::TopLevel );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::TopLevel )).toString().toStdString());
}
}
- if (aProps.contains(ISOS_PROP)) {
- param = occParam + ISOS_PROP;
- ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::NbIsos ))) {
+ param = occParam + GEOM::propertyName( GEOM::NbIsos );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::NbIsos )).toString().toStdString());
}
- if (aProps.contains(VECTOR_MODE_PROP)) {
- param = occParam + VECTOR_MODE_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::EdgesDirection ))) {
+ param = occParam + GEOM::propertyName( GEOM::EdgesDirection );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::EdgesDirection )).toString().toStdString());
}
- if (aProps.contains(DEFLECTION_COEFF_PROP)) {
- param = occParam + DEFLECTION_COEFF_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Deflection ))) {
+ param = occParam + GEOM::propertyName( GEOM::Deflection );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Deflection )).toString().toStdString());
}
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
- if (aProps.contains(MARKER_TYPE_PROP)) {
- param = occParam + MARKER_TYPE_PROP;
- ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::PointMarker ))) {
+ param = occParam + GEOM::propertyName( GEOM::PointMarker );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::PointMarker )).toString().toStdString());
}
- if (aProps.contains(MATERIAL_PROP)) {
- param = occParam + MATERIAL_PROP;
- ip->setParameter(entry, param, aProps.value(MATERIAL_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Material ))) {
+ param = occParam + GEOM::propertyName( GEOM::Material );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Material )).toString().toStdString());
}
- if (aProps.contains(EDGE_WIDTH_PROP)) {
- param = occParam + EDGE_WIDTH_PROP;
- ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::LineWidth ))) {
+ param = occParam + GEOM::propertyName( GEOM::LineWidth );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::LineWidth )).toString().toStdString());
}
- if (aProps.contains(ISOS_WIDTH_PROP)) {
- param = occParam + ISOS_WIDTH_PROP;
- ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::IsosWidth ))) {
+ param = occParam + GEOM::propertyName( GEOM::IsosWidth );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
}
} // object iterator
} // for (views)
{
// visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
// '_' is used as separator and should not be used in viewer type or parameter names.
- QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts);
+ QStringList lst = QString((*namesIt).c_str()).split( GEOM::sectionSeparator(), QString::SkipEmptyParts);
if (lst.size() != 3)
continue;
}
QString val((*valuesIt).c_str());
- if (paramNameStr == VISIBILITY_PROP) {
- aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0);
- } else if (paramNameStr == OPACITY_PROP) {
- aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
- } else if (paramNameStr == TRANSPARENCY_PROP) {
- aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() );
- } else if (paramNameStr == TOP_LEVEL_PROP) {
- aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False );
- } else if (paramNameStr == DISPLAY_MODE_PROP) {
- aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
- } else if (paramNameStr == ISOS_PROP) {
- aListOfMap[viewIndex].insert( ISOS_PROP, val);
- } else if (paramNameStr == COLOR_PROP) {
- QStringList rgb = val.split(DIGIT_SEPARATOR);
+ if (paramNameStr == GEOM::propertyName( GEOM::Visibility )) {
+ aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Visibility ), val == "On");
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Opacity )) {
+ aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Transparency ), 1. - val.toDouble());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Transparency )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Transparency ), val.toDouble() );
+ } else if (paramNameStr == GEOM::propertyName( GEOM::TopLevel )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::TopLevel ), val.toInt() ? Standard_True : Standard_False );
+ } else if (paramNameStr == GEOM::propertyName( GEOM::DisplayMode )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::DisplayMode ), val.toInt());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::NbIsos )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::NbIsos ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Color )) {
+ QStringList rgb = val.split(GEOM::subSectionSeparator());
if (rgb.count() == 3) {
- QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255));
- aListOfMap[viewIndex].insert( COLOR_PROP, c);
+ QColor c = QColor::fromRgbF(rgb[0].toDouble(), rgb[1].toDouble(), rgb[2].toDouble());
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Color ), c);
}
- } else if (paramNameStr == VECTOR_MODE_PROP) {
- aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt());
- } else if (paramNameStr == DEFLECTION_COEFF_PROP) {
- aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
- } else if (paramNameStr == MARKER_TYPE_PROP) {
- aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
- } else if (paramNameStr == MATERIAL_PROP) {
- aListOfMap[viewIndex].insert( MATERIAL_PROP, val);
- } else if (paramNameStr == EDGE_WIDTH_PROP) {
- aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP, val);
- } else if (paramNameStr == ISOS_WIDTH_PROP) {
- aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP, val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::EdgesDirection )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val.toInt());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Deflection ), val.toDouble());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::PointMarker )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::PointMarker ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Material )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Material ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::LineWidth )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt());
}
} // for names/parameters iterator
appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
//Get Visibility property of the current PropMap
- if (aListOfMap[index].value(VISIBILITY_PROP) == 1) {
+ if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
SUIT_ViewManager* vman = lst.at(index);
SUIT_ViewModel* vmodel = vman->getViewModel();
displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
SUIT_ViewWindow* window = app->desktop()->activeWindow();
if ( !window ) return;
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+ bool isOCC = window->getViewManager()->getType() == OCCViewer_Viewer::Type();
+ bool isVTK = window->getViewManager()->getType() == SVTK_Viewer::Type();
// get view id
int mgrId = window->getViewManager()->getGlobalId();
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
// get view id
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if ( isVTK ) {
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
// get initial color (use first object from selection)
SVTK_View* aView = vtkVW->getView();
QColor color = aView->GetColor( selected.First() );
- QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+ QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
// show Choose Color dialog box
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
QColor color = QColor((int)( aColor.Red() * 255.0 ),
(int)( aColor.Green() * 255.0 ),
(int)( aColor.Blue() * 255.0 ));
- QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+ QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
// show Choose Color dialog box
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
{
// get material property
QString matProp;
- matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+ matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
Material_Model material;
material.fromProperties( matProp );
// change color only for shapes with not physical type of material
if ( !material.isPhysical() ) {
view->SetColor( IO, color );
- study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+ study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
}
// store color to GEOM_Object
// get material property
QString matProp;
- matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+ matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
Material_Model material;
material.fromProperties( matProp );
io->Redisplay( Standard_True );
- study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+ study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
}
// store color to GEOM_Object
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
ic->InitCurrent();
if ( ic->MoreCurrent() ) {
}
for(; ic->MoreCurrent(); ic->NextCurrent()) {
- int aMgrId = window->getViewManager()->getGlobalId();
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
- QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
+ QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ) , QVariant() );
int width = v.isValid() ? v.toInt() : 1;
ic->SetLocalAttributes(CurObject, CurDrawer);
ic->Redisplay(CurObject);
- QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
- aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
+ QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
+ aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
}
}
GeometryGUI::Modified();
if ( !vtkVW )
return;
+ int aMgrId = window->getViewManager()->getGlobalId();
+
SALOME_View* view = GEOM_Displayer::GetActiveView();
vtkActorCollection* aCollection = vtkActorCollection::New();
anActor->SetNbIsos(aIsos);
anActor->StoreIsoNumbers();
- QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
- int aMgrId = window->getViewManager()->getGlobalId();
- aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_PROP, anIsos);
+ QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
+ aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
}
anAct = aCollection->GetNextActor();
}
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if (isOCC) { // if is OCCViewer
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
ic->Redisplay(CurObject);
- appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aNewDC);
+ appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aNewDC);
}
}
}
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetDeflection(aDC);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aDC);
+ appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC);
}
anAct = aCollection->GetNextActor();
}
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if (isOCC) { // if is OCCViewer
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
ic->Redisplay(cur);
}
}
- appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth);
+ appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aNewWidth);
}
}
}
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetWidth(aWidth);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth);
+ appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth);
}
anAct = aCollection->GetNextActor();
}
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
ic->InitCurrent();
if ( ic->MoreCurrent() ) {
return;
for(; ic->MoreCurrent(); ic->NextCurrent()) {
- int aMgrId = window->getViewManager()->getGlobalId();
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
ic->Redisplay(CurObject);
- aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+ aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
}
GeometryGUI::Modified();
}
if ( !vtkVW )
return;
+ int aMgrId = window->getViewManager()->getGlobalId();
+
SALOME_View* view = GEOM_Displayer::GetActiveView();
vtkActorCollection* aCollection = vtkActorCollection::New();
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetIsosWidth(aWidth);
- int aMgrId = window->getViewManager()->getGlobalId();
- aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+ aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
}
anAct = aCollection->GetNextActor();
}
if ( isOCC ) {
GEOMBase* gb = new GEOMBase();
Handle(GEOM_AISShape) aisShape;
+ int aMgrId = window->getViewManager()->getGlobalId();
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
SALOME_ListIO anIOlst;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
if ( !aisShape.IsNull() ) {
+ appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked );
aisShape->setTopLevel(checked);
- int aMgrId = window->getViewManager()->getGlobalId();
- appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), TOP_LEVEL_PROP, checked );
anIOlst.Append(aisShape->getIO());
}
} // for...
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
SALOME_ListIO anIOlst;
AIS_ListOfInteractive aList;
if(CurObject.IsNull())
continue;
+ appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), GEOM::propertyName( GEOM::TopLevel ), Standard_False );
CurObject->setTopLevel(Standard_False);
-
- int aMgrId = window->getViewManager()->getGlobalId();
- appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), TOP_LEVEL_PROP, Standard_False );
anIOlst.Append(CurObject->getIO());
}
disp->Redisplay(anIOlst);
if ( selected.IsEmpty() )
return;
SUIT_ViewWindow* window = app->desktop()->activeWindow();
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
// convert needed material properties to the string representation
Material_Model aModel;
// set material property to the presentation
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
// store chosen material in the property map
- study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
// set correct color for the non-physical material
}
aView->Repaint();
// Return to the default facing mode
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
// store chosen material in the property map
- study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
//if ( aisShape->DisplayMode() != AIS_Shaded)
ic->Redisplay( aisShape, Standard_False );
}