Skip to content

Commit d68025c

Browse files
committedJul 26, 2016
Fix annotation position when maps are rotated, remove hacks
Adds a new interface class QgsAnnotation, and allows for removal of a bunch of hacks in QgsComposerMap without breaking 2.x API (cherry-picked from 0fa6499)
1 parent b351d16 commit d68025c

File tree

9 files changed

+277
-54
lines changed

9 files changed

+277
-54
lines changed
 

‎python/core/core.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
%Include qgis.sip
2020

21+
%Include qgsannotation.sip
2122
%Include qgsapplication.sip
2223
%Include qgsaction.sip
2324
%Include qgsactionmanager.sip

‎python/core/qgsannotation.sip

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/** \ingroup core
2+
* \class QgsAnnotation
3+
* \note added in QGIS 3.0
4+
*
5+
* \brief An interface for annotation items which are drawn over a map.
6+
*
7+
* QgsAnnotation is an interface class for map annotation items. These annotations can be
8+
* drawn within a map, and have either a fixed map position (retrieved using mapPosition())
9+
* or are placed relative to the map's frame (retrieved using relativePosition()).
10+
* Annotations with a fixed map position also have a corresponding
11+
* QgsCoordinateReferenceSystem, which can be determined by calling mapPositionCrs().
12+
*/
13+
14+
class QgsAnnotation
15+
{
16+
%TypeHeaderCode
17+
#include <qgsannotation.h>
18+
%End
19+
public:
20+
21+
//! Returns true if the annotation should be shown.
22+
virtual bool showItem() const = 0;
23+
24+
/** Returns true if the annotation is attached to a fixed map position, or
25+
* false if the annotation uses a position relative to the current map
26+
* extent.
27+
* @see mapPosition()
28+
* @see relativePositon()
29+
*/
30+
//TODO QGIS 3 - rename to hasFixedMapPosition()
31+
virtual bool mapPositionFixed() const = 0;
32+
33+
/** Returns the map position of the annotation, if it is attached to a fixed map
34+
* position.
35+
* @see mapPositionFixed()
36+
* @see mapPositionCrs()
37+
*/
38+
virtual QgsPoint mapPosition() const;
39+
40+
/** Returns the CRS of the map position, or an invalid CRS if the annotation does
41+
* not have a fixed map position.
42+
*/
43+
virtual QgsCoordinateReferenceSystem mapPositionCrs() const;
44+
45+
/** Returns the relative position of the annotation, if it is not attached to a fixed map
46+
* position. The coordinates in the return point should be between 0 and 1, and represent
47+
* the relative percentage for the position compared to the map width and height.
48+
* @see mapPositionFixed()
49+
*/
50+
virtual QPointF relativePosition() const;
51+
52+
/** Returns a scaling factor which should be applied to painters before rendering
53+
* the item.
54+
*/
55+
virtual double scaleFactor() const = 0;
56+
57+
//! deprecated - do not use
58+
// TODO QGIS 3.0 - remove
59+
virtual void setItemData( int role, const QVariant& value ) = 0;
60+
61+
//! Paint the annotation to a destination painter
62+
virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) = 0;
63+
64+
};

‎python/gui/qgsannotationitem.sip

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "qgstextannotationitem.h"
99
%End
1010

11-
class QgsAnnotationItem: QgsMapCanvasItem
11+
class QgsAnnotationItem: QgsMapCanvasItem, QgsAnnotation
1212
{
1313
%TypeHeaderCode
1414
#include <qgsannotationitem.h>
@@ -66,6 +66,12 @@ class QgsAnnotationItem: QgsMapCanvasItem
6666
virtual void setMapPosition( const QgsPoint& pos );
6767
QgsPoint mapPosition() const;
6868

69+
virtual QPointF relativePosition() const;
70+
71+
virtual double scaleFactor() const;
72+
73+
virtual bool showItem() const;
74+
6975
/** Sets the CRS of the map position.
7076
@param crs the CRS to set */
7177
virtual void setMapPositionCrs( const QgsCoordinateReferenceSystem& crs );
@@ -97,18 +103,28 @@ class QgsAnnotationItem: QgsMapCanvasItem
97103
void _writeXML( QDomDocument& doc, QDomElement& itemElem ) const;
98104
void _readXML( const QDomDocument& doc, const QDomElement& annotationElem );
99105

106+
virtual void setItemData( int role, const QVariant& value );
107+
virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr );
108+
void paint( QPainter* painter );
109+
100110
protected:
101111
void updateBoundingRect();
102112
/** Check where to attach the balloon connection between frame and map point*/
103113
void updateBalloon();
104114

