コード例 #1
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();
  }
}