HYDROData_ObstacleAltitude.h
HYDROData_OperationsFactory.h
HYDROData_Pipes.h
+ HYDROData_PolylineOperator.h
HYDROData_PolylineXY.h
HYDROData_Polyline3D.h
HYDROData_PriorityQueue.h
HYDROData_ObstacleAltitude.cxx
HYDROData_OperationsFactory.cxx
HYDROData_Pipes.cxx
+ HYDROData_PolylineOperator.cxx
HYDROData_PolylineXY.cxx
HYDROData_Polyline3D.cxx
HYDROData_PriorityQueue.cxx
*/
HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
- /**
+ /**
* Set type for section with given index.
* \param theSectionIndex index of section
* \param theSectionType new section type
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROData_PolylineOperator.h>
+
+bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+ const gp_Pnt2d& thePoint ) const
+{
+ //TODO
+ return true;
+}
+
+bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+ const Handle( HYDROData_PolylineXY )& theTool ) const
+{
+ //TODO
+ return true;
+}
+
+bool HYDROData_PolylineOperator::Split( const HYDROData_SequenceOfObjects& thePolylines )
+{
+ //TODO
+ return true;
+}
+
+bool HYDROData_PolylineOperator::Merge( const HYDROData_SequenceOfObjects& thePolylines )
+{
+ //TODO
+ return true;
+}
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROData_PolylineOperator_HeaderFile
+#define HYDROData_PolylineOperator_HeaderFile
+
+#include <HYDROData_PolylineXY.h>
+
+class gp_Pnt2d;
+
+class HYDROData_PolylineOperator
+{
+public:
+ HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+ const gp_Pnt2d& thePoint ) const;
+ HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+ const Handle( HYDROData_PolylineXY )& theTool ) const;
+ HYDRODATA_EXPORT bool Split( const HYDROData_SequenceOfObjects& thePolylines );
+ HYDRODATA_EXPORT bool Merge( const HYDROData_SequenceOfObjects& thePolylines );
+};
+
+#endif
class QTransform;
class TopoDS_Wire;
class gp_XYZ;
+class gp_Pnt;
/**\class HYDROData_PolylineXY
* \brief Class that stores/retreives information about the
#include <HYDROGUI_MergePolylinesOp.h>
#include <HYDROGUI_MergePolylinesDlg.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROData_PolylineOperator.h>
HYDROGUI_MergePolylinesOp::HYDROGUI_MergePolylinesOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule )
{
HYDROGUI_Operation::startOperation();
- //TODO
+ HYDROGUI_MergePolylinesDlg* aPanel =
+ ::qobject_cast<HYDROGUI_MergePolylinesDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ aPanel->setPolylinesFromSelection();
}
HYDROGUI_InputPanel* HYDROGUI_MergePolylinesOp::createInputPanel() const
QString& theErrorMsg,
QStringList& theBrowseObjectsEntries )
{
- /* TODO:
- HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast<HYDROGUI_LocalCSDlg*>( inputPanel() );
+ HYDROGUI_MergePolylinesDlg* aPanel = ::qobject_cast<HYDROGUI_MergePolylinesDlg*>( inputPanel() );
if ( !aPanel )
return false;
- double aLX = aPanel->GetLocalX();
- double aLY = aPanel->GetLocalY();
- doc()->SetLocalCS( aLX, aLY );
+ HYDROData_SequenceOfObjects aPolylinesList = aPanel->selectedPolylines();
+ HYDROData_PolylineOperator anOp;
+ anOp.Merge( aPolylinesList );
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
- */
return true;
}
myObject->blockSignals( true );
myObject->clear();
- myObject->addItems( objectNames() );
+ myObjects.Clear();
+ myObject->addItems( objectNames( myObjects ) );
myObject->setCurrentIndex( -1 );
myObject->blockSignals( block );
updateSelection();
}
-void HYDROGUI_ObjComboBox::setSectedObject( const QString& theName )
+void HYDROGUI_ObjComboBox::setSelectedObject( const QString& theName )
{
int aNewIdx = myObject->findText( theName );
if ( aNewIdx != myObject->currentIndex() )
return aSelMgr;
}
-QStringList HYDROGUI_ObjComboBox::objectNames() const
+QStringList HYDROGUI_ObjComboBox::objectNames( HYDROData_SequenceOfObjects& theObjects ) const
{
QStringList aNames;
for ( HYDROData_Iterator it( HYDROData_Document::Document( module()->getStudyId() ), objectType() ); it.More(); it.Next() )
emit objectSelected( myObject->itemText( idx ) );
}
}
+
+Handle( HYDROData_Entity ) HYDROGUI_ObjComboBox::GetObject() const
+{
+ int anIndex = myObject->currentIndex();
+ if( anIndex>=0 && anIndex<myObjects.Length() )
+ return myObjects.Value( myObjects.Lower() + anIndex );
+ else
+ Handle( HYDROData_Entity )();
+}
+
void setObjectFilter( HYDROGUI_ObjComboBoxFilter* );
QString selectedObject() const;
- void setSectedObject( const QString& );
+ void setSelectedObject( const QString& );
void reset();
+ Handle( HYDROData_Entity ) GetObject() const;
+
signals:
void objectSelected( const QString& );
void updateSelection();
protected:
- QStringList objectNames() const;
+ QStringList objectNames( HYDROData_SequenceOfObjects& ) const;
SUIT_SelectionMgr* selectionMgr() const;
private:
QComboBox* myObject;
HYDROGUI_Module* myModule;
HYDROGUI_ObjComboBoxFilter* myFilter;
+ HYDROData_SequenceOfObjects myObjects;
};
class HYDROGUI_ObjComboBoxFilter
createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" );
createAction( ExportPolylineId, "EXPORT_POLYLINE", "EXPORT_POLYLINE_ICO" );
+ createAction( SplitPolylinesId, "SPLIT_POLYLINES", "SPLIT_POLYLINES_ICO" );
+ createAction( MergePolylinesId, "MERGE_POLYLINES", "MERGE_POLYLINES_ICO" );
}
void HYDROGUI_Module::createMenus()
void HYDROGUI_ProfileInterpolateDlg::setRiver( const QString& theName )
{
- myRiver->setSectedObject( theName );
+ myRiver->setSelectedObject( theName );
}
QString HYDROGUI_ProfileInterpolateDlg::profileStart() const
void HYDROGUI_ProfileInterpolateDlg::setProfileStart( const QString& theName )
{
- myProfileStart->setSectedObject( theName );
+ myProfileStart->setSelectedObject( theName );
}
QString HYDROGUI_ProfileInterpolateDlg::profileFinish() const
void HYDROGUI_ProfileInterpolateDlg::setProfileFinish( const QString& theName )
{
- myProfileFinish->setSectedObject( theName );
+ myProfileFinish->setSelectedObject( theName );
}
int HYDROGUI_ProfileInterpolateDlg::profileNumber() const
void HYDROGUI_RiverBottomDlg::setRiverName( const QString& theName )
{
- myRivers->setSectedObject( theName );
+ myRivers->setSelectedObject( theName );
}
bool HYDROGUI_RiverBottomDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const
//
#include <HYDROGUI_SplitPolylinesDlg.h>
+#include <HYDROGUI_ObjComboBox.h>
+#include <HYDROGUI_ObjListBox.h>
+#include <HYDROGUI_Tool.h>
+#include <QtxDoubleSpinBox.h>
#include <QFrame>
#include <QGridLayout>
+#include <QTabWidget>
+#include <gp_Pnt2d.hxx>
HYDROGUI_SplitPolylinesDlg::HYDROGUI_SplitPolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
QGridLayout* aLayout = new QGridLayout( aFrame );
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
+
+ myTab = new QTabWidget( aFrame );
+ aLayout->addWidget( myTab, 0, 0 );
+
+ QFrame* aPointPage = new QFrame();
+ QGridLayout* aPointPageLayout = new QGridLayout( aPointPage );
+
+ myTab->addTab( aPointPage, tr( "BY_POINT" ) );
+
+ QFrame* aToolPage = new QFrame();
+ myTab->addTab( aToolPage, tr( "BY_TOOL" ) );
+
+ QFrame* aSplitPage = new QFrame();
+ myTab->addTab( aSplitPage, tr( "COMPLETE_SPLIT" ) );
}
HYDROGUI_SplitPolylinesDlg::~HYDROGUI_SplitPolylinesDlg()
{
}
+HYDROGUI_SplitPolylinesDlg::Mode HYDROGUI_SplitPolylinesDlg::GetMode() const
+{
+ return ( Mode )myTab->currentIndex();
+}
+
+Handle( HYDROData_PolylineXY ) HYDROGUI_SplitPolylinesDlg::GetMainPolyline() const
+{
+ switch( GetMode() )
+ {
+ case ByPoint:
+ return Handle( HYDROData_PolylineXY )::DownCast( myMainPolyline1->GetObject() );
+ case ByTool:
+ return Handle( HYDROData_PolylineXY )::DownCast( myMainPolyline2->GetObject() );
+ default:
+ return Handle( HYDROData_PolylineXY )();
+ }
+}
+
+Handle( HYDROData_PolylineXY ) HYDROGUI_SplitPolylinesDlg::GetToolPolyline() const
+{
+ if( GetMode()==ByTool )
+ return Handle( HYDROData_PolylineXY )::DownCast( myToolPolyline->GetObject() );
+ else
+ return Handle( HYDROData_PolylineXY )();
+}
+
+gp_Pnt2d HYDROGUI_SplitPolylinesDlg::GetPoint() const
+{
+ return gp_Pnt2d( myX->value(), myY->value() );
+}
+
+HYDROData_SequenceOfObjects HYDROGUI_SplitPolylinesDlg::GetPolylines() const
+{
+ if( GetMode()==Split )
+ return myPolylines->selectedObjects();
+ else
+ return HYDROData_SequenceOfObjects();
+}
+
+void HYDROGUI_SplitPolylinesDlg::setPolylinesFromSelection()
+{
+ Handle( HYDROData_Entity ) anObject = HYDROGUI_Tool::GetSelectedObject( module() );
+ if( anObject.IsNull() || anObject->GetKind() != KIND_POLYLINEXY )
+ return;
+
+ QString aName = anObject->GetName();
+ myMainPolyline1->setObjectName( aName );
+ myMainPolyline2->setObjectName( aName );
+ myPolylines->setObjectsFromSelection();
+}
#define HYDROGUI_SplitPolylinesDlg_H
#include "HYDROGUI_InputPanel.h"
+#include <HYDROData_PolylineXY.h>
+
+class QTabWidget;
+class QtxDoubleSpinBox;
+class HYDROGUI_ObjComboBox;
+class HYDROGUI_ObjListBox;
+class gp_Pnt2d;
class HYDROGUI_SplitPolylinesDlg : public HYDROGUI_InputPanel
{
Q_OBJECT
+public:
+ enum Mode { ByPoint, ByTool, Split };
+
public:
HYDROGUI_SplitPolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle );
virtual ~HYDROGUI_SplitPolylinesDlg();
+
+ Mode GetMode() const;
+ Handle( HYDROData_PolylineXY ) GetMainPolyline() const;
+ Handle( HYDROData_PolylineXY ) GetToolPolyline() const;
+ gp_Pnt2d GetPoint() const;
+ HYDROData_SequenceOfObjects GetPolylines() const;
+
+ void setPolylinesFromSelection();
+
+private:
+ QTabWidget* myTab;
+ QtxDoubleSpinBox* myX;
+ QtxDoubleSpinBox* myY;
+ HYDROGUI_ObjComboBox* myMainPolyline1;
+ HYDROGUI_ObjComboBox* myMainPolyline2;
+ HYDROGUI_ObjComboBox* myToolPolyline;
+ HYDROGUI_ObjListBox* myPolylines;
};
#endif
#include <HYDROGUI_SplitPolylinesOp.h>
#include <HYDROGUI_SplitPolylinesDlg.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROData_PolylineOperator.h>
+#include <gp_Pnt2d.hxx>
HYDROGUI_SplitPolylinesOp::HYDROGUI_SplitPolylinesOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule )
{
HYDROGUI_Operation::startOperation();
- //TODO
+ HYDROGUI_SplitPolylinesDlg* aPanel =
+ ::qobject_cast<HYDROGUI_SplitPolylinesDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ aPanel->setPolylinesFromSelection();
+
}
HYDROGUI_InputPanel* HYDROGUI_SplitPolylinesOp::createInputPanel() const
QString& theErrorMsg,
QStringList& theBrowseObjectsEntries )
{
- /*TODO:
- HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast<HYDROGUI_LocalCSDlg*>( inputPanel() );
+ HYDROGUI_SplitPolylinesDlg* aPanel = ::qobject_cast<HYDROGUI_SplitPolylinesDlg*>( inputPanel() );
if ( !aPanel )
return false;
- double aLX = aPanel->GetLocalX();
- double aLY = aPanel->GetLocalY();
- doc()->SetLocalCS( aLX, aLY );
+ Handle( HYDROData_PolylineXY ) aMainPolyline = aPanel->GetMainPolyline();
+ Handle( HYDROData_PolylineXY ) aToolPolyline = aPanel->GetToolPolyline();
+ HYDROData_SequenceOfObjects aPolylinesList = aPanel->GetPolylines();
+ gp_Pnt2d aPoint = aPanel->GetPoint();
+ HYDROData_PolylineOperator anOp;
+ switch( aPanel->GetMode() )
+ {
+ case HYDROGUI_SplitPolylinesDlg::ByPoint:
+ anOp.Split( aMainPolyline, aPoint );
+ break;
+ case HYDROGUI_SplitPolylinesDlg::ByTool:
+ anOp.Split( aMainPolyline, aToolPolyline );
+ break;
+ case HYDROGUI_SplitPolylinesDlg::Split:
+ anOp.Split( aPolylinesList );
+ break;
+ }
+
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
- */
return true;
}
<source>DSK_SPLIT_IMAGE</source>
<translation>Split image</translation>
</message>
+ <message>
+ <source>DSK_SPLIT_POLYLINES</source>
+ <translation>Split polylines</translation>
+ </message>
+ <message>
+ <source>DSK_MERGE_POLYLINES</source>
+ <translation>Merge polylines</translation>
+ </message>
<message>
<source>DSK_UNDO</source>
<translation>Undo</translation>
<source>MEN_SPLIT_IMAGE</source>
<translation>Split image</translation>
</message>
+ <message>
+ <source>MEN_SPLIT_POLYLINES</source>
+ <translation>Split polylines</translation>
+ </message>
+ <message>
+ <source>MEN_MERGE_POLYLINES</source>
+ <translation>Merge polylines</translation>
+ </message>
<message>
<source>MEN_UNDO</source>
<translation>Undo</translation>
<source>STB_SPLIT_IMAGE</source>
<translation>Split image</translation>
</message>
+ <message>
+ <source>STB_SPLIT_POLYLINES</source>
+ <translation>Split polylines</translation>
+ </message>
+ <message>
+ <source>STB_MERGE_POLYLINES</source>
+ <translation>Merge polylines</translation>
+ </message>
<message>
<source>STB_UNDO</source>
<translation>Undo</translation>
</message>
</context>
+ <context>
+ <name>HYDROGUI_SplitPolylinesDlg</name>
+ <message>
+ <source>POLYLINES</source>
+ <translation>Polylines</translation>
+ </message>
+ <message>
+ <source>INCLUDE</source>
+ <translation>Include</translation>
+ </message>
+ <message>
+ <source>EXCLUDE</source>
+ <translation>Exclude</translation>
+ </message>
+ </context>
+
</TS>