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() )
{
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();
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})
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(
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 );
+ }
}
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;
*/
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();
#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>
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()
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 )
CreateLandCoverId,
EditLandCoverId,
- PolylineExtraction
++ PolylineExtractionId,
+ SplitPolylinesId,
+ MergePolylinesId,
+
+ LandCoverScalarMapModeOnId,
- LandCoverScalarMapModeOffId
++ LandCoverScalarMapModeOffId,
};
#endif
<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>
<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>