#include <QImage>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
const int BATH_HIGHLIGHT_MODE = 10;
HYDROGUI_BathymetryPrs::HYDROGUI_BathymetryPrs( const HYDROGUI_ShapeBathymetry* theShape )
: myShape( theShape )
{
+ DEBTRACE("HYDROGUI_BathymetryPrs");
SetHilightMode( BATH_HIGHLIGHT_MODE );
SetAutoHilight( Standard_True );
}
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode )
{
+ DEBTRACE("Compute " << theMode);
thePresentation->Clear();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
- if( theMode==BATH_HIGHLIGHT_MODE )
+ if( theMode==BATH_HIGHLIGHT_MODE ) // highlight ==> draw bounding box
{
if( myBound.IsVoid() )
UpdateBound();
-
- if( myBound.IsVoid() ||
+ if( myBound.IsVoid() ||
myBound.IsOpenXmin() || myBound.IsOpenXmax() ||
myBound.IsOpenYmin() || myBound.IsOpenYmax() ||
myBound.IsOpenZmin() || myBound.IsOpenZmax() )
Standard_Real xmin, xmax, ymin, ymax, zmin, zmax;
myBound.Get( xmin, ymin, zmin, xmax, ymax, zmax );
- Handle(Prs3d_LineAspect) aWireAspect = new Prs3d_LineAspect( Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0 );
- aGroup->SetPrimitivesAspect( aWireAspect->Aspect() );
+ Handle(Prs3d_LineAspect) aWireAspect = new Prs3d_LineAspect( Quantity_NOC_RED, Aspect_TOL_DASH, 4.0 );
+ aGroup->SetPrimitivesAspect( aWireAspect->Aspect() ); // use Aspect_TOL_DASH to find the group by the aspect style
Handle(Graphic3d_ArrayOfPolylines) aLines = new Graphic3d_ArrayOfPolylines( 18, 6 );
-
+
aLines->AddBound( 5 );
aLines->AddVertex( xmin, ymin, zmin );
aLines->AddVertex( xmax, ymin, zmin );
}
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);
+ DEBTRACE("non highlight mode"); // display the nodes as points with color (HYDROGUI_ShapeBathymetry::UpdateWithColorScale)
AIS_PointCloud::Compute( thePresentationManager, thePresentation, theMode );
- aGroup->SetGroupPrimitivesAspect( anAspect );
+
+ QImage qtMark( 4, 4, QImage::Format_RGB888 ); // points marks as 4x4 rectangles
+ Handle(Image_PixMap) aMark = HYDROGUI_Tool::Pixmap( qtMark );
+ DEBTRACE("pnt dims " << aMark->SizeX() << " " << aMark->SizeY());
+ Handle(Graphic3d_MarkerImage) gMark = new Graphic3d_MarkerImage(aMark);
+ Handle(Graphic3d_AspectMarker3d) anAspect = new Graphic3d_AspectMarker3d( Aspect_TOM_USERDEFINED, Quantity_NOC_WHITE, 1.0 );
+ anAspect->SetMarkerImage(gMark);
+
+ DEBTRACE("nb groups " << thePresentation->NumberOfGroups()); // find the group corresponding to the points, change the aspect
+ const Graphic3d_SequenceOfGroup& grps = thePresentation->Groups();
+ Graphic3d_SequenceOfGroup::Iterator anIter( grps );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(Graphic3d_Group) aGrp = anIter.Value();
+ DEBTRACE("grp type: " << aGrp->get_type_name());
+ Handle(Graphic3d_Aspects) asp = aGrp->Aspects();
+ if (!asp.IsNull())
+ {
+ DEBTRACE("aspect: " << asp->get_type_name());
+ if (asp->LineType() != Aspect_TOL_DASH) // find the group which does not correspond to the bounding box
+ aGrp->SetGroupPrimitivesAspect( anAspect );
+ }
+ }
Handle(Graphic3d_ArrayOfPoints) points = GetPoints();
- if( !myTextIndices.empty() && !points.IsNull() )
+ if (!points.IsNull())
+ DEBTRACE("nb points " << points->ItemNumber());
+
+ if( !myTextIndices.empty() && !points.IsNull() ) // points selected ==> altitude labels
{
+ DEBTRACE("myTextIndices.size() " << myTextIndices.size());
char aBuf[1024];
Handle(Prs3d_TextAspect) anAspect = new Prs3d_TextAspect();
HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule ), myIsActive( false )
{
+ DEBTRACE("HYDROGUI_BathymetrySelectionOp");
}
HYDROGUI_BathymetrySelectionOp::~HYDROGUI_BathymetrySelectionOp()
void HYDROGUI_BathymetrySelectionOp::startOperation()
{
+ DEBTRACE("startOperation");
activateSelection( true );
}
void HYDROGUI_BathymetrySelectionOp::abortOperation()
{
+ DEBTRACE("abortOperation");
activateSelection( false );
module()->action( BathymetrySelectionId )->setChecked( false );
bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const
{
+ DEBTRACE("isValid");
HYDROGUI_BathymetryOp* aBathOp = dynamic_cast<HYDROGUI_BathymetryOp*>( theOtherOp );
return ( aBathOp != 0 );
}
QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
if( isActive )
{
- const int aSelectionMode = 1;
+ const int aSelectionMode = 1; // 2 AIS_PointCloud selection bounding box
//ctx->Deactivate( Standard_True );
//ctx->OpenLocalContext( Standard_True );
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
{
+ DEBTRACE("bathy name: " << bath->GetShape()->getObject()->GetName().toStdString());
+ ctx->Deactivate(bath);
ctx->Activate( bath, aSelectionMode, Standard_True );
bath->SetAutoHilight( Standard_False );
}
#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;
QVector<int> HYDROGUI_ShapeBathymetry::selected() const
{
+ DEBTRACE("selected");
QVector<int> selected;
selected.reserve( myCoords->Size() );
Handle(AIS_InteractiveObject) obj = getAISObjects().first();
Handle(AIS_InteractiveContext) c = getContext();
+ int cnt = 0;
if( !c.IsNull() )
{
for( c->InitSelected(); c->MoreSelected(); c->NextSelected() )
{
+ cnt++;
Handle(HYDROGUI_BathymetryPointOwner) anOwner =
Handle(HYDROGUI_BathymetryPointOwner)::DownCast( c->SelectedOwner() );
if( !anOwner.IsNull() && anOwner->Selectable()==obj )
selected.append( anOwner->GetIndex() );
}
}
+ DEBTRACE("selected " << cnt << " " << selected.size() );
return selected;
}
void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn, bool isUpdateCurrentViewer )
{
+ DEBTRACE("TextLabels " << isOn << " " << isUpdateCurrentViewer);
if( getAISObjects().isEmpty() )
return;