mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Merge branch 'master' of github.com:qgis/Quantum-GIS
This commit is contained in:
commit
5a3d14a9f9
@ -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,8 +85,10 @@ 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
|
||||
@ -94,19 +96,19 @@ void QgsApplication::init( QString customConfigPath )
|
||||
#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() );
|
||||
|
@ -451,21 +451,21 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
|
||||
/**Writes into the provider datasource*/
|
||||
virtual bool write( void* data, int band, int width, int height, int xOffset, int yOffset )
|
||||
{
|
||||
Q_UNUSED( data );
|
||||
Q_UNUSED( band );
|
||||
Q_UNUSED( width );
|
||||
Q_UNUSED( height );
|
||||
Q_UNUSED( xOffset );
|
||||
Q_UNUSED( yOffset );
|
||||
return false;
|
||||
Q_UNUSED( data );
|
||||
Q_UNUSED( band );
|
||||
Q_UNUSED( width );
|
||||
Q_UNUSED( height );
|
||||
Q_UNUSED( xOffset );
|
||||
Q_UNUSED( yOffset );
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Creates a new dataset with mDataSourceURI
|
||||
@return true in case of success*/
|
||||
virtual bool create( const QString& format, int nBands,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
int width, int height, double* geoTransform,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
QStringList createOptions = QStringList() /*e.v. color table*/ )
|
||||
{
|
||||
Q_UNUSED( format );
|
||||
|
@ -34,8 +34,8 @@ QgsRasterProjector::QgsRasterProjector(
|
||||
, mDestExtent( theDestExtent )
|
||||
, mExtent( theExtent )
|
||||
, mDestRows( theDestRows ), mDestCols( theDestCols )
|
||||
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
|
||||
, pHelperTop( 0 ), pHelperBottom( 0 )
|
||||
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
|
||||
{
|
||||
QgsDebugMsg( "Entered" );
|
||||
QgsDebugMsg( "theDestExtent = " + theDestExtent.toString() );
|
||||
@ -53,8 +53,8 @@ QgsRasterProjector::QgsRasterProjector(
|
||||
, mDestCRS( theDestCRS )
|
||||
, mCoordinateTransform( theDestCRS, theSrcCRS )
|
||||
, mExtent( theExtent )
|
||||
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
|
||||
, pHelperTop( 0 ), pHelperBottom( 0 )
|
||||
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
|
||||
{
|
||||
QgsDebugMsg( "Entered" );
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ bool QgsScaleUtils::loadScaleList( const QString &fileName, QStringList &scales,
|
||||
if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
|
||||
{
|
||||
errorMessage = QString( "Parse error at line %1, column %2:\n%3" )
|
||||
.arg( errorLine )
|
||||
.arg( errorColumn )
|
||||
.arg( errorStr );
|
||||
.arg( errorLine )
|
||||
.arg( errorColumn )
|
||||
.arg( errorStr );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q
|
||||
|
||||
void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
|
||||
{
|
||||
Q_UNUSED( bandNo );
|
||||
if ( !mInput )
|
||||
{
|
||||
return 0;
|
||||
@ -136,7 +137,6 @@ void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
transparencyType = ( QgsRasterInterface::DataType )mInput->dataType( mAlphaBand );
|
||||
}
|
||||
|
||||
double oversamplingX = 1.0, oversamplingY = 1.0;
|
||||
QSet<int> bands;
|
||||
if ( mRedBand > 0 )
|
||||
{
|
||||
@ -203,9 +203,6 @@ void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
int redVal = 0;
|
||||
int greenVal = 0;
|
||||
int blueVal = 0;
|
||||
int redDataVal = 0;
|
||||
int greenDataVal = 0;
|
||||
int blueDataVal = 0;
|
||||
QRgb defaultColor = qRgba( 255, 255, 255, 0 );
|
||||
double currentOpacity = mOpacity; //opacity (between 0 and 1)
|
||||
|
||||
@ -227,17 +224,14 @@ void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
if ( mRedBand > 0 )
|
||||
{
|
||||
redVal = readValue( redData, redType, currentRasterPos );
|
||||
redDataVal = redVal;
|
||||
}
|
||||
if ( mGreenBand > 0 )
|
||||
{
|
||||
greenVal = readValue( greenData, greenType, currentRasterPos );
|
||||
greenDataVal = greenVal;
|
||||
}
|
||||
if ( mBlueBand > 0 )
|
||||
{
|
||||
blueVal = readValue( blueData, blueType, currentRasterPos );
|
||||
blueDataVal = blueVal;
|
||||
}
|
||||
|
||||
//apply default color if red, green or blue not in displayable range
|
||||
|
@ -24,7 +24,7 @@
|
||||
class QPainter;
|
||||
class QImage;
|
||||
class QgsMapToPixel;
|
||||
class QgsRasterViewPort;
|
||||
struct QgsRasterViewPort;
|
||||
class QgsRasterIterator;
|
||||
|
||||
class QgsRasterDrawer
|
||||
|
@ -188,7 +188,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
|
||||
void* blueData = VSIMalloc( mMaxTileWidth * mMaxTileHeight );
|
||||
void* alphaData = VSIMalloc( mMaxTileWidth * mMaxTileHeight );
|
||||
QgsRectangle mapRect;
|
||||
int iterLeft, iterTop, iterCols, iterRows;
|
||||
int iterLeft = 0, iterTop = 0, iterCols = 0, iterRows = 0;
|
||||
int fileIndex = 0;
|
||||
|
||||
//create destProvider for whole dataset here
|
||||
|
@ -45,7 +45,7 @@ class CORE_EXPORT QgsRasterFileWriter
|
||||
int maxTileWidth() const { return mMaxTileWidth; }
|
||||
|
||||
void setMaxTileHeight( int h ) { mMaxTileHeight = h; }
|
||||
int maxTileHeight() const { return mMaxTileHeight; }
|
||||
int maxTileHeight() const { return mMaxTileHeight; }
|
||||
|
||||
// for now not putting createOptions in all methods, use createOptions()
|
||||
void setCreateOptions( const QStringList& list ) { mCreateOptions = list; }
|
||||
@ -72,7 +72,7 @@ class CORE_EXPORT QgsRasterFileWriter
|
||||
QgsRasterDataProvider* createPartProvider( const QgsRectangle& extent, int nCols, int iterCols, int iterRows,
|
||||
int iterLeft, int iterTop,
|
||||
const QString& outputUrl, int fileIndex, int nBands, QgsRasterInterface::DataType type,
|
||||
const QgsCoordinateReferenceSystem& crs );
|
||||
const QgsCoordinateReferenceSystem& crs );
|
||||
|
||||
/**Init VRT (for tiled mode) or create global output provider (single-file mode)*/
|
||||
QgsRasterDataProvider* initOutput( int nCols, int nRows, const QgsCoordinateReferenceSystem& crs, double* geoTransform, int nBands,
|
||||
|
@ -50,6 +50,12 @@ bool QgsRasterInterface::typeIsNumeric( DataType dataType ) const
|
||||
case CFloat32:
|
||||
case CFloat64:
|
||||
return true;
|
||||
|
||||
case UnknownDataType:
|
||||
case ARGB32:
|
||||
case ARGB32_Premultiplied:
|
||||
case TypeCount:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -61,6 +67,21 @@ bool QgsRasterInterface::typeIsColor( DataType dataType ) const
|
||||
case ARGB32:
|
||||
case ARGB32_Premultiplied:
|
||||
return true;
|
||||
|
||||
case UnknownDataType:
|
||||
case Byte:
|
||||
case UInt16:
|
||||
case Int16:
|
||||
case UInt32:
|
||||
case Int32:
|
||||
case Float32:
|
||||
case CInt16:
|
||||
case Float64:
|
||||
case CInt32:
|
||||
case CFloat32:
|
||||
case CFloat64:
|
||||
case TypeCount:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
class QgsMapToPixel;
|
||||
class QgsRasterInterface;
|
||||
class QgsRasterProjector;
|
||||
class QgsRasterViewPort;
|
||||
struct QgsRasterViewPort;
|
||||
|
||||
class QgsRasterIterator
|
||||
class CORE_EXPORT QgsRasterIterator
|
||||
{
|
||||
public:
|
||||
//Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
|
||||
|
@ -129,11 +129,6 @@ bool QgsRasterPipe::set( QgsRasterInterface* theInterface )
|
||||
|
||||
if ( !theInterface ) return false;
|
||||
|
||||
QgsRasterDataProvider * provider = dynamic_cast<QgsRasterDataProvider *>( theInterface );
|
||||
QgsRasterRenderer * renderer;
|
||||
QgsRasterResampleFilter * resampleFilter;
|
||||
QgsRasterProjector * projector;
|
||||
|
||||
Role role = interfaceRole( theInterface );
|
||||
|
||||
// We dont know where to place unknown interface
|
||||
@ -179,34 +174,34 @@ bool QgsRasterPipe::set( QgsRasterInterface* theInterface )
|
||||
return insert( idx, theInterface ); // insert may still fail and return false
|
||||
}
|
||||
|
||||
QgsRasterInterface * QgsRasterPipe::interface( Role role ) const
|
||||
QgsRasterInterface * QgsRasterPipe::iface( Role role ) const
|
||||
{
|
||||
QgsDebugMsg( QString( "role = %1" ).arg( role ) );
|
||||
if ( mRoleMap.contains( role ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "role = %1" ).arg( role ) );
|
||||
if ( mRoleMap.contains( role ) )
|
||||
{
|
||||
return mInterfaces.value( mRoleMap.value( role ) );
|
||||
}
|
||||
return 0;
|
||||
return mInterfaces.value( mRoleMap.value( role ) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QgsRasterDataProvider * QgsRasterPipe::provider() const
|
||||
{
|
||||
return dynamic_cast<QgsRasterDataProvider *>( interface( ProviderRole ) );
|
||||
return dynamic_cast<QgsRasterDataProvider *>( iface( ProviderRole ) );
|
||||
}
|
||||
|
||||
QgsRasterRenderer * QgsRasterPipe::renderer() const
|
||||
{
|
||||
return dynamic_cast<QgsRasterRenderer *>( interface( RendererRole ) );
|
||||
return dynamic_cast<QgsRasterRenderer *>( iface( RendererRole ) );
|
||||
}
|
||||
|
||||
QgsRasterResampleFilter * QgsRasterPipe::resampleFilter() const
|
||||
{
|
||||
return dynamic_cast<QgsRasterResampleFilter *>( interface( ResamplerRole ) );
|
||||
return dynamic_cast<QgsRasterResampleFilter *>( iface( ResamplerRole ) );
|
||||
}
|
||||
|
||||
QgsRasterProjector * QgsRasterPipe::projector() const
|
||||
{
|
||||
return dynamic_cast<QgsRasterProjector*>( interface( ProjectorRole ) );
|
||||
return dynamic_cast<QgsRasterProjector*>( iface( ProjectorRole ) );
|
||||
}
|
||||
|
||||
bool QgsRasterPipe::remove( int idx )
|
||||
|
@ -69,7 +69,7 @@ class CORE_EXPORT QgsRasterPipe
|
||||
bool set( QgsRasterInterface * theInterface );
|
||||
|
||||
/** Get known interface by role */
|
||||
QgsRasterInterface * interface( Role role ) const;
|
||||
QgsRasterInterface * iface( Role role ) const;
|
||||
|
||||
/** Remove and delete interface at given index if possible */
|
||||
bool remove( int idx );
|
||||
@ -99,7 +99,7 @@ class CORE_EXPORT QgsRasterPipe
|
||||
|
||||
private:
|
||||
/** Get known parent type_info of interface parent */
|
||||
Role interfaceRole( QgsRasterInterface * interface ) const;
|
||||
Role interfaceRole( QgsRasterInterface * iface ) const;
|
||||
|
||||
// Interfaces in pipe, the first is always provider
|
||||
QVector<QgsRasterInterface*> mInterfaces;
|
||||
|
@ -68,8 +68,7 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
|
||||
/**Get symbology items if provided by renderer*/
|
||||
virtual void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const { Q_UNUSED( symbolItems ); }
|
||||
|
||||
virtual void writeXML( QDomDocument& doc, QDomElement& parentElem ) const {}
|
||||
|
||||
virtual void writeXML( QDomDocument&, QDomElement& ) const {}
|
||||
/**Sets base class members from xml. Usually called from create() methods of subclasses*/
|
||||
void readXML( const QDomElement& rendererElem );
|
||||
|
||||
|
@ -90,8 +90,8 @@ bool QgsRasterResampleFilter::setInput( QgsRasterInterface* input )
|
||||
|
||||
if ( input->dataType( 1 ) != QgsRasterInterface::ARGB32_Premultiplied )
|
||||
{
|
||||
return false;
|
||||
QgsDebugMsg( "Unknown input data type" );
|
||||
return false;
|
||||
}
|
||||
|
||||
mInput = input;
|
||||
@ -113,6 +113,7 @@ void QgsRasterResampleFilter::setZoomedOutResampler( QgsRasterResampler* r )
|
||||
|
||||
void * QgsRasterResampleFilter::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
|
||||
{
|
||||
Q_UNUSED( bandNo );
|
||||
QgsDebugMsg( "Entered" );
|
||||
if ( !mInput ) return 0;
|
||||
|
||||
@ -190,7 +191,7 @@ void QgsRasterResampleFilter::writeXML( QDomDocument& doc, QDomElement& parentEl
|
||||
|
||||
QDomElement rasterRendererElem = doc.createElement( "rasterresampler" );
|
||||
|
||||
rasterRendererElem.setAttribute( "maxOversampling", mMaxOversampling );
|
||||
rasterRendererElem.setAttribute( "maxOversampling", QString::number( mMaxOversampling ) );
|
||||
if ( mZoomedInResampler )
|
||||
{
|
||||
rasterRendererElem.setAttribute( "zoomedInResampler", mZoomedInResampler->type() );
|
||||
|
@ -25,7 +25,7 @@ class QgsRasterResampler;
|
||||
|
||||
class QDomElement;
|
||||
|
||||
class QgsRasterResampleFilter : public QgsRasterInterface
|
||||
class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface
|
||||
{
|
||||
public:
|
||||
QgsRasterResampleFilter( QgsRasterInterface* input = 0 );
|
||||
|
@ -55,8 +55,6 @@ void * QgsSingleBandColorDataRenderer::readBlock( int bandNo, QgsRectangle cons
|
||||
|
||||
bool hasTransparency = usesTransparency();
|
||||
|
||||
QgsRasterInterface::DataType rasterType = ( QgsRasterInterface::DataType )mInput->dataType( mBand );
|
||||
|
||||
void* rasterData = mInput->block( bandNo, extent, width, height );
|
||||
|
||||
currentRasterPos = 0;
|
||||
|
@ -62,6 +62,7 @@ void QgsSingleBandGrayRenderer::setContrastEnhancement( QgsContrastEnhancement*
|
||||
|
||||
void * QgsSingleBandGrayRenderer::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
|
||||
{
|
||||
Q_UNUSED( bandNo );
|
||||
if ( !mInput )
|
||||
{
|
||||
return 0;
|
||||
@ -79,14 +80,15 @@ void * QgsSingleBandGrayRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
|
||||
void* alphaData = 0;
|
||||
double currentAlpha = mOpacity;
|
||||
int grayVal, grayValOrig;
|
||||
int grayVal;
|
||||
QRgb myDefaultColor = qRgba( 0, 0, 0, 0 );
|
||||
|
||||
if ( mAlphaBand > 0 && mGrayBand != mAlphaBand )
|
||||
{
|
||||
alphaData = mInput->block( mAlphaBand, extent, width, height );
|
||||
if ( !alphaData ) {
|
||||
free ( rasterData );
|
||||
if ( !alphaData )
|
||||
{
|
||||
free( rasterData );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -95,7 +97,7 @@ void * QgsSingleBandGrayRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
alphaData = rasterData;
|
||||
}
|
||||
|
||||
QImage *img = createImage ( width, height, QImage::Format_ARGB32_Premultiplied );
|
||||
QImage *img = createImage( width, height, QImage::Format_ARGB32_Premultiplied );
|
||||
QRgb* imageScanLine = 0;
|
||||
int currentRasterPos = 0;
|
||||
|
||||
@ -104,7 +106,7 @@ void * QgsSingleBandGrayRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
imageScanLine = ( QRgb* )( img->scanLine( i ) );
|
||||
for ( int j = 0; j < width; ++j )
|
||||
{
|
||||
grayValOrig = grayVal = readValue( rasterData, rasterType, currentRasterPos );
|
||||
grayVal = readValue( rasterData, rasterType, currentRasterPos );
|
||||
|
||||
//alpha
|
||||
currentAlpha = mOpacity;
|
||||
@ -145,13 +147,13 @@ void * QgsSingleBandGrayRenderer::readBlock( int bandNo, QgsRectangle const & e
|
||||
}
|
||||
}
|
||||
|
||||
free ( rasterData );
|
||||
if ( mAlphaBand > 0 && mGrayBand != mAlphaBand )
|
||||
free( rasterData );
|
||||
if ( mAlphaBand > 0 && mGrayBand != mAlphaBand )
|
||||
{
|
||||
free ( alphaData );
|
||||
free( alphaData );
|
||||
}
|
||||
|
||||
void * data = (void *)img->bits();
|
||||
void * data = ( void * )img->bits();
|
||||
delete img;
|
||||
return data; // OK, the image was created with extraneous data
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ QgsRasterRenderer* QgsSingleBandPseudoColorRenderer::create( const QDomElement&
|
||||
|
||||
void * QgsSingleBandPseudoColorRenderer::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
|
||||
{
|
||||
Q_UNUSED( bandNo );
|
||||
if ( !mInput || !mShader )
|
||||
{
|
||||
return 0;
|
||||
|
@ -249,7 +249,7 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
|
||||
item = new QListWidgetItem( it.key() );
|
||||
item->setData( Qt::UserRole, it.value() );
|
||||
item->setCheckState( checkList.contains( it.value() ) ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item = new QListWidgetItem( it.value() );
|
||||
|
@ -158,7 +158,7 @@ QgsMapCanvas::~QgsMapCanvas()
|
||||
it++;
|
||||
}
|
||||
|
||||
delete mScene;
|
||||
mScene->deleteLater(); // crashes in python tests on windows
|
||||
|
||||
delete mMapRenderer;
|
||||
// mCanvasProperties auto-deleted via std::auto_ptr
|
||||
|
@ -262,7 +262,7 @@ bool QgsRasterFormatSaveOptionsWidget::validateOptions( bool gui )
|
||||
{
|
||||
// print error string?
|
||||
char** papszOptions = papszFromStringList( createOptions );
|
||||
ok = ( GDALValidateCreationOptions( myGdalDriver, papszOptions ) == TRUE );
|
||||
ok = GDALValidateCreationOptions( myGdalDriver, papszOptions );
|
||||
CSLDestroy( papszOptions );
|
||||
if ( gui )
|
||||
{
|
||||
|
@ -2174,10 +2174,10 @@ char** papszFromStringList( const QStringList& list )
|
||||
return papszRetList;
|
||||
}
|
||||
|
||||
bool QgsGdalProvider::create( const QString& format, int nBands,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
int width, int height, double* geoTransform,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
bool QgsGdalProvider::create( const QString& format, int nBands,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
int width, int height, double* geoTransform,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
QStringList createOptions )
|
||||
{
|
||||
//get driver
|
||||
@ -2187,7 +2187,7 @@ bool QgsGdalProvider::create( const QString& format, int nBands,
|
||||
return false;
|
||||
}
|
||||
|
||||
//create dataset
|
||||
//create dataset
|
||||
char **papszOptions = papszFromStringList( createOptions );
|
||||
GDALDatasetH dataset = GDALCreate( driver, dataSourceUri().toLocal8Bit().data(), width, height, nBands, ( GDALDataType )type, papszOptions );
|
||||
CSLDestroy( papszOptions );
|
||||
|
@ -269,9 +269,9 @@ class QgsGdalProvider : public QgsRasterDataProvider
|
||||
|
||||
/** Creates a new dataset with mDataSourceURI
|
||||
@return true in case of success*/
|
||||
bool create( const QString& format, int nBands,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
int width, int height, double* geoTransform,
|
||||
bool create( const QString& format, int nBands,
|
||||
QgsRasterDataProvider::DataType type,
|
||||
int width, int height, double* geoTransform,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
QStringList createOptions = QStringList() );
|
||||
|
||||
|
@ -199,7 +199,7 @@ void TestQgsRasterLayer::checkStats()
|
||||
QVERIFY( mpRasterLayer->bandStatistics( 1 ).minimumValue == 0 );
|
||||
QVERIFY( mpRasterLayer->bandStatistics( 1 ).maximumValue == 9 );
|
||||
QVERIFY( mpRasterLayer->bandStatistics( 1 ).mean == 4.5 );
|
||||
QVERIFY( fabs( mpRasterLayer->bandStatistics( 1 ).stdDev - 2.87228132326901431 )
|
||||
QVERIFY( fabs( mpRasterLayer->bandStatistics( 1 ).stdDev - 2.87228132326901431 )
|
||||
< 0.0000000000000001 );
|
||||
mReport += "<h2>Check Stats</h2>\n";
|
||||
mReport += "<p>Passed</p>";
|
||||
|
@ -1,25 +1,27 @@
|
||||
import unittest
|
||||
from utilities import (getQgisTestApp,
|
||||
setCanvasCrs,
|
||||
GEOCRS,
|
||||
GOOGLECRS
|
||||
)
|
||||
|
||||
from utilities import getQgisTestApp
|
||||
|
||||
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
|
||||
|
||||
class TestQGisApp(unittest.TestCase):
|
||||
|
||||
def testValidThemeName(self):
|
||||
"""That can set the app to use a valid theme"""
|
||||
QGISAPP.setThemeName('gis')
|
||||
myExpectedResult = 'gis'
|
||||
myResult = QGISAPP.themeName()
|
||||
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
|
||||
(myExpectedResult, myResult))
|
||||
|
||||
mySettings = QGISAPP.showSettings()
|
||||
print mySettings
|
||||
|
||||
assert myExpectedResult == myResult, myMessage
|
||||
# Can this work at all?
|
||||
# The theme resources are built into the executable and should only be
|
||||
# available to plugins and not in test applications.
|
||||
#
|
||||
# def testValidThemeName(self):
|
||||
# """That can set the app to use a valid theme"""
|
||||
# QGISAPP.setThemeName('gis')
|
||||
# myExpectedResult = 'gis'
|
||||
# myResult = QGISAPP.themeName()
|
||||
# myMessage = ('Expected:\n%s\nGot:\n%s\n' %
|
||||
# (myExpectedResult, myResult))
|
||||
#
|
||||
# mySettings = QGISAPP.showSettings()
|
||||
# print mySettings
|
||||
#
|
||||
# assert myExpectedResult == myResult, myMessage
|
||||
|
||||
def testInvalidThemeName(self):
|
||||
"""That setting the app to use an invalid theme will fallback to 'default'"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user