47 changes: 47 additions & 0 deletions python/analysis/interpolation/NormVecDecorator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class NormVecDecorator : TriDecorator
{
%TypeHeaderCode
#include <NormVecDecorator.h>
%End

public:
/**Enumeration for the state of a point. NORMAL means, that the point is not on a breakline, BREAKLINE means that the point is on a breakline (but not an endpoint of it) and ENDPOINT means, that it is an endpoint of a breakline*/
enum pointState {NORMAL, BREAKLINE, ENDPOINT};
NormVecDecorator();
NormVecDecorator( Triangulation* tin );
virtual ~NormVecDecorator();
/**Adds a point to the triangulation*/
int addPoint( Point3D* p );
/**Calculates the normal at a point on the surface and assigns it to 'result'. Returns true in case of success and false in case of failure*/
bool calcNormal( double x, double y, Vector3D* result );
/**Calculates the normal of a triangle-point for the point with coordinates x and y. This is needed, if a point is on a break line and there is no unique normal stored in 'mNormVec'. Returns false, it something went wrong and true otherwise*/
bool calcNormalForPoint( double x, double y, int point, Vector3D* result );
/**Calculates x-, y and z-value of the point on the surface and assigns it to 'result'. Returns true in case of success and flase in case of failure*/
bool calcPoint( double x, double y, Point3D* result );
/**Eliminates the horizontal triangles by swapping or by insertion of new points. If alreadyestimated is true, a re-estimation of the normals will be done*/
virtual void eliminateHorizontalTriangles();
/**Estimates the first derivative a point. Return true in case of succes and false otherwise*/
bool estimateFirstDerivative( int pointno );
/**This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise*/
bool estimateFirstDerivatives( QProgressDialog* d = 0 );
/**Returns a pointer to the normal vector for the point with the number n*/
Vector3D* getNormal( int n ) const;
/**Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normaly taken from 'mNormVec', exept if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/
bool getTriangle( double x, double y, Point3D* p1, Vector3D* v1, Point3D* p2, Vector3D* v2, Point3D* p3, Vector3D* v3 );
/**This function behaves similar to the one above. Additionally, the numbers of the points are returned (ptn1, ptn2, ptn3) as well as the pointStates of the triangle points (state1, state2, state3)*/
//! @note not available in python bindings
// bool getTriangle( double x, double y, Point3D* p1, int* ptn1, Vector3D* v1, pointState* state1, Point3D* p2, int* ptn2, Vector3D* v2, pointState* state2, Point3D* p3, int* ptn3, Vector3D* v3, pointState* state3 );
/**Returns the state of the point with the number 'pointno'*/
pointState getState( int pointno ) const;
/**Sets an interpolator*/
void setTriangleInterpolator( TriangleInterpolator* inter );
/**Swaps the edge which is closest to the point with x and y coordinates (if this is possible) and forces recalculation of the concerned normals (if alreadyestimated is true)*/
virtual bool swapEdge( double x, double y );
/**Saves the triangulation as a (line) shapefile
@return true in case of success*/
virtual bool saveAsShapefile( const QString& fileName ) const;

protected:
/**Sets the state (BREAKLINE, NORMAL, ENDPOINT) of a point*/
void setState( int pointno, pointState s );
};
29 changes: 29 additions & 0 deletions python/analysis/interpolation/ParametricLine.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class ParametricLine
{
%TypeHeaderCode
#include <ParametricLine.h>
%End
public:
/**Default constructor*/
ParametricLine();
/**Constructor, par is a pointer to the parent object, controlpoly the controlpolygon
@note not available in python binding */
// ParametricLine( ParametricLine* par /Transfer/, QVector<Point3D*>* controlpoly );
/**Destructor*/
virtual ~ParametricLine();
virtual void add( ParametricLine* pl ) = 0;
virtual void calcFirstDer( float t, Vector3D* v ) = 0;
virtual void calcSecDer( float t, Vector3D* v ) = 0;
//virtual Point3D calcPoint(float t);
virtual void calcPoint( float t, Point3D* ) = 0;
virtual void changeDirection() = 0;
//virtual void draw(QPainter* p);
virtual const Point3D* getControlPoint( int number ) const = 0;
// virtual const QVector<Point3D*>* getControlPoly() const = 0;
virtual int getDegree() const = 0;
virtual ParametricLine* getParent() const = 0;
//virtual bool intersects(ParametricLine* pal);
virtual void remove( int i ) = 0;
//virtual void setControlPoly( QVector<Point3D*>* cp ) = 0;
virtual void setParent( ParametricLine* paral ) = 0;
};
29 changes: 29 additions & 0 deletions python/analysis/interpolation/Point3D.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Point3D
{
%TypeHeaderCode
#include <Point3D.h>
%End
public:
Point3D();
/**Constructor with the x-, y- and z-coordinate as arguments*/
Point3D( double x, double y, double z );
Point3D( const Point3D& p );
~Point3D();
// Point3D& operator=( const Point3D& p );
bool operator==( const Point3D& p );
bool operator!=( const Point3D& p );
/**calculates the three-dimensional distance to another point*/
double dist3D( Point3D* p ) const;
/**Returns the x-coordinate of the point*/
double getX() const;
/**Returns the y-coordinate of the point*/
double getY() const;
/**Returns the z-coordinate of the point*/
double getZ() const;
/**Sets the x-coordinate of the point*/
void setX( double x );
/**Sets the y-coordinate of the point*/
void setY( double y );
/**Sets the z-coordinate of the point*/
void setZ( double z );
};
41 changes: 41 additions & 0 deletions python/analysis/interpolation/TriDecorator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**Decorator class for Triangulations (s. Decorator pattern in Gamma et al.)*/
class TriDecorator : Triangulation
{
%TypeHeaderCode
#include "Triangulation.h"
%End

public:
TriDecorator();
TriDecorator( Triangulation* t );
virtual ~TriDecorator();
virtual void addLine( Line3D* line, bool breakline );
virtual int addPoint( Point3D* p );
/**Adds an association to a triangulation*/
virtual void addTriangulation( Triangulation* t );
/**Performs a consistency check, remove this later*/
virtual void performConsistencyTest();
virtual bool calcNormal( double x, double y, Vector3D* result );
virtual bool calcPoint( double x, double y, Point3D* result );
virtual Point3D* getPoint( unsigned int i ) const;
virtual int getNumberOfPoints() const;
// bool getTriangle( double x, double y, Point3D* p1, int* n1, Point3D* p2, int* n2, Point3D* p3, int* n3 );
bool getTriangle( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3 );
virtual int getOppositePoint( int p1, int p2 );
virtual QList<int>* getSurroundingTriangles( int pointno );
virtual double getXMax() const;
virtual double getXMin() const;
virtual double getYMax() const;
virtual double getYMin() const;
virtual void setForcedCrossBehaviour( Triangulation::forcedCrossBehaviour b );
virtual void setEdgeColor( int r, int g, int b );
virtual void setForcedEdgeColor( int r, int g, int b );
virtual void setBreakEdgeColor( int r, int g, int b );
virtual void setTriangleInterpolator( TriangleInterpolator* interpolator );
virtual void eliminateHorizontalTriangles();
virtual void ruppertRefinement();
virtual bool pointInside( double x, double y );
virtual bool swapEdge( double x, double y );
virtual QList<int>* getPointsAroundEdge( double x, double y );
};

