diff --git a/src/osgPlugins/shp/ESRIShapeParser.cpp b/src/osgPlugins/shp/ESRIShapeParser.cpp index 299fbe5d2..4245f2232 100644 --- a/src/osgPlugins/shp/ESRIShapeParser.cpp +++ b/src/osgPlugins/shp/ESRIShapeParser.cpp @@ -12,9 +12,10 @@ using namespace ESRIShape; -ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ): +ESRIShapeParser::ESRIShapeParser(const std::string fileName, bool useDouble, bool keepSeparatePoints) : _valid(false), - _useDouble(useDouble) + _useDouble(useDouble), + _keepSeparatePoints(keepSeparatePoints) { int fd = 0; if( !fileName.empty() ) @@ -215,7 +216,7 @@ osg::Geode *ESRIShapeParser::getGeode() void ESRIShapeParser::_combinePointToMultipoint() { - if( !_valid ) return; + if (!_valid || _keepSeparatePoints) return; OSG_NOTICE<<"_combinePointToMultipoint()"< _geode; diff --git a/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp b/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp index faa997a13..abe9de05a 100644 --- a/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp +++ b/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp @@ -20,6 +20,7 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter { supportsExtension("shp","Geospatial Shape file format"); supportsOption("double","Read x,y,z data as double an stored as geometry in osg::Vec3dArray's."); + supportsOption("keepSeparatePoints", "Avoid combining point features into multi-point."); } virtual const char* className() const { return "ESRI Shape ReaderWriter"; } @@ -47,8 +48,14 @@ class ESRIShapeReaderWriter : public osgDB::ReaderWriter useDouble = true; } + bool keepSeparatePoints = false; + if (options && options->getOptionString().find("keepSeparatePoints") != std::string::npos) + { + keepSeparatePoints = true; + } - ESRIShape::ESRIShapeParser sp(fileName, useDouble); + + ESRIShape::ESRIShapeParser sp(fileName, useDouble, keepSeparatePoints); std::string xbaseFileName(osgDB::getNameLessExtension(fileName) + ".dbf"); diff --git a/src/osgPlugins/shp/XBaseParser.cpp b/src/osgPlugins/shp/XBaseParser.cpp index ca06da466..61119ec9e 100644 --- a/src/osgPlugins/shp/XBaseParser.cpp +++ b/src/osgPlugins/shp/XBaseParser.cpp @@ -184,7 +184,7 @@ bool XBaseParser::parse(int fd) char* number = new char[it->_fieldLength + 1]; memcpy(number, recordPtr, it->_fieldLength); number[it->_fieldLength] = 0; - shapeAttributeList->push_back(osgSim::ShapeAttribute((const char *) it->_name, (int) atoi(number))); + shapeAttributeList->push_back(osgSim::ShapeAttribute((const char *) it->_name, atof(number))); delete [] number; break; }