void HYDROData_Object::SetName( const QString& theName )
{
+ //DEBTRACE("SetName");
QString anOldObjName = GetName();
if ( anOldObjName != theName )
{
void HYDROData_Object::Update()
{
+ DEBTRACE("Update");
if( IsMustBeUpdated( Geom_2d ) )
{
RemoveTopShape();
HYDROData_SequenceOfObjects HYDROData_Object::GetAllReferenceObjects() const
{
+ //DEBTRACE("GetAllReferenceObjects");
HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
Handle(HYDROData_IAltitudeObject) aRefAltitude = GetAltitudeObject();
void HYDROData_Object::Changed( Geometry theChangedGeometry )
{
+ DEBTRACE("Changed");
HYDROData_Entity::Changed( theChangedGeometry );
Handle(HYDROData_DummyObject3D) anObject3D = GetObject3D();
void HYDROData_Object::SetTopShape( const TopoDS_Shape& theShape )
{
+ DEBTRACE("SetTopShape");
HYDROData_Entity::SetShape( DataTag_TopShape, theShape );
}
TopoDS_Shape HYDROData_Object::GetTopShape() const
{
+ //DEBTRACE("GetTopShape");
return HYDROData_Entity::GetShape( DataTag_TopShape );
}
void HYDROData_Object::SetShape3D( const TopoDS_Shape& theShape )
{
+ DEBTRACE("SetShape3D");
HYDROData_Entity::SetShape( DataTag_Shape3D, theShape );
// Check the object 3D existance
checkAndSetObject3D();
TopoDS_Shape HYDROData_Object::GetShape3D() const
{
+ //DEBTRACE("GetShape3D");
return HYDROData_Entity::GetShape( DataTag_Shape3D );
}
Handle(HYDROData_DummyObject3D) HYDROData_Object::GetObject3D() const
{
+ //DEBTRACE("GetObject3D");
Handle(HYDROData_DummyObject3D) anObject;
TDF_Label aLabel = myLab.FindChild( DataTag_Object3D, false );
void HYDROData_Object::checkAndSetObject3D()
{
+ DEBTRACE("checkAndSetObject3D");
TDF_Label aLabel = myLab.FindChild( DataTag_Object3D, false );
if ( !aLabel.IsNull() )
return;
HYDROData_SequenceOfObjects HYDROData_Object::GetGroups() const
{
+ //DEBTRACE("GetGroups");
return GetReferenceObjects( DataTag_EdgesGroup );
}
Handle(HYDROData_ShapesGroup) HYDROData_Object::GetGroup( const int theGroupId ) const
{
+ //DEBTRACE("GetGroup");
Handle(HYDROData_ShapesGroup) aResGroup;
HYDROData_SequenceOfObjects aGroups = GetGroups();
int HYDROData_Object::GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const
{
+ //DEBTRACE("GetGroupId");
int aRes = -1;
HYDROData_SequenceOfObjects aGroups = GetGroups();
bool HYDROData_Object::SetAltitudeObject(
const Handle(HYDROData_IAltitudeObject)& theAltitude )
{
+ DEBTRACE("SetAltitudeObject");
if ( theAltitude.IsNull() )
return false;
Handle(HYDROData_IAltitudeObject) aPrevAltitude = GetAltitudeObject();
+ if (!aPrevAltitude.IsNull())
+ DEBTRACE("aPrevAltitude: " << aPrevAltitude->GetName())
+ DEBTRACE("theAltitude: " << theAltitude->GetName())
if ( IsEqual( aPrevAltitude, theAltitude ) )
return true;
Handle(HYDROData_IAltitudeObject) HYDROData_Object::GetAltitudeObject() const
{
+ //DEBTRACE("GetAltitudeObject");
return Handle(HYDROData_IAltitudeObject)::DownCast(
GetReferenceObject( DataTag_AltitudeObject ) );
}
void HYDROData_Object::RemoveAltitudeObject()
{
+ DEBTRACE("RemoveAltitudeObject");
Handle(HYDROData_IAltitudeObject) aPrevAltitude = GetAltitudeObject();
if ( aPrevAltitude.IsNull() )
return;
-
+ DEBTRACE("aPrevAltitude: " << aPrevAltitude->GetName())
ClearReferenceObjects( DataTag_AltitudeObject );
// #636: In the case of the altitude object change the geometry of the main object is not changed,
void HYDROData_Object::SetFillingColor( const QColor& theColor )
{
+ //DEBTRACE("SetFillingColor");
SetColor( theColor, DataTag_FillingColor );
}
QColor HYDROData_Object::GetFillingColor() const
{
+ //DEBTRACE("GetFillingColor");
return GetColor( DefaultFillingColor(), DataTag_FillingColor );
}
void HYDROData_Object::SetBorderColor( const QColor& theColor )
{
+ //DEBTRACE("SetBorderColor");
SetColor( theColor, DataTag_BorderColor );
}
QColor HYDROData_Object::GetBorderColor() const
{
+ //DEBTRACE("GetBorderColor");
return GetColor( DefaultBorderColor(), DataTag_BorderColor );
}
QColor HYDROData_Object::DefaultFillingColor() const
{
+ //DEBTRACE("DefaultFillingColor");
return QColor( Qt::yellow );
}
QColor HYDROData_Object::DefaultBorderColor() const
{
+ //DEBTRACE("DefaultBorderColor");
return QColor( Qt::transparent );
}
QStringList HYDROData_Object::dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const
{
+ DEBTRACE("dumpObjectCreation");
QStringList aResList = HYDROData_Entity::dumpObjectCreation( theTreatedObjects );
if ( aResList.isEmpty() )
return aResList; //Object was not created
Handle(HYDROData_IAltitudeObject) HYDROData_Object::getChildAltitudeObject() const
{
+ //DEBTRACE("getChildAltitudeObject");
Handle(HYDROData_IAltitudeObject) anObject;
TDF_Label aLabel = myLab.FindChild( DataTag_ChildAltitudeObject, false );
void HYDROData_Object::checkAndSetAltitudeObject()
{
+ DEBTRACE("checkAndSetAltitudeObject");
Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
ObjectKind anAltitudeObjectType = getAltitudeObjectType();
- //DEBTRACE("HYDROData_Object::checkAndSetAltitudeObject anAltitudeObjectType="<< anAltitudeObjectType);
+ DEBTRACE("HYDROData_Object::checkAndSetAltitudeObject anAltitudeObjectType="<< anAltitudeObjectType);
if ( anAltitudeObjectType == KIND_UNKNOWN )
+ {
+ DEBTRACE("anAltitudeObjectType == KIND_UNKNOWN");
return; // No need to create altitude object
+ }
Handle(HYDROData_IAltitudeObject) altObject = GetAltitudeObject();
+ if( !altObject.IsNull() )
+ DEBTRACE(altObject->GetName());
if( !altObject.IsNull() && altObject->GetKind()==anAltitudeObjectType )
return;
HYDROData_Iterator::CreateObject( aChildLabel, anAltitudeObjectType ) );
QString anAltitudePref = GetName() + "_Altitude";
- //DEBTRACE("anAltitudePref " << anAltitudePref.toStdString());
+ DEBTRACE("anAltitudePref " << anAltitudePref.toStdString());
QString anAltitudeName = HYDROData_Tool::GenerateObjectName( aDocument, anAltitudePref );
anAltitudeObject->SetName( anAltitudeName );
Handle(HYDROData_ShapesGroup) HYDROData_Object::createGroupObject()
{
+ DEBTRACE("createGroupObject");
TDF_Label aNewLab = myLab.FindChild( DataTag_EdgesGroup ).NewChild();
Handle(HYDROData_ShapesGroup) aNewGroup =
void HYDROData_Object::RemoveGroupObjects()
{
+ DEBTRACE("RemoveGroupObjects");
TDF_Label aLabel = myLab.FindChild( DataTag_EdgesGroup, false );
if ( !aLabel.IsNull() )
aLabel.ForgetAllAttributes();
void HYDROData_Object::RemoveTopShape()
{
+ DEBTRACE("RemoveTopShape");
HYDROData_Entity::SetShape( DataTag_TopShape, TopoDS_Shape() );
}
void HYDROData_Object::RemoveShape3D()
{
+ DEBTRACE("RemoveShape3D");
HYDROData_Entity::SetShape( DataTag_Shape3D, TopoDS_Shape() );
}
bool HYDROData_Object::IsSubmersible() const
{
+ //DEBTRACE("IsSubmersible");
Handle(TDataStd_Integer) aSubMersibleAttr;
bool isSubmersible = true; //default
void HYDROData_Object::SetIsSubmersible( bool isSubmersible ) const
{
+ DEBTRACE("SetIsSubmersible");
Handle(TDataStd_Integer) anAttr = TDataStd_Integer::Set( myLab, isSubmersible ? 1 : 0 );
anAttr->SetID(TDataStd_Integer::GetID());
}
void HYDROData_Object::GetBoundaries( QList<TopoDS_Shape>& theBoundShapes,
QStringList& theBoundNames ) const
{
+ DEBTRACE("GetBoundaries");
HYDROData_SequenceOfObjects aGroups = GetGroups();
HYDROData_SequenceOfObjects::Iterator anIter( aGroups );
for ( ; anIter.More(); anIter.Next() )
#include <TopoDS_Wire.hxx>
#include <QApplication>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
HYDROGUI_ImmersibleZoneOp::HYDROGUI_ImmersibleZoneOp( HYDROGUI_Module* theModule,
const bool theIsEdit )
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;
}