12 changes: 12 additions & 0 deletions python/analysis/interpolation/TriangleInterpolator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class TriangleInterpolator
{
%TypeHeaderCode
#include <TriangleInterpolator.h>
%End
public:
virtual ~TriangleInterpolator();
/**Calculates the normal vector and assigns it to vec*/
virtual bool calcNormVec( double x, double y, Vector3D* result ) = 0;
/**Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point*/
virtual bool calcPoint( double x, double y, Point3D* result ) = 0;
};
70 changes: 70 additions & 0 deletions python/analysis/interpolation/Triangulation.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class Triangulation
{
%TypeHeaderCode
#include <Triangulation.h>
%End

public:
/**Enumeration describing the behaviour, if two forced lines cross. SnappingType_VERTICE means, that the second inserted forced line is snapped to the closest vertice of the first inserted forced line. DELETE_FIRST means, that the status of the first inserted forced line is reset to that of a normal edge (so that the second inserted forced line remain and the first not*/
enum forcedCrossBehaviour {SnappingType_VERTICE, DELETE_FIRST, INSERT_VERTICE};
virtual ~Triangulation();
/**Adds a line (e.g. a break-, structure- or an isoline) to the triangulation. The class takes ownership of the line object and its points*/
virtual void addLine( Line3D* line, bool breakline ) = 0;
/**Adds a point to the triangulation*/
virtual int addPoint( Point3D* p ) = 0;
/**Calculates the normal at a point on the surface and assigns it to 'result'. Returns true in case of success and flase in case of failure*/
virtual bool calcNormal( double x, double y, Vector3D* result ) = 0;
/**Performs a consistency check, remove this later*/
virtual void performConsistencyTest() = 0;
/**Calculates x-, y and z-value of the point on the surface and assigns it to 'result'. Returns true in case of success and flase in case of failure*/
virtual bool calcPoint( double x, double y, Point3D* result ) = 0;
/**Returns a pointer to the point with number i. Any virtual points must have the number -1*/
virtual Point3D* getPoint( unsigned int i ) const = 0;
/**Finds out, in which triangle the point with coordinates x and y is and assigns the numbers of the vertices to 'n1', 'n2' and 'n3' and the vertices to 'p1', 'p2' and 'p3'*/
// virtual bool getTriangle( double x, double y, Point3D* p1, int* n1, Point3D* p2, int* n2, Point3D* p3, int* n3 ) = 0;
/**Finds out, in which triangle the point with coordinates x and y is and assigns the points at the vertices to 'p1', 'p2' and 'p3*/
virtual bool getTriangle( double x, double y, Point3D* p1 /Out/, Point3D* p2 /Out/, Point3D* p3 /Out/ ) = 0;
/**Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge)*/
virtual int getOppositePoint( int p1, int p2 ) = 0;
/**Returns the largest x-coordinate value of the bounding box*/
virtual double getXMax() const = 0;
/**Returns the smallest x-coordinate value of the bounding box*/
virtual double getXMin() const = 0;
/**Returns the largest y-coordinate value of the bounding box*/
virtual double getYMax() const = 0;
/**Returns the smallest x-coordinate value of the bounding box*/
virtual double getYMin() const = 0;
/**Returns the number of points*/
virtual int getNumberOfPoints() const = 0;
/**Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point. Four integer values describe a triangle, the first three are the number of the half edges of the triangle and the fourth is -10, if the third (and most counterclockwise) edge is a breakline, and -20 otherwise. The value list has to be deleted by the code which called the method. Any virtual point needs to have the number -1*/
virtual QList<int>* getSurroundingTriangles( int pointno ) = 0;
/**Returns a value list with the numbers of the four points, which would be affected by an edge swap. This function is e.g. needed by NormVecDecorator to know the points, for which the normals have to be recalculated. The list has to be deleted by the code which calls this method*/
virtual QList<int>* getPointsAroundEdge( double x, double y ) = 0;
/**draws the points, edges and the forced lines*/
//virtual void draw(QPainter* p, double xlowleft, double ylowleft, double xupright, double yupright, double width, double height) const=0;
/**Sets the behaviour of the triangulation in case of crossing forced lines*/
virtual void setForcedCrossBehaviour( Triangulation::forcedCrossBehaviour b ) = 0;
/**Sets the color of the normal edges*/
virtual void setEdgeColor( int r, int g, int b ) = 0;
/**Sets the color of the forced edges*/
virtual void setForcedEdgeColor( int r, int g, int b ) = 0;
/**Sets the color of the breaklines*/
virtual void setBreakEdgeColor( int r, int g, int b ) = 0;
/**Sets an interpolator object*/
virtual void setTriangleInterpolator( TriangleInterpolator* interpolator ) = 0;
/**Eliminates the horizontal triangles by swapping*/
virtual void eliminateHorizontalTriangles() = 0;
/**Adds points to make the triangles better shaped (algorithm of ruppert)*/
virtual void ruppertRefinement() = 0;
/**Returns true, if the point with coordinates x and y is inside the convex hull and false otherwise*/
virtual bool pointInside( double x, double y ) = 0;
/**Reads the content of a taff-file*/
//virtual bool readFromTAFF(QString fileName)=0;
/**Saves the content to a taff file*/
//virtual bool saveToTAFF(QString fileName) const=0;
/**Swaps the edge which is closest to the point with x and y coordinates (if this is possible)*/
virtual bool swapEdge( double x, double y ) = 0;
/**Saves the triangulation as a (line) shapefile
@return true in case of success*/
virtual bool saveAsShapefile( const QString& fileName ) const = 0;
};
35 changes: 35 additions & 0 deletions python/analysis/interpolation/Vector3D.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class Vector3D
{
%TypeHeaderCode
#include <Vector3D.h>
%End

public:
/**Constructor taking the three components as arguments*/
Vector3D( double x, double y, double z );
/**Default constructor*/
Vector3D();
/**Copy constructor*/
Vector3D( const Vector3D& v );
/**Destructor*/
~Vector3D();
//Vector3D& operator=( const Vector3D& v );
bool operator==( const Vector3D& v );
bool operator!=( const Vector3D& v );
/**Returns the x-component of the vector*/
double getX() const;
/**Returns the y-component of the vector*/
double getY() const;
/**Returns the z-component of the vector*/
double getZ() const;
/**Returns the length of the vector*/
double getLength() const;
/**Sets the x-component of the vector*/
void setX( double x );
/**Sets the y-component of the vector*/
void setY( double y );
/**Sets the z-component of the vector*/
void setZ( double z );
/**Standardises the vector*/
void standardise();
};
16 changes: 16 additions & 0 deletions python/analysis/interpolation/qgsgridfilewriter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class QgsGridFileWriter
{
%TypeHeaderCode
#include <qgsgridfilewriter.h>
%End

public:
QgsGridFileWriter( QgsInterpolator* i, QString outputPath, QgsRectangle extent, int nCols, int nRows, double cellSizeX, double cellSizeY );
~QgsGridFileWriter();

/**Writes the grid file.
@param showProgressDialog shows a dialog with the possibility to cancel
@return 0 in case of success*/

int writeFile( bool showProgressDialog = false );
};
18 changes: 18 additions & 0 deletions python/analysis/interpolation/qgsidwinterpolator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class QgsIDWInterpolator: QgsInterpolator
{
%TypeHeaderCode
#include <qgsidwinterpolator.h>
%End
public:
QgsIDWInterpolator( const QList<QgsInterpolator::LayerData>& layerData );
~QgsIDWInterpolator();

/**Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
@param y y-coordinate (in map units)
@param result out: interpolation result
@return 0 in case of success*/
int interpolatePoint( double x, double y, double& result );

void setDistanceCoefficient( double p );
};
44 changes: 44 additions & 0 deletions python/analysis/interpolation/qgsinterpolator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**Interface class for interpolations. Interpolators take
the vertices of a vector layer as base data. The z-Value
can be an attribute or the z-coordinates in case of 25D types*/
class QgsInterpolator
{
%TypeHeaderCode
#include "qgsinterpolator.h"
%End

public:
/**Describes the type of input data*/
enum InputType
{
POINTS,
STRUCTURE_LINES,
BREAK_LINES
};

/**A layer together with the information about interpolation attribute / z-coordinate interpolation and the type (point, structure line, breakline)*/
struct LayerData
{
QgsVectorLayer* vectorLayer;
bool zCoordInterpolation;
int interpolationAttribute;
int mInputType;
};

QgsInterpolator( const QList<QgsInterpolator::LayerData>& layerData );

virtual ~QgsInterpolator();

/**Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
@param y y-coordinate (in map units)
@param result out: interpolation result
@return 0 in case of success*/
virtual int interpolatePoint( double x, double y, double& result ) = 0;

protected:
/**Caches the vertex and value data from the provider. All the vertex data
will be held in virtual memory
@return 0 in case of success*/
int cacheBaseData();
};
25 changes: 25 additions & 0 deletions python/analysis/interpolation/qgstininterpolator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class QgsTINInterpolator: QgsInterpolator
{
%TypeHeaderCode
#include <qgstininterpolator.h>
%End
public:
//describes the type of interpolation
enum TIN_INTERPOLATION
{
Linear,
CloughTocher
};
QgsTINInterpolator( const QList<QgsInterpolator::LayerData>& inputData, TIN_INTERPOLATION interpolation = Linear, bool showProgressDialog = false );
~QgsTINInterpolator();

/**Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
@param y y-coordinate (in map units)
@param result out: interpolation result
@return 0 in case of success*/
int interpolatePoint( double x, double y, double& result );

void setExportTriangulationToFile( bool e );
void setTriangulationFilePath( const QString& filepath );
};
8 changes: 4 additions & 4 deletions python/analysis/network/qgsarcproperter.sip
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
/**
* \ingroup networkanalysis
* \class QgsEdgeProperter
* \brief QgsEdgeProperter is a strategy pattern.
* You can use it for customize arc property. For example look at QgsDistanceArcProperter or src/plugins/roadgraph/speedproperter.h
* \brief QgsEdgeProperter is a strategy pattern.
* You can use it for customize arc property. For example look at QgsDistanceArcProperter or src/plugins/roadgraph/speedproperter.h
*/
class QgsArcProperter
{
Expand All @@ -35,9 +35,9 @@ class QgsArcProperter
* \return required attributes list
*/
virtual QgsAttributeList requiredAttributes() const;

/**
* calculate and return adge property
*/
virtual QVariant property( double distance, const QgsFeature& f ) const;
virtual QVariant property( double distance, const QgsFeature &f ) const;
};
1 change: 0 additions & 1 deletion python/analysis/network/qgsdistancearcproperter.sip
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ class QgsDistanceArcProperter : QgsArcProperter

public:
virtual QVariant property( double distance, const QgsFeature& ) const;

};

33 changes: 18 additions & 15 deletions python/analysis/network/qgsgraph.sip
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/**
* \ingroup networkanalysis
* \class QgsGraphEdge
* \class QgsGraphArc
* \brief This class implement a graph edge
*/
class QgsGraphArc
{
%TypeHeaderCode
#include <qgsgraph.h>
%End

public:
QgsGraphArc();

/**
* return property value
* @param propertyIndex property index
*/
QVariant property(int propertyIndex ) const;
QVariant property( int propertyIndex ) const;

/**
* get array of proertyes
*/
Expand Down Expand Up @@ -46,6 +47,7 @@ class QgsGraphVertex
%TypeHeaderCode
#include <qgsgraph.h>
%End

public:
/**
* default constructor. It need for QT's container, e.g. QVector
Expand All @@ -57,21 +59,21 @@ class QgsGraphVertex
*/

QgsGraphVertex( const QgsPoint& point );

/**
* return outgoing edges
*/
QgsGraphArcIdList outArc() const;

/**
* return incoming edges
*/
QgsGraphArcIdList inArc() const;

/**
* return vertex point
*/
QgsPoint point() const;
QgsPoint point() const;
};

/**
Expand All @@ -85,6 +87,7 @@ class QgsGraph
%TypeHeaderCode
#include <qgsgraph.h>
%End

public:
QgsGraph();

Expand All @@ -95,28 +98,28 @@ class QgsGraph
* add vertex to a grap
*/
int addVertex( const QgsPoint& pt );

/**
* add edge to a graph
*/
int addArc( int outVertexIdx, int inVertexIdx, const QVector< QVariant >& properties );

/**
* retrun vertex count
*/
int vertexCount() const;

/**
* return vertex at index
*/
const QgsGraphVertex& vertex( int idx ) const;

/**
* retrun edge count
*/
/**
* return edge count
*/
int arcCount() const;
/**

/**
* retrun edge at index
*/
const QgsGraphArc& arc( int idx ) const;
Expand Down
3 changes: 1 addition & 2 deletions python/analysis/network/qgsgraphbuilder.sip
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class QgsGraphBuilder : QgsGraphBuilderInterface
* default constructor
*/
QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool otfEnabled = true, double topologyTolerance = 0.0, const QString& ellipsoidID = "WGS84" );

~QgsGraphBuilder();

/*
Expand All @@ -30,4 +30,3 @@ class QgsGraphBuilder : QgsGraphBuilderInterface
*/
QgsGraph* graph() /Factory/;
};

9 changes: 4 additions & 5 deletions python/analysis/network/qgsgraphbuilderintr.sip
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QgsGraphBuilderInterface
* @param ctfEnabled enable coordinate transform from source graph CRS to CRS graph
* @param topologyTolerance sqrt distance between source point as one graph vertex
* @param ellipsoidID ellipsoid for edge measurement
*/
*/
QgsGraphBuilderInterface( const QgsCoordinateReferenceSystem& crs, bool ctfEnabled = true, double topologyTolerance = 0.0, const QString& ellipsoidID = "WGS84" );

QgsCoordinateReferenceSystem& destinationCrs();
Expand All @@ -43,11 +43,11 @@ class QgsGraphBuilderInterface

