--- /dev/null
+
+#include <HYDROGUI_BathymetryPrs.h>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Select3D_SensitiveBox.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
+
+const int BATH_HIGHLIGHT_MODE = 10;
+
+HYDROGUI_BathymetryPrs::HYDROGUI_BathymetryPrs()
+{
+ SetHilightMode( BATH_HIGHLIGHT_MODE );
+}
+
+HYDROGUI_BathymetryPrs::~HYDROGUI_BathymetryPrs()
+{
+}
+
+void HYDROGUI_BathymetryPrs::SetPoints( const Handle(TColgp_HArray1OfPnt)& theCoords,
+ const Handle(Quantity_HArray1OfColor)& theColors )
+{
+ myBound.SetVoid();
+ if( !theCoords.IsNull() )
+ {
+ int aLower = theCoords->Lower();
+ int anUpper = theCoords->Upper();
+
+ for( int i = aLower; i <= anUpper; i++ )
+ {
+ if( i==aLower )
+ myBound.Set( theCoords->Value( i ) );
+ else
+ {
+ gp_Pnt aPnt = theCoords->Value( i );
+ myBound.Update( aPnt.X(), aPnt.Y(), aPnt.Z() );
+ }
+ }
+ }
+ AIS_PointCloud::SetPoints( theCoords, theColors );
+}
+
+void HYDROGUI_BathymetryPrs::Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode )
+{
+ if( theMode==BATH_HIGHLIGHT_MODE )
+ {
+ thePresentation->Clear();
+ if( myBound.IsVoid() ||
+ myBound.IsOpenXmin() || myBound.IsOpenXmax() ||
+ myBound.IsOpenYmin() || myBound.IsOpenYmax() ||
+ myBound.IsOpenZmin() || myBound.IsOpenZmax() )
+ return;
+
+ Standard_Real xmin, xmax, ymin, ymax, zmin, zmax;
+ myBound.Get( xmin, ymin, zmin, xmax, ymax, zmax );
+
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
+ Handle(Prs3d_LineAspect) aWireAspect = new Prs3d_LineAspect( Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0 );
+ aGroup->SetPrimitivesAspect( aWireAspect->Aspect() );
+
+ Handle(Graphic3d_ArrayOfPolylines) aLines = new Graphic3d_ArrayOfPolylines( 18, 6 );
+
+ aLines->AddBound( 5 );
+ aLines->AddVertex( xmin, ymin, zmin );
+ aLines->AddVertex( xmax, ymin, zmin );
+ aLines->AddVertex( xmax, ymax, zmin );
+ aLines->AddVertex( xmin, ymax, zmin );
+ aLines->AddVertex( xmin, ymin, zmin );
+ aLines->AddBound( 5 );
+ aLines->AddVertex( xmin, ymin, zmax );
+ aLines->AddVertex( xmax, ymin, zmax );
+ aLines->AddVertex( xmax, ymax, zmax );
+ aLines->AddVertex( xmin, ymax, zmax );
+ aLines->AddVertex( xmin, ymin, zmax );
+ aLines->AddBound( 2 );
+ aLines->AddVertex( xmin, ymin, zmin );
+ aLines->AddVertex( xmin, ymin, zmax );
+ aLines->AddBound( 2 );
+ aLines->AddVertex( xmax, ymin, zmin );
+ aLines->AddVertex( xmax, ymin, zmax );
+ aLines->AddBound( 2 );
+ aLines->AddVertex( xmax, ymax, zmin );
+ aLines->AddVertex( xmax, ymax, zmax );
+ aLines->AddBound( 2 );
+ aLines->AddVertex( xmin, ymax, zmin );
+ aLines->AddVertex( xmin, ymax, zmax );
+ aGroup->AddPrimitiveArray( aLines );
+ }
+ else
+ AIS_PointCloud::Compute( thePresentationManager, thePresentation, theMode );
+}
+
+void HYDROGUI_BathymetryPrs::ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode )
+{
+ if( theMode == 0 )
+ {
+ if( myBound.IsVoid() ||
+ myBound.IsOpenXmin() || myBound.IsOpenXmax() ||
+ myBound.IsOpenYmin() || myBound.IsOpenYmax() ||
+ myBound.IsOpenZmin() || myBound.IsOpenZmax() )
+ return;
+
+ Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner( this );
+ Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox( anOwner, myBound );
+ theSelection->Add( aSensitiveBox );
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_BATHYMETRY_PRS_H
+#define HYDROGUI_BATHYMETRY_PRS_H
+
+#include <AIS_PointCloud.hxx>
+#include <Bnd_Box.hxx>
+
+class HYDROGUI_BathymetryPrs : public AIS_PointCloud
+{
+public:
+ HYDROGUI_BathymetryPrs();
+ virtual ~HYDROGUI_BathymetryPrs();
+
+ virtual void SetPoints( const Handle(TColgp_HArray1OfPnt)& theCoords,
+ const Handle(Quantity_HArray1OfColor)& theColors = NULL );
+
+protected:
+ virtual void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode = 0 );
+ virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode );
+
+private:
+ Bnd_Box myBound;
+};
+
+#endif
+