Skip to content

Commit

Permalink
more sip fixes:
Browse files Browse the repository at this point in the history
- also move enum StyleEntity in QgsStyleV2
- fix some warnings
  • Loading branch information
jef-n committed Sep 24, 2012
1 parent cd97358 commit 74fd0e4
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 81 deletions.
7 changes: 7 additions & 0 deletions cmake/Flex.cmake
Expand Up @@ -78,5 +78,12 @@ MACRO(ADD_FLEX_FILES_PREFIX _sources prefix )
)

SET(${_sources} ${${_sources}} ${_out} )

# Disable warnings
IF(MSVC)
SET_SOURCE_FILES_PROPERTIES(${_out} PROPERTIES COMPILE_FLAGS /W0)
ELSE(MSVC)
SET_SOURCE_FILES_PROPERTIES(${_out} PROPERTIES COMPILE_FLAGS -w)
ENDIF(MSVC)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_FLEX_FILES_PREFIX)
4 changes: 4 additions & 0 deletions python/CMakeLists.txt
Expand Up @@ -54,6 +54,10 @@ IF(NOT WITH_TOUCH)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} HAVE_TOUCH)
ENDIF(NOT WITH_TOUCH)

IF(NOT QT_MOBILITY_LOCATION_FOUND)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} MOBILITY_LOCATION)
ENDIF(NOT QT_MOBILITY_LOCATION_FOUND)

IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
ENDIF(PYQT4_VERSION_NUM LESS 263680)
Expand Down
6 changes: 3 additions & 3 deletions python/core/core.sip
Expand Up @@ -120,7 +120,7 @@
%Include gps/qgsgpsdconnection.sip
%Include gps/qgsgpsdetector.sip
%Include gps/qgsnmeaconnection.sip
// %Include gps/qgsqtlocationconnection.sip
%Include gps/qgsqtlocationconnection.sip

%Include raster/qgscliptominmaxenhancement.sip
%Include raster/qgsfreakoutshader.sip
Expand Down Expand Up @@ -161,7 +161,6 @@
%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
Expand All @@ -175,7 +174,8 @@
%Include symbology-ng/qgssinglesymbolrendererv2.sip
%Include symbology-ng/qgspointdisplacementrenderer.sip
%Include symbology-ng/qgsrulebasedrendererv2.sip
// %Include symbology-ng/qgsrendererv2registry.sip
%Include symbology-ng/qgsrendererv2.sip
%Include symbology-ng/qgsrendererv2registry.sip

%Include symbology-ng/qgssymbollayerv2.sip
%Include symbology-ng/qgssymbollayerv2utils.sip
Expand Down
4 changes: 4 additions & 0 deletions python/core/gps/qgsqtlocationconnection.sip
@@ -1,3 +1,6 @@
%Feature MOBILITY_LOCATION

%If (MOBILITY_LOCATION)
class QgsQtLocationConnection: QgsGPSConnection
{
%TypeHeaderCode
Expand All @@ -23,3 +26,4 @@ class QgsQtLocationConnection: QgsGPSConnection
/**Called when the number of satellites in use is updated.*/
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo>& satellites );
};
%End
4 changes: 2 additions & 2 deletions python/core/qgslabelsearchtree.sip
Expand Up @@ -12,10 +12,10 @@ class QgsLabelSearchTree
void clear();

/**Returns label position(s) at a given point. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList );
// void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList );

/**Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList );
// void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList );

/**Inserts label position. Does not take ownership of labelPos
@return true in case of success*/
Expand Down
12 changes: 6 additions & 6 deletions python/core/qgsmaprenderer.sip
Expand Up @@ -6,7 +6,7 @@ class QgsLabelPosition
#include <qgsmaprenderer.h>
%End
public:
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down );
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down, bool diagram = false, bool pinned = false );
QgsLabelPosition();
int featureId;
double rotation;
Expand Down Expand Up @@ -58,13 +58,13 @@ class QgsLabelingEngineInterface
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) = 0;

//! called when passing engine among map renderers
virtual QgsLabelingEngineInterface* clone() = 0;
virtual QgsLabelingEngineInterface* clone() = 0 /Factory/;
};


/**
* \class QgsMapRenderer
* \brief Class for rendering map layer set

/** \ingroup core
* A non GUI class for rendering a map layer set onto a QPainter.
*/

