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
Expand Up @@ -616,11 +616,11 @@ IF (WITH_CORE)
ENDIF(MSVC)
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_MODULE_LINKER_FLAGS "${CMAKE_MODULE_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)
INCLUDE(GenerateExportHeader)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGDAL.cmake
Expand Up @@ -167,7 +167,7 @@ ELSE(WIN32)
SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
ENDIF (NOT GDAL_LIBRARY)
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)

ELSE(GDAL_CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGEOS.cmake
Expand Up @@ -148,7 +148,7 @@ ELSE(WIN32)
SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
ENDIF (NOT GEOS_LIBRARY)
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)
#MESSAGE("DBG GEOS_LIBRARY=${GEOS_LIBRARY}")

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

IF (UNIX)
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)
ENDIF ()
IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
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)

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

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(POSTGRES_CONFIG)

Expand Down
8 changes: 7 additions & 1 deletion cmake/FindPyQt5.py
Expand Up @@ -37,9 +37,15 @@
import PyQt5.QtCore
import sipconfig # won't work for SIP v5
import os.path
import sys
cfg = sipconfig.Configuration()
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")):
sip_dir = p
break
Expand Down
1 change: 1 addition & 0 deletions cmake/FindQScintilla.cmake
Expand Up @@ -39,6 +39,7 @@ ELSE(EXISTS QSCINTILLA_VERSION_STR)
PATHS
"${QT_LIBRARY_DIR}"
/usr/local/lib
/usr/local/lib/qt5
/usr/lib
)

Expand Down
4 changes: 3 additions & 1 deletion cmake/FindQwt.cmake
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
NAMES ${QWT_LIBRARY_NAMES}
PATHS
/usr/lib
/usr/local/lib
/usr/local/lib/qt5
"$ENV{LIB_DIR}/lib"
"$ENV{LIB}"
)
Expand All @@ -32,6 +33,7 @@ FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
"${_qwt_fw}/Headers"
/usr/include
/usr/local/include
/usr/local/include/qt5
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
PATH_SUFFIXES qwt-qt5 qwt qwt6
Expand Down
17 changes: 10 additions & 7 deletions python/console/console.py
Expand Up @@ -23,7 +23,7 @@
import os

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.QtWidgets import QVBoxLayout
from qgis.utils import iface
Expand All @@ -32,7 +32,7 @@
from .console_editor import EditorTabWidget
from .console_settings import optionsDialog
from qgis.core import QgsApplication, QgsSettings
from qgis.gui import QgsFilterLineEdit, QgsHelp
from qgis.gui import QgsFilterLineEdit, QgsHelp, QgsDockWidget
from functools import partial

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

_console.show() # force show even if it was restored as hidden
# 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
QTimer.singleShot(0, _console.activate)
else:
_console.setVisible(not _console.isVisible())
_console.setUserVisible(not _console.isUserVisible())
# set focus to the console so the user can start typing
if _console.isVisible():
if _console.isUserVisible():
_console.activate()

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


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

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

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

Py_DECREF(valueobj);
Py_DECREF(keyobj);
}

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

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

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

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

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

if (keyobj)
{
Expand Down
Expand Up @@ -47,6 +47,8 @@ Constructor for QgsProcessingModelAlgorithm.

virtual QString helpUrl() const;

virtual Flags flags() const;


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

Expand Down
2 changes: 1 addition & 1 deletion python/core/processing/qgsprocessingalgorithm.sip.in
Expand Up @@ -44,7 +44,7 @@ Abstract base class for processing algorithms.
FlagSupportsBatch,
FlagCanCancel,
FlagRequiresMatchingCrs,
FlagCanRunInBackground,
FlagNoThreading,
FlagDeprecated,
};
typedef QFlags<QgsProcessingAlgorithm::Flag> Flags;
Expand Down
4 changes: 4 additions & 0 deletions python/core/processing/qgsprocessingprovider.sip.in
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
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`
%End

Expand Down
3 changes: 3 additions & 0 deletions python/core/qgis.sip.in
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 DEFAULT_SNAP_TOLERANCE;

static const int DEFAULT_SNAP_UNITS;
};


Expand Down
18 changes: 9 additions & 9 deletions python/core/qgsattributes.sip.in
Expand Up @@ -71,19 +71,20 @@ typedef QVector<QVariant> 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 );
QVariant *t;
if ( obj == Py_None )
{
t = new QVariant( QVariant::Int );
qv->append( QVariant( QVariant::Int ) );
}
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 )
{
Expand All @@ -92,11 +93,10 @@ typedef QVector<QVariant> QgsAttributes;
delete qv;
return 0;
}
}

qv->append( *t );

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

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

static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs,
const QgsCoordinateTransformContext &transformContext,
const QgsPointXY &point );
%Docstring
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
Expand Up @@ -201,12 +201,15 @@ Wrapper for iterator of features from vector data provider or vector layer

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

.. 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

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





void updateDerived();
};

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

.. 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

const QgsRectangle &extent() const;
Expand Down

0 comments on commit 3a6eac2

Please sign in to comment.