X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Bathymetry.cxx;h=15401f0ab37de92ae857dbd226f9c49cfd67242d;hb=4d4d74dd554819c30f1c8ded5520cc6c25aba56b;hp=adc140a1db93066822acd12b612faced8666e980;hpb=f662e2fdc45595b8dd6d7855f3bbd6e9a4176c77;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index adc140a1..15401f0a 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.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 @@ -25,8 +21,6 @@ #include "HYDROData_Tool.h" #include "HYDROData_PolylineXY.h" -#include - #include #include @@ -34,6 +28,7 @@ #include #include +#include #include #include #include @@ -59,20 +54,21 @@ HYDROData_Bathymetry::~HYDROData_Bathymetry() { } -QStringList HYDROData_Bathymetry::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const +QStringList HYDROData_Bathymetry::DumpToPython( const QString& thePyScriptPath, + MapOfTreatedObjects& theTreatedObjects ) const { QStringList aResList = dumpObjectCreation( theTreatedObjects ); QString aBathymetryName = GetObjPyName(); - aResList << QString( "%1.SetAltitudesInverted( %2 );" ) + aResList << QString( "%1.SetAltitudesInverted( %2 )" ) .arg( aBathymetryName ).arg( IsAltitudesInverted() ); TCollection_AsciiString aFilePath = GetFilePath(); - aResList << QString( "%1.ImportFromFile( \"%2\" );" ) + aResList << QString( "%1.ImportFromFile( \"%2\" )" ) .arg( aBathymetryName ).arg( aFilePath.ToCString() ); aResList << QString( "" ); - aResList << QString( "%1.Update();" ).arg( aBathymetryName ); + aResList << QString( "%1.Update()" ).arg( aBathymetryName ); aResList << QString( "" ); return aResList; @@ -99,10 +95,10 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints ) aCoordsArray->SetValue( i * 3 + 2, aPoint.Z() ); } - SetToUpdate( true ); + Changed( Geom_Z ); } -HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() const +HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(bool IsConvertToGlobal) const { AltitudePoints aPoints; @@ -114,6 +110,7 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) ) return aPoints; + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab ); for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; ) { if ( i + 3 > n + 1 ) @@ -124,6 +121,8 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c aPoint.SetY( aCoordsArray->Value( i++ ) ); aPoint.SetZ( aCoordsArray->Value( i++ ) ); + if( IsConvertToGlobal ) + aDoc->Transform( aPoint, false ); aPoints.Append( aPoint ); } @@ -136,7 +135,7 @@ void HYDROData_Bathymetry::RemoveAltitudePoints() if ( !aLabel.IsNull() ) { aLabel.ForgetAllAttributes(); - SetToUpdate( true ); + Changed( Geom_Z ); } } @@ -358,7 +357,7 @@ void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted, TDataStd_Integer::Set( myLab.FindChild( DataTag_AltitudesInverted ), (Standard_Integer)theIsInverted ); - SetToUpdate( true ); + Changed( Geom_Z ); if ( !theIsUpdate ) return; @@ -477,9 +476,9 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, if ( !isXOk || !isYOk || !isZOk ) return false; - if ( boost::math::isnan( aPoint.X() ) || boost::math::isinf( aPoint.X() ) || - boost::math::isnan( aPoint.Y() ) || boost::math::isinf( aPoint.Y() ) || - boost::math::isnan( aPoint.Z() ) || boost::math::isinf( aPoint.Z() ) ) + if ( HYDROData_Tool::IsNan( aPoint.X() ) || HYDROData_Tool::IsInf( aPoint.X() ) || + HYDROData_Tool::IsNan( aPoint.Y() ) || HYDROData_Tool::IsInf( aPoint.Y() ) || + HYDROData_Tool::IsNan( aPoint.Z() ) || HYDROData_Tool::IsInf( aPoint.Z() ) ) return false; // Invert the z value if requested @@ -630,6 +629,9 @@ Handle_HYDROData_PolylineXY HYDROData_Bathymetry::CreateBoundaryPolyline() const aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmin, Ymax ) ); aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymax ) ); aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymin ) ); + + aResult->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() ); + aResult->Update(); return aResult;