Skip to content

Commit

Permalink
Merge branch 'master' into rulebaseDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ committed Jan 30, 2018
2 parents 9fff5f0 + 1194c78 commit 3a6eac2
Show file tree
Hide file tree
Showing 278 changed files with 2,520 additions and 1,315 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -616,11 +616,11 @@ IF (WITH_CORE)
ENDIF(MSVC) ENDIF(MSVC)
ENDIF(COMMAND cmake_policy) ENDIF(COMMAND cmake_policy)


IF (PEDANTIC AND NOT WIN32 AND NOT APPLE) if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
ENDIF(PEDANTIC AND NOT WIN32 AND NOT APPLE) endif() #"${CMAKE_SYSTEM_NAME}" MATCHES "Linux")


SET(CMAKE_CXX_VISIBILITY_PRESET hidden) SET(CMAKE_CXX_VISIBILITY_PRESET hidden)
INCLUDE(GenerateExportHeader) INCLUDE(GenerateExportHeader)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGDAL.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ELSE(WIN32)
SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE) SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
ENDIF (NOT GDAL_LIBRARY) ENDIF (NOT GDAL_LIBRARY)
ELSE (APPLE) ELSE (APPLE)
SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.so CACHE STRING INTERNAL) FIND_LIBRARY(GDAL_LIBRARY NAMES ${GDAL_LIB_NAME} PATHS ${GDAL_LINK_DIRECTORIES}/lib)
ENDIF (APPLE) ENDIF (APPLE)


ELSE(GDAL_CONFIG) ELSE(GDAL_CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGEOS.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ELSE(WIN32)
SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE) SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
ENDIF (NOT GEOS_LIBRARY) ENDIF (NOT GEOS_LIBRARY)
ELSE (APPLE) ELSE (APPLE)
SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.so CACHE STRING INTERNAL) FIND_LIBRARY(GEOS_LIBRARY NAMES ${GEOS_LIB_NAME} PATHS ${GEOS_LIB_DIRECTORIES}/lib)
ENDIF (APPLE) ENDIF (APPLE)
#MESSAGE("DBG GEOS_LIBRARY=${GEOS_LIBRARY}") #MESSAGE("DBG GEOS_LIBRARY=${GEOS_LIBRARY}")


Expand Down
16 changes: 14 additions & 2 deletions cmake/FindGRASS.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -159,8 +159,20 @@ ENDIF (WIN32)


IF (UNIX) IF (UNIX)
IF (GRASS_FIND_VERSION EQUAL 7) IF (GRASS_FIND_VERSION EQUAL 7)
LIST(APPEND GRASS_PATHS /usr/lib64/grass70 /usr/lib/grass70 /usr/lib64/grass71 /usr/lib/grass71 /usr/lib64/grass72 /usr/lib/grass72) IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
ENDIF () FOREACH (VERSION_MINOR 0 1 2 3 4)
FOREACH (VERSION_BUILD 0 1 2 3 4 5)
LIST (APPEND GRASS_PATHS /usr/local/grass-${GRASS_FIND_VERSION}.${VERSION_MINOR}.${VERSION_BUILD})
ENDFOREACH (VERSION_BUILD)
ENDFOREACH(VERSION_MINOR)
ELSE (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
FOREACH (PATH /usr/lib64 /usr/lib)
FOREACH (VERSION grass70, grass71, grass72)
LIST(APPEND GRASS_PATHS "${PATH}/${VERSION}")
ENDFOREACH (VERSION)
ENDFOREACH (PATH)
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
ENDIF (GRASS_FIND_VERSION EQUAL 7)
ENDIF (UNIX) ENDIF (UNIX)


IF (APPLE) IF (APPLE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindPostgres.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ELSE(WIN32)
ENDFOREACH(_LIBNAME ${_LIBS}) ENDFOREACH(_LIBNAME ${_LIBS})


ELSE (CYGWIN) ELSE (CYGWIN)
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.so CACHE STRING INTERNAL) FIND_LIBRARY(POSTGRES_LIBRARY NAMES pq libpq libpqdll PATHS ${PG_TMP}/lib)
ENDIF (APPLE) ENDIF (APPLE)
ENDIF(POSTGRES_CONFIG) ENDIF(POSTGRES_CONFIG)


Expand Down
8 changes: 7 additions & 1 deletion cmake/FindPyQt5.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@
import PyQt5.QtCore import PyQt5.QtCore
import sipconfig # won't work for SIP v5 import sipconfig # won't work for SIP v5
import os.path import os.path
import sys
cfg = sipconfig.Configuration() cfg = sipconfig.Configuration()
sip_dir = cfg.default_sip_dir sip_dir = cfg.default_sip_dir
for p in (os.path.join(sip_dir, "PyQt5"), sip_dir): if sys.platform.startswith('freebsd'):
py_version = str(sys.version_info.major) + str(sys.version_info.minor)
sip_dir = sip_dir.replace(py_version, '')
for p in (os.path.join(sip_dir, "PyQt5"),
os.path.join(sip_dir, "PyQt5-3"),
sip_dir):
if os.path.exists(os.path.join(p, "QtCore", "QtCoremod.sip")): if os.path.exists(os.path.join(p, "QtCore", "QtCoremod.sip")):
sip_dir = p sip_dir = p
break break
Expand Down
1 change: 1 addition & 0 deletions cmake/FindQScintilla.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ELSE(EXISTS QSCINTILLA_VERSION_STR)
PATHS PATHS
"${QT_LIBRARY_DIR}" "${QT_LIBRARY_DIR}"
/usr/local/lib /usr/local/lib
/usr/local/lib/qt5
/usr/lib /usr/lib
) )


