Showing with 32 additions and 4 deletions.
  1. +21 −0 src/core/qgis.h
  2. +7 −0 src/core/qgsvectorfilewriter.cpp
  3. +3 −3 src/core/qgsvectorlayer.h
  4. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
21 changes: 21 additions & 0 deletions src/core/qgis.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ class CORE_EXPORT QGis
WKBMultiPolygon25D,
};

static WkbType flatType( WkbType type )
{
switch ( type )
{
case WKBMultiPoint:
return WKBPoint;
case WKBMultiLineString:
return WKBLineString;
case WKBMultiPolygon:
return WKBPolygon;
case WKBMultiPoint25D:
return WKBPoint25D;
case WKBMultiLineString25D:
return WKBLineString25D;
case WKBMultiPolygon25D:
return WKBPolygon25D;
default:
return type;
}
}

enum GeometryType
{
Point,
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ bool QgsVectorFileWriter::addFeature( QgsFeature& feature )
{
// build geometry from WKB
QgsGeometry *geom = feature.geometry();

// turn single geoemetry to multi geometry if needed
if ( geom && geom->wkbType() != mWkbType && geom->wkbType() == QGis::flatType( mWkbType ) )
{
geom->convertToMultiType();
}

if ( geom && geom->wkbType() != mWkbType )
{
// there's a problem when layer type is set as wkbtype Polygon
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef QList<int> QgsAttributeList;
typedef QSet<int> QgsAttributeIds;

/** @note Added in 1.9 */
class QgsAttributeEditorElement : public QObject
class CORE_EXPORT QgsAttributeEditorElement : public QObject
{
Q_OBJECT
public:
Expand Down Expand Up @@ -82,7 +82,7 @@ class QgsAttributeEditorElement : public QObject
};

/** @note Added in 1.9 */
class QgsAttributeEditorContainer : public QgsAttributeEditorElement
class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorElement
{
public:
QgsAttributeEditorContainer( QString name, QObject *parent )
Expand All @@ -99,7 +99,7 @@ class QgsAttributeEditorContainer : public QgsAttributeEditorElement
};

/** @note Added in 1.9 */
class QgsAttributeEditorField : public QgsAttributeEditorElement
class CORE_EXPORT QgsAttributeEditorField : public QgsAttributeEditorElement
{
public:
QgsAttributeEditorField( QString name , int idx, QObject *parent )
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ QString QgsPostgresProvider::pkParamWhereClause( int offset, const char *alias )
QString whereClause;

QString aliased;
if ( alias ) aliased = QString("%1.").arg( alias );
if ( alias ) aliased = QString( "%1." ).arg( alias );

switch ( mPrimaryKeyType )
{
Expand Down