Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/qgis/Quantum-GIS into sty…

…les_to_db

Conflicts:
	python/console/console_editor.py
	src/core/qgsvectordataprovider.h
	src/core/qgsvectorfilewriter.cpp
  • Loading branch information
Emilio Loi
Emilio Loi committed Apr 30, 2013
2 parents c499df7 + 009ba1b commit 0704366abedb212d99e15ecd5183df592ad579a5
Showing with 6,917 additions and 3,449 deletions.
  1. +1 −0 doc/AUTHORS
  2. +32 −32 doc/TRANSLATORS
  3. +4,040 −3,060 i18n/qgis_sv.ts
  4. +896 −0 python/console/console_editor.py
  5. +1 −3 python/console/console_sci.py
  6. +30 −5 python/core/qgsmaprenderer.sip
  7. +0 −3 python/core/raster/qgsrasterbandstats.sip
  8. +1 −4 python/core/raster/qgsrasterdataprovider.sip
  9. +0 −10 python/core/raster/qgsrasteriterator.sip
  10. +3 −2 python/core/raster/qgsrasterlayer.sip
  11. +3 −3 python/core/raster/qgsrasternuller.sip
  12. +0 −15 python/core/raster/qgsrasterprojector.sip
  13. +16 −17 python/core/raster/qgsrasterviewport.sip
  14. +1 −1 python/gui/qgsrasterlayersaveasdialog.sip
  15. +4 −4 src/app/legend/qgslegend.cpp
  16. +5 −2 src/app/qgisapp.cpp
  17. +2 −2 src/app/qgsmaptoolmovefeature.cpp
  18. +2 −2 src/app/qgsmaptoolrotatefeature.cpp
  19. +1 −1 src/app/qgsrasterlayerproperties.cpp
  20. +4 −1 src/core/qgsfeaturestore.h
  21. +23 −6 src/core/qgsmaprenderer.cpp
  22. +30 −5 src/core/qgsmaprenderer.h
  23. +3 −37 src/core/qgsvectordataprovider.h
  24. +1,497 −0 src/core/qgsvectorfilewriter.cpp
  25. +3 −0 src/core/qgsvectorfilewriter.h
  26. +1 −1 src/core/raster/qgshuesaturationfilter.cpp
  27. +4 −10 src/core/raster/qgsrasterbandstats.h
  28. +3 −2 src/core/raster/qgsrasterblock.cpp
  29. +2 −2 src/core/raster/qgsrasterdataprovider.cpp
  30. +4 −3 src/core/raster/qgsrasterdataprovider.h
  31. +2 −11 src/core/raster/qgsrasterdrawer.cpp
  32. +5 −43 src/core/raster/qgsrasterfilewriter.cpp
  33. +8 −5 src/core/raster/qgsrasterfilewriter.h
  34. +0 −1 src/core/raster/qgsrasterinterface.cpp
  35. +1 −9 src/core/raster/qgsrasteriterator.cpp
  36. +12 −11 src/core/raster/qgsrasteriterator.h
  37. +39 −33 src/core/raster/qgsrasterlayer.cpp
  38. +7 −6 src/core/raster/qgsrasterlayer.h
  39. +54 −15 src/core/raster/qgsrasternuller.cpp
  40. +9 −6 src/core/raster/qgsrasternuller.h
  41. +7 −6 src/core/raster/qgsrasterprojector.h
  42. +17 −18 src/core/raster/qgsrasterviewport.h
  43. +4 −5 src/gui/qgsrasterlayersaveasdialog.cpp
  44. +2 −2 src/gui/qgsrasterlayersaveasdialog.h
  45. +5 −4 src/gui/qgsrubberband.cpp
  46. +1 −1 src/plugins/georeferencer/qgsgcpcanvasitem.cpp
  47. +2 −2 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  48. +6 −13 src/providers/gdal/qgsgdalprovider.cpp
  49. +0 −13 src/providers/gdal/qgsgdalprovider.h
  50. +1 −1 src/providers/grass/qgsgrassrasterprovider.cpp
  51. +1 −1 src/providers/ogr/qgsogrprovider.cpp
  52. +1 −1 src/providers/wcs/qgswcsprovider.cpp
  53. +5 −3 src/providers/wms/qgswmsprovider.cpp
  54. +4 −1 src/ui/qgsoptionsbase.ui
  55. +1 −0 tests/src/core/CMakeLists.txt
  56. +103 −0 tests/src/core/testqgscomposereffects.cpp
  57. +4 −1 tests/src/core/testqgsrasterfilewriter.cpp
  58. +3 −3 tests/src/core/testqgsrasterlayer.cpp
  59. +1 −1 tests/src/python/test_qgsrasterlayer.py
  60. BIN tests/testdata/control_images/expected_composereffects/composereffect_blend.png
  61. BIN tests/testdata/control_images/expected_composereffects/composereffect_transparency.png