/**
* add vertex
* @param id vertex identyficator
* @param id vertex identifier
* @param pt vertex coordinate
* @note id and pt is a redundant interface. You can use coordinates or id for vertex identyfy
* @note id and pt are redundant. You can use pt or id to identify the vertex
*/
virtual void addVertex( int id, const QgsPoint& pt );
virtual void addVertex( int id, const QgsPoint &pt );

/**
* add arc
Expand All @@ -61,4 +61,3 @@ class QgsGraphBuilderInterface
virtual void addArc( int pt1id, const QgsPoint& pt1, int pt2id, const QgsPoint& pt2, const QVector< QVariant >& properties );

};

6 changes: 3 additions & 3 deletions python/analysis/network/qgsgraphdirector.sip
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class QgsGraphDirector : QObject
*
* @note if tiedPoints[i]==QgsPoint(0.0,0.0) then tied failed.
*/
virtual void makeGraph( QgsGraphBuilderInterface* builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints /Out/ );
virtual void makeGraph( QgsGraphBuilderInterface *builder,
const QVector< QgsPoint > &additionalPoints,
QVector< QgsPoint> &tiedPoints /Out/ );

void addProperter( QgsArcProperter* prop /Transfer/ ) ;

Expand Down
16 changes: 8 additions & 8 deletions python/analysis/network/qgslinevectorlayerdirector.sip
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class QgsLineVectorLayerDirector : QgsGraphDirector
* @param bothDirectionValue value for road
* @param defaultDirection 1 - direct direction, 2 - reverse direction, 3 - both direction
*/
QgsLineVectorLayerDirector( QgsVectorLayer* myLayer,
int directionFieldId,
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
int defaultDirection
);
QgsLineVectorLayerDirector( QgsVectorLayer* vl,
int directionFieldId,
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
int defaultDirection
);

//! Destructor
virtual ~QgsLineVectorLayerDirector();

/*
* MANDATORY DIRECTOR PROPERTY DECLARATION
*/
Expand Down
5 changes: 0 additions & 5 deletions python/analysis/qgsoverlayanalyzer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,4 @@ class QgsOverlayAnalyzer
bool intersection( QgsVectorLayer* layerA, QgsVectorLayer* layerB,
const QString& shapefileName, bool onlySelectedFeatures = false,
QProgressDialog* p = 0 );

private:
void combineFieldLists( QgsFieldMap fieldListA, QgsFieldMap fieldListB );
void intersectFeature( QgsFeature& f, QgsVectorFileWriter* vfw, QgsVectorLayer* dp,
QgsSpatialIndex* index );
};
17 changes: 17 additions & 0 deletions python/analysis/raster/qgsaspectfilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class QgsAspectFilter: QgsDerivativeFilter
{
%TypeHeaderCode
#include <qgsaspectfilter.h>
%End

public:
QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsAspectFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );

};
21 changes: 21 additions & 0 deletions python/analysis/raster/qgsderivativefilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*/
class QgsDerivativeFilter : QgsNineCellFilter
{
%TypeHeaderCode
#include <qgsderivativefilter.h>
%End

public:
QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
virtual ~QgsDerivativeFilter();
//to be implemented by subclasses
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 ) = 0;

protected:
/**Calculates the first order derivative in x-direction according to Horn (1981)*/
float calcFirstDerX( float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
/**Calculates the first order derivative in y-direction according to Horn (1981)*/
float calcFirstDerY( float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
};
22 changes: 22 additions & 0 deletions python/analysis/raster/qgshillshadefilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class QgsHillshadeFilter: QgsDerivativeFilter
{
%TypeHeaderCode
#include <qgshillshadefilter.h>
%End

public:
QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth = 300,
double lightAngle = 40 );
~QgsHillshadeFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );

float lightAzimuth() const;
void setLightAzimuth( float azimuth );
float lightAngle() const;
void setLightAngle( float angle );
};
33 changes: 33 additions & 0 deletions python/analysis/raster/qgsninecellfilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class QgsNineCellFilter
{
%TypeHeaderCode
#include <qgsninecellfilter.h>
%End
public:
/**Constructor that takes input file, output file and output format (GDAL string)*/
QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
virtual ~QgsNineCellFilter();
/**Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@return 0 in case of success*/
int processRaster( QProgressDialog* p );

double cellSizeX() const;
void setCellSizeX( double size );
double cellSizeY() const;
void setCellSizeY( double size );

double zFactor() const;
void setZFactor( double factor );

double inputNodataValue() const;
void setInputNodataValue( double value );
double outputNodataValue() const;
void setOutputNodataValue( double value );

/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 ) = 0;
};
57 changes: 57 additions & 0 deletions python/analysis/raster/qgsrastercalcnode.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class QgsRasterCalcNode
{
%TypeHeaderCode
#include <qgsrastercalcnode.h>
%End
public:
//! defines possible types of node
enum Type
{
tOperator = 1,
tNumber,
tRasterRef
};

//! possible operators
enum Operator
{
opPLUS,
opMINUS,
opMUL,
opDIV,
opPOW,
opSQRT,
opSIN,
opCOS,
opTAN,
opASIN,
opACOS,
opATAN,
opEQ, // =
opNE, //!=
opGT, // >
opLT, // <
opGE, // >=
opLE, // <=
opAND,
opOR,
opSIGN //change sign
};

QgsRasterCalcNode();
QgsRasterCalcNode( double number );
QgsRasterCalcNode( Operator op, QgsRasterCalcNode* left, QgsRasterCalcNode* right );
QgsRasterCalcNode( const QString& rasterName );
~QgsRasterCalcNode();

Type type() const;

//set left node
void setLeft( QgsRasterCalcNode* left );
void setRight( QgsRasterCalcNode* right );

/**Calculates result (might be real matrix or single number)*/
bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const;

static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg ) /Factory/;
};
28 changes: 28 additions & 0 deletions python/analysis/raster/qgsrastercalculator.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
struct QgsRasterCalculatorEntry
{
%TypeHeaderCode
#include <qgsrastercalculator.h>
%End

QString ref; //name
QgsRasterLayer* raster; //pointer to rasterlayer
int bandNumber; //raster band number
};

/**Raster calculator class*/
class QgsRasterCalculator
{
%TypeHeaderCode
#include <qgsrastercalculator.h>
%End

public:
QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat,
const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector<QgsRasterCalculatorEntry>& rasterEntries );
~QgsRasterCalculator();

/**Starts the calculation and writes new raster
@param p progress bar (or 0 if called from non-gui code)
@return 0 in case of success*/
int processCalculation( QProgressDialog* p = 0 );
};
86 changes: 86 additions & 0 deletions python/analysis/raster/qgsrastermatrix.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
class QgsRasterMatrix
{
%TypeHeaderCode
#include <qgsrastermatrix.h>
%End

public:

enum TwoArgOperator
{
opPLUS,
opMINUS,
opMUL,
opDIV,
opPOW,
opEQ, // =
opNE, // != resp. <>
opGT, // >
opLT, // <
opGE, // >=
opLE, // <=
opAND,
opOR
};

enum OneArgOperator
{
opSQRT,
opSIN,
opCOS,
opTAN,
opASIN,
opACOS,
opATAN,
opSIGN
};

/**Takes ownership of data array*/
QgsRasterMatrix();
// QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue );
QgsRasterMatrix( const QgsRasterMatrix& m );
~QgsRasterMatrix();

/**Returns true if matrix is 1x1 (=scalar number)*/
bool isNumber() const;
double number() const;

/**Returns data array (but not ownership)*/
// float* data();
/**Returns data and ownership. Sets data and nrows, ncols of this matrix to 0*/
// float* takeData();

void setData( int cols, int rows, float* data, double nodataValue );

int nColumns() const;
int nRows() const;

double nodataValue() const;
void setNodataValue( double d );

// QgsRasterMatrix& operator=( const QgsRasterMatrix& m );
/**Adds another matrix to this one*/
bool add( const QgsRasterMatrix& other );
/**Subtracts another matrix from this one*/
bool subtract( const QgsRasterMatrix& other );
bool multiply( const QgsRasterMatrix& other );
bool divide( const QgsRasterMatrix& other );
bool power( const QgsRasterMatrix& other );
bool equal( const QgsRasterMatrix& other );
bool notEqual( const QgsRasterMatrix& other );
bool greaterThan( const QgsRasterMatrix& other );
bool lesserThan( const QgsRasterMatrix& other );
bool greaterEqual( const QgsRasterMatrix& other );
bool lesserEqual( const QgsRasterMatrix& other );
bool logicalAnd( const QgsRasterMatrix& other );
bool logicalOr( const QgsRasterMatrix& other );

bool squareRoot();
bool sinus();
bool asinus();
bool cosinus();
bool acosinus();
bool tangens();
bool atangens();
bool changeSign();
};
38 changes: 38 additions & 0 deletions python/analysis/raster/qgsrelief.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class QgsRelief
{
%TypeHeaderCode
#include <qgsrelief.h>
%End

public:
struct ReliefColor
{
ReliefColor( const QColor& c, double min, double max );
QColor color;
double minElevation;
double maxElevation;
};

QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsRelief();

/**Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@return 0 in case of success*/
int processRaster( QProgressDialog* p );

double zFactor() const;
void setZFactor( double factor );

void clearReliefColors();
void addReliefColorClass( const QgsRelief::ReliefColor& color );
const QList< QgsRelief::ReliefColor >& reliefColors() const;
void setReliefColors( const QList< QgsRelief::ReliefColor >& c );

/**Calculates class breaks according with the method of Buenzli (2011) using an iterative algorithm for segmented regression
@return true in case of success*/
QList< QgsRelief::ReliefColor > calculateOptimizedReliefClasses();

/**Write frequency of elevation values to file for manual inspection*/
bool exportFrequencyDistributionToCsv( const QString& file );
};
17 changes: 17 additions & 0 deletions python/analysis/raster/qgsruggednessfilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class QgsRuggednessFilter: QgsNineCellFilter
{
%TypeHeaderCode
#include <qgsruggednessfilter.h>
%End

public:
QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsRuggednessFilter();

protected:
/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );
};
16 changes: 16 additions & 0 deletions python/analysis/raster/qgsslopefilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class QgsSlopeFilter: QgsDerivativeFilter
{
%TypeHeaderCode
#include <qgsslopefilter.h>
%End

public:
QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsSlopeFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );
};
17 changes: 17 additions & 0 deletions python/analysis/raster/qgstotalcurvaturefilter.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class QgsTotalCurvatureFilter: QgsNineCellFilter
{
%TypeHeaderCode
#include <qgstotalcurvaturefilter.h>
%End

public:
QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsTotalCurvatureFilter();

protected:
/**Calculates total curvature from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );
};
File renamed without changes.
19 changes: 19 additions & 0 deletions python/core/composer/qgsaddremovemultiframecommand.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class QgsAddRemoveMultiFrameCommand : QUndoCommand
{
%TypeHeaderCode
#include <qgsaddremovemultiframecommand.h>
%End

public:

enum State
{
Added = 0,
Removed
};

QgsAddRemoveMultiFrameCommand( State s, QgsComposerMultiFrame* multiFrame, QgsComposition* c, const QString& text, QUndoCommand* parent = 0 );
~QgsAddRemoveMultiFrameCommand();
void redo();
void undo();
};
57 changes: 57 additions & 0 deletions python/core/composer/qgscomposerarrow.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class QgsComposerArrow: QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposerarrow.h>
%End
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;

/** \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;

void setOutlineWidth( double width );
double outlineWidth() const;

void setStartMarker( const QString& svgPath );
QString startMarker() const;
void setEndMarker( const QString& svgPath );
QString endMarker() const;

QColor arrowColor() const;
void setArrowColor( const QColor& c );

MarkerMode markerMode() const;
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 );
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@
* Attribute table item for map composer.
*/

class QgsComposerAttributeTable: QgsComposerTable
class QgsComposerAttributeTableCompare
{
%TypeHeaderCode
#include <qgscomposerattributetable.h>
%End

public:
QgsComposerAttributeTableCompare();
// bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 );
void setSortColumn( int col );
void setAscending( bool asc );
};

class QgsComposerAttributeTable : QgsComposerTable
{
%TypeHeaderCode
#include <qgscomposerattributetable.h>
Expand All @@ -12,6 +25,9 @@ class QgsComposerAttributeTable: QgsComposerTable
QgsComposerAttributeTable( QgsComposition* composition /TransferThis/ );
~QgsComposerAttributeTable();

/** return correct graphics item type. Added in v1.7 */
virtual int type() const;

/** \brief Reimplementation of QCanvasItem::paint*/
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

Expand Down Expand Up @@ -41,4 +57,9 @@ class QgsComposerAttributeTable: QgsComposerTable

//void setSortAttributes( const QList<QPair<int, bool> > att );
//QList<QPair<int, bool> > sortAttributes() const;


signals:
/**This signal is emitted if the maximum number of feature changes (interactively)*/
void maximumNumberOfFeaturesChanged( int n );
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class QgsComposerFrame: QgsComposerItem
#include "qgscomposerframe.h"
%End

public:
public:
QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height );
~QgsComposerFrame();

Expand All @@ -23,4 +23,4 @@ class QgsComposerFrame: QgsComposerItem
int type() const;

QgsComposerMultiFrame* multiFrame();
};
};
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class QgsComposerItem: QObject, QGraphicsRectItem
sipClass = sipClass_QgsComposerItem;
*sipCppRet = static_cast<QgsComposerItem*>(sipCpp);
break;
/*
#if 0
case QgsComposerItem::ComposerArrow:
sipClass = sipClass_QgsComposerArrow;
*sipCppRet = static_cast<QgsComposerArrow*>(sipCpp);
Expand All @@ -37,7 +37,7 @@ class QgsComposerItem: QObject, QGraphicsRectItem
sipClass = sipClass_QgsComposerItemGroup;
*sipCppRet = static_cast<QgsComposerItemGroup*>(sipCpp);
break;
*/
#endif
case QgsComposerItem::ComposerLabel:
sipClass = sipClass_QgsComposerLabel;
*sipCppRet = static_cast<QgsComposerLabel*>(sipCpp);
Expand Down Expand Up @@ -104,7 +104,8 @@ class QgsComposerItem: QObject, QGraphicsRectItem
ComposerShape,
ComposerTable,
ComposerAttributeTable,
ComposerTextTable
ComposerTextTable,
ComposerFrame
};

