#include <BRepCheck_Shell.hxx>
#include <BRepCheck_ListOfStatus.hxx>
#include <TopTools_SequenceOfShape.hxx>
+#include <Handle_Geom_Curve.hxx>
+#include <Handle_Geom_Line.hxx>
+#include <Handle_Geom_TrimmedCurve.hxx>
+#include <Geom_TrimmedCurve.hxx>
#include <QFile>
QString aSType = anIt.StricklerType();
//std::cout << "from " << anIt.Face() << ": " << anIt.StricklerType() << std::endl;
TopTools_ListOfShape aModified = aBuilder.Modified( anIt.Face() );
+
+ //
+ TopTools_ListOfShape aGen = aBuilder.Generated( anIt.Face() );
+ //
if( aModified.Extent() == 0 )
aModified.Append( anIt.Face() );
return false;
}
+bool HYDROData_LandCoverMap::CheckLinear()
+{
+ TopoDS_Shape InpShape = GetShape();
+ TopExp_Explorer anEdgeEx(InpShape, TopAbs_EDGE);
+ for (; anEdgeEx.More(); anEdgeEx.Next())
+ {
+ TopoDS_Edge E = TopoDS::Edge(anEdgeEx.Current());
+ double aFP, aLP;
+ Handle_Geom_Curve aCur = BRep_Tool::Curve(E, aFP, aLP);
+ Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aCur);
+ if (aLine.IsNull())
+ {
+ Handle(Geom_TrimmedCurve) aTC = Handle(Geom_TrimmedCurve)::DownCast(aCur);
+ if (!aTC.IsNull())
+ {
+ Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aTC->BasisCurve());
+ if (aLine.IsNull())
+ return false;
+ }
+ else
+ return false;
+ }
+ }
+ return true;
+}
HYDRODATA_EXPORT TopoDS_Shape RemoveInternal(const TopoDS_Shape& InSh);
+ HYDRODATA_EXPORT bool CheckLinear();
+
protected:
void SetShape( const TopoDS_Shape& );
}
void HYDROData_ShapeFile::Export(const QString& aFileName, const Handle_HYDROData_LandCoverMap& aLCM,
- QStringList& aNonExpList, bool bUseDiscr, double theDefl)
+ QStringList& aNonExpList, bool bCheckLinear, bool bUseDiscr, double theDefl)
{
+ if (bCheckLinear && !aLCM->CheckLinear())
+ return;
+ //
SHPHandle hSHPHandle;
if ( !aLCM.IsNull() && !aLCM->IsEmpty())
{
if (theInputShape.IsNull())
return 0;
- if (!bUseDiscr && !CheckLinear(theInputShape))
- return -1;
-
if (theInputShape.ShapeType() == TopAbs_FACE)
{
ProcessFace(TopoDS::Face(theInputShape), theShpHandle, bUseDiscr, theDefl);
}
-bool HYDROData_ShapeFile::CheckLinear(const TopoDS_Shape& theInpShape)
-{
- TopExp_Explorer anEdgeEx(theInpShape, TopAbs_EDGE);
- for (; anEdgeEx.More(); anEdgeEx.Next())
- {
- TopoDS_Edge E = TopoDS::Edge(anEdgeEx.Current());
- double aFP, aLP;
- Handle_Geom_Curve aCur = BRep_Tool::Curve(E, aFP, aLP);
- Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aCur);
- if (aLine.IsNull())
- {
- Handle(Geom_TrimmedCurve) aTC = Handle(Geom_TrimmedCurve)::DownCast(aCur);
- if (!aTC.IsNull())
- {
- Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aTC->BasisCurve());
- if (aLine.IsNull())
- return false;
- }
- else
- return false;
- }
- }
- return true;
-}
\ No newline at end of file
HYDRODATA_EXPORT void Export(const QString& aFileName,
const Handle_HYDROData_LandCoverMap& aLCM,
QStringList& aNonExpList,
+ bool bCheckLinear = true,
bool bUseDiscr = false,
double theDefl = 0.1);
return;
//
- HYDROGUI_ExportLandCoverMapDlg aDlg( module()->getApp()->desktop(), anAttrNames.toList());
+ Handle_HYDROData_LandCoverMap aLCM = Handle(HYDROData_LandCoverMap)::DownCast( aSeq(1) );
+ bool IsLinear = aLCM->CheckLinear();
+ HYDROGUI_ExportLandCoverMapDlg aDlg( module()->getApp()->desktop(), IsLinear, anAttrNames.toList());
if ( aDlg.exec() == HYDROGUI_ExportLandCoverMapDlg::Accepted )
{
//In our case : aSeq.Size() == 1
//Export of multiple landcover maps into the one shp-file is disallowed.
- Handle_HYDROData_LandCoverMap aLCM = Handle(HYDROData_LandCoverMap)::DownCast( aSeq(1) );
QString aCItem = aDlg.getCurrentItem();
Handle(HYDROData_StricklerTable) aStricklerTableObj;
{
}
//export shape-data
- anExporter.Export(aFileName, aLCM, aNonExpList);
+ anExporter.Export(aFileName, aLCM, aNonExpList, false, !IsLinear, aDlg.getDeflValue());
QString aDBFFileName = aFileName.replace( ".shp", ".dbf", Qt::CaseInsensitive);
//Even if attribute-checkbox is unchecked, the .dbf-file should be removed.
//otherwise it may be used with wrong .shp-file. This is an incorrect behaivor.
#include <QCheckBox>
#include <QVBoxLayout>
#include <QComboBox>
+#include <QLabel>
+#include <QDoubleSpinBox>
-HYDROGUI_ExportLandCoverMapDlg::HYDROGUI_ExportLandCoverMapDlg( QWidget* theParent, const QStringList& theAttrItems )
+HYDROGUI_ExportLandCoverMapDlg::HYDROGUI_ExportLandCoverMapDlg( QWidget* theParent, bool IsLinear, const QStringList& theAttrItems )
: QtxDialog( theParent, false, true, QtxDialog::OKCancel )
{
setWindowTitle( tr( "EXPORT_LANDCOVERMAP" ) );
aLayout->addWidget( myAttrCheckBox, 0, 0 );
aLayout->addWidget( myAvFields, 1, 0, 1, 2 );
+ if(!IsLinear)
+ {
+ myDiscrLabel = new QLabel( tr( "LCM_DISCR_LABEL" ), mainFrame() );
+ myDeflSpinBox = new QDoubleSpinBox( mainFrame() );
+ myDeflSpinBox->setRange(0.001, 2);
+ myDeflSpinBox->setDecimals(3);
+ myDeflSpinBox->setSingleStep(0.001);
+ myDeflLabel = new QLabel ( tr( "LCM_DEFL_LABEL" ), mainFrame() );
+ aLayout->addWidget( myDiscrLabel, 2, 0 );
+ aLayout->addWidget( myDeflLabel, 3, 0, 1, 1 );
+ aLayout->addWidget( myDeflSpinBox, 3, 1, 2, 2 );
+ }
+
setMinimumSize( 300, 100 );
connect( myAttrCheckBox, SIGNAL(clicked(bool)), this, SLOT(onAttrCBChecked(bool)));
{
return myAttrCheckBox->isChecked();
}
+
+double HYDROGUI_ExportLandCoverMapDlg::getDeflValue() const
+{
+ return myDeflSpinBox->value();
+}
class QCheckBox;
class QComboBox;
+class QLabel;
+class QDoubleSpinBox;
class HYDROGUI_ExportLandCoverMapDlg : public QtxDialog
{
Q_OBJECT
public:
- HYDROGUI_ExportLandCoverMapDlg( QWidget* theParent = 0, const QStringList& theAttrItems = QStringList());
+ HYDROGUI_ExportLandCoverMapDlg( QWidget* theParent = 0, bool IsLinear = false, const QStringList& theAttrItems = QStringList());
virtual ~HYDROGUI_ExportLandCoverMapDlg();
protected slots:
public:
QString getCurrentItem() const;
bool getAttrCheckBoxState();
+ double getDeflValue() const;
private:
QCheckBox* myAttrCheckBox;
QComboBox* myAvFields;
+ QLabel* myDiscrLabel;
+ QLabel* myDeflLabel;
+ QDoubleSpinBox* myDeflSpinBox;
};
#endif
<source>WRITE_ST_AS_ATTRS_TO_DBF</source>
<translation>Write Strickler Types as attributes values to DBF file</translation>
</message>
+ <message>
+ <source>LCM_DISCR_LABEL</source>
+ <translation>Current Land Cover Map contains at least one non-linear border. It will be exported in the discretization mode</translation>
+ </message>
+ <message>
+ <source>LCM_DEFL_LABEL</source>
+ <translation>Enter a deflection value:</translation>
+ </message>
+
</context>