@@ -53,3 +53,4 @@ Dave DeHaan <dave.dehaan@sap.com>
Matthias Kuhn <matthias.kuhn at gmx.ch>
Salvatore Larosa <lrssvtml at gmail.com>
Nyall Dawson <nyall.dawson at gmail.com>
Vinayan Parameswaran <vinayan123 at gmail dot com>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -73,9 +73,6 @@ def __init__(self, parent=None):
# Current line visible with special background color
self.setCaretWidth(2)

# Set Python lexer
self.setLexers()

self.settingsShell()

# Don't want to see the horizontal scrollbar at all
@@ -110,6 +107,7 @@ def __init__(self, parent=None):
self.completion_list_selected)

def settingsShell(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThreshold", 2).toInt()[0]
self.setAutoCompletionThreshold(threshold)
@@ -152,19 +152,44 @@ class QgsMapRenderer : QObject
QSize outputSize();
QSizeF outputSizeF();

//! transform extent in layer's CRS to extent in output CRS
/**
* @brief transform bounding box from layer's CRS to output CRS
* @see layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect ) if you want to transform a rectangle
* @return a bounding box (aligned rectangle) containing the transformed extent
*/
QgsRectangle layerExtentToOutputExtent( QgsMapLayer* theLayer, QgsRectangle extent );

//! transform extent in output CRS to extent in layer's CRS
/**
* @brief transform bounding box from output CRS to layer's CRS
* @see mapToLayerCoordinates( QgsMapLayer* theLayer,QgsRectangle rect ) if you want to transform a rectangle
* @return a bounding box (aligned rectangle) containing the transformed extent
*/
QgsRectangle outputExtentToLayerExtent( QgsMapLayer* theLayer, QgsRectangle extent );

//! transform coordinates from layer's CRS to output CRS
/**
* @brief transform point coordinates from layer's CRS to output CRS
* @return the transformed point
*/
QgsPoint layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint point );

//! transform coordinates from output CRS to layer's CRS
/**
* @brief transform rectangle from layer's CRS to output CRS
* @see layerExtentToOutputExtent() if you want to transform a bounding box
* @return the transformed rectangle
*/
QgsRectangle layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect );

/**
* @brief transform point coordinates from output CRS to layer's CRS
* @return the transformed point
*/
QgsPoint mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point );

//! transform rect's coordinates from output CRS to layer's CRS
/**
* @brief transform rectangle from output CRS to layer's CRS
* @see outputExtentToLayerExtent() if you want to transform a bounding box
* @return the transformed rectangle
*/
QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle rect );

//! sets whether to use projections for this layer set
@@ -27,9 +27,6 @@ class QgsRasterBandStats
/*! Compares region, size etc. not collected statistics */
bool contains( const QgsRasterBandStats &s ) const;

/** \brief The name of the band that these stats belong to. */
QString bandName;

/** \brief The gdal band number (starts at 1)*/
int bandNumber;

@@ -82,7 +82,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
virtual void setUserNoDataValue( int bandNo, QgsRasterRangeList noData );

/** Get list of user no data value ranges */
virtual QgsRasterRangeList userNoDataValue( int bandNo ) const;
virtual QgsRasterRangeList userNoDataValues( int bandNo ) const;

virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo ) const;

@@ -181,9 +181,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
*/
virtual bool setNoDataValue( int bandNo, double noDataValue );

/**Returns the formats supported by create()*/
virtual QStringList createFormats() const;

/** Remove dataset*/
virtual bool remove();

@@ -4,16 +4,6 @@ class QgsRasterIterator
#include <qgsrasteriterator.h>
%End
public:
//Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
struct RasterPartInfo
{
int currentCol;
int currentRow;
int nCols;
int nRows;
QgsRasterBlock *block;
QgsRasterProjector* prj; //raster projector (or 0 if no reprojection is done)
};

QgsRasterIterator( QgsRasterInterface* input );
~QgsRasterIterator();
@@ -190,7 +190,8 @@ class QgsRasterLayer : QgsMapLayer
QString providerType() const;

/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixel();
double rasterUnitsPerPixelX();
double rasterUnitsPerPixelY();

/** \brief Mutator for contrast enhancement algorithm
* @param theAlgorithm Contrast enhancement algorithm
@@ -200,7 +201,7 @@ class QgsRasterLayer : QgsMapLayer
* @param theGenerateLookupTableFlag Generate llokup table. */


void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
QgsRaster::ContrastEnhancementLimits theLimits = QgsRaster::ContrastEnhancementMinMax,
QgsRectangle theExtent = QgsRectangle(),
int theSampleSize = QgsRasterLayer::SAMPLE_SIZE,
@@ -21,10 +21,10 @@ class QgsRasterNuller : QgsRasterInterface

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height ) / Factory /;

