//remove internal edges
//if nothing changes => the result shape should be the same
- //in any other case the history of modifications may be broken
- aResult = RemoveInternal(aResult);
+ //hence the map will be empty
+
+ NCollection_IndexedDataMap<TopoDS_Face, TopoDS_Face> ShF2FHistory;
+ RemoveInternal(aResult, &ShF2FHistory);
//one face => mark as unchanged
if( aListOfFaces.Extent() == 1 )
TopTools_ListOfShape aLS = ShHistory.FindFromKey(aFF);
if (aLS.IsEmpty())
{
- QString SType = theMap.FindFromKey(aFF);
- aChF2ST.Add(aFF, SType);
+ QString aSType = theMap.FindFromKey(aFF);
+ if (ShF2FHistory.Contains(aFF))
+ aChF2ST.Add(ShF2FHistory.FindFromKey(aFF), aSType);
+ else
+ aChF2ST.Add(aFF, aSType);
}
else
{
for (; anIt.More(); anIt.Next())
{
QString aSType = theMap.FindFromKey(aFF);
- aChF2ST.Add(TopoDS::Face(anIt.Value()), aSType);
+ const TopoDS_Face& aMF = TopoDS::Face(anIt.Value());
+ if (ShF2FHistory.Contains(aFF))
+ aChF2ST.Add(ShF2FHistory.FindFromKey(aFF), aSType);
+ else
+ aChF2ST.Add(aFF, aSType);
}
}
}
return aResList;
}
-TopoDS_Shape HYDROData_LandCoverMap::RemoveInternal(const TopoDS_Shape& InSh)
+void HYDROData_LandCoverMap::RemoveInternal(TopoDS_Shape& ShToRebuild, NCollection_IndexedDataMap<TopoDS_Face, TopoDS_Face>* aF2FReplace)
{
//Shape must be topologically correct
- TopExp_Explorer anExp(InSh, TopAbs_EDGE);
- TopTools_ListOfShape anEdgesToRemove;
-
- for(; anExp.More(); anExp.Next() )
+ TopExp_Explorer anExpF(ShToRebuild, TopAbs_FACE);
+ //
+ for(; anExpF.More(); anExpF.Next() )
{
- TopoDS_Edge CurEdge = TopoDS::Edge(anExp.Current());
- if (CurEdge.Orientation() == TopAbs_INTERNAL)
- anEdgesToRemove.Append(CurEdge);
+ TopoDS_Face CurFace = TopoDS::Face(anExpF.Current());
+ //
+ TopExp_Explorer anExp(CurFace, TopAbs_EDGE);
+ TopTools_ListOfShape anEdgesToRemove;
+ //
+ for(; anExp.More(); anExp.Next() )
+ {
+ TopoDS_Edge CurEdge = TopoDS::Edge(anExp.Current());
+ if (CurEdge.Orientation() == TopAbs_INTERNAL)
+ anEdgesToRemove.Append(CurEdge);
+ }
+ //
+ if (!anEdgesToRemove.IsEmpty())
+ {
+ Handle_ShapeBuild_ReShape aReshape = new ShapeBuild_ReShape();
+ TopoDS_Shape OutF = aReshape->Apply(CurFace);
+ TopTools_ListIteratorOfListOfShape aIt(anEdgesToRemove);
+ for (; aIt.More(); aIt.Next())
+ aReshape->Remove(aIt.Value());
+ OutF = aReshape->Apply(CurFace);
+
+ Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
+ sfs->Init(OutF);
+ sfs->Perform();
+ OutF = sfs->Shape();
+ aF2FReplace->Add(CurFace, TopoDS::Face(OutF));
+ }
}
-
- if (!anEdgesToRemove.IsEmpty())
+ //
+ Handle_ShapeBuild_ReShape anExtReshape = new ShapeBuild_ReShape();
+ for (int i = 1; i <= aF2FReplace->Extent(); i++)
{
- Handle_ShapeBuild_ReShape aReshape = new ShapeBuild_ReShape();
- TopoDS_Shape OutSh = aReshape->Apply(InSh);
- TopTools_ListIteratorOfListOfShape aIt(anEdgesToRemove);
- for (; aIt.More(); aIt.Next())
- aReshape->Remove(aIt.Value());
- OutSh = aReshape->Apply(InSh);
-
- Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
- sfs->Init(OutSh);
- sfs->Perform();
- return sfs->Shape();
+ TopoDS_Face aFK = aF2FReplace->FindKey(i);
+ TopoDS_Face aFV = aF2FReplace->FindFromIndex(i);
+ anExtReshape->Replace(aFK, aFV);
+ ShToRebuild = anExtReshape->Apply(ShToRebuild);
}
- else
- return InSh;
+
}
void HYDROData_LandCoverMap::SetTransparency( double theTransparency )