Skip to content

Commit

Permalink
update sip bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 26, 2014
1 parent 3c5c7de commit d4e3694
Show file tree
Hide file tree
Showing 87 changed files with 1,134 additions and 291 deletions.
2 changes: 1 addition & 1 deletion python/core/composer/qgscomposereffect.sip
Expand Up @@ -7,7 +7,7 @@ class QgsComposerEffect : QGraphicsEffect
QgsComposerEffect();
~QgsComposerEffect();

void setCompositionMode( const QPainter::CompositionMode compositionMode );
void setCompositionMode( const QPainter::CompositionMode &compositionMode );

protected:
/** Called whenever source needs to be drawn */
Expand Down
3 changes: 3 additions & 0 deletions python/core/composer/qgscomposeritemgroup.sip
Expand Up @@ -38,6 +38,9 @@ class QgsComposerItemGroup: QgsComposerItem
signals:
void childItemDeleted( QgsComposerItem* item );

public slots:
void itemDestroyed();

protected:
void drawFrame( QPainter* p );
};
6 changes: 3 additions & 3 deletions python/core/composer/qgscomposershape.sip
Expand Up @@ -13,7 +13,7 @@ class QgsComposerShape: QgsComposerItem
Triangle
};

QgsComposerShape( QgsComposition* composition /TransferThis/);
QgsComposerShape( QgsComposition* composition /TransferThis/ );
QgsComposerShape( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition /TransferThis/);
~QgsComposerShape();

Expand Down Expand Up @@ -43,7 +43,7 @@ class QgsComposerShape: QgsComposerItem
void setCornerRadius( double radius );
/**Returns the radius for rounded rectangle corners*/
double cornerRadius() const;

/**Sets the QgsFillSymbolV2 used to draw the shape. Must also call setUseSymbolV2( true ) to
* enable drawing with a symbol.
* Note: added in version 2.1*/
Expand All @@ -54,7 +54,7 @@ class QgsComposerShape: QgsComposerItem

/**Controls whether the shape should be drawn using a QgsFillSymbolV2.
* Note: Added in v2.1 */
void setUseSymbolV2( bool useSymbolV2 );
void setUseSymbolV2( bool useSymbolV2 );

protected:
/* reimplement drawFrame, since it's not a rect, but a custom shape */
Expand Down
2 changes: 2 additions & 0 deletions python/core/composer/qgspaperitem.sip
Expand Up @@ -28,6 +28,8 @@ class QgsPaperItem: QgsComposerItem
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

virtual void setSceneRect( const QRectF& rectangle );

private:
QgsPaperItem();
/**Set flags and z-value*/
Expand Down
1 change: 1 addition & 0 deletions python/core/core.sip
Expand Up @@ -71,6 +71,7 @@
%Include qgspythonrunner.sip
%Include qgsrectangle.sip
%Include qgsrelation.sip
%Include qgsrelationmanager.sip

This comment has been minimized.

Copy link
@snorfalorpagus

snorfalorpagus Jan 26, 2014

Contributor

Did you forget to add this file to the commit?

This comment has been minimized.

Copy link
@dakcarto

dakcarto Jan 27, 2014

Member

Same issue here. Build fails on Mac due to missing sip file.

%Include qgsrenderchecker.sip
%Include qgsrendercontext.sip
%Include qgsrunprocess.sip
Expand Down
27 changes: 22 additions & 5 deletions python/core/qgis.sip
Expand Up @@ -59,6 +59,12 @@ class QGis
WKBMultiPolygon25D,
};

static WkbType singleType( WkbType type );
static WkbType multiType( WkbType type );
static WkbType flatType( WkbType type );
static bool isSingleType( WkbType type );
static bool isMultiType( WkbType type );
static int wkbDimensions( WkbType type );
enum GeometryType
{
Point,
Expand All @@ -68,11 +74,11 @@ class QGis
NoGeometry
};

// TODO: String representation of geometry types (set in qgis.cpp)
// static const char *qgisVectorGeometryType[];
//! description strings for geometry types
static const char *vectorGeometryType( GeometryType type );

//! description strings for feature types
// static const char *qgisFeatureTypes[];
static const char *featureType( WkbType type );