class QgsMapRenderer : QObject
Expand Down Expand Up @@ -245,5 +245,5 @@ class QgsMapRenderer : QObject

/**Creates an overlay object position manager subclass according to the current settings
@note this method was added in version 1.1*/
QgsOverlayObjectPositionManager* overlayManagerFromSettings();
QgsOverlayObjectPositionManager* overlayManagerFromSettings() /Factory/;
};
2 changes: 1 addition & 1 deletion python/core/qgsrasterdataprovider.sip
Expand Up @@ -403,7 +403,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
/** Creates a new dataset with mDataSourceURI
@return true in case of success*/
virtual bool create( const QString& format, int nBands,
int type,
QgsRasterInterface::DataType type,
int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs,
QStringList createOptions = QStringList() /*e.v. color table*/ );
Expand Down
29 changes: 9 additions & 20 deletions python/core/symbology-ng/qgsrendererv2registry.sip
@@ -1,8 +1,11 @@
class QgsRendererV2Widget /External/;

class QgsRendererV2AbstractMetadata
{
%TypeHeaderCode
#include <qgsrendererv2registry.h>
%End

public:
QgsRendererV2AbstractMetadata( QString name, QString visibleName, QIcon icon = QIcon() );
virtual ~QgsRendererV2AbstractMetadata();
Expand Down Expand Up @@ -31,31 +34,17 @@ class QgsRendererV2Metadata : QgsRendererV2AbstractMetadata
#include <qgsrendererv2registry.h>
%End
public:

/** construct metadata */
QgsRendererV2Metadata( QString name,
QString visibleName,
QgsRendererV2CreateFunc pfCreate,
QIcon icon = QIcon(),
QgsRendererV2WidgetFunc pfWidget = NULL );

QgsRendererV2Metadata( QString name,
QString visibleName,
QgsRendererV2CreateFunc pfCreate,
QgsRendererV2CreateFromSldFunc pfCreateFromSld,
QIcon icon = QIcon(),
QgsRendererV2WidgetFunc pfWidget = NULL );
{}

virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) /Factory/;
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) /Factory/;
virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) /Factory/;

QgsRendererV2CreateFunc createFunction() const;
QgsRendererV2WidgetFunc widgetFunction() const;
QgsFeatureRendererV2* (*)( QDomElement&, QGis::GeometryType geomType ) createFromSldFunction() const;
// QgsRendererV2CreateFunc createFunction() const;
// QgsRendererV2WidgetFunc widgetFunction() const;
// QgsFeatureRendererV2* (*)( QDomElement&, QGis::GeometryType geomType ) createFromSldFunction() const;
// void setWidgetFunction( QgsRendererV2WidgetFunc f );

void setWidgetFunction( QgsRendererV2WidgetFunc f );
private:
QgsRendererV2Metadata(); // pretend this is private
};

/**
Expand Down
28 changes: 18 additions & 10 deletions python/core/symbology-ng/qgsstylev2.sip
Expand Up @@ -9,6 +9,14 @@ class QgsStyleV2
QgsStyleV2();
~QgsStyleV2();

//! Enum for Entities involved in a style
/*!
The enumerator is used for identifying the entity being operated on when generic
database functions are being run.
\sa group(), rename(), remove(), symbolsOfGroup(), symbolsWithTag(), symbolsOfSmartgroup()
*/
enum StyleEntity { SymbolEntity, GroupEntity, TagEntity, ColorrampEntity, SmartgroupEntity };

//! add color ramp to style. takes ramp's ownership
/*!
* \note Adding a color ramp with the name of existing one replaces it.
Expand Down Expand Up @@ -85,7 +93,7 @@ class QgsStyleV2
* \param tags is the list of the tags that are to be applied as QStringList
* \return returns the success state of the operation
*/
bool tagSymbol( int type, QString symbol, QStringList tags );
bool tagSymbol( StyleEntity type, QString symbol, QStringList tags );

//! detags the symbol with the given list
/*!
Expand All @@ -95,7 +103,7 @@ class QgsStyleV2
* \param tags is the list of tags that are to be removed as QStringList
* \return returns the success state of the operation
*/
bool detagSymbol( int type, QString symbol, QStringList tags );
bool detagSymbol( StyleEntity type, QString symbol, QStringList tags );

