Skip to content
Permalink
Browse files

- QgsSymbolLayerV2 descendants missing from sip.

  QgsSymbolLayerV2 class has been modified to convert into SubClass as needed
- A test is provided for check subclasses binding and behaviour
- A fix has been done for src\core\symbology-ng\qgsellipsesymbollayerv2.cpp because of an error in createFromSld about fillColor

Signed-off-by: endmax <massimo.endrighi@geopartner.it>
  • Loading branch information
endmax committed Oct 2, 2012
1 parent 58e423a commit 7f208338ae965389b68f7f483c51de1e5694bdec
@@ -8,18 +8,52 @@ class QgsSymbolLayerV2
switch (sipCpp->type())
{
case QgsSymbolV2::Marker:
if( sipCpp->layerType() == "VectorField" )
{
sipClass = sipClass_QgsVectorFieldSymbolLayer;
}
else
{
if (dynamic_cast<QgsEllipseSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsEllipseSymbolLayerV2;
else if (dynamic_cast<QgsFontMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsFontMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSimpleMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleMarkerSymbolLayerV2;
else if (dynamic_cast<QgsSvgMarkerSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSvgMarkerSymbolLayerV2;
else if (dynamic_cast<QgsVectorFieldSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsVectorFieldSymbolLayer;
else
sipClass = sipClass_QgsMarkerSymbolLayerV2;
}
break;
case QgsSymbolV2::Line: sipClass = sipClass_QgsLineSymbolLayerV2; break;
case QgsSymbolV2::Fill: sipClass = sipClass_QgsFillSymbolLayerV2; break;
default: sipClass = 0; break;

case QgsSymbolV2::Line:
if (dynamic_cast<QgsLineDecorationSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsLineDecorationSymbolLayerV2;
else if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsMarkerLineSymbolLayerV2;
else if (dynamic_cast<QgsSimpleLineSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleLineSymbolLayerV2;
else
sipClass = sipClass_QgsLineSymbolLayerV2;
break;

case QgsSymbolV2::Fill:
if (dynamic_cast<QgsSimpleFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsSimpleFillSymbolLayerV2;
else if (dynamic_cast<QgsImageFillSymbolLayer*>(sipCpp) != NULL)
if (dynamic_cast<QgsLinePatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsLinePatternFillSymbolLayer;
else if (dynamic_cast<QgsPointPatternFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsPointPatternFillSymbolLayer;
else if (dynamic_cast<QgsSVGFillSymbolLayer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSVGFillSymbolLayer;
else
sipClass = sipClass_QgsImageFillSymbolLayer;
else if (dynamic_cast<QgsCentroidFillSymbolLayerV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsCentroidFillSymbolLayerV2;
else
sipClass = sipClass_QgsFillSymbolLayerV2;
break;

default:
sipClass = 0;
break;
}
%End

@@ -274,7 +274,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element )
return NULL;

QString name = "circle";
QColor color, borderColor;
QColor fillColor, borderColor;
double borderWidth, size;
double widthHeightFactor = 1.0;

@@ -290,7 +290,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element )
}
}

if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, color, borderColor, borderWidth, size ) )
if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, fillColor, borderColor, borderWidth, size ) )
return NULL;

double angle = 0.0;
@@ -305,7 +305,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element )

QgsEllipseSymbolLayerV2 *m = new QgsEllipseSymbolLayerV2();
m->setSymbolName( name );
m->setColor( color );
m->setFillColor( fillColor );
m->setOutlineColor( borderColor );
m->setOutlineWidth( borderWidth );
m->setSymbolWidth( size );
@@ -13,3 +13,4 @@ ADD_PYTHON_TEST(PyQgsComposerHtml test_qgscomposerhtml.py)
ADD_PYTHON_TEST(PyQgsComposition test_qgscomposition.py)
ADD_PYTHON_TEST(PyQgsAnalysis test_qgsanalysis.py)
#ADD_PYTHON_TEST(PyQgsComposerMap test_qgscomposermap.py)
ADD_PYTHON_TEST(PyQgsSymbolLayerV2 test_qgssymbollayerv2.py)

0 comments on commit 7f20833

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