void setNoData( QList<QgsRasterNuller::NoData> noData );
void setNoData( int bandNo, QgsRasterRangeList noData );

QList<QgsRasterNuller::NoData> noData() const;
QgsRasterRangeList noData( int bandNo ) const;

/** \brief Set output no data value. */
void setOutputNoData( double noData );
void setOutputNoDataValue( int bandNo, double noData );
};
@@ -50,21 +50,6 @@ class QgsRasterProjector : QgsRasterInterface
/** \brief set maximum source resolution */
void setMaxSrcRes( double theMaxSrcXRes, double theMaxSrcYRes );

/** get source extent */
QgsRectangle srcExtent();

/** get/set source width/height */
int srcRows();
int srcCols();
void setSrcRows( int theRows );
void setSrcCols( int theCols );

/** \brief Get source row and column indexes for current source extent and resolution */
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );

int dstRows() const;
int dstCols() const;

QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;
};

@@ -4,28 +4,27 @@ struct QgsRasterViewPort
%TypeHeaderCode
#include <qgsrasterviewport.h>
%End
/** \brief Coordinate (in output device coordinate system) of top left corner
* of the part of the raster that is to be rendered.*/
QgsPoint mTopLeftPoint;
/** \brief Coordinate (in output device coordinate system) of bottom right corner
* of the part of the raster that is to be rendered.*/
QgsPoint mBottomRightPoint;

// NOT IN MAP SPACE BUT DEVICE SPACE
/** \brief Coordinate (in geographic coordinate system) of top left corner of the part of the raster that
* is to be rendered.*/
QgsPoint topLeftPoint;
/** \brief Coordinate (in geographic coordinate system) of bottom right corner of the part of the raster that
* is to be rendered.*/
QgsPoint bottomRightPoint;
/** \brief Distance in map units from left edge to right edge for the part of the raster that
* is to be rendered.*/
/** \brief Width, number of columns to be rendered */
int mWidth;
/** \brief Distance in map units from bottom edge to top edge for the part of
* the raster that is to be rendered.*/
/** \brief Height, number of rows to be rendered */
int mHeight;

int drawableAreaXDim;
/** \brief Distance in map units from bottom edge to top edge for the part of the raster that
* is to be rendered.*/
int drawableAreaYDim;

// intersection of current map extent and layer extent
/** \brief Intersection of current map extent and layer extent */
QgsRectangle mDrawnExtent;

// Source coordinate system
/** \brief Source coordinate system */
QgsCoordinateReferenceSystem mSrcCRS;

// Target coordinate system
/** \brief Target coordinate system */
QgsCoordinateReferenceSystem mDestCRS;

};
@@ -46,7 +46,7 @@ class QgsRasterLayerSaveAsDialog : QDialog
QgsCoordinateReferenceSystem outputCrs();
QStringList createOptions() const;
QgsRectangle outputRectangle() const;
QList<QgsRasterNuller::NoData> noData() const;
QgsRasterRangeList noData() const;

QList< int > pyramidsList() const;
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
@@ -2716,7 +2716,7 @@ void QgsLegend::legendLayerZoomNative()
QgsRasterLayer *layer = qobject_cast<QgsRasterLayer *>( currentLayer->layer() );
if ( layer )
{
QgsDebugMsg( "Raster units per pixel : " + QString::number( layer->rasterUnitsPerPixel() ) );
QgsDebugMsg( "Raster units per pixel : " + QString::number( layer->rasterUnitsPerPixelX() ) );
QgsDebugMsg( "MapUnitsPerPixel before : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );

layer->setCacheImage( NULL );
@@ -2732,11 +2732,11 @@ void QgsLegend::legendLayerZoomNative()
p2 = ct.transform( p2 );
double width = sqrt( p1.sqrDist( p2 ) ); // width of reprojected pixel
// This is not perfect of course, we use the resolution in just one direction
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixel() / width ) );
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixelX() / width ) );
}
else
{
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel() ) );
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixelX() / mMapCanvas->mapUnitsPerPixel() ) );
}
mMapCanvas->refresh();
QgsDebugMsg( "MapUnitsPerPixel after : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );
@@ -2757,7 +2757,7 @@ void QgsLegend::legendLayerStretchUsingCurrentExtent()

QgsRectangle myRectangle;
myRectangle = mMapCanvas->mapRenderer()->outputExtentToLayerExtent( layer, mMapCanvas->extent() );
layer->setContrastEnhancementAlgorithm( contrastEnhancementAlgorithm, QgsRaster::ContrastEnhancementMinMax, myRectangle );
layer->setContrastEnhancement( contrastEnhancementAlgorithm, QgsRaster::ContrastEnhancementMinMax, myRectangle );

layer->setCacheImage( NULL );
refreshLayerSymbology( layer->id() );
@@ -4295,7 +4295,10 @@ void QgisApp::saveAsRasterFile()
}

