mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
another fix for gml wkb assembly (fixes #14315)
This commit is contained in:
parent
1ffccf05c9
commit
d2679d6dbd
@ -235,8 +235,6 @@ QgsGeometry* QgsGeometry::fromRect( const QgsRectangle& rect )
|
||||
|
||||
void QgsGeometry::fromWkb( unsigned char *wkb, int length )
|
||||
{
|
||||
Q_UNUSED( length );
|
||||
|
||||
detach( false );
|
||||
|
||||
if ( d->geometry )
|
||||
|
@ -377,10 +377,10 @@ void QgsGml::endElement( const XML_Char* el )
|
||||
else if ( theParseMode == feature && localName == mTypeName )
|
||||
{
|
||||
Q_ASSERT( mCurrentFeature );
|
||||
if ( mCurrentWKBSize > 0 )
|
||||
if ( mCurrentWKB.size() > 0 )
|
||||
{
|
||||
QgsGeometry *g = new QgsGeometry();
|
||||
g->fromWkb( mCurrentWKB, mCurrentWKBSize );
|
||||
g->fromWkb( mCurrentWKB, mCurrentWKB.size() );
|
||||
mCurrentFeature->setGeometry( g );
|
||||
mCurrentWKB = QgsWkbPtr( nullptr, 0 );
|
||||
}
|
||||
@ -767,10 +767,10 @@ int QgsGml::getRingWKB( QgsWkbPtr &wkbPtr, const QList<QgsPoint>& ringCoordinate
|
||||
|
||||
int QgsGml::createMultiLineFromFragments()
|
||||
{
|
||||
mCurrentWKBSize = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[mCurrentWKBSize], mCurrentWKBSize );
|
||||
int size = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[size], size );
|
||||
|
||||
QgsWkbPtr wkbPtr( mCurrentWKB, mCurrentWKBSize );
|
||||
QgsWkbPtr wkbPtr( mCurrentWKB );
|
||||
|
||||
wkbPtr << mEndian << QGis::WKBMultiLineString << mCurrentWKBFragments.constBegin()->size();
|
||||
|
||||
@ -790,8 +790,8 @@ int QgsGml::createMultiLineFromFragments()
|
||||
|
||||
int QgsGml::createMultiPointFromFragments()
|
||||
{
|
||||
mCurrentWKBSize = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[mCurrentWKBSize], mCurrentWKBSize );
|
||||
int size = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[size], size );
|
||||
|
||||
QgsWkbPtr wkbPtr( mCurrentWKB );
|
||||
wkbPtr << mEndian << QGis::WKBMultiPoint << mCurrentWKBFragments.constBegin()->size();
|
||||
@ -812,8 +812,8 @@ int QgsGml::createMultiPointFromFragments()
|
||||
|
||||
int QgsGml::createPolygonFromFragments()
|
||||
{
|
||||
mCurrentWKBSize = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[mCurrentWKBSize], mCurrentWKBSize );
|
||||
int size = 1 + 2 * sizeof( int ) + totalWKBFragmentSize();
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[size], size );
|
||||
|
||||
QgsWkbPtr wkbPtr( mCurrentWKB );
|
||||
wkbPtr << mEndian << QGis::WKBPolygon << mCurrentWKBFragments.constBegin()->size();
|
||||
@ -833,12 +833,12 @@ int QgsGml::createPolygonFromFragments()
|
||||
|
||||
int QgsGml::createMultiPolygonFromFragments()
|
||||
{
|
||||
mCurrentWKBSize = 0;
|
||||
mCurrentWKBSize += 1 + 2 * sizeof( int );
|
||||
mCurrentWKBSize += totalWKBFragmentSize();
|
||||
mCurrentWKBSize += mCurrentWKBFragments.size() * ( 1 + 2 * sizeof( int ) ); //fragments are just the rings
|
||||
int size = 0;
|
||||
size += 1 + 2 * sizeof( int );
|
||||
size += totalWKBFragmentSize();
|
||||
size += mCurrentWKBFragments.size() * ( 1 + 2 * sizeof( int ) ); //fragments are just the rings
|
||||
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[mCurrentWKBSize], mCurrentWKBSize );
|
||||
mCurrentWKB = QgsWkbPtr( new unsigned char[size], size );
|
||||
|
||||
QgsWkbPtr wkbPtr( mCurrentWKB );
|
||||
wkbPtr << ( char ) mEndian << QGis::WKBMultiPolygon << mCurrentWKBFragments.size();
|
||||
|
@ -170,7 +170,7 @@ class CORE_EXPORT QgsGml : public QObject
|
||||
int getRingWKB( QgsWkbPtr &wkbPtr, const QList<QgsPoint>& ringCoordinates ) const;
|
||||
/** Creates a multiline from the information in mCurrentWKBFragments and
|
||||
* mCurrentWKBFragmentSizes. Assign the result. The multiline is in
|
||||
* mCurrentWKB and mCurrentWKBSize. The function deletes the memory in
|
||||
* mCurrentWKB. The function deletes the memory in
|
||||
* mCurrentWKBFragments. Returns 0 in case of success.
|
||||
*/
|
||||
int createMultiLineFromFragments();
|
||||
@ -226,8 +226,6 @@ class CORE_EXPORT QgsGml : public QObject
|
||||
int mFeatureCount;
|
||||
/** The total WKB for a feature*/
|
||||
QgsWkbPtr mCurrentWKB;
|
||||
/** The total WKB size for a feature*/
|
||||
int mCurrentWKBSize;
|
||||
QgsRectangle mCurrentExtent;
|
||||
/** WKB intermediate storage during parsing. For points and lines, no
|
||||
* intermediate WKB is stored at all. For multipoints and multilines and
|
||||
|
Loading…
x
Reference in New Issue
Block a user