From: eap Date: Mon, 16 Jan 2012 11:25:16 +0000 (+0000) Subject: prevent access to Null anIO X-Git-Tag: V6_5_0a1~94 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f74a6e09936bdd546f6df4a5ef7fab8938fd2c9a;p=modules%2Fgeom.git prevent access to Null anIO --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 94b0d2cd2..ad8b77511 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -942,67 +942,67 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) } } } - } - // 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; + + } // AISShape->SetName(???); ??? necessary to set name ??? occPrs->AddObject( AISShape );