/** Raster data types.
* This is modified and extended copy of GDALDataType.
Expand All @@ -97,6 +103,7 @@ class QGis
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
};


/** Map units that qgis supports
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
* @note and QGIS >1.8 returns to that
Expand All @@ -112,6 +119,7 @@ class QGis
DecimalDegrees = 2, // was 2
DegreesMinutesSeconds = 2, // was 4
DegreesDecimalMinutes = 2, // was 5
NauticalMiles = 7
};

//! Provides the canonical name of the type value
Expand All @@ -123,6 +131,8 @@ class QGis
//! Provides translated version of the type value
// Added in version 2.0
static QString tr( QGis::UnitType unit );
//! Returns the conversion factor between the specified units
static double fromUnitToUnitFactor( QGis::UnitType fromUnit, QGis::UnitType toUnit );

//! User defined event types
enum UserEvent
Expand All @@ -137,14 +147,16 @@ class QGis
};

static const double DEFAULT_IDENTIFY_RADIUS;

//! Default threshold between map coordinates and device coordinates for map2pixel simplification
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
};


/** Wkt string that represents a geographic coord sys
* @note added in 1.8 to replace GEOWkt
*/
const QString GEOWKT;

const QString PROJECT_SCALES;

/** PROJ4 string that represents a geographic coord sys */
Expand Down Expand Up @@ -184,6 +196,11 @@ const double DEFAULT_LINE_WIDTH;
/** default snapping tolerance for segments (@note added in 1.8) */
const double DEFAULT_SEGMENT_EPSILON;

/** KEEP IN SYNC WITH qgssize defined in qgis.h! */
/** qgssize is used instead of size_t, because size_t is stdlib type, unknown
* by SIP, and it would be hard to define size_t correctly in SIP.
* Currently used "unsigned long long" was introduced in C++11 (2011)
* but it was supported already before C++11 on common platforms.
* "unsigned long long int" gives syntax error in SIP.
* KEEP IN SYNC WITH qgssize defined in SIP! */
typedef unsigned long long qgssize;

16 changes: 12 additions & 4 deletions python/core/qgsapplication.sip
Expand Up @@ -92,7 +92,7 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
* based on the supplied theme name exists. If it does not the theme name will
* be reverted to 'default'.
*/
static void setThemeName( const QString theThemeName );
static void setThemeName( const QString &theThemeName );

/** Set the active theme to the specified theme.
* The theme name should be a single word e.g. 'default','classic'.
Expand Down Expand Up @@ -125,6 +125,11 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
*/
static const QString translatorsFilePath();

/*!
Returns the path to the licence file.
*/
static const QString licenceFilePath();

//! Returns the path to the help application.
static const QString helpAppPath();

Expand Down Expand Up @@ -202,20 +207,23 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static const QString libexecPath();

//! Alters prefix path - used by 3rd party apps
static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = false );
static void setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths = false );

//! Alters plugin path - used by 3rd party apps
static void setPluginPath( const QString thePluginPath );
static void setPluginPath( const QString &thePluginPath );

//! Alters pkg data path - used by 3rd party apps
static void setPkgDataPath( const QString thePkgDataPath );
static void setPkgDataPath( const QString &thePkgDataPath );

//! Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5
static void setDefaultSvgPaths( const QStringList& pathList );

//! loads providers
static void initQgis();

//! initialise qgis.db
static bool createDB( QString* errorMessage = 0 );

//! deletes provider registry and map layer registry
static void exitQgis();

Expand Down
30 changes: 15 additions & 15 deletions python/core/qgsattributeaction.sip
Expand Up @@ -29,9 +29,15 @@ class QgsAction
//! Whether to capture output for display when this action is run
bool capture() const;

//! Whether the action is runable on the current platform
bool runable() const;
};

/*! \class QgsAttributeAction
* \brief Storage and management of actions associated with Qgis layer
* attributes.
*/

class QgsAttributeAction
{
%TypeHeaderCode
Expand All @@ -54,31 +60,25 @@ class QgsAttributeAction
//! Remove an action at given index
void removeAction( int index );

/*! Does the given values. defaultValueIndex is the index of the
/*! Does the given values. defaultValueIndex is the index of the
* field to be used if the action has a $currfield placeholder.
* @note added in 1.9
* @note not available in python bindings
* @note available in python bindings as doActionFeature
*/
void doActionFeature( int index,
QgsFeature &feat,
int defaultValueIndex = 0 );
%MethodCode
sipCpp->doAction( a0, *a1, a2 );
%End
void doAction( int index,
QgsFeature &feat,
int defaultValueIndex = 0 ) /PyName=doActionFeature/;

/*! Does the action using the expression builder to expand it
* and getting values from the passed feature attribute map.
* substitutionMap is used to pass custom substitutions, to replace
* each key in the map with the associated value
* @note added in 1.9
* @note available in python bindings as doActionFeatureSubstitution
* @note available in python bindings as doActionFeatureWithSubstitution
*/
void doActionFeatureWithSubstitution( int index,
QgsFeature &feat,
const QMap<QString, QVariant> *substitutionMap = 0 );
%MethodCode
sipCpp->doAction( a0, *a1, a2 );
%End
void doAction( int index,
QgsFeature &feat,
const QMap<QString, QVariant> *substitutionMap = 0 ) /PyName=doActionFeatureWithSubstitution/;

//! Removes all actions
void clearActions();
Expand Down
20 changes: 11 additions & 9 deletions python/core/qgscachedfeatureiterator.sip
Expand Up @@ -5,35 +5,37 @@ class QgsCachedFeatureIterator : QgsAbstractFeatureIterator
%End
public:
/**
* @brief
* This constructor creates a feature iterator, that delivers only cached information, based on the
* @link QgsFeatureIds @endlink. No request is made to the backend.
*
* @param vlCache The vector layer cache to use
* @param featureRequest The feature request to answer
* @param featureIds The feature ids to return
*
* @deprecated Use QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest )
* instead
*/
QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest, QgsFeatureIds featureIds );

