#include <QFile>
#include <QTextStream>
+#include <gp_Pnt2d.hxx>
+
+void generateOne( QTextStream& theStream,
+ double theFirstX, double theFirstY,
+ double theLastX, double theLastY )
+{
+ const int aNbPoints = 50;
+
+ double aComDist = gp_Pnt2d( theFirstX, theFirstY ).Distance( gp_Pnt2d( theLastX, theLastY ) );
+ double aStep = aComDist / (double)aNbPoints;
+
+ double aStepZ = -5;
+ double aCurDist = 0.0;
+ for ( int i = 0; i <= aNbPoints; ++i )
+ {
+ double aRatio = ( aCurDist / ( aComDist - aCurDist ) );
+
+ double anX = ( theFirstX + aRatio * theLastX ) / ( 1 + aRatio );
+ double anY = ( theFirstY + aRatio * theLastY ) / ( 1 + aRatio );
+ double aZ = aStepZ * aStepZ + sin( (float)rand() );
+ theStream << anX << " " << anY << " " << aZ << " \n";
+
+ aCurDist += aStep;
+ aStepZ += 0.2;
+ }
+}
+
bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName )
{
QFile aTmpFile( theFileName );
{
QTextStream anOutStream( &aTmpFile );
-
- anOutStream << "0 0 0 \n";
- anOutStream << "0 1 10 \n";
- anOutStream << "0 2 20 \n";
- anOutStream << "0 3 30 \n";
-
- anOutStream << "1 0 0 \n";
- anOutStream << "1 1 10 \n";
- anOutStream << "1 2 20 \n";
- anOutStream << "1 3 30 \n";
-
- anOutStream << "2 1 10 \n";
- anOutStream << "2 2 20 \n";
- anOutStream << "2 3 30 \n";
- anOutStream << "2 4 40 \n";
-
- anOutStream << "3 0 0 \n";
- anOutStream << "3 1 10 \n";
- anOutStream << "3 2 20 \n";
- anOutStream << "3 3 30 \n";
-
- anOutStream << "4 0 0 \n";
- anOutStream << "4 1 10 \n";
- anOutStream << "4 2 20 \n";
- anOutStream << "4 3 30 \n";
+
+ srand( 4587 );
+
+ generateOne( anOutStream, 0, -5, 0, 5 );
+ generateOne( anOutStream, 10, -5, 10, 5 );
+ generateOne( anOutStream, 20, -5, 20, 5 );
+ generateOne( anOutStream, 30, -5, 30, 5 );
+ generateOne( anOutStream, 40, -5, 40, 5 );
+ generateOne( anOutStream, 50.85397, -3.794724, 45.833271, 6.703101 );
+ generateOne( anOutStream, 50.85397, 11.267372, 56.787525, 2.367043 );
+ generateOne( anOutStream, 62.721077, 10.354518, 52.67968, 16.516285 );
+ generateOne( anOutStream, 65.23143, 17.657352, 55.190029, 23.819118 );
+ generateOne( anOutStream, 58.385021, 31.806595, 68.198204, 23.819118 );
+ generateOne( anOutStream, 65.916069, 38.653004, 75.044609, 27.470537 );
+ generateOne( anOutStream, 82.575661, 28.38339, 76.870323, 41.847992 );
+ generateOne( anOutStream, 92.845276, 40.022282, 91.932419, 26.557682 );
+ generateOne( anOutStream, 106.081657, 35.686226, 98.778824, 21.99341 );
+ generateOne( anOutStream, 106.994514, 14.91879, 119.774475, 29.980886 );
+ generateOne( anOutStream, 133.239075, 26.785896, 115.666634, 5.790246 );
+ generateOne( anOutStream, 125.47982, -4.707579, 150.811523, 20.167702 );
+ generateOne( anOutStream, 163.591476, 13.777717, 135.977631, -12.92327 );
+ generateOne( anOutStream, 151.496155, -24.105736, 183.446045, 11.267367 );
+ generateOne( anOutStream, 172.720016, -31.180355, 197.367081, 8.98523100 );
+ generateOne( anOutStream, 197.823502, -38.483189, 214.026672, 9.669872 );
+ generateOne( anOutStream, 220.873108, -47.155304, 235.706985, 9.89809100 );
+ generateOne( anOutStream, 248.715134, -58.565987, 266.744019, 9.213447 );
+ generateOne( anOutStream, 278.611145, -67.922737, 307.366028, 10.354514 );
+ generateOne( anOutStream, 316.951019, -84.81053, 342.510925, 7.159524 );
+ generateOne( anOutStream, 350.913635, -100.02983, 384.659393, -4.55408 );
+ generateOne( anOutStream, 443.097107, -21.015415, 391.243927, -118.960365 );
+ generateOne( anOutStream, 440.62793, -147.7677, 500.711792, -34.184483 );
+ generateOne( anOutStream, 482.604309, -169.990509, 547.626587, -52.291954 );
+ generateOne( anOutStream, 534.45752, -193.8594, 589.603027, -68.753288 );
+ generateOne( anOutStream, 633.225525, -97.560631, 569.026306, -206.205444 );
+ generateOne( anOutStream, 601.948975, -224.312912, 673.555786, -120.606499 );
+ generateOne( anOutStream, 654.625305, -248.181854, 719.647522, -148.590775 );
+ generateOne( anOutStream, 708.947693, -278.635315, 770.677673, -183.982635 );
+ generateOne( anOutStream, 742.69342, -314.027191, 824.177002, -225.959045 );
+ generateOne( anOutStream, 793.05932, -341.853638, 855.937317, -260.368958 );
+ generateOne( anOutStream, 838.6137700, -355.969116, 884.168213, -294.37439 );
+ generateOne( anOutStream, 875.185669, -366.234894, 915.607178, -327.096588 );
+ generateOne( anOutStream, 940.630066, -348.269775, 903.416565, -381.633575 );
+ generateOne( anOutStream, 963.728088, -370.726166, 936.780396, -397.032257 );
+ generateOne( anOutStream, 983.618042, -390.61615, 959.878418, -411.789337 );
+ generateOne( anOutStream, 999.658325, -407.939667, 978.485107, -425.904785 );
+ generateOne( anOutStream, 1018.265076, -422.696716, 996.450256, -443.228302 );
+ generateOne( anOutStream, 1040.079834, -441.303467, 1017.623413, -459.9102175 );
+ generateOne( anOutStream, 1055.478516, -456.060547, 1034.946899, -475.9505 );
+ generateOne( anOutStream, 1074.085327, -474.025665, 1058.044922, -493.274017 );
}
aTmpFile.close();