- if ((umesh_p<=2) || (vmesh_p<=2) || !plotwidget_p)
- return false;
-
- // Almost the same as the old create, except that here we store our own data buffer in the class rather than re-creating it each time...
-
- unsigned i,j;
-
- /* get the data */
- double dx = (maxu_p - minu_p) / (umesh_p - 1);
- double dy = (maxv_p - minv_p) / (vmesh_p - 1);
-
- for (i = 0; i < umesh_p; ++i)
- {
- for (j = 0; j < vmesh_p; ++j)
- {
- data[i][j] = operator()(minu_p + i*dx, minv_p + j*dy);
-
- if (data[i][j] > range_p.maxVertex.z)
- data[i][j] = range_p.maxVertex.z;
- else if (data[i][j] < range_p.minVertex.z)
- data[i][j] = range_p.minVertex.z;
- }
- }
-
- Q_ASSERT(plotwidget_p);
- if (!plotwidget_p)
- {
- fprintf(stderr,"Function: no valid Plot3D Widget assigned");
- }
- else
- {
- ((Waterfall3DDisplayPlot*)plotwidget_p)->loadFromData(data, umesh_p, vmesh_p, minu_p, maxu_p, minv_p, maxv_p);
- }
-
- return true;
-}
-
-double Waterfall3DData::operator()(double x, double y){
- return value(x,y) - _floorValue;
-}
-
-double Waterfall3DData::GetFloorValue()const{
- return _floorValue;
-}
-
-void Waterfall3DData::SetFloorValue(const double newValue){
- _floorValue = newValue;
-}
-
-double Waterfall3DData::minZ()const{
- return range_p.minVertex.z;
-}
-
-double Waterfall3DData::maxZ()const{
- return range_p.maxVertex.z;
-}
-
-void Waterfall3DData::setMesh(unsigned int, unsigned int){
- // Do Nothing
- printf("Should Not Reach this Function\n");
-}
-
-void Waterfall3DData::_ResizeMesh(){
- // Clear out the old mesh
- for ( unsigned i = 0; i < umesh_p; i++){
- delete[] data[i];
- }
- delete[] data;
-
- Qwt3D::Function::setMesh(static_cast<int>(boundingRect().width()/20.0), _historyLength);
- setDomain( boundingRect().left(), static_cast<int>(boundingRect().right()), 0, _historyLength);
-
- /* allocate some space for the mesh */
- unsigned i;
- data = new double* [umesh_p] ;
- for ( i = 0; i < umesh_p; i++)
- {
- data[i] = new double [vmesh_p];
- }