/**Describes the action (move or resize in different directon) to be done during mouse move*/
Expand All @@ -118,7 +119,8 @@ class QgsComposerItem: QObject, QGraphicsRectItem
ResizeLeftUp,
ResizeRightUp,
ResizeLeftDown,
ResizeRightDown
ResizeRightDown,
NoAction
};

enum ItemPositionMode
Expand All @@ -135,9 +137,15 @@ class QgsComposerItem: QObject, QGraphicsRectItem
};

/**Constructor
@param composition parent composition
@param manageZValue true if the z-Value of this object should be managed by mComposition*/
QgsComposerItem( QgsComposition* composition /TransferThis/, bool manageZValue = true );
/**Constructor with box position and composer object
@param x x coordinate of item
@param y y coordinate of item
@param width width of item
@param height height of item
@param composition parent composition
@param manageZValue true if the z-Value of this object should be managed by mComposition*/
QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition /TransferThis/, bool manageZValue = true );
virtual ~QgsComposerItem();
Expand Down Expand Up @@ -185,9 +193,9 @@ class QgsComposerItem: QObject, QGraphicsRectItem
corresponds to 1 scene size unit*/
virtual void setSceneRect( const QRectF& rectangle );

/** stores state in Dom node
* @param node is Dom node corresponding to 'Composer' tag
* @param temp write template file
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc is the Dom document
*/
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0;

Expand All @@ -196,38 +204,35 @@ class QgsComposerItem: QObject, QGraphicsRectItem

/** sets state from Dom document
* @param itemElem is Dom node corresponding to item tag
* @param doc is Dom document
*/
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0;

/**Reads parameter that are not subclass specific in document. Usually called from readXML methods of subclasses*/
bool _readXML( const QDomElement& itemElem, const QDomDocument& doc );



/** Whether this item has a frame or not.
* @param none
* @return boolean - true if there is a frame around this item, otherwise false.
* @note deprecated since 1.8 don't use!
* @see hasFrame
*/
bool frame();
bool frame() /Deprecated/;
/** Whether this item has a frame or not.
* @param none
* @return boolean - true if there is a frame around this item, otherwise false.
* @returns true if there is a frame around this item, otherwise false.
* @note introduced since 1.8
* @see hasFrame
*/
bool hasFrame();
/** Set whether this item has a frame drawn around it or not.
* @param none
* @return void
* @returns void
* @note deprecated since 1.8 don't use!
* @see setFrameEnabled
*/
void setFrame( bool drawFrame );
void setFrame( bool drawFrame ) /Deprecated/;
/** Set whether this item has a frame drawn around it or not.
* @param none
* @return void
* @param drawFrame draw frame
* @returns nothing
* @note introduced in 1.8
* @see hasFrame
*/
Expand All @@ -239,17 +244,29 @@ class QgsComposerItem: QObject, QGraphicsRectItem

const QgsComposition* composition() const;

virtual void beginItemCommand( const QString& text );

/**Starts new composer undo command
@param commandText command title
@param c context for mergeable commands (unknown for non-mergeable commands*/
void beginCommand( const QString& commandText, QgsComposerMergeCommand::Context c = QgsComposerMergeCommand::Unknown );

virtual void endItemCommand();
/**Finish current command and push it onto the undo stack */
void endCommand();
void cancelCommand();

//functions that encapsulate the workaround for the Qt font bug (that is to scale the font size up and then scale the
//painter down by the same factor for drawing

/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work around the Qt font bug)*/
void drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const;
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;

/**Like the above, but with a rectangle for multiline text*/
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const;
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font, Qt::AlignmentFlag halignement = Qt::AlignLeft, Qt::AlignmentFlag valignement = Qt::AlignTop ) const;

/**Returns the font width in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
/**Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double textWidthMillimeters( const QFont& font, const QString& text ) const;

/**Returns the font height of a character in millimeters
Expand Down Expand Up @@ -282,18 +299,19 @@ class QgsComposerItem: QObject, QGraphicsRectItem
/**Updates item, with the possibility to do custom update for subclasses*/
virtual void updateItem();

/**Get label identification name
/**Get item identification name
@note this method was added in version 1.7*/
QString id() const;

/**Set label identification name
/**Set item identification name
@note this method was added in version 1.7
This method was moved from qgscomposerlabel so that every object can have a
id (NathanW)*/
This method was moved from qgscomposerlabel so that every object can have a
id (NathanW)*/
void setId( const QString& id );

public slots:
virtual void setRotation( double r);
virtual void setRotation( double r );
void repaint();

protected:

Expand Down Expand Up @@ -335,7 +353,7 @@ class QgsComposerItem: QObject, QGraphicsRectItem
/**Returns angle of the line from p1 to p2 (clockwise, starting at N)*/
double angle( const QPointF& p1, const QPointF& p2 ) const;

/**Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the \
/**Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the
item border for resizing*/
double rectHandlerBorderTolerance() const;

Expand All @@ -348,20 +366,26 @@ class QgsComposerItem: QObject, QGraphicsRectItem
@note: this function was introduced in version 1.2*/
double horizontalViewScaleFactor() const;

//some utility functions

/**Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation*/
bool imageSizeConsideringRotation( double& width, double& height ) const;
/**Calculates corner point after rotation and scaling*/
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const;

/**Calculates width / height of the bounding box of a rotated rectangle (mRotation)*/
void sizeChangedByRotation(double& width, double& height);
void sizeChangedByRotation( double& width, double& height );
/**Rotates a point / vector
@param angle rotation angle in degrees, counterclockwise
@param x in/out: x coordinate before / after the rotation
@param y in/out: y cooreinate before / after the rotation*/
void rotate( double angle, double& x, double& y ) const;

signals:
/**Is emitted on rotation change to notify north arrow pictures*/
signals:
/**Is emitted on rotation change to notify north arrow pictures*/
void rotationChanged( double newRotation );
/**Used e.g. by the item widgets to update the gui elements*/
void itemChanged();
/**Emitted if the rectangle changes*/
void sizeChanged();
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ class QgsComposerItemCommand: QUndoCommand

/**Returns true if previous state and after state are valid and different*/
bool containsChange() const;

const QgsComposerItem* item() const;

protected:
void saveState( QDomDocument& stateDoc ) const;
void restoreState( QDomDocument& stateDoc ) const;
};

