@@ -136,12 +136,6 @@ QgsPointDialog::QgsPointDialog(QString layerPath, QgisIface* theQgisInterface,
136
136
QgsMapLayerRegistry* registry = QgsMapLayerRegistry::instance ();
137
137
registry->addMapLayer (layer, FALSE );
138
138
139
-
140
- // Set source SRS same as dest SRS, so that we don't do any transformation.
141
- // Dest SRS is set by project defaults
142
- // The CoordinateTransform should now be shortcircuited.
143
- layer->coordinateTransform ()->setSourceSRS (layer->coordinateTransform ()->destSRS ());
144
-
145
139
// add layer to map canvas
146
140
std::deque<QString> layers;
147
141
layers.push_back (layer->getLayerID ());
@@ -280,9 +274,7 @@ void QgsPointDialog::on_cmbTransformType_currentIndexChanged(const QString& valu
280
274
QFileInfo file (mLayer ->source ());
281
275
int pos = filename.size ()-file.suffix ().size ()-1 ;
282
276
filename.insert (pos, tr (" -modified" , " Georeferencer:QgsPointDialog.cpp - used to modify a user given filename" ));
283
- pos = filename.size ()-file.suffix ().size ();
284
- filename.replace (pos, filename.size (), " tif" );
285
-
277
+
286
278
leSelectModifiedRaster->setText (filename);
287
279
leSelectWorldFile->setText (guessWorldFileName (filename));
288
280
}
@@ -298,10 +290,9 @@ void QgsPointDialog::on_cmbTransformType_currentIndexChanged(const QString& valu
298
290
bool QgsPointDialog::generateWorldFile ()
299
291
{
300
292
QgsPoint origin (0 , 0 );
301
- double pixelSize = 1 ;
293
+ double pixelXSize = 1 ;
294
+ double pixelYSize = 1 ;
302
295
double rotation = 0 ;
303
- double xOffset = 0.0 ;
304
- double yOffset = 0.0 ;
305
296
306
297
// create arrays with points from mPoints
307
298
std::vector<QgsPoint> pixelCoords, mapCoords;
@@ -318,7 +309,7 @@ bool QgsPointDialog::generateWorldFile()
318
309
{
319
310
if (cmbTransformType->currentText () == tr (" Linear" ))
320
311
{
321
- QgsLeastSquares::linear (mapCoords, pixelCoords, origin, pixelSize );
312
+ QgsLeastSquares::linear (mapCoords, pixelCoords, origin, pixelXSize, pixelYSize );
322
313
}
323
314
else if (cmbTransformType->currentText () == tr (" Helmert" ))
324
315
{
@@ -327,13 +318,13 @@ bool QgsPointDialog::generateWorldFile()
327
318
" the raster layer.</p><p>The modifed raster will be "
328
319
" saved in a new file and a world file will be "
329
320
" generated for this new file instead.</p><p>Are you "
330
- " sure that this is what you want?</p>" ) +
331
- " <p><i>" + tr (" Currently all modified files will be written in TIFF format." ) +
332
- " </i><p>" , QMessageBox::No, QMessageBox::Yes);
321
+ " sure that this is what you want?</p>" ),
322
+ QMessageBox::No, QMessageBox::Yes);
333
323
if (res == QMessageBox::No)
334
324
return false ;
335
325
336
- QgsLeastSquares::helmert (mapCoords, pixelCoords, origin, pixelSize, rotation);
326
+ QgsLeastSquares::helmert (mapCoords, pixelCoords, origin, pixelXSize, rotation);
327
+ pixelXSize = pixelYSize;
337
328
}
338
329
else if (cmbTransformType->currentText () == tr (" Affine" ))
339
330
{
@@ -359,6 +350,8 @@ bool QgsPointDialog::generateWorldFile()
359
350
}
360
351
361
352
// warp the raster if needed
353
+ double xOffset = 0 ;
354
+ double yOffset = 0 ;
362
355
if (rotation != 0 )
363
356
{
364
357
@@ -381,12 +374,12 @@ bool QgsPointDialog::generateWorldFile()
381
374
return false ;
382
375
}
383
376
QTextStream stream (&file);
384
- stream<<pixelSize <<endl
377
+ stream<<pixelXSize <<endl
385
378
<<0 <<endl
386
379
<<0 <<endl
387
- <<-pixelSize <<endl
388
- <<QString::number (origin.x () - xOffset * pixelSize, ' f ' )<<endl
389
- <<QString::number (origin.y () + yOffset * pixelSize, ' f ' )<<endl;
380
+ <<-pixelYSize <<endl
381
+ <<(origin.x () - xOffset * pixelXSize )<<endl
382
+ <<(origin.y () + yOffset * pixelYSize )<<endl;
390
383
// write the data points in case we need them later
391
384
QFile pointFile (mLayer ->source () + " .points" );
392
385
if (pointFile.open (QIODevice::WriteOnly))
@@ -396,8 +389,7 @@ bool QgsPointDialog::generateWorldFile()
396
389
for (unsigned int i = 0 ; i < mapCoords.size (); ++i)
397
390
{
398
391
points<<(QString (" %1\t %2\t %3\t %4" ).
399
- arg (QString::number (mapCoords[i].x (), ' f' )).
400
- arg (QString::number (mapCoords[i].y (), ' f' )).
392
+ arg (mapCoords[i].x ()).arg (mapCoords[i].y ()).
401
393
arg (pixelCoords[i].x ()).arg (pixelCoords[i].y ()))<<endl;
402
394
}
403
395
}
@@ -469,8 +461,8 @@ void QgsPointDialog::deleteDataPoint(QgsPoint& coords)
469
461
#endif
470
462
if ((x*x + y*y) < maxDistSqr)
471
463
{
472
- delete *it;
473
464
mPoints .erase (it);
465
+ delete *it;
474
466
mCanvas ->refresh ();
475
467
break ;
476
468
}
0 commit comments