194 changes: 155 additions & 39 deletions doc/INSTALL.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
<DIV CLASS="header" ID="header">
<H1>Quantum GIS (QGIS)</H1>
<H2>Building QGIS from source - step by step</H2>
<H3>Wednesday April 04, 2012</H3>
<H3>Saturday April 07, 2012</H3>
</DIV>

<DIV CLASS="body" ID="body">
<P>
Last Updated: Wednesday April 04, 2012
Last Change : Monday December 26, 2011
Last Updated: Saturday April 07, 2012
Last Change : Saturday April 07, 2012
</P>
<DIV CLASS="toc">

Expand Down Expand Up @@ -115,8 +115,8 @@ <H3>Wednesday April 04, 2012</H3>
<UL>
<LI><A HREF="#toc18">5.1. Install Developer Tools</A>
<LI><A HREF="#toc19">5.2. Install Qt4 from disk image</A>
<LI><A HREF="#toc20">5.3. Install development frameworks for QGIS dependencies</A>
<LI><A HREF="#toc21">5.4. Install CMake for OSX</A>
<LI><A HREF="#toc20">5.3. Install CMake for OSX</A>
<LI><A HREF="#toc21">5.4. Install development frameworks for QGIS dependencies</A>
<LI><A HREF="#toc22">5.5. QGIS source</A>
<LI><A HREF="#toc23">5.6. Configure the build</A>
<LI><A HREF="#toc24">5.7. Building</A>
Expand Down Expand Up @@ -1775,7 +1775,30 @@ <H2>5.2. Install Qt4 from disk image</H2>
</P>

<A NAME="toc20"></A>
<H2>5.3. Install development frameworks for QGIS dependencies</H2>
<H2>5.3. Install CMake for OSX</H2>

<P>
Get the latest source release from here:
</P>
<P>
<A HREF="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</A>
</P>
<P>
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source.
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
Double-click the source tarball, then cd to the source folder and:
</P>

<div class="code"><PRE>
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make
sudo make install
</PRE></div>

<A NAME="toc21"></A>
<H2>5.4. Install development frameworks for QGIS dependencies</H2>

<P>
Download William Kyngesburye's excellent GDAL Complete package that includes
Expand Down Expand Up @@ -1808,7 +1831,7 @@ <H2>5.3. Install development frameworks for QGIS dependencies</H2>
software archive section.
</P>

<H3>5.3.1. Additional Dependencies: General compatibility note</H3>
<H3>5.4.1. Additional Dependencies: General compatibility note</H3>

<P>
There are some additional dependencies that, at the time of writing, are not
Expand All @@ -1824,7 +1847,7 @@ <H3>5.3.1. Additional Dependencies: General compatibility note</H3>
have problems and you are on your own with those.
</P>

<H3>5.3.2. Additional Dependencies: Expat</H3>
<H3>5.4.2. Additional Dependencies: Expat</H3>

<P>
<U>Snow Leopard+ note:</U> Snow Leopard includes a usable expat, so this step is
Expand All @@ -1847,7 +1870,7 @@ <H3>5.3.2. Additional Dependencies: Expat</H3>
sudo make install
</PRE></div>

<H3>5.3.3. Additional Dependencies: Python</H3>
<H3>5.4.3. Additional Dependencies: Python</H3>

<P>
<U>Leopard+ note:</U> Starting with Leopard a usable Python is included
Expand All @@ -1867,7 +1890,7 @@ <H3>5.3.3. Additional Dependencies: Python</H3>
your own risk.
</P>

<H3>5.3.4. Additional Dependencies: SIP</H3>
<H3>5.4.4. Additional Dependencies: SIP</H3>

<P>
Retrieve the python bindings toolkit SIP from
Expand Down Expand Up @@ -1956,7 +1979,7 @@ <H3>5.3.4. Additional Dependencies: SIP</H3>
sudo make install
</PRE></div>

<H3>5.3.5. Additional Dependencies: PyQt</H3>
<H3>5.4.5. Additional Dependencies: PyQt</H3>

<P>
Retrieve the python bindings toolkit for Qt from
Expand Down Expand Up @@ -2042,7 +2065,7 @@ <H3>5.3.5. Additional Dependencies: PyQt</H3>
Then make again.
</P>

<H3>5.3.6. Additional Dependencies: Qwt</H3>
<H3>5.4.6. Additional Dependencies: Qwt</H3>

<P>
The GPS tracking feature uses Qwt.
Expand Down Expand Up @@ -2077,7 +2100,7 @@ <H3>5.3.6. Additional Dependencies: Qwt</H3>
the minor.point version). Remember this for QGIS configuration.
</P>

<H3>5.3.7. Additional Dependencies: Bison</H3>
<H3>5.4.7. Additional Dependencies: Bison</H3>

<P>
The version of bison available by default on Mac OS X is too old so you
Expand All @@ -2099,29 +2122,122 @@ <H3>5.3.7. Additional Dependencies: Bison</H3>
sudo make install
</PRE></div>

<A NAME="toc21"></A>
<H2>5.4. Install CMake for OSX</H2>
<H3>5.4.8. Additional Dependencies: OSG &amp; osgEarth</H3>

<P>
Get the latest source release from here:
If you want the Globe plugin in QGIS (default OFF), OSG and osgEarth are needed.
</P>
<P>
<A HREF="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</A>
First, <B>OpenSceneGraph</B>. The main site is:
</P>
<P>
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source.
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
Double-click the source tarball, then cd to the source folder and:
<A HREF="http://www.openscenegraph.org/">http://www.openscenegraph.org/</A>
</P>
<P>
Get the tarball (or zip) for the the latest 3.x version.
Binary availability is unknown at this time as the site is down.
</P>
<P>
Another place to get the source is github:
</P>
<P>
<A HREF="http://github.com/openscenegraph/osg/tags">http://github.com/openscenegraph/osg/tags</A>
</P>
<P>
Download the latest 3.1 version (you can select a tarball when you hover over
the entry). Double-click the source tarball to unpack it.
(There is a version numbering oddity in the source, but since we'll be
bundling OSG as it's meant to be, it really doesn't matter).
</P>
<P>
Installation is a bit out of touch with OS X standards, so we'll stage it to a
temporary location first. You could stage it to the folder that the OSG source
folder is in, or a common staging area like /Users/Shared/unix/osg. Pick a
folder not hidden and that doesn't need admin permissions to write to for simplicity.
</P>
<P>
In a new Terminal cd to the source folder and:
</P>

<div class="code"><PRE>
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D OSG_COMPILE_FRAMEWORKS=ON \
-D OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS=OFF \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/PlugIns"
</PRE></div>

<P>
Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.
</P>
<P>
Now move all .frameworks from the lib/ folder in the staging area to /Library/Frameworks. Move the files in the osgPlugins folder in the lib/ folder
to /Library/Application Support/OpenSceneGraph/PlugIns. The bin/ executables
can be left where they are, we don't need them.
</P>
<P>
Next up is <B>libzip</B>. Get the latest tarball at:
</P>
<P>
<A HREF="http://nih.at/libzip/">http://nih.at/libzip/</A>
</P>
<P>
Double-click the source tarball to unpack it.
In a new Terminal cd to the source folder and:
</P>

<div class="code"><PRE>
./configure --disable-dependency-tracking --disable-shared CFLAGS=-Os
make
sudo make install
</PRE></div>

<P>
Then it's time for <B>osgEarth</B>. Downloads are also on github:
</P>
<P>
<A HREF="http://github.com/gwaldron/osgearth/tags">http://github.com/gwaldron/osgearth/tags</A>
</P>
<P>
Download a tarball for the latest stable release (sorting can be confusing here).
Double-click the source tarball to unpack it.
</P>
<P>
This one also needs an intermediate staging area. Choose a folder similar to OSG.
</P>
<P>
In a new Terminal cd to the source folder and:
</P>

<div class="code"><PRE>
mkdir build
cd build
export PATH="/path/to/osg/staging/folder/bin:$PATH"
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D OSGEARTH_BUILD_FRAMEWORKS=true \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/Headers"
</PRE></div>

<P>
Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.
Also enter the OSG staging path /bin folder in the export above.
</P>
<P>
Move all the .frameworks from the lib/ folder to /Library/Frameworks.
Move the files in the osgPlugins folder in the lib/ folder to
/Library/Application Support/OpenSceneGraph/PlugIns. Move the osgEarthDrivers
folder in the include/ folder to /Library/Application Support/OpenSceneGraph/Headers. And as for OSG, you can leave the bin/
executables where they are.
</P>

<A NAME="toc22"></A>
<H2>5.5. QGIS source</H2>

Expand Down Expand Up @@ -2162,8 +2278,8 @@ <H2>5.6. Configure the build</H2>
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D CMAKE_BUILD_TYPE=MinSizeRel -D ENABLE_TESTS=FALSE \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_PYSPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.2/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.2/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
Expand All @@ -2189,8 +2305,8 @@ <H2>5.6. Configure the build</H2>
sudo chmod +x /usr/local/bin/python32

cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D CMAKE_BUILD_TYPE=MinSizeRel -D ENABLE_TESTS=FALSE \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_PYSPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
Expand All @@ -2199,7 +2315,7 @@ <H2>5.6. Configure the build</H2>
</PRE></div>

<P>
The QGIS Mapserver feature requires fastcgi support. This is included in
The QGIS <B>Mapserver</B> feature requires fastcgi support. This is included in
Leopard and Snow Leopard, but was dropped at Lion. To build the Mapserver
component on Leopard and Snow, add the followling line before the last line in
the above configuration:
Expand All @@ -2214,24 +2330,24 @@ <H2>5.6. Configure the build</H2>
support to the system Apache. Not recommended for the average user.
</P>
<P>
<U>Bundling note:</U> Older Qt versions may have problems with some Qt plugins and
QGIS. The way to handle this is to bundle Qt inside the QGIS application. You
can do this now or wait to see if there are immediate crashes when running QGIS.
It's also a good idea to bundle Qt if you need to copy QGIS to other Macs (where
you would have to install Xcode just so Qt would install!).
</P>
<P>
To bundle Qt, add the following line before the last line (the ".." line) in
the above cmake configurations:
If you want the <B>Globe</B> plugin (and you compiled and installed OSG/osgEarth),
add the following lines before the last line in the above configuration:
</P>

<div class="code"><PRE>
-D QGIS_MACAPP_BUNDLE=1 \
-D WITH_GLOBE=true \
-D OSGEARTH_INCLUDE_DIR="/Library/Application Support/OpenSceneGraph/Headers" \
-D OSG_PLUGINS_PATH="/Library/Application Support/OpenSceneGraph/PlugIns" \
</PRE></div>

