/********************************************************************** * $Id: ElevationMatrixCell.cpp,v 1.3 2004/11/29 16:05:33 strk Exp $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/ #include #include #include namespace geos { ElevationMatrixCell::ElevationMatrixCell(): ztot(0) { } ElevationMatrixCell::~ElevationMatrixCell() { } void ElevationMatrixCell::add(const Coordinate &c) { if ( !ISNAN(c.z) ) { if ( zvals.insert(c.z).second ) { ztot+=c.z; } } } void ElevationMatrixCell::add(double z) { if ( !ISNAN(z) ) { if ( zvals.insert(z).second ) { ztot+=z; } } } double ElevationMatrixCell::getTotal() const { return ztot; } double ElevationMatrixCell::getAvg() const { if ( ! zvals.size() ) return DoubleNotANumber; return (ztot/zvals.size()); } string ElevationMatrixCell::print() const { ostringstream ret; //ret<<"["<