/**
* @brief
* This constructor creates a feature iterator, that delivers all cached features. No request is made to the backend.
*
* @param f
* @return bool
* @param vlCache The vector layer cache to use
* @param featureRequest The feature request to answer
*/
virtual bool nextFeature( QgsFeature& f );
QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest );

/**
* @brief
* Rewind to the beginning of the iterator
*
* @return bool
* @return bool true if the operation was ok
*/
virtual bool rewind();

/**
* @brief
* Close this iterator. No further features will be available.
*
* @return bool
* @return true if successful
*/
virtual bool close();
};
Expand Down
18 changes: 10 additions & 8 deletions python/core/qgscoordinatereferencesystem.sip
Expand Up @@ -71,7 +71,7 @@ class QgsCoordinateReferenceSystem
* @param theWkt The Wkt for the desired spatial reference system.
* @return bool TRUE if success else false
*/
bool createFromWkt( const QString theWkt );
bool createFromWkt( const QString &theWkt );

/*! Set up this srs by fetching the appropriate information from the
* sqlite backend. If the srsid is < 100000, only the system srs.db
Expand All @@ -89,7 +89,7 @@ class QgsCoordinateReferenceSystem
* in the parameters member. The reason for this is so that we
* can easily present the user with 'natural language' representation
* of the projection and ellipsoid by looking them up in the srs.bs sqlite
* database. Also having the ellpse and proj elements stripped out
* database. Also having the ellipse and proj elements stripped out
* is helpful to speed up globbing queries (see below).
*
* We try to match the proj string to and srsid using the following logic:
Expand All @@ -106,13 +106,10 @@ class QgsCoordinateReferenceSystem
* check for a match in entities that have the same ellps and proj entries so
* that it doesn't munch yer cpu so much.
*
* @note If the srs was not matched, we will create a new entry on the users tbl_srs
* for this srs.
*
* @param theProjString A proj4 format string
* @return bool TRUE if success else false
*/
bool createFromProj4( const QString theProjString );
bool createFromProj4( const QString &theProjString );

/*! Set up this srs from a string definition, by default a WKT definition. Otherwise
* the string defines a authority, followed by a colon, followed by the definition.
Expand All @@ -121,7 +118,7 @@ class QgsCoordinateReferenceSystem
* uses the corresponding createFrom... function.
* @param theDefinition A String containing a coordinate reference system definition.
*/
bool createFromString( const QString theDefinition );
bool createFromString( const QString &theDefinition );

/*! Set up this srs from a various text formats.
*
Expand All @@ -138,7 +135,7 @@ class QgsCoordinateReferenceSystem
*
* @note added in 1.8
*/
bool createFromUserInput( const QString theDefinition );
bool createFromUserInput( const QString &theDefinition );

/*! Make sure that ESRI WKT import is done properly.
* This is required for proper shapefile CRS import when using gdal>= 1.9.
Expand Down Expand Up @@ -215,6 +212,7 @@ class QgsCoordinateReferenceSystem

/** Sets custom function to force valid CRS
* QGIS uses implementation in QgisGui::customSrsValidation
* @note not available in python bindings
*/
// static void setCustomSrsValidation( CUSTOM_CRS_VALIDATION f );

Expand Down Expand Up @@ -305,8 +303,12 @@ class QgsCoordinateReferenceSystem
*/
static int syncDb();


/*! Save the proj4-string as a custom CRS
* @returns bool true if success else false
*/
bool saveAsUserCRS( QString name );

/**Returns auth id of related geographic CRS*/
QString geographicCRSAuthId() const;
};

0 comments on commit d4e3694

Please sign in to comment.