<P>
<U>Bundling note:</U> Older Qt versions may have problems with some Qt plugins and
QGIS. The way to handle this is to bundle Qt inside the QGIS application. The
default is to bundle Qt (and osg/osgEarth, if configured).
</P>
<P>
Even better for distribution purposes, to also bundle any extra non-framework,
non-standard, libs (ie postgres' libpq) bump the bundle number to 2:
non-standard, libs (ie postgres' libpq) set the bundle value to 2:
</P>

<div class="code"><PRE>
Expand Down
145 changes: 120 additions & 25 deletions doc/osx.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ may need some help by adding '-L/usr/local/lib' to CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS in the cmake build.


== Install CMake for OSX ==

Get the latest source release from here:

http://www.cmake.org/cmake/resources/software.html

Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source.
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
Double-click the source tarball, then cd to the source folder and:

```
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make
sudo make install
```


== Install development frameworks for QGIS dependencies ==

Download William Kyngesburye's excellent GDAL Complete package that includes
Expand Down Expand Up @@ -352,24 +371,100 @@ make
sudo make install
```

== Install CMake for OSX ==
=== Additional Dependencies: OSG & osgEarth ===

Get the latest source release from here:
If you want the Globe plugin in QGIS (default OFF), OSG and osgEarth are needed.

http://www.cmake.org/cmake/resources/software.html
First, **OpenSceneGraph**. The main site is:

Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source.
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
Double-click the source tarball, then cd to the source folder and:
http://www.openscenegraph.org/

```
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
Get the tarball (or zip) for the the latest 3.x version.
Binary availability is unknown at this time as the site is down.

Another place to get the source is github:

http://github.com/openscenegraph/osg/tags

Download the latest 3.1 version (you can select a tarball when you hover over
the entry). Double-click the source tarball to unpack it.
(There is a version numbering oddity in the source, but since we'll be
bundling OSG as it's meant to be, it really doesn't matter).

Installation is a bit out of touch with OS X standards, so we'll stage it to a
temporary location first. You could stage it to the folder that the OSG source
folder is in, or a common staging area like /Users/Shared/unix/osg. Pick a
folder not hidden and that doesn't need admin permissions to write to for simplicity.

In a new Terminal cd to the source folder and:

```
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D OSG_COMPILE_FRAMEWORKS=ON \
-D OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS=OFF \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/PlugIns"
```

Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.

Now move all .frameworks from the lib/ folder in the staging area to /Library/Frameworks. Move the files in the osgPlugins folder in the lib/ folder
to /Library/Application Support/OpenSceneGraph/PlugIns. The bin/ executables
can be left where they are, we don't need them.


Next up is **libzip**. Get the latest tarball at:

http://nih.at/libzip/

Double-click the source tarball to unpack it.
In a new Terminal cd to the source folder and:

```
./configure --disable-dependency-tracking --disable-shared CFLAGS=-Os
make
sudo make install
```


Then it's time for **osgEarth**. Downloads are also on github:

http://github.com/gwaldron/osgearth/tags

Download a tarball for the latest stable release (sorting can be confusing here).
Double-click the source tarball to unpack it.

This one also needs an intermediate staging area. Choose a folder similar to OSG.

In a new Terminal cd to the source folder and:

```
mkdir build
cd build
export PATH="/path/to/osg/staging/folder/bin:$PATH"
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D OSGEARTH_BUILD_FRAMEWORKS=true \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/Headers"
```

Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.
Also enter the OSG staging path /bin folder in the export above.

Move all the .frameworks from the lib/ folder to /Library/Frameworks.
Move the files in the osgPlugins folder in the lib/ folder to
/Library/Application Support/OpenSceneGraph/PlugIns. Move the osgEarthDrivers
folder in the include/ folder to /Library/Application Support/OpenSceneGraph/Headers. And as for OSG, you can leave the bin/
executables where they are.


== QGIS source ==

Unzip the QGIS source tarball to a working folder of your choice
Expand Down Expand Up @@ -400,8 +495,8 @@ In a Terminal cd to the qgis source folder previously downloaded, then:
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D CMAKE_BUILD_TYPE=MinSizeRel -D ENABLE_TESTS=FALSE \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_PYSPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.2/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.2/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
Expand All @@ -424,16 +519,16 @@ EOF
sudo chmod +x /usr/local/bin/python32

cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D CMAKE_BUILD_TYPE=MinSizeRel -D ENABLE_TESTS=FALSE \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_PYSPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
-D CMAKE_OSX_ARCHITECTURES=i386 -D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
..
```

The QGIS Mapserver feature requires fastcgi support. This is included in
The QGIS **Mapserver** feature requires fastcgi support. This is included in
Leopard and Snow Leopard, but was dropped at Lion. To build the Mapserver
component on Leopard and Snow, add the followling line before the last line in
the above configuration:
Expand All @@ -445,21 +540,21 @@ the above configuration:
On Lion you are on your own to figure out how to install libfcgi and add fcgi
support to the system Apache. Not recommended for the average user.

__Bundling note:__ Older Qt versions may have problems with some Qt plugins and
QGIS. The way to handle this is to bundle Qt inside the QGIS application. You
can do this now or wait to see if there are immediate crashes when running QGIS.
It's also a good idea to bundle Qt if you need to copy QGIS to other Macs (where
you would have to install Xcode just so Qt would install!).

To bundle Qt, add the following line before the last line (the ".." line) in
the above cmake configurations:
If you want the **Globe** plugin (and you compiled and installed OSG/osgEarth),
add the following lines before the last line in the above configuration:

```
-D QGIS_MACAPP_BUNDLE=1 \
-D WITH_GLOBE=true \
-D OSGEARTH_INCLUDE_DIR="/Library/Application Support/OpenSceneGraph/Headers" \
-D OSG_PLUGINS_PATH="/Library/Application Support/OpenSceneGraph/PlugIns" \
```

__Bundling note:__ Older Qt versions may have problems with some Qt plugins and
QGIS. The way to handle this is to bundle Qt inside the QGIS application. The
default is to bundle Qt (and osg/osgEarth, if configured).

Even better for distribution purposes, to also bundle any extra non-framework,
non-standard, libs (ie postgres' libpq) bump the bundle number to 2:
non-standard, libs (ie postgres' libpq) set the bundle value to 2:

```
-D QGIS_MACAPP_BUNDLE=2 \
Expand Down
3 changes: 3 additions & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,10 @@
<file>themes/gis/mIconMssql.png</file>
<file>themes/gis/mIconConnect.png</file>
<file>themes/gis/mIconDbSchema.png</file>
<file>themes/gis/mActionTouch.png</file>
<file>themes/default/mActionAddMssqlLayer.png</file>
<file>themes/default/mActionTouch.png</file>
<file>themes/classic/mActionTouch.png</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
Binary file added images/themes/classic/mActionTouch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/mActionTouch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/gis/mActionTouch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions mac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ IF (APPLE)
# start with Qt
CONFIGURE_FILE (cmake/1qt.cmake.in 1qt.cmake @ONLY)
INSTALL (SCRIPT ${CMAKE_BINARY_DIR}/mac/1qt.cmake)
CONFIGURE_FILE (cmake/1osg.cmake.in 1osg.cmake @ONLY)
INSTALL (SCRIPT ${CMAKE_BINARY_DIR}/mac/1osg.cmake)
IF (QGIS_MACAPP_BUNDLE GREATER 1)
# next - libs
CONFIGURE_FILE (cmake/2lib.cmake.in 2lib.cmake @ONLY)
Expand Down
79 changes: 79 additions & 0 deletions mac/cmake/1osg.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# 1osg - bundle OSG & osgEarth frameworks
# ! cmakecache vars not available to external scripts
# so we configure it first to do substitutions
# make sure to use @varname@

# kill boolean warnings
CMAKE_POLICY (SET CMP0012 NEW)

IF (@OSGEARTH_FOUND@)

INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake)
INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

SET (OSG_PLUGINS_PATH "@OSG_PLUGINS_PATH@")

# list of osg frameworks to bundle

SET (OSGLIST OpenThreads osg osgDB osgGA osgViewer osgEarth osgEarthAnnotation osgEarthFeatures osgEarthSymbology osgEarthUtil osgFX osgManipulator osgShadow osgSim osgTerrain osgText osgUtil osgWidget)
#SET (PYOSGLIST future python bindings?)
MYMESSAGE ("OSG list: ${OSGLIST}")

# extract OSG framework path from OSGEARTH_LIBRARY, assume all in same prefix

STRING (REPLACE "/osgEarth.framework" "" OSG_FW_DIR "@OSGEARTH_LIBRARY@")

### copy OSG

MESSAGE (STATUS "Copying OSG and osgEarth...")

# osg frameworks
FOREACH (OFW ${OSGLIST})
IF (NOT IS_DIRECTORY "${QFWDIR}/${OFW}.framework")
COPY_FRAMEWORK("${OSG_FW_DIR}" ${OFW} "${QFWDIR}")
ENDIF ()
ENDFOREACH (OFW)

# osg plugins

IF (OSG_PLUGINS_PATH)
FILE (GLOB OSGPLUGLIST RELATIVE ${OSG_PLUGINS_PATH} ${OSG_PLUGINS_PATH}/*.so)
EXECUTE_PROCESS (COMMAND mkdir -p "${QPLUGDIR}/../osgPlugins")
FOREACH (OP ${OSGPLUGLIST})
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "${OSG_PLUGINS_PATH}/${OP}" "${QPLUGDIR}/../osgPlugins/${OP}")
ENDFOREACH (OP)
ENDIF ()

# update lib paths

MESSAGE (STATUS "Updating OSG library paths...")

FOREACH (OFW ${OSGLIST})
# get install names from installed in case bundled copy already changed
# from a previous install attempt
GET_INSTALL_NAME ("${OSG_FW_DIR}/${OFW}.framework/${OFW}" ${OFW}.framework OO)
SET (OFW_CHG "${OO}")
SET (OFW_CHG_TO "${ATEXECUTABLE}/@QGIS_FW_SUBDIR@/${OFW}.framework/${OFW}")
# qgis app
INSTALLNAMETOOL_CHANGE ("${OFW_CHG}" "${OFW_CHG_TO}" "${QAPPDIR}/${QGIS_APP_NAME}")

SET (LIBPOST "${OFW}.framework/${OFW}")
# osg frameworks
IF (@OSX_HAVE_LOADERPATH@)
SET (OFW_CHG_TO "${ATLOADER}/../../../${LIBPOST}")
ENDIF ()
FOREACH (OF ${OSGLIST})
INSTALLNAMETOOL_CHANGE ("${OFW_CHG}" "${OFW_CHG_TO}" "${QFWDIR}/${OF}.framework/${OF}")
ENDFOREACH (OF)
# osg plugins
IF (@OSX_HAVE_LOADERPATH@)
SET (OFW_CHG_TO "${ATLOADER}/@QGIS_PLUGIN_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${LIBPOST}")
ENDIF ()
FOREACH (OP ${OSGPLUGLIST})
INSTALLNAMETOOL_CHANGE ("${OFW_CHG}" "${OFW_CHG_TO}" "${QPLUGDIR}/../osgPlugins/${OP}")
ENDFOREACH (OP)
# globe plugin
INSTALLNAMETOOL_CHANGE ("${OFW_CHG}" "${OFW_CHG_TO}" "${QPLUGDIR}/libglobeplugin.so")
ENDFOREACH (OFW)

ENDIF (@OSGEARTH_FOUND@)
69 changes: 37 additions & 32 deletions mac/cmake/1qt.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ ENDFOREACH (QFW)

# Qt plugins

EXECUTE_PROCESS (COMMAND mkdir -p "${QAPPDIRC}/PlugIns/imageformats")
IF (NOT EXISTS "${QAPPDIRC}/PlugIns/imageformats/libqjpeg.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/imageformats/libqjpeg.dylib" "${QAPPDIRC}/PlugIns/imageformats/libqjpeg.dylib")
EXECUTE_PROCESS (COMMAND mkdir -p "${QPLUGDIR}/../imageformats")
IF (NOT EXISTS "${QPLUGDIR}/../imageformats/libqjpeg.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/imageformats/libqjpeg.dylib" "${QPLUGDIR}/../imageformats/libqjpeg.dylib")
ENDIF ()
EXECUTE_PROCESS (COMMAND mkdir -p "${QAPPDIRC}/PlugIns/codecs")
EXECUTE_PROCESS (COMMAND mkdir -p "${QPLUGDIR}/../codecs")
FOREACH (QTC cn;jp;kr;tw)
IF (NOT EXISTS "${QAPPDIRC}/PlugIns/codecs/libq${QTC}codecs.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/codecs/libq${QTC}codecs.dylib" "${QAPPDIRC}/PlugIns/codecs/libq${QTC}codecs.dylib")
IF (NOT EXISTS "${QPLUGDIR}/../codecs/libq${QTC}codecs.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/codecs/libq${QTC}codecs.dylib" "${QPLUGDIR}/../codecs/libq${QTC}codecs.dylib")
ENDIF ()
ENDFOREACH (QTC)
EXECUTE_PROCESS (COMMAND mkdir -p "${QAPPDIRC}/PlugIns/sqldrivers")
IF (NOT EXISTS "${QAPPDIRC}/PlugIns/sqldrivers/libqsqlite.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/sqldrivers/libqsqlite.dylib" "${QAPPDIRC}/PlugIns/sqldrivers/libqsqlite.dylib")
EXECUTE_PROCESS (COMMAND mkdir -p "${QPLUGDIR}/../sqldrivers")
IF (NOT EXISTS "${QPLUGDIR}/../sqldrivers/libqsqlite.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QT_PLUGINS_DIR@/sqldrivers/libqsqlite.dylib" "${QPLUGDIR}/../sqldrivers/libqsqlite.dylib")
ENDIF ()

# Qwt
Expand Down Expand Up @@ -122,27 +122,30 @@ IF (NOT EXISTS "${QBINDIR}/pyuic4")
ENDIF ()

# PyQwt
# only if it's available, not compatible with newer PyQt

MESSAGE (STATUS "Copying PyQwt and updating library paths...")
EXECUTE_PROCESS (COMMAND mkdir -p "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5")
IF (NOT EXISTS "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/_iqt.so")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/_iqt.so" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
ENDIF ()
IF (NOT EXISTS "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/Qwt.so")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/Qwt.so" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
IF (EXISTS "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/_iqt.so")
MESSAGE (STATUS "Copying PyQwt and updating library paths...")
EXECUTE_PROCESS (COMMAND mkdir -p "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5")
IF (NOT EXISTS "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/_iqt.so")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/_iqt.so" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
ENDIF ()
IF (NOT EXISTS "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/Qwt.so")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/Qwt.so" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
ENDIF ()
FILE (GLOB PQWPYLIST "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/*.py")
FOREACH (PQWPY ${PQWPYLIST})
EXECUTE_PROCESS (COMMAND cp -fp "${PQWPY}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
ENDFOREACH (PQWPY)
IF (QWT_CHG)
IF (@OSX_HAVE_LOADERPATH@)
SET (QWT_CHG_TO "${ATLOADER}/../../../@QGIS_DATA_SUBDIR_REV@/@QGIS_LIB_SUBDIR@/libqwt.dylib")
ENDIF (@OSX_HAVE_LOADERPATH@)
FOREACH (PW _iqt;Qwt)
INSTALLNAMETOOL_CHANGE ("${QWT_CHG}" "${QWT_CHG_TO}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/${PW}.so")
ENDFOREACH (PW)
ENDIF (QWT_CHG)
ENDIF ()
FILE (GLOB PQWPYLIST "@SIP_MOD_DIR@/PyQt${QT_FWVER}/Qwt5/*.py")
FOREACH (PQWPY ${PQWPYLIST})
EXECUTE_PROCESS (COMMAND cp -fp "${PQWPY}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/")
ENDFOREACH (PQWPY)
IF (QWT_CHG)
IF (@OSX_HAVE_LOADERPATH@)
SET (QWT_CHG_TO "${ATLOADER}/../../../@QGIS_DATA_SUBDIR_REV@/@QGIS_LIB_SUBDIR@/libqwt.dylib")
ENDIF (@OSX_HAVE_LOADERPATH@)
FOREACH (PW _iqt;Qwt)
INSTALLNAMETOOL_CHANGE ("${QWT_CHG}" "${QWT_CHG_TO}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/${PW}.so")
ENDFOREACH (PW)
ENDIF (QWT_CHG)

# don't load plugins from system-installed Qt
FILE (WRITE "${QAPPDIRC}/Resources/qt.conf" "")
Expand Down Expand Up @@ -172,11 +175,11 @@ FOREACH (QFW ${QTLISTQG})
IF (@OSX_HAVE_LOADERPATH@)
SET (QFW_CHG_TO "${ATLOADER}/@QGIS_PLUGIN_SUBDIR_REV@/${QGIS_FW_SUBDIR}/${LIBPOST}")
ENDIF ()
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QAPPDIRC}/PlugIns/imageformats/libqjpeg.dylib")
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QPLUGDIR}/../imageformats/libqjpeg.dylib")
FOREACH (QC cn;jp;kr;tw)
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QAPPDIRC}/PlugIns/codecs/libq${QC}codecs.dylib")
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QPLUGDIR}/../codecs/libq${QC}codecs.dylib")
ENDFOREACH (QC)
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QAPPDIRC}/PlugIns/sqldrivers/libqsqlite.dylib")
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QPLUGDIR}/../sqldrivers/libqsqlite.dylib")
# qt fw
IF (@OSX_HAVE_LOADERPATH@)
SET (QFW_CHG_TO "${ATLOADER}/../../../${LIBPOST}")
Expand All @@ -196,7 +199,9 @@ FOREACH (QFW ${QTLISTQG})
SET (QFW_CHG_TO "${ATLOADER}/../../../@QGIS_DATA_SUBDIR_REV@/${QGIS_FW_SUBDIR}/${LIBPOST}")
ENDIF ()
FOREACH (PW _iqt;Qwt)
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/${PW}.so")
IF (EXISTS "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/${PW}.so")
INSTALLNAMETOOL_CHANGE ("${QFW_CHG}" "${QFW_CHG_TO}" "${QGISPYDIR}/PyQt${QT_FWVER}/Qwt5/${PW}.so")
ENDIF ()
ENDFOREACH (PW)
# bin - PyQt utils
SET (QFW_CHG_TO "${ATEXECUTABLE}/@QGIS_BIN_SUBDIR_REV@/${QGIS_FW_SUBDIR}/${LIBPOST}")
Expand Down
1 change: 1 addition & 0 deletions ms-windows/python_plugins.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

WriteRegStr HKEY_CURRENT_USER "Software\QuantumGIS\QGIS\PythonPlugins" "plugin_installer" "true"
WriteRegStr HKEY_CURRENT_USER "Software\QuantumGIS\QGIS\PythonPlugins" "fTools" "true"
WriteRegStr HKEY_CURRENT_USER "Software\QuantumGIS\QGIS\PythonPlugins" "GdalTools" "true"
WriteRegStr HKEY_CURRENT_USER "Software\QuantumGIS\QGIS\PythonPlugins" "mapserver_export" "true"

############################### reg2nsis end #################################
15 changes: 11 additions & 4 deletions python/plugins/fTools/tools/doDefineProj.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ def updateProj1(self, layerName):
self.inRef.clear()
tempLayer = ftools_utils.getVectorLayerByName(layerName)
crs = tempLayer.dataProvider().crs()
self.inRef.insert(crs.authid() + " - " + crs.description())
if crs.isValid():
self.inRef.insert(crs.authid() + " - " + crs.description())
else:
self.inRef.insert( self.tr( "Missing or invalid CRS" ) )

def updateProj2(self, layerName):
self.outRef.clear()
tempLayer = ftools_utils.getVectorLayerByName(layerName)
crs = tempLayer.dataProvider().crs()
self.outRef.insert(crs.authid() + " - " + crs.description())
if crs.isValid():
self.outRef.insert(crs.authid() + " - " + crs.description())
else:
self.outRef.insert( self.tr( "Missing or invalid CRS" ) )

def accept(self):
self.buttonOk.setEnabled( False )
Expand All @@ -90,8 +96,9 @@ def accept(self):
else:
srsDefine = QgsCoordinateReferenceSystem()
if self.rdoProjection.isChecked():
outProj = self.txtProjection.text()
srsDefine.createFromProj4(outProj)
outProj = self.txtProjection.text().split( " - " )[ 0 ]
#srsDefine.createFromProj4(outProj)
srsDefine.createFromString(outProj)
else:
destLayer = ftools_utils.getVectorLayerByName(self.cmbLayer.currentText())
srsDefine = destLayer.crs()
Expand Down
99 changes: 78 additions & 21 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ extern "C"
#include <windows.h>
#endif

#ifdef HAVE_TOUCH
#include "qgsmaptooltouch.h"
#endif

class QTreeWidgetItem;


Expand Down Expand Up @@ -317,14 +321,24 @@ static QgsMessageOutput *messageOutputViewer_()
return new QgsMessageViewer( QgisApp::instance() );
}

static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
{
QgisApp::instance()->emitCustomSrsValidation( srs );
}

void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
{
emit customSrsValidation( srs );
}

/**
* This function contains forced validation of CRS used in QGIS.
* There are 3 options depending on the settings:
* - ask for CRS using projection selecter
* - use project's CRS
* - use predefined global CRS
*/
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
{
static QString authid = QString::null;
QSettings mySettings;
Expand Down Expand Up @@ -510,6 +524,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QgsMessageLog::logMessage( tr( "QGIS starting..." ) );

// set QGIS specific srs validation
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) );
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );

