94 changes: 47 additions & 47 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions doc/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash
###########################################################################
# build.sh
# ---------------------
# Date : November 2010
# Copyright : (C) 2010 by Tim Sutton
# Email : tim dot linfiniti at com
###########################################################################
# #
# 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. #
# #
###########################################################################

txt2tags -o ../INSTALL -t txt INSTALL.t2t
txt2tags -o INSTALL.html -t html INSTALL.t2t
txt2tags -o INSTALL.tex -t tex INSTALL.t2t
Expand Down
12,591 changes: 8,387 additions & 4,204 deletions i18n/qgis_af.ts

Large diffs are not rendered by default.

12,658 changes: 8,399 additions & 4,259 deletions i18n/qgis_ar.ts

Large diffs are not rendered by default.

9,833 changes: 6,292 additions & 3,541 deletions i18n/qgis_bg.ts

Large diffs are not rendered by default.

12,614 changes: 8,370 additions & 4,244 deletions i18n/qgis_ca_ES.ts

Large diffs are not rendered by default.

12,921 changes: 9,203 additions & 3,718 deletions i18n/qgis_cs_CZ.ts

Large diffs are not rendered by default.

9,994 changes: 6,492 additions & 3,502 deletions i18n/qgis_da_DK.ts

Large diffs are not rendered by default.

2,813 changes: 1,450 additions & 1,363 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

13,048 changes: 8,831 additions & 4,217 deletions i18n/qgis_el_GR.ts

Large diffs are not rendered by default.

5,320 changes: 4,963 additions & 357 deletions i18n/qgis_es.ts

Large diffs are not rendered by default.

11,354 changes: 7,831 additions & 3,523 deletions i18n/qgis_et_EE.ts

Large diffs are not rendered by default.

12,597 changes: 8,395 additions & 4,202 deletions i18n/qgis_fa.ts

Large diffs are not rendered by default.

12,985 changes: 8,726 additions & 4,259 deletions i18n/qgis_fi.ts

Large diffs are not rendered by default.

12,927 changes: 9,197 additions & 3,730 deletions i18n/qgis_fr.ts

Large diffs are not rendered by default.

2,033 changes: 1,132 additions & 901 deletions i18n/qgis_gl_ES.ts

Large diffs are not rendered by default.

12,673 changes: 8,395 additions & 4,278 deletions i18n/qgis_he.ts

Large diffs are not rendered by default.

13,027 changes: 9,076 additions & 3,951 deletions i18n/qgis_hr_HR.ts

Large diffs are not rendered by default.

12,923 changes: 9,193 additions & 3,730 deletions i18n/qgis_hu.ts

Large diffs are not rendered by default.

12,996 changes: 9,070 additions & 3,926 deletions i18n/qgis_id.ts

Large diffs are not rendered by default.

13,026 changes: 8,848 additions & 4,178 deletions i18n/qgis_is.ts

Large diffs are not rendered by default.

12,896 changes: 9,178 additions & 3,718 deletions i18n/qgis_it.ts

Large diffs are not rendered by default.

12,908 changes: 9,193 additions & 3,715 deletions i18n/qgis_ja.ts

Large diffs are not rendered by default.

13,110 changes: 8,911 additions & 4,199 deletions i18n/qgis_ka_GE.ts

Large diffs are not rendered by default.

11,530 changes: 8,007 additions & 3,523 deletions i18n/qgis_ko_KR.ts

Large diffs are not rendered by default.

12,995 changes: 8,719 additions & 4,276 deletions i18n/qgis_lo.ts

Large diffs are not rendered by default.

12,780 changes: 8,450 additions & 4,330 deletions i18n/qgis_lt.ts

Large diffs are not rendered by default.

3,393 changes: 3,112 additions & 281 deletions i18n/qgis_lv.ts

Large diffs are not rendered by default.

13,147 changes: 8,972 additions & 4,175 deletions i18n/qgis_mn.ts

Large diffs are not rendered by default.

5,312 changes: 4,979 additions & 333 deletions i18n/qgis_nl.ts

Large diffs are not rendered by default.

12,566 changes: 8,341 additions & 4,225 deletions i18n/qgis_no.ts

Large diffs are not rendered by default.

12,915 changes: 9,201 additions & 3,714 deletions i18n/qgis_pl_PL.ts

Large diffs are not rendered by default.

12,918 changes: 9,196 additions & 3,722 deletions i18n/qgis_pt_BR.ts

Large diffs are not rendered by default.

9,008 changes: 5,492 additions & 3,516 deletions i18n/qgis_pt_PT.ts

Large diffs are not rendered by default.

12,936 changes: 8,639 additions & 4,297 deletions i18n/qgis_ro.ts

Large diffs are not rendered by default.

12,961 changes: 9,195 additions & 3,766 deletions i18n/qgis_ru.ts

Large diffs are not rendered by default.

13,030 changes: 8,888 additions & 4,142 deletions i18n/qgis_sk.ts

Large diffs are not rendered by default.

