#include <LightApp_UpdateFlags.h>
#include <OCCViewer_ViewModel.h>
-#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewWindow.h>
+#include <OCCViewer_ViewManager.h>
#include <OCCViewer_AISSelector.h>
#include <AIS_ListOfInteractive.hxx>
commitDocOperation();
else
{
- errMessage = tr( "CALCULATE_ERROR" ), QString( anIterp->GetErrorMessage().c_str() );
+ errMessage = tr( "CALCULATE_ERROR" ), QString( HYDROGUI_Tool::ToQString( anIterp->GetErrorMessage() ) );
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 );
commit();
}
- return errMessage.isEmpty();
+ bool res = errMessage.isEmpty();
+
+ if ( res )
+ theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+
+ return res;
}
void HYDROGUI_ProfileInterpolateOp::updatePreview()
{
myPreview = new AIS_Shape( aShape );
myPreview->SetColor( Quantity_NOC_RED );
- aCtx->Display( myPreview, 0, -1, false );
+ aCtx->Display( myPreview, 1, -1, false );
}
}
}
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() )
{
- 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;
}
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;
HYDROData_IProfilesInterpolator* aRes = 0;
if ( anIFactory )
- aRes = anIFactory->GetInterpolator( theName.toStdString() );
+ aRes = anIFactory->GetInterpolator( HYDROGUI_Tool::ToAsciiString( theName ) );
return aRes;
}
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( aWire, aPreviewShape );
+ aBuilder.Add( aPreviewShape, aWire );
}
}
if ( !aPanel || !anInterp )
return;
- aPanel->setInterpolatorDescription( QString( anInterp->GetDescription().c_str() ) );
+ aPanel->setInterpolatorDescription( HYDROGUI_Tool::ToQString( anInterp->GetDescription() ) );
updatePreview();
}
Handle(AIS_Shape) aPrs = new AIS_Shape( aProfile->GetShape3D() );
aPrs->SetOwner( aProfile );
aPrs->SetColor( Quantity_NOC_BLACK );
- aCtx->Display( aPrs, 0, 0, false );
+ aCtx->Display( aPrs, 1, 0, false );
+ }
+ }
+ OCCViewer_ViewManager* vm = aDlg->viewManager();
+ if ( vm )
+ {
+ QVector<SUIT_ViewWindow*> winList = vm->getViews();
+ for ( QVector<SUIT_ViewWindow*>::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ OCCViewer_ViewWindow* occWin = ::qobject_cast<OCCViewer_ViewWindow*>( *it );
+ if ( occWin )
+ {
+ OCCViewer_ViewPort3d* vp = occWin->getViewPort();
+ if ( vp )
+ vp->fitAll();
+ }
}
}
}