// set graphical message output
Expand Down Expand Up @@ -626,7 +642,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
// request notification of FileOpen events (double clicking a file icon in Mac OS X Finder)
QgsApplication::setFileOpenEventReceiver( this );

#ifdef ANDROID
#ifdef HAVE_TOUCH
//add reacting to long click in android
grabGesture( Qt::TapAndHoldGesture );
#endif
Expand All @@ -646,6 +662,9 @@ QgisApp::~QgisApp()
delete mMapTools.mZoomIn;
delete mMapTools.mZoomOut;
delete mMapTools.mPan;
#ifdef HAVE_TOUCH
delete mMapTools.mTouch;
#endif
delete mMapTools.mIdentify;
delete mMapTools.mFeatureAction;
delete mMapTools.mMeasureDist;
Expand Down Expand Up @@ -741,8 +760,8 @@ bool QgisApp::event( QEvent * event )
openFile( foe->file() );
done = true;
}
#ifdef ANDROID
else if ( event->type() == QEvent::Gesture )
#ifdef HAVE_TOUCH
else if (event->type() == QEvent::Gesture )
{
done = gestureEvent( static_cast<QGestureEvent*>( event ) );
}
Expand Down Expand Up @@ -820,6 +839,9 @@ void QgisApp::createActions()

// View Menu Items

#ifdef HAVE_TOUCH
connect( mActionTouch, SIGNAL( triggered() ), this, SLOT( touch() ) );
#endif
connect( mActionPan, SIGNAL( triggered() ), this, SLOT( pan() ) );
connect( mActionPanToSelected, SIGNAL( triggered() ), this, SLOT( panToSelected() ) );
connect( mActionZoomIn, SIGNAL( triggered() ), this, SLOT( zoomIn() ) );
Expand Down Expand Up @@ -1009,6 +1031,9 @@ void QgisApp::createActionGroups()
//
// Map Tool Group
mMapToolGroup = new QActionGroup( this );
#ifdef HAVE_TOUCH
mMapToolGroup->addAction( mActionTouch );
#endif
mMapToolGroup->addAction( mActionPan );
mMapToolGroup->addAction( mActionZoomIn );
mMapToolGroup->addAction( mActionZoomOut );
Expand Down Expand Up @@ -1520,6 +1545,9 @@ void QgisApp::setTheme( QString theThemeName )
mActionZoomOut->setIcon( getThemeIcon( "/mActionZoomOut.png" ) );
mActionZoomFullExtent->setIcon( getThemeIcon( "/mActionZoomFullExtent.png" ) );
mActionZoomToSelected->setIcon( getThemeIcon( "/mActionZoomToSelected.png" ) );
#ifdef HAVE_TOUCH
mActionTouch->setIcon( getThemeIcon( "/mActionTouch.png" ) );
#endif
mActionPan->setIcon( getThemeIcon( "/mActionPan.png" ) );
mActionZoomLast->setIcon( getThemeIcon( "/mActionZoomLast.png" ) );
mActionZoomNext->setIcon( getThemeIcon( "/mActionZoomNext.png" ) );
Expand Down Expand Up @@ -1652,6 +1680,10 @@ void QgisApp::createCanvasTools()
mMapTools.mZoomOut->setAction( mActionZoomOut );
mMapTools.mPan = new QgsMapToolPan( mMapCanvas );
mMapTools.mPan->setAction( mActionPan );
#ifdef HAVE_TOUCH
mMapTools.mTouch = new QgsMapToolTouch( mMapCanvas );
mMapTools.mTouch->setAction( mActionTouch );
#endif
mMapTools.mIdentify = new QgsMapToolIdentify( mMapCanvas );
mMapTools.mIdentify->setAction( mActionIdentify );
mMapTools.mFeatureAction = new QgsMapToolFeatureAction( mMapCanvas );
Expand Down Expand Up @@ -1717,6 +1749,9 @@ void QgisApp::createCanvasTools()
mMapTools.mChangeLabelProperties->setAction( mActionChangeLabelProperties );
//ensure that non edit tool is initialised or we will get crashes in some situations
mNonEditMapTool = mMapTools.mPan;
//#ifdef HAVE_TOUCH
// mNonEditMapTool = mMapTools.mTouch;
//#endif
}