/**\ingroup MapComposer
A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the
/**A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the
newest after state. The purpose is to avoid too many micro changes in the history*/
class QgsComposerMergeCommand: QgsComposerItemCommand
class QgsComposerMergeCommand : QgsComposerItemCommand
{
%TypeHeaderCode
#include "qgscomposeritemcommand.h"
Expand All @@ -40,13 +45,16 @@ class QgsComposerMergeCommand: QgsComposerItemCommand
Unknown = 0,
//composer label
ComposerLabelSetText,
ComposerLabelSetId,
ComposerLabelRotation,
//composer map
ComposerMapRotation,
ComposerMapAnnotationDistance,
//composer legend
ComposerLegendText,
LegendSymbolWidth,
LegendSymbolHeight,
LegendGroupSpace,
LegendLayerSpace,
LegendSymbolSpace,
LegendIconSymbolSpace,
Expand Down Expand Up @@ -74,12 +82,13 @@ class QgsComposerMergeCommand: QgsComposerItemCommand
ArrowOutlineWidth,
ArrowHeadWidth,
//item
ItemOutlineWidth
ItemOutlineWidth,
ItemMove
};

QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
~QgsComposerMergeCommand();

bool mergeWith( const QUndoCommand * command );
int id() const;
};
};
43 changes: 43 additions & 0 deletions python/core/composer/qgscomposeritemgroup.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class QgsComposerItemGroup: QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposeritemgroup.h>
%End
public:
QgsComposerItemGroup( QgsComposition* c );
~QgsComposerItemGroup();

/** return correct graphics item type. Added in v1.7 */
virtual int type() const;

/**Adds an item to the group. All the group members are deleted
if the group is deleted*/
void addItem( QgsComposerItem* item );
/**Removes the items but does not delete them*/
void removeItems();
/**Draw outline and ev. selection handles*/
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
/**Sets this items bound in scene coordinates such that 1 item size units
corresponds to 1 scene size unit*/
void setSceneRect( const QRectF& rectangle );

/** stores state in Dom node
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc is the Dom 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 Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

QSet<QgsComposerItem*> items();

signals:
void childItemDeleted( QgsComposerItem* item );

protected:
void drawFrame( QPainter* p );
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** \ingroup MapComposer
* A label that can be placed onto a map composition.
*/
class QgsComposerLabel: QgsComposerItem
class QgsComposerLabel : QgsComposerItem
{
%TypeHeaderCode
#include "qgscomposerlabel.h"
Expand All @@ -22,56 +22,56 @@ class QgsComposerLabel: QgsComposerItem
QString text();
void setText( const QString& text );

/**Returns the text as it appears on screen (with replaced data field)
/**Returns the text as it appears on screen (with replaced data field)
@note this function was added in version 1.2*/
QString displayText() const;

QFont font() const;
void setFont( const QFont& f );
/** Accessor for the vertical alignment of the label
* @param none
* @returns Qt::AlignmentFlag
*/
Qt::AlignmentFlag vAlign() const;
/** Accessor for the horizontal alignment of the label
* @param none
* @returns Qt::AlignmentFlag
*/
Qt::AlignmentFlag hAlign() const;
/** Mutator for the horizontal alignment of the label
* @param Qt::AlignmentFlag
* @param a alignment
* @returns void
*/
void setHAlign( Qt::AlignmentFlag a );
/** Mutator for the vertical alignment of the label
* @param QQt::AlignmentFlag
* @param a alignment
* @returns void
*/
void setVAlign( Qt::AlignmentFlag a );

//!brief Accessor for the margin of the label
double margin();
//!brief Mutator for the margin of the label
void setMargin( double m );


/**Get font color
@note: this function was added in version 1.4*/
QFont font() const;
void setFont( const QFont& f );

/**Sets text color
@note: this function was added in version 1.4*/
void setFontColor( const QColor& c);

@note: this function was added in version 1.4*/
void setFontColor( const QColor& c );
/**Get font color
@note: this function was added in version 1.4*/
QColor fontColor() const;

/** stores state in Dom node
* @param node is Dom node corresponding to 'Composer' tag
* @param temp write template file
void setSceneRect( const QRectF& rectangle );

/** 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 node is Dom node corresponding to 'ComposerLabel' tag
* @param itemElem is Dom element corresponding to 'ComposerLabel' tag
* @param doc document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

public slots:
virtual void setRotation( double r );
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** \ingroup MapComposer
* A legend that can be placed onto a map composition
*/
class QgsComposerLegend: QgsComposerItem
class QgsComposerLegend : QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposerlegend.h>
Expand Down Expand Up @@ -45,6 +45,9 @@ class QgsComposerLegend: QgsComposerItem
double boxSpace() const;
void setBoxSpace( double s );

double groupSpace() const;
void setGroupSpace( double s );

double layerSpace() const;
void setLayerSpace( double s );

Expand All @@ -60,21 +63,30 @@ class QgsComposerLegend: QgsComposerItem
double symbolHeight() const;
void setSymbolHeight( double h );

void setWrapChar( const QString& t );
QString wrapChar() const;

void setComposerMap( const QgsComposerMap* map );
const QgsComposerMap* composerMap() const;

/**Updates the model and all legend entries*/
void updateLegend();

/** stores state in Dom node
* @param elem is Dom element corresponding to 'Composer' tag
* @param temp write template file
* @param doc Dom 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 Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

public slots:
/**Data changed*/
void synchronizeWithModel();
/**Sets mCompositionMap to 0 if the map is deleted*/
void invalidateCurrentMap();
};
147 changes: 147 additions & 0 deletions python/core/composer/qgscomposerlegenditem.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
class QgsComposerLegendItem : QStandardItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End

public:
QgsComposerLegendItem();
QgsComposerLegendItem( const QString& text );
QgsComposerLegendItem( const QIcon& icon, const QString& text );
virtual ~QgsComposerLegendItem();

enum ItemType
{
GroupItem = QStandardItem::UserType,
LayerItem,
SymbologyItem,
SymbologyV2Item,
RasterSymbolItem
};

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const = 0;
/**Read item content from xml
@param itemElem item to read from
@param xServerAvailable Read item icons if true (QIcon needs x-server)*/
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true ) = 0;

virtual ItemType itemType() const = 0;
virtual QStandardItem* clone() const = 0;

protected:
void writeXMLChildren( QDomElement& elem, QDomDocument& doc ) const;
};

class QgsComposerSymbolItem : QgsComposerLegendItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End
public:

QgsComposerSymbolItem();
QgsComposerSymbolItem( const QString& text );
QgsComposerSymbolItem( const QIcon& icon, const QString& text );
virtual ~QgsComposerSymbolItem();

virtual QStandardItem* clone() const /Factory/;

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const;
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true );

/**Set symbol (takes ownership)*/
void setSymbol( QgsSymbol* s );
QgsSymbol* symbol();

void setLayerID( const QString& id );
QString layerID() const;

ItemType itemType() const;
};

class QgsComposerSymbolV2Item: QgsComposerLegendItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End

public:
QgsComposerSymbolV2Item();
QgsComposerSymbolV2Item( const QString& text );
QgsComposerSymbolV2Item( const QIcon& icon, const QString& text );
virtual ~QgsComposerSymbolV2Item();

virtual QStandardItem* clone() const /Factory/;

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const;
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true );

/**Set symbol (takes ownership)*/
void setSymbolV2( QgsSymbolV2* s );
QgsSymbolV2* symbolV2();

ItemType itemType() const;
};

class QgsComposerRasterSymbolItem : QgsComposerLegendItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End
public:
QgsComposerRasterSymbolItem();
QgsComposerRasterSymbolItem( const QString& text );
QgsComposerRasterSymbolItem( const QIcon& icon, const QString& text );
virtual ~QgsComposerRasterSymbolItem();

virtual QStandardItem* clone() const /Factory/;

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const;
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true );

void setLayerID( const QString& id );
QString layerID() const;
ItemType itemType() const;

void setColor( const QColor& c );
QColor color() const;
};

class QgsComposerLayerItem : QgsComposerLegendItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End

public:
QgsComposerLayerItem();
QgsComposerLayerItem( const QString& text );
virtual ~QgsComposerLayerItem();
virtual QStandardItem* clone() const /Factory/;

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const;
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true );

ItemType itemType() const;

void setLayerID( const QString& id );
QString layerID() const;
};

class QgsComposerGroupItem : QgsComposerLegendItem
{
%TypeHeaderCode
#include <qgscomposerlegenditem.h>
%End

public:
QgsComposerGroupItem();
QgsComposerGroupItem( const QString& text );
virtual ~QgsComposerGroupItem();
virtual QStandardItem* clone() const /Factory/;

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const;
virtual void readXML( const QDomElement& itemElem, bool xServerAvailable = true );

ItemType itemType() const;
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ class QgsComposerMap : QgsComposerItem
BoundaryDirection
};

/**Enum for different frame borders*/
enum Border
enum GridAnnotationFormat
{
Left,
Right,
Bottom,
Top
Decimal = 0,
DegreeMinute,
DegreeMinuteSecond
};

enum GridFrameStyle
Expand All @@ -63,14 +61,26 @@ class QgsComposerMap : QgsComposerItem
Zebra //black / white pattern
};

/**@deprecated*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& size, int dpi );
/**Enum for different frame borders*/
enum Border
{
Left,
Right,
Bottom,
Top
};

/**This function is deprecated*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& size, int dpi ) /Deprecated/;

/** \brief Draw to paint device
@param extent map extent
@param size size in scene coordinates
@param dpi scene dpi*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi );
@param painter painter
@param extent map extent
@param size size in scene coordinates
@param dpi scene dpi
@param forceWidthScale force wysiwyg line widths / marker sizes
*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi, double* forceWidthScale = 0 );

/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
Expand Down Expand Up @@ -144,12 +154,13 @@ class QgsComposerMap : QgsComposerItem

/** stores state in Dom node
* @param elem is Dom element corresponding to 'Composer' tag
* @param temp write template file
* @param doc Dom document
*/
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;

/** sets state from Dom document
* @param itemElem is Dom node corresponding to 'ComposerMap' tag
* @param doc is Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

Expand Down Expand Up @@ -188,7 +199,7 @@ class QgsComposerMap : QgsComposerItem
void setGridPen( const QPen& p );
QPen gridPen() const;

/**Sets with of grid pen
/**Sets with of grid pen
@note this function was added in version 1.4*/
void setGridPenWidth( double w );

Expand All @@ -201,7 +212,7 @@ class QgsComposerMap : QgsComposerItem
void setGridAnnotationFont( const QFont& f );
QFont gridAnnotationFont() const;

/**Sets coordinate precision for grid annotations
/**Sets coordinate precision for grid annotations
@note this function was added in version 1.4*/
void setGridAnnotationPrecision( int p );
int gridAnnotationPrecision() const;
Expand All @@ -211,23 +222,20 @@ class QgsComposerMap : QgsComposerItem
void setShowGridAnnotation( bool show );
bool showGridAnnotation() const;

