#ifdef DEB_CALCULATION
#include <BRepTools.hxx>
#include <TopLoc_Location.hxx>
-#endif
+#endif
#define CALCULATION_REGIONS_PREF GetName() + "_Reg"
#define CALCULATION_ZONES_PREF GetName() + "_Zone"
#define CALCULATION_GROUPS_PREF GetName() + "_"
{
}
-void HYDROData_CalculationCase::SetName( const QString& theName )
+void HYDROData_CalculationCase::SetName( const QString& theName, bool isDefault )
{
QString anOldCaseName = GetName();
if ( anOldCaseName != theName )
}
}
- HYDROData_Entity::SetName( theName );
+ HYDROData_Entity::SetName( theName, isDefault );
}
QStringList HYDROData_CalculationCase::DumpToPython( const QString& thePyScriptPath,
QString aCalculName = GetObjPyName();
- AssignmentMode aMode = GetAssignmentMode();
+ AssignmentMode aMode = GetAssignmentMode();
QString aModeStr = aMode==MANUAL ? "HYDROData_CalculationCase.MANUAL" : "HYDROData_CalculationCase.AUTOMATIC";
aResList << QString( "%0.SetAssignmentMode( %1 )" ).arg( aCalculName ).arg( aModeStr );
{
// Now we restore the
// - regions and zones order
- DumpRegionsToPython( aResList, thePyScriptPath, theTreatedObjects, GetRegions() );
+ DumpRegionsToPython( aResList, thePyScriptPath, theTreatedObjects, GetRegions() );
}
// Export calculation case
Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( aBoundaryPolygons(i));
TopoDS_Shape aPolyTopShape = aBCPoly->GetTopShape();
int bType = aBCPoly->GetBoundaryType();
- if (bType == 2)
+ if (bType == 2)
IncTools.Append(aPolyTopShape);
else if (bType == 3)
SelectionTools.Append(aPolyTopShape);
}
-
+
while( anIter.hasNext() )
{
const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( aBoundaryPolygons(i));
TopoDS_Shape aPolyTopShape = aBCPoly->GetTopShape();
int bType = aBCPoly->GetBoundaryType();
- if (bType == 1)
+ if (bType == 1)
{
CutTools.Append(aPolyTopShape);
QString bp_name = aBCPoly->GetName();
BPolyToName.Bind(aPolyTopShape, bp_name);
}
}
-
+
while( anIter.hasNext() )
{
const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
TopoDS_Edge E = TopoDS::Edge(it.Value());
if (!E.IsNull())
{
- HYDROData_SplitToZonesTool::SplitData SD(HYDROData_SplitToZonesTool::SplitData::Data_Edge, E, *name);
+ HYDROData_SplitToZonesTool::SplitData SD(HYDROData_SplitToZonesTool::SplitData::Data_Edge, E, *name);
outBoundaryPolygonEdgesList.append(SD);
}
}
const NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& ObjToRes,
HYDROData_SplitToZonesTool::SplitDataList& outZoneList)
{
- HYDROData_SplitToZonesTool::SplitDataListIterator it( ZoneList );
+ HYDROData_SplitToZonesTool::SplitDataListIterator it( ZoneList );
BRepTools_ReShape reshaper;
for (;it.hasNext();)
{
else
continue;
}
- else
+ else
continue;
}
reshaper.Replace(K, V);
TopoDS_Shape nS = reshaper.Apply(mS);
HYDROData_SplitToZonesTool::SplitData aNS(aSplitData.Type, nS, aSplitData.ObjectNames);
outZoneList.append(aNS);
- }
+ }
}
static void CreateNewEdgeList( const HYDROData_SplitToZonesTool::SplitDataList& theEdges,
CreateNewEdgeList(anEdgesList, ObjToRes, newEdgesList1);
//
newEdgesList1.append(outBoundaryPolygonEdgesList); //append new list of groups
- //filter out edges list by include&selection tools
+ //filter out edges list by include&selection tools
FilterEdgesByIncludeSelectionBoundaryPolygons(newEdgesList1,aBoundaryPolygons,newEdgesList2);
-
+
switch( GetAssignmentMode() )
{
case MANUAL:
- CreateRegionsDef( aDocument,aNewZonesList );
+ CreateRegionsDef( aDocument,aNewZonesList );
break;
case AUTOMATIC:
- CreateRegionsAuto( aDocument,aNewZonesList );
+ CreateRegionsAuto( aDocument,aNewZonesList );
break;
}
anObjectsWithEmptyRegions.append( anObjName );
}
}
-
+
if( !anObjectsWithEmptyRegions.empty() )
{
QString aData = anObjectsWithEmptyRegions.join( ", " );
if ( anObjName.isEmpty() )
continue;
#ifdef DEB_CALCULATION
- QString aStr = aSplitData.ObjectNames.join(" ");
- cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;
+ QString aStr = aSplitData.ObjectNames.join(" ");
+ cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;
#endif
Handle(HYDROData_SplitShapesGroup) aSplitGroup;
if ( !aSplitEdgesGroupsMap.contains( anObjName ) )
aSplitGroup->GetShapes(theShapes);
if (aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_IntEdge)
- aSplitGroup->SetInternal(true);
+ aSplitGroup->SetInternal(true);
}
}
return false; // Object is already in reference list
AddReferenceObject( theObject, DataTag_GeometryObject );
-
+
// Indicate model of the need to update splitting
Changed( Geom_2d );
return false; // Object is already in reference list
AddReferenceObject( theGroup, DataTag_GeometryGroup );
-
+
// Indicate model of the need to update splitting
Changed( Geom_Groups );
Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
{
- return Handle(HYDROData_PolylineXY)::DownCast(
+ return Handle(HYDROData_PolylineXY)::DownCast(
GetReferenceObject( DataTag_Polyline ) );
}
Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
{
- return Handle(HYDROData_StricklerTable)::DownCast(
+ return Handle(HYDROData_StricklerTable)::DownCast(
GetReferenceObject( DataTag_StricklerTable ) );
}
if ( theRegion.IsNull() )
return false;
-
+
HYDROData_CalculationCase::DataTag aDataTag = DataTag_Region;
if ( HasReference( theRegion, aDataTag ) )
return false; // Object is already in reference list
// Move the region from other calculation
- Handle(HYDROData_CalculationCase) aFatherCalc =
+ Handle(HYDROData_CalculationCase) aFatherCalc =
Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
{
return;
QString aRegsPref = CALCULATION_REGIONS_PREF;
- std::map<int, Handle(HYDROData_Region)> IndToRegion; //index in the name of region to region itself
+ std::map<int, Handle(HYDROData_Region)> IndToRegion; //index in the name of region to region itself
HYDROData_SequenceOfObjects aRegions = GetRegions();
HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
QString aName;
RemoveReferenceObject( theRegion->Label(), aDataTag );
// Remove region from data model
- Handle(HYDROData_CalculationCase) aFatherCalc =
+ Handle(HYDROData_CalculationCase) aFatherCalc =
Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
if ( !aFatherCalc.IsNull() && aFatherCalc->Label() == myLab )
theRegion->Remove();
HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
{
- Handle(HYDROData_IAltitudeObject) aMergeAltitude =
+ Handle(HYDROData_IAltitudeObject) aMergeAltitude =
Handle(HYDROData_IAltitudeObject)::DownCast( theZone->GetMergeObject() );
if ( !aMergeAltitude.IsNull() )
{
return aResAltitude;
}
-NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
+NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
const Handle(HYDROData_Region)& theRegion,
int theMethod) const
for ( int i = 1, n = aNbPoints; i <= n && aPSentry.More(); ++i, aPSentry.Next() )
{
const gp_XY& thePnt = thePoints.Value( i );
-
+
double anAltitude = GetAltitudeForPoint( thePnt, theRegion, theMethod );
aResSeq.Append( anAltitude );
}
return aResSeq;
}
-NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
+NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
const Handle(HYDROData_Zone)& theZone,
int theMethod) const
for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
{
const gp_XY& thePnt = thePoints.Value( i );
-
+
double anAltitude = GetAltitudeForPoint( thePnt, theZone, theMethod );
aResSeq.Append( anAltitude );
}
TopoDS_Face aZoneFace = TopoDS::Face( theZone->GetShape() );
if ( aZoneFace.IsNull() )
return aRes;
-#ifdef DEB_CLASS2D
+#ifdef DEB_CLASS2D
TopoDS_Compound aCmp;
BRep_Builder aBB;
aBB.MakeCompound(aCmp);
BRepBuilderAPI_MakeVertex aMk(aPnt);
aBB.Add(aCmp, aMk.Vertex());
BRepTools::Write(aCmp, "FCL2d.brep");
-#endif
+#endif
TopAbs_State State = HYDROData_Tool::ComputePointState(thePoint, aZoneFace);
if (State == TopAbs_OUT)
aRes = POINT_OUT;
TDF_Label aNewLab = myLab.FindChild( DataTag_SplitGroups ).NewChild();
Handle(HYDROData_SplitShapesGroup) aNewGroup =
- Handle(HYDROData_SplitShapesGroup)::DownCast(
+ Handle(HYDROData_SplitShapesGroup)::DownCast(
HYDROData_Iterator::CreateObject( aNewLab, KIND_SPLIT_GROUP ) );
AddReferenceObject( aNewGroup, DataTag_SplitGroups );
return "";
#else
GEOM::GEOM_Gen_var aGEOMEngine = HYDROData_GeomTool::GetGeomGen();
-
+
QString aGeomObjEntry, anErrorMsg;
QString statMess;
bool isOK = Export( aGEOMEngine, aGeomObjEntry, anErrorMsg, statMess );
}
}
-
+
// Get faces
bool isAllNotSubmersible = true;
HYDROData_SequenceOfObjects aCaseRegions = GetRegions();
Handle(HYDROData_Region)::DownCast( aRegionIter.Value() );
if( aRegion.IsNull() || !aRegion->IsSubmersible() )
continue;
-
+
if ( isAllNotSubmersible )
isAllNotSubmersible = false;
}
}
} // faces iterator
-
+
aSewing.Perform();
TopoDS_Shape aSewedShape = aSewing.SewedShape();
}
}
-
+
// If the sewed shape is empty - return false
if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() )
return false;
BRepTools::Write(aSewedShape ,"Sew.brep");
#endif // Publish the sewed shape
QString aName = EXPORT_NAME;
- GEOM::GEOM_Object_ptr aMainShape =
+ GEOM::GEOM_Object_ptr aMainShape =
HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( theGeomEngine, aSewedShape, aFacesToNameModif, aName, theGeomObjEntry );
- if ( aMainShape->_is_nil() )
+ if ( aMainShape->_is_nil() )
return false;
if ( theGroupsDefs.IsEmpty() )
#ifdef DEB_CALCULATION
cout << "\nOld shape(" << i << ") = " << aShape.TShape() <<endl;
#endif
-
+
TopoDS_Shape aModifiedShape = aShape;
if ( aSewing.IsModified( aShape ) )
aModifiedShape = aSewing.Modified( aShape );
if ( anIndex > 0 ) {
aGroupIndexes.Append( anIndex );
} else {
-#ifdef DEB_CALCULATION
+#ifdef DEB_CALCULATION
TCollection_AsciiString aNam("Lost_");
if(!aMapOfSubShapes.Contains(aModifiedShape)) {
for ( int anIndex = 1; anIndex <= aMapOfSubShapes.Extent(); anIndex++ )
if ( !aGroupIndexes.IsEmpty() )
aGroupsData.Bind( aGroupDef.Name, aGroupIndexes );
}
-
+
if ( !aGroupsData.IsEmpty() )
{
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- theGeomEngine->GetIGroupOperations();
+ GEOM::GEOM_IGroupOperations_var aGroupOp =
+ theGeomEngine->GetIGroupOperations();
NCollection_DataMap< TCollection_AsciiString, NCollection_Sequence<int> >::Iterator aMapIt( aGroupsData );
for ( ; aMapIt.More(); aMapIt.Next() )
{
- const TCollection_AsciiString& aGroupName = aMapIt.Key();
+ const TCollection_AsciiString& aGroupName = aMapIt.Key();
const NCollection_Sequence<int>& aGroupIndexes = aMapIt.Value();
GEOM::GEOM_Object_var aGeomGroup = aGroupOp->CreateGroup( aMainShape, TopAbs_EDGE );
aGroupOp->UnionIDs( aGeomGroup, aGeomIndexes );
if ( aGroupOp->IsDone() )
{
- SALOMEDS::SObject_var aGroupSO =
+ SALOMEDS::SObject_var aGroupSO =
theGeomEngine->AddInStudy( aGeomGroup, aGroupName.ToCString(), aMainShape );
}
}
}
}
-bool HYDROData_CalculationCase::GetRule( int theIndex,
+bool HYDROData_CalculationCase::GetRule( int theIndex,
Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType& thePriority,
Handle(HYDROData_Entity)& theObject2,
HYDROData_CalculationCase::DataTag aDataTag = DataTag_InterPoly;
if ( HasReference( theInterPolyline, aDataTag ) )
- return false;
+ return false;
AddReferenceObject( theInterPolyline, aDataTag );
HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetInterPolyObjects() const
{
- return GetReferenceObjects( DataTag_InterPoly );
+ return GetReferenceObjects( DataTag_InterPoly );
}
-void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_PolylineXY)& theInterPolyline )
+void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_PolylineXY)& theInterPolyline )
{
if ( theInterPolyline.IsNull() )
return;
HYDROData_CalculationCase::DataTag aDataTag = DataTag_BCPolygon;
if ( HasReference( theBCPolygon, aDataTag ) )
- return false;
+ return false;
AddReferenceObject( theBCPolygon, aDataTag );
HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetBoundaryPolygons() const
{
- return GetReferenceObjects( DataTag_BCPolygon );
+ return GetReferenceObjects( DataTag_BCPolygon );
}
-void HYDROData_CalculationCase::RemoveBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon )
+void HYDROData_CalculationCase::RemoveBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon )
{
if ( theBCPolygon.IsNull() )
return;
* Updates the name of this object.
* Reimplemented to update the names of regions, zones and split groups.
*/
- HYDRODATA_EXPORT virtual void SetName( const QString& theName );
+ HYDRODATA_EXPORT virtual void SetName( const QString& theName, bool isDefault = false );
/**
* Dump Calculation object to Python script representation.
*/
HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
-public:
+public:
// Public methods to work with Calculation
/**
* because of new region becomes the new parent for this zone.
* \return the created region
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
/**
* Removes reference region from calculation case.
* \param theRegion the region to remove
*/
- HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
+ HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
/**
* Removes all reference regions from calculation case.
/**
* \brief Set the Container Name to use when not default (FactoryServer).
- * \param theContainerName the name of the container used for GEOM
+ * \param theContainerName the name of the container used for GEOM
* (to be used by scripts for distributed execution)
*/
HYDRODATA_EXPORT virtual void SetContainerName( const QString& theContainerName );
-
+
/**
* Exports the calculation case data (shell and groups) to GEOM module.
* \return the entry of the GEOM object (empty string in the case of error)
QString& statMess) const;
#endif
-public:
+public:
// Public methods to work with Calculation services
/**
* \param theRegion reference region to check
* \return result altitude value
*/
- HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
+ HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
const Handle(HYDROData_Region)& theRegion,
int theMethod = 0) const;
* \param theZone reference zone to check
* \return result altitude value
*/
- HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
+ HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
const Handle(HYDROData_Zone)& theZone,
int theMethod = 0) const;
const Handle(HYDROData_Entity)& theObject2,
HYDROData_Zone::MergeType theMergeType,
HYDROData_CalculationCase::DataTag theDataTag );
- HYDRODATA_EXPORT bool GetRule( int theIndex,
+ HYDRODATA_EXPORT bool GetRule( int theIndex,
Handle(HYDROData_Entity)& theObject1,
HYDROData_PriorityType& thePriority,
Handle(HYDROData_Entity)& theObject2,
/**
* Exports the given faces as shell and the given groups to GEOM module.
* \param theGeomEngine GEOM module engine
- * \param theFaces the list of faces to make shell
+ * \param theFaces the list of faces to make shell
* \param theSplitGroups the list of groups
* \return true in case of success
*/
const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs,
QString& theGeomObjEntry ) const;
#endif
-
+
void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
const HYDROData_SplitToZonesTool::SplitDataList& theZones );
void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
void UpdateRegionsNames( const HYDROData_SequenceOfObjects& theRegions,
const QString& theOldCaseName,
const QString& theName );
-
+
void DumpRegionsToPython( QStringList& theResList,
const QString& thePyScriptPath,
MapOfTreatedObjects& theTreatedObjects,
friend class HYDROData_Iterator;
/**
- * Creates new object in the internal data structure. Use higher level objects
+ * Creates new object in the internal data structure. Use higher level objects
* to create objects with real content.
*/
HYDRODATA_EXPORT HYDROData_CalculationCase();