Skip to content

Commit

Permalink
Move georeferencer sources from plugins to app
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 25, 2020
1 parent 788180c commit 80a29fd
Show file tree
Hide file tree
Showing 93 changed files with 154 additions and 198 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -637,6 +637,10 @@ ADD_DEFINITIONS(-DQT_DEPRECATED_WARNINGS)
# Unfortunately Qwt uses deprecated QString::null in headers, preventing this being raised above 5.8
ADD_DEFINITIONS(-DQT_DISABLE_DEPRECATED_BEFORE=0x050800)

IF (WITH_GEOREFERENCER)
FIND_PACKAGE(GSL REQUIRED)
ENDIF (WITH_GEOREFERENCER)

IF(ENABLE_COVERAGE)
INCLUDE("cmake/modules/coverage/CodeCoverage.cmake")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage")
Expand Down
32 changes: 32 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -175,6 +175,29 @@ SET(QGIS_APP_SRCS
devtools/profiler/qgsprofilerpanelwidget.cpp
devtools/profiler/qgsprofilerwidgetfactory.cpp

georeferencer/qgsgcpcanvasitem.cpp
georeferencer/qgsgeorefconfigdialog.cpp
georeferencer/qgsgeorefdatapoint.cpp
georeferencer/qgsgeorefdelegates.cpp
georeferencer/qgsgeorefdescriptiondialog.cpp
georeferencer/qgsgeorefplugin.cpp
georeferencer/qgsgeorefplugingui.cpp
georeferencer/qgsgeoreftooladdpoint.cpp
georeferencer/qgsgeoreftooldeletepoint.cpp
georeferencer/qgsgeoreftoolmovepoint.cpp
georeferencer/qgsgeorefvalidators.cpp
georeferencer/qgsleastsquares.cpp
georeferencer/qgsmapcoordsdialog.cpp
georeferencer/qgsresidualplotitem.cpp
georeferencer/qgstransformsettingsdialog.cpp
georeferencer/qgsgcplist.cpp
georeferencer/qgsgcplistmodel.cpp
georeferencer/qgsimagewarper.cpp
georeferencer/qgsgeoreftransform.cpp
georeferencer/qgsgcplistwidget.cpp
georeferencer/qgsrasterchangecoords.cpp
georeferencer/qgsvalidateddoublespinbox.cpp

labeling/qgslabelpropertydialog.cpp
labeling/qgsmaptoolchangelabelproperties.cpp
labeling/qgsmaptoolpinlabels.cpp
Expand Down Expand Up @@ -581,6 +604,15 @@ IF (WITH_3D)
)
ENDIF (WITH_3D)

IF (WITH_GEOREFERENCER)
INCLUDE_DIRECTORIES(SYSTEM
${GSL_INCLUDE_DIR}
)
TARGET_LINK_LIBRARIES(qgis_app
${GSL_LIBRARIES}
)
ENDIF (WITH_GEOREFERENCER)