void QgisApp::createOverview()
Expand Down Expand Up @@ -2269,10 +2304,11 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
// present a dialog to choose GDAL raster sublayers
void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
{
if ( !layer || layer->subLayers().size() < 1 )
if ( !layer )
return;

QStringList sublayers = layer->subLayers();

QgsDebugMsg( "sublayers:\n " + sublayers.join( " \n" ) + "\n" );

// if promptLayers=Load all, load all sublayers without prompting
Expand All @@ -2297,7 +2333,16 @@ void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )

if ( chooseSublayersDialog.exec() )
{
loadGDALSublayers( layer->source(), chooseSublayersDialog.getSelection() );
foreach( QString path, chooseSublayersDialog.getSelection() )
{
QString name = path;
name.replace( layer->source(), QFileInfo( layer->source() ).completeBaseName() );
QgsRasterLayer *rlayer = new QgsRasterLayer( path, name );
if ( rlayer && rlayer->isValid() )
{
addRasterLayer( rlayer );
}
}
}
}

Expand All @@ -2310,9 +2355,11 @@ bool QgisApp::shouldAskUserForGDALSublayers( QgsRasterLayer *layer )

QSettings settings;
int promptLayers = settings.value( "/qgis/promptForRasterSublayers", 1 ).toInt();
// 0 = always -> always ask (if there are existing sublayers)
// 1 = if needed -> ask if layer has no bands, but has sublayers
// 2 = never

// return true if promptLayers=Always or if promptLayers!=Never and there are no bands
return promptLayers == 0 || ( promptLayers != 2 && layer->bandCount() == 0 );
return promptLayers == 0 || ( promptLayers == 1 && layer->bandCount() == 0 );
}

// This method will load with GDAL the layers in parameter.
Expand Down Expand Up @@ -2729,6 +2776,10 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
// set the initial map tool
mMapCanvas->setMapTool( mMapTools.mPan );
mNonEditMapTool = mMapTools.mPan; // signals are not yet setup to catch this
#ifdef HAVE_TOUCH
mMapCanvas->setMapTool( mMapTools.mTouch );
mNonEditMapTool = mMapTools.mTouch; // signals are not yet setup to catch this
#endif
} // QgisApp::fileNew(bool thePromptToSaveFlag)


Expand Down Expand Up @@ -2818,11 +2869,7 @@ void QgisApp::fileOpen()
deletePrintComposers();
removeAnnotationItems();
// clear out any stuff from previous project

//avoid multiple canvas redraws during loading of project files
bool bkRenderFlag = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );

mMapCanvas->freeze( true );
removeAllLayers();

QgsProject::instance()->setFileName( fullPath );
Expand All @@ -2832,7 +2879,8 @@ void QgisApp::fileOpen()
QMessageBox::critical( this,
tr( "QGIS Project Read Error" ),
QgsProject::instance()->error() );
mMapCanvas->setRenderFlag( bkRenderFlag );
mMapCanvas->freeze( false );
mMapCanvas->refresh();
return;
}

Expand All @@ -2844,7 +2892,8 @@ void QgisApp::fileOpen()
// add this to the list of recently used project files
saveRecentProjectPath( fullPath, settings );

mMapCanvas->setRenderFlag( bkRenderFlag );
mMapCanvas->freeze( false );
mMapCanvas->refresh();
}

} // QgisApp::fileOpen
Expand All @@ -2856,8 +2905,7 @@ void QgisApp::fileOpen()
*/
bool QgisApp::addProject( QString projectFile )
{
bool bkRenderFlag = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );
mMapCanvas->freeze( true );

QApplication::setOverrideCursor( Qt::WaitCursor );

Expand All @@ -2875,7 +2923,8 @@ bool QgisApp::addProject( QString projectFile )

QApplication::restoreOverrideCursor();

mMapCanvas->setRenderFlag( bkRenderFlag );
mMapCanvas->freeze( false );
mMapCanvas->refresh();
return false;
}

Expand Down Expand Up @@ -2911,7 +2960,8 @@ bool QgisApp::addProject( QString projectFile )

QApplication::restoreOverrideCursor();

mMapCanvas->setRenderFlag( bkRenderFlag );
mMapCanvas->freeze( false );
mMapCanvas->refresh();
return true;
} // QgisApp::addProject(QString projectFile)

Expand Down Expand Up @@ -3359,6 +3409,13 @@ void QgisApp::pan()
mMapCanvas->setMapTool( mMapTools.mPan );
}

#ifdef HAVE_TOUCH
void QgisApp::touch()
{
mMapCanvas->setMapTool( mMapTools.mTouch );
}
#endif

void QgisApp::zoomFull()
{
mMapCanvas->zoomToFullExtent();
Expand Down Expand Up @@ -7066,8 +7123,8 @@ QMenu* QgisApp::createPopupMenu()
return menu;
}

#ifdef ANDROID
bool QgisApp::gestureEvent( QGestureEvent *event )
#ifdef HAVE_TOUCH
bool QgisApp::gestureEvent(QGestureEvent *event)
{
if ( QGesture *tapAndHold = event->gesture( Qt::TapAndHoldGesture ) )
{
Expand Down
27 changes: 23 additions & 4 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class QgsScaleComboBox;
#include <QPointer>
#include <QSslError>

#ifdef ANDROID
#ifdef HAVE_TOUCH
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#endif
Expand Down Expand Up @@ -244,6 +244,10 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionSnappingOptions() { return mActionSnappingOptions; }
QAction *actionOffsetCurve() { return mActionOffsetCurve; }

#ifdef HAVE_TOUCH
QAction *actionTouch() { return mActionTouch; }
#endif

QAction *actionPan() { return mActionPan; }
QAction *actionPanToSelected() { return mActionPanToSelected; }
QAction *actionZoomIn() { return mActionZoomIn; }
Expand Down Expand Up @@ -367,6 +371,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! @note added in 1.6
void completeInitialization();

void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );

public slots:
//! Zoom to full extent
void zoomFull();
Expand Down Expand Up @@ -483,6 +489,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
#endif

private slots:
//! validate a SRS
void validateSrs( QgsCoordinateReferenceSystem *crs );

//! QGis Sponsors
void sponsors();
//! About QGis
Expand Down Expand Up @@ -730,6 +739,10 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void zoomIn();
//! Set map tool to pan
void pan();
#ifdef HAVE_TOUCH
//! Set map tool to touch
void touch();
#endif
//! Identify feature(s) on the currently selected layer
void identify();
//! Measure distance
Expand Down Expand Up @@ -850,6 +863,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
@note added in version 1.6*/
void initializationCompleted();

void customSrsValidation( QgsCoordinateReferenceSystem *crs );

private:
/** This method will open a dialog so the user can select the sublayers to load
*/
Expand Down Expand Up @@ -954,6 +969,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool* mZoomIn;
QgsMapTool* mZoomOut;
QgsMapTool* mPan;
#ifdef HAVE_TOUCH
QgsMapTool* mTouch;
#endif
QgsMapTool* mIdentify;
QgsMapTool* mFeatureAction;
QgsMapTool* mMeasureDist;
Expand Down Expand Up @@ -1127,14 +1145,15 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

QString mOldScale;

#ifdef ANDROID
bool gestureEvent( QGestureEvent *event );
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );
#ifdef HAVE_TOUCH
bool gestureEvent(QGestureEvent *event);
void tapAndHoldTriggered(QTapAndHoldGesture *gesture);
#endif
};

#ifdef ANDROID
#define QGIS_ICON_SIZE 32
//TODO find a better default fontsize maybe using DPI detection or so
#define QGIS_DEFAULT_FONTSIZE 8
#else
#define QGIS_ICON_SIZE 24
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
connect( mLayer, SIGNAL( layerDeleted() ), this, SLOT( close() ) );

connect( searchButton, SIGNAL( clicked() ), this, SLOT( search() ) );
connect( mCloseButton, SIGNAL( clicked() ), this, SLOT( close() ) );
connect( mAddFeature, SIGNAL( clicked() ), this, SLOT( addFeature() ) );

