# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-ADD_SUBDIRECTORY(gui)
+#ADD_SUBDIRECTORY(gui)
ADD_SUBDIRECTORY(examples)
-ADD_SUBDIRECTORY(tutorial)
-ADD_SUBDIRECTORY(tui)
+#ADD_SUBDIRECTORY(tutorial)
+#ADD_SUBDIRECTORY(tui)
# Application tests
-SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/HYDRO)
INSTALL(FILES ${EXAMPLES_TESTS} ${HYDRO_SAMPLES} DESTINATION ${TEST_INSTALL_DIRECTORY})
INSTALL(FILES CTestTestfileInstall.cmake
print "Geom shape:", Case_1_geom
print "Geom shape name:", Case_1_geom.GetName()
-controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
+controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' )
controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
+controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
# --- basic properties control: edges length, surfaces
controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
-
+controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
#----------------------
# --- Meshing
#----------------------
+med_file = r'/garonne_1.med'
+
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
+
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats
SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
garonne_1.SetAutoColor( 1 )
-garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(garonne_1, 3888, 475, 7597)
-controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2342)
-controlSubMeshStats(riveGauche_1, 2871)
+controlMeshStats(garonne_1, 1763, 180, 3360)
+controlSubMeshStats(litMineur_2, 48)
+controlSubMeshStats(riveDroite_1, 1360)
+controlSubMeshStats(riveGauche_1, 1952)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomaine' )
# --- basic properties control: edges length, surfaces
+
controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
+controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
#----------------------
# --- Meshing
#----------------------
+med_file = r'/garonne_1.med'
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
+
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats
SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
garonne_1.SetAutoColor( 1 )
-garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(garonne_1, 3888, 475, 7597)
-controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2342)
-controlSubMeshStats(riveGauche_1, 2871)
+controlMeshStats(garonne_1, 1763, 180, 3360)
+controlSubMeshStats(litMineur_2, 48)
+controlSubMeshStats(riveDroite_1, 1360)
+controlSubMeshStats(riveGauche_1, 1952)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
nomCas = 'garonne_1'
# --- med file 2D(x,y) of the case produced by SMESH
-fichierMaillage = '/tmp/garonne_1.med'
+fichierMaillage = med_file
# --- dictionary [med group name] = region name
dicoGroupeRegion= dict(litMineur = 'garonne_1_litMineur',
geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' )
geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' )
-controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue, 10343.901103, 103037.738504)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue, 10340.1424233, 102887.6201)
+controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
#garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
#geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
-controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue, 10343.901103, 103037.738504)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue, 10340.1424233, 102887.6201)
+controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
#----------------------
# --- Meshing
#bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
+
+med_file = r'/garonne_2.med'
+
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
garonne_2.SetAutoColor( 1 )
-garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(garonne_2, 6190, 691, 12201)
+controlMeshStats(garonne_2, 5247, 717, 10075)
controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2400)
-controlSubMeshStats(riveGauche_1, 6585)
-controlSubMeshStats(digue_1, 832)
+controlSubMeshStats(riveDroite_1, 2348)
+controlSubMeshStats(riveGauche_1, 5343)
+controlSubMeshStats(digue_1, 0)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
#garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"])
#geompy.UnionIDs(garonne_2_digue_Right_Bank, [48])
-controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557)
-controlGeomProps(geompy, digue, 10343.901103, 103037.738504)
-controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388)
-controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615)
+controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348)
+controlGeomProps(geompy, digue, 10340.1424233, 102887.6201)
+controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981)
+controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601)
#----------------------
# --- Meshing
#bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE)
SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE)
+
+med_file = r'/garonne_2.med'
+
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
+
garonne_2.SetAutoColor( 1 )
-garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1)
+garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(garonne_2, 6190, 691, 12201)
+controlMeshStats(garonne_2, 5247, 717, 10075)
controlSubMeshStats(litMineur_2, 2384)
-controlSubMeshStats(riveDroite_1, 2400)
-controlSubMeshStats(riveGauche_1, 6585)
-controlSubMeshStats(digue_1, 832)
+controlSubMeshStats(riveDroite_1, 2348)
+controlSubMeshStats(riveGauche_1, 5343)
+controlSubMeshStats(digue_1, 0)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
nomCas = 'garonne_2'
# --- med file 2D(x,y) of the case produced by SMESH
-fichierMaillage = '/tmp/garonne_2.med'
+fichierMaillage = med_file
# --- dictionary [med group name] = region name
dicoGroupeRegion= dict(litMineur = 'garonne_2_litMineur',
geompy.addToStudyInFather( HYDRO_casGaronne_1, piles, 'piles' )
# --- basic properties control: edges length, surfaces
-controlGeomProps(geompy, riveGauche, 29149.1353799, 35949580.6716)
-controlGeomProps(geompy, litMineur_aval, 7965.23431497, 935955.786347)
-controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.016847)
-controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2531409.65041)
-controlGeomProps(geompy, riveDroite, 32012.2241814, 25998085.6892)
+controlGeomProps(geompy, riveGauche, 29149.1353799, 35950762.8967)
+controlGeomProps(geompy, litMineur_aval, 7965.23431497, 938890.904721)
+controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.0787789)
+controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2548509.17447)
+controlGeomProps(geompy, riveDroite, 32012.2241814, 26188706.2202)
###
### SMESH component
smesh.SetName(nbseg_litMineur_amont, 'nbseg_litMineur_amont')
smesh.SetName(sections_1, 'sections')
+med_file = r'/casGaronne_1.med'
+
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
+
casGaronne_1.SetAutoColor( 1 )
-casGaronne_1.ExportMED( r'/tmp/casGaronne_1.med', 0, SMESH.MED_V2_2, 1, None ,1)
+casGaronne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
-controlMeshStats(casGaronne_1, 6985, 745, 13761)
-controlSubMeshStats(litMineur_pont_2, 185)
+controlMeshStats(casGaronne_1, 7040, 746, 13871)
+controlSubMeshStats(litMineur_pont_2, 204)
controlSubMeshStats(litMineur_amont_2, 3000)
controlSubMeshStats(litMineur_aval_2, 2000)
-controlSubMeshStats(riveDroite_1, 3941)
-controlSubMeshStats(riveGauche_1, 4635)
+controlSubMeshStats(riveDroite_1, 4040)
+controlSubMeshStats(riveGauche_1, 4627)
if salome.sg.hasDesktop():
domaine_1 = relief.GroupOnGeom(domaine,'domaine',SMESH.FACE)
domaine_2 = relief.GroupOnGeom(domaine,'domaine',SMESH.NODE)
smesh.SetName(relief, 'relief')
+
+med_file = r'/relief.med'
+
+try:
+ os.remove(med_file)
+except OSError:
+ pass
+
+
try:
- relief.ExportMED( r'/tmp/relief.med', 0, SMESH.MED_V2_2, 1, None ,1)
+ relief.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1)
except:
print 'ExportToMEDX() failed. Invalid file name?'
nomCas = 'etude'
# --- fichier med 2D(x,y) du cas, produit par SMESH
-fichierMaillage = '/tmp/relief.med'
+fichierMaillage = med_file
# --- dictionnaire: (clé = nom de groupe med, valeur= nom de région)
dicoGroupeRegion= dict(domaine = 'etude_Reg_1',
std::map<int, vtkPolyData*> HYDROData_Bathymetry::myDelaunay2D;
#endif
+inline double sqr( double x )
+{
+ return x*x;
+}
+
+HYDROData_Bathymetry::AltitudePoint::AltitudePoint( double x, double y, double z )
+{
+ X=x; Y=y; Z=z;
+}
+
+double HYDROData_Bathymetry::AltitudePoint::SquareDistance( const HYDROData_Bathymetry::AltitudePoint& p ) const
+{
+ double d = 0;
+ d += sqr( X - p.X );
+ d += sqr( Y - p.Y );
+ d += sqr( Z - p.Z );
+ return d;
+}
HYDROData_Bathymetry::HYDROData_Bathymetry()
: HYDROData_IAltitudeObject()
// if (myQuadtree->isEmpty() )
if (myQuadtrees.find(labkey) == myQuadtrees.end())
{
- DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
+ //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.);
myQuadtrees[labkey] = aQuadtree;
TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
index++;
aListOfNodes->push_back(aPoint);
}
- DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute");
+ //DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute");
aQuadtree->setNodesAndCompute(aListOfNodes);
return aQuadtree;
}
//DEBTRACE("GetVtkDelaunay2D this labkey altkey "<<this<<" "<<labkey<<" "<<altkey);
if (myDelaunay2D.find(labkey) == myDelaunay2D.end())
{
- DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
+ //DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
if (aLabel.IsNull())
}
vtkPolyData* profile = vtkPolyData::New();
profile->SetPoints(points);
- DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
+ //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New();
delaunay2D->SetInputData(profile);
int nbPts = triangle->GetNumberOfIds();
if (nbPts != 3)
{
- DEBTRACE("not a triangle ?");
+ //DEBTRACE("not a triangle ?");
return false;
}
vtkIdType s[3];
double det = (v[1][1]-v[2][1])*(v[0][0]-v[2][0]) + (v[2][0]-v[1][0])*(v[0][1]-v[2][1]);
if (det == 0)
{
- DEBTRACE("flat triangle ?");
+ //DEBTRACE("flat triangle ?");
return false;
}
double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const
{
- DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
+ //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
double anInvalidAltitude = GetInvalidAltitude();
double aResAltitude = anInvalidAltitude;
HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes();
if (!aQuadtree)
{
- DEBTRACE(" no Quadtree");
+ //DEBTRACE(" no Quadtree");
return aResAltitude;
}
while (dist2nodes.size() == 0)
{
aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
- DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+ //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
}
std::map<double, const gpi_XYZ*>::const_iterator it = dist2nodes.begin();
aResAltitude = it->second->Z();
int nodeIndex = it->second->getIndex();
- DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
+ //DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
// --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud)
// interpolation is required.
points->Allocate(64);
aDelaunay2D->GetPointCells(nodeIndex, cells);
vtkIdType nbCells = cells->GetNumberOfIds();
- DEBTRACE(" triangles on nearest point: " << nbCells);
+ //DEBTRACE(" triangles on nearest point: " << nbCells);
bool isInside = false;
for (int i=0; i<nbCells; i++)
{
if (isInside)
{
aResAltitude = z;
- DEBTRACE(" interpolated z: " << z);
+ //DEBTRACE(" interpolated z: " << z);
break;
}
}
- if (!isInside) DEBTRACE(" point outside triangles, nearest z kept");
+ if (!isInside)
+ {
+ // DEBTRACE(" point outside triangles, nearest z kept");
+ }
}
#endif
return aResAltitude;
class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
{
public:
- struct AltitudePoint
+ struct HYDRODATA_EXPORT AltitudePoint
{
- AltitudePoint( double x=0, double y=0, double z=0 ) { X=x; Y=y; Z=z; }
+ AltitudePoint( double x=0, double y=0, double z=0 );
double X;
double Y;
double Z;
+
+ double SquareDistance( const AltitudePoint& ) const;
};
typedef std::vector<AltitudePoint> AltitudePoints;
SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId );
QString aGeomObjEntry, anErrorMsg;
- bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg );
+ QString statMess;
+ bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg, statMess );
return isOK ? aGeomObjEntry : QString();
#endif
}
bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
SALOMEDS::Study_ptr theStudy,
QString& theGeomObjEntry,
- QString& theErrorMsg ) const
+ QString& theErrorMsg,
+ QString& statMess) const
{
HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs;
if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() )
{
QString aTelemacFileName = GetName() + ".telemac";
- aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable() );
+ aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable(), statMess );
+ if (!aRes)
+ theErrorMsg = QString( "The export to TELEMAC %1 failed" ).arg( aTelemacFileName );
}
return aRes;
}
AddReferenceObject( theInterPolyline, aDataTag );
+ Changed( Geom_2d );
+
return true;
}
HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
SALOMEDS::Study_ptr theStudy,
QString& theGeomObjEntry,
- QString& theErrorMsg ) const;
+ QString& theErrorMsg,
+ QString& statMess) const;
#endif
public:
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRep_Builder.hxx>
+#include <ShapeAnalysis_Wire.hxx>
+#include <BRepAlgo_NormalProjection.hxx>
IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry )
-
-HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir )
- : myXcurv( theXCurv ), myProfileDir( theProfileDir )
+HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ )
+ : myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ )
{
}
return myProfileDir;
}
+double HYDROData_DTM::CurveUZ::DeltaZ() const
+{
+ return myDeltaZ;
+}
+
HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) const
{
- HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir() );
- size_t n = size();
+ HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir(), DeltaZ() + c.DeltaZ() );
+ size_t n = size(), n1 = c.size();
+ if( n!=n1 )
+ {
+ std::cout << "Warning: different number of points in curves: " << n << ", " << n1 << std::endl;
+ }
res.reserve( n );
for( int i=0; i<n; i++ )
{
HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator * ( double d ) const
{
- HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d );
+ HYDROData_DTM::CurveUZ res( Xcurv()*d, ProfileDir()*d, DeltaZ()*d );
size_t n = size();
res.reserve( n );
for( int i=0; i<n; i++ )
void HYDROData_DTM::SetProfiles( const HYDROData_SequenceOfObjects& theProfiles )
{
SetReferenceObjects( theProfiles, DataTag_Profiles );
+ Changed( Geom_3d );
}
double HYDROData_DTM::GetDDZ() const
void HYDROData_DTM::SetDDZ( double theDDZ )
{
SetDouble( DataTag_DDZ, theDDZ );
+ Changed( Geom_3d );
}
double HYDROData_DTM::GetSpatialStep() const
void HYDROData_DTM::SetSpatialStep( double theSpatialStep )
{
SetDouble( DataTag_SpatialStep, theSpatialStep );
+ Changed( Geom_3d );
}
void HYDROData_DTM::PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W )
double ddz = GetDDZ();
double step = GetSpatialStep();
std::set<int> InvInd;
- CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd );
+ 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);
Out3dPres = GetShape( DataTag_3DShape );
Out2dPres = GetShape( DataTag_2DShape );
}
-
void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& InpProfiles,
double ddz,
double step,
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd)
+ std::set<int>& InvInd,
+ int thePntsLimit,
+ bool& WireIntersections)
{
-
int aLower = InpProfiles.Lower(), anUpper = InpProfiles.Upper();
size_t n = anUpper - aLower + 1;
AltitudePoints right;
std::vector<AltitudePoints> main_profiles;
+ if( thePntsLimit > 0 )
+ {
+ int aNbPoints = EstimateNbPoints( profiles, ddz, step );
+ if( aNbPoints < 0 || aNbPoints > thePntsLimit )
+ return;
+ }
+
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)
{
- //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
}
-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;
};
}
GetProperties( theProfile, aLowest, theDir, false, zmin, zmax );
gp_Ax3 aStd3d( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( 1, 0, 0 ) );
- gp_Ax3 aLocal( aLowest, gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
+ gp_Ax3 aLocal( gp_Pnt( aLowest.X(), aLowest.Y(), 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
gp_Trsf aTransf;
aTransf.SetTransformation( aStd3d, aLocal );
}
-bool CalcMidWidth( const std::vector<gp_Pnt2d>& intersections, double& theMid, double& theWid )
+bool CalcMidWidth( const std::set<double>& intersections, double& theMid, double& theWid )
{
double umin = std::numeric_limits<double>::max(),
umax = -umin;
size_t n = intersections.size();
- if( n <= 1 )
+ if( n <= 0 )
return false;
- for( size_t i = 0; i < n; i++ )
+ std::set<double>::const_iterator it = intersections.begin(), last = intersections.end();
+ for( ; it!=last; it++ )
{
- double u = intersections[i].X();
+ double u = *it;
if( u<umin )
umin = u;
if( u>umax )
curves.push_back( aT2 );
int psize = ( int )( ( theMaxZ-theMinZ ) / theDDZ + 1 );
- theMidPointCurve = CurveUZ( theXCurv, aProfileDir );
+ theMidPointCurve = CurveUZ( theXCurv, aProfileDir, theMinZ );
theMidPointCurve.reserve( psize );
- theWidthCurve = CurveUZ( theXCurv, aProfileDir );
+ theWidthCurve = CurveUZ( theXCurv, aProfileDir, theMinZ );
theWidthCurve.reserve( psize );
n = curves.size();
// for each discrete value of z we search intersection with profile
- for( double z = theMinZ; z <= theMaxZ; z += theDDZ )
+ for( double z1 = theMinZ; z1 <= theMaxZ; z1 += theDDZ )
{
- Handle(Geom2d_Line) aLine = new Geom2d_Line( gp_Pnt2d( 0, z ), gp_Dir2d( 1, 0 ) );
- std::vector<gp_Pnt2d> intersections;
+ Handle(Geom2d_Line) aLine = new Geom2d_Line( gp_Pnt2d( 0, z1 ), gp_Dir2d( 1, 0 ) );
+ std::set<double> intersections;
for( size_t i = 0; i < n; i++ )
{
Handle_Geom2d_Curve aCurve = curves[i];
Geom2dAPI_InterCurveCurve anIntersect( aCurve, aLine, theTolerance );
for( int k=1, m=anIntersect.NbPoints(); k<=m; k++ )
- intersections.push_back( anIntersect.Point( k ) );
+ intersections.insert( anIntersect.Point( k ).X() );
}
intersection_nb = intersections.size();
- if( intersection_nb >= 2 )
+ if( intersection_nb >= 1 )
{
double u_mid, u_wid;
if( !CalcMidWidth( intersections, u_mid, u_wid ) )
continue;
+ double z = z1 - theMinZ;
PointUZ p_mid;
p_mid.U = u_mid;
p_mid.Z = z;
#include <BRepLib_MakeEdge2d.hxx>
void HYDROData_DTM::CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
- AltitudePoints& thePoints, double dz )
+ AltitudePoints& thePoints )
{
Geom2dAdaptor_Curve anAdaptor( theHydraulicAxis );
TopoDS_Edge E2d = BRepLib_MakeEdge2d(theHydraulicAxis).Edge();
gp_Pnt2d point;
anAdaptor.D0( aParam, point );
gp_Vec2d profile_dir = theMidCurve.ProfileDir();
- gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz );
+ //gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz );
profile_dir.Normalize();
size_t n = theMidCurve.size();
gp_Pnt2d p1 = point.Translated( param1 * profile_dir);
gp_Pnt2d p2 = point.Translated( param2 * profile_dir);
- double z = theMidCurve[i].Z;
+ double z = theMidCurve[i].Z + theMidCurve.DeltaZ();
AltitudePoint p3d_1( p1.X(), p1.Y(), z ), p3d_2( p2.X(), p2.Y(), z );
}
thePoints.reserve( sorted_points.size() );
+ const double EPS = 1E-12;
std::map<double, AltitudePoint>::const_iterator it = sorted_points.begin(), last = sorted_points.end();
for( ; it!=last; it++ )
- thePoints.push_back( it->second );
+ if( thePoints.empty() || thePoints.back().SquareDistance( it->second ) > EPS )
+ thePoints.push_back( it->second );
}
inline double max( double a, double b )
return b;
}
+inline double min( double a, double b )
+{
+ if( a<b )
+ return a;
+ else
+ return b;
+}
+
#include <BRepLib_MakeWire.hxx>
std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
GetProperties( theProfileA, lowestA, dirA, false, zminA, zmaxA );
GetProperties( theProfileB, lowestB, dirB, false, zminB, zmaxB );
- double dz = zminB - zminA;
+
+ double hmax = max( zmaxA-zminA, zmaxB-zminB );
- double zmin = max( zminA, zminB );
- double zmax = max( zmaxA, zmaxB );
+ //double dz = zminB - zminA;
+ //double zmin = min( zminA, zminB );
+ //double zmax = max( zmaxA, zmaxB );
- CurveUZ midA(0, gp_Vec2d()), midB(0, gp_Vec2d());
- CurveUZ widA(0, gp_Vec2d()), widB(0, gp_Vec2d());
+ CurveUZ midA(0, gp_Vec2d(), 0), midB(0, gp_Vec2d(), 0);
+ CurveUZ widA(0, gp_Vec2d(), 0), widB(0, gp_Vec2d(), 0);
- ProfileDiscretization( theProfileA, theXCurvA, zmin, zmax, theDDZ, midA, widA, inter_nb_1 );
- ProfileDiscretization( theProfileB, theXCurvB, zmin, zmax, theDDZ, midB, widB, inter_nb_2 );
+ ProfileDiscretization( theProfileA, theXCurvA, zminA, zminA+hmax, theDDZ, midA, widA, inter_nb_1 );
+ ProfileDiscretization( theProfileB, theXCurvB, zminB, zminB+hmax, theDDZ, midB, widB, inter_nb_2 );
std::vector<CurveUZ> mid, wid;
Interpolate( midA, midB, theNbSteps, mid, isAddSecond );
for( size_t i=0; i<p; i++ )
{
points[i].reserve( q );
- CurveTo3D( theHydraulicAxis, mid[i], wid[i], points[i], dz );
+ CurveTo3D( theHydraulicAxis, mid[i], wid[i], points[i] );
}
return points;
theProfiles[i+1], distances[i+1], theDDZ, aNbSteps, isAddSecond, inter_nb_1, inter_nb_2 );
int lps = local_points.size();
- if (inter_nb_1 >= 2)
+ if (inter_nb_1 > 2)
invalInd.insert(i);
- if (inter_nb_2 >= 2)
+ if (inter_nb_2 > 2)
invalInd.insert(i+1);
// 2. Put all points into the global container
}
return points;
}
+
+int HYDROData_DTM::EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
+ double theDDZ, double theSpatialStep )
+{
+ size_t n = theProfiles.size();
+ if( n<=1 )
+ return 0;
+ if( theDDZ<1E-6 || theSpatialStep<1E-6 )
+ return 1 << 20;
+
+ std::vector<double> distances;
+ Handle_Geom2d_BSplineCurve aHydraulicAxis = CreateHydraulicAxis( theProfiles, distances );
+ if( aHydraulicAxis.IsNull() )
+ return 0;
+
+ double aCompleteDistance = distances[n-1];
+ int aNbSteps = int( aCompleteDistance / theSpatialStep ) + 1;
+ gp_Pnt aLowest;
+ gp_Vec2d aDir;
+ double aZMin, aZMax;
+ GetProperties( theProfiles[0], aLowest, aDir, true, aZMin, aZMax );
+ int aNbZSteps = (aZMax-aZMin)/theDDZ;
+
+ if( aNbSteps > ( 1<<16 ) || aNbZSteps > ( 1<<16 ) )
+ return 1 << 20;
+
+ return aNbSteps * aNbZSteps;
+}
class CurveUZ : public std::vector<PointUZ>
{
public:
- CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir = gp_Vec2d() );
+ CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ );
~CurveUZ();
double Xcurv() const;
- gp_Vec2d ProfileDir() const;
+ gp_Vec2d ProfileDir() const;
+ double DeltaZ() const;
CurveUZ operator + ( const CurveUZ& ) const;
CurveUZ operator * ( double ) const;
private:
double myXcurv;
gp_Vec2d myProfileDir;
+ double myDeltaZ;
};
protected:
static void CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
- AltitudePoints& thePoints, double dz );
+ AltitudePoints& thePoints );
static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB,
int theNbSteps, std::vector<CurveUZ>& theInterpolation,
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd );
+ std::set<int>& InvInd,
+ bool& WireIntersections);
+
+ static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
+
+ static int EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
+ double theDDZ, double theSpatialStep );
- static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
-
void GetPresentationShapes( TopoDS_Shape& Out3dPres,
TopoDS_Shape& Out2dPres,
TopoDS_Shape& OutLeftB,
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd );
+ std::set<int>& InvInd,
+ int thePntsLimit,
+ bool& WireIntersections);
};
{
// Try to open the file
QFile aFile( thePyScriptPath );
- if ( !aFile.open( QIODevice::WriteOnly ) )
+ if ( !aFile.open( QIODevice::WriteOnly | QFile::Text ) )
return false;
MapOfTreatedObjects aTreatedObjects;
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <NCollection_DoubleMap.hxx>
#include <HYDROData_LCM_FaceClassifier.h>
+#include <QDir>
#include <stdexcept>
*/
bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName,
double theDeflection,
- const Handle(HYDROData_StricklerTable)& theTable ) const
+ const Handle(HYDROData_StricklerTable)& theTable,
+ QString& statMessage) const
{
TopoDS_Shape aLandCoverMapShape = GetShape();
TopTools_ListOfShape aListOfFaces;
QFile aFile( theFileName );
if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
- return false;
+ {
+ QString homeFilePath = QDir::home().absoluteFilePath( theFileName );
+ aFile.setFileName(homeFilePath);
+ if (aFile.open( QFile::WriteOnly | QFile::Text ) )
+ statMessage = "Telemac file have been exported to the home directory: " + homeFilePath;
+ else
+ return false;
+ }
+ else
+ {
+ QString absFilePath = QDir::current().absoluteFilePath( theFileName );
+ statMessage = "Telemac file have been exported to the current directory: " + absFilePath;
+ }
QTextStream aStream( &aFile );
aStream << "# nodes\n";
HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName,
double theDeflection,
- const Handle_HYDROData_StricklerTable& theTable ) const;
+ const Handle_HYDROData_StricklerTable& theTable,
+ QString& statMessage) const;
HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
const double minBoxSize) :
HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25)
{
- DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
+ //DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
if (myNodes)
{
- DEBTRACE(" --- start compute");
+ //DEBTRACE(" --- start compute");
compute();
- DEBTRACE(" --- end compute");
+ //DEBTRACE(" --- end compute");
}
}
myNodes = theNodes;
if (myNodes)
{
- DEBTRACE(" --- start compute");
+ //DEBTRACE(" --- start compute");
compute();
- DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
- DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y());
- DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y());
+ //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
+ //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y());
+ //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y());
}
}
Handle_HYDROData_DTM dtm = DTM();
dtm->Update();
UpdatePrs( dtm );
+
+ HYDROData_NaturalObject::Update();
}
bool HYDROData_Stream::IsHas2dPrs() const
void HYDROData_Stream::SetDDZ( double theDDZ )
{
DTM()->SetDDZ( theDDZ );
+ Changed( Geom_3d );
}
double HYDROData_Stream::GetSpatialStep() const
void HYDROData_Stream::SetSpatialStep( double theSpatialStep )
{
DTM()->SetSpatialStep( theSpatialStep );
+ Changed( Geom_3d );
}
bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
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
return;
QTextStream anOutStream( &theFile );
- anOutStream << aWriteStr << theSep << theSep;
+ anOutStream << aWriteStr.toUtf8() << theSep << theSep;
}
QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
aPanel->setBoundary( aPolylineName );
}
- aSeq = myEditedObject->GetGeometryObjects();
+ aSeq = myEditedObject->GetGeometryObjects();
+ HYDROData_SequenceOfObjects anInterPolyList = myEditedObject->GetInterPolyObjects();
+ aSeq.Append(anInterPolyList);
+
getNamesAndEntries( aSeq, aList, anEntryList );
aPanel->includeGeomObjects( aList );
bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
QString& theErrorMsg,
- QStringList& theBrowseObjectsEntries )
+ QStringList& theBrowseObjectsEntries)
{
// Get the selected calculation case
Handle(HYDROData_CalculationCase) aCalculation =
dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
// Export
+ myStatMess.clear();
QString anErrorMsg;
if ( aStudy ) {
SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() );
GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen();
QString anEntry;
- if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg ) ) {
+ if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg, myStatMess ) ) {
theUpdateFlags = UF_ObjBrowser;
isOk = true;
}
// Show message box
SUIT_MessageBox::information( module()->getApp()->desktop(),
tr( "EXPORT_STATUS" ),
- tr( "EXPORT_FINISHED") );
+ tr( "EXPORT_FINISHED") + "\n" + getStatMess() );
}
else {
abort();
anErrorMsg );
}
}
+
+QString HYDROGUI_ExportCalculationOp::getStatMess()
+{
+ return myStatMess;
+}
virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
QStringList& theBrowseObjectsEntries );
virtual void onApply();
+
+ QString getStatMess();
+
+ QString myStatMess;
};
#endif
\ No newline at end of file
aPrs->Clear();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs );
+ if( myImage.IsNull() )
+ return;
+
if ( aMode == 0 )
{
Handle(Graphic3d_ArrayOfPolylines) aSegments = new Graphic3d_ArrayOfPolylines( 5 );
{
commitDocOperation();
commit();
- module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+ module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init | UF_OCCViewer );
}
else
abort();
setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis );
- update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
+ update( UF_OCCViewer | UF_VTKViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
}
Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const
Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth );
TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
+ Bnd_Box BB;
+ BRepBndLib::AddClose(myshape, BB);
+ double xmin, xmax, ymin, ymax, zmin, zmax;
+ double devCoeff = 0.1;
+ if (!BB.IsVoid())
+ {
+ BB.Get(xmin, ymin, zmin, xmax, ymax, zmax); //ignore Z coord
+ double minSide = Min(Abs(xmax - xmin), Abs(ymax - ymin));
+ devCoeff = minSide > 50 ? 0.1 : minSide / 500;
+ }
for ( ; Exp1.More(); Exp1.Next() )
{
TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
- Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
+ Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, devCoeff );
if( !anArray.IsNull() )
{
aGroup->SetPrimitivesAspect( anAspect );
gp_Pnt aPnt1 = C->Value (aMaxRatioStep);
gp_Vec aDir;
- if (!UseD1) {
+ if (!UseD1)
+ {
GCPnts_AbscissaPoint aAbsPoint(aAdC, -aArrLen, aMaxRatioStep);
double aParam = aAbsPoint.Parameter();
gp_Pnt aPnt2 = C->Value (aParam);
D.Subtract (aPnt2.XYZ());
aDir = D;
}
- else
+
+ if (UseD1 || aDir.IsEqual (gp_Vec(0,0,0), Precision::Confusion(), Precision::Angular()))
C->D1(aMaxRatioStep, aPnt1, aDir);
if ( anEdge.Orientation() == TopAbs_REVERSED )
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();
#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
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
#include <QColor>
+#include <QApplication>
+
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewModel.h>
// Hydraulic axis
Handle(HYDROData_PolylineXY) aHydraulicAxis = myEditedObject->GetHydraulicAxis();
+
+ TopoDS_Face aPlane;
+ HYDROData_Stream::BuildRefFace( aPlane ) ;
if ( !aHydraulicAxis.IsNull() )
- {
myHydAxis = aHydraulicAxis->GetName();
- TopoDS_Face aPlane;
- HYDROData_Stream::BuildRefFace( aPlane ) ;
-
- // Stream profiles
- HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles();
- for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
- {
- Handle(HYDROData_Profile) aProfile =
- Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
- if ( aProfile.IsNull() )
- continue;
+ // Stream profiles
+ HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles();
+ for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
+ {
+ Handle(HYDROData_Profile) aProfile =
+ Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
+ if ( aProfile.IsNull() )
+ continue;
- QString aProfileName = aProfile->GetName();
+ QString aProfileName = aProfile->GetName();
+ myProfiles << aProfileName;
+ if (!aHydraulicAxis.IsNull())
+ {
Standard_Real aProfilePar = 0.0;
HYDROData_Stream::HasIntersection( aHydraulicAxis, aProfile, aPlane, aProfilePar );
-
- myProfiles << aProfileName;
myProfileParams << aProfilePar;
-
}
- }
+
+ }
+
}
}
return aPanel;
}
+void HYDROGUI_StreamOp::apply()
+{
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ startDocOperation();
+
+ int anUpdateFlags = 0;
+ QString anErrorMsg;
+
+ bool aResult = false;
+ QStringList aBrowseObjectsEntries;
+
+ try
+ {
+ aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
+ }
+ catch ( Standard_Failure )
+ {
+ Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
+ anErrorMsg = aFailure->GetMessageString();
+ aResult = false;
+ }
+ catch ( ... )
+ {
+ aResult = false;
+ }
+
+ QApplication::restoreOverrideCursor();
+
+ if ( aResult )
+ {
+ module()->update( anUpdateFlags );
+ commitDocOperation();
+ commit();
+ browseObjects( aBrowseObjectsEntries );
+ }
+ else
+ {
+ myEditedObject->Remove();
+ module()->setObjectRemoved( myEditedObject );
+
+ if ( isToAbortOnApply() )
+ abortDocOperation();
+
+ abort();
+ SUIT_MessageBox::critical( module()->getApp()->desktop(),
+ tr( "CREATE_STREAM_ERROR" ),
+ anErrorMsg );
+
+ }
+}
+
bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
QString& theErrorMsg,
QStringList& theBrowseObjectsEntries )
double ss = aPanel->getSpatialStep();
std::set<int> InvInd;
-
+
+#ifdef _DEBUG
+ const int MAX_POINTS_IN_PREVIEW = 50000;
+#else
+ const int MAX_POINTS_IN_PREVIEW = 500000;
+#endif
+
HYDROData_Bathymetry::AltitudePoints points;
+
+ bool WireIntersections = false;
HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
- OutInlet, OutOutlet, true, true, InvInd);
+ 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 );
}
virtual bool isToAbortOnApply() const { return false; }
+ virtual void apply();
+
private slots:
void onAddProfiles();
void onRemoveProfiles( const QStringList& );
double aZ;
int anInvalidZ = InvalidZValue();
- for (int i = 1; i <= aNbPoints; i++ )
+ for (int i = 0; i < aNbPoints; i++ )
{
anAltPnt = anAltPoints[i];
aZ = anAltPnt.Z;
<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>
<context>
<name>HYDROGUI_StreamOp</name>
<message>
+ <source>CREATE_STREAM_ERROR</source>
+ <translation>Stream creation error</translation>
+ </message>
+ <message>
<source>CREATE_STREAM</source>
<translation>Create stream</translation>
</message>
if ( !aRef.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef ):
- sipCpp->ExportTelemac( *a0, a1, aRef );
+ QString messStat;
+ sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef, messStat ):
+ sipCpp->ExportTelemac( *a0, a1, aRef, messStat );
Py_END_ALLOW_THREADS
}
%End
#include <GeomAPI_Interpolate.hxx>
#include <gp_Circ.hxx>
-TopoDS_Edge Edge( const QList<double>& theXYList, bool isClosed )
+TopoDS_Edge Edge2d( const QList<double>& theXYList, bool isClosed )
{
int n = theXYList.size()/2;
Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
return TopoDS_Edge();
}
-TopoDS_Wire Wire( const QList<double>& theXYList, bool isClosed )
+TopoDS_Wire Wire2d( const QList<double>& theXYList, bool isClosed )
{
- return BRepBuilderAPI_MakeWire( Edge( theXYList, isClosed ) ).Wire();
+ return BRepBuilderAPI_MakeWire( Edge2d( theXYList, isClosed ) ).Wire();
}
-TopoDS_Face Face( const QList<double>& theXYList )
+TopoDS_Edge Edge3d( const QList<double>& theXYZList, bool isClosed )
{
- return BRepBuilderAPI_MakeFace( Wire( theXYList, true ), Standard_True ).Face();
+ int n = theXYZList.size()/3;
+ Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
+ for( int i=1; i<=n; i++ )
+ {
+ double x = theXYZList[3*i-3];
+ double y = theXYZList[3*i-2];
+ double z = theXYZList[3*i-1];
+ gp_Pnt aPnt( x, y, z );
+ aPointsArray->SetValue( i, aPnt );
+ }
+ GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 );
+ anInterpolator.Perform();
+ bool aResult = anInterpolator.IsDone() == Standard_True;
+ if( aResult )
+ {
+ Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve();
+ return BRepBuilderAPI_MakeEdge( aCurve ).Edge();
+ }
+ else
+ return TopoDS_Edge();
+}
+
+TopoDS_Wire Wire3d( const QList<double>& theXYZList, bool isClosed )
+{
+ return BRepBuilderAPI_MakeWire( Edge3d( theXYZList, isClosed ) ).Wire();
+}
+
+TopoDS_Face Face2d( const QList<double>& theXYList )
+{
+ return BRepBuilderAPI_MakeFace( Wire2d( theXYList, true ), Standard_True ).Face();
+}
+
+TopoDS_Face Face3d( const QList<double>& theXYZList )
+{
+ return BRepBuilderAPI_MakeFace( Wire3d( theXYZList, true ), Standard_True ).Face();
}
TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius )
class TopoDS_Face;
class gp_Pnt;
-TopoDS_Edge Edge( const QList<double>& theXYList, bool isClosed = false );
-TopoDS_Wire Wire( const QList<double>& theXYList, bool isClosed = false );
+TopoDS_Edge Edge2d( const QList<double>& theXYList, bool isClosed = false );
+TopoDS_Wire Wire2d( const QList<double>& theXYList, bool isClosed = false );
+
+TopoDS_Edge Edge3d( const QList<double>& theXYZList, bool isClosed = false );
+TopoDS_Wire Wire3d( const QList<double>& theXYZList, bool isClosed = false );
+
+
TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius );
-TopoDS_Face Face( const QList<double>& theXYList );
+TopoDS_Face Face2d( const QList<double>& theXYList );
+TopoDS_Face Face3d( const QList<double>& theXYZList );
-from HYDROPy import *
+from HYDROPy import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
aTestPoint = gp_XY( 0.5, 0.5 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.7127, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
aTestPoint = gp_XY( 1.5, 1 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
aTestPoint = gp_XY( 1.5, 0.7 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.4116, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
aTestPoint = gp_XY( 1.5, -0.7 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.0479, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.271267, anAltitude, EPS );
aTestPoint = gp_XY( 2, 3.5 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.2525, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.9454, anAltitude, EPS );
aDoc->Close();
}
aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
aProfile->SetRightPoint( gp_XY( 20, 20 ) );
- HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
+ HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
int dummy = 0;
HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
aProfile->SetLeftPoint( gp_XY( 10, 10 ) );
aProfile->SetRightPoint( gp_XY( 20, 20 ) );
- HYDROData_DTM::CurveUZ aMid( 0.0 ), aWid( 0.0 );
+ HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 );
int dummy = 0 ;
HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy );
CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() );
void test_HYDROData_DTM::test_curves_interpolation()
{
- HYDROData_DTM::CurveUZ A(1.0), B(2.0);
+ HYDROData_DTM::CurveUZ A(1.0, gp_Vec2d(), 0), B(2.0, gp_Vec2d(), 0);
A.push_back( HYDROData_DTM::PointUZ( 0, 0 ) );
A.push_back( HYDROData_DTM::PointUZ( 1, 1 ) );
A.push_back( HYDROData_DTM::PointUZ( 2, 2 ) );
Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances );
HYDROData_DTM::AltitudePoints points;
- HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10) );
+ HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0 );
mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) );
mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) );
- HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10) );
+ HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0 );
wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) );
wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) );
- HYDROData_DTM::CurveTo3D( HA, mid, wid, points, 0.0 );
+ HYDROData_DTM::CurveTo3D( HA, mid, wid, points );
CPPUNIT_ASSERT_EQUAL( 4, (int)points.size() );
CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 16.380, -2.186, 6.0 ), points[0] );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS );
DTM->Update();
- CPPUNIT_ASSERT_EQUAL( 275690, (int)DTM->GetAltitudePoints().size() );
+ CPPUNIT_ASSERT_EQUAL( 282338, (int)DTM->GetAltitudePoints().size() );
Handle_AIS_InteractiveContext aContext = TestViewer::context();
HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
//DEBTRACE("--- ajout test1 " << aLC1);
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
- TopoDS_Face aLC2 = Face( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 );
//DEBTRACE("--- ajout test2 " << aLC2);
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ TopoDS_Face aLC = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
Handle(HYDROData_PolylineXY) aPolyline =
Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
- TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
+ TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false );
aPolyline->SetShape( aWire );
CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ TopoDS_Face aLC = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
Handle(HYDROData_PolylineXY) aPolyline =
Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
- TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
+ TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10, false );
aPolyline->SetShape( aWire );
CPPUNIT_ASSERT_EQUAL( false, aMap->Split( aPolyline ) );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
// aST.size() == aDBFV.size()!!
Handle(HYDROData_PolylineXY) aPolyline =
Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
- TopoDS_Wire aWire = Wire( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
+ TopoDS_Wire aWire = Wire2d( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 );
aPolyline->SetShape( aWire );
for (int i = 0; i < 3; i++)
aMap->Add(aPolyline, "");
- TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
Handle(HYDROData_LandCoverMap) aMap =
Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) );
Handle(HYDROData_LandCoverMap) aMap =
Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) );
CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
Handle(HYDROData_LandCoverMap) aMap =
Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
- aMap->LocalPartition( Face( QList<double>() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
- aMap->LocalPartition( Face( QList<double>() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
+ aMap->LocalPartition( Face2d( QList<double>() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
+ aMap->LocalPartition( Face2d( QList<double>() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute"));
aMap->SetName( "test_LCM" );
TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" );
Handle(HYDROData_LandCoverMap) aMap =
Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
- TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêt et végétation arbustive en mutation")) );
- TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de conifères")) );
- TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ TopoDS_Face aLC3 = Face2d( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Forêts de feuillus")) );
QString aTmpFileName = "test.telemac";
QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName;
- CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) );
+ QString messStat;
+ CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) );
CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 );
aDoc->Close();
Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
aMap->SetName( "map_1" );
- TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+ TopoDS_Face aLC1 = Face2d( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêts de conifères")) );
- TopoDS_Face aLC2 = Face( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+ TopoDS_Face aLC2 = Face2d( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de feuillus")) );
Handle(HYDROData_LandCoverMap) aMap2 =
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, true );
+ TopoDS_Wire aWire = Wire2d( aCoords, true );
aPolyline->SetShape( aWire );
gp_Pnt2d aPnt( 20, 20 );
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, true );
+ TopoDS_Wire aWire = Wire2d( aCoords, true );
aPolyline->SetShape( aWire );
Handle(HYDROData_ImmersibleZone) aZone =
aPolyline3d->SetPolylineXY( aPolyline2d );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, false );
+ TopoDS_Wire aWire = Wire2d( aCoords, false );
aPolyline2d->SetShape( aWire );
aPolyline3d->SetTopShape( aWire );
aPolyline3d->SetShape3D( aWire );
Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
aProfile->SetName( "profile_1" );
- QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.5 << 0.0 << 1.0 << 0.1;
- TopoDS_Wire aWirePr = Wire( aCoordsPr, false );
+ QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.0 << 0.0 << 1.0 << 0.0;
+ TopoDS_Wire aWirePr = Wire3d( aCoordsPr, false );
aProfile->SetTopShape( aWirePr );
aProfile->SetShape3D( aWirePr );
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, false );
+ TopoDS_Wire aWire = Wire2d( aCoords, false );
aPolyline->SetShape( aWire );
aPolyline->SetWireColor( Qt::red );
CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() );
- aPolyline2->SetShape( Wire( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
+ aPolyline2->SetShape( Wire2d( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
CPPUNIT_ASSERT_EQUAL( true, aPolyline2->IsCustom() );
HYDROData_PolylineXY::PointsList aPointsList = aPolyline2->GetPoints( 0 );
Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) );
CPPUNIT_ASSERT_EQUAL( false, (bool)aStream.IsNull() );
+ CPPUNIT_ASSERT_EQUAL( true, (bool)aStream->GetAltitudeObject().IsNull() );
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->DTM().IsNull() );
CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->GetAltitudeObject().IsNull() );
CPPUNIT_ASSERT_EQUAL( KIND_DTM, aStream->getAltitudeObjectType() );
Handle(HYDROData_Stream) aStream =
Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) );
Handle(HYDROData_DTM) aDTM =
- Handle(HYDROData_DTM)::DownCast( aStream->GetAltitudeObject() );
+ Handle(HYDROData_DTM)::DownCast( aStream->DTM() );
CPPUNIT_ASSERT_EQUAL( false, (bool)aDTM.IsNull() );
Handle(HYDROData_Profile) aProfile1 =
void test_HYDROGUI_Shape::test_face_in_preview()
{
- TopoDS_Face aFace = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ TopoDS_Face aFace = Face2d( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
31 << 114 );