Skip to content
Permalink
Browse files

run astyle on src/core

  • Loading branch information
3nids committed Mar 3, 2017
1 parent c4434e8 commit 40c056cae0cf2f7ab9ce94a27085c9ae83f6aa07
Showing 752 changed files with 19,006 additions and 18,973 deletions.
@@ -22,9 +22,9 @@
#include <QPen>
#include <QPainter>

QgsAnnotation::QgsAnnotation( QObject* parent )
: QObject( parent )
, mMarkerSymbol( new QgsMarkerSymbol() )
QgsAnnotation::QgsAnnotation( QObject *parent )
: QObject( parent )
, mMarkerSymbol( new QgsMarkerSymbol() )
{
QgsStringMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "white" ) );
@@ -55,13 +55,13 @@ void QgsAnnotation::setHasFixedMapPosition( bool fixed )
emit moved();
}

void QgsAnnotation::setMapPosition( const QgsPoint& position )
void QgsAnnotation::setMapPosition( const QgsPoint &position )
{
mMapPosition = position;
emit moved();
}

void QgsAnnotation::setMapPositionCrs( const QgsCoordinateReferenceSystem& crs )
void QgsAnnotation::setMapPositionCrs( const QgsCoordinateReferenceSystem &crs )
{
mMapPositionCrs = crs;
emit moved();
@@ -90,21 +90,21 @@ void QgsAnnotation::setFrameSize( QSizeF size )
emit appearanceChanged();
}

void QgsAnnotation::setContentsMargin( const QgsMargins& margins )
void QgsAnnotation::setContentsMargin( const QgsMargins &margins )
{
mContentsMargins = margins;
emit appearanceChanged();
}

void QgsAnnotation::setFillSymbol( QgsFillSymbol* symbol )
void QgsAnnotation::setFillSymbol( QgsFillSymbol *symbol )
{
mFillSymbol.reset( symbol );
emit appearanceChanged();
}

