OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

class osgEarth::Map has no member named 'addImageLayer'


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [3rdparty]
View previous topic :: View next topic  
Author Message
Rodrigo
User


Joined: 01 Mar 2017
Posts: 24

PostPosted: Wed Jan 02, 2019 4:39 pm    Post subject:
class osgEarth::Map has no member named 'addImageLayer'
Reply with quote

Hi,

I'm following the example from here. This line, however:

Code:
map->addImageLayer( layer );


won't compile. g++ says:

Quote:
error: ‘class osgEarth::Map’ has no member named ‘addImageLayer’; did you mean ‘addLayer’?


I tried with addLayer, but then the program compiles but hangs on run, and won't execute not even the first line, "cout << 1;".

I'm using version 2.10. I noticed that the documentation is from version 2.1. Even the page where I took the example from is titled "osgEarth 2.4 documentation". Is there an up to date documentation? What am I doing wrong here?

Thank you!

Cheers,
Rodrigo
Back to top
View user's profile Send private message
ceranco (Eran Cohen)
Newbie


Joined: 15 Dec 2017
Posts: 19

PostPosted: Thu Jan 03, 2019 9:21 am    Post subject:
Re: class osgEarth::Map has no member named 'addImageLayer'
Reply with quote

Rodrigo wrote:
Hi,

I'm following the example from here. This line, however:

Code:
map->addImageLayer( layer );


won't compile. g++ says:

Quote:
error: ‘class osgEarth::Map’ has no member named ‘addImageLayer’; did you mean ‘addLayer’?


I tried with addLayer, but then the program compiles but hangs on run, and won't execute not even the first line, "cout << 1;".

I'm using version 2.10. I noticed that the documentation is from version 2.1. Even the page where I took the example from is titled "osgEarth 2.4 documentation". Is there an up to date documentation? What am I doing wrong here?

Thank you!

Cheers,
Rodrigo


Hi Rodrigo,

If I'm not mistaken, the map API was changed in 2.9 to be more generic,
so the different map->add*Type*Layer() were changed to map->addLayer(), so that's the reason for the first error.

I'm not sure why the program hangs when you use the addLayer() method, but you may have better luck asking in the osgEarth forum.

Good luck,
Eran Cohen
Back to top
View user's profile Send private message
Rodrigo
User


Joined: 01 Mar 2017
Posts: 24

PostPosted: Sun Jan 06, 2019 2:38 am    Post subject:
Reply with quote

Well, I just formatted my computer and reinstalled everything. Now it runs all lines up to addLayer and then hangs (which is an advance). The provided url, http://labs.metacarta.com/wms-c/Basic.py/1.0.0/satellite/, gives a timeout in the browser, so I think that's why it's hanging now. What other url can I use?

Actually, I want to load a PNG as the texture, while using another PNG as the elevation, but couldn't find any example of that.
Back to top
View user's profile Send private message
Rodrigo
User


Joined: 01 Mar 2017
Posts: 24

PostPosted: Mon Jan 14, 2019 9:25 pm    Post subject:
Reply with quote

The code below worked:

Code:
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgViewer/Viewer>
#include <osgEarth/ImageLayer>
#include <osgEarth/Map>
#include <osgEarth/MapNode>
#include <osgEarthDrivers/gdal/GDALOptions>

using namespace std;
using namespace osg;
using namespace osgEarth;
using namespace osgEarth::Drivers;

int main (int argc, char** argv) {
   // Cria um Mapa na opção "projetado" para mostrar num plano (ao invés de num globo)
   MapOptions mapOpt;
   mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;
   mapOpt.profile() = ProfileOptions("plate-carre");
   osg::ref_ptr<Map> map = new Map(mapOpt);

   // Adiciona uma camada de imagem/textura (vegetação do Brasil num GeoTiff)
   {
      GDALOptions gdal;
      gdal.url() = "br_modified.tif";
      osg::ref_ptr<ImageLayer> layer = new ImageLayer( "BR", gdal );
      map->addLayer( layer );
   }

   // Adiciona uma camada de elevação (SRTM de um arquivo GeoTiff)
   {
      GDALOptions gdal;
      gdal.url() = "BRalt.tif";
      osg::ref_ptr<ElevationLayer> layer = new ElevationLayer( "SRTM", gdal );
      map->addLayer( layer );
   }

   // Cria um MapNode para renderizar este mapa
   osg::ref_ptr<MapNode> mapNode = new MapNode( map );

   osgViewer::Viewer viewer;
   viewer.setSceneData( mapNode.get() );
   viewer.setCameraManipulator( new osgGA::TrackballManipulator );

   while ( !viewer.done() ) {
      viewer.frame();
   }
   
   return 0;
}
// g++ main.cpp -losg -losgDB -losgViewer -losgEarth -losgGA -o main
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [3rdparty] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts questions about developing drivers fo... speterson@idealaero.com General 10 Fri Aug 30, 2019 8:24 pm View latest post
No new posts osgQt & osgEarth not working with... Db80 General 1 Thu May 16, 2019 2:15 pm View latest post
No new posts adding object models in osgEarth best... Db80 General 10 Tue Apr 30, 2019 6:12 pm View latest post
No new posts Air-Traffic Surveillance Display usin... eskay187 Announcement [ANN] 2 Wed Feb 13, 2019 7:07 am View latest post
No new posts Use PNG as texture for terrain in osg... Rodrigo General [3rdparty] 12 Mon Jan 07, 2019 5:13 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP