29 , mFrameSymbol( nullptr )
30 , mBlendMode(
QPainter::CompositionMode_SourceOver )
34 createDefaultFrameSymbol();
40 , mFrameSymbol(
nullptr )
41 , mBlendMode( QPainter::CompositionMode_SourceOver )
47 void QgsComposerMapOverview::createDefaultFrameSymbol()
51 properties.
insert(
"color",
"255,0,0,255" );
52 properties.
insert(
"style",
"solid" );
53 properties.
insert(
"style_border",
"no" );
75 if ( !overviewFrameMap )
102 delete expressionContext;
107 painter->
scale( 1 / dotsPerMM, 1 / dotsPerMM );
124 intersectPolygon = mapTransform.
map( intersectExtent );
130 mFrameSymbol->
renderPolygon( intersectPolygon, &rings,
nullptr, context );
137 outerPolygon <<
QPointF( 0, 0 )
144 rings.
append( intersectPolygon );
145 mFrameSymbol->
renderPolygon( outerPolygon, &rings,
nullptr, context );
162 overviewFrameElem.
setAttribute(
"frameMap", mFrameMapId );
164 overviewFrameElem.
setAttribute(
"inverted", mInverted );
165 overviewFrameElem.
setAttribute(
"centered", mCentered );
187 mInverted = ( itemElem.
attribute(
"inverted",
"0" ) !=
"0" );
188 mCentered = ( itemElem.
attribute(
"centered",
"0" ) !=
"0" );
191 if ( !frameStyleElem.
isNull() )
194 mFrameSymbol = QgsSymbolLayerV2Utils::loadSymbol<QgsFillSymbolV2>( frameStyleElem );
201 return mBlendMode != QPainter::CompositionMode_SourceOver;
206 if ( mFrameMapId == mapId )
246 mFrameSymbol = symbol;
278 if ( !overviewFrameMap )
288 center.
y() - extent.
height() / 2,
387 for (
int i = 0; i < mapOverviewNodeList.
size(); ++i )
391 mapOverview->
readXML( mapOverviewElem, doc );
QgsComposerMapItem * item(const QString &itemId) const
Returns a reference to an item within the stack.
void connectSignals()
Reconnects signals for overview map, so that overview correctly follows changes to source map's exten...
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
void setForceVectorOutput(bool force)
QDomNodeList elementsByTagName(const QString &tagname) const
A rectangle specified with double values.
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
void setExtent(const QgsRectangle &rect, bool magnified=true)
Set coordinates of the rectangle which should be rendered.
QgsPoint center() const
Center point of the rectangle.
const QgsComposerMap * getComposerMapById(const int id) const
Returns the composer map with specified id.
void setCompositionMode(CompositionMode mode)
void addItem(QgsComposerMapItem *item)
Adds a new map item to the stack and takes ownership of the item.
void setRenderHint(RenderHint hint, bool on)
QDomNode appendChild(const QDomNode &newChild)
QString attribute(const QString &name, const QString &defValue) const
void addOverview(QgsComposerMapOverview *overview)
Adds a new map overview to the stack and takes ownership of the overview.
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation...
QgsComposerMapItem(const QString &name, QgsComposerMap *map)
Constructor for QgsComposerMapItem.
void scale(qreal sx, qreal sy)
static QgsFillSymbolV2 * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties. ...
void cache()
Create cache image.
const T & at(int i) const
void moveOverviewDown(const QString &overviewId)
Moves an overview down the stack, causing it to be rendered below other overviews.
void setOutputDpi(double dpi)
Set DPI used for conversion between real world units (e.g. mm) and pixels.
static QgsMapRenderer::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
static QDomElement saveSymbol(const QString &symbolName, QgsSymbolV2 *symbol, QDomDocument &doc)
const QgsComposerMapOverview * constOverview(const QString &overviewId) const
Returns a const reference to an overview within the stack.
bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets overview state from a DOM document.
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void update(const QRectF &rect)
An item which is drawn inside a QgsComposerMap, eg a grid or map overview.
double y() const
Get the y value of the point.
The QgsMapSettings class contains configuration for rendering of the map.
QDomElement toElement() const
void append(const T &value)
void setOutputSize(QSize size)
Set the size of the resulting map image.
An individual overview which is drawn above the map content in a QgsComposerMap, and shows the extent...
void setFrameSymbol(QgsFillSymbolV2 *symbol)
Sets the fill symbol used for drawing the overview extent.
void startRender(QgsRenderContext &context, const QgsFields *fields=nullptr)
bool mEnabled
True if item is to be displayed on map.
QgsComposerMapOverview & operator[](int idx)
Returns a reference to an overview within the stack.
void setAttribute(const QString &name, const QString &value)
void removeItem(const QString &itemId)
Removes an item from the stack and deletes the corresponding QgsComposerMapItem.
const QgsComposerMapItem * constItem(const QString &itemId) const
Returns a const reference to an item within the stack.
double width() const
Width of the rectangle.
int toInt(bool *ok, int base) const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void moveItemUp(const QString &itemId)
Moves an item up the stack, causing it to be rendered above other items.
void setCentered(const bool centered)
Sets whether the extent of the map is forced to center on the overview.
QPaintDevice * device() const
void setPainter(QPainter *p)
void removeOverview(const QString &overviewId)
Removes an overview from the stack and deletes the corresponding QgsComposerMapOverview.
QgsComposerMapOverview(const QString &name, QgsComposerMap *map)
Constructor for QgsComposerMapOverview.
QgsComposerMap * mComposerMap
Associated composer map.
static QPainter::CompositionMode getCompositionMode(BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
A class to represent a point.
const QgsMapSettings & mapSettings() const
Return setting of QGIS map canvas.
bool usesAdvancedEffects() const override
Returns true if the item is drawn using advanced effects, such as blend modes.
Object representing map window.
void moveItemDown(const QString &itemId)
Moves an item up the stack, causing it to be rendered above other items.
void draw(QPainter *painter) override
Draws an overview.
QList< QgsComposerMapItem *> mItems
QgsComposerMapOverview * overview(const QString &overviewId) const
Returns a reference to an overview within the stack.
bool writeXML(QDomElement &elem, QDomDocument &doc) const override
Stores overview state in DOM element.
virtual ~QgsComposerMapOverview()
Contains information about the context of a rendering operation.
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties, const QgsExpressionContext *context=nullptr) override
void overviewExtentChanged()
Handles recentering of the map and redrawing of the map's overview.
void stopRender(QgsRenderContext &context)
const QgsComposition * composition() const
Returns the composition the item is attached to.
void moveOverviewUp(const QString &overviewId)
Moves an overview up the stack, causing it to be rendered above other overviews.
QList< QgsComposerMapOverview *> asList() const
Returns a list of QgsComposerMapOverviews contained by the stack.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
bool inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the exte...
A collection of map items which are drawn above the map content in a QgsComposerMap.
QDomElement firstChildElement(const QString &tagName) const
void translate(const QPointF &offset)
QPolygonF intersected(const QPolygonF &r) const
void setInverted(const bool inverted)
Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent ...
void setFrameMap(const int mapId)
Sets overview frame map.
virtual ~QgsComposerMapOverviewStack()
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets map item state from a DOM document.
iterator insert(const Key &key, const T &value)
QDomElement createElement(const QString &tagName)
void removeItems()
Clears the item stack and deletes all QgsComposerMapItems contained by the stack. ...
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const override
Stores map item state in DOM element.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QgsComposerMapOverviewStack(QgsComposerMap *map)
Constructor for QgsComposerMapOverviewStack.
const QgsRectangle * currentMapExtent() const
Returns a pointer to the current map extent, which is either the original user specified extent or th...
void setAlpha(qreal alpha)
Set alpha transparency 1 for opaque, 0 for invisible.
bool readXML(const QDomElement &elem, const QDomDocument &doc) override
Sets the overview stack's state from a DOM document.
double x() const
Get the x value of the point.
void setBlendMode(const QPainter::CompositionMode blendMode)
Sets the blending mode used for drawing the overview.
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects' current state.
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
double height() const
Height of the rectangle.
QDomNode at(int index) const
QgsComposerMap * mComposerMap
uint toUInt(bool *ok, int base) const