//! remove symbol from style (and delete it)
bool removeSymbol( QString name );
Expand Down Expand Up @@ -135,15 +143,15 @@ class QgsStyleV2
* \param groupid is id of the group to which the symbols belong to, as int
* \return A QStringList of the symbol or colorramp names for the given group id
*/
QStringList symbolsOfGroup( int type, int groupid );
QStringList symbolsOfGroup( StyleEntity type, int groupid );

//! returns the symbol names with which have the given tag
/*!
* \param type is either SymbolEntity or ColorampEntity
* \param tagid is id of the tag which has been applied over the symbol as int
* \return A QStringList of the symbol or colorramp names for the given tag id
*/
QStringList symbolsWithTag( int type, int tagid );
QStringList symbolsWithTag( StyleEntity type, int tagid );

//! applies the specifed group to the symbol or colorramp specified by StyleEntity
/*!
Expand All @@ -152,22 +160,22 @@ class QgsStyleV2
* \param groupid is the id of the group to which the entity is assigned
* \return returns the success state as bool
*/
bool group( int type, QString name, int groupid );
bool group( StyleEntity type, QString name, int groupid );

//! rename the given entity with the specified id
/*!
* \param type is any of the style entites. Refer enum StyleEntity.
* \param id is the DB id of the entity which is to be renamed
* \param newName is the new name of the entity
*/
void rename( int type, int id, QString newName );
void rename( StyleEntity type, int id, QString newName );

//! remove the specified entity from the db
/*!
* \param type is any of the style entites. Refer enum StyleEntity.
* \param id is the DB id of the entity to be removed
*/
void remove( int type, int id );
void remove( StyleEntity type, int id );

//! add the symbol to the DB with the tags
/*!
Expand Down Expand Up @@ -218,7 +226,7 @@ class QgsStyleV2
* \param symbol is the name of the symbol or color ramp
* \return A QStringList of the tags that have been applied to that symbol/colorramp
*/
QStringList tagsOfSymbol( int type, QString symbol );
QStringList tagsOfSymbol( StyleEntity type, QString symbol );

//! returns the smart groups map with id as key and name as value
QMap<int, QString> smartgroupsListMap();
Expand All @@ -234,7 +242,7 @@ class QgsStyleV2
QString smartgroupOperator( int id );

//! returns the symbols for the smartgroup
QStringList symbolsOfSmartgroup( int type, int id );
QStringList symbolsOfSmartgroup( StyleEntity type, int id );

//! Exports the style as a XML file
bool exportXML( QString filename );
Expand Down Expand Up @@ -265,5 +273,5 @@ class QgsStyleV2
* \param name is the name of an existing symbol or a color ramp
* \return Success state of the update operation
*/
bool updateSymbol( int type, QString name );
bool updateSymbol( StyleEntity type, QString name );
};
4 changes: 0 additions & 4 deletions python/core/symbology-ng/qgssymbollayerv2registry.sip
@@ -1,9 +1,5 @@
class QgsSymbolLayerV2Widget /External/;

typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFunc )( const QgsStringMap& );
typedef QgsSymbolLayerV2Widget*( *QgsSymbolLayerV2WidgetFunc )( const QgsVectorLayer* );
typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFromSldFunc )( QDomElement& );

