Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qgis/Quantum-GIS into sty…
Browse files Browse the repository at this point in the history
…les_to_db

Conflicts:
	python/console/console_editor.py
	src/core/qgsvectordataprovider.h
	src/core/qgsvectorfilewriter.cpp
  • Loading branch information
Emilio Loi committed Apr 30, 2013
2 parents c499df7 + 009ba1b commit 0704366
Show file tree
Hide file tree
Showing 61 changed files with 6,917 additions and 3,449 deletions.
1 change: 1 addition & 0 deletions doc/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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>
64 changes: 32 additions & 32 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

7,100 changes: 4,040 additions & 3,060 deletions i18n/qgis_sv.ts

Large diffs are not rendered by default.

896 changes: 896 additions & 0 deletions python/console/console_editor.py

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
35 changes: 30 additions & 5 deletions python/core/qgsmaprenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions python/core/raster/qgsrasterbandstats.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions python/core/raster/qgsrasterdataprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down
10 changes: 0 additions & 10 deletions python/core/raster/qgsrasteriterator.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions python/core/raster/qgsrasternuller.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
};
15 changes: 0 additions & 15 deletions python/core/raster/qgsrasterprojector.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 /;
};

33 changes: 16 additions & 17 deletions python/core/raster/qgsrasterviewport.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;

};
2 changes: 1 addition & 1 deletion python/gui/qgsrasterlayersaveasdialog.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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() ) );
Expand All @@ -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() );
Expand Down
7 changes: 5 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolmovefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrotatefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
5 changes: 4 additions & 1 deletion src/core/qgsfeaturestore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
29 changes: 23 additions & 6 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() )
Expand All @@ -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
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 0704366

Please sign in to comment.