Skip to content

Commit

Permalink
Rename projection selection widgets and cleanup API
Browse files Browse the repository at this point in the history
The current names for QgsProjectionSelector and
QgsGenericProjectionSelector are confusing
  • Loading branch information
nyalldawson committed Feb 27, 2017
1 parent 887ca6f commit 5312965
Show file tree
Hide file tree
Showing 41 changed files with 394 additions and 499 deletions.
2 changes: 2 additions & 0 deletions doc/api_break.dox
Expand Up @@ -257,6 +257,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsFormAnnotationItem. Use QgsFormAnnotation instead.
- QgsHtmlAnnotationItem. Use QgsHtmlAnnotation instead.
- QgsHttpTransaction. This class was outdated and code should be ported to native Qt or Python implementations.
- QgsGenericProjectionSelector. Use QgsProjectionSelectionTreeWidget instead.
- QgsLabel and QgsLabelAttributes. Replaced by labeling based on PAL library, see QgsLabelingEngine.
- QgsLabelingEngineInterface. Replaced by QgsLabelingEngine.
- QgsLegendInterface was removed. It was replaced by layer tree API (QgsLayerTreeNode class and others).
Expand All @@ -276,6 +277,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsRendererV2DataDefinedMenus was removed. Use QgsPropertyOverrideButton instead.
- QgsSizeScaleWidget. Use QgsPropertyAssistantWidget instead.
- QgsLegacyHelpers.
- QgsProjectionSelector. Use QgsProjectionSelectionDialog instead.
- QgsProviderCountCalcEvent and QgsProviderExtentCalcEvent. These classes were unused in QGIS core and unmaintained.
- QgsWebviewWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsEditorWidgetConfig was removed. Use QVariantMap instead.
Expand Down
4 changes: 2 additions & 2 deletions python/gui/gui.sip
Expand Up @@ -81,7 +81,6 @@
%Include qgsfloatingwidget.sip
%Include qgsfocuswatcher.sip
%Include qgsformannotation.sip
%Include qgsgenericprojectionselector.sip
%Include qgsgeometryrubberband.sip
%Include qgsgradientcolorrampdialog.sip
%Include qgsgradientstopeditor.sip
Expand Down Expand Up @@ -138,8 +137,9 @@
%Include qgspluginmanagerinterface.sip
%Include qgspresetcolorrampdialog.sip
%Include qgsprevieweffect.sip
%Include qgsprojectionselectiondialog.sip
%Include qgsprojectionselectiontreewidget.sip
%Include qgsprojectionselectionwidget.sip
%Include qgsprojectionselector.sip
%Include qgspropertyassistantwidget.sip
%Include qgspropertyoverridebutton.sip
%Include qgsquerybuilder.sip
Expand Down
64 changes: 0 additions & 64 deletions python/gui/qgsgenericprojectionselector.sip

This file was deleted.

39 changes: 39 additions & 0 deletions python/gui/qgsprojectionselectiondialog.sip
@@ -0,0 +1,39 @@
class QgsProjectionSelectionDialog : QDialog //, private Ui::QgsGenericProjectionSelectorBase
{
%TypeHeaderCode
#include <qgsprojectionselectiondialog.h>
%End

public:
/**
* Constructor
*/
QgsProjectionSelectionDialog( QWidget *parent /TransferThis/ = 0,
const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags );

//! Destructor
~QgsProjectionSelectionDialog();

QgsCoordinateReferenceSystem crs() const;

void setMessage( const QString& message );

public slots:


void setCrs( const QgsCoordinateReferenceSystem& crs );

/**
* \brief filters this dialog by the given CRSs
*
* Sets this dialog to filter the available projections to those listed
* by the given Coordinate Reference Systems.
*
* \param crsFilter a list of OGC Coordinate Reference Systems to filter the
* list of projections by. This is useful in (e.g.) WMS situations
* where you just want to offer what the WMS server can support.
*
* \warning This function's behavior is undefined if it is called after the dialog is shown.
*/
void setOgcWmsCrsFilter( const QSet<QString>& crsFilter );
};
31 changes: 31 additions & 0 deletions python/gui/qgsprojectionselectiontreewidget.sip
@@ -0,0 +1,31 @@
class QgsProjectionSelectionTreeWidget : QWidget
{
%TypeHeaderCode
#include <qgsprojectionselectiontreewidget.h>
%End

public:
QgsProjectionSelectionTreeWidget( QWidget* parent /TransferThis/ );

~QgsProjectionSelectionTreeWidget();

QgsCoordinateReferenceSystem crs() const;

public slots:

void setCrs( const QgsCoordinateReferenceSystem& crs );
void setOgcWmsCrsFilter( const QSet<QString>& crsFilter );
void pushProjectionToFront();

signals:

void crsSelected();
void initialized();
void projectionDoubleClicked();

protected:
void showEvent( QShowEvent * event );

void resizeEvent( QResizeEvent * event );
};

