X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_GroupOnShapeDlg.cxx;h=deeaad22ff1481a30d5eeb513726c2c7683933f1;hp=f4cde4f1b1c3c2323cd9a07ece977c49dbab32ac;hb=70e7642a8cdf2191e246458ec5f8294a6ced6344;hpb=1067ffa6e7e5c394e3a1b17219d8b355a57607cd diff --git a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx index f4cde4f1b..deeaad22f 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // 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 @@ -30,9 +30,11 @@ #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_GEOMGenUtils.h" +#include #include #include +#include #include #include @@ -204,7 +206,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const */ //================================================================================ -static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom) +static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom) { if ( !geom->_is_nil() ) { switch ( geom->GetShapeType() ) { @@ -219,17 +221,18 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom) default: return SMESH::ALL; } _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - GEOM::GEOM_IShapesOperations_var aShapeOp = + GEOM::GEOM_IShapesOperations_wrap aShapeOp = SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId()); if ( geom->GetType() == 37 ) { // geom group - GEOM::GEOM_IGroupOperations_var aGroupOp = + GEOM::GEOM_IGroupOperations_wrap aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); if ( !aGroupOp->_is_nil() ) { + // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom ); GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom ); if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) { - GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( mainShape, ids[0] ); + GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] ); return elementType( member ); } } @@ -237,7 +240,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom) else if ( !aShapeOp->_is_nil() ) { // just a compoud shape GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false ); if ( ids->length() ) { - GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( geom, ids[0] ); + GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] ); return elementType( member ); } } @@ -348,9 +351,17 @@ bool SMESHGUI_GroupOnShapeOp::onApply() //printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() ); group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom ); - if( !group->_is_nil() ) + if( !group->_is_nil() ) { + // set default color for created group + QColor c = SMESH::GetColor( "SMESH", "default_grp_color" ); + SALOMEDS::Color aColor; + aColor.R = c.redF(); + aColor.G = c.greenF(); + aColor.B = c.blueF(); + group->SetColor(aColor); if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( group ) ) anEntryList.append( aSObject->GetID().c_str() ); + } } } SMESHGUI::Modified(); @@ -489,13 +500,13 @@ void SMESHGUI_GroupOnShapeOp::selectionDone() } } - if ( myDlg->myElemGeomBtn->isChecked() ) // elem geomerty selection + if ( myDlg->myElemGeomBtn->isChecked() ) // elem geometry selection { myDlg->myElemGeomList->clear(); myDlg->myElemGeomList->addItems( goodNames ); myElemGeoIDs = goodIds; } - else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geomerty selection + else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geometry selection { myDlg->myNodeGeomList->clear(); myDlg->myNodeGeomList->addItems( goodNames );