]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #585: flag in merge operations
authorasl <asl@opencascade.com>
Fri, 26 Jun 2015 08:01:48 +0000 (11:01 +0300)
committerasl <asl@opencascade.com>
Fri, 26 Jun 2015 08:01:48 +0000 (11:01 +0300)
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_PolylineOperator.h
src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx
src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h
src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index e8a7eec82937ebdb4ef51b491f27025a618bfbc6..dff7ce3eaadc044141048e6117066b4d3b0d6a6b 100644 (file)
@@ -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;
 }
 
index e11c41ba8772c9561805ac8d9598460837b540a3..a76a6af9eed6de3f57900d52a904e514cf41395c 100644 (file)
@@ -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<Handle( Geom2d_Curve )> GetCurves( const Handle( HYDROData_PolylineXY )& thePolyline );
index 5035aae9a265dc29f4da0942df82516beba49ef0..620e8397a1f57868d9a1a3eacad9dd5d1ca792b8 100644 (file)
@@ -22,6 +22,7 @@
 #include <QLabel>
 #include <QGridLayout>
 #include <QLineEdit>
+#include <QCheckBox>
 
 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();
+}
index 9213deff5f26b7771105c14b6f74493d375d4859..d0cf3edd6a534658205b6c92ba4d0323246a652b 100644 (file)
@@ -23,6 +23,7 @@
 #include <HYDROData_Entity.h>
 
 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;
 };
 
index 9e0eaf0ccea3f59905530671f787a34d8c86f473..c5067c84643cff49d6b1474bf8273980365dcf80 100644 (file)
@@ -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;
index d6dc4dfd09999a3c24a336765348a829eb270708..72951f5e95b3b251d31cbfd51901c24152fc69da 100644 (file)
@@ -3057,8 +3057,11 @@ Polyline should consist from one not closed curve.</translation>
       <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>