GENERATE_EXPORT_HEADER(
qgis_app
BASE_NAME APP
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -91,7 +91,8 @@ void QgsGCPListWidget::updateGCPList()

void QgsGCPListWidget::closeEditors()
{
Q_FOREACH ( const QModelIndex &index, selectedIndexes() )
const QModelIndexList selection = selectedIndexes();
for ( const QModelIndex &index : selection )
{
closePersistentEditor( index );
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -1280,7 +1280,7 @@ void QgsGeorefPluginGui::saveGCPs()
{
QTextStream points( &pointFile );
points << "mapX,mapY,pixelX,pixelY,enable,dX,dY,residual" << endl;
Q_FOREACH ( QgsGeorefDataPoint *pt, mPoints )
for ( QgsGeorefDataPoint *pt : qgis::as_const( mPoints ) )
{
points << QStringLiteral( "%1,%2,%3,%4,%5,%6,%7,%8" )
.arg( qgsDoubleToString( pt->mapCoords().x() ),
Expand Down Expand Up @@ -1863,7 +1863,7 @@ QString QgsGeorefPluginGui::generateGDALtranslateCommand( bool generateTFW )
gdalCommand << QStringLiteral( "-co TFW=YES" );
}

Q_FOREACH ( QgsGeorefDataPoint *pt, mPoints )
for ( QgsGeorefDataPoint *pt : qgis::as_const( mPoints ) )
{
gdalCommand << QStringLiteral( "-gcp %1 %2 %3 %4" ).arg( pt->pixelCoords().x() ).arg( -pt->pixelCoords().y() )
.arg( pt->mapCoords().x() ).arg( pt->mapCoords().y() );
Expand Down
File renamed without changes.
Expand Up @@ -577,7 +577,7 @@ bool QgsProjectiveGeorefTransform::updateParametersFromGCPs( const QVector<QgsPo
// HACK: flip y coordinates, because georeferencer and gdal use different conventions
QVector<QgsPointXY> flippedPixelCoords;
flippedPixelCoords.reserve( pixelCoords.size() );
Q_FOREACH ( const QgsPointXY &coord, pixelCoords )
for ( const QgsPointXY &coord : pixelCoords )
{
flippedPixelCoords << QgsPointXY( coord.x(), -coord.y() );
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -95,7 +95,7 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
mListCompression.append( QStringLiteral( "PACKBITS" ) );
mListCompression.append( QStringLiteral( "DEFLATE" ) );
QStringList listCompressionTr;
Q_FOREACH ( const QString &item, mListCompression )
for ( const QString &item : qgis::as_const( mListCompression ) )
{
listCompressionTr.append( tr( item.toLatin1().data() ) );
}
Expand Down
76 changes: 76 additions & 0 deletions src/app/georeferencer/qgsvalidateddoublespinbox.cpp
@@ -0,0 +1,76 @@
/***************************************************************************
qgsvalidateddoublespinbox.cpp
--------------------------------------
Date : 23-Feb-2010
Copyright : (c) 2010 by Manuel Massing
Email : m.massing at warped-space.de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsvalidateddoublespinbox.h"

QgsValidatedDoubleSpinBox::QgsValidatedDoubleSpinBox( QWidget *widget )
: QDoubleSpinBox( widget )
{ }

QValidator::State QgsValidatedDoubleSpinBox::validate( QString &input, int &pos ) const
{
QValidator::State state = QDoubleSpinBox::validate( input, pos );
if ( state != QValidator::Acceptable )
{
return state;
}

// A value of zero is acceptable as intermediate result,
// but not as final entry
double val = valueFromText( input );
if ( val == 0.0 )
{
return QValidator::Intermediate;
}
return QValidator::Acceptable;
}

QAbstractSpinBox::StepEnabled QgsValidatedDoubleSpinBox::stepEnabled() const
{
StepEnabled mayStep = StepNone;

// Zero is off limits, so handle the logic differently
// (always exclude zero from the permitted interval)
if ( minimum() == 0.0 )
{
if ( value() - singleStep() > minimum() )
{
mayStep |= StepDownEnabled;
}
}
else // closed interval
{
if ( value() - singleStep() >= minimum() )
{
mayStep |= StepDownEnabled;
}
}

if ( maximum() == 0.0 )
{
if ( value() + singleStep() < maximum() )
{
mayStep |= StepUpEnabled;
}
}
else
{
if ( value() + singleStep() <= maximum() )
{
mayStep |= StepUpEnabled;
}
}
return mayStep;
}
33 changes: 33 additions & 0 deletions src/app/georeferencer/qgsvalidateddoublespinbox.h
@@ -0,0 +1,33 @@
/***************************************************************************
qgsvalidateddoublespinbox.h - Simple extension to QDoubleSpinBox which
implements a validate function to disallow zero as input.
--------------------------------------
Date : 23-Feb-2010
Copyright : (c) 2010 by Manuel Massing
Email : m.massing at warped-space.de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSVALIDATEDDOUBLESPINBOX_H
#define QGSVALIDATEDDOUBLESPINBOX_H

#include <QDoubleSpinBox>

class QgsValidatedDoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT

public:
QgsValidatedDoubleSpinBox( QWidget *widget );

QValidator::State validate( QString &input, int &pos ) const override;
StepEnabled stepEnabled() const override;
};

#endif
4 changes: 0 additions & 4 deletions src/plugins/CMakeLists.txt
Expand Up @@ -16,10 +16,6 @@ IF (GRASS_FOUND)
ADD_SUBDIRECTORY(grass)
ENDIF (GRASS_FOUND)

IF (WITH_GEOREFERENCER)
ADD_SUBDIRECTORY(georeferencer)
ENDIF (WITH_GEOREFERENCER)

IF (CUSTOM_PLUGINS)
ADD_SUBDIRECTORY(${CUSTOM_PLUGINS})
ENDIF (CUSTOM_PLUGINS)
Expand Down
102 changes: 0 additions & 102 deletions src/plugins/georeferencer/CMakeLists.txt

This file was deleted.

0 comments on commit 80a29fd

Please sign in to comment.