/**Sets position of grid annotations. Possibilities are inside / outside of the map frame or disabled
@note this function was added in version 1.9*/
void setGridAnnotationPosition( GridAnnotationPosition p, QgsComposerMap::Border border );
/**@note: this function was added in version 1.9*/
GridAnnotationPosition gridAnnotationPosition( QgsComposerMap::Border border ) const;

/**Sets distance between map frame and annotations
@note this function was added in version 1.4*/
void setAnnotationFrameDistance( double d );
double annotationFrameDistance() const;

/**Sets grid annotation direction. Can be horizontal or vertical
@note this function was added in version 1.9*/
void setGridAnnotationDirection( GridAnnotationDirection d, QgsComposerMap::Border border );
/**@note: this function was added in version 1.9*/
GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border border ) const;

void setGridAnnotationFormat( GridAnnotationFormat f );
GridAnnotationFormat gridAnnotationFormat() const;

/**Set grid frame style (NoGridFrame or Zebra)
@note: this function was added in version 1.9*/
void setGridFrameStyle( GridFrameStyle style );
Expand All @@ -247,28 +255,43 @@ class QgsComposerMap : QgsComposerItem

/**Sets length of the cros segments (if grid style is cross)
@note this function was added in version 1.4*/
void setCrossLength(double l);
void setCrossLength( double l );
double crossLength();

void setMapRotation( double r );

void updateItem();

/**Sets canvas pointer (necessary to query and draw map canvas items)*/
void setMapCanvas( QGraphicsView* canvas /Transfer/ );

void setDrawCanvasItems( bool b );
bool drawCanvasItems() const;

/**Returns the conversion factor map units -> mm*/
double mapUnitsToMM() const;

/**Sets overview frame map. -1 disables the overview frame
@note: this function was added in version 1.9*/
void setOverviewFrameMap( int mapId );
/**Returns id of overview frame (or -1 if no overfiew frame)
@note: this function was added in version 1.9*/
int overviewFrameMapId() const;

void setOverviewFrameMapSymbol( QgsFillSymbolV2* symbol /Transfer/ );
QgsFillSymbolV2* overviewFrameMapSymbol();

/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
Usually, this function is called before adding the composer map to the composition*/
void assignFreeId();

signals:
void extentChanged();

public slots:

/**Called if map canvas has changed*/
void updateCachedImage( );
/**Call updateCachedImage if item is in render mode*/
void renderModeUpdateCachedImage();

signals:
/**Is emitted when width/height is changed as a result of user interaction*/
void extentChanged();
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class QgsComposerMultiFrame: QObject
%TypeHeaderCode
#include "qgscomposermultiframe.h"
%End
public:

public:

enum ResizeMode
{
Expand Down Expand Up @@ -44,4 +45,14 @@ public:

int nFrames() const;
QgsComposerFrame* frame( int i );

protected slots:
void recalculateFrameSizes();
/**Called before a frame is going to be removed (update frame list)*/
void handleFrameRemoval( QgsComposerItem* item );
/**Adapts to changed number of pages if resize type is RepeatOnEveryPage*/
void handlePageChange();

signals:
void changed();
};
18 changes: 18 additions & 0 deletions python/core/composer/qgscomposermultiframecommand.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class QgsComposerMultiFrameCommand : QUndoCommand
{
%TypeHeaderCode
#include <qgscomposermultiframecommand.h>
%End
public:
QgsComposerMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, QUndoCommand* parent = 0 );
~QgsComposerMultiFrameCommand();

void undo();
void redo();

void savePreviousState();
void saveAfterState();

/**Returns true if previous state and after state are valid and different*/
bool containsChange() const;
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ class QgsComposerPicture: QgsComposerItem
QString pictureFile() const;

/**Sets this items bound in scene coordinates such that 1 item size units
corresponds to 1 scene size unit*/
corresponds to 1 scene size unit and resizes the svg symbol / image*/
void setSceneRect( const QRectF& rectangle );

/** stores state in Dom node
* @param node is Dom node corresponding to 'Composer' tag
* @param temp write template file
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc is Dom 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 Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

Expand All @@ -44,11 +45,7 @@ class QgsComposerPicture: QgsComposerItem
/**True if the rotation is taken from a map item*/
bool useRotationMap() const;

public slots:
public slots:
/**Sets the rotation and adapts the item rect*/
virtual void setRotation( double r );


signals:
/**Tell the configuration widget that the settings need to be updated*/
void settingsChanged();
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class QgsComposerScaleBar: QgsComposerItem
%TypeHeaderCode
#include "qgscomposerscalebar.h"
%End

public:

/**Added in version 1.8*/
Expand All @@ -25,7 +26,7 @@ class QgsComposerScaleBar: QgsComposerItem
Feet
};

QgsComposerScaleBar( QgsComposition* composition /TransferThis/);
QgsComposerScaleBar( QgsComposition* composition /TransferThis/ );
~QgsComposerScaleBar();

/** return correct graphics item type. Added in v1.7 */
Expand Down Expand Up @@ -113,17 +114,20 @@ class QgsComposerScaleBar: QgsComposerItem
/**Returns string of first label (important for drawing, labeling, size calculation*/
QString firstLabelString() const;

/** stores state in Dom node
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param temp write template file
* @param doc Dom 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 Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

/**Moves scalebar position to the left / right depending on alignment and change in item width*/
void correctXPositionAlignment( double width, double widthAfter );

public slots:
void updateSegmentSize();
Expand All @@ -133,4 +137,7 @@ class QgsComposerScaleBar: QgsComposerItem
protected:
/**Calculates with of a segment in mm and stores it in mSegmentMillimeters*/
void refreshSegmentMillimeters();

/**Returns diagonal of composer map in selected units (map units / meters / feet)*/
double mapWidth() const;
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ class QgsComposerShape: QgsComposerItem
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

/** stores state in Dom node
* @param node is Dom node corresponding to 'Composer' tag
* @param temp write template file
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc write template file
*/
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;

/** sets state from Dom document
* @param itemElem is Dom node corresponding to item tag
* @param doc is Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

Expand All @@ -49,7 +50,8 @@ class QgsComposerShape: QgsComposerItem
/**Sets this items bound in scene coordinates such that 1 item size units
corresponds to 1 scene size unit. Also, the shape is scaled*/
void setSceneRect( const QRectF& rectangle );

public slots:
/**Sets item rotation and resizes item bounds such that the shape always has the same size*/
virtual void setRotation( double r );
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class QgsComposerTable: QgsComposerItem
QgsComposerTable( QgsComposition* composition /TransferThis/ );
virtual ~QgsComposerTable();

/** return correct graphics item type. Added in v1.7 */
virtual int type() const;

/** \brief Reimplementation of QCanvasItem::paint*/
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

Expand All @@ -33,11 +36,21 @@ class QgsComposerTable: QgsComposerItem
void setGridColor( const QColor& c );
QColor gridColor() const;

/**Adapts the size of the frame to match the content. This is normally done in the paint method, but sometimes \
/**Adapts the size of the frame to match the content. This is normally done in the paint method, but sometimes
it needs to be done before the first render*/
void adjustFrameToSize();

protected:
//virtual bool getFeatureAttributes( QList< QMap< int, QVariant> >& attributes );
//virtual QMap<int, QString> getHeaderLabels() const;
/**Retrieves feature attributes*/
// virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributes );
virtual QMap<int, QString> getHeaderLabels() const;
/**Calculate the maximum width values of the vector attributes*/
// virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeList ) const;
/**Adapts the size of the item frame to match the content*/
// void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeList );
void drawHorizontalGridLines( QPainter* p, int nAttributes );
// void drawVerticalGridLines( QPainter* p, const QMap<int, double>& maxWidthMap );

bool tableWriteXML( QDomElement& itemElem, QDomDocument& doc ) const;
bool tableReadXML( const QDomElement& itemElem, const QDomDocument& doc );
};
22 changes: 22 additions & 0 deletions python/core/composer/qgscomposertexttable.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class QgsComposerTextTable: QgsComposerTable
{
%TypeHeaderCode
#include <qgscomposertexttable.h>
%End
public:
QgsComposerTextTable( QgsComposition* c );
~QgsComposerTextTable();

/** return correct graphics item type. Added in v1.7 */
virtual int type() const;

void setHeaderLabels( const QStringList& l );
void addRow( const QStringList& row );

bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

protected:
// bool getFeatureAttributes( QList< QMap<int, QVariant> >& attributes );
QMap<int, QString> getHeaderLabels() const;
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class QgsComposition: QGraphicsScene
/**Returns width of paper item*/
double paperWidth() const;

double spaceBetweenPages() const;

/**Note: added in version 1.9*/
void setNumPages( int pages );
/**Note: added in version 1.9*/
Expand Down Expand Up @@ -72,7 +74,10 @@ class QgsComposition: QGraphicsScene

/**Returns pointers to all composer maps in the scene*/
//todo: needs a new mapping for QList<const T*> ?
//QList<const QgsComposerMap*> composerMapItems() const;
// QList<const QgsComposerMap*> composerMapItems() const;

/**Return composer items of a specific type*/
// template<class T> void composerItems( QList<T*>& itemList );

/**Returns the composer map with specified id
@return id or 0 pointer if the composer map item does not exist*/
Expand All @@ -82,7 +87,7 @@ class QgsComposition: QGraphicsScene
void setPrintResolution( int dpi );

bool printAsRaster() const;
void setPrintAsRaster(bool enabled);
void setPrintAsRaster( bool enabled );

double selectionTolerance() const;
void setSelectionTolerance( double tol );
Expand All @@ -109,12 +114,15 @@ class QgsComposition: QGraphicsScene

/**Load a template document
@param doc template document
@param substitutionMap map with text to replace. Text needs to be enclosed by brackets (e.g. '[text]' )*/
@param substitutionMap map with text to replace. Text needs to be enclosed by brackets (e.g. '[text]' )
@param addUndoCommands whether or not to add undo commands
*/
bool loadFromTemplate( const QDomDocument& doc, QMap<QString, QString>* substitutionMap = 0, bool addUndoCommands = false );

/**Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard)
@param elem items parent element, e.g. <Composer> or <ComposerItemClipboard>
@param elem items parent element, e.g. \verbatim <Composer> \endverbatim or \verbatim <ComposerItemClipboard> \endverbatim
@param doc xml document
@param mapsToRestore for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand
@param addUndoCommands insert AddItem commands if true (e.g. for copy/paste)
@param pos item position. Optional, take position from xml if 0*/
//void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore, bool addUndoCommands = false, QPointF* pos = 0 );
Expand Down Expand Up @@ -160,6 +168,9 @@ class QgsComposition: QGraphicsScene
/**Deletes current command*/
void cancelCommand();

void beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text );
void endMultiFrameCommand();

