mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Update Python bindings to match changes in core/gui libraries.
This commit is contained in:
parent
412eaf4a07
commit
2bece090f5
@ -141,7 +141,8 @@ class QgsComposerMap : QgsComposerItem
|
||||
|
||||
QgsRectangle extent() const;
|
||||
|
||||
const QgsMapRenderer* mapRenderer() const;
|
||||
//! @deprecated since 2.1 - use mapSettings() - may return 0 if not initialized with QgsMapRenderer
|
||||
const QgsMapRenderer* mapRenderer() const /Deprecated/;
|
||||
|
||||
/**Sets offset values to shift image (useful for live updates when moving item content)*/
|
||||
void setOffset( double xOffset, double yOffset );
|
||||
|
@ -28,7 +28,9 @@ class QgsComposition : QGraphicsScene
|
||||
Crosses
|
||||
};
|
||||
|
||||
QgsComposition( QgsMapRenderer* mapRenderer );
|
||||
//! @deprecated since 2.1 - use the constructor with QgsMapSettings
|
||||
QgsComposition( QgsMapRenderer* mapRenderer ) /Deprecated/;
|
||||
explicit QgsComposition( const QgsMapSettings& mapSettings );
|
||||
~QgsComposition();
|
||||
|
||||
/**Changes size of paper item*/
|
||||
@ -151,7 +153,12 @@ class QgsComposition : QGraphicsScene
|
||||
void setWorldFileMap( QgsComposerMap* map );
|
||||
|
||||
/**Returns pointer to map renderer of qgis map canvas*/
|
||||
QgsMapRenderer* mapRenderer();
|
||||
//! @deprecated since 2.1 - use mapSettings() instead. May return null if not initialized with QgsMapRenderer
|
||||
QgsMapRenderer* mapRenderer() /Deprecated/;
|
||||
|
||||
//! Return setting of QGIS map canvas
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings() const;
|
||||
|
||||
QgsComposition::PlotStyle plotStyle() const;
|
||||
void setPlotStyle( QgsComposition::PlotStyle style );
|
||||
@ -310,6 +317,10 @@ class QgsComposition : QGraphicsScene
|
||||
public slots:
|
||||
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
|
||||
void sendItemAddedSignal( QgsComposerItem* item );
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
signals:
|
||||
void paperSizeChanged();
|
||||
void nPagesChanged();
|
||||
|
@ -45,7 +45,9 @@
|
||||
%Include qgslogger.sip
|
||||
%Include qgsmaplayer.sip
|
||||
%Include qgsmaplayerregistry.sip
|
||||
%Include qgsmaplayerrenderer.sip
|
||||
%Include qgsmaprenderer.sip
|
||||
%Include qgsmapsettings.sip
|
||||
%Include qgsmaptopixel.sip
|
||||
%Include qgsmessagelog.sip
|
||||
%Include qgsmessageoutput.sip
|
||||
|
@ -5,6 +5,9 @@ class QgsDiagram
|
||||
%End
|
||||
public:
|
||||
virtual ~QgsDiagram();
|
||||
/** Returns an instance that is equivalent to this one
|
||||
* @note added in 2.1 */
|
||||
virtual QgsDiagram* clone() const = 0;
|
||||
/**Draws the diagram at the given position (in pixel coordinates)*/
|
||||
virtual void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position ) = 0;
|
||||
virtual QString diagramName() const = 0;
|
||||
|
@ -7,6 +7,8 @@ class QgsHistogramDiagram: QgsDiagram
|
||||
QgsHistogramDiagram();
|
||||
~QgsHistogramDiagram();
|
||||
|
||||
virtual QgsDiagram* clone() const;
|
||||
|
||||
void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
|
||||
|
@ -7,6 +7,8 @@ class QgsPieDiagram: QgsDiagram
|
||||
QgsPieDiagram();
|
||||
~QgsPieDiagram();
|
||||
|
||||
virtual QgsDiagram* clone() const;
|
||||
|
||||
void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
|
||||
|
@ -20,6 +20,9 @@ class QgsTextDiagram: QgsDiagram
|
||||
|
||||
QgsTextDiagram();
|
||||
~QgsTextDiagram();
|
||||
|
||||
virtual QgsDiagram* clone() const;
|
||||
|
||||
void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
|
||||
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
|
||||
|
@ -24,6 +24,8 @@ struct QgsDiagramLayerSettings
|
||||
|
||||
QgsDiagramLayerSettings();
|
||||
|
||||
~QgsDiagramLayerSettings();
|
||||
|
||||
//pal placement properties
|
||||
Placement placement;
|
||||
LinePlacementFlags placementFlags;
|
||||
@ -118,6 +120,10 @@ class QgsDiagramRendererV2
|
||||
QgsDiagramRendererV2();
|
||||
virtual ~QgsDiagramRendererV2();
|
||||
|
||||
/** Returns new instance that is equivalent to this one
|
||||
* @note added in 2.1 */
|
||||
virtual QgsDiagramRendererV2* clone() const = 0;
|
||||
|
||||
/**Returns size of the diagram for feature f in map units. Returns an invalid QSizeF in case of error*/
|
||||
virtual QSizeF sizeMapUnits( const QgsAttributes& attributes, const QgsRenderContext& c );
|
||||
|
||||
@ -171,6 +177,8 @@ class QgsSingleCategoryDiagramRenderer : QgsDiagramRendererV2
|
||||
QgsSingleCategoryDiagramRenderer();
|
||||
~QgsSingleCategoryDiagramRenderer();
|
||||
|
||||
QgsDiagramRendererV2* clone() const;
|
||||
|
||||
QString rendererName() const;
|
||||
|
||||
QList<int> diagramAttributes() const;
|
||||
@ -198,6 +206,8 @@ class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRendererV2
|
||||
QgsLinearlyInterpolatedDiagramRenderer();
|
||||
~QgsLinearlyInterpolatedDiagramRenderer();
|
||||
|
||||
QgsDiagramRendererV2* clone() const;
|
||||
|
||||
/**Returns list with all diagram settings in the renderer*/
|
||||
QList<QgsDiagramSettings> diagramSettings() const;
|
||||
|
||||
|
@ -63,3 +63,23 @@ class QgsFeatureRequest
|
||||
QgsFeatureRequest& setSubsetOfAttributes( const QStringList& attrNames, const QgsFields& fields );
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** base class that can be used for any class that is capable of returning features
|
||||
* @note added in 2.1
|
||||
*/
|
||||
class QgsAbstractFeatureSource
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfeaturerequest.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
virtual ~QgsAbstractFeatureSource();
|
||||
|
||||
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& request ) = 0;
|
||||
|
||||
protected:
|
||||
void iteratorOpened( QgsAbstractFeatureIterator* it );
|
||||
void iteratorClosed( QgsAbstractFeatureIterator* it );
|
||||
};
|
||||
|
@ -126,6 +126,7 @@ class QgsFields
|
||||
void clear();
|
||||
void append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
|
||||
void remove( int fieldIdx );
|
||||
void extend( const QgsFields& other );
|
||||
|
||||
bool isEmpty() const;
|
||||
// __len__ annotation since sip 4.10.3
|
||||
@ -139,7 +140,6 @@ class QgsFields
|
||||
//const QgsField& operator[](int i) const;
|
||||
//QgsField& operator[](int i);
|
||||
const QgsField& at(int i) const;
|
||||
QList<QgsField> toList() const;
|
||||
|
||||
const QgsField& field( int fieldIdx ) const;
|
||||
const QgsField& field( const QString& name ) const;
|
||||
@ -147,8 +147,17 @@ class QgsFields
|
||||
int fieldOriginIndex( int fieldIdx ) const;
|
||||
|
||||
int indexFromName( const QString& name ) const;
|
||||
void extend( const QgsFields& other );
|
||||
|
||||
//! Look up field's index from name - case insensitive
|
||||
//! TODO: sort out case sensitive (indexFromName()) vs insensitive (fieldNameIndex()) calls
|
||||
//! @note added in 2.1
|
||||
int fieldNameIndex( const QString& fieldName ) const;
|
||||
|
||||
//! Utility function to get list of attribute indexes
|
||||
//! @note added in 2.1
|
||||
QgsAttributeList allAttributesList() const;
|
||||
|
||||
QList<QgsField> toList() const;
|
||||
|
||||
QgsField& operator[](int i) /Factory/;
|
||||
%MethodCode
|
||||
@ -181,5 +190,6 @@ void __setitem__(int key, const QgsField& field);
|
||||
(*sipCpp)[idx] = *a1;
|
||||
%End
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@ class QgsGeometryCache
|
||||
#include <qgsgeometrycache.h>
|
||||
%End
|
||||
public:
|
||||
QgsGeometryCache( QgsVectorLayer* layer );
|
||||
QgsGeometryCache();
|
||||
~QgsGeometryCache();
|
||||
|
||||
QgsGeometryMap& cachedGeometries();
|
||||
@ -25,6 +25,4 @@ class QgsGeometryCache
|
||||
void setCachedGeometriesRect( const QgsRectangle& extent );
|
||||
const QgsRectangle& cachedGeometriesRect();
|
||||
|
||||
protected:
|
||||
QgsVectorLayerEditBuffer *editBuffer();
|
||||
};
|
||||
|
@ -12,10 +12,10 @@ class QgsLabelSearchTree
|
||||
void clear();
|
||||
|
||||
/**Returns label position(s) at a given point. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
|
||||
// void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList );
|
||||
// void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList ) const;
|
||||
|
||||
/**Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
|
||||
// void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList );
|
||||
// void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList ) const;
|
||||
|
||||
/**Inserts label position. Does not take ownership of labelPos
|
||||
@return true in case of success*/
|
||||
|
@ -116,6 +116,11 @@ class QgsMapLayer : QObject
|
||||
@note added in version 1.6*/
|
||||
virtual void reload();
|
||||
|
||||
/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
|
||||
* @note added in 2.1
|
||||
*/
|
||||
virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) /Factory/;
|
||||
|
||||
/** This is the method that does the actual work of
|
||||
* drawing the layer onto a paint device.
|
||||
* @param rendererContext describes the extents,
|
||||
@ -210,21 +215,11 @@ class QgsMapLayer : QObject
|
||||
void removeCustomProperty( const QString& key );
|
||||
|
||||
|
||||
/**
|
||||
* If an operation returns 0 (e.g. draw()), this function
|
||||
* returns the text of the error associated with the failure.
|
||||
* Interactive users of this provider can then, for example,
|
||||
* call a QMessageBox to display the contents.
|
||||
*/
|
||||
virtual QString lastErrorTitle();
|
||||
//! @deprecated since 2.1 - returns empty string
|
||||
virtual QString lastErrorTitle() /Deprecated/;
|
||||
|
||||
/**
|
||||
* If an operation returns 0 (e.g. draw()), this function
|
||||
* returns the text of the error associated with the failure.
|
||||
* Interactive users of this provider can then, for example,
|
||||
* call a QMessageBox to display the contents.
|
||||
*/
|
||||
virtual QString lastError();
|
||||
//! @deprecated since 2.1 - returns empty string
|
||||
virtual QString lastError() /Deprecated/;
|
||||
|
||||
/** Get current status error. This error describes some principal problem
|
||||
* for which layer cannot work and thus is not valid. It is not last error
|
||||
@ -346,18 +341,12 @@ class QgsMapLayer : QObject
|
||||
/** Return pointer to layer's undo stack */
|
||||
QUndoStack* undoStack();
|
||||
|
||||
/** Get the QImage used for caching render operations
|
||||
* @note This method was added in QGIS 1.4 **/
|
||||
QImage *cacheImage();
|
||||
/** Set the QImage used for caching render operations
|
||||
* @note This method was added in QGIS 1.4 **/
|
||||
void setCacheImage( QImage * thepImage /Transfer/ );
|
||||
|
||||
/**
|
||||
* @brief Is called when the cache image is being deleted. Overwrite and use to clean up.
|
||||
* @note added in 2.0
|
||||
*/
|
||||
virtual void onCacheImageDelete();
|
||||
/** @deprecated since 2.1 - returns NULL */
|
||||
QImage *cacheImage() /Deprecated/;
|
||||
/** @deprecated since 2.1 - does nothing */
|
||||
void setCacheImage( QImage * thepImage /Transfer/ ) /Deprecated/;
|
||||
/** @deprecated since 2.1 - does nothing */
|
||||
virtual void onCacheImageDelete() /Deprecated/;
|
||||
|
||||
public slots:
|
||||
|
||||
@ -376,9 +365,8 @@ class QgsMapLayer : QObject
|
||||
void toggleScaleBasedVisibility( bool theVisibilityFlag );
|
||||
bool hasScaleBasedVisibility();
|
||||
|
||||
/** Clear cached image
|
||||
* added in 1.5 */
|
||||
void clearCacheImage();
|
||||
/** @deprecated since 2.1 - does nothing */
|
||||
void clearCacheImage() /Deprecated/;
|
||||
|
||||
/** \brief Obtain Metadata for this layer */
|
||||
virtual QString metadata();
|
||||
@ -388,7 +376,7 @@ class QgsMapLayer : QObject
|
||||
|
||||
signals:
|
||||
|
||||
/** Emit a signal to notify of a progress event */
|
||||
//! @deprecated in 2.1 - not emitted anymore
|
||||
void drawingProgress( int theProgress, int theTotalSteps );
|
||||
|
||||
/** Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar) */
|
||||
@ -407,8 +395,7 @@ class QgsMapLayer : QObject
|
||||
*/
|
||||
void repaintRequested();
|
||||
|
||||
/**The layer emits this signal when a screen update is requested.
|
||||
This signal should be connected with the slot QgsMapCanvas::updateMap()*/
|
||||
//! \note Deprecated in 2.1 and not emitted anymore
|
||||
void screenUpdateRequested();
|
||||
|
||||
/** This is used to send a request that any mapcanvas using this layer update its extents */
|
||||
|
@ -119,7 +119,8 @@ class QgsMapLayerRegistry : QObject
|
||||
*
|
||||
* @note Added in QGIS 1.4
|
||||
*/
|
||||
void clearAllLayerCaches();
|
||||
//! @deprecated since 2.1 - does nothing
|
||||
void clearAllLayerCaches() /Deprecated/;
|
||||
|
||||
/**
|
||||
* Reload all provider data caches (currently used for WFS and WMS providers)
|
||||
|
20
python/core/qgsmaplayerrenderer.sip
Normal file
20
python/core/qgsmaplayerrenderer.sip
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
class QgsMapLayerRenderer
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsmaplayerrenderer.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsMapLayerRenderer( const QString& layerID );
|
||||
virtual ~QgsMapLayerRenderer();
|
||||
|
||||
//! Do the rendering (based on data stored in the class)
|
||||
virtual bool render() = 0;
|
||||
|
||||
//! Return list of errors (problems) that happened during the rendering
|
||||
QStringList errors() const;
|
||||
|
||||
//! Get access to the ID of the layer rendered by this class
|
||||
QString layerID() const;
|
||||
};
|
@ -36,7 +36,10 @@ class QgsLabelingEngineInterface
|
||||
virtual ~QgsLabelingEngineInterface();
|
||||
|
||||
//! called when we're going to start with rendering
|
||||
virtual void init( QgsMapRenderer* mp ) = 0;
|
||||
//! @deprecated since 2.1 - use override with QgsMapSettings
|
||||
virtual void init( QgsMapRenderer* mp ) = 0 /Deprecated/;
|
||||
//! called when we're going to start with rendering
|
||||
virtual void init( const QgsMapSettings& mapSettings ) = 0;
|
||||
//! called to find out whether the layer is used for labeling
|
||||
virtual bool willUseLayer( QgsVectorLayer* layer ) = 0;
|
||||
//! clears all PAL layer settings for registered layers
|
||||
@ -44,29 +47,31 @@ class QgsLabelingEngineInterface
|
||||
virtual void clearActiveLayers() = 0;
|
||||
//! clears data defined objects from PAL layer settings for a registered layer
|
||||
//! @note: this method was added in version 1.9
|
||||
virtual void clearActiveLayer( QgsVectorLayer* layer ) = 0;
|
||||
virtual void clearActiveLayer( const QString& layerID ) = 0;
|
||||
//! called when starting rendering of a layer
|
||||
//! @note: this method was added in version 1.6
|
||||
virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices, QgsRenderContext& ctx ) = 0;
|
||||
virtual int prepareLayer( QgsVectorLayer* layer, QStringList& attrNames, QgsRenderContext& ctx ) = 0;
|
||||
//! returns PAL layer settings for a registered layer
|
||||
//! @note: this method was added in version 1.9
|
||||
virtual QgsPalLayerSettings& layer( const QString& layerName ) = 0;
|
||||
//! adds a diagram layer to the labeling engine
|
||||
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings* s );
|
||||
//! called for every feature
|
||||
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) = 0;
|
||||
virtual void registerFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) = 0;
|
||||
//! called for every diagram feature
|
||||
virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
virtual void registerDiagramFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
//! called when the map is drawn and labels should be placed
|
||||
virtual void drawLabeling( QgsRenderContext& context ) = 0;
|
||||
//! called when we're done with rendering
|
||||
virtual void exit() = 0;
|
||||
//! return infos about labels at a given (map) position
|
||||
//! @note: this method was added in version 1.7
|
||||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = 0;
|
||||
//! @deprecated since 2.1 - use takeResults() and methods of QgsLabelingResults
|
||||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = 0 /Deprecated/;
|
||||
//! return infos about labels within a given (map) rectangle
|
||||
//! @note: this method was added in version 1.9
|
||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) = 0;
|
||||
//! @deprecated since 2.1 - use takeResults() and methods of QgsLabelingResults
|
||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) = 0 /Deprecated/;
|
||||
|
||||
//! called when passing engine among map renderers
|
||||
virtual QgsLabelingEngineInterface* clone() = 0 /Factory/;
|
||||
@ -245,6 +250,17 @@ class QgsMapRenderer : QObject
|
||||
//! Added in QGIS v1.4
|
||||
void setLabelingEngine( QgsLabelingEngineInterface* iface /Transfer/ );
|
||||
|
||||
//! Returns a QPainter::CompositionMode corresponding to a BlendMode
|
||||
//! Added in 1.9
|
||||
static QPainter::CompositionMode getCompositionMode( const QgsMapRenderer::BlendMode blendMode );
|
||||
//! Returns a BlendMode corresponding to a QPainter::CompositionMode
|
||||
//! Added in 1.9
|
||||
static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::CompositionMode blendMode );
|
||||
|
||||
//! bridge to QgsMapSettings
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings();
|
||||
|
||||
signals:
|
||||
|
||||
void drawingProgress( int current, int total );
|
||||
@ -260,10 +276,14 @@ class QgsMapRenderer : QObject
|
||||
//! emitted when layer's draw() returned false
|
||||
void drawError( QgsMapLayer* );
|
||||
|
||||
//! emitted when the current extent gets changed
|
||||
//! @note added in 2.1
|
||||
void extentsChanged();
|
||||
|
||||
public slots:
|
||||
|
||||
//! called by signal from layer current being drawn
|
||||
void onDrawingProgress( int current, int total );
|
||||
//! @deprecated in 2.1 - does nothing
|
||||
void onDrawingProgress( int current, int total ) /Deprecated/;
|
||||
|
||||
protected:
|
||||
|
||||
|
122
python/core/qgsmapsettings.sip
Normal file
122
python/core/qgsmapsettings.sip
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
class QgsMapSettings
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsmapsettings.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsMapSettings();
|
||||
|
||||
QgsRectangle extent() const;
|
||||
void setExtent(const QgsRectangle& rect);
|
||||
|
||||
QSize outputSize() const;
|
||||
void setOutputSize(const QSize& size);
|
||||
|
||||
int outputDpi() const;
|
||||
void setOutputDpi(int dpi);
|
||||
|
||||
QStringList layers() const;
|
||||
void setLayers(const QStringList& layers);
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
//! returns true if projections are enabled for this layer set
|
||||
bool hasCrsTransformEnabled() const;
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
//! returns CRS of destination coordinate reference system
|
||||
const QgsCoordinateReferenceSystem& destinationCrs() const;
|
||||
|
||||
QGis::UnitType mapUnits() const;
|
||||
void setMapUnits( QGis::UnitType u );
|
||||
|
||||
void setBackgroundColor( const QColor& color );
|
||||
QColor backgroundColor() const;
|
||||
|
||||
void setSelectionColor( const QColor& color );
|
||||
QColor selectionColor() const;
|
||||
|
||||
enum Flag
|
||||
{
|
||||
Antialiasing = 0x01,
|
||||
DrawEditingInfo = 0x02,
|
||||
ForceVectorOutput = 0x04,
|
||||
UseAdvancedEffects = 0x08,
|
||||
DrawLabeling = 0x10
|
||||
// TODO: ignore scale-based visibiity (overview)
|
||||
};
|
||||
//Q_DECLARE_FLAGS(Flags, Flag)
|
||||
typedef QFlags<QgsMapSettings::Flag> Flags;
|
||||
|
||||
void setFlags( Flags flags );
|
||||
void setFlag( Flag flag, bool on = true );
|
||||
Flags flags() const;
|
||||
bool testFlag( Flag flag ) const;
|
||||
|
||||
bool hasValidSettings() const;
|
||||
QgsRectangle visibleExtent() const;
|
||||
double mapUnitsPerPixel() const;
|
||||
double scale() const;
|
||||
|
||||
|
||||
// -- utility functions --
|
||||
|
||||
const QgsMapToPixel& mapToPixel() const;
|
||||
|
||||
/**
|
||||
* @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 ) const;
|
||||
|
||||
/**
|
||||
* @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 ) const;
|
||||
|
||||
/**
|
||||
* @brief transform point coordinates from layer's CRS to output CRS
|
||||
* @return the transformed point
|
||||
*/
|
||||
QgsPoint layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint point ) const;
|
||||
|
||||
/**
|
||||
* @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 ) const;
|
||||
|
||||
/**
|
||||
* @brief transform point coordinates from output CRS to layer's CRS
|
||||
* @return the transformed point
|
||||
*/
|
||||
QgsPoint mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point ) const;
|
||||
|
||||
/**
|
||||
* @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 ) const;
|
||||
|
||||
|
||||
//! returns current extent of layer set
|
||||
QgsRectangle fullExtent() const;
|
||||
|
||||
/* serialization */
|
||||
|
||||
void readXML( QDomNode& theNode );
|
||||
|
||||
void writeXML( QDomNode& theNode, QDomDocument& theDoc );
|
||||
|
||||
};
|
||||
|
||||
//Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapSettings::Flags )
|
||||
QFlags<QgsMapSettings::Flag> operator|(QgsMapSettings::Flag f1, QFlags<QgsMapSettings::Flag> f2);
|
@ -89,6 +89,9 @@ class QgsPalLayerSettings
|
||||
QgsPalLayerSettings( const QgsPalLayerSettings& s );
|
||||
~QgsPalLayerSettings();
|
||||
|
||||
//! @note added in 2.1
|
||||
static QgsPalLayerSettings fromLayer( QgsVectorLayer* layer );
|
||||
|
||||
enum Placement
|
||||
{
|
||||
AroundPoint, // Point / Polygon
|
||||
@ -433,7 +436,7 @@ class QgsPalLayerSettings
|
||||
void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = 0 );
|
||||
|
||||
// implementation of register feature hook
|
||||
void registerFeature( QgsVectorLayer* layer, QgsFeature& f, const QgsRenderContext& context );
|
||||
void registerFeature( QgsFeature& f, const QgsRenderContext& context );
|
||||
|
||||
void readFromLayer( QgsVectorLayer* layer );
|
||||
void writeToLayer( QgsVectorLayer* layer );
|
||||
@ -579,6 +582,24 @@ class QgsLabelComponent
|
||||
void setDpiRatio( double ratio );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class that stores computed placement from labeling engine.
|
||||
* @note added in 2.1
|
||||
*/
|
||||
class QgsLabelingResults
|
||||
{
|
||||
public:
|
||||
QgsLabelingResults();
|
||||
~QgsLabelingResults();
|
||||
|
||||
//! return infos about labels at a given (map) position
|
||||
QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) const;
|
||||
//! return infos about labels within a given (map) rectangle
|
||||
QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) const;
|
||||
};
|
||||
|
||||
|
||||
class QgsPalLabeling : QgsLabelingEngineInterface
|
||||
{
|
||||
%TypeHeaderCode
|
||||
@ -624,7 +645,10 @@ class QgsPalLabeling : QgsLabelingEngineInterface
|
||||
// implemented methods from labeling engine interface
|
||||
|
||||
//! called when we're going to start with rendering
|
||||
virtual void init( QgsMapRenderer* mr );
|
||||
//! @deprecated since 2.1 - use override with QgsMapSettings
|
||||
virtual void init( QgsMapRenderer* mr ) /Deprecated/;
|
||||
//! called when we're going to start with rendering
|
||||
virtual void init( const QgsMapSettings& mapSettings );
|
||||
//! called to find out whether the layer is used for labeling
|
||||
virtual bool willUseLayer( QgsVectorLayer* layer );
|
||||
//! clears all PAL layer settings for registered layers
|
||||
@ -632,22 +656,26 @@ class QgsPalLabeling : QgsLabelingEngineInterface
|
||||
virtual void clearActiveLayers();
|
||||
//! clears data defined objects from PAL layer settings for a registered layer
|
||||
//! @note: this method was added in version 1.9
|
||||
virtual void clearActiveLayer( QgsVectorLayer* layer );
|
||||
virtual void clearActiveLayer( const QString& layerID );
|
||||
//! hook called when drawing layer before issuing select()
|
||||
virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices, QgsRenderContext& ctx );
|
||||
virtual int prepareLayer( QgsVectorLayer* layer, QStringList &attrNames, QgsRenderContext& ctx );
|
||||
//! adds a diagram layer to the labeling engine
|
||||
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings *s );
|
||||
//! hook called when drawing for every feature in a layer
|
||||
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
virtual void registerFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
virtual void registerDiagramFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
|
||||
//! called when the map is drawn and labels should be placed
|
||||
virtual void drawLabeling( QgsRenderContext& context );
|
||||
//! called when we're done with rendering
|
||||
virtual void exit();
|
||||
//! return infos about labels at a given (map) position
|
||||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p );
|
||||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) /Deprecated/;
|
||||
//! return infos about labels within a given (map) rectangle
|
||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r );
|
||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) /Deprecated/;
|
||||
|
||||
//! Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller
|
||||
//! @note added in 2.1
|
||||
QgsLabelingResults* takeResults() /TransferBack/;
|
||||
|
||||
//! called when passing engine among map renderers
|
||||
virtual QgsLabelingEngineInterface* clone() /Factory/;
|
||||
@ -674,6 +702,8 @@ class QgsPalLabeling : QgsLabelingEngineInterface
|
||||
void loadEngineSettings();
|
||||
void saveEngineSettings();
|
||||
void clearEngineSettings();
|
||||
bool isStoredWithProject() const;
|
||||
void setStoredWithProject( bool store );
|
||||
//! @deprecated since 2.1 - settings are always stored in project
|
||||
bool isStoredWithProject() const /Deprecated/;
|
||||
//! @deprecated since 2.1 - settings are always stored in project
|
||||
void setStoredWithProject( bool store ) /Deprecated/;
|
||||
};
|
||||
|
@ -10,6 +10,10 @@ class QgsRenderContext
|
||||
QgsRenderContext();
|
||||
~QgsRenderContext();
|
||||
|
||||
//! create initialized QgsRenderContext instance from given QgsMapSettings
|
||||
//! @note added in 2.1
|
||||
static QgsRenderContext fromMapSettings( const QgsMapSettings& mapSettings );
|
||||
|
||||
//getters
|
||||
|
||||
QPainter* painter();
|
||||
|
@ -69,7 +69,11 @@ class QgsSnapper
|
||||
QgsTolerance::UnitType mUnitType;
|
||||
};
|
||||
|
||||
QgsSnapper( QgsMapRenderer* mapRender );
|
||||
//!@ deprecated since 2.1 - use constructor with QgsMapSettings
|
||||
QgsSnapper( QgsMapRenderer* mapRender ) /Deprecated/;
|
||||
|
||||
explicit QgsSnapper( const QgsMapSettings& mapSettings );
|
||||
|
||||
~QgsSnapper();
|
||||
/**Does the snapping operation
|
||||
@param startPoint the start point for snapping (in pixel coordinates)
|
||||
|
@ -12,30 +12,35 @@ class QgsSpatialIndex
|
||||
/** constructor - creates R-tree */
|
||||
QgsSpatialIndex();
|
||||
|
||||
/** copy constructor */
|
||||
QgsSpatialIndex( const QgsSpatialIndex& other );
|
||||
|
||||
/** destructor finalizes work with spatial index */
|
||||
~QgsSpatialIndex();
|
||||
|
||||
/** implement assignment operator */
|
||||
//QgsSpatialIndex& operator=( const QgsSpatialIndex& other );
|
||||
|
||||
/* operations */
|
||||
|
||||
/** add feature to index */
|
||||
bool insertFeature( QgsFeature& f );
|
||||
bool insertFeature( const QgsFeature& f );
|
||||
|
||||
/** remove feature from index */
|
||||
bool deleteFeature( QgsFeature& f );
|
||||
bool deleteFeature( const QgsFeature& f );
|
||||
|
||||
|
||||
/* queries */
|
||||
|
||||
/** returns features that intersect the specified rectangle */
|
||||
QList<qint64> intersects( QgsRectangle rect );
|
||||
QList<qint64> intersects( QgsRectangle rect ) const;
|
||||
|
||||
/** returns nearest neighbors (their count is specified by second parameter) */
|
||||
QList<qint64> nearestNeighbor( QgsPoint point, int neighbors );
|
||||
QList<qint64> nearestNeighbor( QgsPoint point, int neighbors ) const;
|
||||
|
||||
|
||||
protected:
|
||||
// SpatialIndex::Region rectToRegion( QgsRectangle rect );
|
||||
// static SpatialIndex::Region rectToRegion( QgsRectangle rect );
|
||||
// bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, QgsFeatureId &id );
|
||||
|
||||
|
||||
|
@ -20,14 +20,40 @@ class QgsTolerance
|
||||
* The value is read from settings and transformed if necessary.
|
||||
* @return value of vertex tolerance in map units
|
||||
*/
|
||||
static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer );
|
||||
static double vertexSearchRadius( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
|
||||
|
||||
/**
|
||||
* Static function to get vertex tolerance value for a layer.
|
||||
* The value is read from settings and transformed if necessary.
|
||||
* @return value of vertex tolerance in map units
|
||||
*/
|
||||
//! @deprecated since 2.1 - use override with QgsMapSettings
|
||||
static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer ) /Deprecated/;
|
||||
|
||||
/**
|
||||
* Static function to get default tolerance value for a layer.
|
||||
* The value is read from settings and transformed if necessary.
|
||||
* @return value of default tolerance in map units
|
||||
*/
|
||||
static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer );
|
||||
static double defaultTolerance( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
|
||||
|
||||
/**
|
||||
* Static function to get default tolerance value for a layer.
|
||||
* The value is read from settings and transformed if necessary.
|
||||
* @return value of default tolerance in map units
|
||||
*/
|
||||
//! @deprecated since 2.1 - use override with QgsMapSettings
|
||||
static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer ) /Deprecated/;
|
||||
|
||||
/**
|
||||
* Static function to translate tolerance value into current map unit value
|
||||
* @param tolerance tolerance value to be translated
|
||||
* @param layer reference layer
|
||||
* @param mapSettings settings of the map
|
||||
* @param units type of units to be translated
|
||||
* @return value of tolerance in map units
|
||||
*/
|
||||
static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = MapUnits );
|
||||
|
||||
/**
|
||||
* Static function to translate tolerance value into current map unit value
|
||||
@ -37,6 +63,6 @@ class QgsTolerance
|
||||
* @param units type of units to be translated
|
||||
* @return value of tolerance in map units
|
||||
*/
|
||||
static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = MapUnits );
|
||||
|
||||
//! @deprecated since 2.1 - use the override with QgsMapSettings
|
||||
static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = MapUnits ) /Deprecated/;
|
||||
};
|
||||
|
@ -44,6 +44,24 @@ class QgsVectorDataProvider : QgsDataProvider
|
||||
*/
|
||||
virtual ~QgsVectorDataProvider();
|
||||
|
||||
/**
|
||||
* Return feature source object that can be used for querying provider's data. The returned feature source
|
||||
* is independent from provider - any changes to provider's state (e.g. change of subset string) will not be
|
||||
* reflected in the feature source, therefore it can be safely used for processing in background without
|
||||
* having to care about possible changes within provider that may happen concurrently. Also, even in the case
|
||||
* of provider being deleted, any feature source obtained from the provider will be kept alive and working
|
||||
* (they are independent and owned by the caller).
|
||||
*
|
||||
* Sometimes there are cases when some data needs to be shared between vector data provider and its feature source.
|
||||
* In such cases, the implementation must ensure that the data is not susceptible to run condition. For example,
|
||||
* if it is possible that both feature source and provider may need reading/writing to some shared data at the
|
||||
* same time, some synchronization mechanisms must be used (e.g. mutexes) to prevent data corruption.
|
||||
*
|
||||
* @note added in 2.1
|
||||
* @return new instance of QgsAbstractFeatureSource (caller is responsible for deleting it)
|
||||
*/
|
||||
virtual QgsAbstractFeatureSource* featureSource() const /Factory/;
|
||||
|
||||
/**
|
||||
* Returns the permanent storage type for this layer as a friendly name.
|
||||
*/
|
||||
@ -275,9 +293,9 @@ class QgsVectorDataProvider : QgsDataProvider
|
||||
*/
|
||||
virtual bool isSaveAndLoadStyleToDBSupported();
|
||||
|
||||
protected:
|
||||
QVariant convertValue( QVariant::Type type, QString value );
|
||||
static QVariant convertValue( QVariant::Type type, QString value );
|
||||
|
||||
protected:
|
||||
void clearMinMaxCache();
|
||||
void fillMinMaxCache();
|
||||
|
||||
|
@ -350,16 +350,6 @@ class QgsVectorLayer : QgsMapLayer
|
||||
*/
|
||||
void setRendererV2( QgsFeatureRendererV2* r /Transfer/ );
|
||||
|
||||
/** Draw layer with renderer V2. QgsFeatureRenderer::startRender() needs to be called before using this method
|
||||
* @note added in 1.4
|
||||
*/
|
||||
void drawRendererV2( QgsFeatureIterator &fit, QgsRenderContext& rendererContext, bool labeling );
|
||||
|
||||
/** Draw layer with renderer V2 using symbol levels. QgsFeatureRenderer::startRender() needs to be called before using this method
|
||||
* @note added in 1.4
|
||||
*/
|
||||
void drawRendererV2Levels( QgsFeatureIterator &fit, QgsRenderContext& rendererContext, bool labeling );
|
||||
|
||||
/** Returns point, line or polygon */
|
||||
QGis::GeometryType geometryType() const;
|
||||
|
||||
@ -642,6 +632,11 @@ class QgsVectorLayer : QgsMapLayer
|
||||
@note added in version 1.6*/
|
||||
virtual void reload();
|
||||
|
||||
/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
|
||||
* @note added in 2.1
|
||||
*/
|
||||
virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) /Factory/;
|
||||
|
||||
/** Draws the layer
|
||||
* @return false if an error occurred during drawing
|
||||
*/
|
||||
|
@ -1,3 +1,7 @@
|
||||
|
||||
// abstract feature iterator implementations are not part of public API
|
||||
|
||||
/*
|
||||
class QgsVectorLayerFeatureIterator : QgsAbstractFeatureIterator
|
||||
{
|
||||
%TypeHeaderCode
|
||||
@ -27,3 +31,4 @@ class QgsVectorLayerFeatureIterator : QgsAbstractFeatureIterator
|
||||
bool nextFeatureFid( QgsFeature& f );
|
||||
void addJoinedAttributes( QgsFeature &f );
|
||||
};
|
||||
*/
|
||||
|
@ -146,6 +146,11 @@ class QgsRasterLayer : QgsMapLayer
|
||||
@note added in version 1.6*/
|
||||
virtual void reload();
|
||||
|
||||
/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
|
||||
* @note added in 2.1
|
||||
*/
|
||||
virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) /Factory/;
|
||||
|
||||
/** \brief This is called when the view on the raster layer needs to be redrawn */
|
||||
bool draw( QgsRenderContext& rendererContext );
|
||||
|
||||
@ -154,11 +159,11 @@ class QgsRasterLayer : QgsMapLayer
|
||||
QgsRasterViewPort * myRasterViewPort,
|
||||
const QgsMapToPixel* theQgsMapToPixel = 0 );
|
||||
|
||||
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
||||
QString lastError();
|
||||
//! @deprecated since 2.1 - returns empty string
|
||||
QString lastError() /Deprecated/;
|
||||
|
||||
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
||||
QString lastErrorTitle();
|
||||
//! @deprecated since 2.1 - returns empty string
|
||||
QString lastErrorTitle() /Deprecated/;
|
||||
|
||||
/**Returns a list with classification items (Text and color)
|
||||
@note this method was added in version 1.8*/
|
||||
@ -233,8 +238,8 @@ class QgsRasterLayer : QgsMapLayer
|
||||
public slots:
|
||||
void showStatusMessage( const QString & theMessage );
|
||||
|
||||
/** \brief Propagate progress updates from GDAL up to the parent app */
|
||||
void updateProgress( int, int );
|
||||
//! @deprecated since 2.1 - does nothing
|
||||
void updateProgress( int, int ) /Deprecated/;
|
||||
|
||||
/** \brief receive progress signal from provider */
|
||||
void onProgress( int, double, QString );
|
||||
|
@ -43,7 +43,7 @@ class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2
|
||||
|
||||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context );
|
||||
|
||||
|
@ -42,7 +42,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
|
||||
|
||||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context );
|
||||
|
||||
|
@ -16,7 +16,7 @@ class QgsPointDisplacementRenderer : QgsFeatureRendererV2
|
||||
|
||||
QgsSymbolV2* symbolForFeature( QgsFeature& feature );
|
||||
|
||||
void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
void stopRender( QgsRenderContext& context );
|
||||
|
||||
|
@ -57,7 +57,10 @@ class QgsFeatureRendererV2
|
||||
// to be overridden
|
||||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ) = 0;
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) = 0;
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;
|
||||
|
||||
//! @deprecated since 2.1 - not using QgsVectorLayer directly anymore
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) /Deprecated/;
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context ) = 0;
|
||||
|
||||
|
@ -91,7 +91,7 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2
|
||||
QDomElement save( QDomDocument& doc, QgsSymbolV2Map& symbolMap );
|
||||
|
||||
//! prepare the rule for rendering and its children (build active children array)
|
||||
bool startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
//! get all used z-levels from this rule and children
|
||||
QSet<int> collectZLevels();
|
||||
//! assign normalized z-levels [0..N-1] for this rule's symbol for quick access during rendering
|
||||
@ -147,7 +147,7 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2
|
||||
|
||||
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context );
|
||||
|
||||
|
@ -11,7 +11,7 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2
|
||||
|
||||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context );
|
||||
|
||||
|
@ -109,7 +109,7 @@ class QgsSymbolLayerV2
|
||||
protected:
|
||||
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
|
||||
|
||||
virtual void prepareExpressions( const QgsVectorLayer* vl );
|
||||
virtual void prepareExpressions( const QgsFields* fields, double scale = -1 );
|
||||
virtual QgsExpression* expression( const QString& property );
|
||||
/**Saves data defined properties to string map*/
|
||||
void saveDataDefinedProperties( QgsStringMap& stringMap ) const;
|
||||
|
@ -73,7 +73,7 @@ class QgsSymbolV2
|
||||
//! delete layer at specified index and set a new one
|
||||
bool changeSymbolLayer( int index, QgsSymbolLayerV2 *layer /Transfer/ );
|
||||
|
||||
void startRender( QgsRenderContext& context, const QgsVectorLayer* layer = 0 );
|
||||
void startRender( QgsRenderContext& context, const QgsFields* fields = 0 );
|
||||
void stopRender( QgsRenderContext& context );
|
||||
|
||||
void setColor( const QColor& color );
|
||||
@ -124,7 +124,7 @@ class QgsSymbolV2RenderContext
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = 0 );
|
||||
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = 0, const QgsFields* fields = 0 );
|
||||
~QgsSymbolV2RenderContext();
|
||||
|
||||
QgsRenderContext& renderContext();
|
||||
@ -147,10 +147,14 @@ class QgsSymbolV2RenderContext
|
||||
void setRenderHints( int hints );
|
||||
|
||||
void setFeature( const QgsFeature* f );
|
||||
//! Current feature being rendered - may be null
|
||||
const QgsFeature* feature() const;
|
||||
|
||||
void setLayer( const QgsVectorLayer* layer );
|
||||
const QgsVectorLayer* layer() const;
|
||||
//! Fields of the layer. Currently only available in startRender() calls
|
||||
//! to allow symbols with data-defined properties prepare the expressions
|
||||
//! (other times fields() returns null)
|
||||
//! @note added in 2.1
|
||||
const QgsFields* fields() const;
|
||||
|
||||
double outputLineWidth( double width ) const;
|
||||
double outputPixelSize( double size ) const;
|
||||
|
@ -55,18 +55,39 @@ class QgsMapCanvas : QGraphicsView
|
||||
|
||||
void enableOverviewMode( QgsMapOverviewCanvas* overview );
|
||||
|
||||
//! Get access to properties used for map rendering
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings() const;
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
//! @note added in 2.1
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
//! @note added in 2.1
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
|
||||
//! Get access to the labeling results (may be null)
|
||||
//! @note added in 2.1
|
||||
const QgsLabelingResults* labelingResults() const;
|
||||
|
||||
//! @deprecated since 2.1 - there could be more than just one "map" items
|
||||
QgsMapCanvasMap* map();
|
||||
|
||||
QgsMapRenderer* mapRenderer() /Transfer/;
|
||||
//! @deprecated since 2.1 - use mapRendererSettings() for anything related to current renderer settings
|
||||
//// SIP: removed /Transfer/ because it crashes after few calls to iface.mapCanvas().mapRenderer().hasCrsTransformEnabled()
|
||||
//// and in fact there is no transfer of ownership from c++ to python!
|
||||
//// Actually the problem comes from the fact that "hasCrsTransformEnabled" is both a signal and a normal method
|
||||
QgsMapRenderer* mapRenderer() /Deprecated/;
|
||||
|
||||
//! Accessor for the canvas paint device
|
||||
QPaintDevice &canvasPaintDevice();
|
||||
//! @deprecated since 2.1
|
||||
QPaintDevice &canvasPaintDevice() /Deprecated/;
|
||||
|
||||
//! Get the last reported scale of the canvas
|
||||
double scale();
|
||||
|
||||
//! Clear the map canvas
|
||||
void clear();
|
||||
//! @deprecated since 2.1 - use refresh() - clear does the same thing
|
||||
void clear() /Deprecated/;
|
||||
|
||||
//! Returns the mapUnitsPerPixel (map units per pixel) for the canvas
|
||||
double mapUnitsPerPixel() const;
|
||||
@ -118,11 +139,15 @@ class QgsMapCanvas : QGraphicsView
|
||||
/** Read property of QColor bgColor. */
|
||||
virtual QColor canvasColor() const;
|
||||
|
||||
/** Set color of selected vector features */
|
||||
//! @note added in 2.1
|
||||
void setSelectionColor( const QColor& color );
|
||||
|
||||
/** Emits signal scaleChanged to update scale in main window */
|
||||
void updateScale();
|
||||
|
||||
/** Updates the full extent */
|
||||
void updateFullExtent();
|
||||
//! @deprecated since v2.1 - does nothing
|
||||
void updateFullExtent() /Deprecated/;
|
||||
|
||||
//! return the map layer at position index in the layer stack
|
||||
QgsMapLayer *layer( int index );
|
||||
@ -143,11 +168,11 @@ class QgsMapCanvas : QGraphicsView
|
||||
/*! Accessor for frozen status of canvas */
|
||||
bool isFrozen();
|
||||
|
||||
//! Flag the canvas as dirty and needed a refresh
|
||||
void setDirty( bool _dirty );
|
||||
//! @deprecated since 2.1 - use refresh() to trigger a refresh (clients should not decide explicitly whether canvas is dirty or not)
|
||||
void setDirty( bool _dirty ) /Deprecated/;
|
||||
|
||||
//! Return the state of the canvas (dirty or not)
|
||||
bool isDirty() const;
|
||||
//! @deprecated since 2.1 - dirty flag is not kept anymore - always returns false
|
||||
bool isDirty() const /Deprecated/;
|
||||
|
||||
//! Set map units (needed by project properties dialog)
|
||||
void setMapUnits( QGis::UnitType mapUnits );
|
||||
@ -189,8 +214,8 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! true if antialising is enabled
|
||||
bool antiAliasingEnabled() const;
|
||||
|
||||
//! Select which Qt class to render with
|
||||
void useImageToRender( bool theFlag );
|
||||
//! @deprecated since 2.1 - does nothing because now we always render to QImage
|
||||
void useImageToRender( bool theFlag ) /Deprecated/;
|
||||
|
||||
// following 2 methods should be moved elsewhere or changed to private
|
||||
// currently used by pan map tool
|
||||
@ -225,14 +250,15 @@ class QgsMapCanvas : QGraphicsView
|
||||
/** A simple helper method to find out if on the fly projections are enabled or not */
|
||||
bool hasCrsTransformEnabled();
|
||||
|
||||
/** The map units may have changed, so cope with that */
|
||||
void mapUnitsChanged();
|
||||
//! @deprecated in 2.1 - does nothing - kept for API compatibility
|
||||
void updateMap() /Deprecated/;
|
||||
|
||||
/** updates pixmap on render progress */
|
||||
void updateMap();
|
||||
//! stop rendering (if there is any right now)
|
||||
//! @note added in 2.1
|
||||
void stopRendering();
|
||||
|
||||
//! show whatever error is exposed by the QgsMapLayer.
|
||||
void showError( QgsMapLayer * mapLayer );
|
||||
//! @deprecated since 2.1 - does nothing - errors are reported by different means
|
||||
void showError( QgsMapLayer * mapLayer ) /Deprecated/;
|
||||
|
||||
//! called to read map canvas settings from project
|
||||
void readProject( const QDomDocument & );
|
||||
@ -242,7 +268,8 @@ class QgsMapCanvas : QGraphicsView
|
||||
|
||||
signals:
|
||||
/** Let the owner know how far we are with render operations */
|
||||
void setProgress( int, int );
|
||||
//! @deprecated since 2.1 - already unused in 2.0 anyway
|
||||
void setProgress( int, int ) /Deprecated/;
|
||||
|
||||
/** emits current mouse position
|
||||
\note changed in 1.3 */
|
||||
@ -262,15 +289,20 @@ class QgsMapCanvas : QGraphicsView
|
||||
being rendered onto a pixmap other than the mapCanvas own pixmap member.
|
||||
|
||||
*/
|
||||
//! TODO: deprecate when decorations are reimplemented as map canvas items
|
||||
//! - anything related to rendering progress is not visible outside of map canvas
|
||||
//! - additional drawing shall be done directly within the renderer job or independently as a map canvas item
|
||||
void renderComplete( QPainter * );
|
||||
|
||||
/** Emitted when canvas finished a refresh request.
|
||||
\note Added in 2.0 */
|
||||
void mapCanvasRefreshed();
|
||||
//! @deprecated since 2.1 - anything related to rendering progress is not visible outside of map canvas
|
||||
void mapCanvasRefreshed() /Deprecated/;
|
||||
|
||||
/** Emitted when the canvas is about to be rendered.
|
||||
\note Added in 1.5 */
|
||||
void renderStarting();
|
||||
//! @deprecated since 2.1 - anything related to rendering progress is not visible outside of map canvas
|
||||
void renderStarting() /Deprecated/;
|
||||
|
||||
//! Emitted when a new set of layers has been received
|
||||
void layersChanged();
|
||||
@ -295,6 +327,18 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! @note: this signal was added in version 1.4
|
||||
void zoomNextStatusChanged( bool );
|
||||
|
||||
//! Emitted when on-the-fly projection has been turned on/off
|
||||
//! @note added in 2.1
|
||||
void hasCrsTransformEnabledChanged( bool flag );
|
||||
|
||||
//! Emitted when map CRS has changed
|
||||
//! @note added in 2.1
|
||||
void destinationCrsChanged();
|
||||
|
||||
//! Emmitted when map units are changed
|
||||
//! @note added in 2.1
|
||||
void mapUnitsChanged();
|
||||
|
||||
protected:
|
||||
//! Overridden standard event to be gestures aware
|
||||
bool event( QEvent * e );
|
||||
|
@ -39,7 +39,8 @@ class QgsMapCanvasItem : QGraphicsItem
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
//! sets current offset, to be called from QgsMapCanvas
|
||||
void setPanningOffset( const QPoint& point );
|
||||
//! @deprecated since v2.1 - not called by QgsMapCanvas anymore
|
||||
void setPanningOffset( const QPoint& point ) /Deprecated/;
|
||||
|
||||
//! returns canvas item rectangle
|
||||
QgsRectangle rect() const;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <qgsmapcanvasmap.h>
|
||||
%End
|
||||
|
||||
class QgsMapCanvasMap : QGraphicsRectItem
|
||||
class QgsMapCanvasMap : QgsMapCanvasItem
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsmapcanvasmap.h>
|
||||
@ -28,25 +28,32 @@ class QgsMapCanvasMap : QGraphicsRectItem
|
||||
//! constructor
|
||||
QgsMapCanvasMap( QgsMapCanvas* canvas /TransferThis/ );
|
||||
|
||||
//! resize canvas item and pixmap
|
||||
void resize( QSize size );
|
||||
//! @note added in 2.1
|
||||
void setContent( const QImage& image, const QgsRectangle& rect );
|
||||
|
||||
void enableAntiAliasing( bool flag );
|
||||
//! @note added in 2.1
|
||||
QImage contentImage() const;
|
||||
|
||||
//! renders map using QgsMapRenderer to mPixmap
|
||||
void render();
|
||||
virtual void paint( QPainter * painter );
|
||||
|
||||
void setBackgroundColor( const QColor& color );
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void resize( QSize size ) /Deprecated/;
|
||||
|
||||
void setPanningOffset( const QPoint& point );
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void enableAntiAliasing( bool flag ) /Deprecated/;
|
||||
|
||||
QPaintDevice& paintDevice();
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void render() /Deprecated/;
|
||||
|
||||
void paint( QPainter* p, const QStyleOptionGraphicsItem*, QWidget* );
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void setBackgroundColor( const QColor& color ) /Deprecated/;
|
||||
|
||||
QRectF boundingRect() const;
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void setPanningOffset( const QPoint& point ) /Deprecated/;
|
||||
|
||||
//! Update contents - can be called while drawing to show the status.
|
||||
//! Added in version 1.2
|
||||
void updateContents();
|
||||
//! @deprecated in 2.1
|
||||
QPaintDevice& paintDevice() /Deprecated/;
|
||||
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
void updateContents() /Deprecated/;
|
||||
};
|
||||
|
@ -10,9 +10,6 @@ class QgsMapOverviewCanvas : QWidget
|
||||
|
||||
~QgsMapOverviewCanvas();
|
||||
|
||||
//! used for overview canvas to reflect changed extent in main map canvas
|
||||
void drawExtentRect();
|
||||
|
||||
//! renders overview and updates panning widget
|
||||
void refresh();
|
||||
|
||||
@ -22,7 +19,7 @@ class QgsMapOverviewCanvas : QWidget
|
||||
//! updates layer set for overview
|
||||
void setLayerSet( const QStringList& layerSet );
|
||||
|
||||
QStringList& layerSet();
|
||||
QStringList layerSet() const;
|
||||
|
||||
void enableAntiAliasing( bool flag );
|
||||
|
||||
@ -30,10 +27,16 @@ class QgsMapOverviewCanvas : QWidget
|
||||
|
||||
public slots:
|
||||
|
||||
//! used for overview canvas to reflect changed extent in main map canvas
|
||||
void drawExtentRect();
|
||||
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
|
||||
void destinationSrsChanged();
|
||||
|
||||
protected slots:
|
||||
void mapRenderingFinished();
|
||||
|
||||
protected:
|
||||
|
||||
//! Overridden paint event
|
||||
|
@ -64,7 +64,8 @@ class QgsMapTool : QObject
|
||||
%End
|
||||
|
||||
//! Called when rendering has finished. Default implementation does nothing.
|
||||
virtual void renderComplete();
|
||||
//! @deprecated since 2.1 - not called anymore - map tools must not directly depend on rendering progress
|
||||
virtual void renderComplete() /Deprecated/;
|
||||
|
||||
|
||||
/** Use this to associate a QAction to this maptool. Then when the setMapTool
|
||||
|
@ -116,7 +116,7 @@ void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLa
|
||||
connect( mVlayer, SIGNAL( beforeRollBack() ), this, SLOT( beforeRollBack() ) );
|
||||
|
||||
// projection or extents changed
|
||||
connect( canvas, SIGNAL( destinationSrsChanged() ), this, SLOT( updateVertexMarkersPosition() ) );
|
||||
connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( updateVertexMarkersPosition() ) );
|
||||
connect( canvas, SIGNAL( extentsChanged() ), this, SLOT( updateVertexMarkersPosition() ) );
|
||||
|
||||
// geometry was changed
|
||||
|
@ -1889,10 +1889,10 @@ void QgisApp::setupConnections()
|
||||
mMapCanvas, SLOT( setRenderFlag( bool ) ) );
|
||||
|
||||
// connect renderer
|
||||
connect( mMapCanvas, SIGNAL( hasCrsTransformEnabled( bool ) ),
|
||||
connect( mMapCanvas, SIGNAL( hasCrsTransformEnabledChanged( bool ) ),
|
||||
this, SLOT( hasCrsTransformEnabled( bool ) ) );
|
||||
connect( mMapCanvas, SIGNAL( destinationSrsChanged() ),
|
||||
this, SLOT( destinationSrsChanged() ) );
|
||||
connect( mMapCanvas, SIGNAL( destinationCrsChanged() ),
|
||||
this, SLOT( destinationCrsChanged() ) );
|
||||
|
||||
// connect legend signals
|
||||
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
|
||||
@ -7627,7 +7627,7 @@ void QgisApp::updateCRSStatusBar()
|
||||
}
|
||||
}
|
||||
|
||||
void QgisApp::destinationSrsChanged()
|
||||
void QgisApp::destinationCrsChanged()
|
||||
{
|
||||
// save this information to project
|
||||
long srsid = mMapCanvas->mapSettings().destinationCrs().srsid();
|
||||
|
@ -1001,7 +1001,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
void showStatusMessage( QString theMessage );
|
||||
void updateMouseCoordinatePrecision();
|
||||
void hasCrsTransformEnabled( bool theFlag );
|
||||
void destinationSrsChanged();
|
||||
void destinationCrsChanged();
|
||||
// void debugHook();
|
||||
//! Add a vector layer to the map
|
||||
void addVectorLayer();
|
||||
|
@ -63,7 +63,7 @@ QgsDecorationGrid::QgsDecorationGrid( QObject* parent )
|
||||
mMarkerSymbol = 0;
|
||||
projectRead();
|
||||
|
||||
connect( QgisApp::instance()->mapCanvas()->mapRenderer(), SIGNAL( mapUnitsChanged() ),
|
||||
connect( QgisApp::instance()->mapCanvas(), SIGNAL( mapUnitsChanged() ),
|
||||
this, SLOT( checkMapUnitsChanged() ) );
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas* canvas ): QgsMapTo
|
||||
{
|
||||
mSnapper.setMapCanvas( canvas );
|
||||
|
||||
connect( canvas, SIGNAL( destinationSrsChanged() ),
|
||||
connect( canvas, SIGNAL( destinationCrsChanged() ),
|
||||
this, SLOT( updateSettings() ) );
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
|
||||
mDialog = new QgsMeasureDialog( this, Qt::WindowStaysOnTopHint );
|
||||
mSnapper.setMapCanvas( canvas );
|
||||
|
||||
connect( canvas, SIGNAL( destinationSrsChanged() ),
|
||||
connect( canvas, SIGNAL( destinationCrsChanged() ),
|
||||
this, SLOT( updateSettings() ) );
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
|
||||
//use stored layer set or read current set from main canvas
|
||||
jobMapSettings.setLayers( mKeepLayerSet ? mLayerSet : ms.layers() );
|
||||
jobMapSettings.setDestinationCrs( ms.destinationCrs() );
|
||||
jobMapSettings.setProjectionsEnabled( ms.hasCrsTransformEnabled() );
|
||||
jobMapSettings.setCrsTransformEnabled( ms.hasCrsTransformEnabled() );
|
||||
jobMapSettings.setFlags( ms.flags() );
|
||||
|
||||
// composer-specific overrides of flags
|
||||
|
@ -245,6 +245,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
|
||||
Q_DECL_DEPRECATED QgsMapRenderer* mapRenderer() {return mMapRenderer;}
|
||||
|
||||
//! Return setting of QGIS map canvas
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings() const { return mMapSettings; }
|
||||
|
||||
QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;}
|
||||
|
@ -149,7 +149,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFeatureRequest::Flags )
|
||||
class QgsFeatureIterator;
|
||||
class QgsAbstractFeatureIterator;
|
||||
|
||||
/** base class that can be used for any class that is capable of returning features */
|
||||
/** base class that can be used for any class that is capable of returning features
|
||||
* @note added in 2.1
|
||||
*/
|
||||
class QgsAbstractFeatureSource
|
||||
{
|
||||
public:
|
||||
|
@ -224,11 +224,6 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
|
||||
//Lock render method for concurrent threads (e.g. from globe)
|
||||
QMutexLocker renderLock( &mRenderMutex );
|
||||
|
||||
//flag to see if the render context has changed
|
||||
//since the last time we rendered. If it hasnt changed we can
|
||||
//take some shortcuts with rendering
|
||||
bool mySameAsLastFlag = true;
|
||||
|
||||
QgsDebugMsg( "========== Rendering ==========" );
|
||||
|
||||
if ( mExtent.isEmpty() )
|
||||
@ -309,28 +304,24 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
|
||||
if ( mRenderContext.rasterScaleFactor() != rasterScaleFactor )
|
||||
{
|
||||
mRenderContext.setRasterScaleFactor( rasterScaleFactor );
|
||||
mySameAsLastFlag = false;
|
||||
}
|
||||
if ( mRenderContext.scaleFactor() != scaleFactor )
|
||||
{
|
||||
mRenderContext.setScaleFactor( scaleFactor );
|
||||
mySameAsLastFlag = false;
|
||||
}
|
||||
if ( mRenderContext.rendererScale() != mScale )
|
||||
{
|
||||
//add map scale to render context
|
||||
mRenderContext.setRendererScale( mScale );
|
||||
mySameAsLastFlag = false;
|
||||
}
|
||||
if ( mLastExtent != mExtent )
|
||||
{
|
||||
mLastExtent = mExtent;
|
||||
mySameAsLastFlag = false;
|
||||
}
|
||||
|
||||
mRenderContext.setLabelingEngine( mLabelingEngine );
|
||||
if ( mLabelingEngine )
|
||||
mLabelingEngine->init( this );
|
||||
mLabelingEngine->init( mapSettings() );
|
||||
|
||||
// render all layers in the stack, starting at the base
|
||||
QListIterator<QString> li( mLayerSet );
|
||||
@ -981,7 +972,7 @@ bool QgsMapRenderer::writeXML( QDomNode & theNode, QDomDocument & theDoc )
|
||||
tmpSettings.setOutputSize( outputSize() );
|
||||
tmpSettings.setMapUnits( mapUnits() );
|
||||
tmpSettings.setExtent( extent() );
|
||||
tmpSettings.setProjectionsEnabled( hasCrsTransformEnabled() );
|
||||
tmpSettings.setCrsTransformEnabled( hasCrsTransformEnabled() );
|
||||
tmpSettings.setDestinationCrs( destinationCrs() );
|
||||
|
||||
tmpSettings.writeXML( theNode, theDoc );
|
||||
@ -1079,9 +1070,16 @@ QgsMapRenderer::BlendMode QgsMapRenderer::getBlendModeEnum( const QPainter::Comp
|
||||
}
|
||||
}
|
||||
|
||||
const QgsMapSettings& QgsMapRenderer::mapSettings() const
|
||||
const QgsMapSettings& QgsMapRenderer::mapSettings()
|
||||
{
|
||||
// TODO: keep up-to-date with real settings
|
||||
// make sure the settings object is up-to-date
|
||||
mMapSettings.setExtent( extent() );
|
||||
mMapSettings.setOutputSize( outputSize() );
|
||||
mMapSettings.setOutputDpi( outputDpi() );
|
||||
mMapSettings.setLayers( layerSet() );
|
||||
mMapSettings.setCrsTransformEnabled( hasCrsTransformEnabled() );
|
||||
mMapSettings.setDestinationCrs( destinationCrs() );
|
||||
mMapSettings.setMapUnits( mapUnits() );
|
||||
return mMapSettings;
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,7 @@ class CORE_EXPORT QgsLabelingEngineInterface
|
||||
};
|
||||
|
||||
|
||||
// ### QGIS 3: remove QgsMapRenderer in favor of QgsMapRendererJob
|
||||
|
||||
/** \ingroup core
|
||||
* A non GUI class for rendering a map layer set onto a QPainter.
|
||||
@ -296,7 +297,8 @@ class CORE_EXPORT QgsMapRenderer : public QObject
|
||||
static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::CompositionMode blendMode );
|
||||
|
||||
//! bridge to QgsMapSettings
|
||||
const QgsMapSettings& mapSettings() const;
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings();
|
||||
|
||||
signals:
|
||||
|
||||
@ -391,6 +393,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
|
||||
//! Locks rendering loop for concurrent draws
|
||||
QMutex mRenderMutex;
|
||||
|
||||
//! map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings
|
||||
QgsMapSettings mMapSettings;
|
||||
|
||||
private:
|
||||
|
@ -171,7 +171,7 @@ void QgsMapSettings::setLayers(const QStringList& layers)
|
||||
mLayers = layers;
|
||||
}
|
||||
|
||||
void QgsMapSettings::setProjectionsEnabled( bool enabled )
|
||||
void QgsMapSettings::setCrsTransformEnabled( bool enabled )
|
||||
{
|
||||
mProjectionsEnabled = enabled;
|
||||
}
|
||||
@ -473,7 +473,7 @@ void QgsMapSettings::readXML( QDomNode& theNode )
|
||||
|
||||
// set projections flag
|
||||
QDomNode projNode = theNode.namedItem( "projections" );
|
||||
setProjectionsEnabled( projNode.toElement().text().toInt() );
|
||||
setCrsTransformEnabled( projNode.toElement().text().toInt() );
|
||||
|
||||
// set destination CRS
|
||||
QgsCoordinateReferenceSystem srs;
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
void setLayers(const QStringList& layers);
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
void setProjectionsEnabled( bool enabled );
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
//! returns true if projections are enabled for this layer set
|
||||
bool hasCrsTransformEnabled() const;
|
||||
|
||||
@ -76,9 +76,7 @@ public:
|
||||
double scale() const;
|
||||
|
||||
|
||||
|
||||
// TODO: utility functions
|
||||
|
||||
// -- utility functions --
|
||||
|
||||
const QgsMapToPixel& mapToPixel() const { return mMapToPixel; }
|
||||
|
||||
|
@ -42,6 +42,7 @@ class CORE_EXPORT QgsRenderContext
|
||||
~QgsRenderContext();
|
||||
|
||||
//! create initialized QgsRenderContext instance from given QgsMapSettings
|
||||
//! @note added in 2.1
|
||||
static QgsRenderContext fromMapSettings( const QgsMapSettings& mapSettings );
|
||||
|
||||
//getters
|
||||
|
@ -143,6 +143,12 @@ QgsSpatialIndex:: ~QgsSpatialIndex()
|
||||
{
|
||||
}
|
||||
|
||||
QgsSpatialIndex& QgsSpatialIndex::operator=( const QgsSpatialIndex& other )
|
||||
{
|
||||
if ( this != &other )
|
||||
d = other.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Region QgsSpatialIndex::rectToRegion( QgsRectangle rect )
|
||||
{
|
||||
|
@ -57,6 +57,9 @@ class CORE_EXPORT QgsSpatialIndex
|
||||
/** destructor finalizes work with spatial index */
|
||||
~QgsSpatialIndex();
|
||||
|
||||
/** implement assignment operator */
|
||||
QgsSpatialIndex& operator=( const QgsSpatialIndex& other );
|
||||
|
||||
|
||||
/* operations */
|
||||
|
||||
|
@ -148,7 +148,6 @@ ENDIF (WITH_TOUCH)
|
||||
SET(QGIS_GUI_MOC_HDRS
|
||||
|
||||
qgscolorbutton.h
|
||||
qgsmapcanvasmap.h
|
||||
|
||||
raster/qgsrasterminmaxwidget.h
|
||||
raster/qgspalettedrendererwidget.h
|
||||
|
@ -92,10 +92,10 @@ QgsMapCanvasRendererSync::QgsMapCanvasRendererSync( QgsMapCanvas* canvas, QgsMap
|
||||
connect( mCanvas, SIGNAL(mapUnitsChanged()), this, SLOT(onMapUnitsC2R()) );
|
||||
connect( mRenderer, SIGNAL(mapUnitsChanged()), this, SLOT(onMapUnitsR2C()) );
|
||||
|
||||
connect( mCanvas, SIGNAL(hasCrsTransformEnabled(bool)), this, SLOT(onCrsTransformC2R()) );
|
||||
connect( mCanvas, SIGNAL(hasCrsTransformEnabledChanged(bool)), this, SLOT(onCrsTransformC2R()) );
|
||||
connect( mRenderer, SIGNAL(hasCrsTransformEnabled(bool)), this, SLOT(onCrsTransformR2C()) );
|
||||
|
||||
connect( mCanvas, SIGNAL(destinationSrsChanged()), this, SLOT(onDestCrsC2R()) );
|
||||
connect( mCanvas, SIGNAL(destinationCrsChanged()), this, SLOT(onDestCrsC2R()) );
|
||||
connect( mRenderer, SIGNAL(destinationSrsChanged()), this, SLOT(onDestCrsR2C()) );
|
||||
|
||||
connect( mCanvas, SIGNAL(layersChanged()), this, SLOT(onLayersC2R()) );
|
||||
@ -194,9 +194,6 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
|
||||
mMap = new QgsMapCanvasMap( this );
|
||||
mScene->addItem( mMap );
|
||||
|
||||
// TODO: propagate signals to map renderer?
|
||||
//connect( mMapRenderer, SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( crsTransformEnabled( bool ) ) );
|
||||
|
||||
// project handling
|
||||
connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ),
|
||||
this, SLOT( readProject( const QDomDocument & ) ) );
|
||||
@ -425,9 +422,9 @@ void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
|
||||
if ( mMapOverview )
|
||||
{
|
||||
// disconnect old map overview if exists
|
||||
disconnect( this, SIGNAL( hasCrsTransformEnabled( bool ) ),
|
||||
disconnect( this, SIGNAL( hasCrsTransformEnabledChanged( bool ) ),
|
||||
mMapOverview, SLOT( hasCrsTransformEnabled( bool ) ) );
|
||||
disconnect( this, SIGNAL( destinationSrsChanged() ),
|
||||
disconnect( this, SIGNAL( destinationCrsChanged() ),
|
||||
mMapOverview, SLOT( destinationSrsChanged() ) );
|
||||
|
||||
// map overview is not owned by map canvas so don't delete it...
|
||||
@ -438,9 +435,9 @@ void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
|
||||
if ( overview )
|
||||
{
|
||||
// connect to the map render to copy its projection settings
|
||||
connect( this, SIGNAL( hasCrsTransformEnabled( bool ) ),
|
||||
connect( this, SIGNAL( hasCrsTransformEnabledChanged( bool ) ),
|
||||
overview, SLOT( hasCrsTransformEnabled( bool ) ) );
|
||||
connect( this, SIGNAL( destinationSrsChanged() ),
|
||||
connect( this, SIGNAL( destinationCrsChanged() ),
|
||||
overview, SLOT( destinationSrsChanged() ) );
|
||||
}
|
||||
}
|
||||
@ -452,15 +449,14 @@ const QgsMapSettings &QgsMapCanvas::mapSettings() const
|
||||
|
||||
void QgsMapCanvas::setCrsTransformEnabled(bool enabled)
|
||||
{
|
||||
mSettings.setProjectionsEnabled( enabled );
|
||||
if ( mSettings.hasCrsTransformEnabled() == enabled )
|
||||
return;
|
||||
|
||||
if ( enabled )
|
||||
{
|
||||
QgsDebugMsg( "refreshing after reprojection was enabled" );
|
||||
refresh();
|
||||
}
|
||||
mSettings.setCrsTransformEnabled( enabled );
|
||||
|
||||
emit hasCrsTransformEnabled( enabled );
|
||||
refresh();
|
||||
|
||||
emit hasCrsTransformEnabledChanged( enabled );
|
||||
}
|
||||
|
||||
void QgsMapCanvas::setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
|
||||
@ -485,7 +481,7 @@ void QgsMapCanvas::setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
|
||||
|
||||
mSettings.setDestinationCrs( crs );
|
||||
|
||||
emit destinationSrsChanged();
|
||||
emit destinationCrsChanged();
|
||||
}
|
||||
|
||||
const QgsLabelingResults *QgsMapCanvas::labelingResults() const
|
||||
|
@ -119,10 +119,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
|
||||
void setCurrentLayer( QgsMapLayer* layer );
|
||||
|
||||
// ### QGIS 3: make QgsMapCanvas independent from overview
|
||||
void updateOverview();
|
||||
|
||||
// ### QGIS 3: make QgsMapCanvas independent from overview
|
||||
void enableOverviewMode( QgsMapOverviewCanvas* overview );
|
||||
|
||||
//! Get access to properties used for map rendering
|
||||
//! @note added in 2.1
|
||||
const QgsMapSettings& mapSettings() const;
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
@ -205,6 +209,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
virtual QColor canvasColor() const;
|
||||
|
||||
/** Set color of selected vector features */
|
||||
//! @note added in 2.1
|
||||
void setSelectionColor( const QColor& color );
|
||||
|
||||
/** Emits signal scaleChanged to update scale in main window */
|
||||
@ -212,7 +217,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
|
||||
/** Updates the full extent */
|
||||
//! @deprecated since v2.1 - does nothing
|
||||
void updateFullExtent();
|
||||
Q_DECL_DEPRECATED void updateFullExtent() {}
|
||||
|
||||
//! return the map layer at position index in the layer stack
|
||||
QgsMapLayer *layer( int index );
|
||||
@ -395,6 +400,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! Emit map tool changed event
|
||||
void mapToolSet( QgsMapTool *tool );
|
||||
|
||||
// ### QGIS 3: remove the signal
|
||||
//! Emitted when selection in any layer gets changed
|
||||
void selectionChanged( QgsMapLayer * layer );
|
||||
|
||||
@ -408,11 +414,11 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
|
||||
//! Emitted when on-the-fly projection has been turned on/off
|
||||
//! @note added in 2.1
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
void hasCrsTransformEnabledChanged( bool flag );
|
||||
|
||||
//! Emitted when map CRS has changed
|
||||
//! @note added in 2.1
|
||||
void destinationSrsChanged();
|
||||
void destinationCrsChanged();
|
||||
|
||||
//! Emmitted when map units are changed
|
||||
//! @note added in 2.1
|
||||
@ -481,6 +487,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
*/
|
||||
QgsMapCanvas( QgsMapCanvas const & );
|
||||
|
||||
//! encompases all map settings necessary for map rendering
|
||||
QgsMapSettings mSettings;
|
||||
|
||||
//! all map rendering is done in this class
|
||||
|
@ -55,7 +55,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QgsMapCanvasItem // public QObject, p
|
||||
Q_DECL_DEPRECATED void resize( QSize size ) { Q_UNUSED( size ); }
|
||||
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
Q_DECL_DEPRECATED void enableAntiAliasing( bool flag );
|
||||
Q_DECL_DEPRECATED void enableAntiAliasing( bool flag ) { Q_UNUSED( flag ); }
|
||||
|
||||
//! @deprecated in 2.1 - does nothing. Kept for API compatibility
|
||||
Q_DECL_DEPRECATED void render() {}
|
||||
|
@ -324,7 +324,7 @@ void QgsMapOverviewCanvas::updateFullExtent()
|
||||
|
||||
void QgsMapOverviewCanvas::hasCrsTransformEnabled( bool flag )
|
||||
{
|
||||
mSettings.setProjectionsEnabled( flag );
|
||||
mSettings.setCrsTransformEnabled( flag );
|
||||
}
|
||||
|
||||
void QgsMapOverviewCanvas::destinationSrsChanged()
|
||||
|
@ -62,11 +62,14 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
|
||||
|
||||
public slots:
|
||||
|
||||
// ### QGIS 3: make protected
|
||||
//! used for overview canvas to reflect changed extent in main map canvas
|
||||
void drawExtentRect();
|
||||
|
||||
// ### QGIS 3: rename so it does not look like getter, make protected
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
|
||||
// ### QGIS 3: rename Srs to Crs, make protected
|
||||
void destinationSrsChanged();
|
||||
|
||||
protected slots:
|
||||
|
@ -85,7 +85,7 @@ void CoordinateCapture::initGui()
|
||||
{
|
||||
mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object
|
||||
|
||||
connect( mQGisIface->mapCanvas(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
|
||||
connect( mQGisIface->mapCanvas(), SIGNAL( destinationCrsChanged() ), this, SLOT( setSourceCrs() ) );
|
||||
connect( mQGisIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
|
||||
|
||||
setSourceCrs(); //set up the source CRS
|
||||
|
@ -122,7 +122,7 @@ void QgsGrassPlugin::initGui()
|
||||
mCanvas = qGisInterface->mapCanvas();
|
||||
QWidget* qgis = qGisInterface->mainWindow();
|
||||
|
||||
connect( mCanvas, SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
|
||||
connect( mCanvas, SIGNAL( destinationCrsChanged() ), this, SLOT( setTransform() ) );
|
||||
|
||||
// Connect project
|
||||
connect( qgis, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
|
||||
|
@ -45,7 +45,7 @@ QgsGrassRegionEdit::QgsGrassRegionEdit( QgsMapCanvas* canvas )
|
||||
mCrs = QgsGrass::crs( gisdbase, location );
|
||||
QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
|
||||
setTransform();
|
||||
connect( canvas, SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
|
||||
connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( setTransform() ) );
|
||||
}
|
||||
|
||||
QgsGrassRegionEdit::~QgsGrassRegionEdit()
|
||||
|
@ -78,7 +78,7 @@ void TestQgsAtlasComposition::initTestCase()
|
||||
|
||||
//create composition with composer map
|
||||
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings.setProjectionsEnabled( true );
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
|
||||
// select epsg:2154
|
||||
QgsCoordinateReferenceSystem crs;
|
||||
|
@ -62,7 +62,7 @@ void TestQgsComposerLabel::initTestCase()
|
||||
|
||||
//create composition with composer map
|
||||
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings.setProjectionsEnabled( false );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
||||
|
@ -67,7 +67,7 @@ void TestQgsComposerMap::initTestCase()
|
||||
|
||||
//create composition with composer map
|
||||
mMapSettings.setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings.setProjectionsEnabled( false );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
|
||||
|
@ -69,7 +69,7 @@ void TestQgsComposerScaleBar::initTestCase()
|
||||
QgsCoordinateReferenceSystem destCRS;
|
||||
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
mMapSettings.setDestinationCrs( destCRS );
|
||||
mMapSettings.setProjectionsEnabled( true );
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
Loading…
x
Reference in New Issue
Block a user