Salome HOME
projects
/
modules
/
hydro.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7
[modules/hydro.git]
/
src
/
HYDROGUI
/
HYDROGUI_ShapeBathymetry.cxx
diff --git
a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
index 2e43a726d42c5b0f361e4da842600ecbdfacf830..a88b5069923989e42e06f4bcf2ef403b7ef4b692 100644
(file)
--- a/
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
+++ b/
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
@@
-1,8
+1,4
@@
-// Copyright (C) 2007-2015 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
-//
+// 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
// 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
@@
-26,13
+22,12
@@
#include <HYDROData_Bathymetry.h>
#include <AIS_InteractiveContext.hxx>
#include <HYDROData_Bathymetry.h>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_Drawer.hxx>
-#include <Aspect_ColorScale.hxx>
+#include <AIS_ColorScale.hxx>
#include <Prs3d_PointAspect.hxx>
HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer,
const Handle(AIS_InteractiveContext)& theContext,
#include <Prs3d_PointAspect.hxx>
HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer,
const Handle(AIS_InteractiveContext)& theContext,
- const Handle
_HYDROData_Bathymetry&
theBathymetry,
+ const Handle
(HYDROData_Bathymetry)&
theBathymetry,
const int theZLayer )
: HYDROGUI_Shape( theContext, theBathymetry, theZLayer ),
myDisplayer( theDisplayer )
const int theZLayer )
: HYDROGUI_Shape( theContext, theBathymetry, theZLayer ),
myDisplayer( theDisplayer )
@@
-42,7
+37,7
@@
HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer*
HYDROGUI_ShapeBathymetry::~HYDROGUI_ShapeBathymetry()
{
HYDROGUI_ShapeBathymetry::~HYDROGUI_ShapeBathymetry()
{
-
myDisplayer->SetToUpdateColorScale(
);
+
setToUpdateColorScale( true
);
}
void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivateSelection )
}
void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivateSelection )
@@
-53,7
+48,7
@@
void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate
Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
- if ( !aBath.IsNull() )
+ if ( !aBath.IsNull()
&& !aBath->GetAltitudePoints().empty()
)
{
buildShape();
updateShape( false, false );
{
buildShape();
updateShape( false, false );
@@
-63,29
+58,29
@@
void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate
}
}
-Handle
_AIS_InteractiveObject
HYDROGUI_ShapeBathymetry::createShape() const
+Handle
(AIS_InteractiveObject)
HYDROGUI_ShapeBathymetry::createShape() const
{
{
- Handle_HYDROData_Bathymetry aBath = Handle_HYDROData_Bathymetry::DownCast( getObject() );
+ Handle(AIS_InteractiveObject) aPntCloud;
+
+ Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
if( !aBath.IsNull() )
{
if( !aBath.IsNull() )
{
-
Handle_AIS_PointCloud
aPntCloud = new HYDROGUI_BathymetryPrs();
+ aPntCloud = new HYDROGUI_BathymetryPrs();
aPntCloud->SetHilightMode( AIS_PointCloud::DM_BndBox );
aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0));
const HYDROData_Bathymetry::AltitudePoints& aBathPoints = aBath->GetAltitudePoints();
aPntCloud->SetHilightMode( AIS_PointCloud::DM_BndBox );
aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0));
const HYDROData_Bathymetry::AltitudePoints& aBathPoints = aBath->GetAltitudePoints();
- int aLower =
aBathPoints.Lower()
;
- int anUpper =
aBathPoints.Upper()
;
+ int aLower =
0
;
+ int anUpper =
(int)aBathPoints.size()-1
;
HYDROGUI_ShapeBathymetry* aThat = const_cast<HYDROGUI_ShapeBathymetry*>( this );
aThat->myCoords = new TColgp_HArray1OfPnt( aLower, anUpper );
aThat->myColors = new Quantity_HArray1OfColor( aLower, anUpper );
for( int i=aLower; i<=anUpper; i++ )
HYDROGUI_ShapeBathymetry* aThat = const_cast<HYDROGUI_ShapeBathymetry*>( this );
aThat->myCoords = new TColgp_HArray1OfPnt( aLower, anUpper );
aThat->myColors = new Quantity_HArray1OfColor( aLower, anUpper );
for( int i=aLower; i<=anUpper; i++ )
- aThat->myCoords->SetValue( i, aBathPoints.Value( i ) );
-
- return aPntCloud;
+ aThat->myCoords->SetValue( i, gp_Pnt( aBathPoints[i].X, aBathPoints[i].Y, aBathPoints[i].Z ) );
}
}
- else
-
return Handle_AIS_InteractiveObject()
;
+
+
return aPntCloud
;
}
void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const
}
void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const
@@
-107,8
+102,10
@@
void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const
}
}
}
}
-void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(A
spect
_ColorScale)& theColorScale )
+void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(A
IS
_ColorScale)& theColorScale )
{
{
+ if (!myCoords)
+ return;
for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ )
{
double z = myCoords->Value( i ).Z();
for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ )
{
double z = myCoords->Value( i ).Z();
@@
-116,7
+113,7
@@
void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(Aspect_ColorSc
theColorScale->FindColor( z, aColor );
myColors->SetValue( i, aColor );
}
theColorScale->FindColor( z, aColor );
myColors->SetValue( i, aColor );
}
- Handle
_AIS_PointCloud aPntCloud = Handle_AIS_PointCloud
::DownCast( getAISObject() );
+ Handle
(AIS_PointCloud) aPntCloud = Handle(AIS_PointCloud)
::DownCast( getAISObject() );
aPntCloud->SetPoints( myCoords, myColors );
getContext()->Redisplay( aPntCloud, Standard_False );
}
aPntCloud->SetPoints( myCoords, myColors );
getContext()->Redisplay( aPntCloud, Standard_False );
}
@@
-127,8
+124,7
@@
void HYDROGUI_ShapeBathymetry::setVisible( const bool theState,
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( isShown != theState );
HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( isShown != theState );
HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer )
}
void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer )
@@
-136,8
+132,7
@@
void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer )
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( !isShown );
HYDROGUI_Shape::displayShape( theIsUpdateViewer );
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( !isShown );
HYDROGUI_Shape::displayShape( theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer )
}
void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer )
@@
-145,8
+140,7
@@
void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer )
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( !isShown );
HYDROGUI_Shape::display( theIsUpdateViewer );
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( !isShown );
HYDROGUI_Shape::display( theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer )
}
void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer )
@@
-154,6
+148,13
@@
void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer )
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( isShown );
HYDROGUI_Shape::erase( theIsUpdateViewer );
bool isShown = getContext()->IsDisplayed( getAISObject() );
bool isChanged = ( isShown );
HYDROGUI_Shape::erase( theIsUpdateViewer );
- if( isChanged )
+ setToUpdateColorScale( isChanged );
+}
+
+void HYDROGUI_ShapeBathymetry::setToUpdateColorScale( bool isChanged )
+{
+#ifndef LIGHT_MODE
+ if( isChanged && myDisplayer )
myDisplayer->SetToUpdateColorScale();
myDisplayer->SetToUpdateColorScale();
+#endif
}
}