From: asl Date: Fri, 26 Jun 2015 08:01:48 +0000 (+0300) Subject: refs #585: flag in merge operations X-Git-Tag: v1.4.2~25^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b62210e48be9a46b9a7d2c85ecce2fdccefbfa07;p=modules%2Fhydro.git refs #585: flag in merge operations --- diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index e8a7eec8..dff7ce3e 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -107,9 +107,21 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD bool HYDROData_PolylineOperator::Merge( const Handle( HYDROData_Document )& theDoc, const TCollection_AsciiString& theName, - const HYDROData_SequenceOfObjects& thePolylines ) + const HYDROData_SequenceOfObjects& thePolylines, + bool isConnectByNewSegment ) { //TODO + + TopoDS_Shape aMergedPolyline; + + Handle( HYDROData_PolylineXY ) aPolyline = + Handle( HYDROData_PolylineXY )::DownCast( theDoc->CreateObject( KIND_POLYLINEXY ) ); + if( aPolyline.IsNull() ) + return false; + + aPolyline->SetShape( aMergedPolyline ); + //TODO: set name + return true; } diff --git a/src/HYDROData/HYDROData_PolylineOperator.h b/src/HYDROData/HYDROData_PolylineOperator.h index e11c41ba..a76a6af9 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.h +++ b/src/HYDROData/HYDROData_PolylineOperator.h @@ -42,7 +42,8 @@ public: const HYDROData_SequenceOfObjects& thePolylines ); bool Merge( const Handle( HYDROData_Document )& theDoc, const TCollection_AsciiString& theName, - const HYDROData_SequenceOfObjects& thePolylines ); + const HYDROData_SequenceOfObjects& thePolylines, + bool isConnectByNewSegment ); protected: static std::vector GetCurves( const Handle( HYDROData_PolylineXY )& thePolyline ); diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx index 5035aae9..620e8397 100644 --- a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx @@ -22,6 +22,7 @@ #include #include #include +#include HYDROGUI_MergePolylinesDlg::HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle ) : HYDROGUI_InputPanel( theModule, theTitle ) @@ -37,8 +38,11 @@ HYDROGUI_MergePolylinesDlg::HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModu aLayout->addWidget( new QLabel( tr( "RESULT_NAME" ) ), 0, 0 ); aLayout->addWidget( myName, 0, 1 ); + myIsConnect = new QCheckBox( tr( "IS_CONNECT" ), mainFrame() ); + aLayout->addWidget( myIsConnect, 1, 0, 1, 2 ); + myList = new HYDROGUI_ObjListBox( theModule, tr( "POLYLINES" ), KIND_POLYLINEXY, mainFrame() ); - aLayout->addWidget( myList, 1, 0, 1, 2 ); + aLayout->addWidget( myList, 2, 0, 1, 2 ); } HYDROGUI_MergePolylinesDlg::~HYDROGUI_MergePolylinesDlg() @@ -64,3 +68,8 @@ QString HYDROGUI_MergePolylinesDlg::GetResultName() const { return myName->text(); } + +bool HYDROGUI_MergePolylinesDlg::IsConnectByNewSegment() const +{ + return myIsConnect->isChecked(); +} diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h index 9213deff..d0cf3edd 100644 --- a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h @@ -23,6 +23,7 @@ #include class QLineEdit; +class QCheckBox; class HYDROGUI_ObjListBox; class HYDROGUI_MergePolylinesDlg : public HYDROGUI_InputPanel @@ -38,8 +39,11 @@ public: void setSelectedPolylines( const HYDROData_SequenceOfObjects& ); void setPolylinesFromSelection(); + bool IsConnectByNewSegment() const; + private: QLineEdit* myName; + QCheckBox* myIsConnect; HYDROGUI_ObjListBox* myList; }; diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx index 9e0eaf0c..c5067c84 100644 --- a/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx @@ -58,9 +58,10 @@ bool HYDROGUI_MergePolylinesOp::processApply( int& theUpdateFlags, return false; QString aName = aPanel->GetResultName(); + bool isConnectByNewSegment = aPanel->IsConnectByNewSegment(); HYDROData_SequenceOfObjects aPolylinesList = aPanel->selectedPolylines(); HYDROData_PolylineOperator anOp; - anOp.Merge( doc(), aName.toLatin1().data(), aPolylinesList ); + anOp.Merge( doc(), aName.toLatin1().data(), aPolylinesList, isConnectByNewSegment ); theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; return true; diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index d6dc4dfd..72951f5e 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -3057,8 +3057,11 @@ Polyline should consist from one not closed curve. RESULT_NAME Result name: + + IS_CONNECT + Connect by a new segment + - HYDROGUI_MergePolylinesOp