]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc
authorasl <asl@opencascade.com>
Fri, 26 Jun 2015 08:09:44 +0000 (11:09 +0300)
committerasl <asl@opencascade.com>
Fri, 26 Jun 2015 08:09:44 +0000 (11:09 +0300)
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

16 files changed:
1  2 
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_Document.h
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_LandCoverOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROPy/HYDROData_CalculationCase.sip

Simple merge
index 0e68479d54660cb49495689a2cf3daf0e710de94,279ecaea75d844343183b49c4fa9d3566432a05b..564b65f17663ff834c03a37aef50e267ad0775a9
@@@ -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 );
  }
  
- TColStd_SequenceOfExtendedString HYDROData_StricklerTable::GetTypes() const
 +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;
 +    }
 +  }
 +}
 +
+ QStringList HYDROData_StricklerTable::GetTypes() const
  {
-     TColStd_SequenceOfExtendedString aSeq;
+     QStringList aSeq;
      Handle(TDataStd_NamedData) aMap = Map();
      if ( !aMap.IsNull() )
      {
index 856786c7d574a34af32be557b306b688abf39f3b,a70e9f71e86d68a11870126515cd8fb75e637c30..080422edb9b5d4b4d2fe4bca454d04f297f5d834
@@@ -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 TColStd_SequenceOfExtendedString GetTypes() const;
+   HYDRODATA_EXPORT QStringList GetTypes() const;
 +  HYDRODATA_EXPORT void GetCoefficientRange( double& theMin, double& theMax ) const;
 +
 +
 +  HYDRODATA_EXPORT bool HasType( const TCollection_ExtendedString& theType ) const;
  
    HYDRODATA_EXPORT void Clear();
  
index b036383260559525859a90efe0ce550458bc1074,2f647b72d98b389919c0ee7059faa2290de1653b..ce49d5f592f4cf095ade09eb81e82fa0517322bf
@@@ -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
      HYDROGUI_RiverBottomOp.h
      HYDROGUI_ViewerDlg.h
      HYDROGUI_ObjComboBox.h
-       HYDROGUI_ShapeLandCover.h
+     HYDROGUI_PolylineExtractionOp.h
 +    HYDROGUI_ObjListBox.h
 +    HYDROGUI_RecognizeContoursDlg.h
 +    HYDROGUI_RecognizeContoursOp.h
 +    HYDROGUI_LandCoverColoringOp.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
      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
      HYDROGUI_RiverBottomOp.cxx
      HYDROGUI_ViewerDlg.cxx
      HYDROGUI_ObjComboBox.cxx
-       HYDROGUI_ShapeLandCover.cxx
+     HYDROGUI_PolylineExtractionOp.cxx
 +    HYDROGUI_ObjListBox.cxx
 +    HYDROGUI_RecognizeContoursDlg.cxx
 +    HYDROGUI_RecognizeContoursOp.cxx
 +    HYDROGUI_LandCoverColoringOp.cxx
++    HYDROGUI_ShapeLandCover.cxx
  )
  
  add_definitions(
index 6255c5e5a2548e9c10aff48adf998b887a11c9c2,aed8f8a7a4227a6b7c982ff4f853cd0dc40c6c6a..88bb35b290d435bad73c6dacad67b36ae9b8a32a
@@@ -1221,19 -1233,11 +1235,28 @@@ bool HYDROGUI_DataModel::rename( Handle
    return true;
  }
  
 -        aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( "preferences", "default_strickler_coefficient", 0 ) );
+ 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 ) );
++}
++
 +void HYDROGUI_DataModel::setObjectVisibilityState( Handle(HYDROData_Entity) theModelObject,
 +                                                   HYDROGUI_DataObject* theObject )
 +{
 +  SUIT_AbstractModel* treeModel = 0;
 +  LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
 +  if ( app )
 +    treeModel = dynamic_cast<SUIT_AbstractModel*>( app->objectBrowser()->model() );
 +
 +  if ( treeModel )
 +  {
 +    HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( 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 );
 +  }
  }
index 6707dd2edd8b0cdc4013f6413b689450520ae2eb,caaa234d82b14a59dedb8f9d12a08168be34c674..33d6a07f4886c0a3847e13ec85dc08c5eeedf996
@@@ -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;
Simple merge
Simple merge
index 381bf95da8ebd3bd44de8fc2d573aabb79239fef,28020c12cbfb20f58f610608fd0a2e9a74872eff..1b3523f17cb2c2c82add42cd6cc831ed856e5ba6
@@@ -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();
  
index 3ede1f216c9e16197f7606e7538dee7725c9864d,109b1a55de78cfa9fd7a981e8e9bab284b91ed1a..be2b9cdbdfed1c1ba026abbcbe677749bc4ee6bb
  #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 <HYDROData_Document.h>
  #include <HYDROData_Obstacle.h>
@@@ -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 )
index fc1908471cdb0f02706eae33be88150ebe904609,ab4219acb90604c3f56ab15a1d83f66d488daf97..37d0205378df3670bc5f937836f8927bd22044b2
@@@ -124,11 -119,7 +124,12 @@@ enum OperationI
    CreateLandCoverId,
    EditLandCoverId,
  
 -  PolylineExtraction
++  PolylineExtractionId,
 +  SplitPolylinesId,
 +  MergePolylinesId,
 +
 +  LandCoverScalarMapModeOnId,
