Skip to content
Permalink
Browse files
[API] fix #5014
  • Loading branch information
jef-n committed Apr 14, 2012
1 parent 5ea1162 commit 71c4c7f8ce9d26b66159e849c5e96aef3ab5e802
@@ -103,12 +103,12 @@ public:
/** Wkt string that represents a geographic coord sys
* @note added in 1.8 to replace GEOWkt
*/
const QString GEOWKT;
const QString GEOWKT;
/** Wkt string that represents a geographic coord sys
* @note deprecated in 1.8 due to violation of coding conventions (globals
* should be in all caps).
*/
const QString GEOWkt /Deprecated/;
const QString GEOWkt /Deprecated/;

/** PROJ4 string that represents a geographic coord sys */
const QString GEOPROJ4;
@@ -52,7 +52,8 @@ public:
QString *errorMessage = 0,
const QStringList &datasourceOptions = QStringList(),
const QStringList &layerOptions = QStringList(),
bool skipAttributeCreation = FALSE // added in 1.7
bool skipAttributeCreation = FALSE, // added in 1.7
QString *newFilename = 0
);

/** create shapefile and initialize it */
@@ -63,7 +64,8 @@ public:
const QgsCoordinateReferenceSystem* srs,
const QString& driverName = "ESRI Shapefile",
const QStringList &datasourceOptions = QStringList(),
const QStringList &layerOptions = QStringList() );
const QStringList &layerOptions = QStringList(),
QString *newFilename = 0 );

/**Returns map with format filter string as key and OGR format key as value*/
static QMap< QString, QString> supportedFiltersAndFormats();
@@ -648,7 +648,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
#else
//remove mActionTouch button
delete mActionTouch;
mActionTouch=0;
mActionTouch = 0;
#endif

// update windows
@@ -765,7 +765,7 @@ bool QgisApp::event( QEvent * event )
done = true;
}
#ifdef HAVE_TOUCH
else if (event->type() == QEvent::Gesture )
else if ( event->type() == QEvent::Gesture )
{
done = gestureEvent( static_cast<QGestureEvent*>( event ) );
}
@@ -3631,20 +3631,22 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )

QgsVectorFileWriter::WriterError error;
QString errorMessage;
QString newFilename;
error = QgsVectorFileWriter::writeAsVectorFormat(
vlayer, vectorFilename, encoding, &destCRS, format,
saveOnlySelection,
&errorMessage,
datasourceOptions, dialog->layerOptions(),
dialog->skipAttributeCreation() );
dialog->skipAttributeCreation(),
&newFilename );

QApplication::restoreOverrideCursor();

if ( error == QgsVectorFileWriter::NoError )
{
if ( dialog->addToCanvas() )
{
addVectorLayers( QStringList( vectorFilename ), encoding, "file" );
addVectorLayers( QStringList( newFilename ), encoding, "file" );
}
QMessageBox::information( 0, tr( "Saving done" ), tr( "Export to vector file has been completed" ) );
}
@@ -4700,10 +4702,10 @@ void QgisApp::isInOverview()

void QgisApp::removingLayers( QStringList theLayers )
{
foreach (const QString &layerId, theLayers)
foreach( const QString &layerId, theLayers )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer*>(
QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
if ( !vlayer || !vlayer->isEditable() )
return;

@@ -6027,9 +6029,9 @@ void QgisApp::markDirty()
//changed from layerWasAdded to layersWereAdded in 1.8
void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )
{
for (int i = 0; i < theLayers.size(); ++i)
for ( int i = 0; i < theLayers.size(); ++i )
{
QgsMapLayer * layer = theLayers.at(i);
QgsMapLayer * layer = theLayers.at( i );
QgsDataProvider *provider = 0;

QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
@@ -7448,7 +7450,7 @@ QMenu* QgisApp::createPopupMenu()
}

#ifdef HAVE_TOUCH
bool QgisApp::gestureEvent(QGestureEvent *event)
bool QgisApp::gestureEvent( QGestureEvent *event )
{
if ( QGesture *tapAndHold = event->gesture( Qt::TapAndHoldGesture ) )
{
@@ -59,7 +59,8 @@ QgsVectorFileWriter::QgsVectorFileWriter(
const QgsCoordinateReferenceSystem* srs,
const QString& driverName,
const QStringList &datasourceOptions,
const QStringList &layerOptions
const QStringList &layerOptions,
QString *newFilename
)
: mDS( NULL )
, mLayer( NULL )
@@ -387,6 +388,9 @@ QgsVectorFileWriter::QgsVectorFileWriter(
// create geometry which will be used for import
mGeom = createEmptyGeometry( mWkbType );
}

if ( newFilename )
*newFilename = vectorFileName;
}

OGRGeometryH QgsVectorFileWriter::createEmptyGeometry( QGis::WkbType wkbType )
@@ -584,7 +588,8 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
QString *errorMessage,
const QStringList &datasourceOptions,
const QStringList &layerOptions,
bool skipAttributeCreation )
bool skipAttributeCreation,
QString *newFilename )
{
const QgsCoordinateReferenceSystem* outputCRS;
QgsCoordinateTransform* ct = 0;
@@ -607,7 +612,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
outputCRS = &layer->crs();
}
QgsVectorFileWriter* writer =
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFieldMap() : layer->pendingFields(), layer->wkbType(), outputCRS, driverName, datasourceOptions, layerOptions );
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFieldMap() : layer->pendingFields(), layer->wkbType(), outputCRS, driverName, datasourceOptions, layerOptions, newFilename );

// check whether file creation was successful
WriterError err = writer->hasError();
@@ -79,7 +79,8 @@ class CORE_EXPORT QgsVectorFileWriter
QString *errorMessage = 0,
const QStringList &datasourceOptions = QStringList(), // added in 1.6
const QStringList &layerOptions = QStringList(), // added in 1.6
bool skipAttributeCreation = false // added in 1.6
bool skipAttributeCreation = false, // added in 1.6
QString *newFilename = 0 // added in 1.9
);

/** create shapefile and initialize it */
@@ -90,7 +91,8 @@ class CORE_EXPORT QgsVectorFileWriter
const QgsCoordinateReferenceSystem* srs,
const QString& driverName = "ESRI Shapefile",
const QStringList &datasourceOptions = QStringList(), // added in 1.6
const QStringList &layerOptions = QStringList() // added in 1.6
const QStringList &layerOptions = QStringList(), // added in 1.6
QString *newFilename = 0 // added in 1.9
);

/**Returns map with format filter string as key and OGR format key as value*/

0 comments on commit 71c4c7f

Please sign in to comment.