#include <HYDROGUI_OCCDisplayer.h>
#include <HYDROGUI_BathymetryPrs.h>
#include <HYDROData_Bathymetry.h>
+#include <HYDROGUI_Tool.h>
#include <AIS_InteractiveContext.hxx>
#include <AIS_ColorScale.hxx>
#include <QTime>
#include <utilities.h>
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Bathymetry)& theBathymetry,
QList<Handle(AIS_InteractiveObject)> HYDROGUI_ShapeBathymetry::createShape() const
{
+ DEBTRACE("createShape");
QList<Handle(AIS_InteractiveObject)> shapes;
Handle(AIS_InteractiveObject) aPntCloud;
void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale )
{
+ DEBTRACE("UpdateWithColorScale");
if (!myCoords || getAISObjects().isEmpty())
return;
{
if( !myRangeInitialized )
{
- HYDROGUI_ShapeBathymetry* that =
+ HYDROGUI_ShapeBathymetry* that =
const_cast<HYDROGUI_ShapeBathymetry*>( this );
that->RescaleDefault();
that->myRangeInitialized = true;
QVector<int> HYDROGUI_ShapeBathymetry::selected() const
{
+ DEBTRACE("selected");
QVector<int> selected;
- selected.reserve( myCoords->Size() );
- Handle(AIS_InteractiveObject) obj = getAISObjects().first();
+ // HYDROGUI_BathymetryPrs::ClearSelected() called before: Nothing left...
- Handle(AIS_InteractiveContext) c = getContext();
- if( !c.IsNull() )
- {
- Handle(AIS_LocalContext) lc = c->LocalContext();
- if( !lc.IsNull() )
- {
- for( lc->InitSelected(); lc->MoreSelected(); lc->NextSelected() )
- {
- Handle(HYDROGUI_BathymetryPointOwner) anOwner =
- Handle(HYDROGUI_BathymetryPointOwner)::DownCast( lc->SelectedOwner() );
- if( !anOwner.IsNull() && anOwner->Selectable()==obj )
- selected.append( anOwner->GetIndex() );
- }
- }
- }
+ Handle(HYDROGUI_BathymetryPrs) aPntCloud = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] );
+ if (!aPntCloud.IsNull())
+ selected = aPntCloud->getSelectedPoints();
+ DEBTRACE("selected " << selected.size());
return selected;
}
void HYDROGUI_ShapeBathymetry::Rescale( double theMin, double theMax )
{
- getContext()->ClearSelected();
+ getContext()->ClearSelected(true);
myMin = qMin( theMin, theMax );
myMax = qMax( theMin, theMax );
setToUpdateColorScale( true );
if( !getAISObjects().isEmpty() )
{
- getContext()->RecomputePrsOnly( getAISObjects()[0] );
- //getAISObjects()[0]->Redisplay();
+ getContext()->RecomputePrsOnly( getAISObjects()[0], true );
}
}
void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn, bool isUpdateCurrentViewer )
{
+ DEBTRACE("TextLabels " << isOn << " " << isUpdateCurrentViewer);
if( getAISObjects().isEmpty() )
return;
if( isOn )
selection = selected();
- //getContext()->ClearSelected();
+
prs->SetTextLabels( selection );
getContext()->RecomputePrsOnly( prs, Standard_False, Standard_False );
- //prs->Redisplay();
if( isUpdateCurrentViewer )
- getContext()->UpdateCurrentViewer();
+ getContext()->UpdateCurrentViewer();
}