# 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
#controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.0787789)
#controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2548509.17447)
#controlGeomProps(geompy, riveDroite, 32012.2241814, 26188706.2202)
-ontrolGeomProps(geompy, riveGauche, 29149.1353799, 35949580.6716)
+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)
double d = 0;
d += sqr( X - p.X );
d += sqr( Y - p.Y );
- d += sqr( Z - p.Z );
+ //d += sqr( Z - p.Z );
return d;
}
return theCoeffs;
}
+std::vector<int> HYDROData_CalculationCase::GetStricklerTypeForPoints( const std::vector<gp_XY>& thePoints ) const
+{
+ Handle( HYDROData_LandCoverMap ) aLCM = GetLandCoverMap();
+ Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+ std::vector<int> types;
+ if( aLCM.IsNull() || aTable.IsNull() )
+ return types;
+
+ aLCM->ClassifyPoints(thePoints, aTable, types );
+ return types;
+}
+
Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
{
Handle(HYDROData_Region) aResRegion;
RemoveReferenceObject( theInterPolyline->Label(), DataTag_InterPoly );
+ Changed( Geom_2d );
}
double DefValue,
bool UseMax ) const;
+ HYDRODATA_EXPORT std::vector<int> GetStricklerTypeForPoints( const std::vector<gp_XY>& thePoints ) const;
+
/**
* Returns altitudes for given points on given region.
* \param thePoints the points to examine
return;
theOutPoints = Interpolate( theProfiles, theDDZ, theSpatialStep, theOutLeft, theOutRight, theOutMainProfiles, InvInd );
//note that if Create3dPres is false => Create2dPres flag is meaningless!
+ if( theOutPoints.empty() )
+ return;
+
if (Create3dPres)
{
TopTools_IndexedMapOfOrientedShape ll = Create3DShape( theOutLeft, theOutRight, theOutMainProfiles);
void HYDROData_DTM::GetProperties( const Handle(HYDROData_Profile)& theProfile,
gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
- bool isNormalDir,
double& theZMin, double& theZMax )
{
theLowestPoint = theProfile->GetBottomPoint();
theProfile->GetRightPoint( aRight, true, true );
double x = aRight.X()-aLeft.X();
double y = aRight.Y()-aLeft.Y();
- if( isNormalDir )
- theDir = gp_Vec2d( -y, x );
- else
- theDir = gp_Vec2d( x, y );
+ theDir = gp_Vec2d( x, y );
HYDROData_Profile::ProfilePoints points = theProfile->GetProfilePoints();
int lo = points.Lower();
return Handle(Geom2d_Curve)();
}
+#include <GCE2d_MakeSegment.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+bool IsCooriented( const Handle(HYDROData_Profile)& theProfile1,
+ const Handle(HYDROData_Profile)& theProfile2 )
+{
+ if( theProfile1==theProfile2 )
+ return true;
+
+ gp_XY lp1, rp1, lp2, rp2;
+ theProfile1->GetLeftPoint(lp1);
+ theProfile1->GetRightPoint(rp1);
+ theProfile2->GetLeftPoint(lp2);
+ theProfile2->GetRightPoint(rp2);
+
+ GCE2d_MakeSegment s1(lp1, lp2);
+ GCE2d_MakeSegment s2(rp1, rp2);
+
+ Geom2dAPI_InterCurveCurve inter;
+ inter.Init(s1.Value(), s2.Value());
+ if (inter.NbPoints() == 0)
+ return true;
+ else
+ return false;
+}
+
Handle(Geom2d_BSplineCurve) HYDROData_DTM::CreateHydraulicAxis(
const std::vector<Handle(HYDROData_Profile)>& theProfiles,
std::vector<double>& theDistances )
{
size_t n = theProfiles.size();
- Handle(Geom2d_BSplineCurve) aResult;
+ if( n==1 )
+ return Handle_Geom2d_BSplineCurve();
+
+ Handle_Geom2d_BSplineCurve aResult;
Handle(TColgp_HArray1OfPnt2d) points = new TColgp_HArray1OfPnt2d( 1, (int)n );
TColgp_Array1OfVec2d tangents( 1, (int)n );
for( size_t i = 1; i <= n; i++ )
{
Handle(HYDROData_Profile) aProfile = theProfiles[i-1];
+ Handle(HYDROData_Profile) aPrevProfile = i==1 ? theProfiles[i-1] : theProfiles[i-2];
+ Handle(HYDROData_Profile) aNextProfile = i==n ? theProfiles[i-1] : theProfiles[i];
+
+ if( !IsCooriented( aProfile, aNextProfile ) )
+ {
+ gp_XY lp, rp;
+ aProfile->GetLeftPoint( lp, true );
+ aProfile->GetRightPoint( rp, true );
+ aProfile->SetLeftPoint( rp, true );
+ aProfile->SetRightPoint( lp, true );
+ }
aProfile->Update();
gp_Pnt aLowest;
- gp_Vec2d aTangent;
+ gp_Vec2d aNormal;
double zmin, zmax;
- GetProperties( aProfile, aLowest, aTangent, true, zmin, zmax );
- aTangent.Normalize();
+
+ gp_XYZ curP = aProfile->GetBottomPoint();
+ gp_XY curP2d = gp_XY(curP.X(), curP.Y());
+
+ gp_XYZ nextP;
+ if( i==n )
+ nextP = aPrevProfile->GetBottomPoint(true);
+ else
+ nextP = aNextProfile->GetBottomPoint(true);
+
+ gp_XY nextP2d = gp_XY(nextP.X(), nextP.Y());
+
+ gp_Vec2d aPrTangent;
+ GetProperties( aProfile, aLowest, aPrTangent, zmin, zmax );
+ aNormal.SetCoord( -aPrTangent.Y(), aPrTangent.X() );
+
+ gp_Vec2d aDirToNextProfile(nextP2d.X() - curP2d.X(), nextP2d.Y() - curP2d.Y() );
+ if( i==n )
+ aDirToNextProfile.Reverse();
+ if (aNormal.Dot(aDirToNextProfile) < 0)
+ aNormal.Reverse();
+
+ aNormal.Normalize();
points->SetValue( (int)i, gp_Pnt2d( aLowest.X(), aLowest.Y() ) );
- tangents.SetValue( (int)i, aTangent );
+ tangents.SetValue( (int)i, aNormal );
flags->SetValue( (int)i, Standard_True );
}
// Transformation of the coordinate systems
gp_Pnt aLowest;
double zmin, zmax;
- GetProperties( theProfile, aLowest, theDir, false, zmin, zmax );
+ GetProperties( theProfile, aLowest, theDir, zmin, zmax );
gp_Ax3 aStd3d( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( 1, 0, 0 ) );
gp_Ax3 aLocal( gp_Pnt( aLowest.X(), aLowest.Y(), 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) );
gp_Pnt lowestA, lowestB;
gp_Vec2d dirA, dirB;
- GetProperties( theProfileA, lowestA, dirA, false, zminA, zmaxA );
- GetProperties( theProfileB, lowestB, dirB, false, zminB, zmaxB );
+ GetProperties( theProfileA, lowestA, dirA, zminA, zmaxA );
+ GetProperties( theProfileB, lowestB, dirB, zminB, zmaxB );
double hmax = max( zmaxA-zminA, zmaxB-zminB );
gp_Pnt aLowest;
gp_Vec2d aDir;
double aZMin, aZMax;
- GetProperties( theProfiles[0], aLowest, aDir, true, aZMin, aZMax );
+ GetProperties( theProfiles[0], aLowest, aDir, aZMin, aZMax );
int aNbZSteps = (aZMax-aZMin)/theDDZ;
if( aNbSteps > ( 1<<16 ) || aNbZSteps > ( 1<<16 ) )
static void GetProperties( const Handle(HYDROData_Profile)& theProfile,
gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
- bool isNormalDir,
double& theZMin, double& theZMax );
static void ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile,
{
HYDROData_NaturalObject::Update();
+ RemoveGroupObjects();
TopoDS_Shape aResShape = generateTopShape();
SetTopShape( aResShape );
if(f.IsNull())
return Standard_False;
- BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
-
- TopLoc_Location L;
- Handle(Geom_Surface) C = BRep_Tool::Surface(f, L);
- Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation()));
+ BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
+
+ Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(f);
Standard_Real u, v;
ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v);
-
TopAbs_State aState = class2d->Perform( gp_Pnt2d(u, v), Standard_False );
if (aState == TopAbs_IN)
}
+Handle(Geom_Plane) HYDROData_LCM_FaceClassifier::GetPlane(const TopoDS_Face& F)
+{
+ TopLoc_Location L;
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, L);
+ Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(S->Transformed(L.Transformation()));
+ return Pl;
+}
+
void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints,
std::vector<std::set <QString> >& theTypes,
std::vector<NCollection_Map<TopoDS_Face> >* theFaces) const
Bnd_Box2d B;
const TopoDS_Face& F = TopoDS::Face(aFaces(i));
BRepTools::AddUVBounds(F, B);
- aTreeFiller.Add(i, B);
- BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 0 );
+
+ //convert 2d space of planar face to the 3d space of given points
+ //this is more faster way then getting of bnd3d of faces and project them on plane...
+ Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(F);
+ gp_Trsf RT;
+ RT.SetTransformation(Pl->Position());
+ RT.Invert();
+ double xmin, ymin, xmax, ymax;
+ B.Get(xmin, ymin, xmax, ymax);
+ gp_Pnt MinP(xmin, ymin, 0), MaxP(xmax, ymax, 0);
+ MinP.Transform(RT);
+ MaxP.Transform(RT);
+ gp_Pnt2d MinPT(MinP.X(), MinP.Y());
+ gp_Pnt2d MaxPT(MaxP.X(), MaxP.Y());
+ Bnd_Box2d NB;
+ NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
+
+ aTreeFiller.Add(i, NB);
+ BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 1E-7 );
aMapF2Class2d.Add(F, aClass2d);
fclass2dpointers.push_back(aClass2d);
}
#include <NCollection_IndexedDataMap.hxx>
#include <TopoDS_Face.hxx>
#include <NCollection_Map.hxx>
+#include <Geom_Plane.hxx>
class BRepTopAdaptor_FClass2d;
class HYDROData_LandCoverMap;
std::vector<std::set <QString> >& theTypes,
std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
+ static Handle(Geom_Plane) GetPlane(const TopoDS_Face& F);
+
private:
const HYDROData_LandCoverMap* const myLCM;
SetShape( aLocatedShape );
}
-void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints, std::vector<std::set <QString> >& theTypes ) const
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,
+ std::vector<std::set <QString> >& theTypes ) const
{
HYDROData_LCM_FaceClassifier FC(this);
FC.Classify(thePoints, theTypes, NULL);
}
+void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,
+ const Handle(HYDROData_StricklerTable)& theTable,
+ std::vector<int>& theTypes ) const
+{
+ std::vector<std::set <QString> > types;
+ HYDROData_LCM_FaceClassifier FC(this);
+ FC.Classify(thePoints, types, NULL);
+
+ size_t n = types.size();
+ theTypes.resize( n );
+ for( size_t i=0; i<n; i++ )
+ {
+ const std::set<QString>& sub_types = types[i];
+ int aType = 0;
+ if( !sub_types.empty() )
+ {
+ const QString& aSType = *sub_types.begin();
+ aType = theTable->GetAttrValue( aSType ).toInt();
+ }
+ theTypes[i] = aType;
+ }
+}
+
void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints,
- Handle(HYDROData_StricklerTable) theTable,
+ const Handle(HYDROData_StricklerTable)& theTable,
std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const
{
std::vector<std::set <QString> > Types;
HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
- HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints, std::vector<std::set <QString> >& theTypes ) const;
+ HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
+ std::vector<std::set <QString> >& theTypes ) const;
+
+ HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
+ const Handle(HYDROData_StricklerTable)& theTable,
+ std::vector<int>& theTypes ) const;
HYDRODATA_EXPORT void ClassifyPoints( const std::vector<gp_XY>& thePoints,
- Handle(HYDROData_StricklerTable) theTable,
- std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const;
+ const Handle(HYDROData_StricklerTable)& theTable,
+ std::vector<double>& theCoeffs, double DefValue, bool UseMax ) const;
protected:
void SetShape( const TopoDS_Shape& );
#include <QStringList>
#include <QColor>
#include <Geom_BSplineCurve.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <BRepLib_MakeWire.hxx>
#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
QList<TopoDS_Shape> aBoundShapes;
QStringList aBoundNames;
+ QMap<QString, TopTools_IndexedMapOfShape> aNameToShMap;
theObject->GetBoundaries( aBoundShapes, aBoundNames );
continue;
QString aBoundName = i<aBoundNames.size() ? aBoundNames[i] : "";
+
+ if (!aNameToShMap.contains(aBoundName))
+ {
+ TopTools_IndexedMapOfShape IM;
+ IM.Add(aShape);
+ aNameToShMap[aBoundName] = IM;
+ }
+ else
+ aNameToShMap[aBoundName].Add(aShape);
+
+ }
+
+ foreach( QString K, aNameToShMap.keys() )
+ {
+ const TopTools_IndexedMapOfShape& IM = aNameToShMap.value(K);
+ TopTools_ListOfShape LSE;
+ for (int i = 1; i <= IM.Extent(); i++)
+ {
+ const TopoDS_Edge& E = TopoDS::Edge(IM(i));
+ if (E.IsNull())
+ continue;
+ LSE.Append(E);
+ }
+
+ BRepLib_MakeWire WM;
+ WM.Add(LSE);
+ TopoDS_Shape aShapeW;
+ if (WM.IsDone())
+ aShapeW = WM.Wire();
+ else
+ continue;
Handle( HYDROData_PolylineXY ) aPolyline =
Handle( HYDROData_PolylineXY )::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
-
+
if( aPolyline.IsNull() )
return false;
- aPolyline->SetShape( aShape );
+ aPolyline->SetShape( aShapeW );
int anIndex = 0;
- QString aName = aBoundName;
+ QString aName = K;
while( !theDocument->FindObjectByName( aName ).IsNull() )
{
anIndex++;
- aName = aBoundName + "_" + QString::number( anIndex );
+ aName = K + "_" + QString::number( anIndex );
}
aPolyline->SetName( aName );
}
SetRightPoint( aPnt, false );
}
-HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint() const
+HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint(bool IsConvertToGlobal) const
{
ProfilePoint aBottom;
}
// Find the corresponding profile point
- ProfilePoints aProfilePoints = GetProfilePoints( false );
+ ProfilePoints aProfilePoints = GetProfilePoints( IsConvertToGlobal );
if ( aBottomIndex >= 1 && aBottomIndex <= aProfilePoints.Length() ) {
aBottom = aProfilePoints.Value( aBottomIndex );
}
* Return profile point with minimal Z value.
* \return non-parametric profile point
*/
- HYDRODATA_EXPORT ProfilePoint GetBottomPoint() const;
+ HYDRODATA_EXPORT ProfilePoint GetBottomPoint(bool IsConvertToGlobal = false) const;
/**
* Return profile middle point.
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_Builder.hxx>
#include <TopExp.hxx>
+#include <assert.h>
//#define DEB_SPLIT_TO_ZONES 1
//#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1
anOutputSplitDataList.append(SDI);
}
+#ifndef NDEBUG
+ //check CutFaceByEdges method: ensure that SD.Face() edges fully covered by
+ //history map (OutOrSh2M)
+ if (!OutOrSh2M.IsEmpty())
+ {
+ TopTools_IndexedMapOfShape EE;
+ TopExp::MapShapes(SD.Face(), TopAbs_EDGE, EE);
+ int noncontNb = 0;
+ for (int i = 1; i <= EE.Extent(); i++)
+ {
+ const TopoDS_Shape& E = EE(i);
+ noncontNb += !OutOrSh2M.Contains(E);
+ }
+ //noncontNb > 0 => some problem with edge history
+ assert(noncontNb == 0);
+ }
+#endif
+
if(!theGroupsList.IsEmpty() )
{
SplitDataList ModifInpGroupList;
if (SData.Type != SplitData::Data_Edge)
ModifInpGroupList.append(SData); //add as is
const TopoDS_Shape& SData_sh = SData.Shape;
- const TopTools_ListOfShape& modif_ls = OutOrSh2M.FindFromKey(SData_sh);
+ TopTools_ListOfShape modif_ls;
+ if (!InterPolys.IsEmpty())
+ if (OutOrSh2M.Contains(SData_sh))
+ modif_ls = OutOrSh2M.FindFromKey(SData_sh);
+ //else TODO - show message that one of the object should be updated
+
+#ifndef NDEBUG
+ if (!InterPolys.IsEmpty() && OutOrSh2M.IsEmpty())
+ assert (true);
+#endif
if (modif_ls.IsEmpty())
ModifInpGroupList.append(SData); //non modified
else
myProfiles->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myEquiDistance = new QtxDoubleSpinBox( aParamGroup );
- myEquiDistance->setRange( 0.01, 100 );
+ myEquiDistance->setRange( 0.01, 9999 );
myEquiDistance->setValue( 1.0 );
myEquiDistance->setSingleStep( 1.0 );
<parameter value="HYDRO" name="name" />
<parameter value="HYDROGUI" name="library" />
<parameter value="0" name="parameter_test" />
- <parameter name="version" value="1.5"/>
+ <parameter name="version" value="1.6"/>
<parameter value="false" name="auto_fit_all"/>
<parameter name="documentation" value="hydro_help"/>
</section>
%End
+ std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
+ const NCollection_Sequence<double>& theCoordsY ) const
+ [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
+ %MethodCode
+ std::vector<gp_XY> aPnts;
+ int aLen = qMin( a0->Length(), a1->Length() );
+ for ( int i = 1; i <= aLen; ++i )
+ {
+ gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
+ aPnts.push_back( aPnt );
+ }
+ std::vector<int> aRes;
+ Py_BEGIN_ALLOW_THREADS
+ aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) :
+ sipCpp->GetStricklerTypeForPoints( aPnts );
+ Py_END_ALLOW_THREADS
+ sipRes = new std::vector<int>( aRes );
+ %End
+
+
/**
* Returns altitudes for given points on given zone.
* \param thePoints the points to examine
#include <QHash>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
+#include <Prs3d_IsoAspect.hxx>
#include <GEOMUtils.hxx>
#include <TopTools_ListOfShape.hxx>
}
}
-void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor )
+void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor,
+ int theUIANb, int theVIANb)
{
Handle(AIS_Shape) aShape = new AIS_Shape( theShape );
if( theShape.ShapeType()==TopAbs_VERTEX )
aShape->Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_X );
+ if (theShape.ShapeType()==TopAbs_FACE)
+ {
+ context()->DefaultDrawer()->UIsoAspect()->SetNumber(theUIANb);
+ context()->DefaultDrawer()->VIsoAspect()->SetNumber(theVIANb);
+ Handle_Prs3d_Drawer aDrawer = aShape->Attributes();
+ aDrawer->UIsoAspect()->SetNumber(theUIANb);
+ aDrawer->VIsoAspect()->SetNumber(theVIANb);
+ }
aShape->SetMaterial( Graphic3d_NOM_PLASTIC );
aShape->SetColor( HYDROData_Tool::toOccColor( theColor ) );
context()->Display( aShape, theMode, 0, Standard_False );
viewWindow()->onFitAll();
}
}
-
-void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey )
+void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey,
+ int theUIANb, int theVIANb)
{
QString aNewKey = theKey;
if( !aNewKey.isEmpty() )
GEOMUtils::SortShapes(aListOfFaces);
TopTools_ListIteratorOfListOfShape aLF(aListOfFaces);
for( ; aLF.More(); aLF.Next(), i++)
- show( aLF.Value(), theMode, false, GetColor(i) );
+ show( aLF.Value(), theMode, false, GetColor(i), theUIANb, theVIANb );
//show all independent wires
TopTools_ListOfShape aListOfWires;
int theLinesToOmit,
QString& theMsg )
{
- QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+ QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test";
anExpectedRefFilePath += "/" + theBaseName;
QString anActualFilePath = QDir::tempPath() + "/" + theBaseName;
static void eraseAll( bool isUpdate );
static void show( const Handle(AIS_InteractiveObject)& theObject,
int theMode, int theSelectionMode, bool isFitAll, const char* theKey );
- static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor );
- static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey );
+ static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor,
+ int theUIANb = 10, int theVIANb = 10);
+ static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey,
+ int theUIANb = 10, int theVIANb = 10);
static bool AssertImages( QString& theMessage, const QImage* = 0, const char* theCase = 0 );
static QColor GetColor(int i);
DTM_2.png
stream_dtm_2d.png
stream_dtm_3d.png
+ pb_1066.cbf
)
# Application tests
TopTools_IndexedDataMapOfShapeShape ls;
HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
- TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3" );
+ TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3", 1, 1 );
CPPUNIT_ASSERT_IMAGES
}
#include <HYDROData_Profile.h>
#include <HYDROData_DTM.h>
#include <HYDROData_Iterator.h>
+#include <HYDROData_CalculationCase.h>
#include <Geom2d_Curve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <gp_XY.hxx>
gp_Pnt lp;
gp_Vec2d dd;
double zmin, zmax;
- HYDROData_DTM::GetProperties( aProfile, lp, dd, false, zmin, zmax );
+ HYDROData_DTM::GetProperties( aProfile, lp, dd, zmin, zmax );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
- HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax );
+ /* HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, dd.X(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.Y(), EPS );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS );*/
aDoc->Close();
}
TestViewer::showColorScale( ColorScaleIsDisp );
delete aBathPrs;
aDoc->Close();
+}
+
+void test_HYDROData_DTM::test_classifier_1()
+{
+ TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data();
+ fname += "/pb_1066.cbf";
+ CPPUNIT_ASSERT_EQUAL( (int)DocError_OK, (int)HYDROData_Document::Load( fname.ToCString(), 1 ) );
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_CalculationCase) aCase =
+ Handle(HYDROData_CalculationCase)::DownCast( aDoc->FindObjectByName( "Case_1" ) );
+ CPPUNIT_ASSERT_EQUAL( false, aCase.IsNull() );
+ std::vector<gp_XY> points;
+ points.push_back( gp_XY( 43.4842, 3.33176 ) );
+ points.push_back( gp_XY( -125.777, 2.24728 ) );
+ points.push_back( gp_XY( -60.1628, 168.262 ) );
+ points.push_back( gp_XY( 21.8055587645, 154.699344457 ) );
+ points.push_back( gp_XY( -84.4764138524, 79.2606012276 ) );
+ points.push_back( gp_XY( -73.4132070504, 69.7096313266 ) );
+
+ std::vector<double> values = aCase->GetStricklerCoefficientForPoints( points, 0.0, true );
+ CPPUNIT_ASSERT_EQUAL( 6, (int)values.size() );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[0], EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[1], EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0221, values[2], EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[3], EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[4], EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[5], EPS );
+
+ std::vector<int> types = aCase->GetStricklerTypeForPoints( points );
+ CPPUNIT_ASSERT_EQUAL( 6, (int)types.size() );
+ CPPUNIT_ASSERT_EQUAL( 123, types[0] );
+ CPPUNIT_ASSERT_EQUAL( 123, types[1] );
+ CPPUNIT_ASSERT_EQUAL( 221, types[2] );
+ CPPUNIT_ASSERT_EQUAL( 123, types[3] );
+ CPPUNIT_ASSERT_EQUAL( 123, types[4] );
+ CPPUNIT_ASSERT_EQUAL( 123, types[5] );
+
+ aDoc->Close();
}
+
CPPUNIT_TEST( test_curve_to_3d );
CPPUNIT_TEST( test_presentation );
CPPUNIT_TEST( test_garonne );
+ CPPUNIT_TEST( test_classifier_1 );
CPPUNIT_TEST_SUITE_END();
public:
void test_curve_to_3d();
void test_presentation();
void test_garonne();
+ void test_classifier_1();
};
CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_DTM );
TopoDS_Shape aPrs3d = aStream->GetShape3D();
TopoDS_Shape aPrs2d = aStream->GetTopShape();
- TestViewer::show( aPrs2d, 0, true, "stream_dtm_2d" );
+ TestViewer::show( aPrs2d, 0, true, "stream_dtm_2d", 1, 1 );
CPPUNIT_ASSERT_IMAGES;
TestViewer::eraseAll( true );