From Sherman Wilcox, "In ESRIShapeParser.cpp, wasn't closing the file handle. Added:
if(fd) { close(fd); fd = 0; } to the constructor."
This commit is contained in:
parent
b668a54e17
commit
62bba8e52b
@ -200,6 +200,12 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ):
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(fd)
|
||||
{
|
||||
close(fd);
|
||||
fd = 0;
|
||||
}
|
||||
}
|
||||
|
||||
osg::Geode *ESRIShapeParser::getGeode()
|
||||
@ -367,15 +373,15 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::MultiPointM> &mptms
|
||||
std::vector<ESRIShape::MultiPointM>::const_iterator p;
|
||||
for( p = mptms.begin(); p != mptms.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
// Here is where we would use the 'M' (?)
|
||||
for( int i = 0; i < p->numPoints ; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, 0.0 );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, 0.0 ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, coords.size()));
|
||||
geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, coords->size()));
|
||||
|
||||
_geode->addDrawable( geometry.get() );
|
||||
}
|
||||
@ -388,11 +394,11 @@ void ESRIShapeParser::_process(const std::vector<ESRIShape::PolyLineM> &linems )
|
||||
std::vector<ESRIShape::PolyLineM>::const_iterator p;
|
||||
for( p = linems.begin(); p != linems.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < p->numPoints; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, 0.0 );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, 0.0 ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
@ -418,10 +424,10 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::PolygonM> &polyms )
|
||||
std::vector<ESRIShape::PolygonM>::const_iterator p;
|
||||
for( p = polyms.begin(); p != polyms.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
int i;
|
||||
for( i = 0; i < p->numPoints; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, 0.0 );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, 0.0 ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
@ -447,8 +453,8 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::PointZ> &ptzs )
|
||||
std::vector<ESRIShape::PointZ>::const_iterator p;
|
||||
for( p = ptzs.begin(); p != ptzs.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
coords.add( p->x, p->y, p->z );
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
coords->push_back( osg::Vec3( p->x, p->y, p->z ));
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, 1));
|
||||
@ -465,15 +471,15 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::MultiPointZ> &mptzs
|
||||
std::vector<ESRIShape::MultiPointZ>::const_iterator p;
|
||||
for( p = mptzs.begin(); p != mptzs.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
// Here is where we would use the 'M' (?)
|
||||
for( int i = 0; i < p->numPoints ; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, p->zArray[i] );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, coords.size()));
|
||||
geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, coords->size()));
|
||||
|
||||
_geode->addDrawable( geometry.get() );
|
||||
}
|
||||
@ -486,11 +492,11 @@ void ESRIShapeParser::_process(const std::vector<ESRIShape::PolyLineZ> &linezs )
|
||||
std::vector<ESRIShape::PolyLineZ>::const_iterator p;
|
||||
for( p = linezs.begin(); p != linezs.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < p->numPoints; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, p->zArray[i] );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
@ -516,11 +522,11 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::PolygonZ> &polyzs )
|
||||
std::vector<ESRIShape::PolygonZ>::const_iterator p;
|
||||
for( p = polyzs.begin(); p != polyzs.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < p->numPoints; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, p->zArray[i] );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
@ -546,11 +552,11 @@ void ESRIShapeParser::_process( const std::vector<ESRIShape::MultiPatch> &mpatch
|
||||
std::vector<ESRIShape::MultiPatch>::const_iterator p;
|
||||
for( p = mpatches.begin(); p != mpatches.end(); p++ )
|
||||
{
|
||||
ArrayHelper coords(_useDouble);
|
||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < p->numPoints; i++ )
|
||||
coords.add( p->points[i].x, p->points[i].y, p->zArray[i] );
|
||||
coords->push_back( osg::Vec3( p->points[i].x, p->points[i].y, p->zArray[i] ));
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(coords.get());
|
||||
|
Loading…
Reference in New Issue
Block a user