-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 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
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <SMESH_TypeFilter.hxx>
#include <SMESH_Actor.h>
-#include <SMESH_ActorUtils.h>
+//#include <SMESH_ActorUtils.h>
#include <SMESH_LogicalFilter.hxx>
// SALOME GEOM includes
SMESH::SMESH_Mesh_ptr theMesh )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
myNameChanged( false ),
const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
myNameChanged( false ),
bool isUnique = false;
while (!isUnique) {
aName = theOperation + "_" + QString::number(++aNumber);
- isUnique = (aSet.count(aName.toLatin1().data()) == 0);
+ isUnique = (aSet.count(aName.toUtf8().data()) == 0);
}
return aName;
do
{
aResName = aPrefix + QString::number( i++ );
- anObj = aStudy->FindObject( aResName.toLatin1().data() );
+ anObj = aStudy->FindObject( aResName.toUtf8().data() );
}
while ( anObj );
myName->setText(aResName);
if( !aList.IsEmpty() )
{
QString aName = aList.First()->getName();
- myMeshGroupLine->setText(aName);
+ myMeshGroupLine->setText(aName);//??????
myMeshGroupLine->home( false );
}
myNameChanged = true;
myName->blockSignals(true);
- myName->setText(theGroup->GetName());
+ myName->setText(QString::fromUtf8(theGroup->GetName()));
myName->blockSignals(false);
myName->home(false);
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
- myMeshGroupLine->setText(theGroup->GetName());
+ myMeshGroupLine->setText(QString::fromUtf8(theGroup->GetName()));
int aType = 0;
switch(theGroup->GetType()) {
{
myNameChanged = true;
myName->blockSignals(true);
- myName->setText(theGroup->GetName());
+ myName->setText(QString::fromUtf8(theGroup->GetName()));
myName->blockSignals(false);
}
QStringList anEntryList;
SMESH::SMESH_GroupBase_var resultGroup;
- bool isCreation;
+ bool isCreation, isConversion = false;
if (myGrpTypeId == 0) // standalone
{
else
myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
- myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
+ myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
+ isConversion = true;
}
}
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toLatin1().data(),
+ myName->text().toUtf8().data(),
myGeomObjects[0]);
}
else {
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
- aNewGeomGroupName.toLatin1().data(), aMeshShape);
+ aNewGeomGroupName.toUtf8().data(), aMeshShape);
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toLatin1().data(),
+ myName->text().toUtf8().data(),
aGroupVar);
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
return false;
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
- myName->text().toLatin1().data(),
+ myName->text().toUtf8().data(),
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
myFilter = SMESH::Filter::_nil();
+
+ setDefaultGroupColor(); // reset color for case if 'auto-color' feature is enabled.
}
else
{
- resultGroup->SetName(myName->text().toLatin1().data());
+ resultGroup->SetName(myName->text().toUtf8().data());
if ( aMeshGroupSO )
+ {
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
- anActor->setName(myName->text().toLatin1().data());
+ if ( isConversion ) { // need to reset TVisualObj and actor
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
+ SMESH::Update( anIO,true);
+ myActorsList.clear();
+ anActor = SMESH::FindActorByEntry( anIO->getEntry() );
+ if ( !anActor ) return false;
+ myActorsList.append( anActor );
+ }
+ anActor->setName(myName->text().toUtf8().data());
QColor c;
int delta;
switch ( myTypeId ) {
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpVolumeSelection:
- SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
- anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
- break;
+ SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
+ anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
+ break;
case grpFaceSelection:
default:
- SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
- break;
+ SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
+ break;
}
}
+ }
}
SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true);
if ( onApply() )
reject();
setIsApplyAndClose( false );
+
+ if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
}
//=================================================================================
myElementsLab->setEnabled( !noElemsModif );
myElements->setEnabled ( !noElemsModif );
- myFilterBtn->setEnabled ( !mySelectAll->isChecked() );
+ myFilterBtn->setEnabled ( !noElemsModif );
myAddBtn->setEnabled ( !noElemsModif );
myRemoveBtn->setEnabled ( !noElemsModif );
mySortBtn->setEnabled ( !noElemsModif );
myFilterDlg->Init( aType );
}
- myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSelection();
myFilterDlg->SetSourceWg( myElements, false );
myFilterDlg->show();
mySMESHGUI->ResetState();
QDialog::reject();
+
+ if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
}
//=================================================================================
bool isAutoColor = myMesh->GetAutoColor();
- QColor aQColor;
+ QColor aQColor = myColorBtn->color();
if( !isAutoColor )
{
- int r = 0, g = 0, b = 0;
- SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
- aQColor.setRgb( r, g, b );
+ if ( !aQColor.isValid() ) {
+ int r = 0, g = 0, b = 0;
+ SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
+ aQColor.setRgb( r, g, b );
+ }
}
else
{
+#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
+ SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
+#else // old algorithm for auto-colors
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
QList<SALOMEDS::Color> aReservedColors;
}
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
+#endif // SIMPLE_AUTOCOLOR
+
aQColor.setRgb( (int)( aColor.R * 255.0 ),
(int)( aColor.G * 255.0 ),
(int)( aColor.B * 255.0 ) );