Source
histSubRecord = rec.subRecord(PrincipalAxesDD::HISTOGRAM_RANGE); // Record to append to
//# LatticePADD2.cc: explicit templates for LatticePADD class
//# Copyright (C) 1999,2000,2001,2002,2003,2004
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
using namespace casacore;
namespace casa { //# NAMESPACE CASA - BEGIN
// Format a string containing the data value and its units at the
// given position (Float and Complex versions).
template <>
String LatticePADisplayData<Float>::showValue(const Vector<Double>& world) {
//if(!conformed()) return "";
// (kludge: showValue() and showPosition() should also have
// wch passed in, and call conformsTo(wch) instead...).
Vector<Double> fullWorld, fullPixel;
String retval;
if (!getFullCoord(fullWorld, fullPixel, world)) {
retval = "invalid";
return retval;
}
Int length = fullPixel.shape()(0);
IPosition ipos(length);
for (Int i = 0; i < length; i++) {
ipos(i) = Int(fullPixel(i) + 0.5);
if ( (ipos(i) < 0) || (ipos(i) >= dataShape()(i)) ) {
retval = "invalid";
return retval;
}
}
if (!maskValue(ipos)) {
retval = "masked";
return retval;
}
ostringstream oss;
if(itsNotation == Coordinate::SCIENTIFIC) {
oss.setf(ios::scientific, ios::floatfield);
oss.precision(3);
} else if(itsNotation == Coordinate::FIXED) {
oss.setf(ios::fixed, ios::floatfield);
} else if(itsNotation == Coordinate::DEFAULT) { // flexible notation
oss.precision(4);
}
oss.setf(ios::showpos);
Quantum<Float> qtm(dataValue(ipos), dataUnit());
qtm.print(oss);
retval = String(oss);
return retval;