#include "HYDROGUI_Module.h"
#include "HYDROGUI_Shape.h"
#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
#include "HYDROGUI_UpdateFlags.h"
#include "HYDROGUI_DataObject.h"
#include <TopoDS_Wire.hxx>
#include <QApplication>
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
HYDROGUI_ImmersibleZoneOp::HYDROGUI_ImmersibleZoneOp( HYDROGUI_Module* theModule,
const bool theIsEdit )
if ( !myIsEdit )
{
- aZoneObj->SetFillingColor( HYDROData_ImmersibleZone::DefaultFillingColor() );
- aZoneObj->SetBorderColor( HYDROData_ImmersibleZone::DefaultBorderColor() );
+ aZoneObj->SetFillingColor( aZoneObj->DefaultFillingColor() );
+ aZoneObj->SetBorderColor( aZoneObj->DefaultBorderColor() );
}
- aZoneObj->SetPolyline( aZonePolyline );
- aZoneObj->SetAltitudeObject( aZoneBathymetry );
+ bool isPolylineChanged = true;
+ if (aZonePolyline && aZoneObj->GetPolyline() && (aZoneObj->GetPolyline()->GetName() == aZonePolyline->GetName()))
+ {
+ isPolylineChanged =false;
+ DEBTRACE("polyline unchanged");
+ }
+ else
+ {
+ if (aZonePolyline) DEBTRACE(aZonePolyline->GetName().toStdString());
+ if (aZoneObj->GetPolyline()) DEBTRACE(aZoneObj->GetPolyline()->GetName().toStdString());
+ aZoneObj->SetPolyline( aZonePolyline );
+ }
+ bool isBathymetryChanged = true;
+ if (aZoneBathymetry && aZoneObj->GetAltitudeObject() && IsEqual(aZoneObj->GetAltitudeObject(), aZoneBathymetry))
+ {
+ isBathymetryChanged = false;
+ DEBTRACE("bathymetry unchanged");
+ }
+ else aZoneObj->SetAltitudeObject( aZoneBathymetry );
aZoneObj->Update();
closePreview();
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+ if (isBathymetryChanged)
+ {
+ DEBTRACE("bathymetry changed on " << anObjectName.toStdString());
+ // Find immersibles objects referenced by all calculation case zones and check if they correspond to the one modified
+ HYDROData_SequenceOfObjects zoneList = doc()->CollectAllObjects();
+ for (int i=1; i<=zoneList.Size(); i++ )
+ {
+ //DEBTRACE(" --- entity: " << zoneList(i)->GetName().toStdString() << " " << zoneList(i)->GetKind());
+ Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( zoneList(i) );
+ if (aZone.IsNull())
+ continue;
+ DEBTRACE(" zone tested: " << aZone->GetName().toStdString());
+ HYDROData_SequenceOfObjects aSeq = aZone->GetObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Entity) aMergeObject;
+ Handle(HYDROData_Object) aRefGeomObj = Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( !aRefGeomObj.IsNull() )
+ {
+ DEBTRACE(" aRefGeomObj " << aRefGeomObj->GetName().toStdString());
+ if (aRefGeomObj->GetName() == anObjectName)
+ {
+ DEBTRACE(" BINGO! modify altitude object in zone");
+ aMergeObject = aRefGeomObj->GetAltitudeObject();
+ aZone->SetMergeObject( aMergeObject );
+ break;
+ }
+ }
+ }
+
+ }
+ }
return true;
}
if ( aViewManager && myPreviewPrs )
{
- QColor aFillingColor = HYDROData_ImmersibleZone::DefaultFillingColor();
- QColor aBorderColor = HYDROData_ImmersibleZone::DefaultBorderColor();
+ QColor aFillingColor = Qt::darkBlue;
+ QColor aBorderColor = Qt::transparent;
if ( !myEditedObject.IsNull() ) {
aFillingColor = myEditedObject->GetFillingColor();
aBorderColor = myEditedObject->GetBorderColor();
}
- myPreviewPrs->setFillingColor( aFillingColor, false, false );
- myPreviewPrs->setBorderColor( aBorderColor, false, false );
TopoDS_Face aFace;
if( !aZoneShape.IsNull() )
aFace = TopoDS::Face( aZoneShape );
myPreviewPrs->setFace( aFace, true, true, "" );
+ myPreviewPrs->setFillingColor( aFillingColor, false, false );
+ myPreviewPrs->setBorderColor( aBorderColor, false, false );
}
QApplication::restoreOverrideCursor();