Re: [osg-users] [osgPlugins] Problem in loading Shape file

2012-02-22 Thread Ulrich Hertlein
Hi Lalit,

On 24/12/11 0:32 , Lalit Manchwari wrote:
 I followed your instruction and now program is not crashing. But in some file 
 it does
 not load the complete shape file. I have attached here a shape file and its 
 snapshot
 (with complete view).
 
 Please could you help.

When opening the 'polygon.shp' file I'm getting the following from osgviewer:

ESRIShape loader : .dbf file containe different record number that .shp file.
   .dbf record skipped.

This appears to indicate a problem with the .shp loader, but I don't know 
enough about
shape files to make any further comment, sorry.

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] Problem in loading Shape file

2011-12-23 Thread Lalit Manchwari
Thanks ulrich for your answer

I followed your instruction and now program is not crashing. But in some file 
it does not load the complete shape file. I have attached here a shape file and 
its snapshot (with complete view).  

Please could you help.   


Thank you!

Cheers,
Lalit

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44461#44461




Attachments: 
http://forum.openscenegraph.org//files/completeview_836.jpg
http://forum.openscenegraph.org//files/testshapefile_371.rar


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [osgPlugins] Problem in loading Shape file

2011-12-22 Thread Lalit Manchwari
Hi,

I am loading *.shp file in my program. In some files program works fine (mostly 
shape file with lines) but in some other files program crashed. 
My code is :

...
osg::Geode* geode = dynamic_cast  osg::Geode*  
(osgDB::readNodeFile(Test.shp));
osg::ref_ptr  osg::Group   group(new osg::Group);
osg::ref_ptr  osgViewer::Viewer  mViewer(new osgViewer::Viewer);

group-addChild(geode);
mViewer-setSceneData(group.get());
mViewer-run();
... 

Is it correct way?

I am using WindowXp 32 bit os, osg 2.8.5 prebuilt library.

Thank you!

Cheers,
Lalit

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=6#6





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] Problem in loading Shape file

2011-12-22 Thread Ulrich Hertlein
Hi Lalit,

On 22/12/11 21:46 , Lalit Manchwari wrote:
 I am loading *.shp file in my program. In some files program works fine 
 (mostly shape
 file with lines) but in some other files program crashed.
 My code is :
 
 osg::Geode* geode = dynamic_cast  osg::Geode*  
 (osgDB::readNodeFile(Test.shp));

You're making the assumption that the returned node always is a Geode.

This may not always be the case, e.g. because the loader decided to place a
MatrixTransform or a Group at the root of the loaded graph.  In these cases the
dynamic_cast will return a NULL pointer which would explain the crash.

Just use a osg::Node* and remove the dynamic_cast and you should be fine.

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org