105-
void drawFrame( QPainter* p );
106-
void drawMarkerSymbol( QPainter* p );
107-
void drawSelectionBoxes( QPainter* p );
115+
//! Draws the annotation frame to a destination painter
116+
void drawFrame( QPainter* p ) const;
117+
118+
//! Draws the map position marker symbol to a destination painter
119+
void drawMarkerSymbol( QPainter* p ) const;
120+
121+
//! Draws selection handles around the item
122+
void drawSelectionBoxes( QPainter* p ) const;
123+
108124
/** Returns frame width in painter units*/
109125
//double scaledFrameWidth( QPainter* p) const;
110126
/** Gets the frame line (0 is the top line, 1 right, 2 bottom, 3 left)*/
111-
QLineF segment( int index );
127+
QLineF segment( int index ) const;
112128
/** Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point*/
113129
QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint, double distance ) const;
114130
/** Returns the symbol size scaled in (mapcanvas) pixels. Used for the counding rect calculation*/

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ SET(QGIS_CORE_HDRS
607607
qgis.h
608608
qgsaction.h
609609
qgsaggregatecalculator.h
610+
qgsannotation.h
610611
qgsattributetableconfig.h
611612
qgsattributeaction.h
612613
qgscachedfeatureiterator.h

‎src/core/composer/qgscomposermap.cpp

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "qgspallabeling.h"
3535
#include "qgsexpression.h"
3636
#include "qgsvisibilitypresetcollection.h"
37+
#include "qgsannotation.h"
3738

3839
#include "qgslabel.h"
3940
#include "qgslabelattributes.h"
@@ -2373,75 +2374,72 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
23732374
for ( int i = itemList.size() - 1; i >= 0; --i )
23742375
{
23752376
currentItem = itemList.at( i );
2376-
//don't draw mapcanvasmap (has z value -10)
2377-
if ( !currentItem || currentItem->data( 0 ).toString() != "AnnotationItem" )
2377+
2378+
const QgsAnnotation* annotation = dynamic_cast< const QgsAnnotation* >( currentItem );
2379+
if ( !annotation )
23782380
{
23792381
continue;
23802382
}
2381-
drawCanvasItem( currentItem, painter, itemStyle );
2383+
drawCanvasItem( annotation, painter, itemStyle );
23822384
}
23832385
}
23842386

2385-
void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle )
2387+
void QgsComposerMap::drawCanvasItem( const QgsAnnotation* annotation, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle )
23862388
{
2387-
if ( !item || !mMapCanvas || !item->isVisible() )
2389+
if ( !annotation || !annotation->showItem() )
23882390
{
23892391
return;
23902392
}
23912393

23922394
painter->save();
23932395
painter->setRenderHint( QPainter::Antialiasing );
23942396

2395-
//determine scale factor according to graphics view dpi
2396-
double scaleFactor = 1.0 / mMapCanvas->logicalDpiX() * 25.4;
2397+
double scaleFactor = annotation->scaleFactor();
23972398

23982399
double itemX, itemY;
2399-
QGraphicsItem* parent = item->parentItem();
2400-
if ( !parent )
2400+
if ( annotation->mapPositionFixed() )
24012401
{
2402-
QPointF mapPos = composerMapPosForItem( item );
2402+
QPointF mapPos = composerMapPosForItem( annotation );
24032403
itemX = mapPos.x();
24042404
itemY = mapPos.y();
24052405
}
2406-
else //place item relative to the parent item
2406+
else
24072407
{
2408-
QPointF itemScenePos = item->scenePos();
2409-
QPointF parentScenePos = parent->scenePos();
2410-
2411-
QPointF mapPos = composerMapPosForItem( parent );
2412-
2413-
itemX = mapPos.x() + ( itemScenePos.x() - parentScenePos.x() ) * scaleFactor;
2414-
itemY = mapPos.y() + ( itemScenePos.y() - parentScenePos.y() ) * scaleFactor;
2408+
itemX = annotation->relativePosition().x() * rect().width();
2409+
itemY = annotation->relativePosition().y() * rect().height();
24152410
}
2416-
painter->translate( itemX, itemY );
24172411

2412+
painter->translate( itemX, itemY );
24182413
painter->scale( scaleFactor, scaleFactor );
24192414

24202415
//a little trick to let the item know that the paint request comes from the composer
2421-
item->setData( 1, "composer" );
2422-
item->paint( painter, itemStyle, nullptr );
2423-
item->setData( 1, "" );
2416+
const_cast< QgsAnnotation* >( annotation )->setItemData( 1, "composer" );
2417+
const_cast< QgsAnnotation* >( annotation )->paint( painter, itemStyle, nullptr );
2418+
const_cast< QgsAnnotation* >( annotation )->setItemData( 1, "" );
2419+
24242420
painter->restore();
24252421
}
24262422

