aCoordsArray->SetValue( i * 3 + 1, aPoint.Y() );
aCoordsArray->SetValue( i * 3 + 2, aPoint.Z() );
}
+
+ SetToUpdate( true );
}
HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() const
{
AltitudePoints aPoints;
+ TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false );
+ if ( aLabel.IsNull() )
+ return aPoints;
+
Handle(TDataStd_RealArray) aCoordsArray;
- if ( !myLab.FindChild( DataTag_AltitudePoints ).FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) )
+ if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) )
return aPoints;
for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; )
void HYDROData_Bathymetry::RemoveAltitudePoints()
{
- TDF_Label aLab = myLab.FindChild( DataTag_AltitudePoints );
- aLab.ForgetAllAttributes();
+ TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false );
+ if ( !aLabel.IsNull() )
+ {
+ aLabel.ForgetAllAttributes();
+ SetToUpdate( true );
+ }
}
void interpolateAltitudeForPoints( const gp_XY& thePoint,
return aResSeq;
}
-void HYDROData_CalculationCase::SplitGeometryObjects()
+void HYDROData_CalculationCase::Update()
{
+ HYDROData_Entity::Update();
+
// At first we remove previously created regions
RemoveRegions();
aRegionZone->AddGeometryObject( aRefObject );
}
}
-
- // The splitted data is up to date
- SetToUpdate( false );
}
bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
*/
HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+ /**
+ * Update the calcualtion case object.
+ * Call this method whenever you made changes for object data.
+ */
+ HYDRODATA_EXPORT virtual void Update();
+
/**
* Returns the list of all reference objects of this object.
*/
public:
// Public methods to work with Calculation
- /**
- * Split reference geometry objects to non-intersected regions.
- */
- HYDRODATA_EXPORT virtual void SplitGeometryObjects();
-
-
/**
* Add new one reference geometry object for calculation case.
*/
#include "HYDROData_Entity.h"
#include "HYDROData_Iterator.h"
+#include "HYDROData_Tool.h"
#include <TDataStd_Name.hxx>
#include <TDataStd_ByteArray.hxx>
void HYDROData_Entity::Update()
{
+ SetToUpdate( false );
}
QVariant HYDROData_Entity::GetDataVariant()
return QVariant();
}
-void HYDROData_Entity::SetToUpdate(bool theFlag)
+void HYDROData_Entity::SetToUpdate( bool theFlag )
{
+ if ( IsMustBeUpdated() == theFlag )
+ return;
+
if ( theFlag )
{
TDataStd_UAttribute::Set( myLab, GUID_MUST_BE_UPDATED );
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if ( !aDocument.IsNull() )
+ {
+ // Change the states of this and all depended objects
+ HYDROData_Tool::SetMustBeUpdatedObjects( aDocument );
+ }
}
else
{
#include "HYDROData_Document.h"
#include "HYDROData_Lambert93.h"
-#include "HYDROData_Tool.h"
#include "HYDROData_OperationsFactory.h"
#include <TDataStd_RealArray.hxx>
void HYDROData_Image::Update()
{
+ bool anIsToUpdate = IsMustBeUpdated();
+
+ HYDROData_Entity::Update();
+
+ if ( !anIsToUpdate )
+ return;
+
HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
ImageComposer_Operator* anOp = aFactory->Operator( OperatorName() );
if ( anOp ) // Update image if there is an operation
{
// Fill by arguments and process the operation
+ anOp->setBinArgs( Args() );
+
QVariant anObj1, anObj2;
int aNbReferences = NbReferences();
{
UpdateTrsf();
}
-
- Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
- if ( !aDocument.IsNull() )
- {
- // Change the states of this and all depended images
- SetToUpdate( true );
- HYDROData_Tool::SetMustBeUpdatedImages( aDocument );
- SetToUpdate( false );
- }
}
QVariant HYDROData_Image::GetDataVariant()
void HYDROData_Image::SetImage(const QImage& theImage)
{
- if (theImage.isNull()) {
+ if ( theImage.isNull() )
+ {
// for empty image remove all previously stored attributes
myLab.ForgetAttribute(TDataStd_IntegerArray::GetID());
myLab.ForgetAttribute(TDataStd_ByteArray::GetID());
- return;
}
- // store width, height, bytes per line and format in integer array
- Handle(TDataStd_IntegerArray) aParams;
- if (!myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aParams)) {
- aParams = TDataStd_IntegerArray::Set(myLab, 1, 4);
+ else
+ {
+ // store width, height, bytes per line and format in integer array
+ Handle(TDataStd_IntegerArray) aParams;
+ if (!myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aParams)) {
+ aParams = TDataStd_IntegerArray::Set(myLab, 1, 4);
+ }
+ aParams->SetValue(1, theImage.width());
+ aParams->SetValue(2, theImage.height());
+ aParams->SetValue(3, theImage.bytesPerLine());
+ aParams->SetValue(4, (int)(theImage.format()));
+ // store data of image in byte array
+ const char* aData = (const char*)(theImage.bits());
+ SaveByteArray(0, aData, theImage.byteCount());
}
- aParams->SetValue(1, theImage.width());
- aParams->SetValue(2, theImage.height());
- aParams->SetValue(3, theImage.bytesPerLine());
- aParams->SetValue(4, (int)(theImage.format()));
- // store data of image in byte array
- const char* aData = (const char*)(theImage.bits());
- SaveByteArray(0, aData, theImage.byteCount());
+
+ SetToUpdate( true );
}
-bool HYDROData_Image::LoadImage(const QString& theFilePath)
+bool HYDROData_Image::LoadImage( const QString& theFilePath )
{
QImage anImage( theFilePath );
SetImage( anImage );
return aResult;
}
-void HYDROData_Image::SetFilePath(const QString& theFilePath)
+void HYDROData_Image::SetFilePath( const QString& theFilePath )
{
TCollection_AsciiString anAsciiStr( theFilePath.toStdString().c_str() );
TDataStd_AsciiString::Set( myLab.FindChild( DataTag_FilePath ), anAsciiStr );
+
+ SetToUpdate( true );
}
QString HYDROData_Image::GetFilePath() const
anArray->SetValue(7, theTrsf.m31());
anArray->SetValue(8, theTrsf.m32());
anArray->SetValue(9, theTrsf.m33());
+
+ SetToUpdate( true );
}
QTransform HYDROData_Image::Trsf() const
SetIsSelfSplitted( false );
}
- SetToUpdate( false );
-
bool anIsByTwoPoints = IsByTwoPoints();
QImage anImage = Image();
if ( anImage.isNull() )
+ {
+ SetToUpdate( false );
return;
+ }
// Set local points to default position
QPoint aLocalPointA = QPoint( 0, 0 );
QPointF( aTransform.map( aLocalPointC ) );
SetGlobalPoints( ManualCartesian, aTrsfPointA, aTrsfPointB, aTrsfPointC );
+
+ SetToUpdate( false );
}
void HYDROData_Image::SetLocalPoints( const QPoint& thePointA,
if ( theIsUpdate )
UpdateTrsf();
+
+ SetToUpdate( true );
}
bool HYDROData_Image::GetLocalPoints( QPoint& thePointA,
if ( theIsUpdate )
UpdateTrsf();
- /*
- if( anIsRefImage )
- {
- aCPointA = QPointF( aTransform.map( aPointA ) );
- aCPointB = QPointF( aTransform.map( aPointB ) );
- aCPointC = QPointF( aTransform.map( aPointC ) );
-
- // compute Lambert93 points
- xca = aCPointA.x();
- yca = aCPointA.y();
- xcb = aCPointB.x();
- ycb = aCPointB.y();
- xcc = aCPointC.x();
- ycc = aCPointC.y();
-
- double xla = 0, yla = 0, xlb = 0, ylb = 0, xlc = 0, ylc = 0;
- HYDROData_Lambert93::toGeo( xca, yca, yla, xla );
- HYDROData_Lambert93::toGeo( xcb, ycb, ylb, xlb );
- HYDROData_Lambert93::toGeo( xcc, ycc, ylc, xlc );
-
- aLPointA = QPointF( xla * 3600.0, yla * 3600.0 ); // convert degrees to seconds
- aLPointB = QPointF( xlb * 3600.0, ylb * 3600.0 ); // convert degrees to seconds
- aLPointC = QPointF( xlc * 3600.0, ylc * 3600.0 ); // convert degrees to seconds
- }
- */
+ SetToUpdate( true );
}
bool HYDROData_Image::GetGlobalPoints( TransformationMode& theMode,
void HYDROData_Image::SetTrsfMode( const TransformationMode& theMode )
{
TDataStd_Integer::Set( myLab.FindChild( DataTag_TrsfMode ), (int)theMode );
+ SetToUpdate( true );
}
HYDROData_Image::TransformationMode HYDROData_Image::GetTrsfMode() const
void HYDROData_Image::SetTrsfReferenceImage( const Handle(HYDROData_Image)& theRefImage )
{
SetReferenceObject( theRefImage, DataTag_TrsfImage );
+ SetToUpdate( true );
}
Handle(HYDROData_Image) HYDROData_Image::GetTrsfReferenceImage() const
void HYDROData_Image::RemoveTrsfReferenceImage()
{
- return RemoveReferenceObject( DataTag_TrsfImage );
+ RemoveReferenceObject( DataTag_TrsfImage );
+ SetToUpdate( true );
}
void HYDROData_Image::AppendReference( const Handle(HYDROData_Entity)& theReferenced )
{
AddReferenceObject( theReferenced, 0 );
+ SetToUpdate( true );
}
int HYDROData_Image::NbReferences() const
const int theIndex, Handle(HYDROData_Entity) theReferenced)
{
SetReferenceObject( theReferenced, 0, theIndex );
+ SetToUpdate( true );
}
void HYDROData_Image::RemoveReference(const int theIndex)
{
RemoveReferenceObject( 0, theIndex );
+ SetToUpdate( true );
}
void HYDROData_Image::ClearReferences()
{
ClearReferenceObjects( 0 );
+ SetToUpdate( true );
}
void HYDROData_Image::SetOperatorName( const QString theOpName )
{
TCollection_AsciiString anAsciiStr( theOpName.toStdString().c_str() );
TDataStd_AsciiString::Set( myLab.FindChild( DataTag_Operator ), anAsciiStr );
+ SetToUpdate( true );
}
QString HYDROData_Image::OperatorName() const
void HYDROData_Image::SetArgs(const QByteArray& theArgs)
{
SaveByteArray(DataTag_Operator, theArgs.constData(), theArgs.length());
+ SetToUpdate( true );
}
QByteArray HYDROData_Image::Args() const
} else {
myLab.ForgetAttribute(GUID_SELF_SPLITTED);
}
+ SetToUpdate( true );
}
bool HYDROData_Image::IsSelfSplitted() const
const bool& theIsLocal ) const
{
// Rotate vector to 90 degrees : clockwise - for local
- // anticlockwise - for global
+ // counterclockwise - for global
const double aTheta = theIsLocal ? -M_PI_2 : M_PI_2;
QPointF aResPoint;
}
TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
+{
+ return getTopShape();
+}
+
+void HYDROData_ImmersibleZone::Update()
+{
+ HYDROData_NaturalObject::Update();
+
+ TopoDS_Shape aResShape = generateTopShape();
+ SetTopShape( aResShape );
+}
+
+TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape() const
{
TopoDS_Shape aResShape = TopoDS_Face();
void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
{
SetReferenceObject( thePolyline, DataTag_Polyline );
+ SetToUpdate( true );
}
Handle(HYDROData_PolylineXY) HYDROData_ImmersibleZone::GetPolyline() const
void HYDROData_ImmersibleZone::RemovePolyline()
{
ClearReferenceObjects( DataTag_Polyline );
+ SetToUpdate( true );
}
*/
HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
+ /**
+ * Update the immersible zone object.
+ * Call this method whenever you made changes for object data.
+ */
+ HYDRODATA_EXPORT virtual void Update();
+
/**
* Returns the top shape of the object.
*/
*/
HYDRODATA_EXPORT virtual void RemovePolyline();
+private:
+
+ TopoDS_Shape generateTopShape() const;
+
protected:
friend class HYDROData_Iterator;
void HYDROData_Object::Update()
{
+ HYDROData_Entity::Update();
removeTopShape();
removeShape3D();
- SetToUpdate( false );
}
void HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
{
SetReferenceObject( theBathymetry, DataTag_Bathymetry );
+ SetToUpdate( true );
}
Handle(HYDROData_Bathymetry) HYDROData_Object::GetBathymetry() const
void HYDROData_Object::RemoveBathymetry()
{
ClearReferenceObjects( DataTag_Bathymetry );
+ SetToUpdate( true );
}
TopoDS_Shape HYDROData_Object::getTopShape() const
void HYDROData_Object::SetFillingColor( const QColor& theColor )
{
- return SetColor( theColor, DataTag_FillingColor );
+ SetColor( theColor, DataTag_FillingColor );
}
QColor HYDROData_Object::GetFillingColor() const
void HYDROData_Object::SetBorderColor( const QColor& theColor )
{
- return SetColor( theColor, DataTag_BorderColor );
+ SetColor( theColor, DataTag_BorderColor );
}
QColor HYDROData_Object::GetBorderColor() const
void HYDROData_PolylineXY::Update()
{
+ HYDROData_IPolyline::Update();
+
NCollection_Sequence<TCollection_AsciiString> aSectNames;
NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
NCollection_Sequence<bool> aSectClosures;
aNamesList->Append( aSectName );
aTypesList->Append( theSectionType );
aClosuresList->Append( theIsClosed );
+
+ SetToUpdate( true );
}
TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
aNamesList->Append( i == theSectionIndex ? aNewSectName : aNamesIter.Value() );
+
+ SetToUpdate( true );
}
HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
+
+ SetToUpdate( true );
}
bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
+
+ SetToUpdate( true );
}
void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
// Remove points that belongs to removed section
removePointsLists( theSectionIndex );
}
+
+ SetToUpdate( true );
}
void HYDROData_PolylineXY::RemoveSections()
{
removeSectionsLists();
removePointsLists();
+ SetToUpdate( true );
}
void HYDROData_PolylineXY::AddPoint( const int theSectionIndex,
aListY->Append( aCoordY );
}
}
+
+ SetToUpdate( true );
}
void HYDROData_PolylineXY::SetPoint( const int theSectionIndex,
aListY->Append( aCoordY );
}
}
+
+ SetToUpdate( true );
}
void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex,
aListY->Append( anIterY.Value() );
}
}
+
+ SetToUpdate( true );
}
HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex ) const
void HYDROData_Profile::Update()
{
+ HYDROData_Object::Update();
+
BRepBuilderAPI_MakeWire aMakeWire;
ProfilePoints aProfilePoints = GetProfilePoints();
anArray->SetValue( 0, thePoint.X() );
anArray->SetValue( 1, thePoint.Y() );
+
+ SetToUpdate( true );
}
bool HYDROData_Profile::GetFirstPoint( gp_XY& thePoint ) const
anArray->SetValue( 0, thePoint.X() );
anArray->SetValue( 1, thePoint.Y() );
+
+ SetToUpdate( true );
}
bool HYDROData_Profile::GetLastPoint( gp_XY& thePoint ) const
TDF_Label aLastLabel = myLab.FindChild( DataTag_LastPoint, false );
if ( !aLastLabel.IsNull() )
aLastLabel.ForgetAllAttributes();
+
+ SetToUpdate( true );
}
Handle(HYDROData_ProfileUZ) HYDROData_Profile::GetProfileUZ( const bool theIsCreate ) const
{
Handle(HYDROData_ProfileUZ) aProfileUZ = GetProfileUZ( false );
if ( !aProfileUZ.IsNull() )
+ {
aProfileUZ->RemoveSections();
+ SetToUpdate( true );
+ }
}
void HYDROData_Profile::SetParametricPoints( const HYDROData_ProfileUZ::PointsList& thePoints )
const HYDROData_ProfileUZ::Point& aPoint = thePoints.Value( i );
aProfileUZ->AddPoint( 0, aPoint );
}
+
+ SetToUpdate( true );
}
HYDROData_ProfileUZ::PointsList HYDROData_Profile::GetParametricPoints() const
anOutStream << aWriteStr << theSep << theSep;
}
-void HYDROData_Tool::SetMustBeUpdatedImages(
+void HYDROData_Tool::SetMustBeUpdatedObjects(
const Handle(HYDROData_Document)& theDoc )
{
bool anIsChanged = true;
- // iterate until there is no changes because images on all level of dependency must be updated
+ // iterate until there is no changes because objects on all level of dependency must be updated
while ( anIsChanged )
{
anIsChanged = false;
- HYDROData_Iterator anIter( theDoc, KIND_IMAGE );
+ HYDROData_Iterator anIter( theDoc );
for ( ; anIter.More(); anIter.Next() )
{
- Handle(HYDROData_Image) anImage =
- Handle(HYDROData_Image)::DownCast( anIter.Current() );
- if ( anImage.IsNull() || anImage->IsMustBeUpdated() )
+ Handle(HYDROData_Entity) anObject = anIter.Current();
+ if ( anObject.IsNull() || anObject->IsMustBeUpdated() )
continue;
- Handle(HYDROData_Image) aTrsfRefImage = anImage->GetTrsfReferenceImage();
- if ( !aTrsfRefImage.IsNull() && aTrsfRefImage->IsMustBeUpdated() )
+ HYDROData_SequenceOfObjects aRefSeq = anObject->GetAllReferenceObjects();
+ for ( int i = 1, n = aRefSeq.Length(); i <= n; ++i )
{
- anImage->SetToUpdate( true );
- anIsChanged = true;
- continue;
- }
+ Handle(HYDROData_Entity) aRefObject = aRefSeq.Value( i );
+ if ( aRefObject.IsNull() || !aRefObject->IsMustBeUpdated() )
+ continue;
- for ( int i = 0, aNBRefs = anImage->NbReferences(); i < aNBRefs; ++i )
- {
- Handle(HYDROData_Image) aRefImage =
- Handle(HYDROData_Image)::DownCast( anImage->Reference( i ) );
- if ( !aRefImage.IsNull() && aRefImage->IsMustBeUpdated() )
- {
- // image references to updated => also must be updated
- anImage->SetToUpdate( true );
- anIsChanged = true;
- }
+ anObject->SetToUpdate( true );
+ anIsChanged = true;
+ break;
}
}
}
const QString& theSep = "\n" );
/**
- * Enables "MustBeUpdated" flag for Images that are depended on "MustBeUpdated" images.
+ * Enables "MustBeUpdated" flag for objects that are depended on "MustBeUpdated" objects.
* \param theDoc document where this operation is performed
*/
- static void SetMustBeUpdatedImages( const Handle(HYDROData_Document)& theDoc );
+ static void SetMustBeUpdatedObjects( const Handle(HYDROData_Document)& theDoc );
/**
* \brief Generate name for new object.
HYDROGUI_TwoImagesDlg.h
HYDROGUI_TwoImagesOp.h
HYDROGUI_UpdateFlags.h
- HYDROGUI_UpdateImageOp.h
+ HYDROGUI_UpdateObjectOp.h
HYDROGUI_VisualStateOp.h
HYDROGUI_VTKPrs.h
HYDROGUI_VTKPrsBathymetry.h
HYDROGUI_Tool.cxx
HYDROGUI_TwoImagesDlg.cxx
HYDROGUI_TwoImagesOp.cxx
- HYDROGUI_UpdateImageOp.cxx
+ HYDROGUI_UpdateObjectOp.cxx
HYDROGUI_VisualStateOp.cxx
HYDROGUI_VTKPrs.cxx
HYDROGUI_VTKPrsBathymetry.cxx
if ( myEditedObject->IsMustBeUpdated() )
{
myShowZones = true;
- myEditedObject->SplitGeometryObjects();
+ myEditedObject->Update();
aPanel->setEditedObject( myEditedObject );
aZoneObj->SetPolyline( aZonePolyline );
aZoneObj->SetBathymetry( aZoneBathymetry );
+ aZoneObj->Update();
closePreview();
if( !myIsEdit )
module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), anImageObj, true );
- if( myIsEdit )
- anImageObj->Update();
+ anImageObj->Update();
theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
return true;
bool anIsFusedImage = false;
bool anIsCutImage = false;
bool anIsSplittedImage = false;
- bool anIsMustBeUpdatedImage = false;
+ bool anIsMustobjectBeUpdated = false;
bool anIsPolyline = false;
bool anIsPolyline3D = false;
bool anIsProfile = false;
anIsVisibleInSelection |= aVisibility;
anIsHiddenInSelection |= !aVisibility;
+ if ( anObject->IsMustBeUpdated() )
+ {
+ anIsMustobjectBeUpdated = true;
+ }
+
ObjectKind anObjectKind = anObject->GetKind();
if( anObjectKind == KIND_IMAGE )
{
anIsSplittedImage = true;
}
}
- if ( anImage->IsMustBeUpdated() )
- {
- anIsMustBeUpdatedImage = true;
- }
}
}
else if( anObjectKind == KIND_POLYLINEXY )
if( anIsSelectedDataObjects )
{
- if ( anIsMustBeUpdatedImage )
+ if ( anIsMustobjectBeUpdated )
{
- theMenu->addAction( action( UpdateImageId ) );
+ theMenu->addAction( action( UpdateObjectId ) );
theMenu->addSeparator();
}
#include "HYDROGUI_StreamOp.h"
#include "HYDROGUI_TwoImagesOp.h"
#include "HYDROGUI_UpdateFlags.h"
-#include "HYDROGUI_UpdateImageOp.h"
+#include "HYDROGUI_UpdateObjectOp.h"
#include "HYDROGUI_VisualStateOp.h"
#include "HYDROGUI_ImmersibleZoneOp.h"
#include "HYDROGUI_ImportGeomObjectOp.h"
createAction( CopyId, "COPY", "", Qt::CTRL + Qt::Key_C );
createAction( PasteId, "PASTE", "", Qt::CTRL + Qt::Key_V );
+ createAction( UpdateObjectId, "UPDATE_OBJECT" );
+
createAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
createAction( EditImportedImageId, "EDIT_IMPORTED_IMAGE" );
createAction( ObserveImageId, "OBSERVE_IMAGE" );
createAction( ExportImageId, "EXPORT_IMAGE" );
- createAction( UpdateImageId, "UPDATE_IMAGE" );
createAction( RemoveImageRefsId, "REMOVE_IMAGE_REFERENCE" );
createAction( CreatePolylineId, "CREATE_POLYLINE" );
case ExportImageId:
anOp = new HYDROGUI_ExportImageOp( aModule );
break;
- case UpdateImageId:
- anOp = new HYDROGUI_UpdateImageOp( aModule );
+ case UpdateObjectId:
+ anOp = new HYDROGUI_UpdateObjectOp( aModule );
break;
case RemoveImageRefsId:
anOp = new HYDROGUI_RemoveImageRefsOp( aModule );
CopyId,
PasteId,
+ UpdateObjectId,
+
ImportImageId,
EditImportedImageId,
ObserveImageId,
ExportImageId,
- UpdateImageId,
RemoveImageRefsId,
CreatePolylineId,
}
aProfileObj->SetParametricPoints( aProfileParamPoints );
+ aProfileObj->Update();
+
theUpdateFlags = UF_Model;
return true;
}
+++ /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
-//
-
-#include "HYDROGUI_UpdateImageOp.h"
-
-#include "HYDROGUI_Module.h"
-#include "HYDROGUI_Tool.h"
-#include "HYDROGUI_UpdateFlags.h"
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Image.h>
-
-HYDROGUI_UpdateImageOp::HYDROGUI_UpdateImageOp( HYDROGUI_Module* theModule )
-: HYDROGUI_Operation( theModule )
-{
- setName( tr( "UPDATE_IMAGE" ) );
-}
-
-HYDROGUI_UpdateImageOp::~HYDROGUI_UpdateImageOp()
-{
-}
-
-void HYDROGUI_UpdateImageOp::startOperation()
-{
- HYDROGUI_Operation::startOperation();
-
- startDocOperation();
-
- HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
- for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
- {
- Handle(HYDROData_Image) anImage =
- Handle(HYDROData_Image)::DownCast( aSeq.Value( anIndex ) );
- if( !anImage.IsNull() && anImage->IsMustBeUpdated() )
- anImage->Update();
- }
-
- commitDocOperation();
-
- module()->update( UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced );
- commit();
-}
+++ /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_UPDATEIMAGEOP_H
-#define HYDROGUI_UPDATEIMAGEOP_H
-
-#include "HYDROGUI_Operation.h"
-
-class HYDROGUI_UpdateImageOp : public HYDROGUI_Operation
-{
- Q_OBJECT
-
-public:
- HYDROGUI_UpdateImageOp( HYDROGUI_Module* theModule );
- virtual ~HYDROGUI_UpdateImageOp();
-
-protected:
- virtual void startOperation();
-};
-
-#endif
--- /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
+//
+
+#include "HYDROGUI_UpdateObjectOp.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Image.h>
+
+HYDROGUI_UpdateObjectOp::HYDROGUI_UpdateObjectOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+ setName( tr( "UPDATE_IMAGE" ) );
+}
+
+HYDROGUI_UpdateObjectOp::~HYDROGUI_UpdateObjectOp()
+{
+}
+
+void HYDROGUI_UpdateObjectOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ startDocOperation();
+
+ NCollection_Map<Handle(HYDROData_Entity)> aMapOfTreated;
+
+ HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
+ for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
+ {
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
+ updateObject( anObject, aMapOfTreated );
+ }
+
+ commitDocOperation();
+
+ module()->update( UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced );
+ commit();
+}
+
+void HYDROGUI_UpdateObjectOp::updateObject( const Handle(HYDROData_Entity)& theObject,
+ NCollection_Map<Handle(HYDROData_Entity)>& theMapOfTreated ) const
+{
+ if( theObject.IsNull() || theMapOfTreated.Contains( theObject ) )
+ return;
+
+ theMapOfTreated.Add( theObject );
+
+ HYDROData_SequenceOfObjects aRefSeq = theObject->GetAllReferenceObjects();
+ for ( int i = 1, n = aRefSeq.Length(); i <= n; ++i )
+ {
+ Handle(HYDROData_Entity) anObject = aRefSeq.Value( i );
+ updateObject( anObject, theMapOfTreated );
+ }
+
+ if ( !theObject->IsMustBeUpdated() )
+ return;
+
+ theObject->Update();
+}
+
--- /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_UpdateObjectOp_H
+#define HYDROGUI_UpdateObjectOp_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <NCollection_Map.hxx>
+
+class Handle_HYDROData_Entity;
+
+class HYDROGUI_UpdateObjectOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_UpdateObjectOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_UpdateObjectOp();
+
+protected:
+
+ virtual void startOperation();
+
+ virtual void updateObject( const Handle_HYDROData_Entity& theObject,
+ NCollection_Map<Handle(HYDROData_Entity)>& theMapOfTreated ) const;
+};
+
+#endif
<translation>Undo</translation>
</message>
<message>
- <source>DSK_UPDATE_IMAGE</source>
- <translation>Update image</translation>
+ <source>DSK_UPDATE_OBJECT</source>
+ <translation>Update</translation>
</message>
<message>
<source>DSK_IMPORT_OBSTACLE_FROM_FILE</source>
<translation>Undo</translation>
</message>
<message>
- <source>MEN_UPDATE_IMAGE</source>
- <translation>Update image</translation>
+ <source>MEN_UPDATE_OBJECT</source>
+ <translation>Update</translation>
</message>
<message>
<source>MEN_IMPORT_OBSTACLE_FROM_FILE</source>
<translation>Undo</translation>
</message>
<message>
- <source>STB_UPDATE_IMAGE</source>
- <translation>Update image</translation>
+ <source>STB_UPDATE_OBJECT</source>
+ <translation>Update</translation>
</message>
<message>
<source>STB_IMPORT_OBSTACLE_FROM_FILE</source>