#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRep_Builder.hxx>
+#include <ShapeAnalysis_Wire.hxx>
double ddz = GetDDZ();
double step = GetSpatialStep();
std::set<int> InvInd;
- CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd, -1 );
+ bool WireIntersections; //__TODO
+ CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd, -1, WireIntersections );
SetAltitudePoints( points );
SetShape( DataTag_LeftBankShape, OutLeftB);
bool Create3dPres,
bool Create2dPres,
std::set<int>& InvInd,
- int thePntsLimit )
+ int thePntsLimit,
+ bool& WireIntersections)
{
int aLower = InpProfiles.Lower(), anUpper = InpProfiles.Upper();
size_t n = anUpper - aLower + 1;
if( ddz>EPS && step>EPS )
CreateProfiles(profiles, ddz, step, left, right, points, main_profiles,
- Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd );
+ Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd, WireIntersections );
}
void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire)
}
-void HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF )
+bool HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF )
{
Handle_Geom_Plane refpl = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
BRepLib_MakeWire WM;
TopoDS_Wire outW;
ProjWireOnPlane(WM.Wire(), refpl, outW);
- BRepBuilderAPI_MakeFace mf(refpl, outW); //check inside is true by def
+ BRepBuilderAPI_MakeFace mf(refpl, outW, true); //check inside is true by def
outF = mf.Face();
+ ShapeAnalysis_Wire WA(outW, outF, Precision::Confusion());
+ bool res = WA.CheckSelfIntersection();
+ return res;
+
///!!! the internal wires cant be added with 'internal' ori.
// it's possible to do with brep builder yet the result will not be correct!
// more proper way is to use BOP operation here.
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd)
+ std::set<int>& InvInd,
+ bool& WireIntersections)
{
if (theProfiles.empty())
return;
if (Create2dPres)
{
TopoDS_Face outF;
- Get2dFaceFrom3dPres(cmp, outF);
+ WireIntersections = Get2dFaceFrom3dPres(cmp, outF); //__TODO
Out2dPres = outF;
};
}
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd );
+ std::set<int>& InvInd,
+ bool& WireIntersections);
- static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
+ static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
static int EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
double theDDZ, double theSpatialStep );
bool Create3dPres,
bool Create2dPres,
std::set<int>& InvInd,
- int thePntsLimit );
+ int thePntsLimit,
+ bool& WireIntersections);
};
thePrs.myPrs3D = newCmp;
- HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) );
+ HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) ); //__TODO
}
\ No newline at end of file
#include <QListWidget>
#include <QPushButton>
#include <QDoubleSpinBox>
+#include <QTextEdit>
HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
aParamGroup->setLayout( aParamLayout );
+ // Warnings
+ QGroupBox* aWarnGroup = new QGroupBox( tr( "STREAM_WARNINGS" ), mainFrame() );
+ myWarnText = new QTextEdit();
+ myWarnText->setReadOnly(true);
+ QBoxLayout* aWarnLayout = new QVBoxLayout();
+ aWarnLayout->addWidget( myWarnText );
+ aWarnGroup->setLayout( aWarnLayout );
+
// Common
addWidget( myObjectNameGroup );
addWidget( aParamGroup );
+ addWidget( aWarnGroup );
addStretch();
// Create selector
myProfiles->clearAllBackgroundColors();
}
+void HYDROGUI_StreamDlg::addWarning( const QString& theWarnMess )
+{
+ myWarnText->append( theWarnMess );
+}
+
+void HYDROGUI_StreamDlg::clearWarnings()
+{
+ myWarnText->clear();
+}
+
class QListWidget;
class QPushButton;
class QDoubleSpinBox;
+class QTextEdit;
class HYDROGUI_StreamDlg : public HYDROGUI_InputPanel
{
void setSpatialStep( const double );
double getSpatialStep() const;
+ void addWarning( const QString& theWarnMess );
+ void clearWarnings();
+
void setBackgroundColorForProfileList (int theInd, QColor theColor);
QColor getBackgroundColorForProfileList (int theInd) const;
void clearAllBackgroundColorsForProfileList ();
HYDROGUI_OrderedListWidget* myProfiles;
QPushButton* myRemoveButton;
QPushButton* myAddButton;
+ QTextEdit* myWarnText;
+
};
#endif
#endif
HYDROData_Bathymetry::AltitudePoints points;
+
+ bool WireIntersections = false;
HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
- OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW );
+ OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, WireIntersections );
aPanel->clearAllBackgroundColorsForProfileList();
for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
aPrsDef.myOutlet = TopoDS::Wire(OutOutlet);
aPrsDef.myLeftBank = TopoDS::Wire(OutLeftB);
aPrsDef.myRightBank = TopoDS::Wire(OutRightB);
- aPrsDef.myPrs2D = Out2dPres;
+ if (!WireIntersections)
+ aPrsDef.myPrs2D = Out2dPres;
aPrsDef.myPrs3D = Out3dPres;
+ if (WireIntersections)
+ aPanel->addWarning(tr("STREAM_SELF_INTERSECTIONS"));
+
myPreviewPrs->setShape( aPrsDef.myPrs2D );
}
<source>STREAM_PROFILES</source>
<translation>Profiles</translation>
</message>
+ <message>
+ <source>STREAM_WARNINGS</source>
+ <translation>Stream Warnings</translation>
+ </message>
+ <message>
+ <source>STREAM_SELF_INTERSECTIONS</source>
+ <translation>Warning: intersection(s) of banks/profiles are found</translation>
+ </message>
<message>
<source>PREF_TAB_GENERAL</source>
<translation>General</translation>