#include "HYDROData_PolylineXY.h"
#include "HYDROData_ShapesGroup.h"
-
-#include <BRepAlgoAPI_Common.hxx>
+#include <HYDROData_Transform.h>
#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Common.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
-
+#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Compound.hxx>
#include <TopoDS_Wire.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <NCollection_IncAllocator.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
+#include <NCollection_Map.hxx>
#include <NCollection_DataMap.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
+#include <gp_Pln.hxx>
+#include <BRepGProp.hxx>
+#include <GProp_GProps.hxx>
+#include <Geom_Plane.hxx>
+#include <BRepBuilderAPI_FindPlane.hxx>
+
+
+typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
+typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
typedef NCollection_DataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
typedef NCollection_DataMap<TopoDS_Shape, QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
#undef _NCollection_MapHasher
-#define DEB_SPLIT_TO_ZONES 1
+//#define DEB_SPLIT_TO_ZONES 1
#ifdef DEB_SPLIT_TO_ZONES
#include <BRepTools.hxx>
#endif
return aResFace;
}
+Standard_Boolean buildLimFace(const TopoDS_Wire& theBndWire, TopoDS_Face& outFace)
+{
+ GProp_GProps G;
+ BRepGProp::LinearProperties(theBndWire,G);
+ const gp_Pnt& aCPnt = G.CentreOfMass();
+ gp_Pln aPln;
+ BRepBuilderAPI_FindPlane fndPlane (theBndWire, Precision::Confusion());
+ if(fndPlane.Found())
+ aPln = fndPlane.Plane()->Pln();
+ else
+ aPln = gp_Pln(aCPnt, gp::OZ().Direction());
+ BRepBuilderAPI_MakeFace aMkFace(aPln, theBndWire);
+ if(aMkFace.IsDone()) {
+ outFace = aMkFace.Face();
+ if(!outFace.IsNull()) {
+#ifdef DEB_SPLIT_TO_ZONES
+// BRepTools::Write(limFace,"FL.brep");
+#endif
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
HYDROData_SplitToZonesTool::SplitDataList
HYDROData_SplitToZonesTool::Split( const HYDROData_SequenceOfObjects& theObjectList,
const HYDROData_SequenceOfObjects& theGroupsList,
// Preparation.
// Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
SplitDataList anInputSplitDataList;
- //TCollection_AsciiString aNam("Faces_");
+ TCollection_AsciiString aNam("Faces_");
for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
{
Handle(HYDROData_Object) aGeomObj =
TopoDS_Shape aShape = aGeomObj->GetTopShape();
if ( aShape.IsNull() )
continue;
-//TCollection_AsciiString aName = aNam + anIndex + ".brep";
-//BRepTools::Write(aShape, aName.ToCString());
+ //TCollection_AsciiString aName = aNam + anIndex + ".brep";
+ //BRepTools::Write(aShape, aName.ToCString());
if ( aShape.ShapeType() == TopAbs_COMPOUND ) {
// Create split data for each face contained in the compound
anOutputSplitDataList.append(anInputGroupList);
return anOutputSplitDataList;
}
-
HYDROData_DataMapOfShapeListOfString aDM3;
if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names
QStringList aListOfNames;
BOPAlgo_PaveFiller* aPaveFiller = new BOPAlgo_PaveFiller(pA1);
BOPAlgo_Builder* aBuilder = new BOPAlgo_Builder(pA2);
BOPCol_ListOfShape aLS;
+
QStringList aListOfNames;
+ TopoDS_Compound aCmp;
+ BRep_Builder aBB;
+ aBB.MakeCompound(aCmp);
for (int i=0;i < anInputSplitDataList.size() ;i++) {
const TopoDS_Shape& aSh = anInputSplitDataList.at(i).Shape;
aDM3.Bind(aSh, anInputSplitDataList.at(i).ObjectNames);
aLS.Append(aSh);
+ aBB.Add(aCmp,aSh);
+ //TCollection_AsciiString aName = aNam + i + ".brep";
+ //BRepTools::Write(aSh, aName.ToCString());
}
+ HYDROData_Transform sTool;
+ sTool.Clear();
+ sTool.SetArgument(aCmp);
+ sTool.Detect();
+ const Standard_Boolean bToTransform = sTool.ToTransform();
+ Standard_Integer anErr(0);
+ sTool.SetToTransform(bToTransform);
+ sTool.Perform();
+ anErr = sTool.ErrorStatus();
+ if(anErr)
+ return anOutputSplitDataList;
+ const TopoDS_Shape& aResult = sTool.Shape();
+
+ /*
+ else {
+ BOP ==
aPaveFiller->SetArguments(aLS);
aPaveFiller->Perform();
- Standard_Integer anErr = aPaveFiller->ErrorStatus();
+ anErr = aPaveFiller->ErrorStatus();
if(anErr)
return anOutputSplitDataList;
BOPDS_PDS pDS = aPaveFiller->PDS();
aBuilder->Clear();
// Step 2. Split faces
- BOPCol_ListIteratorOfListOfShape anIt(aPaveFiller->Arguments());
+ BOPCol_ListIteratorOfListOfShape anIt(aLS);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aS = anIt.Value();
aBuilder->AddArgument(aS);
}
aBuilder->PerformWithFiller(*aPaveFiller);
anErr = aBuilder->ErrorStatus();
+
+ ////
if(anErr)
return anOutputSplitDataList;
- const TopoDS_Shape& aResult = aBuilder->Shape();
+ aResult = aBuilder->Shape();
+ } */
+
if (aResult.IsNull())
return anOutputSplitDataList;
BRepCheck_Analyzer aCheck (aResult);
return anOutputSplitDataList;
}
#ifdef DEB_SPLIT_TO_ZONES
- //BRepTools::Write(aResult, "SplitFacesV.brep");
+ BRepTools::Write(aResult, "SplitFacesV.brep");
#endif
// Step 3. Collect history
HYDROData_DataMapOfShapeListOfShape aDM1;
- anIt.Init(aLS);
+ BOPCol_ListIteratorOfListOfShape anIt(aLS);
//TCollection_AsciiString aNamM ("EdgM_");
//TCollection_AsciiString aNamG ("EdgG_");
for (int i =1;anIt.More();anIt.Next(),i++) {
Standard_Boolean foundF(Standard_False);
- const TopTools_ListOfShape& aListOfNew = aBuilder->Modified(anIt.Value());
+ const TopTools_ListOfShape& aListOfNew = /*aBuilder->*/sTool.Modified(anIt.Value());
if(!aListOfNew.IsEmpty())
foundF = Standard_True;
TopTools_ListOfShape aList;
for(;it.More();it.Next())
aList.Append(it.Value());
// Bug in History: partition should give only modified entities! => temporary solution is used
- const TopTools_ListOfShape& aListOfGen = aBuilder->Generated(anIt.Value());
+ const TopTools_ListOfShape& aListOfGen = /*aBuilder->*/sTool.Generated(anIt.Value());
if(!aListOfGen.IsEmpty())
foundF = Standard_True;
it.Initialize(aListOfGen);
TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
for (int j =1;exp.More();exp.Next(),j++) {
Standard_Boolean foundE(Standard_False);
- const TopTools_ListOfShape& aListM = aBuilder->Modified(exp.Current());
+ const TopTools_ListOfShape& aListM = /*aBuilder->*/sTool.Modified(exp.Current());
//cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
if(aListM.Extent()) foundE = Standard_True;
it.Initialize(aListM);
//aName = aNamM + i + j +k +".brep";
//BRepTools::Write(it.Value(),aName.ToCString());
}
- const TopTools_ListOfShape& aListG = aBuilder->Generated(exp.Current());
+ const TopTools_ListOfShape& aListG = /*aBuilder->*/sTool.Generated(exp.Current());
if(aListG.Extent()) foundE = Standard_True;
it.Initialize(aListG);
for(int k=1;it.More();it.Next(),k++) {
// aDM2: NewShape ==> ListOfOldShapes
HYDROData_DataMapOfShapeListOfShape aDM2;
- HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
- for(;aMIt.More();aMIt.Next()) {
- const TopoDS_Shape& aKey = aMIt.Key();
- TopTools_ListOfShape aList;
- aList.Append(aKey);
- const TopTools_ListOfShape& aListOfNew = aMIt.Value();
- TopTools_ListIteratorOfListOfShape it(aListOfNew);
- for(;it.More();it.Next()) {
- if(!aDM2.IsBound(it.Value()))
- aDM2.Bind(it.Value(), aList);
- else {
- TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
- aList.Prepend(aKey);
- }
- }
+ // make limiting face
+ HYDROData_DataMapOfShapeListOfShape aDM4;
+ Standard_Boolean hasLimits(Standard_False);
+ if (! thePolyline.IsNull()) {
+ //const TopoDS_Shape aShape = thePolyline->GetShape();
+ const TopoDS_Wire aBndWire = TopoDS::Wire(thePolyline->GetShape());
+ if(!aBndWire.IsNull()) {
+ TopoDS_Face limFace;
+ if(buildLimFace(aBndWire, limFace)) {
+ TopoDS_Shape aComResult;
+ BRepAlgoAPI_Common mkCom(aResult, limFace);
+ if(mkCom.IsDone()) {
+ aComResult = mkCom.Shape();
+ BRepCheck_Analyzer aCheck (aComResult);
+ if(aCheck.IsValid()) {
+#ifdef DEB_SPLIT_TO_ZONES
+ BRepTools::Write(aComResult,"CommonV.brep");
+#endif
+
+ hasLimits = Standard_True; // DM2 should filled here
+ HYDROData_MapOfShape aView;
+ TopExp_Explorer exp (aResult, TopAbs_FACE);
+ for (int i =1;exp.More();exp.Next(),i++) {
+ const TopoDS_Shape& aFace = exp.Current();
+ if(!aFace.IsNull()) {
+ const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace);
+ //cout << "Modified: " << aListOfNew.Extent() <<endl;
+ const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);
+ if(!aListOfNew.IsEmpty()) {
+ aDM4.Bind(aFace, aListOfNew);
+ //TCollection_AsciiString aName = aNam + i + ".brep";
+ //BRepTools::Write(aListOfNew.Last(), aName.ToCString());
+ }
+ else {
+ if(!mkCom.IsDeleted(aFace)) {
+ if(!aListOfGen.IsEmpty()) {
+ aDM4.Bind(aFace, aListOfGen);
+ //TCollection_AsciiString aName = aNam + i + "g.brep";
+ //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
+ }
+ else {
+ TopTools_ListOfShape aList;
+ aList.Append(aFace);
+ aDM4.Bind(aFace, aList); //the same face - not modified
+ }
+ }
+ }
+ TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
+ for (int j =1;exp2.More();exp2.Next(),j++) {
+ const TopoDS_Shape& anEdge = exp2.Current();
+ if(!anEdge.IsNull()) {
+ if(aView.Contains(anEdge)) continue;
+ aView.Add(anEdge);
+ const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);
+ const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
+ if(!aListOfNewEd.IsEmpty())
+ aDM4.Bind(anEdge, aListOfNewEd);
+ else {
+ if(!mkCom.IsDeleted(anEdge)) {
+ if(!aListOfGenEd.IsEmpty()) {
+ aDM4.Bind(anEdge, aListOfGenEd);
+ } else {
+ TopTools_ListOfShape aList;
+ aList.Append(anEdge);
+ aDM4.Bind(anEdge, aList);//the same edge - not modified
+ }
+ }
+ }
+ }
+ }
+ }
+ } //end DM4 filling (phase 1)
+ //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
+ // phase 2 (from tool)
+ TopExp_Explorer expt (limFace, TopAbs_EDGE);
+ for(;expt.More();expt.Next()) {
+ const TopoDS_Shape& anEdge = expt.Current();
+ if(!anEdge.IsNull()) {
+ const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);
+ const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
+ if(!aListOfNewEd.IsEmpty())
+ aDM4.Bind(anEdge, aListOfNewEd);
+ else {
+ if(!mkCom.IsDeleted(anEdge)) {
+ if(!aListOfGenEd.IsEmpty()) {
+ aDM4.Bind(anEdge, aListOfGenEd);
+ } else {
+ TopTools_ListOfShape aList;
+ aList.Append(anEdge);
+ aDM4.Bind(anEdge, aList);//the same edge - not modified
+ }
+ }
+ }
+ }
+ }
+ //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
+ HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
+ //DM4 contains Old - New after common op. DM1: old - new after Split op.
+ for(;aMIt.More();aMIt.Next()) {
+ const TopoDS_Shape& aKey = aMIt.Key();
+ TopTools_ListOfShape aList;
+ aList.Append(aKey);
+ const TopTools_ListOfShape& aListOfNew = aMIt.Value();
+ TopTools_ListIteratorOfListOfShape it(aListOfNew);
+ for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
+ if(!aDM4.IsBound(it.Value())) // bi - is deleted
+ continue; // go to the next bi
+ else {
+ const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
+ TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
+ for(;it4.More();it4.Next()) {
+ if(!aDM2.IsBound(it4.Value()))
+ aDM2.Bind(it4.Value(), aList);
+ else {
+ TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
+ aList.Prepend(aKey);
+ }
+ }
+ }
+ }//
+ }
+ } else {
+ hasLimits = Standard_False;
+#ifdef DEB_SPLIT_TO_ZONES
+ BRepTools::Write(aComResult,"CommonNV.brep");
+#endif
+ }
+ }
+ }
+ }
+ }
+ if(!hasLimits) {
+ HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
+ for(;aMIt.More();aMIt.Next()) {
+ const TopoDS_Shape& aKey = aMIt.Key();
+ TopTools_ListOfShape aList;
+ aList.Append(aKey);
+ const TopTools_ListOfShape& aListOfNew = aMIt.Value();
+ TopTools_ListIteratorOfListOfShape it(aListOfNew);
+ for(;it.More();it.Next()) {
+ if(!aDM2.IsBound(it.Value()))
+ aDM2.Bind(it.Value(), aList);
+ else {
+ TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
+ aList.Prepend(aKey);
+ }
+ }
+ }
}
- //cout << "DM2 Ext = " <<aDM2.Extent() <<endl;
// Step 4. Fill output structure.
- aMIt.Initialize(aDM2);
+ //TCollection_AsciiString aNam4 ("SC_");
+
+ HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM2);
for(int i =1;aMIt.More();aMIt.Next(),i++) {
SplitData aDestSplitData;
const TopoDS_Shape& aKey = aMIt.Key(); //new
aDestSplitData.Type = SplitData::Data_Zone;
else
aDestSplitData.Type = SplitData::Data_Edge;
+#ifdef DEB_SPLIT_TO_ZONES
+ //TCollection_AsciiString aName = aNam4 + i + ".brep";
+ //BRepTools::Write(aKey,aName.ToCString());
+#endif
+
QStringList aListOfNames; // names processing
const TopTools_ListOfShape& aListOfOld = aMIt.Value();
aDestSplitData.ObjectNames = aListOfNames;
anOutputSplitDataList.append(aDestSplitData);
}
- //cout << "anOutputSplitDataList = " <<anOutputSplitDataList.size() <<endl;
+
return anOutputSplitDataList;
-
-/*
- // Step 3. Extract the separate regions.
- SplitDataList anExtractedSplitDataList;
- SplitDataListIterator anOutputIter( anOutputSplitDataList );
- while( anOutputIter.hasNext() )
- {
- const SplitData& anOutputSplitData = anOutputIter.next();
- anExtractedSplitDataList.append( ExtractSeparateData( anOutputSplitData ) );
- }
-*/
- // return anExtractedSplitDataList;
}
bool HYDROData_SplitToZonesTool::SplitTwoData( const SplitData& theData1,
--- /dev/null
+#include <HYDROData_Transform.h>
+
+#include <math.h>
+
+#include <Bnd_Box.hxx>
+#include <gp_Vec.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Iterator.hxx>
+
+#include <BRepBndLib.hxx>
+
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPCol_MapOfShape.hxx>
+
+#include <BOPCol_ListOfShape.hxx>
+
+#include <BOPAlgo_BuilderShape.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+
+//=======================================================================
+//function : HYDROData_Transform
+//purpose :
+//=======================================================================
+HYDROData_Transform::HYDROData_Transform()
+:
+ BOPAlgo_BuilderShape()
+{
+ myToTransform=Standard_False;
+ myTreshold=10000.;
+ myTransform1=NULL;
+ myTransform2=NULL;
+ myBuilder=NULL;
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+HYDROData_Transform::~HYDROData_Transform()
+{
+ Clear();
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Clear()
+{
+ myTreshold=10000.;
+ //
+ if (myTransform1) {
+ delete myTransform1;
+ myTransform1=NULL;
+ }
+ if (myTransform2) {
+ delete myTransform2;
+ myTransform2=NULL;
+ }
+ if (myBuilder) {
+ delete myBuilder;
+ myBuilder=NULL;
+ }
+ //
+ BOPAlgo_BuilderShape::PrepareHistory();
+}
+//=======================================================================
+//function : SetArgument
+//purpose :
+//=======================================================================
+void HYDROData_Transform::SetArgument(const TopoDS_Shape& theShape)
+{
+ myArgument=theShape;
+}
+//=======================================================================
+//function : AddArgument
+//purpose :
+//=======================================================================
+const TopoDS_Shape& HYDROData_Transform::Argument()const
+{
+ return myArgument;
+}
+//=======================================================================
+//function : SetTreshold
+//purpose :
+//=======================================================================
+void HYDROData_Transform::SetTreshold(const Standard_Real theTreshold)
+{
+ myTreshold=theTreshold;
+}
+//=======================================================================
+//function : Treshold
+//purpose :
+//=======================================================================
+Standard_Real HYDROData_Transform::Treshold()const
+{
+ return myTreshold;
+}
+//=======================================================================
+//function : SetToTransform
+//purpose :
+//=======================================================================
+void HYDROData_Transform::SetToTransform(const Standard_Boolean theFlag)
+{
+ myToTransform=theFlag;
+}
+//=======================================================================
+//function : ToTransform
+//purpose :
+//=======================================================================
+Standard_Boolean HYDROData_Transform::ToTransform()const
+{
+ return myToTransform;
+}
+//=======================================================================
+//function : CheckData
+//purpose :
+//=======================================================================
+void HYDROData_Transform::CheckData()
+{
+ if(myArgument.IsNull()) {
+ myErrorStatus=10;
+ }
+}
+//=======================================================================
+//function : Prepare
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Prepare()
+{
+ TopoDS_Shape aSx;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ myShape=aSx;
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Perform()
+{
+ Prepare();
+ //
+ CheckData();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ Clear();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ ComputeTrsf();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ Transform1();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ BuildFuse();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ Transform2();
+}
+//=======================================================================
+//function : Detect
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Detect()
+{
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Standard_Real aXc, aYc, aZc;
+ Bnd_Box aBox;
+ gp_Vec aVec;
+ //
+ myErrorStatus=0;
+ //
+ BRepBndLib::Add(myArgument, aBox);
+ //
+ aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ //
+ aXc=0.5*(aXmin+aXmax);
+ aYc=0.5*(aYmin+aYmax);
+ aZc=0.5*(aZmin+aZmax);
+ printf(" aVc : { %lf %lf %lf }\n", aXc, aYc, aZc);
+ //
+ myToTransform=Standard_False;
+ if (fabs(aXc)>myTreshold ||
+ fabs(aYc)>myTreshold ||
+ fabs(aZc)>myTreshold) {
+ myToTransform=!myToTransform;
+ }
+ //
+ aVec.SetCoord(-aXc, -aYc, -aZc);
+ myTrsf1.SetTranslation(aVec);
+ //
+ aVec.SetCoord(aXc, aYc, aZc);
+ myTrsf2.SetTranslation(aVec);
+}
+//=======================================================================
+//function : ComputeTrsf
+//purpose :
+//=======================================================================
+void HYDROData_Transform::ComputeTrsf()
+{
+ if (!myToTransform) {
+ gp_Trsf aTrsf;
+ //
+ myTrsf1=aTrsf;
+ myTrsf2=aTrsf;
+ }
+}
+//=======================================================================
+//function : Transform1
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Transform1()
+{
+ Standard_Boolean bIsDone;
+ //
+ myErrorStatus=0;
+ //
+ myTransform1=new BRepBuilderAPI_Transform(myTrsf1);
+ //
+ myTransform1->Perform(myArgument);
+ bIsDone=myTransform1->IsDone();
+ if (!bIsDone) {
+ myErrorStatus=11;
+ return;
+ }
+}
+//=======================================================================
+//function : BuildFuse
+//purpose :
+//=======================================================================
+void HYDROData_Transform::BuildFuse()
+{
+ Standard_Integer iErr;
+ TopoDS_Iterator aIt;
+ BOPCol_ListOfShape aLC;
+ BOPAlgo_PaveFiller aPF;
+ //
+ myErrorStatus=0;
+ //
+ const TopoDS_Shape& aS1=myTransform1->Shape();
+ //
+ aIt.Initialize(aS1);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS1x=aIt.Value();
+ aLC.Append(aS1x);
+ }
+ //
+ aPF.SetArguments(aLC);
+ //
+ aPF.Perform();
+ iErr=aPF.ErrorStatus();
+ if (iErr) {
+ myErrorStatus=20;
+ return;
+ }
+ //
+ myBuilder=new BOPAlgo_Builder;
+ //
+ aIt.Initialize(aS1);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS1x=aIt.Value();
+ myBuilder->AddArgument(aS1x);
+ }
+ //
+ myBuilder->PerformWithFiller(aPF);
+ iErr=myBuilder->ErrorStatus();
+ if (iErr) {
+ myErrorStatus=21;
+ return;
+ }
+}
+//=======================================================================
+//function : Transform2
+//purpose :
+//=======================================================================
+void HYDROData_Transform::Transform2()
+{
+ Standard_Boolean bIsDone;
+ //
+ myErrorStatus=0;
+ //
+ const TopoDS_Shape& aR1=myBuilder->Shape();
+ //
+ myTransform2=new BRepBuilderAPI_Transform(myTrsf2);
+ //
+ myTransform2->Perform(aR1);
+ bIsDone=myTransform2->IsDone();
+ if (!bIsDone) {
+ myErrorStatus=12;
+ return;
+ }
+ //
+ const TopoDS_Shape& aR2=myTransform2->Shape();
+ //
+ myShape=aR2;
+}
+//
+//=======================================================================
+//function : Modified
+//purpose :
+//=======================================================================
+const TopTools_ListOfShape& HYDROData_Transform::Modified
+ (const TopoDS_Shape& aS)
+{
+ TopTools_ListOfShape* pHistShapes;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ //
+ pHistShapes=(TopTools_ListOfShape*)&myHistShapes;
+ pHistShapes->Clear();
+ //
+ const TopTools_ListOfShape& aLS1=myTransform1->Modified(aS);
+ const TopoDS_Shape& aS1=aLS1.First();
+ //
+ const TopTools_ListOfShape& aLS1B=myBuilder->Modified(aS1);
+ aItLS.Initialize(aLS1B);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aS1B=aItLS.Value();
+ const TopTools_ListOfShape& aLS2B=myTransform2->Modified(aS1B);
+ const TopoDS_Shape& aS2B=aLS2B.First();
+ pHistShapes->Append(aS2B);
+ }
+ //
+ return myHistShapes;
+}
+//=======================================================================
+//function : Generated
+//purpose :
+//=======================================================================
+const TopTools_ListOfShape& HYDROData_Transform::Generated
+ (const TopoDS_Shape& aS)
+{
+ TopTools_ListOfShape* pHistShapes;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ //
+ pHistShapes=(TopTools_ListOfShape*)&myHistShapes;
+ pHistShapes->Clear();
+ //
+ const TopTools_ListOfShape& aLS1=myTransform1->Modified(aS);
+ const TopoDS_Shape& aS1=aLS1.First();
+ //
+ const TopTools_ListOfShape& aLS1B=myBuilder->Generated(aS1);
+ aItLS.Initialize(aLS1B);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aS1B=aItLS.Value();
+ const TopTools_ListOfShape& aLS2B=myTransform2->Modified(aS1B);
+ const TopoDS_Shape& aS2B=aLS2B.First();
+ pHistShapes->Append(aS2B);
+ }
+ //
+ return myHistShapes;
+}
+//=======================================================================
+//function : IsDeleted
+//purpose :
+//=======================================================================
+Standard_Boolean HYDROData_Transform::IsDeleted(const TopoDS_Shape& aS)
+{
+ Standard_Boolean bIsDeleted;
+ //
+ const TopTools_ListOfShape& aLS1=myTransform1->Modified(aS);
+ const TopoDS_Shape& aS1=aLS1.First();
+ //
+ bIsDeleted=myBuilder->IsDeleted(aS1);
+ //
+ return bIsDeleted;
+}
+//=======================================================================
+//function : HasDeleted
+//purpose :
+//=======================================================================
+Standard_Boolean HYDROData_Transform::HasDeleted()
+{
+ return myBuilder->HasDeleted();
+}
+//=======================================================================
+//function : HasGenerated
+//purpose :
+//=======================================================================
+Standard_Boolean HYDROData_Transform::HasGenerated()
+{
+ return myBuilder->HasGenerated();
+}
+//=======================================================================
+//function : HasModified
+//purpose :
+//=======================================================================
+Standard_Boolean HYDROData_Transform::HasModified()
+{
+ return myBuilder->HasModified();
+}