Expand Down
4 changes: 3 additions & 1 deletion cmake/FindQwt.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# #




set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5 qwt) set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5 qwt qwt6)


find_library(QWT_LIBRARY find_library(QWT_LIBRARY
NAMES ${QWT_LIBRARY_NAMES} NAMES ${QWT_LIBRARY_NAMES}
PATHS PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/usr/local/lib/qt5
"$ENV{LIB_DIR}/lib" "$ENV{LIB_DIR}/lib"
"$ENV{LIB}" "$ENV{LIB}"
) )
Expand All @@ -32,6 +33,7 @@ FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
"${_qwt_fw}/Headers" "${_qwt_fw}/Headers"
/usr/include /usr/include
/usr/local/include /usr/local/include
/usr/local/include/qt5
"$ENV{LIB_DIR}/include" "$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}" "$ENV{INCLUDE}"
PATH_SUFFIXES qwt-qt5 qwt qwt6 PATH_SUFFIXES qwt-qt5 qwt qwt6
Expand Down
17 changes: 10 additions & 7 deletions python/console/console.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import os import os


from qgis.PyQt.QtCore import Qt, QTimer, QCoreApplication, QSize, QByteArray, QFileInfo, QUrl, QDir from qgis.PyQt.QtCore import Qt, QTimer, QCoreApplication, QSize, QByteArray, QFileInfo, QUrl, QDir
from qgis.PyQt.QtWidgets import QDockWidget, QToolBar, QToolButton, QWidget, QSplitter, QTreeWidget, QAction, QFileDialog, QCheckBox, QSizePolicy, QMenu, QGridLayout, QApplication, QShortcut from qgis.PyQt.QtWidgets import QToolBar, QToolButton, QWidget, QSplitter, QTreeWidget, QAction, QFileDialog, QCheckBox, QSizePolicy, QMenu, QGridLayout, QApplication, QShortcut
from qgis.PyQt.QtGui import QDesktopServices, QKeySequence from qgis.PyQt.QtGui import QDesktopServices, QKeySequence
from qgis.PyQt.QtWidgets import QVBoxLayout from qgis.PyQt.QtWidgets import QVBoxLayout
from qgis.utils import iface from qgis.utils import iface
Expand All @@ -32,7 +32,7 @@
from .console_editor import EditorTabWidget from .console_editor import EditorTabWidget
from .console_settings import optionsDialog from .console_settings import optionsDialog
from qgis.core import QgsApplication, QgsSettings from qgis.core import QgsApplication, QgsSettings
from qgis.gui import QgsFilterLineEdit, QgsHelp from qgis.gui import QgsFilterLineEdit, QgsHelp, QgsDockWidget
from functools import partial from functools import partial


import sys import sys
Expand All @@ -46,14 +46,17 @@ def show_console():
if _console is None: if _console is None:
parent = iface.mainWindow() if iface else None parent = iface.mainWindow() if iface else None
_console = PythonConsole(parent) _console = PythonConsole(parent)
if iface:
_console.visibilityChanged.connect(iface.actionShowPythonDialog().setChecked)

_console.show() # force show even if it was restored as hidden _console.show() # force show even if it was restored as hidden
# set focus to the console so the user can start typing # set focus to the console so the user can start typing
# defer the set focus event so it works also whether the console not visible yet # defer the set focus event so it works also whether the console not visible yet
QTimer.singleShot(0, _console.activate) QTimer.singleShot(0, _console.activate)
else: else:
_console.setVisible(not _console.isVisible()) _console.setUserVisible(not _console.isUserVisible())
# set focus to the console so the user can start typing # set focus to the console so the user can start typing
if _console.isVisible(): if _console.isUserVisible():
_console.activate() _console.activate()


