From: asl Date: Fri, 26 Jun 2015 08:09:44 +0000 (+0300) Subject: Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc X-Git-Tag: v1.4.2~25^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00d0017f5e951fb3dd965140d1f16d07d9a49daa;p=modules%2Fhydro.git Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc Conflicts: src/HYDROData/HYDROData_StricklerTable.cxx src/HYDROData/HYDROData_StricklerTable.h src/HYDROGUI/CMakeLists.txt src/HYDROGUI/HYDROGUI_DataModel.cxx src/HYDROGUI/HYDROGUI_DataModel.h src/HYDROGUI/HYDROGUI_Module.h src/HYDROGUI/HYDROGUI_Operations.cxx src/HYDROGUI/HYDROGUI_Operations.h --- 00d0017f5e951fb3dd965140d1f16d07d9a49daa diff --cc src/HYDROData/HYDROData_StricklerTable.cxx index 0e68479d,279ecaea..564b65f1 --- a/src/HYDROData/HYDROData_StricklerTable.cxx +++ b/src/HYDROData/HYDROData_StricklerTable.cxx @@@ -124,33 -125,15 +125,33 @@@ double HYDROData_StricklerTable::Get( c return theDefault; } - void HYDROData_StricklerTable::Set( const TCollection_ExtendedString& theType, double theCoefficient ) + void HYDROData_StricklerTable::Set( const QString& theType, double theCoefficient ) { Handle(TDataStd_NamedData) aMap = Map(); - aMap->SetReal( theType, theCoefficient ); + aMap->SetReal( toExtString( theType ), theCoefficient ); } +void HYDROData_StricklerTable::GetCoefficientRange( double& theMin, double& theMax ) const +{ + theMin = 0; + theMax = 0; + + Handle(TDataStd_NamedData) aMap = Map(); + Standard_Boolean isFirst = Standard_True; + for ( TDataStd_DataMapIteratorOfDataMapOfStringReal it( aMap->GetRealsContainer() ); it.More(); it.Next() ) { + Standard_Real aValue = it.Value(); + if ( theMin == 0 || aValue < theMin ) { + theMin = aValue; + } + if ( theMax == 0 || aValue > theMax ) { + theMax = aValue; + } + } +} + - TColStd_SequenceOfExtendedString HYDROData_StricklerTable::GetTypes() const + QStringList HYDROData_StricklerTable::GetTypes() const { - TColStd_SequenceOfExtendedString aSeq; + QStringList aSeq; Handle(TDataStd_NamedData) aMap = Map(); if ( !aMap.IsNull() ) { diff --cc src/HYDROData/HYDROData_StricklerTable.h index 856786c7,a70e9f71..080422ed --- a/src/HYDROData/HYDROData_StricklerTable.h +++ b/src/HYDROData/HYDROData_StricklerTable.h @@@ -48,14 -48,10 +48,14 @@@ public HYDRODATA_EXPORT bool Import( const TCollection_AsciiString& theFileName ); HYDRODATA_EXPORT bool Export( const TCollection_AsciiString& theFileName ); - HYDRODATA_EXPORT double Get( const TCollection_ExtendedString& theType, double theDefault ) const; - HYDRODATA_EXPORT void Set( const TCollection_ExtendedString& theType, double theCoefficient ); + HYDRODATA_EXPORT double Get( const QString& theType, double theDefault ) const; + HYDRODATA_EXPORT void Set( const QString& theType, double theCoefficient ); + HYDRODATA_EXPORT QStringList GetTypes() const; + HYDRODATA_EXPORT void GetCoefficientRange( double& theMin, double& theMax ) const; + - HYDRODATA_EXPORT TColStd_SequenceOfExtendedString GetTypes() const; + + HYDRODATA_EXPORT bool HasType( const TCollection_ExtendedString& theType ) const; HYDRODATA_EXPORT void Clear(); diff --cc src/HYDROGUI/CMakeLists.txt index b0363832,2f647b72..ce49d5f5 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@@ -18,7 -18,6 +18,7 @@@ set(PROJECT_HEADER HYDROGUI_DataModel.h HYDROGUI_DataModelSync.h HYDROGUI_DataObject.h - HYDROGUI_DataOwner.h ++ HYDROGUI_DataOwner.h HYDROGUI_DeleteDlg.h HYDROGUI_DeleteOp.h HYDROGUI_DigueDlg.h @@@ -129,11 -119,7 +129,12 @@@ HYDROGUI_RiverBottomOp.h HYDROGUI_ViewerDlg.h HYDROGUI_ObjComboBox.h + HYDROGUI_PolylineExtractionOp.h + HYDROGUI_ObjListBox.h + HYDROGUI_RecognizeContoursDlg.h + HYDROGUI_RecognizeContoursOp.h + HYDROGUI_LandCoverColoringOp.h - HYDROGUI_ShapeLandCover.h ++ HYDROGUI_ShapeLandCover.h ) QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) @@@ -154,7 -140,6 +155,7 @@@ set(PROJECT_SOURCE HYDROGUI_DataModel.cxx HYDROGUI_DataModelSync.cxx HYDROGUI_DataObject.cxx - HYDROGUI_DataOwner.cxx ++ HYDROGUI_DataOwner.cxx HYDROGUI_DeleteDlg.cxx HYDROGUI_DeleteOp.cxx HYDROGUI_DigueDlg.cxx @@@ -220,10 -198,8 +221,10 @@@ HYDROGUI_LineEditDoubleValidator.cxx HYDROGUI_StricklerTableDlg.cxx HYDROGUI_StricklerTableOp.cxx - HYDROGUI_LandCoverDlg.cxx - HYDROGUI_LandCoverOp.cxx + HYDROGUI_LandCoverDlg.cxx + HYDROGUI_LandCoverOp.cxx + HYDROGUI_SplitPolylinesDlg.cxx + HYDROGUI_SplitPolylinesOp.cxx HYDROGUI_SubmersibleOp.cxx HYDROGUI_Tool.cxx HYDROGUI_TwoImagesDlg.cxx @@@ -266,11 -242,7 +267,12 @@@ HYDROGUI_RiverBottomOp.cxx HYDROGUI_ViewerDlg.cxx HYDROGUI_ObjComboBox.cxx + HYDROGUI_PolylineExtractionOp.cxx + HYDROGUI_ObjListBox.cxx + HYDROGUI_RecognizeContoursDlg.cxx + HYDROGUI_RecognizeContoursOp.cxx + HYDROGUI_LandCoverColoringOp.cxx - HYDROGUI_ShapeLandCover.cxx ++ HYDROGUI_ShapeLandCover.cxx ) add_definitions( diff --cc src/HYDROGUI/HYDROGUI_DataModel.cxx index 6255c5e5,aed8f8a7..88bb35b2 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@@ -1221,19 -1233,11 +1235,28 @@@ bool HYDROGUI_DataModel::rename( Handle return true; } + void HYDROGUI_DataModel::updateDocument() + { + // Sets the default strickler coefficient from preferences to document. + Handle(HYDROData_Document) aDoc = getDocument(); + SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr(); + if ( resMgr && !aDoc.IsNull() ) - aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( "preferences", "default_strickler_coefficient", 0 ) ); ++ aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( "preferences", "default_strickler_coefficient", 0 ) ); ++} ++ +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_DataModel.h index 6707dd2e,caaa234d..33d6a07f --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@@ -369,15 -374,8 +374,17 @@@ protected static SUIT_DataObject* findChildByName( const SUIT_DataObject* theFather, const QString& theName ); + void updateDocument(); + + /** + * Set object visibility state. + * \param theModelObject the data model object + * \param theDataObject the GUI object + */ + void setObjectVisibilityState( Handle(HYDROData_Entity) theModelObject, + HYDROGUI_DataObject* theObject ); + + protected: QString myStudyURL; ///< the saved/opened document URL QByteArray myStates; diff --cc src/HYDROGUI/HYDROGUI_Module.h index 381bf95d,28020c12..1b3523f1 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@@ -214,40 -207,8 +217,42 @@@ public */ QCursor getPrefEditCursor() const; + void clearCache(); + + /** + * Returns Strickler table used for Land Cover scalar map coloring in the given view. + * @param theViewId the view id + * @return the Strickler table used for scalar map coloring of Land Covers in the given view; + null - if scalar map coloring is off for the view + */ + Handle(HYDROData_StricklerTable) getLandCoverColoringTable( const int theViewId ) const; + + /** + * Set Strickler table to be used for Land Cover scalar map coloring in the given view. + * @param theViewId the view id + * @param theTable the Strickler table + */ + void setLandCoverColoringTable( const int theViewId, + const Handle(HYDROData_StricklerTable)& theTable ); + /** + * Set Land Cover scalar map coloring mode off for the given view. + * @param theViewId the view id + */ + void setLandCoversScalarMapModeOff( const int theViewId ); + + /** + * Check if Land Cover scalar map coloring mode is on in the given view. + * @param theViewId the view id + * @return true if the mode is on, false if the mode is off + */ + bool isLandCoversScalarMapModeOn( const int theViewId ) const; + + /** + * Set object as removed. + * @param theObject the removed object + */ + void setObjectRemoved( const Handle(HYDROData_Entity)& theObject ); + protected: CAM_DataModel* createDataModel(); diff --cc src/HYDROGUI/HYDROGUI_Operations.cxx index 3ede1f21,109b1a55..be2b9cdb --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@@ -63,11 -61,7 +63,12 @@@ #include "HYDROGUI_StricklerTableOp.h" #include "HYDROGUI_DuplicateOp.h" #include "HYDROGUI_LandCoverOp.h" + #include "HYDROGUI_PolylineExtractionOp.h" +#include "HYDROGUI_ExportSinusXOp.h" +#include "HYDROGUI_MergePolylinesOp.h" +#include "HYDROGUI_SplitPolylinesOp.h" +#include "HYDROGUI_LandCoverColoringOp.h" +#include "HYDROGUI_ImportLandCoverOp.h" #include #include @@@ -212,13 -201,9 +213,14 @@@ void HYDROGUI_Module::createActions( createAction( ProfileInterpolateId, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" ); createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" ); - createAction( ExportPolylineId, "EXPORT_POLYLINE", "EXPORT_POLYLINE_ICO" ); + createAction( ExportToShapeFileID, "EXPORT_TO_SHAPE_FILE", "EXPORT_TO_SHAPE_FILE_ICO" ); + ++ createAction( PolylineExtractionId, "POLYLINE_EXTRACTION" ); + createAction( SplitPolylinesId, "SPLIT_POLYLINES", "SPLIT_POLYLINES_ICO" ); + createAction( MergePolylinesId, "MERGE_POLYLINES", "MERGE_POLYLINES_ICO" ); - createAction( PolylineExtraction, "POLYLINE_EXTRACTION" ); + createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" ); + createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" ); } void HYDROGUI_Module::createMenus() @@@ -615,16 -575,9 +617,19 @@@ LightApp_Operation* HYDROGUI_Module::cr case SubmersibleId: anOp = new HYDROGUI_SubmersibleOp( aModule ); break; - case PolylineExtraction: ++ case PolylineExtractionId: + anOp = new HYDROGUI_PolylineExtractionOp( aModule ); + break; + case SplitPolylinesId: + anOp = new HYDROGUI_SplitPolylinesOp( aModule ); + break; + case MergePolylinesId: + anOp = new HYDROGUI_MergePolylinesOp( aModule ); + break; + case LandCoverScalarMapModeOnId: + case LandCoverScalarMapModeOffId: + anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId ); + break; } if( !anOp ) diff --cc src/HYDROGUI/HYDROGUI_Operations.h index fc190847,ab4219ac..37d02053 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@@ -124,11 -119,7 +124,12 @@@ enum OperationI CreateLandCoverId, EditLandCoverId, - PolylineExtraction ++ PolylineExtractionId, + SplitPolylinesId, + MergePolylinesId, + + LandCoverScalarMapModeOnId, - LandCoverScalarMapModeOffId ++ LandCoverScalarMapModeOffId, }; #endif diff --cc src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 72951f5e,75dfb7f2..0a470c97 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@@ -1047,9 -1011,14 +1047,14 @@@ Would you like to remove all reference Submersible - DSK_EXPORT_POLYLINE - Export Polyline + DSK_EXPORT_TO_SHAPE_FILE + Export to Shape file + + DSK_POLYLINE_EXTRACTION + Extracts the polyline from selected object + + MEN_CREATE_CALCULATION Create calculation case @@@ -1367,9 -1308,13 +1372,13 @@@ Submersible - MEN_EXPORT_POLYLINE - Export Polyline + MEN_EXPORT_TO_SHAPE_FILE + Export to Shape file + + MEN_POLYLINE_EXTRACTION + Polyline extraction + STB_CREATE_CALCULATION @@@ -2966,120 -2737,13 +2979,128 @@@ Polyline should consist from one not cl Can't obtain stream oject \"%1\" + + + HYDROGUI_RecognizeContoursDlg + + NAME + Name + + + ORIGINAL_IMAGE + Original image + + + RECOGNIZED_POLYLINES + Polylines + + + + + HYDROGUI_RecognizeContoursOp + + CONTOURS_RECOGNITION + Contours recognition + + + NO_DETECTED_CONTOURS + No contours were detected. + + + + + HYDROGUI_SplitPolylinesOp + + SPLIT_POLYLINES + Split polylines + + + + + HYDROGUI_SplitPolylinesDlg + + POLYLINES + Polylines + + + POINT + Point + + + POLYLINE + Polyline + + + TOOL_POLYLINE + Tool polyline + + + SPLIT_POLYLINES + Split polylines + + + BY_POINT + By point + + + BY_TOOL + By tool + + + COMPLETE_SPLIT + Complete split + + + RESULT_NAME + Result name prefix: + + + + + HYDROGUI_MergePolylinesDlg + + POLYLINES + Polylines + + + MERGE_POLYLINES + Merge polylines + + + RESULT_NAME + Result name: + + + IS_CONNECT + Connect by a new segment + + + + HYDROGUI_MergePolylinesOp + + MERGE_POLYLINES + Merge polylines + + + + + HYDROGUI_ObjListBox + + INCLUDE + Include + + + EXCLUDE + Exclude + + + + HYDROGUI_PolylineExtractionOp + + POLYLINE_EXTRACTION + Polyline extraction + + +