class QgsSymbolLayerV2AbstractMetadata
{
%TypeHeaderCode
Expand Down
2 changes: 2 additions & 0 deletions python/core/symbology-ng/qgssymbollayerv2utils.sip
Expand Up @@ -93,10 +93,12 @@ class QgsSymbolLayerV2Utils
static bool fillFromSld( QDomElement &element,
Qt::BrushStyle &brushStyle, QColor &color );

/*
static void lineToSld( QDomDocument &doc, QDomElement &element,
Qt::PenStyle penStyle, QColor color, double width = -1,
const Qt::PenJoinStyle *penJoinStyle = 0, const Qt::PenCapStyle *penCapStyle = 0,
const QVector<qreal> *customDashPattern = 0, double dashOffset = 0.0 );
*/
static bool lineFromSld( QDomElement &element,
Qt::PenStyle &penStyle, QColor &color, double &width,
Qt::PenJoinStyle *penJoinStyle = 0, Qt::PenCapStyle *penCapStyle = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerattributetable.h
Expand Up @@ -24,7 +24,7 @@ class QgsComposerMap;
class QgsVectorLayer;

/**Helper class for sorting, takes into account sorting column and ascending / descending*/
class QgsComposerAttributeTableCompare
class CORE_EXPORT QgsComposerAttributeTableCompare
{
public:
QgsComposerAttributeTableCompare();
Expand Down
12 changes: 9 additions & 3 deletions src/core/qgslabelsearchtree.h
Expand Up @@ -39,15 +39,21 @@ class CORE_EXPORT QgsLabelSearchTree
/**Removes and deletes all the entries*/
void clear();

/**Returns label position(s) at a given point. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
/**Returns label position(s) at a given point. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions
* @note not available in python bindings
* TODO: why does this break bindings with QList<QgsLabelPosition>?
*/
void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList );

/**Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
/**Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions
* @note not available in python bindings
* TODO: why does this break bindings with QList<QgsLabelPosition>?
*/
void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList );

/**Inserts label position. Does not take ownership of labelPos
* @note not available in python bindings
* @return true in case of success
* @note not available in python bindings
*/
bool insertLabel( LabelPosition* labelPos, int featureId, const QString& layerName, bool diagram = false, bool pinned = false );

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmimedatautils.h
Expand Up @@ -23,7 +23,7 @@ class CORE_EXPORT QgsMimeDataUtils
{
public:

struct Uri
struct CORE_EXPORT Uri
{
Uri( QgsLayerItem* layer );
Uri( QString& encData );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsrasterdataprovider.h
Expand Up @@ -549,7 +549,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** Creates a new dataset with mDataSourceURI
@return true in case of success*/
virtual bool create( const QString& format, int nBands,
QgsRasterDataProvider::DataType type,
QgsRasterInterface::DataType type,
int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs,
QStringList createOptions = QStringList() /*e.v. color table*/ )
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayerundocommand.h
Expand Up @@ -42,7 +42,7 @@ class CORE_EXPORT QgsUndoCommand : public QUndoCommand
public:

/** change structure for attribute for undo/redo purpose */
class AttributeChangeEntry
class CORE_EXPORT AttributeChangeEntry
{
public:
bool isFirstChange;
Expand All @@ -53,7 +53,7 @@ class CORE_EXPORT QgsUndoCommand : public QUndoCommand
typedef QMap<int, AttributeChangeEntry> AttributeChanges;

/** change structure to geometry for undo/redo purpose */
class GeometryChangeEntry
class CORE_EXPORT GeometryChangeEntry
{
public:
GeometryChangeEntry();
Expand Down
6 changes: 4 additions & 2 deletions src/core/raster/qgsrasterfilewriter.cpp
Expand Up @@ -166,7 +166,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs

bool srcHasNoDataValue = srcProvider->srcHasNoDataValue( bandNo );
bool destHasNoDataValue = false;
double destNoDataValue;
double destNoDataValue = std::numeric_limits::quiet_NaN();
QgsRasterInterface::DataType destDataType = srcProvider->srcDataType( bandNo );
//QgsRasterInterface::DataType destDataType = srcProvider->dataType( bandNo );
// TODO: verify what happens/should happen if srcNoDataValue is disabled by setUseSrcNoDataValue
Expand Down Expand Up @@ -219,7 +219,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
destHasNoDataValue = true;
}
}
if ( nuller ) nuller->setOutputNoData( destNoDataValue );

if ( nuller && destHasNoDataValue )
nuller->setOutputNoData( destNoDataValue );

QgsDebugMsg( QString( "bandNo = %1 destDataType = %2 destHasNoDataValue = %3 destNoDataValue = %4" ).arg( bandNo ).arg( destDataType ).arg( destHasNoDataValue ).arg( destNoDataValue ) );
destDataTypeList.append( destDataType );
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgsrendererv2.h
Expand Up @@ -199,5 +199,6 @@ class CORE_EXPORT QgsFeatureRendererV2
int mCurrentVertexMarkerSize;
};

class QgsRendererV2Widget; // why does SIP fail, when this isn't here

#endif // QGSRENDERERV2_H

0 comments on commit 74fd0e4

Please sign in to comment.