Exemplo n.º 1
0
/** return the maximum resolution in the list of images */
float
GeoImageList::maxResolution()
{
  if (!minMaxResUptodate_) {
    minRes_ = -1;
    maxRes_ = 500;
    qDebug("GeoImageList::maxResolution");
    QDictIterator < GeoImage > it = QDictIterator < GeoImage > (*this);
    for (; it.current(); ++it) {
      GeoImage *img = it.current();
      qDebug("%s: xres: %f yres: %f",
             (img->filename()).latin1(),
             img->resolutionX(), img->resolutionY());
      float res = it.current()->resolutionX();
      if (res > minRes_)
        minRes_ = res;
      if (res < maxRes_)
        maxRes_ = res;
      res = it.current()->resolutionY();
      if (res > minRes_)
        minRes_ = res;
      if (res < maxRes_)
        maxRes_ = res;
    }
    minMaxResUptodate_ = true;
  }
  return maxRes_;
}
Exemplo n.º 2
0
/** return the maximum resolution in the list of images */
float
GeoImageList::maxResolution()
{
    if (!minMaxResUptodate_) {
        minRes_ = -1;
        maxRes_ = 500;
        qDebug("GeoImageList::maxResolution");
        Iterator it = begin();
        for (; it!=end(); ++it) {
            GeoImage *img = it.value();
            qDebug("%s: xres: %f yres: %f",
                   img->filename().toLatin1().constData(),
                   img->resolutionX(),
                   img->resolutionY());
            float res = img->resolutionX();
            if (res > minRes_)
                minRes_ = res;
            if (res < maxRes_)
                maxRes_ = res;
            res = img->resolutionY();
            if (res > minRes_)
                minRes_ = res;
            if (res < maxRes_)
                maxRes_ = res;
        }
        minMaxResUptodate_ = true;
    }
    return maxRes_;
}
Exemplo n.º 3
0
/** read a list of GeoImage and the attributes through parser */
void
GeoImageList::read(MLParser & parser)
{
  minMaxResUptodate_ = false;
  qDebug("GeoImageList::read(parser)");
  list_.clear();
  QString keywords[] = { "geoimage", "geoimagelist", "" };
  const MLTagTable nodeTagTable(keywords);
  const int TOK_GEOIMAGE = 1;
  const int TOK_GEOIMAGE_LIST = 2;
  int tag;
#ifdef WIN32 
  geoNorth_ = -1e38F;
  geoSouth_ = 1e38F;
  geoWest_  = 1e38F;
  geoEast_  = -1e38F;
#else
  geoNorth_ = -1e36;
  geoSouth_ = +1e36;
  geoWest_ = +1e36;
  geoEast_ = -1e36;
#endif
  do {
    tag = parser.tag(nodeTagTable);
    switch (tag) {
    case TOK_GEOIMAGE:{
        GeoImage *gi = new GeoImage(parser);    //parse geoimage
#ifdef WIN32
  if (gi == 0){
    cout << "Out of Memory..6";
    exit(1);
  }
#endif
        if (gi->geoNorth() > geoNorth_)
          geoNorth_ = gi->geoNorth();
        if (gi->geoSouth() < geoSouth_)
          geoSouth_ = gi->geoSouth();
        if (gi->geoEast() > geoEast_)
          geoEast_ = gi->geoEast();
        if (gi->geoWest() < geoWest_)
          geoWest_ = gi->geoWest();
        insert(*((*gi)["key"]), gi);    //insert read geoimage
        list_ += *((*gi)["key"]);       //fill additional list of image names
        break;
      }
    default:{
        ArgDict *args = parser.args();
        delete args;
        break;
      }
    }
  } while ((tag != MLParser::END_OF_FILE) && (tag != -TOK_GEOIMAGE_LIST));

  //test images and create a structure for the images
  QString key;
  for (QStringList::Iterator it = list_.begin(); it != list_.end(); ++it) {
    key = *it;
    GeoImage *img = find(key);
    qDebug("## GeoImageList::read(parser)" + img->filename());
    img->load();
  }
}