100 mPen.setColor( color );
101 QColor fillColor( color.red(), color.green(), color.blue(), 63 );
102 mBrush.setColor( fillColor );
103 mBrush.setStyle( Qt::SolidPattern );
116 if ( !symbol )
continue;
124 if ( !symbol )
return;
131 if ( color.lightness() < 200 )
144 if ( !symbolLayer )
continue;
167 mPen.setWidth( width );
186 QPolygonF polygon( line.size() );
188 for (
int i = 0; i < line.size(); i++ )
193 p->drawPolyline( polygon );
204 for (
int i = 0; i < polygon.size(); i++ )
206 if ( polygon[i].empty() )
continue;
209 ring.reserve( polygon[i].
size() + 1 );
211 for (
int j = 0; j < polygon[i].size(); j++ )
215 if ( 0 == j || std::abs( ring.back().x() - cur.x() ) > 1 || std::abs( ring.back().y() - cur.y() ) > 1 )
217 ring.push_back( cur );
221 ring.push_back( ring[ 0 ] );
223 path.addPolygon( ring );
252 for (
int i = 0; i < m.size(); i++ )
271 for (
int i = 0; i < m.size(); i++ )
289 for (
int i = 0; i < m.size(); i++ )
312 if ( extent !=
rect() )
321 double height = ll.y() - ur.y();
322 double width = ur.x() - ll.x();
327 QImage image = QImage((
int )width, (
int )height, QImage::Format_ARGB32 );
329 QPainter *imagePainter =
new QPainter( &image );
330 imagePainter->setRenderHint( QPainter::Antialiasing,
true );
346 QColor color = QColor(
mBrush.color() );
347 color.setAlpha( 63 );
348 QRgb colorRgb = color.rgba();
350 for (
int r = 0; r < image.height(); r++ )
352 QRgb *line = ( QRgb * ) image.scanLine( r );
353 for (
int c = 0; c < image.width(); c++ )
355 if ( line[c] == temporaryRgb )
362 p->drawImage( 0, 0, image );
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
QgsRenderContext * rendererContext()
Accessor for render context.
double mapUnitsPerPixel() const
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
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 ...
An abstract class for items that can be placed on the map canvas.
void setSymbolColor(QgsSymbolV2 *symbol, const QColor &color)
void paintPolygon(QPainter *p, QgsPolygon polygon)
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)
void setExtent(const QgsRectangle &extent)
Map canvas is a class for displaying all GIS data types on a canvas.
const QgsCoordinateTransform * transformation(const QgsMapLayer *layer) const
QgsMultiPolygon asMultiPolygon() const
return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty ...
virtual void stopRender(QgsRenderContext &context)=0
void setCoordinateTransform(const QgsCoordinateTransform *t)
Sets coordinate transformation.
virtual QgsSymbolV2List symbols()=0
for symbol levels
Perform transforms between map coordinates and device coordinates.
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
virtual QgsFeatureRendererV2 * clone()=0
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double xMaximum() const
Get the x maximum value (right side of rectangle)
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
void setYMinimum(double y)
Set the minimum y value.
void updateRect()
recalculates needed rectangle
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
QgsFeatureRendererV2 * mRenderer
void setPainter(QPainter *p)
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 ...
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()
QgsPolyline asPolyline() const
return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list ...
QgsRectangle boundingBox()
Returns the bounding box of this feature.
Contains information about the context of a rendering operation.
void paintLine(QPainter *p, QgsPolyline line)
QColor mTemporaryFillColor
void setColor(const QColor &color)
void setYMaximum(double y)
Set the maximum y value.
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
QgsMapRenderer * mapRenderer()
void setMapToPixel(const QgsMapToPixel &mtp)
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)
virtual void startRender(QgsRenderContext &context, const QgsVectorLayer *vlayer)=0
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
QgsSymbolLayerV2 * symbolLayer(int layer)
QgsVectorLayer * vectorLayer()
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...
Represents a vector layer which manages a vector based data sets.
double xMinimum() const
Get the x minimum value (left side of rectangle)
void setXMinimum(double x)
Set the minimum x value.
void setWidth(int width)
Set width.