2427-
QPointF QgsComposerMap::composerMapPosForItem( const QGraphicsItem* item ) const
2423+
QPointF QgsComposerMap::composerMapPosForItem( const QgsAnnotation* annotation ) const
24282424
{
2429-
if ( !item || !mMapCanvas )
2430-
{
2425+
if ( !annotation )
24312426
return QPointF( 0, 0 );
2432-
}
24332427

2434-
if ( currentMapExtent()->height() <= 0 || currentMapExtent()->width() <= 0 || mMapCanvas->width() <= 0 || mMapCanvas->height() <= 0 )
2428+
double mapX = 0.0;
2429+
double mapY = 0.0;
2430+
2431+
mapX = annotation->mapPosition().x();
2432+
mapY = annotation->mapPosition().y();
2433+
QgsCoordinateReferenceSystem crs = annotation->mapPositionCrs();
2434+
2435+
if ( crs != mComposition->mapSettings().destinationCrs() )
24352436
{
2436-
return QPointF( 0, 0 );
2437+
//need to reproject
2438+
QgsCoordinateTransform t( crs, mComposition->mapSettings().destinationCrs() );
2439+
double z = 0.0;
2440+
t.transformInPlace( mapX, mapY, z );
24372441
}
24382442

2439-
QRectF graphicsSceneRect = mMapCanvas->sceneRect();
2440-
QPointF itemScenePos = item->scenePos();
2441-
QgsRectangle mapRendererExtent = mComposition->mapSettings().visibleExtent();
2442-
2443-
double mapX = itemScenePos.x() / graphicsSceneRect.width() * mapRendererExtent.width() + mapRendererExtent.xMinimum();
2444-
double mapY = mapRendererExtent.yMaximum() - itemScenePos.y() / graphicsSceneRect.height() * mapRendererExtent.height();
24452443
return mapToItemCoords( QPointF( mapX, mapY ) );
24462444
}
24472445

‎src/core/composer/qgscomposermap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class QPainter;
3737
class QgsFillSymbolV2;
3838
class QgsLineSymbolV2;
3939
class QgsVectorLayer;
40+
class QgsAnnotation;
4041

4142
/** \ingroup core
4243
* \class QgsComposerMap
@@ -972,8 +973,8 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
972973
void transformShift( double& xShift, double& yShift ) const;
973974

974975
void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle );
975-
void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle );
976-
QPointF composerMapPosForItem( const QGraphicsItem* item ) const;
976+
void drawCanvasItem( const QgsAnnotation* item, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle );
977+
QPointF composerMapPosForItem( const QgsAnnotation* item ) const;
977978

978979
enum PartType
979980
{

‎src/core/qgsannotation.h

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/***************************************************************************
2+
qgsannotation.h
3+
---------------
4+
begin : July 2016
5+
copyright : (C) 2016 by Nyall Dawson
6+
email : nyall dot dawson at gmail dot com
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#ifndef QGSANNOTATION_H
19+
#define QGSANNOTATION_H
20+
21+
#include "qgspoint.h"
22+
#include "qgscoordinatereferencesystem.h"
23+
24+
class QPainter;
25+
class QStyleOptionGraphicsItem;
26+
27+
/** \ingroup core
28+
* \class QgsAnnotation
29+
* \note added in QGIS 3.0
30+
*
31+
* \brief An interface for annotation items which are drawn over a map.
32+
*
33+
* QgsAnnotation is an interface class for map annotation items. These annotations can be
34+
* drawn within a map, and have either a fixed map position (retrieved using mapPosition())
35+
* or are placed relative to the map's frame (retrieved using relativePosition()).
36+
* Annotations with a fixed map position also have a corresponding
37+
* QgsCoordinateReferenceSystem, which can be determined by calling mapPositionCrs().
38+
*/
39+
40+
class CORE_EXPORT QgsAnnotation
41+
{
42+
public:
43+
44+
//! Returns true if the annotation should be shown.
45+
virtual bool showItem() const = 0;
46+
47+
/** Returns true if the annotation is attached to a fixed map position, or
48+
* false if the annotation uses a position relative to the current map
49+
* extent.
50+
* @see mapPosition()
51+
* @see relativePositon()
52+
*/
53+
//TODO QGIS 3 - rename to hasFixedMapPosition()
54+
virtual bool mapPositionFixed() const = 0;
55+
56+
/** Returns the map position of the annotation, if it is attached to a fixed map
57+
* position.
58+
* @see mapPositionFixed()
59+
* @see mapPositionCrs()
60+
*/
61+
virtual QgsPoint mapPosition() const { return QgsPoint(); }
62+
63+
/** Returns the CRS of the map position, or an invalid CRS if the annotation does
64+
* not have a fixed map position.
65+
*/
66+
virtual QgsCoordinateReferenceSystem mapPositionCrs() const { return QgsCoordinateReferenceSystem(); }
67+
68+
/** Returns the relative position of the annotation, if it is not attached to a fixed map
69+
* position. The coordinates in the return point should be between 0 and 1, and represent
70+
* the relative percentage for the position compared to the map width and height.
71+
* @see mapPositionFixed()
72+
*/
73+
virtual QPointF relativePosition() const { return QPointF(); }
74+
75+
/** Returns a scaling factor which should be applied to painters before rendering
76+
* the item.
77+
*/
78+
virtual double scaleFactor() const = 0;
79+
80+
//! deprecated - do not use
81+
// TODO QGIS 3.0 - remove
82+
virtual void setItemData( int role, const QVariant& value ) = 0;
83+
84+
//! Paint the annotation to a destination painter
85+
virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) = 0;
86+
87+
88+
};
89+
90+
#endif // QGSANNOTATION_H

