Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/QGIS

  • Loading branch information
pcav committed Sep 26, 2013
2 parents b9b4119 + 770e52b commit e8a8c37b7487c73db6eb8b4c45630f5b940e14c3
Showing with 2,468 additions and 627 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 python/CMakeLists.txt
  3. +1 −0 python/core/core.sip
  4. +14 −0 python/core/qgseditorwidgetconfig.sip
  5. +31 −0 python/gui/editorwidgets/qgseditorconfigwidget.sip
  6. +34 −0 python/gui/editorwidgets/qgseditorwidgetfactory.sip
  7. +32 −0 python/gui/editorwidgets/qgseditorwidgetregistry.sip
  8. +42 −0 python/gui/editorwidgets/qgseditorwidgetwrapper.sip
  9. +5 −0 python/gui/gui.sip
  10. +13 −0 python/plugins/processing/gdal/ClipByMask.py
  11. +1 −1 src/app/CMakeLists.txt
  12. +2 −1 src/app/qgisapp.h
  13. +101 −1 src/app/qgsattributetypedialog.cpp
  14. +13 −0 src/app/qgsattributetypedialog.h
  15. +412 −264 src/app/qgsfieldsproperties.cpp
  16. +93 −19 src/app/qgsfieldsproperties.h
  17. +1 −0 src/core/CMakeLists.txt
  18. +1 −1 src/core/qgsdistancearea.h
  19. +19 −0 src/core/qgseditorwidgetconfig.h
  20. +3 −8 src/core/qgsexpression.cpp
  21. +1 −1 src/core/qgsexpression.h
  22. +49 −5 src/core/qgsvectorlayer.cpp
  23. +72 −30 src/core/qgsvectorlayer.h
  24. +18 −0 src/gui/CMakeLists.txt
  25. +36 −0 src/gui/editorwidgets/core/qgseditorconfigwidget.cpp
  26. +84 −0 src/gui/editorwidgets/core/qgseditorconfigwidget.h
  27. +49 −0 src/gui/editorwidgets/core/qgseditorwidgetfactory.cpp
  28. +163 −0 src/gui/editorwidgets/core/qgseditorwidgetfactory.h
  29. +218 −0 src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
  30. +119 −0 src/gui/editorwidgets/core/qgseditorwidgetregistry.h
  31. +94 −0 src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp
  32. +181 −0 src/gui/editorwidgets/core/qgseditorwidgetwrapper.h
  33. +85 −46 src/gui/qgsattributedialog.cpp
  34. +26 −6 src/gui/qgsattributedialog.h
  35. +80 −37 src/gui/qgsattributeeditor.cpp
  36. +35 −9 src/gui/qgsattributeeditor.h
  37. +42 −0 src/gui/qgsattributeeditorcontext.cpp
  38. +59 −0 src/gui/qgsattributeeditorcontext.h
  39. +14 −11 src/ui/qgsattributetypeedit.ui
  40. +222 −187 src/ui/qgsfieldspropertiesbase.ui
@@ -52,5 +52,6 @@ i18n/*.qm
scripts/qgisstyle
.kdev4/
qgis.kdev4
qgis.supp
src/core/qgscontexthelp_texts.cpp
src/core/qgsexpression_texts.cpp
@@ -44,6 +44,8 @@ INCLUDE_DIRECTORIES(

../src/gui/raster
../src/gui/attributetable
../src/gui/editorwidgets
../src/gui/editorwidgets/core

${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h
)
@@ -29,6 +29,7 @@
%Include qgsdistancearea.sip
%Include qgserror.sip
%Include qgsexpression.sip
%Include qgseditorwidgetconfig.sip
%Include qgsfeature.sip
%Include qgsfeatureiterator.sip
%Include qgsfeaturerequest.sip
@@ -0,0 +1,14 @@
/**
* Holds a set of configuration parameters for a editor widget wrapper.
* It's basically a set of key => value pairs.
*
* If you need more advanced structures than a simple key => value pair,
* you can use a value to hold any structure a QVariant can handle (and that's
* about anything you get through your compiler)
*
* These are the user configurable options in the field properties tab of the
* vector layer properties. They are saved in the project file per layer and field.
* You get these passed, for every new widget wrapper.
*/

typedef QMap<QString, QVariant> QgsEditorWidgetConfig;
@@ -0,0 +1,31 @@
/***************************************************************************
qgseditorconfigwidget.sip
--------------------------------------
Date : 24.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

class QgsEditorConfigWidget : QWidget
{
%TypeHeaderCode
#include <qgseditorconfigwidget.h>
%End

public:
explicit QgsEditorConfigWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent /TransferThis/ );
int field();

QgsVectorLayer* layer();

virtual QgsEditorWidgetConfig config() = 0;
virtual void setConfig( const QgsEditorWidgetConfig& config ) = 0;
};

@@ -0,0 +1,34 @@
/***************************************************************************
qgseditorwidgetfactory.sip
--------------------------------------
Date : 21.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

/**
* Every attribute editor widget needs a factory, which inherits this class
*/
class QgsEditorWidgetFactory
{
%TypeHeaderCode
#include <qgseditorwidgetfactory.h>
%End

public:
QgsEditorWidgetFactory( const QString& name );
virtual ~QgsEditorWidgetFactory();
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0 /Factory/;
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0 /Factory/;
virtual QgsEditorWidgetConfig readConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx );
virtual void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, const QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );

