From: asl Date: Mon, 15 Jun 2015 07:57:19 +0000 (+0300) Subject: Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc X-Git-Tag: v1.4.1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=419118d6b16f91ec37912b242cfe7469a585d16e;p=modules%2Fhydro.git Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc Conflicts: src/HYDROData/HYDROData_CalculationCase.cxx --- 419118d6b16f91ec37912b242cfe7469a585d16e diff --cc src/HYDROData/HYDROData_CalculationCase.cxx index 56f5259a,bfed4f10..5ab5b309 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@@ -1126,9 -1192,56 +1192,10 @@@ bool HYDROData_CalculationCase::Export return true; } - void HYDROData_CalculationCase::ClearRules( const bool theIsSetToUpdate ) -GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM( - GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - const TopoDS_Shape& theShape, const QString& theName, - QString& theGeomObjEntry ) const -{ - theGeomObjEntry = ""; - GEOM::GEOM_Object_var aGeomObj; - - if ( theGeomEngine->_is_nil() || theStudy->_is_nil() || - theShape.IsNull() ) { - return aGeomObj._retn(); - } - - std::ostringstream aStreamShape; - // Write TopoDS_Shape in ASCII format to the stream - BRepTools::Write( theShape, aStreamShape ); - // Returns the number of bytes that have been stored in the stream's buffer. - int aSize = aStreamShape.str().size(); - // Allocate octect buffer of required size - CORBA::Octet* anOctetBuf = SALOMEDS::TMPFile::allocbuf( aSize ); - // Copy ostrstream content to the octect buffer - memcpy( anOctetBuf, aStreamShape.str().c_str(), aSize ); - // Create TMPFile - SALOMEDS::TMPFile_var aSeqFile = new SALOMEDS::TMPFile( aSize, aSize, anOctetBuf, 1 ); - - // Restore shape from the stream and get the GEOM object - GEOM::GEOM_IInsertOperations_var anInsOp = theGeomEngine->GetIInsertOperations( theStudy->StudyId() ); - aGeomObj = anInsOp->RestoreShape( aSeqFile ); - - // Puplish the GEOM object - if ( !aGeomObj->_is_nil() ) { - QString aName = HYDROData_GeomTool::GetFreeName( theStudy, theName ); - - SALOMEDS::SObject_var aResultSO = - theGeomEngine->PublishInStudy( theStudy, SALOMEDS::SObject::_nil(), - aGeomObj, qPrintable( aName ) ); - if ( aResultSO->_is_nil() ) { - aGeomObj = GEOM::GEOM_Object::_nil(); - } - else - theGeomObjEntry = aResultSO->GetID(); - } - - return aGeomObj._retn(); -} - + void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag theDataTag, + const bool theIsSetToUpdate ) { - TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules ); + TDF_Label aRulesLab = myLab.FindChild( theDataTag ); HYDROData_PriorityQueue::ClearRules( aRulesLab ); // Indicate model of the need to update splitting diff --cc src/HYDROGUI/HYDROGUI_CalculationOp.cxx index bad592de,f8311d5a..be424729 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@@ -230,9 -211,16 +213,16 @@@ HYDROGUI_InputPanel* HYDROGUI_Calculati connect( aPanel, SIGNAL( removeObjects() ), SLOT( onRemoveObjects() ) ); connect( aPanel, SIGNAL( addGroups() ), SLOT( onAddGroups() ) ); connect( aPanel, SIGNAL( removeGroups() ), SLOT( onRemoveGroups() ) ); + + connect( aPanel, SIGNAL( changeLandCoverMode( int ) ), SLOT( onChangeLandCoverMode( int ) ) ); + connect( aPanel, SIGNAL( addLandCovers() ), SLOT( onAddLandCovers() ) ); + connect( aPanel, SIGNAL( removeLandCovers() ), SLOT( onRemoveLandCovers() ) ); + connect( aPanel, SIGNAL( orderChanged( bool& ) ), SLOT( onOrderChanged( bool& ) ) ); + connect( aPanel, SIGNAL( orderLandCoverChanged( bool& ) ), SLOT( onOrderLandCoverChanged( bool& ) ) ); + connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) ); - connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) ); + connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onBack( const int ) ) ); //connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) ); connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) ); connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList& ) ), diff --cc src/HYDROGUI/HYDROGUI_DataModel.cxx index 956015e6,06a0ab41..61f5453c --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@@ -1132,20 -1203,3 +1196,20 @@@ bool HYDROGUI_DataModel::rename( Handle } return true; } + +void HYDROGUI_DataModel::setObjectVisibilityState( Handle(HYDROData_Entity) theModelObject, + HYDROGUI_DataObject* theObject ) +{ + SUIT_AbstractModel* treeModel = 0; + LightApp_Application* app = dynamic_cast( module()->application() ); + if ( app ) + treeModel = dynamic_cast( app->objectBrowser()->model() ); + + if ( treeModel ) + { + HYDROGUI_Module* aModule = dynamic_cast( module() ); + bool isVisible = aModule->isObjectVisible( -1, theModelObject ); + Qtx::VisibilityState aVisState = isVisible ? Qtx::ShownState : Qtx::HiddenState; + treeModel->setVisibilityState( theObject->text( theObject->customData( Qtx::IdType ).toInt() ), aVisState, false ); + } - } ++} diff --cc src/HYDROGUI/HYDROGUI_Operations.cxx index 7617747e,0a96e798..3ebae572 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@@ -56,8 -57,10 +57,11 @@@ #include "HYDROGUI_LocalCSOp.h" #include "HYDROGUI_RiverBottomOp.h" #include "HYDROGUI_ProfileInterpolateOp.h" +#include "HYDROGUI_RecognizeContoursOp.h" #include "HYDROGUI_SubmersibleOp.h" + #include "HYDROGUI_StricklerTableOp.h" + #include "HYDROGUI_DuplicateOp.h" + #include "HYDROGUI_LandCoverOp.h" #include #include diff --cc src/HYDROGUI/HYDROGUI_Operations.h index 3e551e0d,e9d10c02..2669cae2 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@@ -107,11 -107,17 +107,18 @@@ enum OperationI RiverBottomContextId, ProfileInterpolateId, + RecognizeContoursId, SubmersibleId, ImportPolylineId, - ExportPolylineId + ExportPolylineId, + ImportStricklerTableFromFileId, + ExportStricklerTableFromFileId, + EditStricklerTableId, + DuplicateStricklerTableId, + + CreateLandCoverId, + EditLandCoverId }; #endif diff --cc src/HYDROGUI/HYDROGUI_Tool.cxx index 7370fa31,45e356eb..c4e6b90b --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@@ -28,8 -28,8 +28,9 @@@ #include #include #include + #include +#include #include #include @@@ -774,39 -791,3 +792,39 @@@ Handle(Image_PixMap) HYDROGUI_Tool::Pix return pix; } + +void HYDROGUI_Tool::DeleteGeomObjects( HYDROGUI_Module* theModule, const QStringList& theEntries ) +{ + QStringList anEntryList; + + // Get active SalomeApp_Study + SalomeApp_Study* aStudy = NULL; + if ( theModule && theModule->getApp() ) { + aStudy = dynamic_cast( theModule->getApp()->activeStudy() ); + } + if ( !aStudy ) { + return; + } + + // Get GEOM engine + GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen(); + if ( aGeomEngine->_is_nil() ) { + return; + } + + // Delete GEOM objects + _PTR(StudyBuilder) aStudyBuilder( aStudy->studyDS()->NewBuilder() ); + foreach ( const QString anEntry, theEntries ) { + _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID( qPrintable(anEntry) ) ); + if ( aSObject ) { + GEOM::GEOM_Object_var aGeomObj = + GEOMBase::GetObjectFromIOR( aSObject->GetIOR().c_str() ); + + if ( !aGeomObj->_is_nil() ) { + aGeomEngine->RemoveObject( aGeomObj ); + } + + aStudyBuilder->RemoveObject( aSObject ); + } + } - } ++}