17 #ifndef QGSCOMPOSERITEM_H
18 #define QGSCOMPOSERITEM_H
24 #include <QGraphicsRectItem>
47 ComposerItem = UserType + 100,
120 virtual int type()
const override {
return ComposerItem; }
129 virtual bool isRemoved()
const {
return mRemovedFromComposition; }
138 void setIsRemoved(
const bool removed ) { mRemovedFromComposition = removed; }
147 void move(
double dx,
double dy );
152 virtual void moveContent(
double dx,
double dy ) { Q_UNUSED( dx ); Q_UNUSED( dy ); }
160 Q_DECL_DEPRECATED
virtual void zoomContent(
int delta,
double x,
double y ) { Q_UNUSED( delta ); Q_UNUSED( x ); Q_UNUSED( y ); }
194 void updatePagePos(
double newPageWidth,
double newPageHeight );
203 void setItemPosition(
double x,
double y, ItemPositionMode itemPoint = UpperLeft,
int page = -1 );
215 void setItemPosition(
double x,
double y,
double width,
double height, ItemPositionMode itemPoint = UpperLeft,
bool posIncludesFrame =
false,
int page = -1 );
223 virtual void setSceneRect(
const QRectF& rectangle );
247 virtual void setFrameEnabled(
const bool drawFrame );
257 virtual void setFrameOutlineColor(
const QColor& color );
277 virtual void setFrameOutlineWidth(
const double outlineWidth );
307 void setFrameJoinStyle(
const Qt::PenJoinStyle style );
316 virtual double estimatedFrameBleed()
const;
326 virtual QRectF rectWithFrame()
const;
356 void setBackgroundColor(
const QColor& backgroundColor );
362 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
368 void setBlendMode(
const QPainter::CompositionMode blendMode );
380 void setTransparency(
const int transparency );
396 void setEffectsEnabled(
const bool effectsEnabled );
412 void cancelCommand();
433 Q_DECL_DEPRECATED
void drawText(
QPainter* p,
const QRectF& rect,
const QString& text,
const QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop,
int flags = Qt::TextWordWrap )
const;
438 Q_DECL_DEPRECATED
double textWidthMillimeters(
const QFont& font,
const QString& text )
const;
443 Q_DECL_DEPRECATED
double fontHeightCharacterMM(
const QFont& font,
const QChar& c )
const;
448 Q_DECL_DEPRECATED
double fontAscentMillimeters(
const QFont& font )
const;
453 Q_DECL_DEPRECATED
double fontDescentMillimeters(
const QFont& font )
const;
460 Q_DECL_DEPRECATED
double fontHeightMillimeters(
const QFont& font )
const;
465 Q_DECL_DEPRECATED
double pixelFontSize(
double pointSize )
const;
470 Q_DECL_DEPRECATED
QFont scaledFontPixelSize(
const QFont& font )
const;
476 void setPositionLock(
const bool lock );
498 Q_DECL_DEPRECATED
double rotation()
const {
return mEvaluatedItemRotation; }
513 virtual void setId(
const QString&
id );
530 virtual QString displayName()
const;
539 virtual void setVisibility(
const bool visible );
555 virtual void setExcludeFromExports(
const bool exclude );
569 void setIsGroupMember(
const bool isGroupMember );
601 virtual void setItemRotation(
const double r,
const bool adjustPosition =
false );
682 virtual void drawSelectionBoxes(
QPainter* p );
685 virtual void drawFrame(
QPainter* p );
688 virtual void drawBackground(
QPainter* p );
693 Q_DECL_DEPRECATED
void drawArrowHead(
QPainter* p,
double x,
double y,
double angle,
double arrowHeadWidth )
const;
700 double rectHandlerBorderTolerance()
const;
705 Q_DECL_DEPRECATED
double lockSymbolSize()
const;
710 double horizontalViewScaleFactor()
const;
717 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height,
double rotation )
const;
722 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height )
const;
731 Q_DECL_DEPRECATED
QRectF largestRotatedRectWithinBounds(
const QRectF& originalRect,
const QRectF& boundsRect,
double rotation )
const;
736 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height,
double rotation )
const;
741 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height )
const;
746 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height,
double rotation );
751 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height );
759 Q_DECL_DEPRECATED
void rotate(
double angle,
double& x,
double& y )
const;
763 void deleteHAlignSnapItem();
766 void deleteVAlignSnapItem();
767 void deleteAlignItems();
786 bool shouldDrawItem()
const;
790 void itemRotationChanged(
double newRotation );
810 bool mCompositionManagesZValue;
834 void init(
const bool manageZValue );
bool positionLock() const
Returns whether position lock for mouse drags is enabled returns true if item is locked for mouse mov...
bool mExcludeFromExports
Whether item should be excluded in exports.
void setSelected(bool selected)
bool effectsEnabled() const
Returns whether effects (eg blend modes) are enabled for the item.
int mTransparency
Item transparency.
A base class for objects which belong to a map composition.
A container class for data source field mapping or expression.
QPointF mLastMouseEventPos
Position of the last mouse move event (in scene coordinates)
virtual void beginItemCommand(const QString &text)
ItemPositionMode lastUsedPositionMode()
Returns item's last used position mode.
virtual bool selected() const
Is selected.
virtual void removeItems()
Qt::PenJoinStyle frameJoinStyle() const
Returns the join style used for drawing the item's frame.
A item that forms part of a map composition.
QgsComposerItem::MouseMoveAction mCurrentMouseMoveAction
double mLastValidViewScaleFactor
Backup to restore item appearance if no view scale factor is available.
ItemPositionMode mLastUsedPositionMode
The item's position mode.
A container for grouping several QgsComposerItems.
virtual void zoomContent(const double factor, const QPointF point, const ZoomMode mode=QgsComposerItem::Zoom)
Zoom content of item.
DataDefinedProperty
Data defined properties for different item types.
QColor backgroundColor() const
Gets the background color for this item.
QPainter::CompositionMode mBlendMode
Composition blend mode for item.
void update(const QRectF &rect)
double frameOutlineWidth() const
Returns the frame's outline width.
virtual void moveContent(double dx, double dy)
Move Content of item.
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects's current state.
QString uuid() const
Get item identification name.
virtual void setCurrentExportLayer(const int layerIdx=-1)
Sets the current layer to draw for exporting.
void setIsRemoved(const bool removed)
Sets whether this item has been removed from the composition.
int transparency() const
Returns the item's transparency.
virtual void updateItem()
Updates item, with the possibility to do custom update for subclasses.
QGraphicsRectItem * mBoundingResizeRectangle
Rectangle used during move and resize actions.
bool mFrame
True if item fram needs to be painted.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
double mEvaluatedItemRotation
Temporary evaluated item rotation in degrees, clockwise.
virtual void repaint()
Triggers a redraw for the item.
bool mRemovedFromComposition
True if item has been removed from the composition.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
virtual int numberExportLayers() const
Get the number of layers that this item requires for exporting as layers.
QPointF mMouseMoveStartPos
Start point of the last mouse move action (in scene coordinates)
void setBackgroundEnabled(const bool drawBackground)
Set whether this item has a Background drawn around it or not.
Graphics scene for map printing.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
virtual bool isRemoved() const
Returns whether this item has been removed from the composition.
QColor frameOutlineColor() const
Returns the frame's outline color.
Q_DECL_DEPRECATED double rotation() const
Returns the rotation for the composer item.
Qt::PenJoinStyle mFrameJoinStyle
Frame join style.
QColor mBackgroundColor
Background color.
QGraphicsLineItem * mVAlignSnapItem
virtual Q_DECL_DEPRECATED void zoomContent(int delta, double x, double y)
Zoom content of item.
QGraphicsLineItem * mHAlignSnapItem
int mCurrentExportLayer
The layer that needs to be exported.
virtual void endItemCommand()
virtual void addItem(QgsComposerItem *item)
Composite operations for item groups do nothing per default.
bool mItemPositionLocked
True if item position and size cannot be changed with mouse move.
virtual void refreshDataDefinedProperty(const DataDefinedProperty property=AllProperties, const QgsExpressionContext *context=0)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QPainter::CompositionMode blendMode() const
Returns the item's composition blending mode.
bool hasFrame() const
Whether this item has a frame or not.
bool hasBackground() const
Whether this item has a Background or not.
void setRotation(qreal angle)
QgsComposerEffect * mEffect
MouseMoveAction
Describes the action (move or resize in different directon) to be done during mouse move...
bool mBackground
True if item background needs to be painted.
bool isGroupMember() const
Returns whether this item is part of a group.
ZoomMode
Modes for zooming item content.
bool mIsGroupMember
Whether or not this item is part of a group.
double mItemRotation
Item rotation in degrees, clockwise.
bool mEvaluatedExcludeFromExports
Temporary evaluated item exclusion.
virtual int type() const override
Return correct graphics item type.
QString id() const
Get item's id (which is not necessarly unique)