virtual QString name();
};
@@ -0,0 +1,32 @@
/***************************************************************************
qgseditorwidgetregistry.sip
--------------------------------------
Date : 21.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

/**
* This class manages all known edit widget factories
*/
class QgsEditorWidgetRegistry : QObject
{
%TypeHeaderCode
#include <qgseditorwidgetregistry.h>
%End

public:
static QgsEditorWidgetRegistry* instance();
void registerWidget( const QString& widgetType, QgsEditorWidgetFactory* widgetFactory /Transfer/ );
QgsEditorWidgetWrapper* create( const QString& widgetType, QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, QWidget* editor = NULL, QWidget* parent = NULL ) /Factory/;
QgsEditorConfigWidget* createConfigWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) /Factory/;

const QMap<QString, QgsEditorWidgetFactory*> factories();
};
@@ -0,0 +1,42 @@
/***************************************************************************
qgseditorwidgetwrapper.sip
--------------------------------------
Date : 20.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* 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. *
* *
***************************************************************************/

class QgsEditorWidgetWrapper : QObject
{
%TypeHeaderCode
#include <qgseditorwidgetwrapper.h>
%End

public:
explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent /TransferThis/ = 0 );
QWidget* widget();
virtual void setConfig( QMap<QString, QVariant> config );
virtual QVariant value() = 0;
QVariant config( QString key );

QgsVectorLayer* layer();
int field();

protected:
virtual QWidget* createWidget( QWidget* parent ) = 0 /Factory/;

signals:
void valueChanged( const QVariant& value );

public slots:
virtual void setValue( const QVariant& value ) = 0;
virtual void setEnabled( bool enabled );

};
@@ -127,3 +127,8 @@
%Include symbology-ng/qgsdatadefinedsymboldialog.sip
%Include symbology-ng/qgsstylev2exportimportdialog.sip
%Include symbology-ng/qgssvgselectorwidget.sip

%Include editorwidgets/qgseditorconfigwidget.sip
%Include editorwidgets/qgseditorwidgetfactory.sip
%Include editorwidgets/qgseditorwidgetregistry.sip
%Include editorwidgets/qgseditorwidgetwrapper.sip
@@ -25,6 +25,7 @@

import os
from PyQt4 import QtGui
from osgeo import gdal
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -45,6 +46,7 @@ class ClipByMask(GeoAlgorithm):
NO_DATA = "NO_DATA"
MASK = "MASK"
ALPHA_BAND = "ALPHA_BAND"
KEEP_RESOLUTION = "KEEP_RESOLUTION"
EXTRA = "EXTRA"

def getIcon(self):
@@ -58,6 +60,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterVector(self.MASK, "Mask layer", [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addParameter(ParameterString(self.NO_DATA, "Nodata value, leave as none to take the nodata value from input", "none"))
self.addParameter(ParameterBoolean(self.ALPHA_BAND, "Create and output alpha band", False))
self.addParameter(ParameterBoolean(self.KEEP_RESOLUTION, "Keep resolution of output raster", False))
self.addParameter(ParameterString(self.EXTRA, "Additional creation parameters", ""))
self.addOutput(OutputRaster(self.OUTPUT, "Output layer"))

@@ -66,6 +69,7 @@ def processAlgorithm(self, progress):
mask = self.getParameterValue(self.MASK)
noData = str(self.getParameterValue(self.NO_DATA))
addAlphaBand = self.getParameterValue(self.ALPHA_BAND)
keepResolution = self.getParameterValue(self.KEEP_RESOLUTION)
extra = str(self.getParameterValue(self.EXTRA))

arguments = []
@@ -75,6 +79,15 @@ def processAlgorithm(self, progress):
arguments.append("-dstnodata")
arguments.append(noData)

if keepResolution:
r = gdal.Open(self.getParameterValue(self.INPUT))
geoTransform = r.GetGeoTransform()
r = None
arguments.append("-tr")
arguments.append(str(geoTransform[1]))
arguments.append(str(geoTransform[5]))
arguments.append("-tap")

arguments.append("-cutline")
arguments.append(mask)
arguments.append("-crop_to_cutline")
@@ -422,7 +422,7 @@ INCLUDE_DIRECTORIES(
../core
../core/gps
../core/composer ../core/raster ../core/symbology-ng
../gui ../gui/symbology-ng ../gui/attributetable ../gui/raster
../gui ../gui/symbology-ng ../gui/attributetable ../gui/raster ../gui/editorwidgets ../gui/editorwidgets/core
../plugins
../python
gps
@@ -57,6 +57,7 @@ class QgsPoint;
class QgsProviderRegistry;
class QgsPythonUtils;
class QgsRectangle;

class QgsUndoWidget;
class QgsVectorLayer;

@@ -175,6 +176,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
/** Get the mapcanvas object from the app */
QgsMapCanvas *mapCanvas();

/** Return the messageBar object which allows to display unobtrusive messages to the user.*/
QgsMessageBar* messageBar();

/** Get the mapcanvas object from the app */
@@ -240,7 +242,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
/** overloaded function used to sort menu entries alphabetically */
QMenu* createPopupMenu();


//! Actions to be inserted in menus and toolbars
QAction *actionNewProject() { return mActionNewProject; }
QAction *actionOpenProject() { return mActionOpenProject; }

0 comments on commit e8a8c37

Please sign in to comment.
You can’t perform that action at this time.