connect( mView->verticalHeader(), SIGNAL( sectionClicked( int ) ), this, SLOT( updateRowSelection( int ) ) );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmaptooloffsetcurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
mRubberBand->setToGeometry( &mModifiedGeometry, sourceLayer );
}
}
#else //GEOS_VERSION>=3.3
Q_UNUSED(offset);
Q_UNUSED(leftSide);
#endif //GEOS_VERSION>=3.3
}

Expand Down
8 changes: 7 additions & 1 deletion src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
chkUseRenderCaching->setChecked( settings.value( "/qgis/enable_render_caching", false ).toBool() );

//Changed to default to true as of QGIS 1.7
chkUseSymbologyNG->setChecked( settings.value( "/qgis/use_symbology_ng", true ).toBool() );
//TODO: remove hack when http://hub.qgis.org/issues/5170 is fixed
#ifdef ANDROID
bool use_symbology_ng_default = false;
#else
bool use_symbology_ng_default = true;
#endif
chkUseSymbologyNG->setChecked( settings.value( "/qgis/use_symbology_ng", use_symbology_ng_default ).toBool() );

// Slightly awkard here at the settings value is true to use QImage,
// but the checkbox is true to use QPixmap
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgspluginregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
mySettings.setValue( "/PythonPlugins/fTools", true );
}
if ( !mySettings.contains( "/PythonPlugins/GdalTools" ) )
{
mySettings.setValue( "/PythonPlugins/GdalTools", true );
}

for ( int i = 0; i < pluginList.size(); i++ )
{
Expand Down
8 changes: 7 additions & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,

QSettings settings;
//Changed to default to true as of QGIS 1.7
if ( settings.value( "/qgis/use_symbology_ng", true ).toBool() && hasGeometryType() )
//TODO: remove hack when http://hub.qgis.org/issues/5170 is fixed
#ifdef ANDROID
bool use_symbology_ng_default = false;
#else
bool use_symbology_ng_default = true;
#endif
if ( settings.value( "/qgis/use_symbology_ng", use_symbology_ng_default ).toBool() && hasGeometryType() )
{
// using symbology-ng!
setUsingRendererV2( true );
Expand Down
14 changes: 14 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ qgsexpressionhighlighter.cpp
qgsquerybuilder.cpp
)

IF (WITH_TOUCH)
SET(QGIS_GUI_SRCS
${QGIS_GUI_SRCS}
qgsmaptooltouch.cpp
)
ENDIF (WITH_TOUCH)

SET(QGIS_GUI_MOC_HDRS

symbology-ng/qgsdashspacedialog.h
Expand Down Expand Up @@ -185,6 +192,13 @@ attributetable/qgsattributetableidcolumnpair.h
attributetable/qgsattributetabledelegate.h
)

IF (WITH_TOUCH)
SET(QGIS_GUI_HDRS
${QGIS_GUI_HDRS}
qgsmaptooltouch.h
)
ENDIF (WITH_TOUCH)

SET(QGIS_GUI_UI_HDRS
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsdetaileditemwidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsgenericprojectionselectorbase.h
Expand Down
25 changes: 25 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,3 +1560,28 @@ void QgsMapCanvas::mapToolDestroyed()
QgsDebugMsg( "maptool destroyed" );
mMapTool = 0;
}

#ifdef HAVE_TOUCH
bool QgsMapCanvas::event( QEvent * e )
{
bool done = false;
if ( mDrawing )
{
return done;
}
if (e->type() == QEvent::Gesture )
{
// call handler of current map tool
if ( mMapTool )
{
done = mMapTool->gestureEvent( static_cast<QGestureEvent*>(e) );
}
}
else
{
// pass other events to base class
done = QGraphicsView::event( e );
}
return done;
}
#endif
9 changes: 9 additions & 0 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <QGraphicsView>
#include <QtCore>

#ifdef HAVE_TOUCH
#include <QGestureEvent>
#endif

class QWheelEvent;
class QPixmap;
class QPaintEvent;
Expand Down Expand Up @@ -357,6 +361,11 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void zoomNextStatusChanged( bool );

protected:
#ifdef HAVE_TOUCH
//! Overridden standard event to be gestures aware
bool event( QEvent * e );
#endif

//! Overridden key press event
void keyPressEvent( QKeyEvent * e );

Expand Down
7 changes: 7 additions & 0 deletions src/gui/qgsmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ void QgsMapTool::keyReleaseEvent( QKeyEvent *e )
Q_UNUSED( e );
}

#ifdef HAVE_TOUCH
bool QgsMapTool::gestureEvent( QGestureEvent *e )
{
Q_UNUSED( e );
}
#endif

void QgsMapTool::renderComplete()
{
}
Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgsmaptool.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <QString>
#include <QObject>

#ifdef HAVE_TOUCH
#include <QGestureEvent>
#endif

class QgsMapLayer;
class QgsMapCanvas;
class QKeyEvent;
Expand Down Expand Up @@ -62,6 +66,11 @@ class GUI_EXPORT QgsMapTool : public QObject
//! Added in version 1.1
virtual void keyReleaseEvent( QKeyEvent* e );

#ifdef HAVE_TOUCH
//! gesture event for overriding. Default implementation does nothing.
virtual bool gestureEvent( QGestureEvent* e );
#endif

//! Called when rendering has finished. Default implementation does nothing.
virtual void renderComplete();

Expand Down
129 changes: 129 additions & 0 deletions src/gui/qgsmaptooltouch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/***************************************************************************
qgsmaptooltouch.cpp - map tool for zooming and panning using qgestures
----------------------
begin : February 2012
copyright : (C) 2012 by Marco Bernasocchi
email : marco at bernawebdesign.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsmaptooltouch.h"
#include "qgsmapcanvas.h"
#include "qgscursors.h"
#include "qgsmaptopixel.h"
#include <QBitmap>
#include <QCursor>
#include <QMouseEvent>
#include <qgslogger.h>


QgsMapToolTouch::QgsMapToolTouch( QgsMapCanvas* canvas )
: QgsMapTool( canvas ), mDragging( false ), mPinching( false )
{
// set cursor
// QBitmap panBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
// QBitmap panBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
// mCursor = QCursor( panBmp, panBmpMask, 5, 5 );
}

QgsMapToolTouch::~QgsMapToolTouch()
{
mCanvas->ungrabGesture(Qt::PinchGesture);
}

void QgsMapToolTouch::activate()
{
mCanvas->grabGesture(Qt::PinchGesture);
QgsMapTool::activate();
}

void QgsMapToolTouch::deactivate()
{
mCanvas->ungrabGesture(Qt::PinchGesture);
QgsMapTool::deactivate();
}

void QgsMapToolTouch::canvasMoveEvent( QMouseEvent * e )
{
if ( !mPinching )
{
if (( e->buttons() & Qt::LeftButton ) )
{
mDragging = true;
// move map and other canvas items
mCanvas->panAction( e );
}
}
}

void QgsMapToolTouch::canvasReleaseEvent( QMouseEvent * e )
{
if ( !mPinching )
{
if ( e->button() == Qt::LeftButton )
{
if ( mDragging )
{
mCanvas->panActionEnd( e->pos() );
mDragging = false;
}
else // add pan to mouse cursor
{
// transform the mouse pos to map coordinates
QgsPoint center = mCanvas->getCoordinateTransform()->toMapPoint( e->x(), e->y() );
mCanvas->setExtent( QgsRectangle( center, center ) );
mCanvas->refresh();
}
}
}
}

void QgsMapToolTouch::canvasDoubleClickEvent( QMouseEvent *e )
{
if ( !mPinching )
{
mCanvas->zoomWithCenter(e->x(), e->y(), true);
}
}

bool QgsMapToolTouch::gestureEvent(QGestureEvent *event)
{
qDebug() << "gesture " << event;
if (QGesture *gesture = event->gesture(Qt::PinchGesture))
{
mPinching = true;
pinchTriggered(static_cast<QPinchGesture *>(gesture));
}
return true;
}


void QgsMapToolTouch::pinchTriggered(QPinchGesture *gesture)
{
if (gesture->state() == Qt::GestureFinished) {
//a very small totalScaleFactor indicates a two finger tap (pinch gesture without pinching)
if (0.98 < gesture->totalScaleFactor() && gesture->totalScaleFactor() < 1.02 )
{
mCanvas->zoomOut();
}
else
{
//Transfor global coordinates to widget coordinates
QPoint pos = gesture->centerPoint().toPoint();
pos = mCanvas->mapFromGlobal( pos );
// transform the mouse pos to map coordinates
QgsPoint center = mCanvas->getCoordinateTransform()->toMapPoint( pos.x(),pos.y() );
QgsRectangle r = mCanvas->extent();
r.scale( 1/gesture->totalScaleFactor(), &center );
mCanvas->setExtent( r );
mCanvas->refresh();
}
mPinching = false;
}
}
62 changes: 62 additions & 0 deletions src/gui/qgsmaptooltouch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/***************************************************************************
qgsmaptooltouch.h - map tool for zooming and panning using qgestures
----------------------
begin : February 2012
copyright : (C) 2012 by Marco Bernasocchi
email : marco at bernawebdesign.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSMAPTOOLTOUCH_H
#define QGSMAPTOOLTOUCH_H

#include "qgsmaptool.h"
#include <QGestureEvent>
#include <QPinchGesture>

class QgsMapCanvas;


/** \ingroup gui
* A map tool for panning the map.
* @see QgsMapTool
*/
class GUI_EXPORT QgsMapToolTouch : public QgsMapTool
{
public:
//! constructor
QgsMapToolTouch( QgsMapCanvas* canvas );

~QgsMapToolTouch();

void activate();
void deactivate();

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );

//! Overridden Mouse double click event.
virtual void canvasDoubleClickEvent( QMouseEvent * e );

virtual bool isTransient() { return true; }

private:

//! Flag to indicate a map canvas drag operation is taking place
bool mDragging;
//! Flag to indicate a pinch gesture is taking place
bool mPinching;
bool gestureEvent(QGestureEvent *event);
void pinchTriggered(QPinchGesture *gesture);
};

#endif
2 changes: 0 additions & 2 deletions src/mapserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ SET ( qgis_mapserv_SRCS
qgspostrequesthandler.cpp
qgssoaprequesthandler.cpp
qgssldparser.cpp
qgssldrenderer.cpp
qgswmsserver.cpp
qgswfsserver.cpp
qgsmapserviceexception.cpp
qgsmslayercache.cpp
qgsfilter.cpp
qgssldrule.cpp
qgsbetweenfilter.cpp
qgscomparisonfilter.cpp
qgslogicalfilter.cpp
Expand Down
67 changes: 21 additions & 46 deletions src/mapserver/qgssldparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include "qgscoordinatetransform.h"
#include "qgsftptransaction.h"
#include "qgshttptransaction.h"
#include "qgssinglesymbolrenderer.h"
#include "qgssldrenderer.h"
#include "qgssymbol.h"
#include "qgsrendererv2.h"
#include "qgssinglesymbolrendererv2.h"
#include "qgssymbolv2.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgsmapserviceexception.h"
Expand All @@ -32,7 +32,6 @@
#include "qgsmsutils.h"
#include "qgsrasterlayer.h"
#include "qgscolorrampshader.h"
#include "qgssldrule.h"
#include "qgscoordinatereferencesystem.h"
#include "qgslabelattributes.h"

Expand Down Expand Up @@ -274,9 +273,9 @@ QList<QgsMapLayer*> QgsSLDParser::mapLayerFromStyle( const QString& layerName, c
QgsVectorLayer* v = dynamic_cast<QgsVectorLayer*>( fallbackLayerList.at( 0 ) );
if ( v )
{
QgsRenderer* r = rendererFromUserStyle( userStyleElement, v );
v->setRenderer( r );
v->setUsingRendererV2( false );
QgsFeatureRendererV2* r = rendererFromUserStyle( userStyleElement, v );
v->setRendererV2( r );
v->setUsingRendererV2( true );
labelSettingsFromUserStyle( userStyleElement, v );
#ifdef DIAGRAMSERVER
overlaysFromUserStyle( userStyleElement, v );
Expand Down Expand Up @@ -337,7 +336,7 @@ QList<QgsMapLayer*> QgsSLDParser::mapLayerFromStyle( const QString& layerName, c
return resultList;
}

QgsRenderer* theRenderer = 0;
QgsFeatureRendererV2* theRenderer = 0;

QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>( theMapLayer );
if ( !theVectorLayer )
Expand Down Expand Up @@ -370,15 +369,8 @@ QList<QgsMapLayer*> QgsSLDParser::mapLayerFromStyle( const QString& layerName, c

if ( userStyleElement.isNull() )//apply a default style
{
theRenderer = new QgsSingleSymbolRenderer( theVectorLayer->geometryType() );
QgsSymbol* defaultSymbol = new QgsSymbol( theVectorLayer->geometryType() );
QPen defaultPen;
defaultPen.setWidth( 1 );
defaultSymbol->setPen( defaultPen );
QBrush defaultBrush;
defaultBrush.setStyle( Qt::NoBrush );
defaultSymbol->setBrush( defaultBrush );
( static_cast<QgsSingleSymbolRenderer*>( theRenderer ) )->addSymbol( defaultSymbol );
QgsSymbolV2* symbol = QgsSymbolV2::defaultSymbol( theVectorLayer->geometryType() );
theRenderer = new QgsSingleSymbolRendererV2( symbol );
}
else
{
Expand All @@ -399,48 +391,30 @@ QList<QgsMapLayer*> QgsSLDParser::mapLayerFromStyle( const QString& layerName, c
delete theVectorLayer;
return resultList;
}
theVectorLayer->setRenderer( theRenderer );
theVectorLayer->setUsingRendererV2( false );
theVectorLayer->setRendererV2( theRenderer );
theVectorLayer->setUsingRendererV2( true );
QgsDebugMsg( "Returning the vectorlayer" );
setOpacityForLayer( userLayerElement, theVectorLayer );
resultList.push_back( theVectorLayer );
return resultList;
}

QgsRenderer* QgsSLDParser::rendererFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const
QgsFeatureRendererV2* QgsSLDParser::rendererFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const
{
if ( !vec )
if ( !vec || userStyleElement.isNull() )
{
return 0;
}

QgsDebugMsg( "Entering" );

QgsSLDRenderer* theRenderer = new QgsSLDRenderer( vec->geometryType() );
theRenderer->setScaleDenominator( mScaleDenominator );

if ( !userStyleElement.isNull() )
QString errorMessage;
QgsFeatureRendererV2* renderer = QgsFeatureRendererV2::loadSld( userStyleElement.parentNode(), vec->geometryType(), errorMessage );
if ( !renderer )
{
QDomNodeList featureTypeList = userStyleElement.elementsByTagName( "FeatureTypeStyle" );
for ( int i = 0; i < featureTypeList.size(); ++i )
{
QDomNodeList ruleNodeList = featureTypeList.item( i ).toElement().elementsByTagName( "Rule" );
for ( int j = 0; j < ruleNodeList.size(); ++j )
{
QDomElement ruleElement = ruleNodeList.item( j ).toElement();
QgsSLDRule* r = new QgsSLDRule();
if ( r->setFromXml( ruleElement, vec, mFilesToRemove ) == 0 )
{
theRenderer->addRule( r );
}
else
{
delete r;
}
}
}
throw QgsMapServiceException( "SLD error", errorMessage );
}
return theRenderer;
return renderer;
}

bool QgsSLDParser::rasterSymbologyFromUserStyle( const QDomElement& userStyleElement, QgsRasterLayer* r ) const
Expand Down Expand Up @@ -1405,8 +1379,9 @@ QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userSty
QgsVectorLayer* contourLayer = new QgsVectorLayer( tmpFileName, "layer", "ogr" );

//create renderer
QgsRenderer* theRenderer = rendererFromUserStyle( userStyleElem, contourLayer );
contourLayer->setRenderer( theRenderer );
QgsFeatureRendererV2* theRenderer = rendererFromUserStyle( userStyleElem, contourLayer );
contourLayer->setRendererV2( theRenderer );
contourLayer->setUsingRendererV2( true );

//add labelling if requested
labelSettingsFromUserStyle( userStyleElem, contourLayer );
Expand Down
4 changes: 2 additions & 2 deletions src/mapserver/qgssldparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QPen;
class QgsMapLayer;
class QgsVectorLayer;
class QgsRasterLayer;
class QgsRenderer;
class QgsFeatureRendererV2;

#include "qgsconfigparser.h"
#include "qgsmaprenderer.h"
Expand Down Expand Up @@ -85,7 +85,7 @@ class QgsSLDParser: public QgsConfigParser
/**Don't use the default constructor*/
QgsSLDParser();
/**Creates a Renderer from a UserStyle SLD node. Returns 0 in case of error*/
QgsRenderer* rendererFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const;
QgsFeatureRendererV2* rendererFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const;
/**Searches for a <TextSymbolizer> element and applies the settings to the vector layer
@return true if settings have been applied, false in case of <TextSymbolizer> element not present or error*/
bool labelSettingsFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const;
Expand Down
131 changes: 0 additions & 131 deletions src/mapserver/qgssldrenderer.cpp

This file was deleted.

71 changes: 0 additions & 71 deletions src/mapserver/qgssldrenderer.h

This file was deleted.

786 changes: 0 additions & 786 deletions src/mapserver/qgssldrule.cpp

This file was deleted.

91 changes: 0 additions & 91 deletions src/mapserver/qgssldrule.h

This file was deleted.

5 changes: 3 additions & 2 deletions src/plugins/compass/compass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
***************************************************************************/

#include "compass.h"
#include "qgslogger.h"

Compass::Compass()
{
Expand Down Expand Up @@ -61,7 +62,7 @@ bool Compass::start()
mSensor.start();
if ( !mSensor.isActive() )
{
qDebug() << "Compasssensor didn't start!" << endl;
QgsDebugMsg( "Compasssensor didn't start!" );
return false;
}
return true;
Expand All @@ -72,7 +73,7 @@ bool Compass::stop()
mSensor.stop();
if ( mSensor.isActive() )
{
qDebug() << "Compasssensor didn't stop!" << endl;
QgsDebugMsg( "Compasssensor didn't stop!" );
return false;
}
return true;
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/globe/globe_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>
#include <osgDB/Registry>

#include <osgGA/StateSetManipulator>
#include <osgGA/GUIEventHandler>
Expand Down Expand Up @@ -85,6 +86,13 @@ GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
setObjectName( "globePlugin" );
setParent( theQgisInterface->mainWindow() );

// add internal osg plugin path if bundled osg on OS X
#ifdef QGIS_MACAPP_BUNDLE
#if QGIS_MACAPP_BUNDLE > 0
setLibraryFilePathList( QgsApplication::prefixPath() + "/QGIS_PLUGIN_SUBDIR/../osgPlugins" );
#endif
#endif

mSettingsDialog = new QgsGlobePluginDialog( &viewer, theQgisInterface->mainWindow(), QgisGui::ModalDialogFlags );
mQDockWidget = new QDockWidgetGlobe( tr( "Globe" ), theQgisInterface->mainWindow() );
}
Expand Down
8 changes: 8 additions & 0 deletions src/providers/grass/qgsgrass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,14 @@ QStringList GRASS_LIB_EXPORT QgsGrass::vectorLayers( QString gisdbase,
list.append( l );
}

/* Faces */
int nfaces = Vect_cidx_get_type_count( &map, field, GV_FACE );
if ( nfaces > 0 )
{
QString l = fs + "_face";
list.append( l );
}

/* Polygons */
int nareas = Vect_cidx_get_type_count( &map, field, GV_AREA );
if ( nareas > 0 )
Expand Down
34 changes: 28 additions & 6 deletions src/providers/grass/qgsgrassprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
{
mLayerType = LINE;
}
else if ( mGrassType == GV_FACE )
{
mLayerType = FACE;
}
else if ( mGrassType == GV_AREA )
{
mLayerType = POLYGON;
Expand Down Expand Up @@ -175,6 +179,7 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
mQgisType = QGis::WKBLineString;
break;
case POLYGON:
case FACE:
mQgisType = QGis::WKBPolygon;
break;
}
Expand Down Expand Up @@ -347,7 +352,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
feature.clearAttributeMap();

// TODO int may be 64 bits (memcpy)
if ( type & ( GV_POINTS | GV_LINES ) ) /* points or lines */
if ( type & ( GV_POINTS | GV_LINES | GV_FACE ) ) /* points or lines */
{
Vect_read_line( mMap, mPoints, mCats, id );
int npoints = mPoints->n_points;
Expand All @@ -356,10 +361,14 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
{
wkbsize = 1 + 4 + 2 * 8;
}
else // GV_LINES
else if ( type & GV_LINES )
{
wkbsize = 1 + 4 + 4 + npoints * 2 * 8;
}
else // GV_FACE
{
wkbsize = 1 + 4 + 4 + 4 + npoints * 2 * 8;
}
wkb = new unsigned char[wkbsize];
unsigned char *wkbp = wkb;
wkbp[0] = ( unsigned char ) QgsApplication::endian();
Expand All @@ -369,9 +378,18 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
memcpy( wkbp, &mQgisType, 4 );
wkbp += 4;

/* Number of rings */
if ( type & GV_FACE )
{
int nrings = 1;
memcpy( wkbp, &nrings, 4 );
wkbp += 4;
}

/* number of points */
if ( type & GV_LINES )
if ( type & ( GV_LINES | GV_FACE ) )
{
QgsDebugMsg( QString( "set npoints = %1" ).arg( npoints ) );
memcpy( wkbp, &npoints, 4 );
wkbp += 4;
}
Expand Down Expand Up @@ -494,7 +512,7 @@ void QgsGrassProvider::select( QgsAttributeList fetchAttributes,
box.N = rect.yMaximum(); box.S = rect.yMinimum();
box.E = rect.xMaximum(); box.W = rect.xMinimum();
box.T = PORT_DOUBLE_MAX; box.B = -PORT_DOUBLE_MAX;
if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == BOUNDARY )
if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == FACE || mLayerType == BOUNDARY )
{
Vect_select_lines_by_box( mMap, &box, mGrassType, mList );
}
Expand All @@ -519,7 +537,7 @@ void QgsGrassProvider::select( QgsAttributeList fetchAttributes,
Vect_append_point( Polygon, rect.xMinimum(), rect.yMaximum(), 0 );
Vect_append_point( Polygon, rect.xMinimum(), rect.yMinimum(), 0 );

if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == BOUNDARY )
if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == FACE || mLayerType == BOUNDARY )
{
Vect_select_lines_by_polygon( mMap, Polygon, 0, NULL, mGrassType, mList );
}
Expand Down Expand Up @@ -1386,6 +1404,10 @@ int QgsGrassProvider::grassLayerType( QString name )
{
return GV_LINES;
}
else if ( ts.compare( "face" ) == 0 )
{
return GV_FACE;
}
else if ( ts.compare( "polygon" ) == 0 )
{
return GV_AREA;
Expand Down Expand Up @@ -2314,7 +2336,7 @@ QString *QgsGrassProvider::isOrphan( int field, int cat, int *orphan )
{
int t, id;
int ret = Vect_cidx_find_next( mMap, fieldIndex, cat,
GV_POINTS | GV_LINES, 0, &t, &id );
GV_POINTS | GV_LINES | GV_FACE, 0, &t, &id );

if ( ret >= 0 )
{
Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
{
POINT = 1, // <field>_point
LINE, // <field>_line
FACE, // <field>_face
POLYGON, // <field>_polygon
BOUNDARY, // boundary (currently not used)
CENTROID // centroid (currently not used)
Expand Down
42 changes: 42 additions & 0 deletions src/providers/mssql/qgsmssqlprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,48 @@ void QgsMssqlProvider::loadFields()
}
}
}
// get primary key
if ( mFidColName.isEmpty() )
{
mQuery.clear();
if (!mQuery.exec( QString( "exec sp_pkeys N'%1', NULL, NULL" ).arg( mTableName ) ))
{
QString msg = mQuery.lastError().text();
QgsDebugMsg( msg );
}
if ( mQuery.isActive() )
{
if ( mQuery.next() )
{
mFidColName = mQuery.value( 3 ).toString();
return;
}
}
foreach( QString pk, pkCandidates )
{
mQuery.clear();
mQuery.setForwardOnly( true );
if (!mQuery.exec( QString( "select count(distinct [%1]), count([%1]) from [%2].[%3]" )
.arg( pk )
.arg( mSchemaName )
.arg( mTableName ) ))
{
QString msg = mQuery.lastError().text();
QgsDebugMsg( msg );
}
if ( mQuery.isActive() )
{
if ( mQuery.next() )
{
if (mQuery.value( 0 ).toInt() == mQuery.value( 1 ).toInt())
{
mFidColName = pk;
return;
}
}
}
}
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/providers/postgres/qgspgtablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ QIcon QgsPgTableModel::iconForWkbType( QGis::WkbType type )
case QGis::WKBUnknown:
break;
}

return QIcon( QgsDataItem::getThemePixmap( "/mIconLayer.png" ) );
}

Expand Down
16 changes: 16 additions & 0 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionTouch"/>
<addaction name="mActionPan"/>
<addaction name="mActionPanToSelected"/>
<addaction name="mActionZoomIn"/>
Expand Down Expand Up @@ -1587,6 +1588,21 @@
<string>Pan Map to Selection</string>
</property>
</action>
<action name="mActionTouch">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/gis/mActionTouch.png</normaloff>:/images/themes/gis/mActionTouch.png</iconset>
</property>
<property name="text">
<string>Touch zoom and pan</string>
</property>
<property name="toolTip">
<string>Touch zoom and pan</string>
</property>
</action>
<action name="mActionOffsetCurve">
<property name="checkable">
<bool>true</bool>
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsattributetabledialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mCloseButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
Expand Down
1 change: 0 additions & 1 deletion src/ui/qgsfieldcalculatorbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
<property name="autoFillBackground">
<bool>false</bool>
</property>
<zorder>mButtonBox</zorder>
</widget>
</item>
<item row="3" column="0" colspan="2">
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsnewogrconnectionbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<property name="title">
<string>Connection Information</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_1">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsprojectpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
<property name="title">
<string>WMS Capabilitities</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<layout class="QGridLayout" name="gridLayout_10">
<item row="1" column="0">
<widget class="QGroupBox" name="grpWMSExt">
<property name="title">
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsvectorlayerpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
<height>497</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="0">
<widget class="QPushButton" name="mButtonAddJoin">
<property name="text">
Expand Down