/**Adds multiframe. The object is owned by QgsComposition until removeMultiFrame is called*/
void addMultiFrame( QgsComposerMultiFrame* multiFrame );
/**Removes multi frame (but does not delete it)*/
Expand All @@ -169,7 +180,7 @@ class QgsComposition: QGraphicsScene
/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLabel( QgsComposerLabel* label );
/**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerMap( QgsComposerMap* map );
void addComposerMap( QgsComposerMap* map, bool setDefaultPreviewStyle = true );
/**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
/**Adds legend to the graphics scene and advices composer to create a widget for it (through signal)*/
Expand All @@ -180,12 +191,15 @@ class QgsComposition: QGraphicsScene
void addComposerShape( QgsComposerShape* shape );
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerTable( QgsComposerAttributeTable* table );
/**Adds composer html frame and advices composer to create a widget for it (through signal)*/
void addComposerHtmlFrame( QgsComposerHtml* html /Transfer/, QgsComposerFrame* frame /Transfer/);

/**Remove item from the graphics scene. Additionally to QGraphicsScene::removeItem, this function considers undo/redo command*/
void removeComposerItem( QgsComposerItem* item );
void removeComposerItem( QgsComposerItem* item, bool createCommand = true );

/**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state );
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added );


//printing

Expand All @@ -200,4 +214,34 @@ class QgsComposition: QGraphicsScene
/**Render a page to a paint device
@note added in version 1.9*/
void renderPage( QPainter* p, int page );

public slots:
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
void sendItemAddedSignal( QgsComposerItem* item );
signals:
void paperSizeChanged();
void nPagesChanged();

/**Is emitted when selected item changed. If 0, no item is selected*/
void selectedItemChanged( QgsComposerItem* selected );
/**Is emitted when new composer arrow has been added to the view*/
void composerArrowAdded( QgsComposerArrow* arrow );
/**Is emitted when a new composer html has been added to the view*/
void composerHtmlFrameAdded( QgsComposerHtml* html, QgsComposerFrame* frame );
/**Is emitted when new composer label has been added to the view*/
void composerLabelAdded( QgsComposerLabel* label );
/**Is emitted when new composer map has been added to the view*/
void composerMapAdded( QgsComposerMap* map );
/**Is emitted when new composer scale bar has been added*/
void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
/**Is emitted when a new composer legend has been added*/
void composerLegendAdded( QgsComposerLegend* legend );
/**Is emitted when a new composer picture has been added*/
void composerPictureAdded( QgsComposerPicture* picture );
/**Is emitted when a new composer shape has been added*/
void composerShapeAdded( QgsComposerShape* shape );
/**Is emitted when a new composer table has been added*/
void composerTableAdded( QgsComposerAttributeTable* table );
/**Is emitted when a composer item has been removed from the scene*/
void itemRemoved( QgsComposerItem* );
};
13 changes: 13 additions & 0 deletions python/core/composer/qgsdoubleboxscalebarstyle.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class QgsDoubleBoxScaleBarStyle: QgsScaleBarStyle
{
%TypeHeaderCode
#include <qgsdoubleboxscalebarstyle.h>
%End
public:
QgsDoubleBoxScaleBarStyle( const QgsComposerScaleBar* bar );
~QgsDoubleBoxScaleBarStyle();

QString name() const;

void draw( QPainter* p, double xOffset = 0 ) const;
};
68 changes: 68 additions & 0 deletions python/core/composer/qgslegendmodel.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/** \ingroup MapComposer
* A model that provides layers as root items. The classification items are
* children of the layer items.
*/

class QgsLegendModel: QStandardItemModel
{
%TypeHeaderCode
#include <qgslegendmodel.h>
%End

public:

enum ItemType
{
GroupItem = 0,
LayerItem,
ClassificationItem
};

QgsLegendModel();
~QgsLegendModel();

/**Sets layer set and groups*/
void setLayerSetAndGroups( const QStringList& layerIds, const QList< QPair< QString, QList<QString> > >& groupInfo );
void setLayerSet( const QStringList& layerIds );
/**Adds a group
@param text name of group (defaults to translation of "Group")
@param position insertion position (toplevel position (or -1 if it should be placed at the end of the legend).
@returns a pointer to the added group
*/
QStandardItem *addGroup( QString text = QString::null, int position = -1 );

/**Tries to automatically update a model entry (e.g. a whole layer or only a single item)*/
void updateItem( QStandardItem* item );
/**Updates the whole symbology of a layer*/
void updateLayer( QStandardItem* layerItem );
/**Tries to update a single classification item*/
void updateVectorClassificationItem( QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText );
void updateVectorV2ClassificationItem( QStandardItem* classificationItem, QgsSymbolV2* symbol, QString itemText );
void updateRasterClassificationItem( QStandardItem* classificationItem );

bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc ) const;
bool readXML( const QDomElement& legendModelElem, const QDomDocument& doc );

Qt::DropActions supportedDropActions() const;
Qt::ItemFlags flags( const QModelIndex &index ) const;

/**Implemented to support drag operations*/
virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() );

/**For the drag operation*/
QMimeData* mimeData( const QModelIndexList &indexes ) const;
QStringList mimeTypes() const;

/**Implements the drop operation*/
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );

void setAutoUpdate( bool autoUpdate );
bool autoUpdate();

public slots:
void removeLayer( const QString& layerId );
void addLayer( QgsMapLayer* theMapLayer );

signals:
void layersChanged();
};
16 changes: 16 additions & 0 deletions python/core/composer/qgsnumericscalebarstyle.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class QgsNumericScaleBarStyle : QgsScaleBarStyle
{
%TypeHeaderCode
#include <qgsnumericscalebarstyle.h>
%End
public:
QgsNumericScaleBarStyle( QgsComposerScaleBar* bar );
~QgsNumericScaleBarStyle();

QString name() const;

void draw( QPainter* p, double xOffset = 0 ) const;

//calculation of box size is different compared to segment based scale bars
QRectF calculateBoxSize() const;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ class QgsPaperItem: QgsComposerItem
/** \brief Reimplementation of QCanvasItem::paint*/
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

/** stores state in Dom node
* @param node is Dom node corresponding to 'Composer' tag
* @param temp write template file
/** stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc Dom 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 Dom document
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

private:
QgsPaperItem();
/**Set flags and z-value*/
void initialize();
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class QgsScaleBarStyle
virtual ~QgsScaleBarStyle();

/**Draws the style
@param p painter object
@param xOffset offset to account for centered labeling*/
virtual void draw( QPainter* p, double xOffset = 0 ) const = 0; //to do by every subclass
virtual void drawLabels( QPainter* p ) const; //default implementation provided
virtual QRectF calculateBoxSize() const; //default implementation provided
virtual QString name() const = 0; //return name of the style
//virtual QIcon styleIcon() const = 0;
};
17 changes: 17 additions & 0 deletions python/core/composer/qgssingleboxscalebarstyle.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class QgsSingleBoxScaleBarStyle : QgsScaleBarStyle
{
%TypeHeaderCode
#include <qgssingleboxscalebarstyle.h>
%End
public:
QgsSingleBoxScaleBarStyle( const QgsComposerScaleBar* bar );
~QgsSingleBoxScaleBarStyle();

QString name() const;

/*! draw method
@param p painter object
@param xOffset x offset
*/
void draw( QPainter* p, double xOffset = 0 ) const;
};
26 changes: 26 additions & 0 deletions python/core/composer/qgsticksscalebarstyle.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class QgsTicksScaleBarStyle: QgsScaleBarStyle
{
%TypeHeaderCode
#include <qgsticksscalebarstyle.h>
%End
public:
enum TickPosition
{
TicksUp,
TicksDown,
TicksMiddle
};

QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar );
~QgsTicksScaleBarStyle();

QString name() const;

/*! draw method
@param p painter object
@param xOffset offset
*/
void draw( QPainter* p, double xOffset = 0 ) const;

void setTickPosition( TickPosition p );
};
191 changes: 134 additions & 57 deletions python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,181 @@
// TODO: more files to wrap

%Include qgis.sip
%Include qgsaddremoveitemcommand.sip

%Include qgsapplication.sip
%Include qgscomposerattributetable.sip
%Include qgscomposerframe.sip
%Include qgscomposerhtml.sip
%Include qgscomposeritem.sip
%Include qgscomposeritemcommand.sip
%Include qgscomposerlabel.sip
%Include qgscomposerlegend.sip
%Include qgscomposermap.sip
%Include qgscomposermultiframe.sip
%Include qgscomposerpicture.sip
%Include qgscomposerscalebar.sip
%Include qgscomposershape.sip
%Include qgscomposertable.sip
%Include qgscomposition.sip
%Include qgslegendmodel.sip
%Include qgspaperitem.sip
%Include qgsscalebarstyle.sip
%Include qgsattributeaction.sip
%Include qgsbrowsermodel.sip
%Include qgsclipper.sip
%Include qgscontexthelp.sip
%Include qgscontinuouscolorrenderer.sip
%Include qgscontrastenhancement.sip
%Include qgscontrastenhancementfunction.sip
%Include qgscoordinatereferencesystem.sip
%Include qgscoordinatetransform.sip
%Include qgscredentials.sip
%Include qgscrscache.sip
%Include qgsdataitem.sip
%Include qgsdataprovider.sip
%Include qgsdatasourceuri.sip
%Include qgsdbfilterproxymodel.sip
%Include qgsdistancearea.sip
%Include qgsexpression.sip
%Include qgsfeature.sip
%Include qgsfield.sip
%Include qgsgeometry.sip
%Include qgsgraduatedsymbolrenderer.sip
%Include qgsgeometryvalidator.sip
%Include qgshttptransaction.sip
%Include qgslabel.sip
%Include qgslabelattributes.sip
%Include qgslabelsearchtree.sip
%Include qgslogger.sip
%Include qgsmaplayer.sip
%Include qgsmaplayerregistry.sip
%Include qgsmaprenderer.sip
%Include qgsmaptopixel.sip
%Include qgsmarkercatalogue.sip
%Include qgsmessageoutput.sip
%Include qgsmessagelog.sip
%Include qgsmessageoutput.sip
%Include qgsmimedatautils.sip
%Include qgsnetworkaccessmanager.sip
%Include qgsoverlayobject.sip
%Include qgsowsconnection.sip
%Include qgspaintenginehack.sip
%Include qgsoverlayobjectpositionmanager.sip
%Include qgspalgeometry.sip
%Include qgspallabeling.sip
%Include qgspluginlayer.sip
%Include qgspluginlayerregistry.sip
%Include qgspoint.sip
%Include qgsproject.sip
%Include qgsprojectproperty.sip
%Include qgsprojectversion.sip
%Include qgsprovidercountcalcevent.sip
%Include qgsproviderextentcalcevent.sip
%Include qgsprovidermetadata.sip
%Include qgsproviderregistry.sip
%Include qgsrasterbandstats.sip
%Include qgspythonrunner.sip
%Include qgsrasterdataprovider.sip
%Include qgsrasterchecker.sip
%Include qgsrasterfilewriter.sip
%Include qgsrasterinterface.sip
%Include qgsrasterlayer.sip
%Include qgsrasterpipe.sip
%Include qgsrasterpyramid.sip
%Include qgsrasterprojector.sip
%Include qgsrasterrenderer.sip
%Include qgsrasterresamplefilter.sip
%Include qgsrasterresampler.sip
%Include qgsrastershader.sip
%Include qgsrastershaderfunction.sip
%Include qgsrastertransparency.sip
%Include qgsrasterviewport.sip
%Include qgsrectangle.sip
%Include qgsrendercontext.sip
%Include qgsrenderer.sip
%Include qgsrenderchecker.sip
%Include qgsrendercontext.sip
%Include qgsrunprocess.sip
%Include qgsscalecalculator.sip
%Include qgssinglesymbolrenderer.sip
%Include qgsscaleutils.sip
%Include qgssnapper.sip
%Include qgsspatialindex.sip
%Include qgscoordinatereferencesystem.sip
%Include qgssymbol.sip
%Include qgssymbologyutils.sip
%Include qgstolerance.sip
%Include qgsuniquevaluerenderer.sip
%Include qgsattributeaction.sip
%Include qgsvectordataprovider.sip
%Include qgsvectorfieldsymbollayer.sip
%Include qgsvectorfilewriter.sip
%Include qgsvectorlayer.sip
%Include qgsvectorlayerimport.sip
%Include qgsvectorlayerjoinbuffer.sip
%Include qgsvectorlayerundocommand.sip
%Include qgsvectoroverlay.sip
%Include qgscredentials.sip

