double ddz = GetDDZ();
double step = GetSpatialStep();
std::set<int> InvInd;
- CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd );
+ CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd, -1 );
SetAltitudePoints( points );
SetShape( DataTag_LeftBankShape, OutLeftB);
TopoDS_Shape& OutOutlet,
bool Create3dPres,
bool Create2dPres,
- std::set<int>& InvInd)
+ std::set<int>& InvInd,
+ int thePntsLimit )
{
-
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 );
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;
+}
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;
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 );
aPanel->clearAllBackgroundColorsForProfileList();
for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)