Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
timlinux committed Jul 25, 2012
2 parents d8fd81b + ee4ac59 commit 5a3d14a9f9b91a0c15302ecd6d7574f2bd8768ae
Showing with 191 additions and 168 deletions.
  1. +11 −1 cmake/SIPMacros.cmake
  2. +35 −38 cmake/UsePythonTest.cmake
  3. +1 −1 src/app/main.cpp
  4. +7 −7 src/app/qgsdecorationitem.cpp
  5. +15 −15 src/app/qgsmaptoolfreezelabels.cpp
  6. +2 −2 src/app/qgsmaptoolfreezelabels.h
  7. +5 −4 src/app/qgsrasterlayerproperties.cpp
  8. +2 −2 src/app/qgsvectorlayerproperties.cpp
  9. +1 −1 src/app/qgsvectorlayerproperties.h
  10. +1 −1 src/core/gps/qgsqtlocationconnection.cpp
  11. +8 −6 src/core/qgsapplication.cpp
  12. +9 −9 src/core/qgsrasterdataprovider.h
  13. +2 −2 src/core/qgsrasterprojector.cpp
  14. +3 −3 src/core/qgsscaleutils.cpp
  15. +1 −7 src/core/raster/qgsmultibandcolorrenderer.cpp
  16. +1 −1 src/core/raster/qgsrasterdrawer.h
  17. +1 −1 src/core/raster/qgsrasterfilewriter.cpp
  18. +2 −2 src/core/raster/qgsrasterfilewriter.h
  19. +21 −0 src/core/raster/qgsrasterinterface.cpp
  20. +2 −2 src/core/raster/qgsrasteriterator.h
  21. +11 −16 src/core/raster/qgsrasterpipe.cpp
  22. +2 −2 src/core/raster/qgsrasterpipe.h
  23. +1 −2 src/core/raster/qgsrasterrenderer.h
  24. +3 −2 src/core/raster/qgsrasterresamplefilter.cpp
  25. +1 −1 src/core/raster/qgsrasterresamplefilter.h
  26. +0 −2 src/core/raster/qgssinglebandcolordatarenderer.cpp
  27. +11 −9 src/core/raster/qgssinglebandgrayrenderer.cpp
  28. +1 −0 src/core/raster/qgssinglebandpseudocolorrenderer.cpp
  29. +1 −1 src/gui/qgsattributeeditor.cpp
  30. +1 −1 src/gui/qgsmapcanvas.cpp
  31. +1 −1 src/gui/qgsrasterformatsaveoptionswidget.cpp
  32. +5 −5 src/providers/gdal/qgsgdalprovider.cpp
  33. +3 −3 src/providers/gdal/qgsgdalprovider.h
  34. +1 −1 tests/src/core/testqgsrasterlayer.cpp
  35. +19 −17 tests/src/python/test_qgisapp.py
@@ -46,7 +46,7 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
SET(EXTRA_LINK_LIBRARIES ${ARGN})

STRING(REPLACE "." "/" _x ${MODULE_NAME})
GET_FILENAME_COMPONENT(_parent_module_path ${_x} PATH)
GET_FILENAME_COMPONENT(_parent_module_path ${_x} PATH)
GET_FILENAME_COMPONENT(_child_module_name ${_x} NAME)

GET_FILENAME_COMPONENT(_module_path ${MODULE_SIP} PATH)
@@ -127,6 +127,16 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES SUFFIX ".pyd")
ENDIF (WIN32)

IF(WIN32)
GET_TARGET_PROPERTY(_target_location ${_logical_name} LOCATION)
GET_TARGET_PROPERTY(_runtime_output ${_logical_name} RUNTIME_OUTPUT_DIRECTORY)
ADD_CUSTOM_COMMAND(TARGET ${_logical_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copying extension ${_child_module_name}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_target_location}" "${_runtime_output}/${_child_module_name}.pyd"
DEPENDS ${_logical_name}
)
ENDIF(WIN32)