2 changes: 1 addition & 1 deletion python/gui/qgsprojectionselectionwidget.sip
Expand Up @@ -30,7 +30,7 @@ class QgsProjectionSelectionWidget : QWidget
* Can be used to modify how the projection selector dialog behaves.
* @returns projection selector dialog
*/
QgsGenericProjectionSelector* dialog();
QgsProjectionSelectionDialog* dialog();

/** Returns the currently selected CRS for the widget
* @returns current CRS
Expand Down
111 changes: 0 additions & 111 deletions python/gui/qgsprojectionselector.sip

This file was deleted.

8 changes: 4 additions & 4 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -56,7 +56,7 @@
QgsFieldComboBox,
QgsFieldExpressionWidget,
QgsFieldProxyModel,
QgsGenericProjectionSelector,
QgsProjectionSelectionDialog,
QgsMapLayerComboBox,
QgsProjectionSelectionWidget,
)
Expand Down Expand Up @@ -311,13 +311,13 @@ def createWidget(self):
return widget

def selectProjection(self):
dialog = QgsGenericProjectionSelector(self.widget)
dialog = QgsProjectionSelectionDialog(self.widget)
current_crs = QgsCoordinateReferenceSystem(self.combo.currentText())
if current_crs.isValid():
dialog.setSelectedCrsId(current_crs.srsid())
dialog.setCrs(current_crs)

if dialog.exec_():
self.setValue(dialog.selectedAuthId())
self.setValue(dialog.crs().authid())

def setValue(self, value):
if self.dialogType == DIALOG_MODELER:
Expand Down
12 changes: 5 additions & 7 deletions src/app/composer/qgscomposermapgridwidget.cpp
Expand Up @@ -22,7 +22,7 @@
#include "qgsproject.h"
#include "qgssymbollayerutils.h"
#include "qgsstyle.h"
#include "qgsgenericprojectionselector.h"
#include "qgsprojectionselectiondialog.h"
#include "qgscomposition.h"
#include "qgsmapsettings.h"
#include "qgsexpressionbuilderdialog.h"
Expand Down Expand Up @@ -1033,18 +1033,16 @@ void QgsComposerMapGridWidget::on_mMapGridCRSButton_clicked()
return;
}

QgsGenericProjectionSelector crsDialog( this );
QgsProjectionSelectionDialog crsDialog( this );
QgsCoordinateReferenceSystem crs = mComposerMapGrid->crs();
QString currentAuthId = crs.isValid() ? crs.authid() : mComposerMap->crs().authid();
crsDialog.setSelectedAuthId( currentAuthId );
crsDialog.setCrs( crs.isValid() ? crs : mComposerMap->crs() );

if ( crsDialog.exec() == QDialog::Accepted )
{
mComposerMap->beginCommand( tr( "Grid CRS changed" ) );
QString selectedAuthId = crsDialog.selectedAuthId();
mComposerMapGrid->setCrs( QgsCoordinateReferenceSystem( selectedAuthId ) );
mComposerMapGrid->setCrs( crsDialog.crs() );
mComposerMap->updateBoundingRect();
mMapGridCRSButton->setText( selectedAuthId );
mMapGridCRSButton->setText( crsDialog.crs().authid() );
mComposerMap->endCommand();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/dwg/qgsdwgimportdialog.cpp
Expand Up @@ -38,7 +38,7 @@
#include "qgslinesymbollayer.h"
#include "qgspallabeling.h"
#include "qgsmapcanvas.h"
#include "qgsgenericprojectionselector.h"
#include "qgsprojectionselectiondialog.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"
#include "qgsproperty.h"
Expand Down
2 changes: 1 addition & 1 deletion src/app/ogr/qgsvectorlayersaveasdialog.cpp
Expand Up @@ -17,7 +17,7 @@
***************************************************************************/
#include "qgslogger.h"
#include "qgsvectorlayersaveasdialog.h"
#include "qgsgenericprojectionselector.h"
#include "qgsprojectionselectiondialog.h"
#include "qgsvectordataprovider.h"
#include "qgscoordinatereferencesystem.h"
#include "qgseditorwidgetfactory.h"
Expand Down

0 comments on commit 5312965

Please sign in to comment.