/usr/include/qgis/qgscomposerarrow.h is in libqgis-dev 2.4.0-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /***************************************************************************
qgscomposerarrow.h
----------------------
begin : November 2009
copyright : (C) 2009 by Marco Hugentobler
email : marco@hugis.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSCOMPOSERARROW_H
#define QGSCOMPOSERARROW_H
#include "qgscomposeritem.h"
#include <QBrush>
#include <QPen>
/**An item that draws an arrow between to points*/
class CORE_EXPORT QgsComposerArrow: public QgsComposerItem
{
public:
enum MarkerMode
{
DefaultMarker,
NoMarker,
SVGMarker
};
QgsComposerArrow( QgsComposition* c );
QgsComposerArrow( const QPointF& startPoint, const QPointF& stopPoint, QgsComposition* c );
~QgsComposerArrow();
/** return correct graphics item type. Added in v1.7 */
virtual int type() const { return ComposerArrow; }
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
/**Modifies position of start and endpoint and calls QgsComposerItem::setSceneRect*/
void setSceneRect( const QRectF& rectangle );
/**Sets the width of the arrow head in mm*/
void setArrowHeadWidth( double width );
double arrowHeadWidth() const {return mArrowHeadWidth;}
void setOutlineWidth( double width );
double outlineWidth() const {return mPen.widthF();}
void setStartMarker( const QString& svgPath );
QString startMarker() const {return mStartMarkerFile;}
void setEndMarker( const QString& svgPath );
QString endMarker() const {return mEndMarkerFile;}
QColor arrowColor() const { return mArrowColor; }
void setArrowColor( const QColor& c ) { mArrowColor = c; }
MarkerMode markerMode() const { return mMarkerMode;}
void setMarkerMode( MarkerMode mode );
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc document
*/
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
/** sets state from Dom document
* @param itemElem is Dom node corresponding to item tag
* @param doc is the document to read
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
private:
enum MarkerType
{
StartMarker,
EndMarker
};
QPointF mStartPoint;
QPointF mStopPoint;
/**Considering the rectangle as spanning [x[0], x[1]] x [y[0], y[1]], these
* indices specify which index {0, 1} corresponds to the start point
* coordinate of the respective dimension*/
int mStartXIdx;
int mStartYIdx;
QPen mPen;
QBrush mBrush;
/**Width of the arrow marker in mm. May be specified by the user. The height is automatically adapted*/
double mArrowHeadWidth;
/**Height of the arrow marker in mm. Is calculated from arrow marker width and apsect ratio of svg*/
double mStartArrowHeadHeight;
double mStopArrowHeadHeight;
/**Path to the start marker file*/
QString mStartMarkerFile;
/**Path to the end marker file*/
QString mEndMarkerFile;
/**Default marker, no marker or svg marker*/
MarkerMode mMarkerMode;
QColor mArrowColor;
/**Indicates QGIS version to mimic bounding box behaviour for. The line placement changed in version 2.4, so a value
* of 22 is used to indicate that the line should be drawn using the older placement routine.
*/
int mBoundsBehaviour;
/**Adapts the item scene rect to contain the start point, the stop point including the arrow marker and the outline.
Needs to be called whenever the arrow width/height, the outline with or the endpoints are changed*/
void adaptItemSceneRect();
/**Computes the margin around the line necessary to include the markers */
double computeMarkerMargin() const;
/**Draws the default marker at the line end*/
void drawHardcodedMarker( QPainter* p, MarkerType type );
/**Draws a user-defined marker (must be an svg file)*/
void drawSVGMarker( QPainter* p, MarkerType type, const QString& markerPath );
/**Apply default graphics settings*/
void initGraphicsSettings();
};
#endif // QGSCOMPOSERARROW_H
|