myShadingColor = SalomeApp_Tools::color( col );
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
+
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
+ myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
+ myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1);
+
myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
anAspect->SetNumber( anUIsoNumber );
anAspect->SetColor( aColor );
+ if(HasIsosWidth())
+ anAspect->SetWidth( GetIsosWidth() );
AISShape->Attributes()->SetUIsoAspect( anAspect );
+
anAspect = AISShape->Attributes()->VIsoAspect();
anAspect->SetNumber( aVIsoNumber );
+ if(HasIsosWidth())
+ anAspect->SetWidth( GetIsosWidth() );
anAspect->SetColor( aColor );
AISShape->Attributes()->SetVIsoAspect( anAspect );
anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
anAspect->SetColor( aColor );
AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
+ AISShape->storeBoundaryColors();
// Set free boundaries aspect
col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) );
double aDC = 0;
if(useStudy) {
aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
+ SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
+ SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
}
else {
aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
}
}
}
- }
- // get material properties, set material
- Material_Model* aModelF = 0;
- Material_Model* aModelB = 0;
- if ( useStudy ) {
- // Get front material property from study and construct front material model
- QString aMaterialF = aPropMap.value(FRONT_MATERIAL_PROP).toString();
- QStringList aProps = aMaterialF.split(DIGIT_SEPARATOR);
- aModelF = Material_Model::getMaterialModel( aProps );
-
- // Get back material property from study and construct back material model
- QString aMaterialB = aPropMap.value(BACK_MATERIAL_PROP).toString();
- if ( !aMaterialB.isEmpty() ) {
- QStringList aPropsB = aMaterialB.split(DIGIT_SEPARATOR);
- aModelB = Material_Model::getMaterialModel( aPropsB );
- }
- else
- aModelB = aModelF;
+ // get material properties, set material
+ Material_Model* aModelF = 0;
+ Material_Model* aModelB = 0;
+ if ( useStudy ) {
+ // Get front material property from study and construct front material model
+ QString aMaterialF = aPropMap.value(FRONT_MATERIAL_PROP).toString();
+ QStringList aProps = aMaterialF.split(DIGIT_SEPARATOR);
+ aModelF = Material_Model::getMaterialModel( aProps );
+
+ // Get back material property from study and construct back material model
+ QString aMaterialB = aPropMap.value(BACK_MATERIAL_PROP).toString();
+ if ( !aMaterialB.isEmpty() ) {
+ QStringList aPropsB = aMaterialB.split(DIGIT_SEPARATOR);
+ aModelB = Material_Model::getMaterialModel( aPropsB );
+ }
+ else
+ aModelB = aModelF;
- } else {
- // Get front material property from study and construct front material model
- aModelF = new Material_Model();
- aModelF->fromResources( aResMgr, "Geometry", true );
-
- // Get back material property from study and construct back material model
- aModelB = new Material_Model();
- aModelB->fromResources( aResMgr, "Geometry", false );
- }
+ } else {
+ // Get front material property from study and construct front material model
+ aModelF = new Material_Model();
+ aModelF->fromResources( aResMgr, "Geometry", true );
- // Set front material property
- QString aMaterialPropF = aModelF->getMaterialProperty();
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), FRONT_MATERIAL_PROP, aMaterialPropF );
+ // Get back material property from study and construct back material model
+ aModelB = new Material_Model();
+ aModelB->fromResources( aResMgr, "Geometry", false );
+ }
- // Set back material property
- QString aMaterialPropB = aModelB->getMaterialProperty();
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), BACK_MATERIAL_PROP, aMaterialPropB );
+ // Set front material property
+ QString aMaterialPropF = aModelF->getMaterialProperty();
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), FRONT_MATERIAL_PROP, aMaterialPropF );
- // Get front material properties from the model
- Graphic3d_MaterialAspect aMatF = aModelF->getMaterialOCCAspect();
+ // Set back material property
+ QString aMaterialPropB = aModelB->getMaterialProperty();
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), BACK_MATERIAL_PROP, aMaterialPropB );
- // Get back material properties from the model
- Graphic3d_MaterialAspect aMatB = aModelB->getMaterialOCCAspect();
+ // Get front material properties from the model
+ Graphic3d_MaterialAspect aMatF = aModelF->getMaterialOCCAspect();
- // Set front material for the selected shape
- AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
- AISShape->SetMaterial(aMatF);
+ // Get back material properties from the model
+ Graphic3d_MaterialAspect aMatB = aModelB->getMaterialOCCAspect();
- // Set back material for the selected shape
- AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
- AISShape->SetMaterial(aMatB);
+ // Set front material for the selected shape
+ AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
+ AISShape->SetMaterial(aMatF);
- // Return to the default facing mode
- AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
+ // Set back material for the selected shape
+ AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
+ AISShape->SetMaterial(aMatB);
- // Release memory
- if ( aModelF )
- delete aModelF;
- if ( aModelB )
- delete aModelB;
+ // Return to the default facing mode
+ AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
+
+ // Release memory
+ if ( aModelF )
+ delete aModelF;
+ if ( aModelB )
+ delete aModelB;
+ if(HasWidth())
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
+
+ if(HasIsosWidth())
+ aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
+
+
+ }
// AISShape->SetName(???); ??? necessary to set name ???
occPrs->AddObject( AISShape );
aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
}
- if ( HasWidth() )
- {
- aProp->SetLineWidth( GetWidth() );
- }
-
while ( anActor != NULL )
{
SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
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).toInt());
int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
// Specially processing of 'Shading with edges' mode from preferences,
// Release memory
delete aModelB;
+
+ if(HasWidth())
+ aStudy->setObjectProperty( aMgrId, anEntry, EDGE_WIDTH_PROP, GetWidth() );
+
+ if(HasIsosWidth())
+ aStudy->setObjectProperty( aMgrId, anEntry, ISOS_WIDTH_PROP, GetIsosWidth() );
+
}
else {
// Set the same front and back materials for the selected shape
}
}
+ if ( HasWidth() )
+ {
+ aGeomGActor->SetWidth( GetWidth() );
+ }
+
+
+ if ( HasIsosWidth() )
+ {
+ aGeomGActor->SetIsosWidth( GetIsosWidth() );
+ }
+
if ( myToActivate )
GActor->PickableOn();
else
myWidth = -1;
}
+
+int GEOM_Displayer::GetIsosWidth() const
+{
+ return myIsosWidth;
+}
+
+void GEOM_Displayer::SetIsosWidth(const int width)
+{
+ myIsosWidth = width;
+}
+
+bool GEOM_Displayer::HasIsosWidth() const
+{
+ return myIsosWidth != -1;
+}
+
+
//=================================================================
/*!
* GEOM_Displayer::SetToActivate
QString aMaterialF = aModelF.getMaterialProperty();
aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF );
- // Back material
+ //9. Back material
Material_Model aModelB;
aModelB.fromResources( aResMgr, "Geometry", false );
QString aMaterialB = aModelB.getMaterialProperty();
aDefaultMap.insert( BACK_MATERIAL_PROP , aMaterialB );
+ //10. Width of the edges
+ aDefaultMap.insert( EDGE_WIDTH_PROP , aResMgr->integerValue("Geometry", "edge_width", 1));
+
+
+ //11. Width of iso-lines
+ aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1));
+
+
return aDefaultMap;
}
theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP));
nbInserted++;
}
+
+ if(!theOrigin.contains(EDGE_WIDTH_PROP)) {
+ theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP));
+ nbInserted++;
+ }
+
+ if(!theOrigin.contains(ISOS_WIDTH_PROP)) {
+ theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP));
+ nbInserted++;
+ }
+
return (nbInserted > 0);
}