while( anIter.hasNext() )
{
const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
- HYDROData_Zone::MergeAltitudesType aMergeType;
- Handle(HYDROData_Object) aRegObj =
- Handle(HYDROData_Object)::DownCast( aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType ) );
+ HYDROData_Zone::MergeType aMergeType;
+ Handle(HYDROData_Entity) aRegObj = aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType );
if( aRegObj.IsNull() )
continue;
Handle(HYDROData_Region) aRegion = aRegionsMap[aRegObj->GetName()];
qDebug( "Error in algorithm: unresolved conflicts" );
}
+ Handle(HYDROData_Entity) aMergeEntity = aRegObj;
+ if ( !theLandCover ) {
+ Handle(HYDROData_Object) aMergeObject = Handle(HYDROData_Object)::DownCast( aMergeEntity );
+ if ( !aMergeObject.IsNull() ) {
+ aMergeEntity = aMergeObject->GetAltitudeObject();
+ }
+ }
+
switch( aMergeType )
{
case HYDROData_Zone::Merge_ZMIN:
break;
case HYDROData_Zone::Merge_Object:
aRegionZone->SetMergeType( aMergeType );
- aRegionZone->RemoveMergeAltitude();
- aRegionZone->SetMergeAltitude( aRegObj->GetAltitudeObject() );
+ aRegionZone->RemoveMergeObject();
+ aRegionZone->SetMergeObject( aMergeEntity );
break;
}
}
if ( theZone.IsNull() )
return aResAltitude;
- HYDROData_Zone::MergeAltitudesType aZoneMergeType = theZone->GetMergeType();
+ HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType();
if ( !theZone->IsMergingNeed() )
{
aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
{
- Handle(HYDROData_IAltitudeObject) aMergeAltitude = theZone->GetMergeAltitude();
+ Handle(HYDROData_IAltitudeObject) aMergeAltitude =
+ Handle(HYDROData_IAltitudeObject)::DownCast( theZone->GetMergeObject() );
if ( !aMergeAltitude.IsNull() )
{
if ( aZoneInterpolator != NULL )
}
else
{
- HYDROData_SequenceOfObjects aZoneObjects = theZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects();
HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
for ( ; anIter.More(); anIter.Next() )
{
void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType thePriority,
const Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType theMergeType,
+ HYDROData_Zone::MergeType theMergeType,
HYDROData_CalculationCase::DataTag theDataTag )
{
TDF_Label aRulesLab = myLab.FindChild( theDataTag );
Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType& thePriority,
Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType& theMergeType,
+ HYDROData_Zone::MergeType& theMergeType,
HYDROData_CalculationCase::DataTag& theDataTag) const
{
TDF_Label aRulesLab = myLab.FindChild( theDataTag );
HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType thePriority,
const Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType theMergeType,
+ HYDROData_Zone::MergeType theMergeType,
HYDROData_CalculationCase::DataTag theDataTag );
HYDRODATA_EXPORT bool GetRule( int theIndex,
Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType& thePriority,
Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType& theMergeType,
+ HYDROData_Zone::MergeType& theMergeType,
HYDROData_CalculationCase::DataTag& theDataTag ) const;
HYDRODATA_EXPORT void SetAssignmentLandCoverMode( AssignmentMode theMode );
}
Handle(HYDROData_Entity) HYDROData_PriorityQueue::GetMostPriorityObject( const QStringList& theZoneObjects,
- HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+ HYDROData_Zone::MergeType& theMergeType ) const
{
QStringList aSortedZoneObjects;
for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ )
QStringList::const_iterator anIt = aSortedZoneObjects.begin(), aLast = aSortedZoneObjects.end();
for( ; anIt!=aLast; anIt++ )
{
- HYDROData_Zone::MergeAltitudesType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN;
+ HYDROData_Zone::MergeType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN;
Handle(HYDROData_Entity) anObj = myNames[*anIt];
if( !anObj.IsNull() )
{
bool HYDROData_PriorityQueue::IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
const Handle(HYDROData_Entity)& theObj2,
- HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+ HYDROData_Zone::MergeType& theMergeType ) const
{
// 1. First we check custom rules
HYDROData_ListOfRules::const_iterator anIt = myRules.begin(), aLast = myRules.end();
Merge_Tag,
};
-void HYDROData_PriorityQueue::AddRule( TDF_Label& theRulesLabel,
- const Handle(HYDROData_Entity)& theObject1,
- HYDROData_PriorityType thePriority,
- const Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType theMergeType )
+void HYDROData_PriorityQueue::AddRule( TDF_Label& theRulesLabel,
+ const Handle(HYDROData_Entity)& theObject1,
+ HYDROData_PriorityType thePriority,
+ const Handle(HYDROData_Entity)& theObject2,
+ HYDROData_Zone::MergeType theMergeType )
{
// Get the last rule index
Standard_Integer aRuleIndex = 0;
aRule.Object1 = HYDROData_Iterator::Object( aRefs1->First() );
aRule.Priority = ( HYDROData_PriorityType ) aPriorityAttr->Get();
aRule.Object2 = HYDROData_Iterator::Object( aRefs2->First() );
- aRule.MergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
+ aRule.MergeType = ( HYDROData_Zone::MergeType ) aMergeAttr->Get();
aRules.append( aRule );
}
}
bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
int theIndex,
- Handle(HYDROData_Entity)& theObject1,
- HYDROData_PriorityType& thePriority,
- Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType& theMergeType )
+ Handle(HYDROData_Entity)& theObject1,
+ HYDROData_PriorityType& thePriority,
+ Handle(HYDROData_Entity)& theObject2,
+ HYDROData_Zone::MergeType& theMergeType )
{
TDF_Label aRuleLabel = theRulesLab.FindChild( theIndex );
theObject1 = HYDROData_Iterator::Object( aRefs1->First() );
thePriority = ( HYDROData_PriorityType ) aPriorityAttr->Get();
theObject2 = HYDROData_Iterator::Object( aRefs2->First() );
- theMergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
+ theMergeType = ( HYDROData_Zone::MergeType ) aMergeAttr->Get();
}
return isOK;
}
struct HYDROData_CustomRule
{
- Handle(HYDROData_Entity) Object1;
- HYDROData_PriorityType Priority;
- Handle(HYDROData_Entity) Object2;
- HYDROData_Zone::MergeAltitudesType MergeType;
+ Handle(HYDROData_Entity) Object1;
+ HYDROData_PriorityType Priority;
+ Handle(HYDROData_Entity) Object2;
+ HYDROData_Zone::MergeType MergeType;
};
typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
~HYDROData_PriorityQueue();
Handle_HYDROData_Entity GetMostPriorityObject( const QStringList& theZoneObjects,
- HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
+ HYDROData_Zone::MergeType& theMergeType ) const;
bool IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
const Handle(HYDROData_Entity)& theObj2,
- HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
+ HYDROData_Zone::MergeType& theMergeType ) const;
static void ClearRules( TDF_Label& theRulesLabel );
static void AddRule( TDF_Label& theRulesLabel,
const Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType thePriority,
const Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType theMergeType );
+ HYDROData_Zone::MergeType theMergeType );
static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
static QString DumpRules( const TDF_Label& theRulesLab );
static void DumpRulesToPython( const TDF_Label& theRulesLab,
Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType& thePriority,
Handle(HYDROData_Entity)& theObject2,
- HYDROData_Zone::MergeAltitudesType& theMergeType );
+ HYDROData_Zone::MergeType& theMergeType );
private:
typedef QMap<QString, Handle(HYDROData_Entity)> MapNameToObject;
if ( aRefObject.IsNull() )
continue;
- aNewZone->AddGeometryObject( aRefObject );
+ aNewZone->AddObject( aRefObject );
}
return aNewZone;
// set zone merge type
QString aMergeTypeStr;
- HYDROData_Zone::MergeAltitudesType aMergeType = aZone->GetMergeType();
+ HYDROData_Zone::MergeType aMergeType = aZone->GetMergeType();
if ( aMergeType == HYDROData_Zone::Merge_ZMIN ) {
aMergeTypeStr = "HYDROData_Zone.Merge_ZMIN";
} else if ( aMergeType == HYDROData_Zone::Merge_ZMAX ) {
aResList << QString( "%1.SetMergeType( %2 )" ).arg( aZone->GetObjPyName() ).arg( aMergeTypeStr );
}
if ( aMergeType == HYDROData_Zone::Merge_Object ) {
- Handle(HYDROData_IAltitudeObject) aMergeAltitude = aZone->GetMergeAltitude();
- if ( !aMergeAltitude.IsNull() ) {
- aMergeAltitude->findPythonReferenceObject( theTreatedObjects, aResList );
- aResList << QString( "%1.SetMergeAltitude( %2 )" ).arg( aZone->GetObjPyName() )
- .arg( aMergeAltitude->GetObjPyName() );
+ Handle(HYDROData_Entity) aMergeObject = aZone->GetMergeObject();
+ if ( !aMergeObject.IsNull() ) {
+ aMergeObject->findPythonReferenceObject( theTreatedObjects, aResList );
+ aResList << QString( "%1.SetMergeObject( %2 )" ).arg( aZone->GetObjPyName() )
+ .arg( aMergeObject->GetObjPyName() );
}
}
#include "HYDROData_IAltitudeObject.h"
#include "HYDROData_Document.h"
#include "HYDROData_NaturalObject.h"
+#include "HYDROData_LandCover.h"
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
{
HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
- HYDROData_SequenceOfObjects aSeqOfGeomObjects = GetGeometryObjects();
- aResSeq.Append( aSeqOfGeomObjects );
+ HYDROData_SequenceOfObjects aSeqOfObjects = GetObjects();
+ aResSeq.Append( aSeqOfObjects );
return aResSeq;
}
bool HYDROData_Zone::IsMergingNeed() const
{
+ // Zones based on geometry objects (compare altitudes)
Handle(HYDROData_IAltitudeObject) aRefAltitude;
- HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
- HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
- for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
+ HYDROData_SequenceOfObjects anObjects = GetObjects();
+ HYDROData_SequenceOfObjects::Iterator anObjsIter( anObjects );
+ for ( ; anObjsIter.More(); anObjsIter.Next() )
{
Handle(HYDROData_Object) aRefGeomObj =
- Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
+ Handle(HYDROData_Object)::DownCast( anObjsIter.Value() );
if ( aRefGeomObj.IsNull() )
continue;
return true;
}
+ // Zones based on land cover objects (compare Strickler types)
+ QString aRefStricklerType;
+
+ anObjsIter.Init( anObjects );
+ for ( ; anObjsIter.More(); anObjsIter.Next() )
+ {
+ Handle(HYDROData_LandCover) aRefLandCoverObj =
+ Handle(HYDROData_LandCover)::DownCast( anObjsIter.Value() );
+ if ( aRefLandCoverObj.IsNull() )
+ continue;
+
+ QString aStricklerType = aRefLandCoverObj->GetStricklerType();
+
+ if ( aRefStricklerType.isNull() )
+ {
+ aRefStricklerType = aStricklerType;
+ continue;
+ }
+
+ if ( aRefStricklerType != aStricklerType )
+ return true;
+ }
+
+
return false;
}
return myInterpolator;
}
-void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType )
+void HYDROData_Zone::SetMergeType( const MergeType& theType )
{
TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
}
-HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const
+HYDROData_Zone::MergeType HYDROData_Zone::GetMergeType() const
{
- MergeAltitudesType aMergeType = Merge_UNKNOWN;
+ MergeType aMergeType = Merge_UNKNOWN;
TDF_Label aLabel = myLab.FindChild( DataTag_MergeType, false );
if ( !aLabel.IsNull() )
{
Handle(TDataStd_Integer) anInt;
if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anInt ) )
- aMergeType = (MergeAltitudesType)anInt->Get();
+ aMergeType = (MergeType)anInt->Get();
}
return aMergeType;
}
-void HYDROData_Zone::SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude )
+void HYDROData_Zone::SetMergeObject( const Handle(HYDROData_Entity)& theObject )
{
- SetReferenceObject( theAltitude, DataTag_MergeAltitude );
+ SetReferenceObject( theObject, DataTag_MergeObject );
}
-Handle(HYDROData_IAltitudeObject) HYDROData_Zone::GetMergeAltitude() const
+Handle(HYDROData_Entity) HYDROData_Zone::GetMergeObject() const
{
- return Handle(HYDROData_IAltitudeObject)::DownCast(
- GetReferenceObject( DataTag_MergeAltitude ) );
+ return Handle(HYDROData_Entity)::DownCast(
+ GetReferenceObject( DataTag_MergeObject ) );
}
-void HYDROData_Zone::RemoveMergeAltitude()
+void HYDROData_Zone::RemoveMergeObject()
{
- ClearReferenceObjects( DataTag_MergeAltitude );
+ ClearReferenceObjects( DataTag_MergeObject );
}
-bool HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
+bool HYDROData_Zone::AddObject( const Handle(HYDROData_Entity)& theObject )
{
if ( theObject.IsNull() )
return false;
if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
- !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
+ !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) &&
+ !theObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
return false; // Wrong type of object
- if ( HasReference( theObject, DataTag_GeometryObject ) )
+ if ( HasReference( theObject, DataTag_Object ) )
return false; // Object is already in reference list
- AddReferenceObject( theObject, DataTag_GeometryObject );
+ AddReferenceObject( theObject, DataTag_Object );
return true;
}
-HYDROData_SequenceOfObjects HYDROData_Zone::GetGeometryObjects() const
+HYDROData_SequenceOfObjects HYDROData_Zone::GetObjects() const
{
- return GetReferenceObjects( DataTag_GeometryObject );
+ return GetReferenceObjects( DataTag_Object );
}
-void HYDROData_Zone::RemoveGeometryObjects()
+void HYDROData_Zone::RemoveObjects()
{
- ClearReferenceObjects( DataTag_GeometryObject );
+ ClearReferenceObjects( DataTag_Object );
}
bool HYDROData_Zone::IsSubmersible() const
{
- HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
- HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
- for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
+ HYDROData_SequenceOfObjects anObjects = GetObjects();
+ HYDROData_SequenceOfObjects::Iterator anObjsIter( anObjects );
+ for ( ; anObjsIter.More(); anObjsIter.Next() )
{
Handle(HYDROData_Object) aRefGeomObj =
- Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
+ Handle(HYDROData_Object)::DownCast( anObjsIter.Value() );
+ if ( aRefGeomObj.IsNull() )
+ continue;
+
if( !aRefGeomObj->IsSubmersible() )
return false; //if one of geometry objects is not submersible the zone is considered as not submersible
}
#include "HYDROData_Entity.h"
#include "HYDROData_IInterpolator.h"
-class Handle(HYDROData_Object);
-class Handle(HYDROData_IAltitudeObject);
+class Handle(HYDROData_LandCover);
class TopoDS_Shape;
DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
public:
- // Enumeration of mergin types for conflict altitudes
- enum MergeAltitudesType
+ // Enumeration of mergin types for conflict altitudes/types
+ enum MergeType
{
Merge_UNKNOWN, // Undefined
Merge_ZMIN, // The minimum values
Merge_ZMAX, // The maximum values
- Merge_Object // Only one altitude will be taken into account
+ Merge_Object // Only one altitude/land cover will be taken into account
};
protected:
{
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_Shape, ///< reference shape
- DataTag_GeometryObject, ///< reference geometry objects
- DataTag_MergeType, ///< mergin type of conflict bathymetries
- DataTag_MergeAltitude, ///< reference altitude for conflict merge
+ DataTag_Object, ///< reference objects
+ DataTag_MergeType, ///< mergin type of conflict bathymetries/types
+ DataTag_MergeObject, ///< reference altitude/land cover for conflict merge
};
public:
* * Returns the interpolator of zone object.
*/
HYDRODATA_EXPORT virtual HYDROData_IInterpolator* GetInterpolator() const;
-
-
+
/**
* Sets the merging type for conflict altitudes.
* By default it is set to Merge_UNKNOWN.
*/
- HYDRODATA_EXPORT virtual void SetMergeType( const MergeAltitudesType& theType );
+ HYDRODATA_EXPORT virtual void SetMergeType( const MergeType& theType );
/**
- * Returns the merging type for conflict altitudes.
+ * Returns the merging type for conflict altitudes/types.
*/
- HYDRODATA_EXPORT virtual MergeAltitudesType GetMergeType() const;
+ HYDRODATA_EXPORT virtual MergeType GetMergeType() const;
/**
- * Sets the reference altitude to resolve the conflict.
+ * Sets the reference object to resolve the conflict.
* This object is used only in case of "Merge_Object" merge type.
*/
- HYDRODATA_EXPORT virtual void SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude );
+ HYDRODATA_EXPORT virtual void SetMergeObject( const Handle(HYDROData_Entity)& theObject );
/**
- * Returns the reference altitude to resolve the conflict.
+ * Returns the reference object to resolve the conflict.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetMergeAltitude() const;
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Entity) GetMergeObject() const;
/**
- * Removes the reference altitude for resolving the conflict.
+ * Removes the reference object for resolving the conflict.
*/
- HYDRODATA_EXPORT virtual void RemoveMergeAltitude();
+ HYDRODATA_EXPORT virtual void RemoveMergeObject();
-
/**
- * Add new one geometry object for zone.
+ * Add new one object for zone.
*/
- HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
+ HYDRODATA_EXPORT virtual bool AddObject( const Handle(HYDROData_Entity)& theObject );
/**
- * Returns all geometry objects of zone.
+ * Returns all objects of zone.
*/
- HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetObjects() const;
/**
- * Removes all geometry objects from zone.
+ * Removes all objects from zone.
*/
- HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
+ HYDRODATA_EXPORT virtual void RemoveObjects();
HYDRODATA_EXPORT bool IsSubmersible() const;
myBathymetryChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
myBathymetryChoice->addItem( tr("MERGE_ZMIN"), HYDROData_Zone::Merge_ZMIN );
myBathymetryChoice->addItem( tr("MERGE_ZMAX"), HYDROData_Zone::Merge_ZMAX );
- QStringList aList = aZone->getAltitudes();
+ QStringList aList = aZone->getObjects();
for ( int i = 0; i < aList.length(); i++ )
{
myBathymetryChoice->addItem( aList.at( i ), HYDROData_Zone::Merge_Object );
}
}
-void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theAltitudeName )
+void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theMergeObjectName )
{
HYDROGUI_CalculationDlg* aPanel =
::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
HYDROGUI_Zone* aZone = aPanel->getCurrentZone();
if ( aZone )
{
- aZone->setMergeType( theMergeType, theAltitudeName );
+ aZone->setMergeType( theMergeType, theMergeObjectName );
HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() );
if ( aShape )
{
HYDROData_ListOfRules aRules;
Handle(HYDROData_Entity) anObject1, anObject2;
HYDROData_PriorityType aPriority;
- HYDROData_Zone::MergeAltitudesType aMergeType;
+ HYDROData_Zone::MergeType aMergeType;
HYDROData_CalculationCase::DataTag aDataTag = HYDROData_CalculationCase::DataTag_CustomRules;
for ( int anIndex = 0; ; anIndex++ )
{
void onRemoveLandCovers();
/**
- * Set the given bathymetry merge type to the current zone.
+ * Set the given bathymetry/type merge type to the current zone.
*/
- void onSetMergeType( int theMergeType, QString& theBathymetryName );
+ void onSetMergeType( int theMergeType, QString& theMergeObjectName );
/**
* Selected zones are moved to the existing region.
*/
} else if ( aColumn == 1 ) {
myRules[aRow].Priority = (HYDROData_PriorityType)theValue.toInt();
} else if ( aColumn == 3 ) {
- myRules[aRow].MergeType = (HYDROData_Zone::MergeAltitudesType)theValue.toInt();;
+ myRules[aRow].MergeType = (HYDROData_Zone::MergeType)theValue.toInt();;
}
}
else
{
// Generate the filling color for zone
- QStringList aGeomObjectsNames;
+ QStringList anObjectsNames;
- HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects aRefObjects = aZone->GetObjects();
HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
for ( ; anIter.More(); anIter.Next() )
{
if ( aRefObjectName.isEmpty() )
continue;
- aGeomObjectsNames.append( aRefObjectName );
+ anObjectsNames.append( aRefObjectName );
}
//setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
#include <HYDROData_Zone.h>
#include <HYDROData_Object.h>
#include <HYDROData_IAltitudeObject.h>
+#include <HYDROData_LandCover.h>
#include <SUIT_DataObject.h>
#include <QSet>
aRes = getRefObjectNames();
break;
case AltitudeObjId:
- // Get altitude object name
- aRes = getAltitudeName();
+ // Get altitude/land cover object name
+ aRes = getObjectName();
break;
default:
aRes = LightApp_DataObject::text( theColumnId );
Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
if ( !aZone.IsNull() )
{
- HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects aSeq = aZone->GetObjects();
HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
for ( ; anIter.More(); anIter.Next() )
{
return aRes;
}
-QString HYDROGUI_Zone::getAltitudeName() const
+QString HYDROGUI_Zone::getObjectName() const
{
QString aRes;
Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
if ( !aZone.IsNull() )
{
- HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects aSeq = aZone->GetObjects();
bool isMergingNeed = aZone->IsMergingNeed();
if ( ( isMergingNeed && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
|| ( aSeq.Length() == 1 ) || ( !isMergingNeed ) )
case HYDROData_Zone::Merge_ZMAX: // The maximum values
aRes = QObject::tr( "MERGE_ZMAX" );
break;
- case HYDROData_Zone::Merge_Object: // Only one altitude will be taken into account
+ case HYDROData_Zone::Merge_Object: // Only one altitude/land cover will be taken into account
{
- Handle(HYDROData_IAltitudeObject) anAltitude = aZone->GetMergeAltitude();
- if ( !anAltitude.IsNull() )
- aRes = anAltitude->GetName();
+ Handle(HYDROData_Entity) aMergeObj = aZone->GetMergeObject();
+ if ( !aMergeObj.IsNull() )
+ aRes = aMergeObj->GetName();
break;
}
default:
return aRes;
}
-QStringList HYDROGUI_Zone::getAltitudes() const
+QStringList HYDROGUI_Zone::getObjects() const
{
QStringList aRes;
Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
if ( !aZone.IsNull() )
{
- HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
- // Collect all used altitudes names when merging is necessary
- // or just get the name of altitude of a single geometry object
+ HYDROData_SequenceOfObjects aSeq = aZone->GetObjects();
+ // Collect all used altitudes/land cover names when merging is necessary
+ // or just get the name of altitude/land cover of a single object
HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
for ( ; anIter.More(); anIter.Next() )
{
Handle(HYDROData_IAltitudeObject) anAltitudeObj = aRefGeomObj->GetAltitudeObject();
if ( !anAltitudeObj.IsNull() && !aRes.contains( anAltitudeObj->GetName() ) )
aRes.append( anAltitudeObj->GetName() );
+ } else {
+ aRes.append( anIter.Value()->GetName() );
}
}
}
return aRes;
}
-HYDROData_Zone::MergeAltitudesType HYDROGUI_Zone::getMergeType() const
+HYDROData_Zone::MergeType HYDROGUI_Zone::getMergeType() const
{
- HYDROData_Zone::MergeAltitudesType aRes = HYDROData_Zone::Merge_UNKNOWN;
+ HYDROData_Zone::MergeType aRes = HYDROData_Zone::Merge_UNKNOWN;
Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
if ( !aZone.IsNull() )
{
return aRes;
}
-void HYDROGUI_Zone::setMergeType( int theMergeType, QString theAltitudeName )
+void HYDROGUI_Zone::setMergeType( int theMergeType, QString theMergeObjectName )
{
Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
if ( !aZone.IsNull() )
{
- HYDROData_Zone::MergeAltitudesType aMergeType =
- ( HYDROData_Zone::MergeAltitudesType )theMergeType;
+ HYDROData_Zone::MergeType aMergeType =
+ ( HYDROData_Zone::MergeType )theMergeType;
aZone->SetMergeType( aMergeType );
if ( aMergeType == HYDROData_Zone::Merge_Object )
{
- // Find an altitude object by the given name and set it as the zone's merge altitude
- HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
+ // Find an altitude/land cover object by the given name and set it as the zone's merge altitude/land cover
+ 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() )
{
- // Get altitude object name
- Handle(HYDROData_IAltitudeObject) anAltitudeObj = aRefGeomObj->GetAltitudeObject();
- if ( !anAltitudeObj.IsNull() && theAltitudeName == anAltitudeObj->GetName() )
- {
- aZone->SetMergeAltitude( anAltitudeObj );
- break;
- }
+ // Get altitude object
+ aMergeObject = aRefGeomObj->GetAltitudeObject();
+ } else {
+ aMergeObject = Handle(HYDROData_LandCover)::DownCast( anIter.Value() );
+ }
+
+ if ( !aMergeObject.IsNull() && theMergeObjectName == aMergeObject->GetName() )
+ {
+ aZone->SetMergeObject( aMergeObject );
+ break;
}
}
}
bool isMergingNeed() const;
/**
- * Returns the list of altidude object names.
+ * Returns the list of source object names.
*/
- QStringList getAltitudes() const;
+ QStringList getObjects() const;
/**
* Returns the merging type for conflict altidudes.
*/
- HYDROData_Zone::MergeAltitudesType getMergeType() const;
+ HYDROData_Zone::MergeType getMergeType() const;
/**
- * Set the merging type for conflict altidudes.
- * If the type is Merge_Object then use the second parameter to set the merge bathymetry.
+ * Set the merging type for conflict altidudes/types.
+ * If the type is Merge_Object then use the second parameter to set the merge bathymetry/land cover.
*/
- void setMergeType( int theMergeType, QString theAltitudeName = QString() );
+ void setMergeType( int theMergeType, QString theMergeObjectName = QString() );
private:
QString getRefObjectNames() const;
- QString getAltitudeName() const;
+ QString getObjectName() const;
};
#endif
void AddRule( HYDROData_Entity theObject1,
HYDROData_PriorityType thePriority,
HYDROData_Entity theObject2,
- HYDROData_Zone::MergeAltitudesType theMergeType,
+ HYDROData_Zone::MergeType theMergeType,
HYDROData_CalculationCase::DataTag theDataTag )
- [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeAltitudesType, HYDROData_CalculationCase::DataTag )];
+ [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
%MethodCode
Handle(HYDROData_Entity) anObject1 =
Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
public:
// Enumeration of mergin types for conflict altitudes
- enum MergeAltitudesType
+ enum MergeType
{
Merge_ZMIN, // The minimum values
Merge_ZMAX, // The maximum values
* Sets the merging type for conflict altitudes.
* By default it is set to Merge_ZMIN.
*/
- void SetMergeType( const MergeAltitudesType& theType );
+ void SetMergeType( const MergeType& theType );
/**
* Returns the merging type for conflict altitudes.
*/
- MergeAltitudesType GetMergeType() const;
+ MergeType GetMergeType() const;
/**
if ( !aRefAltitude.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Zone::SetMergeAltitude( aRefAltitude ) :
- sipCpp->SetMergeAltitude( aRefAltitude );
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::SetMergeObject( aRefAltitude ) :
+ sipCpp->SetMergeObject( aRefAltitude );
Py_END_ALLOW_THREADS
}
Handle(HYDROData_IAltitudeObject) aRefAltitude;
Py_BEGIN_ALLOW_THREADS
- aRefAltitude = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetMergeAltitude() :
- sipCpp->GetMergeAltitude();
+ Handle(HYDROData_Entity) aRefObject = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetMergeObject() :
+ sipCpp->GetMergeObject();
+ aRefAltitude = Handle(HYDROData_IAltitudeObject)::DownCast( aRefObject );
Py_END_ALLOW_THREADS
sipRes = (HYDROData_IAltitudeObject*)createPointer( aRefAltitude );
* Removes the reference altitude for resolving the conflict.
*/
void RemoveMergeAltitude();
+ %MethodCode
+
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::RemoveMergeObject() :
+ sipCpp->RemoveMergeObject();
+ Py_END_ALLOW_THREADS
+
+ %End
+
+ /**
+ * Sets the reference object to resolve the conflict.
+ * This object is used only in case of "Merge_Object" merge type.
+ */
+ void SetMergeObject( HYDROData_Entity theObject ) [void (const Handle_HYDROData_Entity&)];
+ %MethodCode
+
+ Handle(HYDROData_Entity) aRefObject =
+ Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
+ if ( !aRefObject.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::SetMergeObject( aRefObject ) :
+ sipCpp->SetMergeObject( aRefObject );
+ Py_END_ALLOW_THREADS
+ }
+ %End
+
+ /**
+ * Returns the reference object to resolve the conflict.
+ */
+ HYDROData_Entity GetMergeObject() const [Handle_HYDROData_Entity ()];
+ %MethodCode
+
+ Handle(HYDROData_Entity) aRefObject;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRefObject = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetMergeObject() :
+ sipCpp->GetMergeObject();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Entity*)createPointer( aRefObject );
+
+ %End
+
+ /**
+ * Removes the reference object for resolving the conflict.
+ */
+ void RemoveMergeObject();
/**
- * dd new one geometry object for zone.
+ * Add new one object for zone.
*/
- void AddGeometryObject( HYDROData_Object theRegion ) [void (const Handle_HYDROData_Object&)];
+ void AddObject( HYDROData_Entity theObject ) [void (const Handle_HYDROData_Entity&)];
%MethodCode
- Handle(HYDROData_Object) aGeomObj =
- Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
- if ( !aGeomObj.IsNull() )
+ Handle(HYDROData_Entity) anObj =
+ Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
+ if ( !anObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Zone::AddGeometryObject( aGeomObj ) :
- sipCpp->AddGeometryObject( aGeomObj );
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::AddObject( anObj ) :
+ sipCpp->AddObject( anObj );
Py_END_ALLOW_THREADS
}
%End
/**
- * Returns all geometry objects of zone.
+ * Returns all objects of zone.
*/
- HYDROData_SequenceOfObjects GetGeometryObjects() const;
+ HYDROData_SequenceOfObjects GetObjects() const;
/**
- * Removes all geometry objects from zone.
+ * Removes all objects from zone.
*/
- void RemoveGeometryObjects();
+ void RemoveObjects();
/**