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
quick optimization patch (bytearray for images)
[modules/hydro.git]
/
src
/
HYDROGUI
/
HYDROGUI_ProfileInterpolateOp.cxx
diff --git
a/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx
b/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx
index 4f3286288aeecfa7e0c1cb1d5791e368bc3be441..3ea3a5ea84cd10b67af289a4158ef828e3fa960e 100644
(file)
--- a/
src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx
+++ b/
src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.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
@@
-23,6
+19,7
@@
#include <HYDROGUI_ProfileInterpolateOp.h>
#include "HYDROGUI_Tool.h"
#include <HYDROGUI_ProfileInterpolateOp.h>
#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_DataObject.h"
#include "HYDROGUI_UpdateFlags.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_DataObject.h"
#include "HYDROGUI_UpdateFlags.h"
@@
-69,11
+66,14
@@
void HYDROGUI_ProfileInterpolateOp::startOperation()
{
HYDROGUI_Operation::startOperation();
{
HYDROGUI_Operation::startOperation();
- HYDROGUI_ProfileInterpolateDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
- if ( aPanel )
+ if ( isApplyAndClose() )
{
{
+ HYDROGUI_ProfileInterpolateDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( aPanel )
+ {
aPanel->reset();
aPanel->setInterpolators( interpolators() );
aPanel->reset();
aPanel->setInterpolators( interpolators() );
+ }
}
}
}
}
@@
-142,12
+142,12
@@
bool HYDROGUI_ProfileInterpolateOp::processApply( int& theUpdateFlags, QString&
commitDocOperation();
else
{
commitDocOperation();
else
{
- errMessage = tr( "CALCULATE_ERROR" ), QString(
anIterp->GetErrorMessage().c_str(
) );
+ errMessage = tr( "CALCULATE_ERROR" ), QString(
HYDROGUI_Tool::ToQString( anIterp->GetErrorMessage()
) );
abortDocOperation();
}
}
else
abortDocOperation();
}
}
else
- errMessage = tr( "CANT_GET_
RIVER
_OBJECT" ).arg( aDlg->river() );
+ errMessage = tr( "CANT_GET_
STREAM
_OBJECT" ).arg( aDlg->river() );
if ( !errMessage.isEmpty() )
QMessageBox::critical( aDlg->topLevelWidget(), tr( "INTERPOLATION_ERROR" ), errMessage, QMessageBox::Ok );
if ( !errMessage.isEmpty() )
QMessageBox::critical( aDlg->topLevelWidget(), tr( "INTERPOLATION_ERROR" ), errMessage, QMessageBox::Ok );
@@
-208,24
+208,19
@@
void HYDROGUI_ProfileInterpolateOp::updateInterpolator( HYDROData_IProfilesInter
theInt->SetResultProfilesNumber( aDlg->profileNumber() );
theInt->SetProfiles( profile( aDlg->profileStart() ), profile( aDlg->profileFinish() ) );
ParamsList aParams = parameters( aDlg->interpolatorParameters() );
theInt->SetResultProfilesNumber( aDlg->profileNumber() );
theInt->SetProfiles( profile( aDlg->profileStart() ), profile( aDlg->profileFinish() ) );
ParamsList aParams = parameters( aDlg->interpolatorParameters() );
- for ( ParamsList::Iterator it = aParams.begin(); it != aParams.end(); ++it )
- theInt->SetParameter( (*it).first.toStdString(), (*it).second.toStdString() );
+ for ( ParamsList::Iterator it = aParams.begin(); it != aParams.end(); ++it ) {
+ theInt->SetParameter( HYDROGUI_Tool::ToAsciiString( (*it).first ),
+ HYDROGUI_Tool::ToAsciiString( (*it).second ) );
+ }
}
}
-
std::vector<double>
HYDROGUI_ProfileInterpolateOp::profile( const QString& theName ) const
+
HYDROData_Profile::ProfilePoints
HYDROGUI_ProfileInterpolateOp::profile( const QString& theName ) const
{
{
-
std::vector<double>
aPoints;
+
HYDROData_Profile::ProfilePoints
aPoints;
Handle(HYDROData_Profile) aProf = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), theName, KIND_PROFILE ) );
if ( !aProf.IsNull() )
{
Handle(HYDROData_Profile) aProf = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), theName, KIND_PROFILE ) );
if ( !aProf.IsNull() )
{
- HYDROData_Profile::ProfilePoints aPntList = aProf->GetProfilePoints();
- for ( int i = aPntList.Lower(); i <= aPntList.Upper(); i++ )
- {
- HYDROData_Profile::ProfilePoint aPnt = aPntList.Value( i );
- aPoints.push_back( aPnt.X() );
- aPoints.push_back( aPnt.Y() );
- aPoints.push_back( aPnt.Z() );
- }
+ aPoints = aProf->GetProfilePoints();
}
return aPoints;
}
}
return aPoints;
}
@@
-270,9
+265,11
@@
QStringList HYDROGUI_ProfileInterpolateOp::interpolators() const
QStringList aNames;
if ( anIFactory )
{
QStringList aNames;
if ( anIFactory )
{
- std::vector<std::string> iNames = anIFactory->GetInterpolatorNames();
- for ( std::vector<std::string>::iterator it = iNames.begin(); it != iNames.end(); ++it )
- aNames.append( (*it).c_str() );
+ NCollection_Sequence<TCollection_AsciiString> iNames = anIFactory->GetInterpolatorNames();
+ for ( int i = 1, n = iNames.Size(); i <= n; ++i ) {
+ const TCollection_AsciiString& anInterpName = iNames.Value( i );
+ aNames.append( HYDROGUI_Tool::ToQString( anInterpName ) );
+ }
}
return aNames;
}
return aNames;
@@
-287,7
+284,7
@@
HYDROData_IProfilesInterpolator* HYDROGUI_ProfileInterpolateOp::interpolator( co
HYDROData_IProfilesInterpolator* aRes = 0;
if ( anIFactory )
HYDROData_IProfilesInterpolator* aRes = 0;
if ( anIFactory )
- aRes = anIFactory->GetInterpolator(
theName.toStdString(
) );
+ aRes = anIFactory->GetInterpolator(
HYDROGUI_Tool::ToAsciiString( theName
) );
return aRes;
}
return aRes;
}
@@
-300,10
+297,8
@@
TopoDS_Shape HYDROGUI_ProfileInterpolateOp::previewShape( HYDROData_IProfilesInt
aBuilder.MakeCompound( aPreviewShape );
for ( int i = 0; i < theInterp->GetCalculatedProfilesNumber(); i++ )
{
aBuilder.MakeCompound( aPreviewShape );
for ( int i = 0; i < theInterp->GetCalculatedProfilesNumber(); i++ )
{
- NCollection_Sequence<gp_XYZ> pointSeq;
- std::vector<double> aPoints = theInterp->GetResultProfile( i );
- for ( int i = 0; i < (int) aPoints.size(); i += 3 )
- pointSeq.Append( gp_XYZ( aPoints[i], aPoints[i+1], aPoints[i+2] ) );
+ NCollection_Sequence<gp_XYZ> pointSeq = theInterp->GetResultProfilePoints( i );
+
TopoDS_Shape aWire = HYDROData_PolylineXY::BuildWire( HYDROData_IPolyline::SECTION_SPLINE, false, pointSeq );
if ( !aWire.IsNull() )
aBuilder.Add( aPreviewShape, aWire );
TopoDS_Shape aWire = HYDROData_PolylineXY::BuildWire( HYDROData_IPolyline::SECTION_SPLINE, false, pointSeq );
if ( !aWire.IsNull() )
aBuilder.Add( aPreviewShape, aWire );
@@
-320,7
+315,7
@@
void HYDROGUI_ProfileInterpolateOp::onInterpolatorChanged( const QString& theInt
if ( !aPanel || !anInterp )
return;
if ( !aPanel || !anInterp )
return;
- aPanel->setInterpolatorDescription(
QString( anInterp->GetDescription().c_str
() ) );
+ aPanel->setInterpolatorDescription(
HYDROGUI_Tool::ToQString( anInterp->GetDescription
() ) );
updatePreview();
}
updatePreview();
}