%Include qgsnetworkaccessmanager.sip
%Include composer/qgsaddremoveitemcommand.sip
%Include composer/qgsaddremovemultiframecommand.sip
%Include composer/qgscomposerarrow.sip
%Include composer/qgscomposerattributetable.sip
%Include composer/qgscomposerframe.sip
%Include composer/qgscomposerhtml.sip
%Include composer/qgscomposeritem.sip
%Include composer/qgscomposeritemcommand.sip
%Include composer/qgscomposeritemgroup.sip
%Include composer/qgscomposerlabel.sip
%Include composer/qgscomposerlegend.sip
%Include composer/qgscomposerlegenditem.sip
%Include composer/qgscomposermap.sip
%Include composer/qgscomposermultiframe.sip
%Include composer/qgscomposermultiframecommand.sip
%Include composer/qgscomposerpicture.sip
%Include composer/qgscomposerscalebar.sip
%Include composer/qgscomposershape.sip
%Include composer/qgscomposertable.sip
%Include composer/qgscomposition.sip
%Include composer/qgsdoubleboxscalebarstyle.sip
%Include composer/qgslegendmodel.sip
%Include composer/qgsnumericscalebarstyle.sip
%Include composer/qgspaperitem.sip
%Include composer/qgsscalebarstyle.sip
%Include composer/qgssingleboxscalebarstyle.sip
%Include composer/qgsticksscalebarstyle.sip
%Include composer/qgscomposertexttable.sip

%Include symbology-ng-core.sip
%Include qgspallabeling.sip
%Include qgsdiagramrendererv2.sip
%Include diagram/qgsdiagram.sip
%Include diagram/qgshistogramdiagram.sip
%Include diagram/qgspiediagram.sip
%Include diagram/qgstextdiagram.sip

%Include qgsgpsconnection.sip
%Include qgsgpsconnectionregistry.sip
%Include qgsgpsdconnection.sip
%Include qgsnmeaconnection.sip
%Include qgsgpsdetector.sip
%Include gps/qgsgpsconnection.sip
%Include gps/qgsgpsconnectionregistry.sip
%Include gps/qgsgpsdconnection.sip
%Include gps/qgsgpsdetector.sip
%Include gps/qgsnmeaconnection.sip
// %Include gps/qgsqtlocationconnection.sip

%Include qgspaintenginehack.sip
%Include raster/qgscliptominmaxenhancement.sip
%Include raster/qgsfreakoutshader.sip
%Include raster/qgscolorrampshader.sip
%Include raster/qgscontrastenhancement.sip
%Include raster/qgscontrastenhancementfunction.sip
%Include raster/qgslinearminmaxenhancement.sip
%Include raster/qgslinearminmaxenhancementwithclip.sip
%Include raster/qgspseudocolorshader.sip
%Include raster/qgsrasterbandstats.sip
%Include raster/qgsrasterchecker.sip
%Include raster/qgsrasterfilewriter.sip
%Include raster/qgsrasterhistogram.sip
%Include raster/qgsrasterinterface.sip
%Include raster/qgsrasteriterator.sip
%Include raster/qgsrasterlayer.sip
%Include raster/qgsrasternuller.sip
%Include raster/qgsrasterpipe.sip
%Include raster/qgsrasterpyramid.sip
%Include raster/qgsrasterrenderer.sip
%Include raster/qgsrasterresamplefilter.sip
%Include raster/qgsrasterresampler.sip
%Include raster/qgsrastershader.sip
%Include raster/qgsrastershaderfunction.sip
%Include raster/qgsrastertransparency.sip
%Include raster/qgsrasterviewport.sip
%Include raster/qgsbilinearrasterresampler.sip
%Include raster/qgssinglebandcolordatarenderer.sip
%Include raster/qgssinglebandpseudocolorrenderer.sip
%Include raster/qgssinglebandgrayrenderer.sip
%Include raster/qgspaletterasterrenderer.sip
%Include raster/qgscubicrasterresampler.sip
%Include raster/qgsmultibandcolorrenderer.sip

%Include renderer/qgscontinuouscolorrenderer.sip
%Include renderer/qgsgraduatedsymbolrenderer.sip
%Include renderer/qgsrenderer.sip
%Include renderer/qgssinglesymbolrenderer.sip
%Include renderer/qgsuniquevaluerenderer.sip

%Include symbology-ng/qgsrendererv2.sip
%Include symbology-ng/qgsstylev2.sip
%Include symbology-ng/qgssvgcache.sip
%Include symbology-ng/qgssymbologyv2conversion.sip
%Include symbology-ng/qgssymbolv2.sip
%Include symbology-ng/qgscolorbrewerpalette.sip
%Include symbology-ng/qgscptcityarchive.sip
%Include symbology-ng/qgsvectorcolorrampv2.sip

%Include symbology-ng/qgscategorizedsymbolrendererv2.sip
%Include symbology-ng/qgsgraduatedsymbolrendererv2.sip
%Include symbology-ng/qgssinglesymbolrendererv2.sip
%Include symbology-ng/qgspointdisplacementrenderer.sip
%Include symbology-ng/qgsrulebasedrendererv2.sip
// %Include symbology-ng/qgsrendererv2registry.sip

%Include symbology-ng/qgssymbollayerv2.sip
%Include symbology-ng/qgssymbollayerv2utils.sip
%Include symbology-ng/qgsvectorfieldsymbollayer.sip
%Include symbology-ng/qgsellipsesymbollayerv2.sip
%Include symbology-ng/qgsfillsymbollayerv2.sip
%Include symbology-ng/qgslinesymbollayerv2.sip
%Include symbology-ng/qgsmarkersymbollayerv2.sip
// %Include symbology-ng/qgssymbollayerv2registry.sip

%Include symbology/qgsmarkercatalogue.sip
%Include symbology/qgssymbol.sip
%Include symbology/qgssymbologyutils.sip
49 changes: 49 additions & 0 deletions python/core/diagram/qgsdiagram.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class QgsDiagram
{
%TypeHeaderCode
#include <qgsdiagram.h>
%End
public:
virtual ~QgsDiagram();
/**Draws the diagram at the given position (in pixel coordinates)*/
virtual void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position ) = 0;
virtual QString diagramName() const = 0;
/**Returns the size in map units the diagram will use to render.*/
virtual QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s ) = 0;
/**Returns the size in map units the diagram will use to render. Interpolate size*/
virtual QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) = 0;

protected:
/** Changes the pen width to match the current settings and rendering context
* @param pen The pen to modify
* @param s The settings that specify the pen width
* @param c The rendering specifying the proper scale units for pixel conversion
*/
void setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c );

/** Calculates a size to match the current settings and rendering context
* @param size The size to convert
* @param s The settings that specify the size type
* @param c The rendering specifying the proper scale units for pixel conversion
*
* @return The converted size for rendering
*/
QSizeF sizePainterUnits( const QSizeF& size, const QgsDiagramSettings& s, const QgsRenderContext& c );

/** Calculates a length to match the current settings and rendering context
* @param l The length to convert
* @param s Unused
* @param c The rendering specifying the proper scale units for pixel conversion
*
* @return The converted length for rendering
*/
float sizePainterUnits( float l, const QgsDiagramSettings& s, const QgsRenderContext& c );

/** Calculates a size to match the current settings and rendering context
* @param s The settings that contain the font size and size type
* @param c The rendering specifying the proper scale units for pixel conversion
*
* @return The properly scaled font for rendering
*/
QFont scaledFont( const QgsDiagramSettings& s, const QgsRenderContext& c );
};
14 changes: 14 additions & 0 deletions python/core/diagram/qgshistogramdiagram.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class QgsHistogramDiagram: QgsDiagram
{
%TypeHeaderCode
#include <qgshistogramdiagram.h>
%End
public:
QgsHistogramDiagram();
~QgsHistogramDiagram();

void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
QString diagramName() const;
};
14 changes: 14 additions & 0 deletions python/core/diagram/qgspiediagram.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class QgsPieDiagram: QgsDiagram
{
%TypeHeaderCode
#include <qgspiediagram.h>
%End
public:
QgsPieDiagram();
~QgsPieDiagram();

void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
QString diagramName() const;
};
28 changes: 28 additions & 0 deletions python/core/diagram/qgstextdiagram.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class QgsTextDiagram: QgsDiagram
{
%TypeHeaderCode
#include <qgstextdiagram.h>
%End

public:
enum Shape
{
Circle = 0,
Rectangle,
Triangle
};

enum Orientation
{
Horizontal = 0,
Vertical
};

QgsTextDiagram();
~QgsTextDiagram();
void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );

QString diagramName() const;
};
Loading