QgsRasterNuller *nuller = new QgsRasterNuller();
nuller->setNoData( d.noData() );
for ( int band = 1; band <= rasterLayer->dataProvider()->bandCount(); band ++ )
{
nuller->setNoData( band, d.noData() );
}
if ( !pipe->insert( 1, nuller ) )
{
QgsDebugMsg( "Cannot set pipe nuller" );
@@ -6488,7 +6491,7 @@ void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRaster::ContrastEnhance
QgsRectangle myRectangle;
if ( visibleAreaOnly ) myRectangle = mMapCanvas->mapRenderer()->outputExtentToLayerExtent( myRasterLayer, mMapCanvas->extent() );

myRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, theLimits, myRectangle );
myRasterLayer->setContrastEnhancement( QgsContrastEnhancement::StretchToMinimumMaximum, theLimits, myRectangle );

myRasterLayer->setCacheImage( NULL );
mMapCanvas->refresh();
@@ -112,14 +112,14 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
mMovedFeatures.clear();
mMovedFeatures << cf.id(); //todo: take the closest feature, not the first one...

mRubberBand = createRubberBand();
mRubberBand = createRubberBand( vlayer->geometryType() );
mRubberBand->setToGeometry( cf.geometry(), vlayer );
}
else
{
mMovedFeatures = vlayer->selectedFeaturesIds();

mRubberBand = createRubberBand();
mRubberBand = createRubberBand( vlayer->geometryType() );
for ( int i = 0; i < vlayer->selectedFeatureCount(); i++ )
{
mRubberBand->addGeometry( vlayer->selectedFeatures()[i].geometry(), vlayer );
@@ -155,14 +155,14 @@ void QgsMapToolRotateFeature::canvasPressEvent( QMouseEvent * e )
mRotatedFeatures.clear();
mRotatedFeatures << cf.id(); //todo: take the closest feature, not the first one...

mRubberBand = createRubberBand();
mRubberBand = createRubberBand( vlayer->geometryType() );
mRubberBand->setToGeometry( cf.geometry(), vlayer );
}
else
{
mRotatedFeatures = vlayer->selectedFeaturesIds();

mRubberBand = createRubberBand();
mRubberBand = createRubberBand( vlayer->geometryType() );
for ( int i = 0; i < vlayer->selectedFeatureCount(); i++ )
{
mRubberBand->addGeometry( vlayer->selectedFeatures()[i].geometry(), vlayer );
@@ -645,7 +645,7 @@ void QgsRasterLayerProperties::sync()
mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData );
lblSrcNoDataValue->setEnabled( enableSrcNoData );

QgsRasterRangeList noDataRangeList = mRasterLayer->dataProvider()->userNoDataValue( 1 );
QgsRasterRangeList noDataRangeList = mRasterLayer->dataProvider()->userNoDataValues( 1 );
QgsDebugMsg( QString( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
if ( noDataRangeList.size() > 0 )
{
@@ -57,8 +57,11 @@ class CORE_EXPORT QgsFeatureStore
/** Get features list reference */
QgsFeatureList& features() { return mFeatures; }

/** Set map of optional parameters */
void setParams( const QMap<QString, QVariant> &theParams ) { mParams = theParams; }

/** Get map of optional parameters */
QMap<QString, QVariant>& params() { return mParams; }
QMap<QString, QVariant> params() const { return mParams; }

private:
QgsFields mFields;
@@ -877,8 +877,7 @@ QgsPoint QgsMapRenderer::layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint
}
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Transform error caught: %1" ).arg( cse.what() ) );
QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ) );
}
}
else
@@ -888,6 +887,26 @@ QgsPoint QgsMapRenderer::layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint
return point;
}

QgsRectangle QgsMapRenderer::layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect )
{
if ( hasCrsTransformEnabled() )
{
try
{
rect = tr( theLayer )->transform( rect, QgsCoordinateTransform::ForwardTransform );
}
catch ( QgsCsException &cse )
{
QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ) );
}
}
else
{
// leave point without transformation
}
return rect;
}

QgsPoint QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point )
{
if ( hasCrsTransformEnabled() )
@@ -898,8 +917,7 @@ QgsPoint QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint
}
catch ( QgsCsException &cse )
{
QgsDebugMsg( QString( "Transform error caught: %1" ).arg( cse.what() ) );
throw cse; //let client classes know there was a transformation error
QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ) );
}
}
else
@@ -919,8 +937,7 @@ QgsRectangle QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRe
}
catch ( QgsCsException &cse )
{
QgsDebugMsg( QString( "Transform error caught: %1" ).arg( cse.what() ) );
throw cse; //let client classes know there was a transformation error
QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ) );
}
}
return rect;

0 comments on commit 0704366

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