106 setColor( QColor( Qt::lightGray ) );
119 mPen.setColor( color );
120 QColor fillColor( color.red(), color.green(), color.blue(), 63 );
121 mBrush.setColor( fillColor );
122 mBrush.setStyle( Qt::SolidPattern );
127 mBrush.setColor( fillColor );
128 mBrush.setStyle( Qt::SolidPattern );
143 if ( !symbol )
continue;
144 setSymbol( symbol, context, color, fillColor );
152 if ( !symbol )
return;
158 if ( !symbolLayer )
continue;
209 mPen.setWidth( width );
228 QPolygonF polygon( line.size() );
230 for (
int i = 0; i < line.size(); i++ )
235 p->drawPolyline( polygon );
246 for (
int i = 0; i < polygon.size(); i++ )
248 if ( polygon[i].empty() )
continue;
251 ring.reserve( polygon[i].
size() + 1 );
253 for (
int j = 0; j < polygon[i].size(); j++ )
257 if ( 0 == j || std::abs( ring.back().x() - cur.x() ) > 1 || std::abs( ring.back().y() - cur.y() ) > 1 )
259 ring.push_back( cur );
263 ring.push_back( ring[ 0 ] );
265 path.addPolygon( ring );
294 for (
int i = 0; i < m.size(); i++ )
313 for (
int i = 0; i < m.size(); i++ )
331 for (
int i = 0; i < m.size(); i++ )
354 QColor tmpColor( 255, 0, 0, 255 );
355 QColor tmpFillColor( 0, 255, 0, 255 );
358 if ( layer && renderer )
361 if ( extent !=
rect() )
368 QImage image = QImage( imageSize.width(), imageSize.height(), QImage::Format_ARGB32 );
370 QPainter *imagePainter =
new QPainter( &image );
371 imagePainter->setRenderHint( QPainter::Antialiasing,
true );
381 QColor color(
mPen.color() );
383 double k = ( 255. -
mBrush.color().alpha() ) / 255.;
384 for (
int r = 0; r < image.height(); r++ )
386 for (
int c = 0; c < image.width(); c++ )
388 QRgb rgba = image.pixel( c, r );
389 int alpha = qAlpha( rgba );
392 int green = qGreen( rgba );
393 color.setAlpha( qBound<int>( 0, alpha - ( green * k ), 255 ) );
395 image.setPixel( c, r, color.rgba() );
400 p->drawImage( 0, 0, image );
double borderWidth() const
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
A rectangle specified with double values.
Base class for all map layer types.
bool isEmpty() const
test if rectangle is empty.
QgsFeatureRendererV2 * getRenderer(const QgsRenderContext &context, const QColor &color, const QColor &fillColor)
Get renderer for current color mode and colors.
virtual double width() const
virtual void setOutlineColor(const QColor &color)
Set outline color.
void setXMaximum(double x)
Set the maximum x value.
double yMaximum() const
Get the y maximum value (top side of rectangle)
QgsMultiPolyline asMultiPolyline() const
return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list
QVector< QgsPoint > QgsPolyline
polyline is represented as a vector of points
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
QgsPolygon asPolygon() const
return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list ...
void setFillColor(const QColor &fillColor)
Set polygons fill color.
An abstract class for items that can be placed on the map canvas.
void paintPolygon(QPainter *p, QgsPolygon polygon)
void setOutlineWidth(double w)
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
QgsSymbolV2::OutputUnit outputUnit() const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsRectangle rect() const
returns canvas item rectangle
virtual void removeDataDefinedProperty(const QString &property)
Map canvas is a class for displaying all GIS data types on a canvas.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
QgsMultiPolygon asMultiPolygon() const
return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty ...
The QgsMapSettings class contains configuration for rendering of the map.
virtual void stopRender(QgsRenderContext &context)=0
virtual QgsSymbolV2List symbols()=0
for symbol levels
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
QgsHighlight(QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsMapLayer *layer)
virtual QgsFeatureRendererV2 * clone()=0
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
QSize outputSize() const
Return the size of the resulting map image.
double xMaximum() const
Get the x maximum value (right side of rectangle)
void setYMinimum(double y)
Set the minimum y value.
virtual void setWidth(double width)
void updateRect()
recalculates needed rectangle
double outlineWidth() const
void paintPoint(QPainter *p, QgsPoint point)
QVector< QgsPolygon > QgsMultiPolygon
a collection of QgsPolygons that share a common collection of attributes
QVector< QgsPoint > QgsMultiPoint
a collection of QgsPoints that share a common collection of attributes
void setPainter(QPainter *p)
void setSymbol(QgsSymbolV2 *symbol, const QgsRenderContext &context, const QColor &color, const QColor &fillColor)
QGis::WkbType wkbType() const
Returns type of wkb (point / linestring / polygon etc.)
virtual void paint(QPainter *p)
QVector< QgsPolyline > QgsPolygon
polygon: first item of the list is outer ring, inner rings (if any) start from second item ...
const QgsMapLayer * layer() const
A class to represent a point geometry.
virtual void setFillColor(const QColor &color)
Set fill color.
QPointF toCanvasCoordinates(const QgsPoint &point)
transformation from map coordinates to screen coordinates
A class to represent a vector.
QVector< QgsPolyline > QgsMultiPolyline
a collection of QgsPolylines that share a common collection of attributes
virtual QgsSymbolV2 * subSymbol()
double getSymbolWidth(const QgsRenderContext &context, double width, QgsSymbolV2::OutputUnit unit)
QgsPolyline asPolyline() const
return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list ...
QgsSymbolV2::OutputUnit outlineWidthUnit() const
QgsRectangle boundingBox()
Returns the bounding box of this feature.
Contains information about the context of a rendering operation.
void paintLine(QPainter *p, QgsPolyline line)
static double lineWidthScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns the line width scale factor depending on the unit and the paint device.
void setColor(const QColor &color)
Set line/outline to color, polygon fill to color with alpha = 63.
void setYMaximum(double y)
Set the maximum y value.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
QgsMultiPoint asMultiPoint() const
return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list...
QgsMapCanvas * mMapCanvas
pointer to map canvas
void setRect(const QgsRectangle &r)
sets canvas item rectangle
int transform(const QgsCoordinateTransform &ct)
Transform this geometry as described by CoordinateTranasform ct.
virtual void setColor(const QColor &color)
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
QgsSymbolLayerV2 * symbolLayer(int layer)
double width() const
Width of the rectangle.
QgsPoint asPoint() const
return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0...
const QgsCoordinateTransform * layerTransfrom(QgsMapLayer *layer) const
Return coordinate transform from layer's CRS to destination CRS.
Represents a vector layer which manages a vector based data sets.
void setBorderWidth(double borderWidth)
double xMinimum() const
Get the x minimum value (left side of rectangle)
QgsSymbolV2::OutputUnit widthUnit() const
void setXMinimum(double x)
Set the minimum x value.
void setWidth(int width)
Set width.