- Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
- if ( !anIO.IsNull() ) {
- _PTR(SObject) SO ( aStudy->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 );
- 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 );
- }
- } else if(!hasColor) {
- //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 );
- AISShape->SetShadingColor( aQuanColor );
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
- }
+ Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
+ if ( !anIO.IsNull() ) {
+ _PTR(SObject) SO ( aStudy->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 );
+ 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 );
+ }
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, SalomeApp_Tools::color( aQuanColor ) );
+ } else if( !hasColor ) {
+ //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 );
+ AISShape->SetShadingColor( aQuanColor );
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
+ }
+
+ // ... 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;
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ Handle(TColStd_HArray1OfByte) aTexture =
+#else
+ Handle(Graphic3d_HArray1OfBytes) aTexture =
+#endif
+ GeometryGUI::getTexture(getStudy(), 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 );
+ }
+ }
+ }
+ }
+
+ // get material properties, set material
+ Material_Model material;
+ if ( useStudy ) {
+ // Get material property from study and construct material model
+ material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() );
+ } else {
+ // Get material property from study and construct material model
+ QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
+ material.fromResources( mname );
+ }
+
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
+
+ // Set material for the selected shape
+ AISShape->SetMaterial( material.getMaterialOCCAspect() );
+ if(HasWidth())
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
+ if(HasIsosWidth())
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
+ }