X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGEOM_Displayer.cxx;h=cc78136fe4ce7ca1664512abc597d5c79fc2d2eb;hb=b6f0965afb72083a5234f9b4fb0b233adaaf8d9d;hp=bd364b92cdc2a3b35c94865f44f1334136307382;hpb=12d2cd28a6a9975ca7521f27ca1891f0f82d2323;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx old mode 100755 new mode 100644 index bd364b92c..cc78136fe --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -92,7 +92,7 @@ #include #include #include -#include +//#include #include #include #include @@ -118,6 +118,7 @@ #include #include +#include // CORBA Headers #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) @@ -125,6 +126,10 @@ #include +#if OCC_VERSION_LARGE >= 0x070400ff +#include +#endif + // If the next macro is defined, autocolor feature works for all sub-shapes; // if it is undefined, autocolor feature works for groups only #define GENERAL_AUTOCOLOR @@ -241,8 +246,12 @@ namespace const Handle(Graphic3d_TextureMap)& aTexture = aAISShape->Attributes()->ShadingAspect()->Aspect()->TextureMap(); if ( aTexture.IsNull() ) continue; - +#if OCC_VERSION_LARGE >= 0x070400ff + Handle(Image_SupportedFormats) aFormats = new Image_SupportedFormats(); + const Handle(Image_PixMap)& aPixmap = aTexture->GetImage(aFormats); +#else const Handle(Image_PixMap)& aPixmap = aTexture->GetImage(); +#endif if ( aPixmap.IsNull() ) continue; @@ -387,7 +396,7 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) //================================================================ SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList* aSubShapes) { - GEOM_CompoundFilter* aFilter; + GEOM_CompoundFilter* aFilter = 0; if(aSubShapes != NULL ) { aFilter = new GEOM_CompoundFilter(getStudy()); @@ -461,16 +470,13 @@ static std::string getName( GEOM::GEOM_BaseObject_ptr object ) * Constructor */ //================================================================= -GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) - : myUpdateColorScale( true ), myIsRedisplayed( false ) +GEOM_Displayer::GEOM_Displayer() + : myUpdateColorScale(true), myIsRedisplayed( false ) { - if( st ) - myApp = dynamic_cast( st->application() ); - else - myApp = 0; + SUIT_Session* session = SUIT_Session::session(); + myApp = dynamic_cast( session->activeApplication() ); /* Shading Color */ - SUIT_Session* session = SUIT_Session::session(); SUIT_ResourceMgr* resMgr = session->resourceMgr(); QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); @@ -779,7 +785,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap 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() ); + anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toUtf8().data(), "GEOM", myName.c_str() ); AISShape->setIO( anIO ); AISShape->SetOwner( anIO ); } @@ -794,7 +800,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1; // get presentation properties - PropMap propMap = getObjectProperties( study, entry, myViewFrame ); + PropMap propMap = getObjectProperties( 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) @@ -833,16 +839,20 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap AISShape->Attributes()->SetLineAspect( anAspect ); // - unfree boundaries color - anAspect = AISShape->Attributes()->UnFreeBoundaryAspect(); - anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : + Handle(Prs3d_LineAspect) aUnFreeBoundaryAspect = + new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); + *aUnFreeBoundaryAspect->Aspect() = *AISShape->Attributes()->UnFreeBoundaryAspect()->Aspect(); + aUnFreeBoundaryAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value() ) ); - AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect ); + AISShape->Attributes()->SetUnFreeBoundaryAspect( aUnFreeBoundaryAspect ); // - free boundaries color - anAspect = AISShape->Attributes()->FreeBoundaryAspect(); - anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : + Handle(Prs3d_LineAspect) aFreeBoundaryAspect = + new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); + *aFreeBoundaryAspect->Aspect() = *AISShape->Attributes()->FreeBoundaryAspect()->Aspect(); + aFreeBoundaryAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value() ) ); - AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); + AISShape->Attributes()->SetFreeBoundaryAspect( aFreeBoundaryAspect ); // - standalone edges color anAspect = AISShape->Attributes()->WireAspect(); @@ -937,14 +947,14 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap aImagePath = GetTexture().c_str(); if ( ! entry.isEmpty() ) { // check that study is active - SalomeApp_Study* study = getActiveStudy(); + SalomeApp_Study* study = getStudy(); 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 propeties map - propMap = getObjectProperties( study, entry, myViewFrame ); + // Update properties map + propMap = getObjectProperties( entry, myViewFrame ); } } } @@ -999,7 +1009,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap int textureId = aList[0].toInt(); Standard_Integer aWidth, aHeight; Handle(TColStd_HArray1OfByte) aTexture = - GeometryGUI::getTexture( study, textureId, aWidth, aHeight ); + GeometryGUI::getTexture( textureId, aWidth, aHeight ); if ( !aTexture.IsNull() ) { Handle(Prs3d_PointAspect) aTextureAspect = new Prs3d_PointAspect( HasColor() ? @@ -1050,7 +1060,7 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create ) else if ( !myName.empty() ) { // workaround to allow selection of temporary objects static int tempId = 0; - anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() ); + anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toUtf8().data(), "GEOM", myName.c_str() ); actor->setIO( anIO ); } @@ -1062,7 +1072,7 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create ) int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1; // get presentation properties - PropMap propMap = getObjectProperties( study, entry, myViewFrame ); + PropMap propMap = getObjectProperties( entry, myViewFrame ); QColor c; ///////////////////////////////////////////////////////////////////////// @@ -1276,7 +1286,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t } else { - aRecords.LoadFromAttribute( getStudy(), theIO->getEntry() ); + aRecords.LoadFromAttribute( theIO->getEntry() ); } // create up-to-date dimension presentations @@ -1346,12 +1356,21 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t if ( aUnitsAngle == "deg" ) { aPrs->SetSpecialSymbol(0xB0); +#if OCC_VERSION_LARGE >= 0x070400ff + aPrs->SetDisplaySpecialSymbol( isUnitsShown ? PrsDim_DisplaySpecialSymbol_After : + PrsDim_DisplaySpecialSymbol_No ); +#else aPrs->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No ); +#endif aStyle->MakeUnitsDisplayed(Standard_False); } else { +#if OCC_VERSION_LARGE >= 0x070400ff + aPrs->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No); +#else aPrs->SetDisplaySpecialSymbol(AIS_DSS_No); +#endif aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); } } @@ -1433,7 +1452,7 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, //================================================================= /*! * GEOM_Displayer::Update - * Update OCC presentaion + * Update OCC presentation * [ Reimplemented from SALOME_Displayer ] */ //================================================================= @@ -1568,7 +1587,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) //================================================================= /*! * GEOM_Displayer::Update - * Update VTK presentaion + * Update VTK presentation * [ Reimplemented from SALOME_Displayer ] */ //================================================================= @@ -1672,7 +1691,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) //================================================================= /*! * GEOM_Displayer::BuildPrs - * Build presentation accordint to the current viewer type + * Build presentation according to the current viewer type */ //================================================================= SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) @@ -1701,7 +1720,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) //================================================================= /*! * GEOM_Displayer::BuildPrs - * Build presentation accordint to the current viewer type + * Build presentation according to the current viewer type */ //================================================================= SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) @@ -1745,55 +1764,50 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, if ( prs ) { Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject(); - theIO->setEntry( entry.toLatin1().constData() ); + theIO->setEntry( entry.toUtf8().constData() ); if ( !theIO.IsNull() ) { // set interactive object setIO( theIO ); // Find SOBject (because shape should be published previously) - SUIT_Session* session = SUIT_Session::session(); - SUIT_Application* app = session->activeApplication(); - if ( app ) + if ( getStudy() ) { - SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); - if ( study ) + _PTR(SObject) SO ( getStudy()->studyDS()->FindObjectID( theIO->getEntry() ) ); + if ( SO ) //GeometryGUI::IsInGeomComponent( SO )) { - _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); - if ( SO ) + // get CORBA reference to data object + CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); + if ( !CORBA::is_nil( object ) ) { - // get CORBA reference to data object - CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); - if ( !CORBA::is_nil( object ) ) + // downcast to GEOM base object + GEOM::GEOM_BaseObject_var GeomBaseObject = GEOM::GEOM_BaseObject::_narrow( object ); + if ( !GeomBaseObject->_is_nil() ) { - // downcast to GEOM base object - GEOM::GEOM_BaseObject_var GeomBaseObject = GEOM::GEOM_BaseObject::_narrow( object ); - if ( !GeomBaseObject->_is_nil() ) - { - myType = GeomBaseObject->GetType(); + myType = GeomBaseObject->GetType(); - // downcast to GEOM object - GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject ); - if ( myType == GEOM_FIELD_STEP ) + // downcast to GEOM object + GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject ); + if ( myType == GEOM_FIELD_STEP ) + { + // get the GEOM object from the field's shape + GEOM::GEOM_FieldStep_var GeomFieldStep = GEOM::GEOM_FieldStep::_narrow( GeomBaseObject ); + if ( !GeomFieldStep->_is_nil() ) { - // get the GEOM object from the field's shape - GEOM::GEOM_FieldStep_var GeomFieldStep = GEOM::GEOM_FieldStep::_narrow( GeomBaseObject ); - if ( !GeomFieldStep->_is_nil() ) - { - GEOM::GEOM_Field_var GeomField = GeomFieldStep->GetField(); - if ( !GeomField->_is_nil() ) - GeomObject = GeomField->GetShape(); - } - - // read the field step information - readFieldStepInfo( GeomFieldStep ); + GEOM::GEOM_Field_var GeomField = GeomFieldStep->GetField(); + if ( !GeomField->_is_nil() ) + GeomObject = GeomField->GetShape(); } - if ( !GeomObject->_is_nil() ) - { - theIO->setName( GeomObject->GetName() ); + // read the field step information + readFieldStepInfo( GeomFieldStep ); + } + + if ( !GeomObject->_is_nil() ) + { + CORBA::String_var name = GeomObject->GetName(); + theIO->setName( name ); // finally set shape setShape( GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); - } } } } @@ -1829,7 +1843,7 @@ SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape if (prs) { Handle(SALOME_InteractiveObject) theIO = new SALOME_InteractiveObject(); - theIO->setEntry(entry.toLatin1().constData()); + theIO->setEntry(entry.toUtf8().constData()); if (!theIO.IsNull()) { // set interactive object @@ -1969,27 +1983,26 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, if ( theModes.Contains( GEOM_ALLOBJECTS ) ) return; - SUIT_SelectionFilter* aFilter; - if ( theModes.Extent() == 1 ) - { - int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key(); - - if ( aMode == GEOM_COMPOUNDFILTER ) - aFilter = getComplexFilter( theSubShapes ); - else - aFilter = getFilter( aMode ); - } - else if ( theModes.Extent() > 1 ) + SUIT_SelectionFilter* aFilter = NULL; + if ( theModes.Extent() > 0 ) { TColStd_MapOfInteger aTopAbsModes; TColStd_MapIteratorOfMapOfInteger anIter( theModes ); QList aListOfFilters; for ( ; anIter.More(); anIter.Next() ) { - SUIT_SelectionFilter* aFilter; + SUIT_SelectionFilter* aFilter = 0; int aMode = anIter.Key(); if ( aMode == GEOM_COMPOUNDFILTER ) aFilter = getComplexFilter( theSubShapes ); + if ( aMode == GEOM_COMPOUND ) { + // always add COMPSOLID filter together with COMPOUND filter + aFilter = new GEOM_TypeFilter( getStudy(), TopAbs_COMPSOLID, true ); + aListOfFilters.append( aFilter ); + + // add the COMPOUND filter itself + aFilter = getFilter( aMode ); + } else aFilter = getFilter( aMode ); @@ -1997,7 +2010,8 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, aListOfFilters.append( aFilter ); } - aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); + if (aListOfFilters.size() > 1) + aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); } else return; @@ -2056,8 +2070,8 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) Handle(AIS_InteractiveContext) ic = vf->getAISContext(); if ( !ic.IsNull() ) { - if ( ic->HasOpenedContext() ) - ic->CloseAllContexts(Standard_True); + ic->Deactivate(); + ic->Activate( 0 ); } } } @@ -2365,7 +2379,8 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const { - _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toLatin1() ); + _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() ); + //if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false; GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component @@ -2493,21 +2508,20 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList& th return aSColor; } -PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study, - const QString& entry, +PropMap GEOM_Displayer::getObjectProperties( const QString& entry, SALOME_View* view ) { // get default properties for the explicitly specified default view type PropMap propMap = GEOM_Displayer::getDefaultPropertyMap(); - if ( study && view ) { + if ( getStudy() && view ) { SUIT_ViewModel* viewModel = dynamic_cast( 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->getObjectProperties( viewId, entry ); + PropMap storedMap = getStudy()->getObjectProperties( 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 ) ) ) @@ -2527,8 +2541,8 @@ PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study, if ( !entry.isEmpty() ) { // get CORBA reference to geom object - _PTR(SObject) SO( study->studyDS()->FindObjectID( entry.toStdString() ) ); - if ( SO ) { + _PTR(SObject) SO( getStudy()->studyDS()->FindObjectID( entry.toStdString() ) ); + if ( SO ) { //GeometryGUI::IsInGeomComponent( SO )) { CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO ); if ( !CORBA::is_nil( object ) ) { GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object ); @@ -2683,38 +2697,40 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo aSColor = theGeomObject->GetColor(); hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0; if ( !hasColor ) { + if (!theGeomObject->IsMainShape()) { #ifdef GENERAL_AUTOCOLOR // auto-color for all sub-shapes - bool general_autocolor = true; + bool general_autocolor = true; #else // auto-color for groups only - bool general_autocolor = false; + bool general_autocolor = false; #endif // GENERAL_AUTOCOLOR - if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) { - GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape(); - if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) { + if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) { + GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape(); + if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) { #ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors - aSColor = getPredefinedUniqueColor(); - hasColor = true; + aSColor = getPredefinedUniqueColor(); + hasColor = true; #else // old algorithm for auto-colors - QList aReservedColors; - CORBA::String_var IOR = app->orb()->object_to_string( aMainObject ); - _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) ); - if ( aMainSObject ) { - _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); - for ( ; it->More(); it->Next() ) { - _PTR(SObject) aChildSObject( it->Value() ); - GEOM::GEOM_Object_var aChildObject = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject)); - if ( CORBA::is_nil( aChildObject ) ) - continue; - - SALOMEDS::Color aReservedColor = aChildObject->GetColor(); - if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 ) - aReservedColors.append( aReservedColor ); + QList aReservedColors; + CORBA::String_var IOR = app->orb()->object_to_string( aMainObject ); + _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) ); + if ( aMainSObject ) { + _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); + for ( ; it->More(); it->Next() ) { + _PTR(SObject) aChildSObject( it->Value() ); + GEOM::GEOM_Object_var aChildObject = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject)); + if ( CORBA::is_nil( aChildObject ) ) + continue; + + SALOMEDS::Color aReservedColor = aChildObject->GetColor(); + if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 ) + aReservedColors.append( aReservedColor ); + } } - } - aSColor = getUniqueColor( aReservedColors ); - hasColor = true; + aSColor = getUniqueColor( aReservedColors ); + hasColor = true; #endif // SIMPLE_AUTOCOLOR + } } } } @@ -2725,16 +2741,9 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO, - const bool eraseOnlyChildren) { - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if ( !app ) - return; - - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - if ( !appStudy ) - return; - - LightApp_DataObject* parent = appStudy->findObjectByEntry(theIO->getEntry()); + const bool eraseOnlyChildren) +{ + LightApp_DataObject* parent = getStudy()->findObjectByEntry(theIO->getEntry()); if( !parent) return; @@ -2742,7 +2751,7 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t // Erase from all views QList views; SALOME_View* view; - ViewManagerList vmans = app->viewManagers(); + ViewManagerList vmans = myApp->viewManagers(); SUIT_ViewManager* vman; foreach ( vman, vmans ) { SUIT_ViewModel* vmod = vman->getViewModel(); @@ -2762,7 +2771,7 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t if(l_obj) foreach ( view, views ) { Handle(SALOME_InteractiveObject) anIO = - new SALOME_InteractiveObject(qPrintable(l_obj->entry()), "GEOM", ""); + new SALOME_InteractiveObject(qUtf8Printable(l_obj->entry()), "GEOM", ""); Erase(anIO, false, false, view); } } @@ -2908,7 +2917,10 @@ QList GEOM_Displayer::groupFieldData( const QList& theFieldS aValue = double( aVariant.toLongLong() ); else if( aVariant.type() == QVariant::Double ) aValue = aVariant.toDouble(); - aNorm += aValue * aValue; + if ( theFieldNbComponents > 1 ) + aNorm += aValue * aValue; + else + aNorm += aValue; } } } @@ -2919,7 +2931,7 @@ QList GEOM_Displayer::groupFieldData( const QList& theFieldS { if( anIsBoolean ) aNorm /= theFieldNbComponents; - else + else if ( theFieldNbComponents > 1 ) aNorm = pow( aNorm, 0.5 ); if( aGroupedList.isEmpty() )