return _console return _console
Expand All @@ -70,10 +73,10 @@ def console_displayhook(obj):
_console_output = obj _console_output = obj




class PythonConsole(QDockWidget): class PythonConsole(QgsDockWidget):


def __init__(self, parent=None): def __init__(self, parent=None):
QDockWidget.__init__(self, parent) super().__init__(parent)
self.setObjectName("PythonConsole") self.setObjectName("PythonConsole")
self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console")) self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))
# self.setAllowedAreas(Qt.BottomDockWidgetArea) # self.setAllowedAreas(Qt.BottomDockWidgetArea)
Expand All @@ -89,7 +92,7 @@ def __init__(self, parent=None):
def activate(self): def activate(self):
self.activateWindow() self.activateWindow()
self.raise_() self.raise_()
QDockWidget.setFocus(self) QgsDockWidget.setFocus(self)


def closeEvent(self, event): def closeEvent(self, event):
self.console.saveSettingsConsole() self.console.saveSettingsConsole()
Expand Down
12 changes: 7 additions & 5 deletions python/core/conversions.sip
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1799,6 +1799,8 @@ template<int, TYPE2*>
return NULL; return NULL;
} }


Py_DECREF(valueobj);
Py_DECREF(keyobj);
} }


return d; return d;
Expand Down Expand Up @@ -1997,9 +1999,7 @@ template <TYPE>
{ {
Py_DECREF(l); Py_DECREF(l);


if (tobj) if (!tobj)
Py_DECREF(tobj);
else
delete t; delete t;


return NULL; return NULL;
Expand Down Expand Up @@ -2073,8 +2073,6 @@ template <TYPE>


PyObject *keyobj = PyLong_FromLong(it.key()); PyObject *keyobj = PyLong_FromLong(it.key());
PyObject *pyOobj = sipConvertFromType(oobj, sipType_QgsFeature, sipTransferObj); PyObject *pyOobj = sipConvertFromType(oobj, sipType_QgsFeature, sipTransferObj);
PyDict_SetItem(d, keyobj, pyOobj);

if(pyOobj == NULL || keyobj == NULL || PyDict_SetItem(d, keyobj, pyOobj) < 0) if(pyOobj == NULL || keyobj == NULL || PyDict_SetItem(d, keyobj, pyOobj) < 0)
{ {
Py_DECREF(d); Py_DECREF(d);
Expand All @@ -2083,6 +2081,10 @@ template <TYPE>
{ {
Py_DECREF(pyOobj); Py_DECREF(pyOobj);
} }
else
{
delete oobj;
}


if (keyobj) if (keyobj)
{ {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Constructor for QgsProcessingModelAlgorithm.


virtual QString helpUrl() const; virtual QString helpUrl() const;


virtual Flags flags() const;



virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const; virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;


Expand Down
2 changes: 1 addition & 1 deletion python/core/processing/qgsprocessingalgorithm.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Abstract base class for processing algorithms.
FlagSupportsBatch, FlagSupportsBatch,
FlagCanCancel, FlagCanCancel,
FlagRequiresMatchingCrs, FlagRequiresMatchingCrs,
FlagCanRunInBackground, FlagNoThreading,
FlagDeprecated, FlagDeprecated,
}; };
typedef QFlags<QgsProcessingAlgorithm::Flag> Flags; typedef QFlags<QgsProcessingAlgorithm::Flag> Flags;
Expand Down
4 changes: 4 additions & 0 deletions python/core/processing/qgsprocessingprovider.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ indicates that none of the outputs from any of the provider's algorithms have
support for non-file based outputs. Returning true indicates that the algorithm's support for non-file based outputs. Returning true indicates that the algorithm's
parameters will each individually declare their non-file based support. parameters will each individually declare their non-file based support.


The default behavior for providers is to support non-file based outputs, and most
providers which rely solely on QGIS API (and which do not depend on third-party scripts
or external dependencies) will automatically support this.

.. seealso:: :py:func:`supportedOutputVectorLayerExtensions` .. seealso:: :py:func:`supportedOutputVectorLayerExtensions`
%End %End


Expand Down
3 changes: 3 additions & 0 deletions python/core/qgis.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ The Qgis class provides global constants for use throughout the application.


static const double UI_SCALE_FACTOR; static const double UI_SCALE_FACTOR;


static const double DEFAULT_SNAP_TOLERANCE;

static const int DEFAULT_SNAP_UNITS;
}; };




Expand Down
18 changes: 9 additions & 9 deletions python/core/qgsattributes.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,19 +71,20 @@ typedef QVector<QVariant> QgsAttributes;
} }


QgsAttributes *qv = new QgsAttributes; QgsAttributes *qv = new QgsAttributes;
SIP_SSIZE_T listSize = PyList_GET_SIZE( sipPy );
qv->reserve( listSize );


