#include <BRepLib_MakeWire.hxx>
#include <BRep_Builder.hxx>
#include <ShapeAnalysis_Wire.hxx>
+#include <BRepAlgo_NormalProjection.hxx>
Out3dPres = GetShape( DataTag_3DShape );
Out2dPres = GetShape( DataTag_2DShape );
}
-
void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& InpProfiles,
double ddz,
double step,
void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire)
{
- //its also possible to use BrepAlgo_NormalProjection here!
- BRepTools_WireExplorer ex(TopoDS::Wire(inpWire.Oriented(TopAbs_FORWARD)));
+ /*BRepTools_WireExplorer ex(TopoDS::Wire(inpWire.Oriented(TopAbs_FORWARD)));
BRepLib_MakeWire WM;
for (;ex.More();ex.Next())
{
double f, l;
Handle(Geom_Curve) C3d = BRep_Tool::Curve(CE, f, l);
Handle(Geom_Curve) ProjectedCurve = GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d, f, l), RefPlane, RefPlane->Position().Direction(), Standard_True);
- TopoDS_Edge ProjEdge = BRepLib_MakeEdge(ProjectedCurve);
- WM.Add(ProjEdge); //auto sharing between edges if vertex is coincident
- }
+ if (!ProjectedCurve.IsNull())
+ {
+ TopoDS_Edge ProjEdge = BRepLib_MakeEdge(ProjectedCurve, f, l );
+ if (!BRep_Tool::Degenerated(ProjEdge))
+ WM.Add(ProjEdge); //auto sharing between edges if vertex is coincident
+ }
+ }*/
+
+ BRep_Builder BB;
+ TopoDS_Face F;
+ BB.MakeFace(F, RefPlane, Precision::Confusion());
+ BRepLib_MakeWire WM;
+
+ BRepAlgo_NormalProjection nproj(F);
+ nproj.Add(inpWire);
+ nproj.SetDefaultParams();
+ nproj.Build();
+ if(!nproj.IsDone())
+ return;
+ TopoDS_Shape projRes = nproj.Projection();
+ TopExp_Explorer exp(projRes, TopAbs_EDGE);
+ TopTools_ListOfShape llE;
+ for (;exp.More();exp.Next())
+ llE.Append(exp.Current());
+
+ WM.Add(llE);
outWire = WM.Wire();
+
outWire.Orientation(inpWire.Orientation()); //take from the original wire
}
Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
- if ( !aBath.IsNull() )
+ if ( !aBath.IsNull() && !aBath->GetAltitudePoints().empty())
{
buildShape();
updateShape( false, false );
void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(Aspect_ColorScale)& theColorScale )
{
+ if (!myCoords)
+ return;
for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ )
{
double z = myCoords->Value( i ).Z();