12,937 changes: 9,205 additions & 3,732 deletions i18n/qgis_sl_SI.ts

Large diffs are not rendered by default.

13,231 changes: 8,846 additions & 4,385 deletions i18n/qgis_sq_AL.ts

Large diffs are not rendered by default.

13,013 changes: 9,062 additions & 3,951 deletions i18n/qgis_sr_CS-Latn.ts

Large diffs are not rendered by default.

5,535 changes: 3,219 additions & 2,316 deletions i18n/qgis_sv.ts

Large diffs are not rendered by default.

12,560 changes: 8,338 additions & 4,222 deletions i18n/qgis_ta.ts

Large diffs are not rendered by default.

13,110 changes: 9,082 additions & 4,028 deletions i18n/qgis_th.ts

Large diffs are not rendered by default.

13,042 changes: 9,007 additions & 4,035 deletions i18n/qgis_tr.ts

Large diffs are not rendered by default.

13,040 changes: 9,037 additions & 4,003 deletions i18n/qgis_uk.ts

Large diffs are not rendered by default.

13,203 changes: 9,079 additions & 4,124 deletions i18n/qgis_vi.ts

Large diffs are not rendered by default.

12,704 changes: 8,409 additions & 4,295 deletions i18n/qgis_xh.ts

Large diffs are not rendered by default.

10,004 changes: 6,734 additions & 3,270 deletions i18n/qgis_zh_CN.ts

Large diffs are not rendered by default.

11,249 changes: 7,599 additions & 3,650 deletions i18n/qgis_zh_TW.ts

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions images/icons/mac/browser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ FILE (GLOB ICONS *.icns)
INSTALL (FILES ${ICONS}
DESTINATION "${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/QGIS Browser.app/Contents/Resources")
# create alias now, so alias file gets correct icon, delete first if it exists
SET (BROWSER_ALIAS "$ENV{DESTDIR}${QGIS_INSTALL_PREFIX}/QGIS Browser.app")
IF (EXISTS ${BROWSER_ALIAS})
FILE (REMOVE ${BROWSER_ALIAS})
ENDIF ()
# could be more than one alias if previous build failed
FILE (GLOB ALIASES "$ENV{DESTDIR}${QGIS_INSTALL_PREFIX}/QGIS Browser.app*")
FOREACH(browserAlias ${ALIASES})
FILE (REMOVE "${browserAlias}")
ENDFOREACH(browserAlias)
INSTALL (CODE "EXECUTE_PROCESS(COMMAND osascript -e \"tell application \\\"Finder\\\" to make alias file to POSIX file \\\"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/QGIS Browser.app\\\" at POSIX file \\\"$ENV{DESTDIR}${QGIS_INSTALL_PREFIX}/\\\"\")")
15 changes: 15 additions & 0 deletions mac/extras/1-release-extra.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# 1-release-extra.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy supportibng libraries (except Qt) to openModeller bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/2-release-extra-qt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# 2-release-extra-qt.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy Qt frameworks to atlas bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/3-dmg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash
###########################################################################
# 3-dmg.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################


#
# A bash script to create a dmg image file of the
Expand Down
15 changes: 15 additions & 0 deletions mac/extras/install-extra.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# install-extra.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Make all libs and plugins in qgis bundle relative to bundle
# This allows the bundle to be moved to another folder and still work

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-check.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Display all paths to supporting libraries
# Output should be visually inspected for paths which haven't been made relative (such as /usr/local)

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-extra-grass.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-extra-grass.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy GRASS supporting libraries to qgis bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-extra-py.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-extra-py.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy PyQt supporting libraries to qgis bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-extra-qt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-extra-qt.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy Qt frameworks to qgis bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-extra.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-extra.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Copy supporting libraries (except Qt) to qgis bundle
# and make search paths for them relative to bundle

Expand Down
15 changes: 15 additions & 0 deletions mac/extras/release-strip.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# release-strip.sh
# ---------------------
# Date : May 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################

# Strip all non-global symbols

PREFIX=qgis1.0.0.app/Contents/MacOS
Expand Down
15 changes: 15 additions & 0 deletions mac/xcode/bundle-template.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
###########################################################################
# bundle-template.sh
# ---------------------
# Date : March 2009
# Copyright : (C) 2009 by William Kyngesburye
# Email : kyngchaos at kyngchaos dot com
###########################################################################
# #
# 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. #
# #
###########################################################################