‎src/gui/qgsannotationitem.cpp

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,19 @@ void QgsAnnotationItem::setMapPosition( const QgsPoint& pos )
5454
{
5555
mMapPosition = pos;
5656
setPos( toCanvasCoordinates( mMapPosition ) );
57-
mMapPositionCrs = mMapCanvas->mapSettings().destinationCrs();
57+
setMapPositionCrs( mMapCanvas->mapSettings().destinationCrs() );
58+
}
59+
60+
QPointF QgsAnnotationItem::relativePosition() const
61+
{
62+
double x = pos().x() / mMapCanvas->width();
63+
double y = pos().y() / mMapCanvas->height();
64+
return QPointF( x, y );
65+
}
66+
67+
double QgsAnnotationItem::scaleFactor() const
68+
{
69+
return 1.0 / mMapCanvas->logicalDpiX() * 25.4;
5870
}
5971

6072
void QgsAnnotationItem::setMapPositionCrs( const QgsCoordinateReferenceSystem& crs )
@@ -185,7 +197,7 @@ void QgsAnnotationItem::updateBalloon()
185197
mBalloonSegmentPoint2 = pointOnLineWithDistance( mBalloonSegmentPoint1, minEdge.p2(), 10 );
186198
}
187199

188-
void QgsAnnotationItem::drawFrame( QPainter* p )
200+
void QgsAnnotationItem::drawFrame( QPainter* p ) const
189201
{
190202
QPen framePen( mFrameColor );
191203
framePen.setWidthF( mFrameBorderWidth );
@@ -219,7 +231,7 @@ void QgsAnnotationItem::setFrameSize( QSizeF size )
219231
updateBalloon();
220232
}
221233

222-
void QgsAnnotationItem::drawMarkerSymbol( QPainter* p )
234+
void QgsAnnotationItem::drawMarkerSymbol( QPainter* p ) const
223235
{
224236
if ( !p )
225237
{
@@ -240,7 +252,7 @@ void QgsAnnotationItem::drawMarkerSymbol( QPainter* p )
240252
}
241253
}
242254

