Skip to content
Permalink
Browse files

Clean up code related to old overlay object system

  • Loading branch information
mhugent committed Jul 6, 2013
1 parent 17b09c2 commit 8f9b89dd677823c3944e2c65385aabab5928a8e0
@@ -15,7 +15,6 @@ which are not wrapped by PyQt:
- QMap<double, TYPE>
- QMultiMap<double, TYPE2>
- QMap<qint64, TYPE>
- QMap<qint64, QgsOverlayObject*>
- QList< QPair< QString, QList<QString> > >
- QVector<TYPE*>
- QMap<qint64, QgsFeature*>
@@ -1323,94 +1322,6 @@ template<double, TYPE2>
%End
};



%MappedType QMap<qint64, QgsOverlayObject*>
{
%TypeHeaderCode
#include <QMap>
#if (SIP_VERSION >= 0x040900)
#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString))
#endif
#if (SIP_VERSION >= 0x040900 && SIP_VERSION < 0x040c01)
#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
#endif
%End

%ConvertFromTypeCode

//convert map to a python dictionary
PyObject *d;

if ((d = PyDict_New()) == NULL)
return NULL;

for (QMap<qint64, QgsOverlayObject*>::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it)
{
QgsOverlayObject* oobj = new QgsOverlayObject(*it.value());

PyObject* keyobj = PyInt_FromLong(it.key());
PyObject* pyOobj = sipConvertFromInstance(oobj, sipClass_QgsOverlayObject, sipTransferObj);
PyDict_SetItem(d, keyobj, pyOobj);

if(pyOobj == NULL || keyobj == NULL || PyDict_SetItem(d, keyobj, pyOobj) < 0)
{
Py_DECREF(d);

if (pyOobj)
{
Py_DECREF(pyOobj);
}

if (keyobj)
{
Py_DECREF(keyobj);
}
return NULL;
}
Py_DECREF(pyOobj);
Py_DECREF(keyobj);
}
return d;

%End
%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

QMap<qint64, QgsOverlayObject*> *qm = new QMap<qint64, QgsOverlayObject*>;

while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
{
int state;
//int t1 = (int)(PyFloat_AsDouble(t1obj));
qint64 t1 = PyLong_AsLongLong(t1obj);
QgsOverlayObject* t2 = reinterpret_cast<QgsOverlayObject*>(sipConvertToInstance(t2obj, sipClass_QgsOverlayObject, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t2, sipClass_QgsOverlayObject, state);
delete qm;
return 0;
}

qm->insert(t1, t2);

sipReleaseInstance(t2, sipClass_QgsOverlayObject, state);
}

*sipCppPtr = qm;

return sipGetState(sipTransferObj);
%End
};



%MappedType QList < QPair< QString, QList<QString> > >
{
%TypeHeaderCode
@@ -52,11 +52,8 @@
%Include qgsnetworkaccessmanager.sip
%Include qgsofflineediting.sip
%Include qgsogcutils.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
@@ -86,16 +83,13 @@
%Include qgsvectorlayerimport.sip
%Include qgsvectorlayerjoinbuffer.sip
%Include qgsvectorlayerundocommand.sip
%Include qgsvectoroverlay.sip
%Include qgsfontutils.sip

%Include qgscachedfeatureiterator.sip
%Include qgscacheindex.sip
%Include qgscacheindexfeatureid.sip
%Include qgscentralpointpositionmanager.sip
%Include qgsfeaturestore.sip
%Include qgsgeometrycache.sip
%Include qgspalobjectpositionmanager.sip
%Include qgsprojectfiletransform.sip
%Include qgsvectorlayereditutils.sip
%Include qgsvectorlayerfeatureiterator.sip

This file was deleted.

@@ -277,8 +277,4 @@ class QgsMapRenderer : QObject
* also sets the contents of the r2 parameter
*/
bool splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent, QgsRectangle& r2 );