# bundle-template.sh
# Qgis
Expand Down
14 changes: 14 additions & 0 deletions mac/xcode/src/x_python_dummy.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/***************************************************************************
x_python_dummy.cpp
---------------------
begin : January 2010
copyright : (C) 2010 by William Kyngesburye
email : kyngchaos at kyngchaos dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************/
/*
* x_python_dummy.cpp
* Qgis
Expand Down
15 changes: 15 additions & 0 deletions ms-windows/quickpackage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash
###########################################################################
# quickpackage.sh
# ---------------------
# Date : November 2010
# Copyright : (C) 2010 by Tim Sutton
# Email : tim dot linfiniti at com
###########################################################################
# #
# 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 script is just for if you want to run the nsis (under linux) part
# of the package building process. Typically you should use
Expand Down
34 changes: 27 additions & 7 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(api)
ADD_SUBDIRECTORY(qsci_apis)

SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
SET (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis)
Expand Down Expand Up @@ -72,7 +72,7 @@ IF(PYQT4_VERSION_NUM LESS 264196) # 0x040804
ENDIF(PYQT4_VERSION_NUM LESS 264196)

# core module
FILE(GLOB sip_files_core core/*.sip)
FILE(GLOB_RECURSE sip_files_core core/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.core.api)
ADD_SIP_PYTHON_MODULE(qgis.core core/core.sip qgis_core)
Expand All @@ -87,7 +87,7 @@ INCLUDE_DIRECTORIES(
)

# gui module
FILE(GLOB sip_files_gui gui/*.sip)
FILE(GLOB_RECURSE sip_files_gui gui/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_gui})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
ADD_SIP_PYTHON_MODULE(qgis.gui gui/gui.sip qgis_core qgis_gui)
Expand All @@ -105,18 +105,39 @@ INCLUDE_DIRECTORIES(
)

# analysis module
FILE(GLOB sip_files_analysis analysis/*.sip)
FILE(GLOB sip_files_analysis
analysis/*.sip
analysis/raster/*.sip
analysis/vector/*.sip
analysis/interpolation/*.sip
)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
ADD_SIP_PYTHON_MODULE(qgis.analysis analysis/analysis.sip qgis_core qgis_analysis)

# network-analysis module
FILE(GLOB sip_files_network_analysis analysis/network/*.sip)
FILE(GLOB_RECURSE sip_files_network_analysis analysis/network/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_network_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.networkanalysis.api)
ADD_SIP_PYTHON_MODULE(qgis.networkanalysis analysis/network/networkanalysis.sip qgis_core qgis_networkanalysis)

SET (QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)

IF(WITH_QSCIAPI)
# wait until after python module builds for api files to be available
SET(QGIS_PYTHON_API_FILE "${CMAKE_BINARY_DIR}/python/qsci_apis/PyQGIS.api")
# create empty destination api file
FILE(WRITE "${QGIS_PYTHON_API_FILE}" "")

# run update/concatenate command after last python module is built (currently python_module_qgis_gui)
ADD_CUSTOM_COMMAND(TARGET python_module_qgis_gui
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/QsciAPI.cmake"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pyqgis api file" VERBATIM)

INSTALL(FILES ${QGIS_PYTHON_API_FILE} DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/qsci_apis")
ENDIF(WITH_QSCIAPI)

ADD_CUSTOM_TARGET(compile_python_files ALL)

Expand All @@ -143,4 +164,3 @@ PYTHON_INSTALL(utils.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console_sci.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(help.py ${QGIS_PYTHON_DIR})

26 changes: 23 additions & 3 deletions python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
# Copyright 2006 Quantum GIS Development team
#
# This file is a part of python bindings for Quantum GIS
# -*- coding: utf-8 -*-

"""
***************************************************************************
__init__.py
---------------------
Date : January 2007
Copyright : (C) 2007 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'January 2007'
__copyright__ = '(C) 2007, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
3 changes: 0 additions & 3 deletions python/api/CMakeLists.txt

This file was deleted.

4 changes: 2 additions & 2 deletions python/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def setLexers(self, lexer):
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
self.api = QsciAPIs(self.lexer)
self.api.loadPrepared(QString(os.path.dirname(__file__) + "/api/pyqgis_master.pap"))
self.api.loadPrepared(QString(os.path.dirname(os.path.dirname(__file__)) + "/qsci_apis/pyqgis_master.pap"))
self.setLexer(self.lexer)

## TODO: show completion list for file and directory
Expand Down Expand Up @@ -525,4 +525,4 @@ def runCommand(self, cmd):
def write(self, txt):
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
self.append(txt)
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
7 changes: 5 additions & 2 deletions python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,15 @@ class QgsRasterLayer : QgsMapLayer
virtual QStringList subLayers() const;

/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
void thumbnailAsPixmap( QPixmap * theQPixmap );
void thumbnailAsPixmap( QPixmap * theQPixmap ) /Deprecated/;

/** \brief Draws a preview of the rasterlayer into a pixmap */
QPixmap previewAsPixmap( QSize size, QColor bgColor = QColor( 255, 255, 255 ) );

/** \brief Draws a thumbnail of the rasterlayer into the supplied QImage pointer
* @note added in QGIS 1.6
* */
void thumbnailAsImage( QImage * thepImage );
/* void thumbnailAsImage( QImage * thepImage ); */

/** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
void triggerRepaint();
Expand Down
1 change: 1 addition & 0 deletions python/core/symbology-ng/qgssymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class QgsSymbolLayerV2
{
%TypeHeaderCode
#include <qgssymbollayerv2.h>
#include <qgslinesymbollayerv2.h>
%End

%ConvertToSubClassCode
Expand Down
12 changes: 12 additions & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ class QgisInterface : QObject

public slots: // TODO: do these functions really need to be slots?

/** Set the app font size
* @param fontSize point size of font
* @note added in 2.0
*/
virtual void setFontSize( int fontSize ) = 0;

/** Set the app font family
* @param fontFamily family of font (not including any style)
* @note added in 2.0
*/
virtual void setFontFamily( QString fontFamily ) = 0;

//! Zoom to full extent of map layers
virtual void zoomFull() = 0;

Expand Down
25 changes: 25 additions & 0 deletions python/help.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
help.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Salvatore Larosa
Email : lrssvtml at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Salvatore Larosa'
__date__ = 'September 2012'
__copyright__ = '(C) 2012, Salvatore Larosa'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.QtCore import *
from PyQt4.QtGui import *
Expand Down
2 changes: 0 additions & 2 deletions python/helpConsole/js/jquery-1.8.2.min.js

This file was deleted.

13 changes: 0 additions & 13 deletions python/helpConsole/js/jquery.i18n.min.js

This file was deleted.

17 changes: 17 additions & 0 deletions python/plugins/fTools/tools/doMergeShapes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
doMergeShapes.py - merge multiple shapefile into one
--------------------------------------
Date : 30-Mar-2010
Copyright : (C) 2010 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

from PyQt4.QtCore import *
from PyQt4.QtGui import *

Expand Down
30 changes: 30 additions & 0 deletions python/plugins/fTools/tools/ftools_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
# -*- coding: utf-8 -*-

#-----------------------------------------------------------
#
# fTools
# Copyright (C) 2008-2011 Carson Farmer
# EMAIL: carson.farmer (at) gmail.com
# WEB : http://www.ftools.ca/fTools.html
#
# A collection of data management and analysis tools for vector data
#
#-----------------------------------------------------------
#
# licensed under the terms of GNU GPL 2
#
# 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 program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#---------------------------------------------------------------------

# Utility functions
# -------------------------------------------------
#
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmAddRelationDlg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmAddRelationDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmAddRelationDlg
The main class of this module (OsmAddRelationDlg) is descendant of "Create OSM Relation" dialog.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmDatabaseManager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmDatabaseManager.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmDatabaseManager
This module provides methods to manipulate with database where OSM data are stored.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmDownloadDlg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmDownloadDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

# -*- coding: utf-8 -*-
"""@package OsmDownloadDlg
Module provides simple way how to download OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmFeatureDW.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmFeatureDW.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

# -*- coding: utf-8 -*-99
"""@package OsmFeatureDW
This module is descendant of "OSM Feature" dockable widget and makes user able
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmImportDlg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmImportDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

# -*- coding: utf-8 -*-
"""@package OsmImportDlg
This module is used to import OSM data from standard QGIS vector layer.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmLoadDlg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmLoadDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

# -*- coding: utf-8 -*-
"""@package OsmLoadDlg
This module provides all structures and methods necessary for OSM data loading.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/OsmSaveDlg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmSaveDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

# -*- coding: utf-8 -*-
"""@package OsmSaveDlg
This module is used to save OSM data into XML file.
Expand Down
501 changes: 263 additions & 238 deletions python/plugins/osm/OsmTags.py

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions python/plugins/osm/OsmUndoRedoDW.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmUndoRedoDW.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmUndoRedoDW
This module holds evidence of user edit actions.
Expand Down
24 changes: 24 additions & 0 deletions python/plugins/osm/OsmUploadDlg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmUploadDlg.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmUploadDlg
Module provides simple way of uploading current OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/map_tools/OsmCreateLineMT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmCreateLineMT.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmCreateLineMT
This module holds all structures and methods required to perform
"create line" operation on current OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/map_tools/OsmCreatePointMT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmCreatePointMT.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmCreatePointMT
This module holds all structures and methods required to perform
"create point" operation on current OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/map_tools/OsmCreatePolygonMT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmCreatePolygonMT.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmCreatePolygonMT
This module holds all structures and methods required to perform
"create polygon" operation on current OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/map_tools/OsmIdentifyMT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmIdentifyMT.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmIdentifyMT
This module holds all structures and methods required to perform
"identify feature" operation on current OSM data.
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/osm/map_tools/OsmMoveMT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
OsmMoveMT.py
---------------------
Date : August 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder.sk at gmail.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'August 2009'
__copyright__ = '(C) 2009, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

"""@package OsmMoveMT
This module holds all structures and methods required to perform move operation on OSM data.
Expand Down
5 changes: 5 additions & 0 deletions python/plugins/sextante/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ ADD_SUBDIRECTORY(script)
FILE(GLOB OTHER_FILES metadata.txt)
FILE(GLOB PY_FILES *.py)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)

