当前位置: 首页>>代码示例>>C++>>正文


C++ GeoImage类代码示例

本文整理汇总了C++中GeoImage的典型用法代码示例。如果您正苦于以下问题:C++ GeoImage类的具体用法?C++ GeoImage怎么用?C++ GeoImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GeoImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createImage

    // override
    // Creates an image.
    osg::Image* createImage(const TileKey&    key,
                            ProgressCallback* progress )
    {
        if ( !_imageLayer.valid() || !_featureSource.valid() )
            return 0L;

        // fetch the image for this key:
        GeoImage image = _imageLayer->createImage(key, progress);
        if ( !image.valid() )
            return 0L;

        // fetch a set of features for this key. The features are in their
        // own SRS, so we need to transform:
        const SpatialReference* featureSRS = _featureSource->getFeatureProfile()->getSRS();
        GeoExtent extentInFeatureSRS = key.getExtent().transform( featureSRS );

        // assemble a spatial query. It helps if your features have a spatial index.
        Query query;
        query.bounds() = extentInFeatureSRS.bounds();
        //query.expression() = ... // SQL expression compatible with data source
        osg::ref_ptr<FeatureCursor> cursor = _featureSource->createFeatureCursor(query);

        // create a new image to return.
        osg::Image* output = new osg::Image();
        //output->allocateImage(128, 128, 1, GL_RGB, GL_UNSIGNED_BYTE);

        // do your magic here.

        return output;
    }
开发者ID:469447793,项目名称:osgearth,代码行数:32,代码来源:TemplateMatClassDriver.cpp

示例2: qDebug