/**Creates an overlay object position manager subclass according to the current settings
@note this method was added in version 1.1*/
QgsOverlayObjectPositionManager* overlayManagerFromSettings() /Factory/;
};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -827,26 +827,6 @@ class QgsVectorLayer : QgsMapLayer
**/
void setLabelOnTop( int idx, bool onTop );

/**Adds a new overlay to this class. QgsVectorLayer takes ownership of the object
@note this method was added in version 1.1
*/
void addOverlay( QgsVectorOverlay* overlay /Transfer/ );

/**Removes all overlays of a given type
@note this method was added in version 1.1
*/
void removeOverlay( const QString& typeName );

/**Returns pointers to the overlays of this layer
@note this method was added in version 1.1
*/
void vectorOverlays( QList<QgsVectorOverlay*>& overlayList /Out/ );

/**Returns the (first) overlay of a type, e.g. diagram or label
@note this method was added in version 1.1
*/
QgsVectorOverlay* findOverlayByType( const QString& typeName );

//! Buffer with uncommitted editing operations. Only valid after editing has been turned on.
QgsVectorLayerEditBuffer* editBuffer();

This file was deleted.

@@ -714,35 +714,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
groupBox_5->setEnabled( false );
#endif //Q_WS_MAC

//overlay placement algorithm
mOverlayAlgorithmComboBox->insertItem( 0, tr( "Central point (fastest)" ) );
mOverlayAlgorithmComboBox->insertItem( 1, tr( "Chain (fast)" ) );
mOverlayAlgorithmComboBox->insertItem( 2, tr( "Popmusic tabu chain (slow)" ) );
mOverlayAlgorithmComboBox->insertItem( 3, tr( "Popmusic tabu (slow)" ) );
mOverlayAlgorithmComboBox->insertItem( 4, tr( "Popmusic chain (very slow)" ) );

QString overlayAlgorithmString = settings.value( "qgis/overlayPlacementAlgorithm", "Central point" ).toString();
if ( overlayAlgorithmString == "Chain" )
{
mOverlayAlgorithmComboBox->setCurrentIndex( 1 );
}
else if ( overlayAlgorithmString == "Popmusic tabu chain" )
{
mOverlayAlgorithmComboBox->setCurrentIndex( 2 );
}
else if ( overlayAlgorithmString == "Popmusic tabu" )
{
mOverlayAlgorithmComboBox->setCurrentIndex( 3 );
}
else if ( overlayAlgorithmString == "Popmusic chain" )
{
mOverlayAlgorithmComboBox->setCurrentIndex( 4 );
}
else
{
mOverlayAlgorithmComboBox->setCurrentIndex( 0 );
} //default is central point

// load gdal driver list only when gdal tab is first opened
mLoadedGdalDriverList = false;

@@ -997,29 +968,6 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/nullValue", leNullValue->text() );
settings.setValue( "/qgis/style", cmbStyle->currentText() );

//overlay placement method
int overlayIndex = mOverlayAlgorithmComboBox->currentIndex();
if ( overlayIndex == 1 )
{
settings.setValue( "/qgis/overlayPlacementAlgorithm", "Chain" );
}
else if ( overlayIndex == 2 )
{
settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic tabu chain" );
}
else if ( overlayIndex == 3 )
{
settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic tabu" );
}
else if ( overlayIndex == 4 )
{
settings.setValue( "/qgis/overlayPlacementAlgorithm", "Popmusic chain" );
}
else
{
settings.setValue( "/qgis/overlayPlacementAlgorithm", "Central point" );
}

if ( cmbTheme->currentText().length() == 0 )
{
settings.setValue( "/Themes", "default" );
@@ -339,7 +339,6 @@ void QgsPluginRegistry::loadCppPlugin( QString theFullPathName )
{
case QgisPlugin::RENDERER:
case QgisPlugin::UI:
case QgisPlugin::VECTOR_OVERLAY:
{
// UI only -- doesn't use mapcanvas
create_ui *cf = ( create_ui * ) cast_to_fptr( myLib.resolve( "classFactory" ) );

0 comments on commit 8f9b89d

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