Line data Source code
1 : //# ImageMomentsProgress.cc: Class to display progress meter for ImageMoments 2 : //# Copyright (C) 1995,1996,1997,1999 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id: ImageMomentsProgress.cc 18093 2004-11-30 17:51:10Z ddebonis $ 27 : // 28 : 29 : 30 : #include <imageanalysis/ImageAnalysis/ImageMomentsProgress.h> 31 : #include <imageanalysis/ImageAnalysis/ImageMomentsProgressMonitor.h> 32 : #include <casacore/casa/BasicMath/Math.h> 33 : #include <casacore/casa/BasicSL/String.h> 34 : 35 : using namespace casacore; 36 : namespace casa { //# NAMESPACE CASA - BEGIN 37 : 38 0 : ImageMomentsProgress::~ImageMomentsProgress() 39 : { 40 0 : delete itsMeter; 41 0 : } 42 : 43 0 : void ImageMomentsProgress::initDerived() 44 : { 45 0 : delete itsMeter; 46 0 : itsMeter = new ProgressMeter(0.0, Double(expectedNsteps()), String("Compute Moments"), 47 0 : String("Vectors extracted"), String(""), String(""), 48 0 : true, max(1,Int(expectedNsteps()/20))); 49 0 : maxReported = false; 50 0 : } 51 : 52 0 : void ImageMomentsProgress::nstepsDone (uInt nsteps) 53 : { 54 0 : itsMeter->update (nsteps); 55 0 : if ( progressMonitor != NULL ){ 56 0 : if ( !maxReported ){ 57 0 : int max = static_cast<int>(itsMeter->max()); 58 0 : progressMonitor->setStepCount( max ); 59 0 : maxReported = true; 60 : } 61 0 : progressMonitor->setStepsCompleted( nsteps ); 62 : } 63 0 : } 64 : 65 0 : void ImageMomentsProgress::setProgressMonitor( ImageMomentsProgressMonitor* monitor ){ 66 0 : progressMonitor = monitor; 67 : 68 0 : } 69 : 70 0 : void ImageMomentsProgress::done() 71 : { 72 0 : if ( progressMonitor != NULL ){ 73 0 : progressMonitor->done(); 74 : } 75 0 : delete itsMeter; 76 0 : itsMeter = 0; 77 0 : } 78 : 79 : 80 : 81 : } //# NAMESPACE CASA - END 82 :