# User options
# ============
# (some options may have already been defined in KERNEL)
-OPTION(SALOME_BUILD_DOC "Generate HYDRO documentation" ON)
+OPTION(SALOME_BUILD_DOC "Generate HYDRO documentation" OFF)
OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON)
# Prerequisites
# Sources
# ========
ADD_SUBDIRECTORY (src/shapelib)
+ADD_SUBDIRECTORY (src/HYDRO_tests)
ADD_SUBDIRECTORY (src/HYDROData)
ADD_SUBDIRECTORY (src/HYDROGUI)
ADD_SUBDIRECTORY (src/HYDROPy)
ADD_SUBDIRECTORY (src/HYDROTools)
-ADD_SUBDIRECTORY (src/HYDRO_tests)
IF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(doc)
ENDIF()
IF( ${WIN32} )
SET( ECW_LIBRARIES libecwj2 )
ELSE()
- SET( ECW_LIBRARIES libecwj2 )
+ SET( ECW_LIBRARIES ecwj2 )
ENDIF()
add_definitions(
HYDROGUI_SetTransparencyOp.h
HYDROGUI_TransparencyDlg.h
HYDROGUI_Overview.h
+ HYDROGUI_PolylineStyleOp.h
+ HYDROGUI_PolylineStyleDlg.h
HYDROGUI_ZoneTool.h
HYDROGUI_RegenerateRegionColorsOp.h
)
HYDROGUI_SetTransparencyOp.cxx
HYDROGUI_TransparencyDlg.cxx
HYDROGUI_Overview.cxx
+ HYDROGUI_PolylineStyleOp.cxx
+ HYDROGUI_PolylineStyleDlg.cxx
HYDROGUI_ZoneTool.cxx
HYDROGUI_RegenerateRegionColorsOp.cxx
)
#include <SUIT_Desktop.h>
#include <QLayout>
#include <QPushButton>
+#include <QApplication>
HYDROGUI_BathymetryLimitsDlg::HYDROGUI_BathymetryLimitsDlg( QWidget* theParent )
: QDialog( theParent )
QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
bool isUpdateCS = false;
+ if( myMode!=BathymetryRescaleUserId )
+ qApp->setOverrideCursor( Qt::WaitCursor );
+
switch( myMode )
{
case BathymetryTextId:
dlg.SetMinMax( min, max );
if( dlg.exec()==QDialog::Accepted )
{
+ qApp->setOverrideCursor( Qt::WaitCursor );
+
min = dlg.GetMin();
max = dlg.GetMax();
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
if( isUpdateCS )
module()->getOCCDisplayer()->UpdateColorScale( getViewer( module() ) );
+
+ qApp->restoreOverrideCursor();
}
//
#include <HYDROGUI_BathymetryPrs.h>
+#include <HYDROGUI_Tool.h>
+
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Image_PixMap.hxx>
+#include <Graphic3d_MarkerImage.hxx>
+
+#include <QImage>
const int BATH_HIGHLIGHT_MODE = 10;
}
else
{
+ Handle(Graphic3d_AspectMarker3d) anAspect = new Graphic3d_AspectMarker3d( Aspect_TOM_USERDEFINED, Quantity_NOC_WHITE, 1.0 );
+ QImage qtMark( 4, 4, QImage::Format_RGB888 );
+ Handle(Image_PixMap) aMark = HYDROGUI_Tool::Pixmap( qtMark );
+ Handle(Graphic3d_MarkerImage) gMark = new Graphic3d_MarkerImage(aMark);
+ anAspect->SetMarkerImage(gMark);
AIS_PointCloud::Compute( thePresentationManager, thePresentation, theMode );
+ aGroup->SetGroupPrimitivesAspect( anAspect );
Handle(Graphic3d_ArrayOfPoints) points = GetPoints();
if( !myTextIndices.empty() && !points.IsNull() )
activateSelection( false );
module()->action( BathymetrySelectionId )->setChecked( false );
+ module()->action( BathymetryTextId )->setChecked( false );
}
bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const
const QString& theParentEntry,
const bool theIsInOperation )
: CAM_DataObject( theParent ),
+#ifndef TEST_MODE
LightApp_DataObject( theParent ),
+#endif
myData( theData ),
myParentEntry( theParentEntry ),
myIsValid( true ),
QString HYDROGUI_DataObject::entry() const
{
QString anEntry = HYDROGUI_DataObject::dataObjectEntry( modelObject() );
- if( isReference() )
+ if( !refEntry().isEmpty() )
anEntry.prepend( myParentEntry + "_" );
return anEntry;
}
QFont HYDROGUI_DataObject::font( const int theId ) const
{
- QFont aFont = LightApp_DataObject::font( theId );
+ QFont aFont = PARENT::font( theId );
if( theId == NameId )
{
Handle(HYDROData_Entity) aDataObject = modelObject();
}
if ( !aColor.isValid() ) {
- aColor = LightApp_DataObject::color( theRole, theId );
+ aColor = PARENT::color( theRole, theId );
}
return aColor;
return aResMgr->loadPixmap( "HYDRO", anIcon );
}
- return LightApp_DataObject::icon( theId );
+ return PARENT::icon( theId );
}
QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
}
else
{
- aRes = LightApp_DataObject::renameAllowed( theColumnId );
+ aRes = PARENT::renameAllowed( theColumnId );
}
return aRes;
}
const QString& theParentEntry,
const bool theIsInOperation )
: CAM_DataObject( theParent ),
+#ifndef TEST_MODE
LightApp_DataObject( theParent ),
+#endif
myName( theName ),
myParentEntry( theParentEntry ),
myIsInOperation( theIsInOperation )
{
return aResMgr->loadPixmap( "HYDRO", QObject::tr( "PARTITION_ICO" ) );
}
- return LightApp_DataObject::icon( theId );
+ return PARENT::icon( theId );
}
QFont HYDROGUI_NamedObject::font( const int theId ) const
{
- QFont aFont = LightApp_DataObject::font( theId );
+ QFont aFont = PARENT::font( theId );
if( theId == NameId )
{
if ( dynamic_cast<CAM_ModuleObject*>( parent() ) )
#pragma warning( disable: 4251 )
#endif
-#include <LightApp_DataObject.h>
+#ifdef TEST_MODE
+ #include <CAM_DataObject.h>
+ enum {
+ EntryId = CAM_DataObject::VisibilityId + 1, //!< entry column
+ RefEntryId //!< reference entry column
+ };
+ #define PARENT CAM_DataObject
+#else
+ #include <LightApp_DataObject.h>
+ #define PARENT LightApp_DataObject
+#endif
+
#include <QString>
#include <QMap>
#include <QPixmap>
* This class inherits CAM_DataObject virtually, so it is necessary to call in the class
* constructor the CAM object constructor manually for the correct initialization
*/
-class HYDROGUI_DataObject : public LightApp_DataObject
+class HYDROGUI_DataObject : public PARENT
{
public:
//! Column id
* This class inherits CAM_DataObject virtually, so it is necessary to call in the class
* constructor the CAM object constructor manually for the correct initialization
*/
-class HYDROGUI_NamedObject : public virtual LightApp_DataObject
+class HYDROGUI_NamedObject : public virtual PARENT
{
public:
/**
#include "HYDROGUI_OrderedListWidget.h"
-#include <LightApp_DataOwner.h>
+#ifdef TEST_MODE
+ #include <SUIT_DataOwner.h>
+ class TestOwner : public SUIT_DataOwner
+ {
+ public:
+ TestOwner( const QString& entry ) { myEntry = entry; }
+ virtual ~TestOwner() {}
+
+ QString keyString() const { return myEntry; }
+ QString entry() const { return myEntry; }
+
+ private:
+ QString myEntry;
+ };
+ #define OWNER_CLASS TestOwner
+
+#else
+ #include <LightApp_DataOwner.h>
+ #define OWNER_CLASS LightApp_DataOwner
+#endif
HYDROGUI_ListSelector::HYDROGUI_ListSelector( HYDROGUI_OrderedListWidget* theListWidget,
foreach ( const QString& anEntry, aSelectedEntries ) {
if ( !anEntry.isEmpty() ) {
- theList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anEntry ) ) );
+ theList.append( SUIT_DataOwnerPtr( new OWNER_CLASS( anEntry ) ) );
}
}
}
QStringList aSelectedEntries;
SUIT_DataOwnerPtrList::const_iterator anIt = theList.begin();
for ( ; anIt != theList.end(); ++anIt ) {
- const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>( (*anIt).operator->() );
+ const OWNER_CLASS* anOwner = dynamic_cast<const OWNER_CLASS*>( (*anIt).operator->() );
if ( anOwner ) {
aSelectedEntries << anOwner->entry();
}
{
const_cast<HYDROGUI_Module*>( this )->myOverview =
new HYDROGUI_Overview( tr( "OVERVIEW" ), 0, app->desktop() );
- myOverview->setGeometry( 0, 0, 320, 240 );
app->insertDockWindow( OverviewWindow, myOverview );
+ app->placeDockWindow( OverviewWindow, Qt::LeftDockWidgetArea );
}
inWindows = false;
}
theMenu->addSeparator();
}
- bool anIsPoly = anIsPolyline || anIsPolyline3D;
- if (anIsPoly && !anIsLandCoverMap)
+ bool isPoly = anIsPolyline || anIsPolyline3D;
+ if (isPoly && !anIsLandCoverMap)
theMenu->addAction( action( ExportToShapeFileID ) );
// Add copy action
}
}
}
+
+ theMenu->addSeparator();
+ QAction* a = action( ShowHideArrows );
+ a->setText( arrowsVisible() ? tr( "HIDE_ARROWS" ) : tr( "SHOW_ARROWS" ) );
+ theMenu->addAction( a );
}
void HYDROGUI_Module::createPreferences()
void enableLCMActions();
+ bool arrowsVisible() const;
+ void setArrowsVisible( bool );
+
protected:
CAM_DataModel* createDataModel();
#include "HYDROGUI_ImportLandCoverMapOp.h"
#include "HYDROGUI_BathymetrySelectionOp.h"
#include "HYDROGUI_BathymetryOp.h"
+#include "HYDROGUI_PolylineStyleOp.h"
#include "HYDROGUI_RegenerateRegionColorsOp.h"
#include <HYDROData_Document.h>
createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" );
createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
+ createAction( ShowHideArrows, "SHOW_HIDE_ARROWS" );
createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" );
}
int anId = actionId( anAction );
if( anId >= 0 )
startOperation( anId );
+
+ if( anId==ShowHideArrows )
+ {
+ setArrowsVisible( !arrowsVisible() );
+ }
+}
+
+bool HYDROGUI_Module::arrowsVisible() const
+{
+ int aType;
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+ if( resMgr )
+ {
+ resMgr->value( "polyline", "arrow_type", aType );
+ return aType>0;
+ }
+ else
+ return false;
+}
+
+void HYDROGUI_Module::setArrowsVisible( bool isVisible )
+{
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+
+ int aType=-1;
+ if( !resMgr )
+ return;
+
+ if( isVisible )
+ {
+ if( resMgr->hasValue( "polyline", "prev_arrow_type" ) )
+ resMgr->value( "polyline", "prev_arrow_type", aType );
+
+ if( aType<=0 )
+ aType = 1;
+ resMgr->setValue( "polyline", "arrow_type", aType );
+ }
+ else
+ {
+ resMgr->value( "polyline", "arrow_type", aType );
+ resMgr->setValue( "polyline", "prev_arrow_type", aType );
+ resMgr->setValue( "polyline", "arrow_type", 0 );
+ }
+ preferencesChanged( "polyline", "arrow_type" );
}
void HYDROGUI_Module::onDelete()
BathymetryRescaleUserId,
BathymetryRescaleDefaultId,
+ ShowHideArrows,
RegenerateRegionColorsId
};
QPoint c = center();
double x1, y1, z1, x2, y2, z2;
main->getView()->Convert( main->width()/2, main->height()/2, x1, y1, z1 );
+
+ // Patch for OCCT 6.9.1, on 7.0.0 the moving of point to plane XY is not necessary
+ gp_Dir dm = main->getView()->Camera()->Direction();
+ double t1 = -z1/dm.Z();
+ x1 += dm.X()*t1;
+ y1 += dm.Y()*t1;
+ z1 += dm.Z()*t1;
+
overview->getView()->Convert( c.x(), c.y(), x2, y2, z2 );
+ gp_Dir dov = overview->getView()->Camera()->Direction();
+ double t2 = -z2/dov.Z();
+ x2 += dov.X()*t2;
+ y2 += dov.Y()*t2;
+ z2 += dov.Z()*t2;
gp_Trsf aTrsf;
aTrsf.SetTranslation( gp_Pnt( x1, y1, z1 ), gp_Pnt( x2, y2, z2 ) );
- main->getView()->Camera()->Transform( aTrsf );
+
+ // Temporary patch for bug in OCCT 6.9.1
+ Handle(Graphic3d_Camera) cam = main->getView()->Camera();
+ gp_Dir u = cam->Up(), nu = u.Transformed (aTrsf);
+ gp_Pnt e = cam->Eye(), ne = e.Transformed (aTrsf);
+ gp_Pnt cen = cam->Center(), ncen = cen.Transformed (aTrsf);
+
+ if (!nu.IsEqual (u, 0.0))
+ cam->SetUp(nu);
+
+ if (!ne.IsEqual (e, 0.0))
+ cam->SetEye(ne);
+
+ if (!ncen.IsEqual(cen, 0.0))
+ cam->SetCenter (ncen);
+
+ //version for new OCCT:
+ //main->getView()->Camera()->Transform( aTrsf );
main->repaint();
}
}
if( !myViewPort )
{
myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC );
- //myViewPort->setBackgroundColor( Qt::white );
+ myViewPort->setBackgroundColor( myMainView->getViewPort()->backgroundColor() );
connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ),
this, SLOT( OnMouseEvent( QMouseEvent* ) ) );
--- /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 "HYDROGUI_PolylineStyleDlg.h"
+#include <QFrame>
+#include <QLayout>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QLabel>
+#include <QGroupBox>
+
+HYDROGUI_PolylineStyleDlg::HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule )
+ : HYDROGUI_InputPanel( theModule, tr( "POLYLINE_STYLE" ) )
+{
+ QGroupBox* group = new QGroupBox( tr( "POLYLINE_STYLE" ), mainFrame() );
+
+ QGridLayout* lay = new QGridLayout( group );
+
+ myShape = new QComboBox( mainFrame() );
+ myShape->addItem( "???" );
+ myShape->addItem( tr( "No" ) );
+ myShape->addItem( tr( "Triangle" ) );
+ myShape->addItem( tr( "Cone" ) );
+
+ mySize = new QSpinBox( mainFrame() );
+ mySize->setRange( -1, 50 );
+ mySize->setSpecialValueText( " " );
+
+ lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW" ) ), 0, 0 );
+ lay->addWidget( myShape, 0, 1 );
+ lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW_SIZE" ) ), 1, 0 );
+ lay->addWidget( mySize, 1, 1 );
+ lay->setRowStretch( 2, 1 );
+
+ addWidget( group );
+}
+
+HYDROGUI_PolylineStyleDlg::~HYDROGUI_PolylineStyleDlg()
+{
+}
+
+void HYDROGUI_PolylineStyleDlg::getStyle( int& theShape, int& theSize ) const
+{
+ theShape = myShape->currentIndex();
+ theSize = mySize->value();
+}
+
+void HYDROGUI_PolylineStyleDlg::setStyle( int theShape, int theSize )
+{
+ myShape->setCurrentIndex( theShape );
+ mySize->setValue( theSize );
+}
+
--- /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 HYDROGUI_PolylineStyleDlg_H
+#define HYDROGUI_PolylineStyleDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QComboBox;
+class QSpinBox;
+
+class HYDROGUI_PolylineStyleDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_PolylineStyleDlg();
+
+ void getStyle( int&, int& ) const;
+ void setStyle( int, int );
+
+private:
+ QComboBox* myShape;
+ QSpinBox* mySize;
+};
+
+#endif
--- /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 <HYDROGUI_PolylineStyleOp.h>
+#include <HYDROGUI_PolylineStyleDlg.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <AIS_InteractiveContext.hxx>
+
+HYDROGUI_PolylineStyleOp::HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule )
+ : HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_PolylineStyleOp::~HYDROGUI_PolylineStyleOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_PolylineStyleOp::createInputPanel() const
+{
+ return new HYDROGUI_PolylineStyleDlg( module() );
+}
+
+Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule );
+
+QList<Handle(HYDROGUI_Arrow)> getSelectedArrows( HYDROGUI_Module* theModule )
+{
+ QList<Handle(HYDROGUI_Arrow)> arrows;
+ Handle(AIS_InteractiveContext) ctx = getContext( theModule );
+
+ AIS_ListOfInteractive objs;
+ ctx->DisplayedObjects( objs );
+ AIS_ListIteratorOfListOfInteractive it( objs );
+ for( ; it.More(); it.Next() )
+ {
+ Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( it.Value() );
+ Handle(AIS_InteractiveObject) obj = arrow;
+ if( !obj.IsNull() && ctx->IsSelected( obj ) )
+ arrows.append( arrow );
+ }
+ return arrows;
+}
+
+void HYDROGUI_PolylineStyleOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ myArrows = getSelectedArrows( module() );
+
+ int aCommonType=-1, aCommonSize=-1;
+ bool isInit = false;
+ foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+ {
+ if( !isInit )
+ {
+ aCommonType = arrow->GetType();
+ aCommonSize = arrow->GetSize();
+ }
+ else
+ {
+ if( aCommonType != -1 && aCommonType != arrow->GetType() )
+ aCommonType = -1;
+ if( aCommonSize != -1 && aCommonSize != arrow->GetSize() )
+ aCommonSize = -1;
+ }
+
+ isInit = true;
+ }
+
+ HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+ dlg->setStyle( aCommonType+1, aCommonSize );
+}
+
+bool HYDROGUI_PolylineStyleOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ Handle(AIS_InteractiveContext) ctx = getContext( module() );
+
+ int aType, aSize;
+ HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+ dlg->getStyle( aType, aSize );
+ aType--;
+
+ foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+ {
+ if( aType>=0 )
+ arrow->SetType( (HYDROGUI_Arrow::Type)aType );
+ if( aSize>=0 )
+ arrow->SetSize( aSize );
+ ctx->Redisplay( arrow, Standard_False );
+ }
+ theUpdateFlags = UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+ 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 HYDROGUI_POLYLINE_STYLE_OP_H
+#define HYDROGUI_POLYLINE_STYLE_OP_H
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROGUI_Polyline.h>
+
+class HYDROGUI_PolylineStyleOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_PolylineStyleOp();
+
+protected:
+ virtual void startOperation();
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
+
+private:
+ QList<Handle(HYDROGUI_Arrow)> myArrows;
+};
+
+#endif
int aType = -1;
int aSize = -1;
- if( aResMgr )
+
+ if( myShapes.length()>1 )
+ {
+ Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( myShapes[1] );
+ if( !arrow.IsNull() )
+ {
+ aType = arrow->GetType();
+ aSize = arrow->GetSize();
+ }
+ }
+ if( aResMgr && ( aType<0 || aSize < 0 ) )
{
aResMgr->value( "polyline", "arrow_type", aType );
aResMgr->value( "polyline", "arrow_size", aSize );
#include <HYDROData_Document.h>
#include <gp_Pnt.hxx>
+#include <QMessageBox>
+#include <QApplication>
+#include <QDesktopWidget>
HYDROGUI_ShapeImage::HYDROGUI_ShapeImage( const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Image)& theImage,
Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( getObject() );
if ( !anImageObj.IsNull() )
{
- aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj ), imageContour( anImageObj ) );
+ QString aMsg;
+ aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj, aMsg ), imageContour( anImageObj ) );
+ if( !aMsg.isEmpty() )
+ QMessageBox::warning( qApp->desktop(), "Warning", aMsg );
shapes.append( aPrs );
}
return shapes;
}
-Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj ) const
+Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj, QString& theMessage ) const
{
Handle(Image_PixMap) aPix;
if ( !theImageObj.IsNull() )
if ( aDelta > 0 )
aTrsfWidth += ( 4 - aDelta );
+ const int maxWidth = 7000;
+ if( aTrsfWidth>maxWidth )
+ {
+ aTrsfWidth = maxWidth;
+ theMessage = QString( "The size of image is scaled to %0" ).arg( aTrsfWidth );
+ }
anImage = anImage.scaledToWidth( aTrsfWidth );
+ int pix = anImage.width() * anImage.height();
aPix = HYDROGUI_Tool::Pixmap( anImage );
}
protected:
virtual QList<Handle(AIS_InteractiveObject)> createShape() const;
- Handle(Image_PixMap) imagePixMap( const Handle(HYDROData_Image)& ) const;
+ Handle(Image_PixMap) imagePixMap( const Handle(HYDROData_Image)&, QString& theMessage ) const;
QPolygonF imageContour( const Handle(HYDROData_Image)& ) const;
};
: HYDROGUI_InputPanel( theModule, theTitle, true, isSplitter )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- SUIT_Study* aStudy = theModule ? theModule->getApp()->activeStudy() : 0;
+ SUIT_Study* aStudy = theModule ? theModule->application()->activeStudy() : 0;
myViewManager = new OCCViewer_ViewManager( aStudy, 0 );
OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
{
+#ifdef TEST_MODE
+ static SUIT_SelectionMgr* mgr = new SUIT_SelectionMgr();
+ return mgr;
+#else
SUIT_SelectionMgr* aSelMgr = 0;
if ( module() )
{
aSelMgr = app->selectionMgr();
}
return aSelMgr;
+#endif
}
void HYDROGUI_ViewerDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
<source>DSK_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
+ <message>
+ <source>DSK_SHOW_HIDE_ARROWS</source>
+ <translation>Show/hide arrows</translation>
+ </message>
<message>
<source>DSK_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>MEN_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
+ <message>
+ <source>MEN_SHOW_HIDE_ARROWS</source>
+ <translation>Show/hide arrows</translation>
+ </message>
+ <message>
+ <source>HIDE_ARROWS</source>
+ <translation>Hide arrows</translation>
+ </message>
+ <message>
+ <source>SHOW_ARROWS</source>
+ <translation>Show arrows</translation>
+ </message>
<message>
<source>MEN_IMPORT_IMAGE</source>
<translation>Import image</translation>
<translation>Selection on bathymetry</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_SELECTION
- </source>
+ <source>STB_BATHYMETRY_RESCALE_SELECTION</source>
<translation>Rescale bathymetry by selection</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_VISIBLE
- </source>
+ <source>STB_POLYLINE_STYLE</source>
+ <translation>Change polyline style</translation>
+ </message>
+ <message>
+ <source>STB_BATHYMETRY_RESCALE_VISIBLE</source>
<translation>Rescale bathymetry by visible range</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_USER
- </source>
+ <source>STB_BATHYMETRY_RESCALE_USER</source>
<translation>Custom rescale bathymetry</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_DEFAULT
- </source>
+ <source>STB_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
<message>
</message>
</context>
+ <context>
+ <name>HYDROGUI_PolylineStyleDlg</name>
+ <message>
+ <source>POLYLINE_STYLE</source>
+ <translation>Polyline style</translation>
+ </message>
+ <message>
+ <source>PREF_POLYLINE_ARROW</source>
+ <translation>Polyline arrow</translation>
+ </message>
+ <message>
+ <source>PREF_POLYLINE_ARROW_SIZE</source>
+ <translation>Polyline arrow size</translation>
+ </message>
+ </context>
+
</TS>
include(../../CMake/Common.cmake)
include(ExternalFiles.cmake)
+set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+
set(PROJECT_HEADERS
test_HYDROData_Bathymetry.h
test_HYDROData_Channel.h
TestLib_Runner.cxx
)
-add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -DTEST_MODE )
+add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -DTEST_MODE -DQT_GUI_LIB -DQT_WIDGETS_LIB )
IF( ${WIN32} )
add_definitions( -DWNT -D__WIN32__ -D__x86__ -D_WIN64 -D_WIN32_WINNT=0x0400 -D__NT__ -D__OSVERSION__=4 )
SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT_DIR}/include )
SET( CAS_INCLUDES $ENV{CASROOT}/inc )
-SET( QT_INCLUDES $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui $ENV{QT_ROOT_DIR}/include/QtTest )
+SET( QT_INCLUDES $ENV{QTDIR}/include $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui $ENV{QT_ROOT_DIR}/include/QtTest )
SET( KERNEL_INCLUDES $ENV{KERNEL_ROOT_DIR}/include/salome )
SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome )
SET( GEOM_INCLUDES $ENV{GEOM_ROOT_DIR}/include/salome )
SET( ECW_INCLUDES $ENV{ECWLIB_ROOT_DIR}/include )
IF( ${WIN32} )
- link_directories( $ENV{CASROOT}/win64/vc10/lib )
+ link_directories( $ENV{CASROOT}/win64/vc10/lib $ENV{GL2PS_DIR}/lib )
ELSE()
link_directories( $ENV{CASROOT}/lib $ENV{TBB_ROOT_DIR}/lib/intel64/gcc4.4 )
ENDIF()
-SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService TKMesh )
+SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService TKMesh gl2ps )
-link_directories( $ENV{QT_ROOT_DIR}/lib )
+link_directories( $ENV{QT_ROOT_DIR}/lib $ENV{QTDIR}/lib )
IF( ${WIN32} )
- IF( CMAKE_BUILD_TYPE MATCHES Debug )
- SET( QT_LIBRARIES Qt5Cored Qt5Guid Qt5Testd )
- ELSE()
- SET( QT_LIBRARIES Qt5Core Qt5Gui Qt5Test )
- ENDIF()
+ SET( QT_LIBRARIES Qt5Cored Qt5Guid Qt5Testd )
ELSE()
- SET( QT_LIBRARIES QtCore QtGui QtTest )
+ SET( QT_LIBRARIES Qt5Core Qt5Gui Qt5Test )
ENDIF()
+
link_directories( $ENV{CPPUNIT_ROOT_DIR}/lib )
IF( ${WIN32} )
IF( CMAKE_BUILD_TYPE MATCHES Debug )
ENDIF()
link_directories( $ENV{KERNEL_ROOT_DIR}/lib/salome $ENV{GUI_ROOT_DIR}/lib/salome $ENV{GEOM_ROOT_DIR}/lib/salome )
-SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer )
-SET( GEOM_LIBRARIES CurveCreator GEOMUtils GEOMUtils )
+
+SET( GUI_LIBRARIES ImageComposer qtx suit CAM OCCViewer GraphicsView )
+# Please do not link with LightApp since in the full SALOME it is linked with CORBA (omniORB)
+
+SET( GEOM_LIBRARIES CurveCreator GEOMUtils )
link_directories( $ENV{ECWLIB_ROOT_DIR}/lib )
IF( ${WIN32} )
SET( ECW_LIBRARIES libecwj2 )
ELSE()
- SET( ECW_LIBRARIES libecwj2 )
+ SET( ECW_LIBRARIES ecwj2 )
ENDIF()
include_directories(
source_group( "External files" FILES ${EXTERNAL_FILES} )
add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${EXTERNAL_FILES} ${PROJECT_MOC_HEADERS} )
-target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib HYDROData ${ECW_LIBRARIES} )
+set_target_properties( HYDROData_tests PROPERTIES LINK_INTERFACE_LIBRARIES "" )
+target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib ${ECW_LIBRARIES} )
INSTALL(TARGETS HYDROData_tests EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
find_package( Qt5Core )
find_package( Qt5Widgets )
+set(CMAKE_AUTOMOC ON)
set( EXTERNAL_FILES
../HYDROData/HYDROData_AltitudeObject.cxx
../HYDROGUI/HYDROGUI_ViewerDlg.h
)
-QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
+#QT5_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
overview_empty.png
overview_prs.png
overview_selection.png
+ overview_selection_a.png
overview_zoomed_1.png
overview_zoomed_2.png
overview_panned_1.png
overview_rotated_1.png
+ overview_drag.png
bathy_rescaled_user.png
bathy_rescaled_visible.png
bathy_text_labels.png
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
-
-QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
-
+extern QString REF_DATA_PATH;
void test_HYDROData_CalcCase::test_add_int_wires()
{
#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
+QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+
int main( int argc, char* argv[] )
{
QApplication anApp( argc, argv );
{ \
QString aMessage; \
QImage aDump = dumpViews(); \
- if( !TestViewer::AssertImages( aMessage, &aDump, theCase ) ) \
+ if( !TestViewer::AssertImages( aMessage, &aDump, theCase, false ) ) \
{ \
TestViewer::showColorScale( false ); \
std::string aMessageStl = aMessage.toStdString(); \
QImage aMain = TestViewer::viewWindow()->getView(OCCViewer_ViewFrame::MAIN_VIEW)->dumpView();
QImage anOverview = myOverview->dump();
- aMain = aMain.rgbSwapped(); //PATCH for image came from OCCT dump
+ aMain = aMain.rgbSwapped(); //PATCH for image came from OCCT dump
//anOverview = anOverview.rgbSwapped(); //overview dump already normalizes the image, the line is not necessary!!!
int w1 = aMain.width();
myOverview->show();
myOverview->setMainView( TestViewer::viewWindow() );
TestViewer::viewWindow()->setGeometry( 400, 100, 800, 800 );
+ TestViewer::viewWindow()->onTopView();
myOverview->setGeometry( 100, 100, 200, 200 );
isPassed = true;
void test_Overview::test_default()
{
create();
+ //QTest::qWait( 50000 );
CPPUNIT_ASSERT_OVERVIEW( "overview_empty" );
}
{
create();
showShape();
-
- OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
- OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+ TestViewer::viewWindow()->onTopView();
// 1. selection in main view
QTest::mouseMove( TestViewer::viewWindow() );
CPPUNIT_ASSERT_OVERVIEW( "overview_selection" );
+ OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
+ OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+
// 2. mouse wheel zoom
QWheelEvent we( QPoint( 243, 416 ), 120*20, Qt::NoButton, Qt::NoModifier );
qApp->sendEvent( vp, &we );
myOverview->setMainView( TestViewer::viewWindow() );
qApp->processEvents();
- CPPUNIT_ASSERT_OVERVIEW( "overview_selection" );
+ CPPUNIT_ASSERT_OVERVIEW( "overview_selection_a" );
}
void test_Overview::test_actions_in_overview()
{
- //TODO
+ create();
+ showShape();
+ TestViewer::viewWindow()->onTopView();
+ QTest::mouseMove( TestViewer::viewWindow() );
+
+ OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
+ OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+
+ QWheelEvent we( QPoint( 243, 416 ), 120*20, Qt::NoButton, Qt::NoModifier );
+ qApp->sendEvent( vp, &we );
+ qApp->processEvents();
+ CPPUNIT_ASSERT_OVERVIEW( "overview_zoomed_1" );
+
+ QTest::mouseMove( myOverview->getViewPort(false), QPoint( 150, 50 ) );
+ QTest::mouseClick( myOverview->getViewPort(false), Qt::LeftButton, Qt::KeyboardModifiers(), QPoint( 150, 50 ) );
+ qApp->processEvents();
+
+ CPPUNIT_ASSERT_OVERVIEW( "overview_drag" );
+
+ //QTest::qWait( 50000 );
}