INSTALL(TARGETS ${_logical_name} DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/${_parent_module_path}")

ENDMACRO(ADD_SIP_PYTHON_MODULE)
@@ -1,5 +1,4 @@
# Add a python test from a python file
# One cannot simply do:
# Add a python test from a python file # One cannot simply do:
# SET(ENV{PYTHONPATH} ${LIBRARY_OUTPUT_PATH})
# SET(my_test "from test_mymodule import *\;test_mymodule()")
# ADD_TEST(PYTHON-TEST-MYMODULE python -c ${my_test})
@@ -26,44 +25,42 @@ MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
MACRO(ADD_PYTHON_TEST TESTNAME FILENAME)
GET_SOURCE_FILE_PROPERTY(loc ${FILENAME} LOCATION)
GET_SOURCE_FILE_PROPERTY(pyenv ${FILENAME} PYTHONPATH)
IF(CMAKE_CONFIGURATION_TYPES)
# I cannot use CMAKE_CFG_INTDIR since it expand to "$(OutDir)"
IF(pyenv)
SET(pyenv "${pyenv};${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}")
ELSE(pyenv)
SET(pyenv ${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
#SET(pyenv ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
#SET(pyenv ${LIBRARY_OUTPUT_PATH}/${CMAKE_CONFIG_TYPE})
#SET(pyenv ${LIBRARY_OUTPUT_PATH}/\${CMAKE_CONFIG_TYPE})
ENDIF(pyenv)
ELSE(CMAKE_CONFIGURATION_TYPES)
IF(pyenv)
SET(pyenv ${pyenv}:${LIBRARY_OUTPUT_PATH})
ELSE(pyenv)
SET(pyenv ${LIBRARY_OUTPUT_PATH})
ENDIF(pyenv)
ENDIF(CMAKE_CONFIGURATION_TYPES)
STRING(REGEX REPLACE ";" " " wo_semicolumn "${ARGN}")

IF(WIN32)
STRING(REGEX REPLACE ":" " " wo_semicolon "${ARGN}")
ELSE(WIN32)
STRING(REGEX REPLACE ";" " " wo_semicolon "${ARGN}")
ENDIF(WIN32)

FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake
"
SET(ENV{PYTHONPATH} ${pyenv}:\$ENV{PYTHONPATH})
SET(ENV{LD_LIBRARY_PATH} ${pyenv}:\$ENV{LD_LIBRARY_PATH})
MESSAGE(\"${pyenv}\")
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolumn}
#WORKING_DIRECTORY @LIBRARY_OUTPUT_PATH@
RESULT_VARIABLE import_res
OUTPUT_VARIABLE import_output
ERROR_VARIABLE import_output
)
# Pass the output back to ctest
IF(import_output)
MESSAGE("\${import_output}")
ENDIF(import_output)
IF(import_res)
MESSAGE(SEND_ERROR "\${import_res}")
ENDIF(import_res)
IF(WIN32)
SET(ENV{QGIS_PREFIX_PATH} \"${QGIS_OUTPUT_DIRECTORY}/bin/${CMAKE_BUILD_TYPE}\")
SET(ENV{PATH} \"${QGIS_OUTPUT_DIRECTORY}/bin/${CMAKE_BUILD_TYPE};\$ENV{PATH}\")
SET(ENV{PYTHONPATH} \"${QGIS_OUTPUT_DIRECTORY}/python/;\$ENV{PYTHONPATH}\")
MESSAGE(\"PATH:\$ENV{PATH}\")
ELSE(WIN32)
SET(ENV{QGIS_PREFIX_PATH} \"${QGIS_OUTPUT_DIRECTORY}\")
SET(ENV{LD_LIBRARY_PATH} \"${pyenv}:${QGIS_OUTPUT_DIRECTORY}/lib:\$ENV{LD_LIBRARY_PATH}\")
SET(ENV{PYTHONPATH} \"${QGIS_OUTPUT_DIRECTORY}/python/:\$ENV{PYTHONPATH}\")
MESSAGE(\"LD_LIBRARY_PATH:\$ENV{LD_LIBRARY_PATH}\")
ENDIF(WIN32)
MESSAGE(\"PYTHONPATH:\$ENV{PYTHONPATH}\")
MESSAGE(STATUS \"Running ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolon}\")
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolumn}
#WORKING_DIRECTORY @LIBRARY_OUTPUT_PATH@
RESULT_VARIABLE import_res
OUTPUT_VARIABLE import_output
ERROR_VARIABLE import_output
)
# Pass the output back to ctest
IF(import_output)
MESSAGE("\${import_output}")
ENDIF(import_output)
IF(import_res)
MESSAGE(SEND_ERROR "\${import_res}")
ENDIF(import_res)
"
)
ADD_TEST(${TESTNAME} ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}.cmake)
@@ -269,7 +269,7 @@ int main( int argc, char *argv[] )
QgsDebugMsg( QString( "Android: All params stripped" ) );// Param %1" ).arg( argv[0] ) );
//put all QGIS settings in the same place
configpath = QDir::homePath() + QString( "/.qgis/" );
QgsDebugMsg( QString( "Android: configpath set to %1" ).arg(configpath) );
QgsDebugMsg( QString( "Android: configpath set to %1" ).arg( configpath ) );
#elif defined(Q_WS_WIN)
for ( int i = 1; i < argc; i++ )
{
@@ -53,10 +53,10 @@ QgsDecorationItem::~QgsDecorationItem()

}

void QgsDecorationItem::update()
{
void QgsDecorationItem::update()
{
saveToProject();
QgisApp::instance()->mapCanvas()->refresh();
QgisApp::instance()->mapCanvas()->refresh();
}

void QgsDecorationItem::projectRead()
@@ -70,11 +70,11 @@ void QgsDecorationItem::saveToProject()
QgsDebugMsg( "Entered" );
QgsProject::instance()->writeEntry( mNameConfig, "/Enabled", mEnabled );
}
void QgsDecorationItem::setName( const char *name )
{
mName = name;
void QgsDecorationItem::setName( const char *name )
{
mName = name;
mNameConfig = name;
mNameConfig.remove( " " );
mNameTranslated = tr( name );
QgsDebugMsg( QString( "name=%1 nameconfig=%2 nametrans=%3").arg(mName).arg(mNameConfig).arg(mNameTranslated) );
QgsDebugMsg( QString( "name=%1 nameconfig=%2 nametrans=%3" ).arg( mName ).arg( mNameConfig ).arg( mNameTranslated ) );
}
@@ -118,12 +118,12 @@ void QgsMapToolFreezeLabels::showFrozenLabels( bool show )
mShowFrozen = show;
if ( mShowFrozen )
{
QgsDebugMsg( QString( "Toggling on frozen label highlighting" ));
QgsDebugMsg( QString( "Toggling on frozen label highlighting" ) );
highlightFrozenLabels();
}
else
{
QgsDebugMsg( QString( "Toggling off frozen label highlighting" ));
QgsDebugMsg( QString( "Toggling off frozen label highlighting" ) );
removeFrozenHighlights();
}
}
@@ -133,15 +133,15 @@ void QgsMapToolFreezeLabels::updateFrozenLabels()
{
if ( mShowFrozen )
{
QgsDebugMsg( QString( "Updating highlighting due to layer editing mode change" ));
QgsDebugMsg( QString( "Updating highlighting due to layer editing mode change" ) );
mCanvas->refresh();
}
}

void QgsMapToolFreezeLabels::highlightLabel( QgsVectorLayer* vlayer,
const QgsLabelPosition& labelpos,
const QString& id,
const QColor& color )
const QgsLabelPosition& labelpos,
const QString& id,
const QColor& color )
{
QgsRectangle rect = labelpos.labelRect;

@@ -152,7 +152,7 @@ void QgsMapToolFreezeLabels::highlightLabel( QgsVectorLayer* vlayer,
if ( vlayer->crs() != mRender->destinationCrs() )
{
rect = mRender->mapToLayerCoordinates( vlayer, rect );
QgsDebugMsg( QString( "Reverse transform needed for highlight rectangle" ));
QgsDebugMsg( QString( "Reverse transform needed for highlight rectangle" ) );
}
}

@@ -209,9 +209,9 @@ void QgsMapToolFreezeLabels::highlightFrozenLabels()
{
mCurrentLabelPos = *it;

if( mCurrentLabelPos.isFrozen )
if ( mCurrentLabelPos.isFrozen )
{
QString labelStringID = QString("%0|%1").arg(mCurrentLabelPos.layerID, QString::number( mCurrentLabelPos.featureId ) );
QString labelStringID = QString( "%0|%1" ).arg( mCurrentLabelPos.layerID, QString::number( mCurrentLabelPos.featureId ) );

// don't highlight again
if ( mHighlights.contains( labelStringID ) )
@@ -236,7 +236,7 @@ void QgsMapToolFreezeLabels::highlightFrozenLabels()
lblcolor = QColor( 54, 129, 0, 255 );
}

highlightLabel( vlayer, ( *it ), labelStringID, lblcolor);
highlightLabel( vlayer, ( *it ), labelStringID, lblcolor );
}
}
QApplication::restoreOverrideCursor();
@@ -253,7 +253,7 @@ void QgsMapToolFreezeLabels::removeFrozenHighlights()
QApplication::restoreOverrideCursor();
}

void QgsMapToolFreezeLabels::freezeThawLabels( const QgsRectangle& ext, QMouseEvent * e )
void QgsMapToolFreezeLabels::freezeThawLabels( const QgsRectangle& ext, QMouseEvent * e )
{

bool doThaw = e->modifiers() & Qt::ShiftModifier ? true : false;
@@ -312,10 +312,10 @@ void QgsMapToolFreezeLabels::freezeThawLabels( const QgsRectangle& ext, QMouseEv
continue;
}

QString labelStringID = QString("%0|%1").arg(mCurrentLabelPos.layerID, QString::number( mCurrentLabelPos.featureId ) );
QString labelStringID = QString( "%0|%1" ).arg( mCurrentLabelPos.layerID, QString::number( mCurrentLabelPos.featureId ) );

// thaw label
if ( mCurrentLabelPos.isFrozen && !doHide && ( doThaw || toggleThawOrFreeze ) )
if ( mCurrentLabelPos.isFrozen && !doHide && ( doThaw || toggleThawOrFreeze ) )
{
// thaw previously frozen label (set attribute table fields to NULL)
if ( freezeThawLabel( vlayer, mCurrentLabelPos, false ) )
@@ -370,8 +370,8 @@ void QgsMapToolFreezeLabels::freezeThawLabels( const QgsRectangle& ext, QMouseEv
}

bool QgsMapToolFreezeLabels::freezeThawLabel( QgsVectorLayer* vlayer,
const QgsLabelPosition& labelpos,
bool freeze )
const QgsLabelPosition& labelpos,
bool freeze )
{
// skip diagrams
if ( labelpos.isDiagram )
@@ -24,7 +24,7 @@
#include "qgscoordinatetransform.h"

class QgsHighlight;
class QgsLabelPosition;
struct QgsLabelPosition;

/**A map tool for freezing (writing to attribute table) and thawing label positions and rotation*/
class QgsMapToolFreezeLabels: public QgsMapToolLabel
@@ -89,7 +89,7 @@ class QgsMapToolFreezeLabels: public QgsMapToolLabel
const QColor& color );

//! Select valid labels to freeze or thaw
void freezeThawLabels( const QgsRectangle& ext, QMouseEvent * e );
void freezeThawLabels( const QgsRectangle& ext, QMouseEvent * e );

//! Freeze or thaw label relative to whether its editable
bool freezeThawLabel( QgsVectorLayer* vlayer,
@@ -1547,6 +1547,7 @@ void QgsRasterLayerProperties::updatePipeList()

void QgsRasterLayerProperties::pipeItemClicked( QTreeWidgetItem * item, int column )
{
Q_UNUSED( column );
QgsDebugMsg( "Entered" );
int idx = mPipeTreeWidget->indexOfTopLevelItem( item );

@@ -1566,12 +1567,12 @@ void QgsRasterLayerProperties::updatePipeItems()
for ( int i = 0; i < pipe->size(); i++ )
{
if ( i >= mPipeTreeWidget->topLevelItemCount() ) break;
QgsRasterInterface * interface = pipe->at( i );
QTreeWidgetItem *item = mPipeTreeWidget->topLevelItem( i );
if ( !item ) continue;
// Checkboxes disabled for now, see above
/*
bool on = interface->on();
#if 0
QgsRasterInterface * iface = pipe->at( i );
bool on = iface->on();
Qt::ItemFlags flags = item->flags();
if ( pipe->canSetOn( i, !on ) )
{
@@ -1582,6 +1583,6 @@ void QgsRasterLayerProperties::updatePipeItems()
flags |= ( Qt::ItemFlags )~Qt::ItemIsUserCheckable;
}
item->setFlags( flags );
*/
#endif
}
}
@@ -1008,7 +1008,7 @@ void QgsVectorLayerProperties::saveStyleAsMenuTriggered( QAction *action )
if ( index < 0 )
return;

saveStyleAs( (StyleType) index );
saveStyleAs(( StyleType ) index );
}

void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
@@ -1029,7 +1029,7 @@ void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
}

QString myOutputFileName = QFileDialog::getSaveFileName( this, tr( "Save layer properties as style file" ),
myLastUsedDir, format );
myLastUsedDir, format );
if ( myOutputFileName.isNull() ) //dialog canceled
{
return;
@@ -147,7 +147,7 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
private slots:

/** save the style based on selected format from the menu */
void saveStyleAsMenuTriggered( QAction * );
void saveStyleAsMenuTriggered( QAction * );

protected:

@@ -158,7 +158,7 @@ void QgsQtLocationConnection::startGPS()
if ( locationDataSource )
{
locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods ); //QGeoPositionInfoSource::AllPositioningMethods
locationDataSource->setUpdateInterval(1000);
locationDataSource->setUpdateInterval( 1000 );
// Whenever the location data source signals that the current
// position is updated, the positionUpdated function is called.
QObject::connect( locationDataSource,
@@ -85,28 +85,30 @@ void QgsApplication::init( QString customConfigPath )
}
qRegisterMetaType<QgsGeometry::Error>( "QgsGeometry::Error" );

QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : applicationDirPath() );

// check if QGIS is run from build directory (not the install directory)
QDir appDir( applicationDirPath() );
QDir appDir( prefixPath );
#ifndef _MSC_VER
#define SOURCE_PATH "source_path.txt"
#else
#define SOURCE_PATH "../source_path.txt"
#endif
if ( appDir.exists( SOURCE_PATH ) )
{
QFile f( applicationDirPath() + "/" + SOURCE_PATH );
QFile f( prefixPath + "/" + SOURCE_PATH );
if ( f.open( QIODevice::ReadOnly ) )
{
ABISYM( mRunningFromBuildDir ) = true;
ABISYM( mBuildSourcePath ) = f.readAll();
#if _MSC_VER
QStringList elems = applicationDirPath().split( "/", QString::SkipEmptyParts );
QStringList elems = prefixPath.split( "/", QString::SkipEmptyParts );
ABISYM( mCfgIntDir ) = elems.last();
ABISYM( mBuildOutputPath ) = applicationDirPath() + "/../..";
ABISYM( mBuildOutputPath ) = prefixPath + "/../..";
#elif defined(Q_WS_MACX)
ABISYM( mBuildOutputPath ) = applicationDirPath();
ABISYM( mBuildOutputPath ) = prefixPath;
#else
ABISYM( mBuildOutputPath ) = applicationDirPath() + "/.."; // on linux
ABISYM( mBuildOutputPath ) = prefixPath + "/.."; // on linux
#endif
qDebug( "Running from build directory!" );
qDebug( "- source directory: %s", ABISYM( mBuildSourcePath ).toAscii().data() );

0 comments on commit 5a3d14a

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