mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Use a clearer marker for main canvas position in view windows
This commit is contained in:
parent
f6699332a3
commit
b54fe1e3a5
@ -17,23 +17,24 @@ class QgsVertexMarker : QgsMapCanvasItem
|
||||
ICON_CIRCLE
|
||||
};
|
||||
|
||||
QgsVertexMarker( QgsMapCanvas* mapCanvas /TransferThis/ );
|
||||
QgsVertexMarker( QgsMapCanvas *mapCanvas /TransferThis/ );
|
||||
|
||||
void setCenter( const QgsPoint& point );
|
||||
void setCenter( const QgsPoint &point );
|
||||
|
||||
void setIconType( int iconType );
|
||||
|
||||
void setIconSize( int iconSize );
|
||||
|
||||
void setColor( const QColor& color );
|
||||
void setColor( const QColor &color );
|
||||
QColor color() const;
|
||||
void setFillColor( const QColor &color );
|
||||
QColor fillColor() const;
|
||||
|
||||
void setPenWidth( int width );
|
||||
|
||||
void paint( QPainter* p );
|
||||
void paint( QPainter *p );
|
||||
|
||||
QRectF boundingRect() const;
|
||||
|
||||
virtual void updatePosition();
|
||||
|
||||
};
|
||||
|
||||
|
@ -48,6 +48,7 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
|
||||
mXyMarker->setIconType( QgsVertexMarker::ICON_CIRCLE );
|
||||
mXyMarker->setIconSize( 6 );
|
||||
mXyMarker->setColor( QColor( 30, 30, 30, 225 ) );
|
||||
mXyMarker->setFillColor( QColor( 255, 255, 255, 225 ) );
|
||||
mPanTool = new QgsMapToolPan( mMapCanvas );
|
||||
mMapCanvas->setMapTool( mPanTool );
|
||||
|
||||
|
@ -20,12 +20,7 @@
|
||||
|
||||
QgsVertexMarker::QgsVertexMarker( QgsMapCanvas *mapCanvas )
|
||||
: QgsMapCanvasItem( mapCanvas )
|
||||
{
|
||||
mIconSize = 10;
|
||||
mIconType = ICON_X;
|
||||
mColor = QColor( 255, 0, 0 );
|
||||
mPenWidth = 1;
|
||||
}
|
||||
{}
|
||||
|
||||
void QgsVertexMarker::setIconType( int type )
|
||||
{
|
||||
@ -47,6 +42,13 @@ void QgsVertexMarker::setCenter( const QgsPoint &point )
|
||||
void QgsVertexMarker::setColor( const QColor &color )
|
||||
{
|
||||
mColor = color;
|
||||
update();
|
||||
}
|
||||
|
||||
void QgsVertexMarker::setFillColor( const QColor &color )
|
||||
{
|
||||
mFillColor = color;
|
||||
update();
|
||||
}
|
||||
|
||||
void QgsVertexMarker::setPenWidth( int width )
|
||||
@ -61,6 +63,8 @@ void QgsVertexMarker::paint( QPainter *p )
|
||||
QPen pen( mColor );
|
||||
pen.setWidth( mPenWidth );
|
||||
p->setPen( pen );
|
||||
QBrush brush( mFillColor );
|
||||
p->setBrush( brush );
|
||||
|
||||
switch ( mIconType )
|
||||
{
|
||||
|
@ -47,8 +47,39 @@ class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem
|
||||
|
||||
void setIconSize( int iconSize );
|
||||
|
||||
/**
|
||||
* Sets the stroke \a color for the marker.
|
||||
* @see color()
|
||||
* @see setFillColor()
|
||||
*/
|
||||
void setColor( const QColor &color );
|
||||
|
||||
/**
|
||||
* Returns the stroke color for the marker.
|
||||
* @see setColor()
|
||||
* @see fillColor()
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
QColor color() const { return mColor; }
|
||||
|
||||
/**
|
||||
* Sets the fill \a color for the marker. This setting only
|
||||
* applies to some icon types.
|
||||
* @note added in QGIS 3.0
|
||||
* @see fillColor()
|
||||
* @see setColor()
|
||||
*/
|
||||
void setFillColor( const QColor &color );
|
||||
|
||||
/**
|
||||
* Returns the fill \a color for the marker. This setting only
|
||||
* applies to some icon types.
|
||||
* @note added in QGIS 3.0
|
||||
* @see setFillColor()
|
||||
* @see color()
|
||||
*/
|
||||
QColor fillColor() const { return mFillColor; }
|
||||
|
||||
void setPenWidth( int width );
|
||||
|
||||
void paint( QPainter *p ) override;
|
||||
@ -57,22 +88,26 @@ class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem
|
||||
|
||||
virtual void updatePosition() override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
//! icon to be shown
|
||||
int mIconType;
|
||||
int mIconType = ICON_X;
|
||||
|
||||
//! size
|
||||
int mIconSize;
|
||||
int mIconSize = 10;
|
||||
|
||||
//! coordinates of the point in the center
|
||||
QgsPoint mCenter;
|
||||
|
||||
//! color of the marker
|
||||
QColor mColor;
|
||||
QColor mColor = QColor( 255, 0, 0 );
|
||||
|
||||
//! pen width
|
||||
int mPenWidth;
|
||||
int mPenWidth = 1;
|
||||
|
||||
//! Fill color
|
||||
QColor mFillColor = QColor( 0, 0, 0, 0 );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user