void QgsAnnotation::render( QgsRenderContext& context ) const
void QgsAnnotation::render( QgsRenderContext &context ) const
{
QPainter* painter = context.painter();
QPainter *painter = context.painter();
if ( !painter )
{
return;
@@ -133,13 +133,13 @@ void QgsAnnotation::render( QgsRenderContext& context ) const
painter->restore();
}

void QgsAnnotation::setMarkerSymbol( QgsMarkerSymbol* symbol )
void QgsAnnotation::setMarkerSymbol( QgsMarkerSymbol *symbol )
{
mMarkerSymbol.reset( symbol );
emit appearanceChanged();
}

void QgsAnnotation::setMapLayer( QgsMapLayer* layer )
void QgsAnnotation::setMapLayer( QgsMapLayer *layer )
{
mMapLayer = layer;
emit mapLayerChanged();
@@ -256,7 +256,7 @@ QPointF QgsAnnotation::pointOnLineWithDistance( QPointF startPoint, QPointF dire
return QPointF( startPoint.x() + dx * scaleFactor, startPoint.y() + dy * scaleFactor );
}

void QgsAnnotation::drawFrame( QgsRenderContext& context ) const
void QgsAnnotation::drawFrame( QgsRenderContext &context ) const
{
if ( !mFillSymbol )
return;
@@ -285,7 +285,7 @@ void QgsAnnotation::drawFrame( QgsRenderContext& context ) const
mFillSymbol->stopRender( context );
}

void QgsAnnotation::drawMarkerSymbol( QgsRenderContext& context ) const
void QgsAnnotation::drawMarkerSymbol( QgsRenderContext &context ) const
{
if ( !context.painter() )
{
@@ -300,7 +300,7 @@ void QgsAnnotation::drawMarkerSymbol( QgsRenderContext& context ) const
}
}

void QgsAnnotation::_writeXml( QDomElement& itemElem, QDomDocument& doc ) const
void QgsAnnotation::_writeXml( QDomElement &itemElem, QDomDocument &doc ) const
{
if ( itemElem.isNull() )
{
@@ -345,7 +345,7 @@ void QgsAnnotation::_writeXml( QDomElement& itemElem, QDomDocument& doc ) const
itemElem.appendChild( annotationElem );
}

void QgsAnnotation::_readXml( const QDomElement& annotationElem, const QDomDocument& doc )
void QgsAnnotation::_readXml( const QDomElement &annotationElem, const QDomDocument &doc )
{
Q_UNUSED( doc );
if ( annotationElem.isNull() )
@@ -385,7 +385,7 @@ void QgsAnnotation::_readXml( const QDomElement& annotationElem, const QDomDocum
QDomElement symbolElem = annotationElem.firstChildElement( QStringLiteral( "symbol" ) );
if ( !symbolElem.isNull() )
{
QgsMarkerSymbol* symbol = QgsSymbolLayerUtils::loadSymbol<QgsMarkerSymbol>( symbolElem );
QgsMarkerSymbol *symbol = QgsSymbolLayerUtils::loadSymbol<QgsMarkerSymbol>( symbolElem );
if ( symbol )
{
mMarkerSymbol.reset( symbol );
@@ -399,7 +399,7 @@ void QgsAnnotation::_readXml( const QDomElement& annotationElem, const QDomDocum
QDomElement symbolElem = fillElem.firstChildElement( QStringLiteral( "symbol" ) );
if ( !symbolElem.isNull() )
{
QgsFillSymbol* symbol = QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( symbolElem );
QgsFillSymbol *symbol = QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( symbolElem );
if ( symbol )
{
mFillSymbol.reset( symbol );
@@ -55,7 +55,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
/**
* Constructor for QgsAnnotation.
*/
QgsAnnotation( QObject* parent = nullptr );
QgsAnnotation( QObject *parent = nullptr );

/**
* Returns true if the annotation is visible and should be rendered.
@@ -100,7 +100,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* position.
* @see mapPosition()
*/
void setMapPosition( const QgsPoint& position );
void setMapPosition( const QgsPoint &position );

/**
* Returns the CRS of the map position, or an invalid CRS if the annotation does
@@ -113,7 +113,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* Sets the CRS of the map position.
* @see mapPositionCrs()
*/
void setMapPositionCrs( const QgsCoordinateReferenceSystem& crs );
void setMapPositionCrs( const QgsCoordinateReferenceSystem &crs );

/**
* Returns the relative position of the annotation, if it is not attached to a fixed map
@@ -162,7 +162,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* content.
* @see contentsMargin()
*/
void setContentsMargin( const QgsMargins& margins );
void setContentsMargin( const QgsMargins &margins );

/**
* Returns the margins (in millimeters) between the outside of the frame and the annotation
@@ -176,63 +176,63 @@ class CORE_EXPORT QgsAnnotation : public QObject
* of the symbol is transferred to the annotation.
* @see fillSymbol()
*/
void setFillSymbol( QgsFillSymbol* symbol );
void setFillSymbol( QgsFillSymbol *symbol );

/**
* Returns the symbol that is used for rendering the annotation frame.
* @see setFillSymbol()
*/
QgsFillSymbol* fillSymbol() const { return mFillSymbol.get(); }
QgsFillSymbol *fillSymbol() const { return mFillSymbol.get(); }

/**
* Renders the annotation to a target render context.
*/
void render( QgsRenderContext& context ) const;
void render( QgsRenderContext &context ) const;

/**
* Writes the annotation state to a DOM element. Derived classes should
* call _writeXml() within their implementation of this method.
* @see readXml()
* @see _writeXml()
*/
virtual void writeXml( QDomElement& elem, QDomDocument & doc ) const = 0;
virtual void writeXml( QDomElement &elem, QDomDocument &doc ) const = 0;

/**
* Restores the annotation's state from a DOM element. Derived classes should
* call _readXml() within their implementation of this method.
* @see writeXml()
* @see _readXml()
*/
virtual void readXml( const QDomElement& itemElem, const QDomDocument& doc ) = 0;
virtual void readXml( const QDomElement &itemElem, const QDomDocument &doc ) = 0;

/**
* Sets the symbol that is drawn at the annotation's map position. Ownership
* of the symbol is transferred to the annotation.
* @see markerSymbol()
*/
void setMarkerSymbol( QgsMarkerSymbol* symbol );
void setMarkerSymbol( QgsMarkerSymbol *symbol );

/**
* Returns the symbol that is drawn at the annotation's map position.
* @see setMarkerSymbol()
*/
QgsMarkerSymbol* markerSymbol() const { return mMarkerSymbol.get(); }
QgsMarkerSymbol *markerSymbol() const { return mMarkerSymbol.get(); }

/**
* Returns the map layer associated with the annotation. Annotations can be
* associated with a map layer if their visibility should be synchronized
* with the layer's visibility.
* @see setMapLayer()
*/
QgsMapLayer* mapLayer() const { return mMapLayer.data(); }
QgsMapLayer *mapLayer() const { return mMapLayer.data(); }

/**
* Sets the map layer associated with the annotation. Annotations can be
* associated with a map layer if their visibility should be synchronized
* with the layer's visibility.
* @see mapLayer()
*/
void setMapLayer( QgsMapLayer* layer );
void setMapLayer( QgsMapLayer *layer );

/**
* Returns the feature associated with the annotation, or an invalid
@@ -245,7 +245,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* Sets the feature associated with the annotation.
* @see associatedFeature()
*/
virtual void setAssociatedFeature( const QgsFeature& feature ) { mFeature = feature; }
virtual void setAssociatedFeature( const QgsFeature &feature ) { mFeature = feature; }

signals:

@@ -269,7 +269,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* Renders the annotation's contents to a target /a context at the specified /a size.
* Derived classes should implement their custom annotation drawing logic here.
*/
virtual void renderAnnotation( QgsRenderContext& context, QSizeF size ) const = 0;
virtual void renderAnnotation( QgsRenderContext &context, QSizeF size ) const = 0;

/**
* Returns the minimum frame size for the annotation. Subclasses should implement this if they
@@ -283,15 +283,15 @@ class CORE_EXPORT QgsAnnotation : public QObject
* @see writeXml()
* @see _readXml()
*/
void _writeXml( QDomElement& itemElem, QDomDocument& doc ) const;
void _writeXml( QDomElement &itemElem, QDomDocument &doc ) const;

/**
* Reads common annotation properties from a DOM element.
* This method should be called from subclasses in their readXml method.
* @see readXml()
* @see _writeXml()
*/
void _readXml( const QDomElement& annotationElem, const QDomDocument& doc );
void _readXml( const QDomElement &annotationElem, const QDomDocument &doc );

private:

@@ -305,10 +305,10 @@ class CORE_EXPORT QgsAnnotation : public QObject
QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint, double distance ) const;

//! Draws the annotation frame to a destination painter
void drawFrame( QgsRenderContext& context ) const;
void drawFrame( QgsRenderContext &context ) const;

//! Draws the map position marker symbol to a destination painter
void drawMarkerSymbol( QgsRenderContext& context ) const;
void drawMarkerSymbol( QgsRenderContext &context ) const;

bool mVisible = true;

@@ -18,9 +18,9 @@
#include "qgsannotation.h"
#include "qgsannotationregistry.h"

QgsAnnotationManager::QgsAnnotationManager( QgsProject* project )
: QObject( project )
, mProject( project )
QgsAnnotationManager::QgsAnnotationManager( QgsProject *project )
: QObject( project )
, mProject( project )
{

}
@@ -30,7 +30,7 @@ QgsAnnotationManager::~QgsAnnotationManager()
clear();
}

bool QgsAnnotationManager::addAnnotation( QgsAnnotation* annotation )
bool QgsAnnotationManager::addAnnotation( QgsAnnotation *annotation )
{
if ( !annotation )
return false;
@@ -44,7 +44,7 @@ bool QgsAnnotationManager::addAnnotation( QgsAnnotation* annotation )
return true;
}

bool QgsAnnotationManager::removeAnnotation( QgsAnnotation* annotation )
bool QgsAnnotationManager::removeAnnotation( QgsAnnotation *annotation )
{
if ( !annotation )
return false;
@@ -62,18 +62,18 @@ bool QgsAnnotationManager::removeAnnotation( QgsAnnotation* annotation )

void QgsAnnotationManager::clear()
{
Q_FOREACH ( QgsAnnotation* a, mAnnotations )
Q_FOREACH ( QgsAnnotation *a, mAnnotations )
{
removeAnnotation( a );
}
}

QList<QgsAnnotation*> QgsAnnotationManager::annotations() const
QList<QgsAnnotation *> QgsAnnotationManager::annotations() const
{
return mAnnotations;
}

bool QgsAnnotationManager::readXml( const QDomElement& element, const QDomDocument& doc )
bool QgsAnnotationManager::readXml( const QDomElement &element, const QDomDocument &doc )
{
clear();
//restore each annotation
@@ -112,15 +112,15 @@ bool QgsAnnotationManager::readXml( const QDomElement& element, const QDomDocume
return result;
}

QDomElement QgsAnnotationManager::writeXml( QDomDocument& doc ) const
QDomElement QgsAnnotationManager::writeXml( QDomDocument &doc ) const
{
QDomElement annotationsElem = doc.createElement( QStringLiteral( "Annotations" ) );
QListIterator<QgsAnnotation*> i( mAnnotations );
QListIterator<QgsAnnotation *> i( mAnnotations );
// save lowermost annotation (at end of list) first
i.toBack();
while ( i.hasPrevious() )
{
QgsAnnotation* annotation = i.previous();
QgsAnnotation *annotation = i.previous();

if ( !annotation )
{
@@ -132,10 +132,10 @@ QDomElement QgsAnnotationManager::writeXml( QDomDocument& doc ) const
return annotationsElem;
}

void QgsAnnotationManager::createAnnotationFromXml( const QDomElement& element, const QDomDocument& doc )
void QgsAnnotationManager::createAnnotationFromXml( const QDomElement &element, const QDomDocument &doc )
{
QString type = element.tagName();
QgsAnnotation* annotation = QgsApplication::annotationRegistry()->create( type );
QgsAnnotation *annotation = QgsApplication::annotationRegistry()->create( type );
if ( !annotation )
return;

0 comments on commit 40c056c

Please sign in to comment.
You can’t perform that action at this time.