91    geos::geom::CoordinateSequence pts;
 
   92    for (
unsigned int i = 0; i < m_sampleVertices.size(); i++) {
 
   93      pts.add(geos::geom::Coordinate(m_sampleVertices[i], m_lineVertices[i]));
 
   95    pts.add(geos::geom::Coordinate(m_sampleVertices[0], m_lineVertices[0]));
 
  101      geos::geom::Polygon *spikedPixelPoly = Isis::globalFactory->createPolygon(
 
  102          globalFactory->createLinearRing(pts)).release();
 
  104      const geos::geom::Polygon *projectedInputPixelPoly;
 
  106      if (spikedPixelPoly->isValid()) {
 
  107        projectedInputPixelPoly = spikedPixelPoly;
 
  110        geos::geom::MultiPolygon *despikedPixelPoly;
 
  115          delete spikedPixelPoly;
 
  123          delete spikedPixelPoly;
 
  127        if (despikedPixelPoly->getNumGeometries() > 1) 
return;
 
  128        projectedInputPixelPoly =
 
  129            dynamic_cast<const geos::geom::Polygon *
>(despikedPixelPoly->getGeometryN(0));
 
  133      if (!projectedInputPixelPoly->intersects(m_imagePoly)) 
return;
 
  136          m_imagePoly->intersection(projectedInputPixelPoly).release());
 
  137      geos::geom::prep::PreparedPolygon *preparedPoly =
 
  138        new geos::geom::prep::PreparedPolygon(intersectPoly);
 
  139      const geos::geom::Envelope *envelope = intersectPoly->getEnvelopeInternal();
 
  142      for (
double x = floor(envelope->getMinX()); x <= ceil(envelope->getMaxX()); x++) {
 
  143        if (x == 0) 
continue;
 
  145        for (
double y = floor(envelope->getMinY()); y <= ceil(envelope->getMaxY()); y++) {
 
  146          if (y == 0) 
continue;
 
  151            geos::geom::Coordinate c(x, y);
 
  152            geos::geom::Point *p = Isis::globalFactory->createPoint(c).release();
 
  153            contains = preparedPoly->contains(p);
 
  157            geos::geom::CoordinateSequence tpts;
 
  158            tpts.add(geos::geom::Coordinate(x - 0.5, y - 0.5));
 
  159            tpts.add(geos::geom::Coordinate(x + 0.5, y - 0.5));
 
  160            tpts.add(geos::geom::Coordinate(x + 0.5, y + 0.5));
 
  161            tpts.add(geos::geom::Coordinate(x - 0.5, y + 0.5));
 
  162            tpts.add(geos::geom::Coordinate(x - 0.5, y - 0.5));
 
  164            geos::geom::Polygon *outPixelFootPrint = Isis::globalFactory->createPolygon(
 
  165                                      globalFactory->createLinearRing(tpts)).release();
 
  166            contains = preparedPoly->intersects(outPixelFootPrint);
 
  167            delete outPixelFootPrint;
 
  179            for (
unsigned int i = 0; i < m_dns.size(); i++) {
 
  189              double inputDn = m_dns[i];
 
  194                  double currentCount = (*m_count)[band];
 
  195                  double newCount = ++((*m_count)[band]);
 
  196                  double currentAverage = (*m_average)[band];
 
  197                  (*m_average)[band] = ((currentAverage * currentCount) + inputDn) / newCount;
 
  200                  (*m_average)[band] = inputDn;
 
  201                  (*m_count)[band] = 1;
 
  208                  (*m_average)[band] = inputDn;
 
  224      delete projectedInputPixelPoly;
 
  225      delete intersectPoly;
 
  230    catch(geos::util::IllegalArgumentException *ill) {
 
  231      QString msg = 
"ERROR! geos exception 1 [";
 
  232      msg += (QString)ill->what() + 
"]";
 
 
  275      const QString &countFileName) {
 
  278    QString path = file->path();
 
  279    QString filename = file->baseName();
 
  280    QString extension = file->extension();
 
  284    averageCube->open(avgFileName, 
"rw");
 
  285    AddOutputCube(averageCube);
 
  290    if (countFileName == 
"") {
 
  293      QString openFile = path + 
"/" + filename + 
"-count-." + extension;
 
  294      countCube->open(openFile, 
"rw");
 
  298      countCube->open(countFileName, 
"rw");
 
  301    AddOutputCube(countCube);
 
 
  317                                      QString &countFileName,
 
  319                                      const int nsamps, 
const int nlines,
 
  328    geos::geom::CoordinateSequence imagePts;
 
  330    imagePts.add(geos::geom::Coordinate(0.0, 0.0));
 
  331    imagePts.add(geos::geom::Coordinate(0.0, this->
OutputCubes[0]->lineCount()));
 
  332    imagePts.add(geos::geom::Coordinate(this->
OutputCubes[0]->sampleCount(),
 
  334    imagePts.add(geos::geom::Coordinate(this->
OutputCubes[0]->sampleCount(), 0.0));
 
  335    imagePts.add(geos::geom::Coordinate(0.0, 0.0));
 
  337    m_imagePoly = Isis::globalFactory->createPolygon(
 
  338                    globalFactory->createLinearRing(imagePts)).release();