ADD_CUSTOM_TARGET(sextante ALL DEPENDS ${PYRC_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
INSTALL(FILES ${OTHER_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
INSTALL(FILES ${PYRC_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
74 changes: 36 additions & 38 deletions python/plugins/sextante/SextantePlugin.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import os, sys
import inspect

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import *
import os, sys
import inspect

from sextante.core.Sextante import Sextante
from sextante.gui.SextanteToolbox import SextanteToolbox
from sextante.core.QGisLayers import QGisLayers
from sextante.gui.HistoryDialog import HistoryDialog
from sextante.core.SextanteUtils import SextanteUtils

from sextante.gui.SextanteToolbox import SextanteToolbox
from sextante.gui.HistoryDialog import HistoryDialog
from sextante.gui.ConfigDialog import ConfigDialog
from sextante.modeler.ModelerDialog import ModelerDialog
from sextante.gui.ResultsDialog import ResultsDialog

from sextante.modeler.ModelerDialog import ModelerDialog

from sextante.about.AboutDialog import AboutDialog
import subprocess

import resources_rc

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
Expand All @@ -32,47 +39,47 @@ def initGui(self):
Sextante.addAlgListListener(self.toolbox)

self.menu = QMenu(self.iface.mainWindow())
self.menu.setTitle("Analysis")
self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")
self.toolboxAction = QAction(icon, \
"&SEXTANTE Toolbox", self.iface.mainWindow())
self.toolboxAction = QAction(QIcon(":/sextante/images/toolbox.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Toolbox"),
self.iface.mainWindow())
QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
self.menu.addAction(self.toolboxAction)

icon = QIcon(os.path.dirname(__file__) + "/images/model.png")
self.modelerAction = QAction(icon, \
"&SEXTANTE Modeler", self.iface.mainWindow())
self.modelerAction = QAction(QIcon(":/sextante/images/model.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Modeler"),
self.iface.mainWindow())
QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
self.menu.addAction(self.modelerAction)

icon = QIcon(os.path.dirname(__file__) + "/images/history.gif")
self.historyAction = QAction(icon, \
"&SEXTANTE History and log", self.iface.mainWindow())
self.historyAction = QAction(QIcon(":/sextante/images/history.gif"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE History and log"),
self.iface.mainWindow())
QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory)
self.menu.addAction(self.historyAction)

icon = QIcon(os.path.dirname(__file__) + "/images/config.png")
self.configAction = QAction(icon, \
"&SEXTANTE options and configuration", self.iface.mainWindow())
self.configAction = QAction(QIcon(":/sextante/images/config.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
self.iface.mainWindow())
QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig)
self.menu.addAction(self.configAction)

icon = QIcon(os.path.dirname(__file__) + "/images/results.png")
self.resultsAction = QAction(icon, \
"&SEXTANTE results viewer", self.iface.mainWindow())
self.resultsAction = QAction(QIcon(":/sextante/images/results.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
self.iface.mainWindow())
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
self.menu.addAction(self.resultsAction)

icon = QIcon(os.path.dirname(__file__) + "/images/help.png")
self.helpAction = QAction(icon, \
"&SEXTANTE help", self.iface.mainWindow())
self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
self.iface.mainWindow())
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
self.menu.addAction(self.helpAction)

icon = QIcon(os.path.dirname(__file__) + "/images/info.png")
self.aboutAction = QAction(icon, \
"&About SEXTANTE", self.iface.mainWindow())
self.aboutAction = QAction(QIcon(":/sextante/images/info.png"),
QCoreApplication.translate("SEXTANTE", "&About SEXTANTE"),
self.iface.mainWindow())
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
self.menu.addAction(self.aboutAction)

Expand All @@ -92,7 +99,6 @@ def unload(self):
#leave files that could not be deleted
pass


def openToolbox(self):
self.toolbox.setVisible(True)

Expand All @@ -119,12 +125,4 @@ def openAbout(self):
dlg.exec_()

def openHelp(self):
filename = os.path.dirname(__file__) + "/help/index.html"
if os.name == "nt":
os.startfile(filename)
elif sys.platform == "darwin":
subprocess.Popen(('open', filename))
else:
subprocess.call(('xdg-open', filename))


QDesktopServices.openUrl(QUrl(os.path.dirname(__file__) + "/help/index.html"))
9 changes: 7 additions & 2 deletions python/plugins/sextante/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
def name():
return "SEXTANTE"

def description():
return "SEXTANTE Geoprocessing Platform for QGIS"

def version():
return "Version 1.0.7"
return "1.0.8"

def icon():
return "icon.png"
return "images/toolbox.png"

def qgisMinimumVersion():
return "1.0"

def classFactory(iface):
from sextante.SextantePlugin import SextantePlugin
return SextantePlugin(iface)
73 changes: 41 additions & 32 deletions python/plugins/sextante/about/AboutDialog.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
from PyQt4 import QtCore, QtGui, QtWebKit
import os

from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os

class AboutDialog(QtGui.QDialog):
from sextante.__init__ import version
from ui_aboutdialogbase import Ui_DlgAbout

import sextante.resources_rc

class AboutDialog(QDialog, Ui_DlgAbout):

def __init__(self):
QtGui.QDialog.__init__(self)
self.setModal(True)
self.setupUi()

def setupUi(self):
self.resize(600, 500)
self.webView = QtWebKit.QWebView()
self.setWindowTitle("About SEXTANTE")
self.verticalLayout= QtGui.QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.verticalLayout.addWidget(self.webView)
self.closeButton = QtGui.QPushButton()
self.closeButton.setText("Close")
self.closeButton.setMaximumWidth(150)
self.horizontalLayout= QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.addStretch(1000)
self.horizontalLayout.addWidget(self.closeButton)
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
self.verticalLayout.addLayout(self.horizontalLayout)
self.setLayout(self.verticalLayout)
filename = os.path.dirname(__file__) + "/about.htm"
url = QtCore.QUrl(filename)
self.webView.load(url)

def closeWindow(self):
self.close()
QDialog.__init__(self)
self.setupUi(self)

self.buttonBox.helpRequested.connect(self.openHelp)

self.setAboutText()

def setAboutText(self):
strAbout = self.tr("""
<img src="qrc:/sextante/images/sextante_logo.png" />
<h2>SEXTANTE for QGIS</h2>
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
<p>A development by Victor Olaya (volayaf@gmail.com).</p>
<p>Portions of this software contributed by:
<ul>
<li>Alexander Bruy</li>
<li>Carson Farmer (fTools algorithms)</li>
<li>Julien Malik (Orfeo Toolbox connectors)</li>
<li>Evgeniy Nikulin (Original Field Pyculator code)</li>
<li>Michael Nimm (mmqgis algorithms)</li>
<li>Camilo Polymeris (Threading). Developed as part of Google
Summer of Code 2012</li>
</ul>
</p>
<p>You are currently using SEXTANTE v%1</p>
<p>This software is distributed under the terms of the GNU GPL License v2.
<p>For more information, please visit our website at
<a href="http://sextantegis.com">http://sextantegis.com</a></p>
""").arg(version())
self.webView.setHtml(strAbout)

def openHelp(self):
QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/index.html"))
8 changes: 6 additions & 2 deletions python/plugins/sextante/about/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB OTHER_FILES *.htm *.png)

FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})

ADD_CUSTOM_TARGET(sextante_about ALL DEPENDS ${PYUI_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
INSTALL(FILES ${OTHER_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
INSTALL(FILES ${PYUI_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
24 changes: 0 additions & 24 deletions python/plugins/sextante/about/about.htm

This file was deleted.

86 changes: 86 additions & 0 deletions python/plugins/sextante/about/aboutdialogbase.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgAbout</class>
<widget class="QDialog" name="DlgAbout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>About SEXTANTE</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DlgAbout</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DlgAbout</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/AddTableField.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
AddTableField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterVector import ParameterVector
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/AutoincrementalField.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
AutoincrementalField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from PyQt4.QtCore import *
from qgis.core import *
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/EquivalentNumField.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
EquivalentNumField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from PyQt4.QtCore import *
from qgis.core import *
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/Explode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
Explode.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
import os.path
from PyQt4 import QtGui
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/FieldPyculator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
FieldPyculator.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterVector import ParameterVector
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/FieldsCalculator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
FieldsCalculator.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterVector import ParameterVector
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
SaveSelectedFeatures.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterVector import ParameterVector
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/SextanteAlgorithmProvider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
SextanteAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from sextante.core.AlgorithmProvider import AlgorithmProvider
from sextante.algs.AddTableField import AddTableField
from PyQt4 import QtGui
Expand Down
25 changes: 25 additions & 0 deletions python/plugins/sextante/algs/SextanteVectorWriter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
SextanteVectorWriter.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from PyQt4.QtCore import *

from qgis.core import *
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/core/AlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def getSupportedOutputVectorLayerExtensions(self):
formats = QgsVectorFileWriter.supportedFiltersAndFormats()
extensions = ["shp"]#shp is the default, should be the first
for extension in formats.keys():
extension = str(extension)
extension = unicode(extension)
extension = extension[extension.find('*.') + 2:]
extension = extension[:extension.find(" ")]
if extension.lower() != "shp":
Expand All @@ -83,4 +83,4 @@ def getSupportedOutputTableExtensions(self):
return ["dbf"]

def supportsNonFileBasedOutput(self):
return False
return False
2 changes: 1 addition & 1 deletion python/plugins/sextante/core/SextanteVectorWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, fileName, encoding, fields, geometryType, crs, options=None):
formats = QgsVectorFileWriter.supportedFiltersAndFormats()
OGRCodes = {}
for key, value in formats.items():
extension = str(key)
extension = unicode(key)
extension = extension[extension.find('*.') + 2:]
extension = extension[:extension.find(" ")]
OGRCodes[extension] = value
Expand Down
190 changes: 0 additions & 190 deletions python/plugins/sextante/ftools/BasicStatistics.py

This file was deleted.

211 changes: 211 additions & 0 deletions python/plugins/sextante/ftools/BasicStatisticsNumbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
BasicStatisticsNumbers.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'September 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os.path
import math

from PyQt4 import QtGui
from PyQt4.QtCore import *

from qgis.core import *

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.core.QGisLayers import QGisLayers

from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.parameters.ParameterBoolean import ParameterBoolean

from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputNumber import OutputNumber

from sextante.ftools import FToolsUtils as utils

class BasicStatisticsNumbers(GeoAlgorithm):

INPUT_LAYER = "INPUT_LAYER"
FIELD_NAME = "FIELD_NAME"
USE_SELECTION = "USE_SELECTION"
OUTPUT_HTML_FILE = "OUTPUT_HTML_FILE"

CV = "CV"
MIN = "MIN"
MAX = "MAX"
SUM = "SUM"
MEAN = "MEAN"
COUNT = "COUNT"
RANGE = "RANGE"
MEDIAN = "MEDIAN"
UNIQUE = "UNIQUE"
STD_DEV = "STD_DEV"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")

def defineCharacteristics(self):
self.name = "Basic statistics for numeric fields"
self.group = "Analysis tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input vector layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterTableField(self.FIELD_NAME, "Field to calculate statistics on", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterBoolean(self.USE_SELECTION, "Use selection", False))

self.addOutput(OutputHTML(self.OUTPUT_HTML_FILE, "Statistics for numeric field"))

self.addOutput(OutputNumber(self.CV, "Coefficient of Variation"))
self.addOutput(OutputNumber(self.MIN, "Minimum value"))
self.addOutput(OutputNumber(self.MAX, "Maximum value"))
self.addOutput(OutputNumber(self.SUM, "Sum"))
self.addOutput(OutputNumber(self.MEAN, "Mean value"))
self.addOutput(OutputNumber(self.COUNT, "Count"))
self.addOutput(OutputNumber(self.RANGE, "Range"))
self.addOutput(OutputNumber(self.MEDIAN, "Median"))
self.addOutput(OutputNumber(self.UNIQUE, "Number of unique values"))
self.addOutput(OutputNumber(self.STD_DEV, "Standard deviation"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)
useSelection = self.getParameterValue(self.USE_SELECTION)

outputFile = self.getOutputValue(self.OUTPUT_HTML_FILE)

index = layer.fieldNameIndex(fieldName)
layer.select([index], QgsRectangle(), False)

count = 0
rValue = 0
cvValue = 0
minValue = 0
maxValue = 0
sumValue = 0
meanValue = 0
medianValue = 0
stdDevValue = 0
uniqueValue = 0

isFirst = True
values = []

if useSelection:
selection = layer.selectedFeatures()
count = layer.selectedFeatureCount()
total = 100.0 / float(count)
current = 0

for f in selection:
value = float(f.attributeMap()[index].toDouble()[0])

if isFirst:
minValue = value
maxValue = value
isFirst = False
else:
if value < minValue:
minValue = value
if value > maxValue:
maxValue = value

values.append(value)
sumValue += value

current += 1
progress.setPercentage(int(current * total))
else:
count = layer.featureCount()
total = 100.0 / float(count)
current = 0

ft = QgsFeature()
while layer.nextFeature(ft):
value = float(ft.attributeMap()[index].toDouble()[0])

if isFirst:
minValue = value
maxValue = value
isFirst = False
else:
if value < minValue:
minValue = value
if value > maxValue:
maxValue = value

values.append( value )
sumValue += value

current += 1
progress.setPercentage(int(current * total))

# calculate additional values
rValue = maxValue - minValue
uniqueValue = utils.getUniqueValuesCount(layer, index, useSelection)

if count > 0:
meanValue = sumValue / count
if meanValue != 0.00:
for v in values:
stdDevValue += ((v - meanValue) * (v - meanValue))
stdDevValue = math.sqrt(stdDevValue / count)
cvValue = stdDevValue / meanValue

if count > 1:
tmp = values
tmp.sort()
# calculate median
if (count % 2) == 0:
medianValue = 0.5 * (tmp[(count - 1) / 2] + tmp[count / 2])
else:
medianValue = tmp[(count + 1) / 2 - 1]

data = []
data.append("Count: " + unicode(count))
data.append("Unique values: " + unicode(uniqueValue))
data.append("Minimum value: " + unicode(minValue))
data.append("Maximum value: " + unicode(maxValue))
data.append("Range: " + unicode(rValue))
data.append("Sum: " + unicode(sumValue))
data.append("Mean value: " + unicode(meanValue))
data.append("Median value: " + unicode(medianValue))
data.append("Standard deviation: " + unicode(stdDevValue))
data.append("Coefficient of Variation: " + unicode(cvValue))

self.createHTML(outputFile, data)

self.setOutputValue(self.COUNT, count)
self.setOutputValue(self.UNIQUE, uniqueValue)
self.setOutputValue(self.MIN, minValue)
self.setOutputValue(self.MAX, maxValue)
self.setOutputValue(self.RANGE, rValue)
self.setOutputValue(self.SUM, sumValue)
self.setOutputValue(self.MEAN, meanValue)
self.setOutputValue(self.MEDIAN, medianValue)
self.setOutputValue(self.STD_DEV, stdDevValue)
self.setOutputValue(self.CV, cvValue)

def createHTML(self, outputFile, algData):
f = open(outputFile, "w")
for s in algData:
f.write("<p>" + str(s) + "</p>")
f.close()
190 changes: 190 additions & 0 deletions python/plugins/sextante/ftools/BasicStatisticsStrings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
BasicStatisticsStrings.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'September 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os.path

from PyQt4 import QtGui
from PyQt4.QtCore import *

from qgis.core import *

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.core.QGisLayers import QGisLayers

from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.parameters.ParameterBoolean import ParameterBoolean

from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputNumber import OutputNumber

from sextante.ftools import FToolsUtils as utils

class BasicStatisticsStrings(GeoAlgorithm):

INPUT_LAYER = "INPUT_LAYER"
FIELD_NAME = "FIELD_NAME"
USE_SELECTION = "USE_SELECTION"
OUTPUT_HTML_FILE = "OUTPUT_HTML_FILE"

MIN_LEN = "MIN_LEN"
MAX_LEN = "MAX_LEN"
MEAN_LEN = "MEAN_LEN"
COUNT = "COUNT"
EMPTY = "EMPTY"
FILLED = "FILLED"
UNIQUE = "UNIQUE"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")

def defineCharacteristics(self):
self.name = "Basic statistics for text fields"
self.group = "Analysis tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input vector layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterTableField(self.FIELD_NAME, "Field to calculate statistics on", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_STRING))
self.addParameter(ParameterBoolean(self.USE_SELECTION, "Use selection", False))

self.addOutput(OutputHTML(self.OUTPUT_HTML_FILE, "Statistics for text field"))

self.addOutput(OutputNumber(self.MIN_LEN, "Minimum length"))
self.addOutput(OutputNumber(self.MAX_LEN, "Maximum length"))
self.addOutput(OutputNumber(self.MEAN_LEN, "Mean length"))
self.addOutput(OutputNumber(self.COUNT, "Count"))
self.addOutput(OutputNumber(self.EMPTY, "Number of empty values"))
self.addOutput(OutputNumber(self.FILLED, "Number of non-empty values"))
self.addOutput(OutputNumber(self.UNIQUE, "Number of unique values"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)
useSelection = self.getParameterValue(self.USE_SELECTION)

outputFile = self.getOutputValue(self.OUTPUT_HTML_FILE)

index = layer.fieldNameIndex(fieldName)
layer.select([index], QgsRectangle(), False)

count = 0
sumValue = 0
minValue = 0
maxValue = 0
meanValue = 0
countEmpty = 0
countFilled = 0

isFirst = True
values = []

if useSelection:
selection = layer.selectedFeatures()
count = layer.selectedFeatureCount()
total = 100.0 / float(count)
current = 0

for f in selection:
length = float(len(f.attributeMap()[index].toString()))

if isFirst:
minValue = length
maxValue = length
isFirst = False
else:
if length < minValue:
minValue = length
if length > maxValue:
maxValue = length

if length != 0.00:
countFilled += 1
else:
countEmpty += 1

values.append(length)
sumValue += length

current += 1
progress.setPercentage(int(current * total))
else:
count = layer.featureCount()
total = 100.0 / float(count)
current = 0

ft = QgsFeature()
while layer.nextFeature(ft):
length = float(len(ft.attributeMap()[index].toString()))

if isFirst:
minValue = length
maxValue = length
isFirst = False
else:
if length < minValue:
minValue = length
if length > maxValue:
maxValue = length

if length != 0.00:
countFilled += 1
else:
countEmpty += 1

values.append(length)
sumValue += length

current += 1
progress.setPercentage(int(current * total))

n = float(len(values))
if n > 0:
meanValue = sumValue / n

uniqueValues = utils.getUniqueValuesCount(layer, index, useSelection)

data = []
data.append("Minimum length: " + unicode(minValue))
data.append("Maximum length: " + unicode(maxValue))
data.append("Mean length: " + unicode(meanValue))
data.append("Filled: " + unicode(countFilled))
data.append("Empty: " + unicode(countEmpty))
data.append("Count: " + unicode(count))
data.append("Unique: " + unicode(uniqueValues))

self.createHTML(outputFile, data)

self.setOutputValue(self.MIN_LEN, minValue)
self.setOutputValue(self.MAX_LEN, maxValue)
self.setOutputValue(self.MEAN_LEN, meanValue)
self.setOutputValue(self.FILLED, countFilled)
self.setOutputValue(self.EMPTY, countEmpty)
self.setOutputValue(self.COUNT, count)
self.setOutputValue(self.UNIQUE, uniqueValues)

def createHTML(self, outputFile, algData):
f = open(outputFile, "w")
for s in algData:
f.write("<p>" + str(s) + "</p>")
f.close()
Loading