#include <HYDROGUI_BathymetryPrs.h>
#include <HYDROGUI_ShapeBathymetry.h>
#include <HYDROGUI_Module.h>
+#include <HYDROGUI_OCCDisplayer.h>
#include <LightApp_Application.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewWindow.h>
QGridLayout* layout = new QGridLayout();
setLayout( layout );
- layout->addWidget( new QLabel( tr( "MIN_VALUE" ) ), 0, 0 );
- layout->addWidget( new QLabel( tr( "MAX_VALUE" ) ), 1, 0 );
+ layout->addWidget( new QLabel( tr( "Min value" ) ), 0, 0 );
+ layout->addWidget( new QLabel( tr( "Max value" ) ), 1, 0 );
myMin = new QtxDoubleSpinBox( this );
+ myMin->setRange( -1000, 1000 );
myMax = new QtxDoubleSpinBox( this );
+ myMax->setRange( -1000, 1000 );
layout->addWidget( myMin, 0, 1 );
layout->addWidget( myMax, 1, 1 );
layout->addWidget( aBtnFrame, 2, 0, 1, 2 );
QPushButton* ok = new QPushButton( tr( "OK" ), this );
- QPushButton* cancel = new QPushButton( tr( "CANCEL" ), this );
+ QPushButton* cancel = new QPushButton( tr( "Cancel" ), this );
aBtnLayout->addWidget( ok );
aBtnLayout->addWidget( cancel );
connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( ok, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
HYDROGUI_BathymetryLimitsDlg::~HYDROGUI_BathymetryLimitsDlg()
HYDROGUI_BathymetryOp::HYDROGUI_BathymetryOp( HYDROGUI_Module* theModule, int theMode )
-: HYDROGUI_Operation( theModule ), myMode( theMode )
+: HYDROGUI_Operation( theModule ), myMode( theMode ), myIsActivate( false )
{
}
{
}
+OCCViewer_Viewer* getViewer( HYDROGUI_Module* theModule );
Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule );
QList<Handle(HYDROGUI_BathymetryPrs)> getShownBathymetries( HYDROGUI_Module* theModule );
void HYDROGUI_BathymetryOp::activate( bool isActivate )
{
-QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
+ if( myIsActivate==isActivate )
+ return;
+
+ myIsActivate = isActivate;
+ QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
+ bool isUpdateCS = false;
switch( myMode )
{
case BathymetryRescaleSelectionId:
{
if( isActivate )
+ {
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
bath->GetShape()->RescaleBySelection();
+ isUpdateCS = true;
+ }
commit();
break;
}
case BathymetryRescaleVisibleId:
{
if( isActivate )
+ {
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
bath->GetShape()->RescaleByVisible( activeViewWindow() );
+ isUpdateCS = true;
+ }
commit();
break;
}
max = dlg.GetMax();
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
bath->GetShape()->Rescale( min, max );
+
+ isUpdateCS = true;
commit();
}
else
case BathymetryRescaleDefaultId:
{
if( isActivate )
+ {
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
bath->GetShape()->RescaleDefault();
+ isUpdateCS = true;
+ }
+ commit();
break;
}
}
+
+ if( isUpdateCS )
+ module()->getOCCDisplayer()->UpdateColorScale( getViewer( module() ) );
}
private:
int myMode;
+ bool myIsActivate;
};
#include <HYDROGUI_Module.h>
#include <HYDROGUI_BathymetryPrs.h>
#include <HYDROGUI_BathymetryOp.h>
+#include <HYDROGUI_ShapeBathymetry.h>
#include <OCCViewer_ViewManager.h>
#include <LightApp_Application.h>
return ( aBathOp != 0 );
}
-Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule )
+OCCViewer_Viewer* getViewer( HYDROGUI_Module* theModule )
{
LightApp_Application* app = theModule->getApp();
OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>
( app->getViewManager( OCCViewer_Viewer::Type(), true ) );
- Handle(AIS_InteractiveContext) ctx = mgr->getOCCViewer()->getAISContext();
- return ctx;
+ return mgr->getOCCViewer();
+}
+
+Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule )
+{
+ return getViewer( theModule )->getAISContext();
}
QList<Handle(HYDROGUI_BathymetryPrs)> getShownBathymetries( HYDROGUI_Module* theModule )
{
bath->ClearSelected();
bath->SetAutoHilight( Standard_True );
+ bath->GetShape()->TextLabels( false );
ctx->Deactivate( bath );
}
ctx->CloseLocalContext( -1, Standard_True );
*/
Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
+ void UpdateColorScale( const OCCViewer_Viewer* );
+
protected:
/**
* \brief Erase all viewer objects.
const int theViewerId,
const bool theIsForced,
const bool theDoFitAll );
-
-protected:
/**
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
void purgeObjects( const int theViewerId );
-
- void UpdateColorScale( const OCCViewer_Viewer* );
private:
/**
if( isChecked )
startOperation( BathymetrySelectionId );
else
- operation( BathymetrySelectionId )->abort();
+ {
+ LightApp_Operation* op = operation( BathymetryTextId );
+ if( op )
+ op->abort();
+
+ op = operation( BathymetrySelectionId );
+ if( op )
+ op->abort();
+ }
}
void HYDROGUI_Module::onBathymetryText()
getContext()->ClearSelected();
myMin = qMin( theMin, theMax );
myMax = qMax( theMin, theMax );
+ setToUpdateColorScale( true );
getAISObject()->Redisplay();
}
<source>DSK_BATHYMETRY_SELECTION</source>
<translation>Selection on bathymetry</translation>
</message>
+ <message>
+ <source>DSK_BATHYMETRY_TEXT</source>
+ <translation>Z-Values on bathymetry</translation>
+ </message>
+ <message>
+ <source>DSK_BATHYMETRY_RESCALE_SELECTION</source>
+ <translation>Rescale bathymetry by selection</translation>
+ </message>
+ <message>
+ <source>DSK_BATHYMETRY_RESCALE_VISIBLE</source>
+ <translation>Rescale bathymetry by visible range</translation>
+ </message>
+ <message>
+ <source>DSK_BATHYMETRY_RESCALE_USER</source>
+ <translation>Custom rescale bathymetry</translation>
+ </message>
+ <message>
+ <source>DSK_BATHYMETRY_RESCALE_DEFAULT</source>
+ <translation>Default rescale bathymetry</translation>
+ </message>
<message>
<source>DSK_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>MEN_BATHYMETRY_SELECTION</source>
<translation>Selection on bathymetry</translation>
</message>
+ <message>
+ <source>MEN_BATHYMETRY_TEXT</source>
+ <translation>Z-Values on bathymetry</translation>
+ </message>
+ <message>
+ <source>MEN_BATHYMETRY_RESCALE_SELECTION</source>
+ <translation>Rescale bathymetry by selection</translation>
+ </message>
+ <message>
+ <source>MEN_BATHYMETRY_RESCALE_VISIBLE</source>
+ <translation>Rescale bathymetry by visible range</translation>
+ </message>
+ <message>
+ <source>MEN_BATHYMETRY_RESCALE_USER</source>
+ <translation>Custom rescale bathymetry</translation>
+ </message>
+ <message>
+ <source>MEN_BATHYMETRY_RESCALE_DEFAULT</source>
+ <translation>Default rescale bathymetry</translation>
+ </message>
<message>
<source>MEN_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>STB_BATHYMETRY_SELECTION</source>
<translation>Selection on bathymetry</translation>
</message>
+ <message>
+ <source>
+ STB_BATHYMETRY_RESCALE_SELECTION
+ </source>
+ <translation>Rescale bathymetry by selection</translation>
+ </message>
+ <message>
+ <source>
+ STB_BATHYMETRY_RESCALE_VISIBLE
+ </source>
+ <translation>Rescale bathymetry by visible range</translation>
+ </message>
+ <message>
+ <source>
+ STB_BATHYMETRY_RESCALE_USER
+ </source>
+ <translation>Custom rescale bathymetry</translation>
+ </message>
+ <message>
+ <source>
+ STB_BATHYMETRY_RESCALE_DEFAULT
+ </source>
+ <translation>Default rescale bathymetry</translation>
+ </message>
<message>
<source>STB_IMPORT_IMAGE</source>
<translation>Import image</translation>