/** 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_;
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:29,代码来源:geoimagelist.cpp

示例3: handleTile

bool CacheTileHandler::handleTile(const TileKey& key, const TileVisitor& tv)
{        
    ImageLayer* imageLayer = dynamic_cast< ImageLayer* >( _layer.get() );
    ElevationLayer* elevationLayer = dynamic_cast< ElevationLayer* >( _layer.get() );    

    // Just call createImage or createHeightField on the layer and the it will be cached!
    if (imageLayer)
    {                
        GeoImage image = imageLayer->createImage( key );
        if (image.valid())
        {                
            return true;
        }            
    }
    else if (elevationLayer )
    {
        GeoHeightField hf = elevationLayer->createHeightField(key, 0L);
        if (hf.valid())
        {                
            return true;
        }            
    }

    // If we didn't produce a result but the key isn't within range then we should continue to 
    // traverse the children b/c a min level was set.
    if (!_layer->isKeyInLegalRange(key))
    {
        return true;
    }

    return false;        
}   
开发者ID:caishanli,项目名称:osgearth,代码行数:32,代码来源:CacheSeed.cpp

示例4: message

/** Prepare the result image with the given instantiated net and the corresponding label image tiles */
void Analysis::prepareResultImage()
{
  iNodeRoot_->setNewID(1);
  emit message("Preparing result map");
  if (!iNodeRoot_->labelImage()) {
    qDebug("Analysis::prepareResultImage: no labelimage");
    return;
  }
  int size_x =
    int ((geoImageList_->geoEast() -
          geoImageList_->geoWest()) / labelImageList_->maxResolution());
  int size_y =
    int ((geoImageList_->geoNorth() -
          geoImageList_->geoSouth()) / labelImageList_->maxResolution());
  GeoImage *img = new GeoImage("result.plm", "result", size_x, size_y,
                               geoImageList_->geoWest(),
                               geoImageList_->geoNorth(),
                               geoImageList_->geoEast(),
                               geoImageList_->geoSouth());
  if (!img->mergeInto(*(iNodeRoot_->labelImage()), 0,
                      iNodeRoot_->attributeInt("id"),
                      iNodeRoot_->attributeInt("IDStart"))) {
    iNodeRoot_->attribute("status", "deleted");
  }
  iNodeRoot_->mergeResultImage(*img);
  img->write();
  map_ = img;
  emit sigMapView(iNodeRoot_, map_);
#ifdef DEBUGMSG
  qDebug("Analysis::prepareResultImage: image=(%dx%d)", size_x, size_y);
#endif
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:33,代码来源:analysis.cpp

示例5: GeoImage

GeoImage
TextureCompositorTexArray::prepareImage( const GeoImage& layerImage, const GeoExtent& tileExtent, unsigned textureSize ) const
{
    const osg::Image* image = layerImage.getImage();
    if (!image)
        return GeoImage::INVALID;

    if (image->getPixelFormat() != GL_RGBA ||
        image->getInternalTextureFormat() != GL_RGBA8 ||
        image->s() != textureSize ||
        image->t() != textureSize )
    {
        // Because all tex2darray layers must be identical in format, let's use RGBA.
        osg::ref_ptr<osg::Image> newImage = ImageUtils::convertToRGBA8( image );
        
        // TODO: revisit. For now let's just settle on 256 (again, all layers must be the same size)
        if ( image->s() != textureSize || image->t() != textureSize )
        {
            osg::ref_ptr<osg::Image> resizedImage;
            if ( ImageUtils::resizeImage( newImage.get(), textureSize, textureSize, resizedImage ) )
                newImage = resizedImage.get();
        }

        return GeoImage( newImage.get(), layerImage.getExtent() );
    }
    else
    {
        return layerImage;
    }
}
开发者ID:hulumogu,项目名称:osgearth,代码行数:30,代码来源:TextureCompositorTexArray.cpp

示例6:

bool
CacheSeed::cacheTile(const MapFrame& mapf, const TileKey& key ) const
{
    bool gotData = false;

    for( ImageLayerVector::const_iterator i = mapf.imageLayers().begin(); i != mapf.imageLayers().end(); i++ )
    {
        ImageLayer* layer = i->get();
        if ( layer->isKeyValid( key ) )
        {
            GeoImage image = layer->createImage( key );
            if ( image.valid() )
                gotData = true;
        }
    }

    if ( mapf.elevationLayers().size() > 0 )
    {
        osg::ref_ptr<osg::HeightField> hf;
        mapf.getHeightField( key, false, hf );
        if ( hf.valid() )
            gotData = true;
    }

    return gotData;
}
开发者ID:APerennec,项目名称:osgearth,代码行数:26,代码来源:CacheSeed.cpp

示例7: handleTile

 bool handleTile(const TileKey& key)
 {
     bool ok = false;
     GeoImage image = _source->createImage(key);
     if ( image.valid() )
         ok = _dest->storeImage(key, image.getImage(), 0L);
     return ok;
 }
开发者ID:DavidLeehome,项目名称:osgearth,代码行数:8,代码来源:osgearth_conv.cpp

示例8: createImage

    osg::Image*
    createImage( const TileKey& key, ProgressCallback* progress )
    {
        if ( !_image.valid() || key.getLevelOfDetail() > getMaxDataLevel() )
            return NULL;

        GeoImage cropped = _image.crop( key.getExtent(), true, getPixelsPerTile(), getPixelsPerTile() );
        return cropped.valid() ? cropped.takeImage() : 0L;
    }
开发者ID:rdelmont,项目名称:osgearth,代码行数:9,代码来源:OSGTileSource.cpp

示例9: geoImage

/** return a list of included images*/
QStringList GeoImageList::list(QString type)
{
    if (type.isEmpty())
        return list_;
    QStringList list;
    QStringList::ConstIterator it;
    for (it = list_.begin(); it != list_.end(); ++it) {
        GeoImage *im = geoImage(*it);
        if (QString::compare(im->type(), type, Qt::CaseInsensitive) == 0)
            list += (*it);
        qDebug("GeoImageList::list(item=%s)", it->toLatin1().constData());
    }
    return list;
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:15,代码来源:geoimagelist.cpp

示例10: geoImage

/** return a list of included images*/
QStringList GeoImageList::list(QString type)
{
  if (type.isEmpty())
    return list_;
  QStringList list;
  QStringList::ConstIterator it;
  for (it = list_.begin(); it != list_.end(); ++it) {
    GeoImage *im = geoImage(*it);
    if (qstricmp(im->type(), type) == 0)
      list += (*it);
    qDebug("GeoImageList::list(item=%s)", (const char *) (*it));
  }
  return list;
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:15,代码来源:geoimagelist.cpp

示例11: while

bool
OSGTileFactory::createValidGeoImage(ImageLayer* layer,
                                    const TileKey& key,
                                    GeoImage& out_image,
                                    TileKey&  out_actualTileKey,
                                    ProgressCallback* progress)
{
    //TODO:  Redo this to just grab images from the parent TerrainTiles
    //Try to create the image with the given key
    out_actualTileKey = key;

    while (out_actualTileKey.valid())
    {
        if ( layer->isKeyValid(out_actualTileKey) )
        {
            out_image = layer->createImage( out_actualTileKey, progress );
            if ( out_image.valid() )
            {
                return true;
            }
        }
        out_actualTileKey = out_actualTileKey.createParentKey();
    }
    return false;
}
开发者ID:hulumogu,项目名称:osgearth,代码行数:25,代码来源:OSGTileFactory.cpp

示例12: if

void
OceanCompositor::applyLayerUpdate(osg::StateSet*       stateSet,
                                  UID                  layerUID,
                                  const GeoImage&      preparedImage,
                                  const TileKey&       tileKey,
                                  const TextureLayout& layout,
                                  osg::StateSet*       parentStateSet) const
{
    osg::Texture2D* tex = s_getTexture( stateSet, layerUID, layout, parentStateSet);
    if ( tex )
    {
        osg::Image* image = preparedImage.getImage();
        image->dirty(); // required for ensure the texture recognizes the image as new data
        tex->setImage( image );

        // set up proper mipmapping filters:
        if (ImageUtils::isPowerOfTwo( image ) && 
            !(!image->isMipmap() && ImageUtils::isCompressed(image)) )
        {
            if ( tex->getFilter(osg::Texture::MIN_FILTER) != osg::Texture::LINEAR_MIPMAP_LINEAR )
                tex->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR );
        }
        else if ( tex->getFilter(osg::Texture::MIN_FILTER) != osg::Texture::LINEAR )
        {
            tex->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR );
        }
    }
}
开发者ID:airwzz999,项目名称:osgearth-for-android,代码行数:28,代码来源:OceanCompositor.cpp

示例13: if

void
TextureCompositorMultiTexture::applyLayerUpdate(osg::StateSet*       stateSet,
                                                UID                  layerUID,
                                                const GeoImage&      preparedImage,
                                                const TileKey&       tileKey,
                                                const TextureLayout& layout,
                                                osg::StateSet*       parentStateSet) const
{
    osg::Texture2D* tex = s_getTexture( stateSet, layerUID, layout, parentStateSet, _minFilter, _magFilter);
    if ( tex )
    {
        osg::Image* image = preparedImage.getImage();
        image->dirty(); // required for ensure the texture recognizes the image as new data
        tex->setImage( image );

        // set up proper mipmapping filters:
        if (_enableMipmapping &&
            _enableMipmappingOnUpdatedTextures &&
            ImageUtils::isPowerOfTwo( image ) &&
            !(!image->isMipmap() && ImageUtils::isCompressed(image)) )
        {
            if ( tex->getFilter(osg::Texture::MIN_FILTER) != _minFilter )
                tex->setFilter( osg::Texture::MIN_FILTER, _minFilter );
        }
        else if ( tex->getFilter(osg::Texture::MIN_FILTER) != osg::Texture::LINEAR )
        {
            tex->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR );
        }

        bool lodBlending = layout.getSlot(layerUID, 1) >= 0;

        if (_enableMipmapping &&
            _enableMipmappingOnUpdatedTextures &&
            lodBlending )
        {
            int slot = layout.getSlot(layerUID, 0);

            // update the timestamp on the image layer to support blending.
            float now = (float)osg::Timer::instance()->delta_s( osg::Timer::instance()->getStartTick(), osg::Timer::instance()->tick() );
            ArrayUniform stampUniform( "osgearth_SlotStamp", osg::Uniform::FLOAT, stateSet, layout.getMaxUsedSlot() + 1 );
            stampUniform.setElement( slot, now );

            // set the texture matrix to properly position the blend (parent) texture
            osg::Matrix mat;
            if ( parentStateSet != 0L )
            {
                unsigned tileX, tileY;
                tileKey.getTileXY(tileX, tileY);

                mat(0,0) = 0.5f;
                mat(1,1) = 0.5f;
                mat(3,0) = (float)(tileX % 2) * 0.5f;
                mat(3,1) = (float)(1 - tileY % 2) * 0.5f;
            }

            ArrayUniform texMatUniform( "osgearth_TexBlendMatrix", osg::Uniform::FLOAT_MAT4, stateSet, layout.getMaxUsedSlot() + 1 );
            texMatUniform.setElement( slot, mat );
        }
    }
}
开发者ID:AlexBobkov,项目名称:osgearth,代码行数:60,代码来源:TextureCompositorMulti.cpp

示例14: find

/** loads the given labelimage fname and returns a pointer to the new image. If the image
was already requested, only a pointer to the image is returned and the reference
counter of the image is incremented. */
GeoImage *GeoImageList::loadLabelImage(QString fname,
                             QString key,
                             float west, float north, float east, float south)
{
  minMaxResUptodate_ = false;
  GeoImage *img = find(fname);
  if (img)
    return img->shallowCopy();
  GeoImage *gi = new GeoImage(fname, key, west, north, east, south);
#ifdef WIN32
  if (gi == 0){
    cout << "Out of Memory..7";
    exit(1);
  }
#endif
  insert(fname, gi);            //insert read geoimage
  list_ += fname;               //fill additional list of image names
  return gi;
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:22,代码来源:geoimagelist.cpp

示例15: qDebug

/** 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_;
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:30,代码来源:geoimagelist.cpp


注:本文中的GeoImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。