for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i ) for ( SIP_SSIZE_T i = 0; i < listSize; ++i )
{ {
int state;
PyObject *obj = PyList_GET_ITEM( sipPy, i ); PyObject *obj = PyList_GET_ITEM( sipPy, i );
QVariant *t;
if ( obj == Py_None ) if ( obj == Py_None )
{ {
t = new QVariant( QVariant::Int ); qv->append( QVariant( QVariant::Int ) );
} }
else else
{ {
t = reinterpret_cast<QVariant *>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) ); int state;
QVariant *t = reinterpret_cast<QVariant *>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );


if ( *sipIsErr ) if ( *sipIsErr )
{ {
Expand All @@ -92,11 +93,10 @@ typedef QVector<QVariant> QgsAttributes;
delete qv; delete qv;
return 0; return 0;
} }
}

qv->append( *t );


sipReleaseType( t, sipType_QVariant, state ); qv->append( *t );
sipReleaseType( t, sipType_QVariant, state );
}
} }


*sipCppPtr = qv; *sipCppPtr = qv;
Expand Down
1 change: 1 addition & 0 deletions python/core/qgsbearingutils.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Utilities for calculating bearings and directions.
public: public:


static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs,
const QgsCoordinateTransformContext &transformContext,
const QgsPointXY &point ); const QgsPointXY &point );
%Docstring %Docstring
Returns the direction to true north from a specified point and for a specified Returns the direction to true north from a specified point and for a specified
Expand Down
11 changes: 7 additions & 4 deletions python/core/qgsfeatureiterator.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -201,12 +201,15 @@ Wrapper for iterator of features from vector data provider or vector layer


SIP_PYOBJECT __next__(); SIP_PYOBJECT __next__();
%MethodCode %MethodCode
QgsFeature *f = new QgsFeature; std::unique_ptr< QgsFeature > f = qgis::make_unique< QgsFeature >();
if ( sipCpp->nextFeature( *f ) ) bool result = false;
sipRes = sipConvertFromType( f, sipType_QgsFeature, Py_None ); Py_BEGIN_ALLOW_THREADS
result = ( sipCpp->nextFeature( *f ) );
Py_END_ALLOW_THREADS
if ( result )
sipRes = sipConvertFromType( f.release(), sipType_QgsFeature, Py_None );
else else
{ {
delete f;
PyErr_SetString( PyExc_StopIteration, "" ); PyErr_SetString( PyExc_StopIteration, "" );
} }
%End %End
Expand Down
22 changes: 22 additions & 0 deletions python/core/qgsmapsettings.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -327,6 +327,26 @@ from a source to destination coordinate reference system.
.. versionadded:: 3.0 .. versionadded:: 3.0


.. seealso:: :py:func:`transformContext` .. seealso:: :py:func:`transformContext`
%End

const QgsPathResolver &pathResolver() const;
%Docstring
Returns the path resolver for conversion between relative and absolute paths
during rendering operations, e.g. for resolving relative symbol paths.

.. versionadded:: 3.0

.. seealso:: :py:func:`setPathResolver`
%End

void setPathResolver( const QgsPathResolver &resolver );
%Docstring
Sets the path ``resolver`` for conversion between relative and absolute paths
during rendering operations, e.g. for resolving relative symbol paths.

.. versionadded:: 3.0

.. seealso:: :py:func:`pathResolver`
%End %End


const QgsMapToPixel &mapToPixel() const; const QgsMapToPixel &mapToPixel() const;
Expand Down Expand Up @@ -465,6 +485,8 @@ Returns global configuration of the labeling engine








void updateDerived(); void updateDerived();
}; };


Expand Down
20 changes: 20 additions & 0 deletions python/core/qgsrendercontext.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ from a source to destination coordinate reference system.
.. versionadded:: 3.0 .. versionadded:: 3.0


.. seealso:: :py:func:`transformContext` .. seealso:: :py:func:`transformContext`
%End

const QgsPathResolver &pathResolver() const;
%Docstring
Returns the path resolver for conversion between relative and absolute paths
during rendering operations, e.g. for resolving relative symbol paths.

.. versionadded:: 3.0

.. seealso:: :py:func:`setPathResolver`
%End

void setPathResolver( const QgsPathResolver &resolver );
%Docstring
Sets the path ``resolver`` for conversion between relative and absolute paths
during rendering operations, e.g. for resolving relative symbol paths.

.. versionadded:: 3.0

.. seealso:: :py:func:`pathResolver`
%End %End


const QgsRectangle &extent() const; const QgsRectangle &extent() const;
Expand Down
Loading

0 comments on commit 3a6eac2

Please sign in to comment.