#include "HYDROGUI_ProfileDlg.h"
#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+
#include <CurveCreator_Widget.h>
#include <CurveCreator_ICurve.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
+#include <GEOMUtils.hxx>
+
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
+#include <QMouseEvent>
HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle ), myName(NULL)
connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) );
myAddElementBox->hide();
+
+ // Coordinates
+ connect( myViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+ if ( aViewWin ) {
+ OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWin );
+ if ( aViewFrame && aViewFrame->getViewPort() ) {
+ aViewFrame->getViewPort()->installEventFilter( this );
+ }
+ }
+
+ myCoordLabel = new QLabel( this );
+ QHBoxLayout* aCoordLayout = new QHBoxLayout();
+ aCoordLayout->addWidget( myCoordLabel );
+ aCoordLayout->addStretch();
+
+ addLayout( aCoordLayout );
}
HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
theWidget->hide();
myAddElementBox->hide();
}
+
+void HYDROGUI_ProfileDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
+{
+ OCCViewer_ViewWindow* anOCCViewWindow =
+ dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
+ if ( anOCCViewWindow && anOCCViewWindow->getViewPort() ) {
+ gp_Pnt aPnt = GEOMUtils::ConvertClickToPoint(
+ theEvent->x(), theEvent->y(), anOCCViewWindow->getViewPort()->getView() );
+
+ // Show the coordinates
+ QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
+ QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
+ myCoordLabel->setText( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+ }
+}
+
+bool HYDROGUI_ProfileDlg::eventFilter( QObject* theObj, QEvent* theEvent )
+{
+ if ( theObj->inherits( "OCCViewer_ViewPort" ) &&
+ theEvent->type() == QEvent::Leave ) {
+ myCoordLabel->clear();
+ }
+
+ return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
+}
\ No newline at end of file
#include <AIS_InteractiveContext.hxx>
-class QLineEdit;
class CurveCreator_Widget;
class CurveCreator_ICurve;
class OCCViewer_ViewManager;
+class SUIT_ViewWindow;
class QGroupBox;
+class QLineEdit;
+class QLabel;
class HYDROGUI_ProfileDlg : public HYDROGUI_InputPanel
{
void deleteSelected();
bool deleteEnabled();
+protected:
+ virtual bool eventFilter( QObject*, QEvent* );
+
protected slots:
void processStartedSubOperation( QWidget* );
void processFinishedSubOperation( QWidget* );
+ void onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
+
signals:
void createPreview( QString );
void selectionChanged();
void subOperationStarted(QWidget*);
void subOperationFinished(QWidget*);
private:
- QLineEdit* myName;
- CurveCreator_Widget* myEditorWidget;
- QGroupBox* myAddElementBox;
+ QLineEdit* myName;
+ CurveCreator_Widget* myEditorWidget;
+ QGroupBox* myAddElementBox;
OCCViewer_ViewManager* myViewManager;
+ QLabel* myCoordLabel;
};
#endif
<translation>BREP files (*.brep);;IGES files (*.iges *.igs);;STEP files (*.step *.stp);;
All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
</message>
+ <message>
+ <source>COORDINATES_INFO</source>
+ <translation>X: %1, Y: %2</translation>
+ </message>
</context>
<context>
<source>REMOVE</source>
<translation>Remove</translation>
</message>
- <message>
- <source>EMPTY_GEOMETRY_OBJECTS</source>
- <translation>No one geometry object is selected, should be at least one.</translation>
- </message>
</context>
<context>
<translation>Undo</translation>
</message>
<message>
- <source>DSK_UPDATE_OBJECT</source>
- <translation>Update</translation>
+ <source>DSK_UPDATE_IMAGE</source>
+ <translation>Update image</translation>
</message>
<message>
<source>DSK_IMPORT_OBSTACLE_FROM_FILE</source>
<translation>Undo</translation>
</message>
<message>
- <source>MEN_UPDATE_OBJECT</source>
- <translation>Update</translation>
+ <source>MEN_UPDATE_IMAGE</source>
+ <translation>Update image</translation>
</message>
<message>
<source>MEN_IMPORT_OBSTACLE_FROM_FILE</source>
<translation>Undo</translation>
</message>
<message>
- <source>STB_UPDATE_OBJECT</source>
- <translation>Update</translation>
+ <source>STB_UPDATE_IMAGE</source>
+ <translation>Update image</translation>
</message>
<message>
<source>STB_IMPORT_OBSTACLE_FROM_FILE</source>
<source>STB_COLOR</source>
<translation>Set object color</translation>
</message>
- <message>
- <source>COORDINATES_INFO</source>
- <translation>X: %1, Y: %2</translation>
- </message>
</context>
<context>
<source>STREAM_HYDRAULIC_AXIS</source>
<translation>Hydraulic axis</translation>
</message>
+ <message>
+ <source>PROFILES</source>
+ <translation>Profiles:</translation>
+ </message>
<message>
<source>ADD</source>
<translation>Add</translation>