-   LandCoverScalarMapModeOffId
++  LandCoverScalarMapModeOffId,
  };
  
  #endif
index 72951f5e95b3b251d31cbfd51901c24152fc69da,75dfb7f26ff96b7c7aed04ca0a855b2f698a6d42..0a470c97d1be4def5438f0f4a26f39a620ea1fea
@@@ -1047,9 -1011,14 +1047,14 @@@ Would you like to remove all reference
        <translation>Submersible</translation>
      </message>
      <message>
 -      <source>DSK_EXPORT_POLYLINE</source>
 -      <translation>Export Polyline</translation>
 +      <source>DSK_EXPORT_TO_SHAPE_FILE</source>
 +      <translation>Export to Shape file</translation>
      </message>
+     <message>
+       <source>DSK_POLYLINE_EXTRACTION</source>
+       <translation>Extracts the polyline from selected object</translation>
+     </message>
      <message>
        <source>MEN_CREATE_CALCULATION</source>
        <translation>Create calculation case</translation>
        <translation>Submersible</translation>
      </message>
      <message>
 -      <source>MEN_EXPORT_POLYLINE</source>
 -      <translation>Export Polyline</translation>
 +      <source>MEN_EXPORT_TO_SHAPE_FILE</source>
 +      <translation>Export to Shape file</translation>
      </message>
+     <message>
+       <source>MEN_POLYLINE_EXTRACTION</source>
+       <translation>Polyline extraction</translation>
+     </message>
  
      <message>
        <source>STB_CREATE_CALCULATION</source>
@@@ -2966,120 -2737,13 +2979,128 @@@ Polyline should consist from one not cl
        <translation>Can't obtain stream oject \"%1\"</translation>
      </message>
    </context>
 +  
 +  <context>
 +    <name>HYDROGUI_RecognizeContoursDlg</name>
 +    <message>
 +      <source>NAME</source>
 +      <translation>Name</translation>
 +    </message>
 +    <message>
 +      <source>ORIGINAL_IMAGE</source>
 +      <translation>Original image</translation>
 +    </message>
 +    <message>
 +      <source>RECOGNIZED_POLYLINES</source>
 +      <translation>Polylines</translation>
 +    </message>
 +  </context>
 +
 +  <context>
 +    <name>HYDROGUI_RecognizeContoursOp</name>
 +    <message>
 +      <source>CONTOURS_RECOGNITION</source>
 +      <translation>Contours recognition</translation>
 +    </message>
 +    <message>
 +      <source>NO_DETECTED_CONTOURS</source>
 +      <translation>No contours were detected.</translation>
 +    </message>
 +  </context>
 +
 +  <context>
 +    <name>HYDROGUI_SplitPolylinesOp</name>
 +    <message>
 +      <source>SPLIT_POLYLINES</source>
 +      <translation>Split polylines</translation>
 +    </message>
 +  </context>
 +
 +  <context>
 +    <name>HYDROGUI_SplitPolylinesDlg</name>
 +    <message>
 +      <source>POLYLINES</source>
 +      <translation>Polylines</translation>
 +    </message>
 +    <message>
 +      <source>POINT</source>
 +      <translation>Point</translation>
 +    </message>
 +    <message>
 +      <source>POLYLINE</source>
 +      <translation>Polyline</translation>
 +    </message>
 +    <message>
 +      <source>TOOL_POLYLINE</source>
 +      <translation>Tool polyline</translation>
 +    </message>
 +    <message>
 +      <source>SPLIT_POLYLINES</source>
 +      <translation>Split polylines</translation>
 +    </message>
 +    <message>
 +      <source>BY_POINT</source>
 +      <translation>By point</translation>
 +    </message>
 +    <message>
 +      <source>BY_TOOL</source>
 +      <translation>By tool</translation>
 +    </message>
 +    <message>
 +      <source>COMPLETE_SPLIT</source>
 +      <translation>Complete split</translation>
 +    </message>
 +    <message>
 +      <source>RESULT_NAME</source>
 +      <translation>Result name prefix:</translation>
 +    </message>
 +  </context>
 +
 +  <context>
 +    <name>HYDROGUI_MergePolylinesDlg</name>
 +    <message>
 +      <source>POLYLINES</source>
 +      <translation>Polylines</translation>
 +    </message>
 +    <message>
 +      <source>MERGE_POLYLINES</source>
 +      <translation>Merge polylines</translation>
 +    </message>
 +    <message>
 +      <source>RESULT_NAME</source>
 +      <translation>Result name:</translation>
 +    </message>
 +    <message>
 +      <source>IS_CONNECT</source>
 +      <translation>Connect by a new segment</translation>
 +    </message>
 +  </context>
 +  <context>
 +    <name>HYDROGUI_MergePolylinesOp</name>
 +    <message>
 +      <source>MERGE_POLYLINES</source>
 +      <translation>Merge polylines</translation>
 +    </message>
 +  </context>
 +
 +  <context>
 +    <name>HYDROGUI_ObjListBox</name>
 +    <message>
 +      <source>INCLUDE</source>
 +      <translation>Include</translation>
 +    </message>
 +    <message>
 +      <source>EXCLUDE</source>
 +      <translation>Exclude</translation>
 +    </message>
 +  </context>
  
+   <context>
+     <name>HYDROGUI_PolylineExtractionOp</name>
+     <message>
+       <source>POLYLINE_EXTRACTION</source>
+       <translation>Polyline extraction</translation>
+     </message>
+   </context>
  </TS>