243-
void QgsAnnotationItem::drawSelectionBoxes( QPainter* p )
255+
void QgsAnnotationItem::drawSelectionBoxes( QPainter* p ) const
244256
{
245257
if ( !p )
246258
{
@@ -262,7 +274,7 @@ void QgsAnnotationItem::drawSelectionBoxes( QPainter* p )
262274
p->drawRect( QRectF( mBoundingRect.left(), mBoundingRect.bottom() - handlerSize, handlerSize, handlerSize ) );
263275
}
264276

265-
QLineF QgsAnnotationItem::segment( int index )
277+
QLineF QgsAnnotationItem::segment( int index ) const
266278
{
267279
switch ( index )
268280
{
@@ -444,8 +456,12 @@ void QgsAnnotationItem::_readXML( const QDomDocument& doc, const QDomElement& an
444456
mapPos.setX( annotationElem.attribute( "mapPosX", "0" ).toDouble() );
445457
mapPos.setY( annotationElem.attribute( "mapPosY", "0" ).toDouble() );
446458
mMapPosition = mapPos;
459+
447460
if ( !mMapPositionCrs.readXML( annotationElem ) )
461+
{
448462
mMapPositionCrs = mMapCanvas->mapSettings().destinationCrs();
463+
}
464+
449465
mFrameBorderWidth = annotationElem.attribute( "frameBorderWidth", "0.5" ).toDouble();
450466
mFrameColor.setNamedColor( annotationElem.attribute( "frameColor", "#000000" ) );
451467
mFrameColor.setAlpha( annotationElem.attribute( "frameColorAlpha", "255" ).toInt() );
@@ -473,3 +489,19 @@ void QgsAnnotationItem::_readXML( const QDomDocument& doc, const QDomElement& an
473489
updateBoundingRect();
474490
updateBalloon();
475491
}
492+
493+
void QgsAnnotationItem::setItemData( int role, const QVariant& value )
494+
{
495+
setData( role, value );
496+
}
497+
498+
void QgsAnnotationItem::paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* )
499+
{
500+
// maintain API compatibility, if annotation item subclasses only implement the paint( QPainter* ) override
501+
paint( painter );
502+
}
503+
504+
void QgsAnnotationItem::paint( QPainter* painter )
505+
{
506+
Q_UNUSED( painter );
507+
}

‎src/gui/qgsannotationitem.h

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "qgsmapcanvasitem.h"
2222
#include "qgscoordinatereferencesystem.h"
23+
#include "qgsannotation.h"
2324

2425
class QDomDocument;
2526
class QDomElement;
@@ -30,7 +31,8 @@ class QgsMarkerSymbolV2;
3031
/** \ingroup gui
3132
* An annotation item can be either placed either on screen corrdinates or on map coordinates.
3233
It may reference a feature and displays that associatiation with a balloon like appearance*/
33-
class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem
34+
35+
class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem, public QgsAnnotation
3436
{
3537
public:
3638
enum MouseMoveAction
@@ -65,16 +67,22 @@ class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem
6567

6668
//setters and getters
6769
void setMapPositionFixed( bool fixed );
68-
bool mapPositionFixed() const { return mMapPositionFixed; }
70+
bool mapPositionFixed() const override { return mMapPositionFixed; }
6971

7072
virtual void setMapPosition( const QgsPoint& pos );
71-
QgsPoint mapPosition() const { return mMapPosition; }
73+
QgsPoint mapPosition() const override { return mMapPosition; }
74+
75+
virtual QPointF relativePosition() const override;
76+
77+
virtual double scaleFactor() const override;
78+
79+
virtual bool showItem() const override { return isVisible(); }
7280

7381
/** Sets the CRS of the map position.
7482
@param crs the CRS to set */
7583
virtual void setMapPositionCrs( const QgsCoordinateReferenceSystem& crs );
7684
/** Returns the CRS of the map position.*/
77-
QgsCoordinateReferenceSystem mapPositionCrs() const { return mMapPositionCrs; }
85+
QgsCoordinateReferenceSystem mapPositionCrs() const override { return mMapPositionCrs; }
7886

7987
void setFrameSize( QSizeF size );
8088
QSizeF frameSize() const { return mFrameSize; }
@@ -101,6 +109,12 @@ class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem
101109
void _writeXML( QDomDocument& doc, QDomElement& itemElem ) const;
102110
void _readXML( const QDomDocument& doc, const QDomElement& annotationElem );
103111

112+
virtual void setItemData( int role, const QVariant& value ) override;
113+
114+
virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
115+
116+
void paint( QPainter* painter ) override;
117+
104118
protected:
105119
/** True: the item stays at the same map position, False: the item stays on same screen position*/
106120
bool mMapPositionFixed;
@@ -136,13 +150,19 @@ class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem
136150
/** Check where to attach the balloon connection between frame and map point*/
137151
void updateBalloon();
138152

139-
void drawFrame( QPainter* p );
140-
void drawMarkerSymbol( QPainter* p );
141-
void drawSelectionBoxes( QPainter* p );
153+
//! Draws the annotation frame to a destination painter
154+
void drawFrame( QPainter* p ) const;
155+
156+
//! Draws the map position marker symbol to a destination painter
157+
void drawMarkerSymbol( QPainter* p ) const;
158+
159+
//! Draws selection handles around the item
160+
void drawSelectionBoxes( QPainter* p ) const;
161+
142162
/** Returns frame width in painter units*/
143163
//double scaledFrameWidth( QPainter* p) const;
144164
/** Gets the frame line (0 is the top line, 1 right, 2 bottom, 3 left)*/
145-
QLineF segment( int index );
165+
QLineF segment( int index ) const;
146166
/** Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point*/
147167
QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint, double distance ) const;
148168
/** Returns the symbol size scaled in (mapcanvas) pixels. Used for the counding rect calculation*/

0 commit comments

Comments
 (0)
Please sign in to comment.