mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
fix some warnings
This commit is contained in:
parent
3ecf6e6546
commit
cec5bdeb0d
@ -12,7 +12,7 @@ class QgsHistogram
|
||||
%End
|
||||
|
||||
public:
|
||||
|
||||
|
||||
QgsHistogram();
|
||||
|
||||
virtual ~QgsHistogram();
|
||||
@ -61,6 +61,6 @@ class QgsHistogram
|
||||
* @note values must first be specified using @link setValues @endlink
|
||||
*/
|
||||
QList<int> counts( int bins ) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -317,9 +317,9 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
||||
|
||||
void setAngle( double angle );
|
||||
double angle() const;
|
||||
|
||||
/** Sets the line angle modification for the symbol's angle. This angle is added to
|
||||
* the marker's rotation and data defined rotation before rendering the symbol, and
|
||||
|
||||
/** Sets the line angle modification for the symbol's angle. This angle is added to
|
||||
* the marker's rotation and data defined rotation before rendering the symbol, and
|
||||
* is usually used for orienting symbols to match a line's angle.
|
||||
* @param lineangle Angle in degrees, valid values are between 0 and 360
|
||||
* @note added in QGIS 2.9
|
||||
|
@ -236,9 +236,9 @@ class QgsMarkerSymbolV2 : QgsSymbolV2
|
||||
|
||||
void setAngle( double angle );
|
||||
double angle();
|
||||
|
||||
/** Sets the line angle modification for the symbol's angle. This angle is added to
|
||||
* the marker's rotation and data defined rotation before rendering the symbol, and
|
||||
|
||||
/** Sets the line angle modification for the symbol's angle. This angle is added to
|
||||
* the marker's rotation and data defined rotation before rendering the symbol, and
|
||||
* is usually used for orienting symbols to match a line's angle.
|
||||
* @param lineangle Angle in degrees, valid values are between 0 and 360
|
||||
* @note added in QGIS 2.9
|
||||
|
@ -21,7 +21,7 @@ class QgsHistogramWidget : QWidget
|
||||
* @param fieldOrExp field name or expression string
|
||||
*/
|
||||
QgsHistogramWidget( QWidget *parent /TransferThis/ = 0, QgsVectorLayer* layer = 0, const QString& fieldOrExp = QString() );
|
||||
|
||||
|
||||
~QgsHistogramWidget();
|
||||
|
||||
/** Returns the layer currently associated with the widget.
|
||||
|
@ -598,6 +598,7 @@ QGis::GeometryType QgsVectorLayer::geometryType() const
|
||||
return QGis::Polygon;
|
||||
|
||||
case QGis::WKBNoGeometry:
|
||||
case QGis::WKBUnknown:
|
||||
return QGis::NoGeometry;
|
||||
}
|
||||
QgsDebugMsg( QString( "Data Provider Geometry type is not recognised, is %1" ).arg( type ) );
|
||||
|
@ -272,15 +272,15 @@ class CORE_EXPORT QgsFeatureRendererV2
|
||||
|
||||
QgsPaintEffect* mPaintEffect;
|
||||
|
||||
/**@note this function is used to convert old sizeScale expresssions to symbol
|
||||
/**@note this function is used to convert old sizeScale expresssions to symbol
|
||||
* level DataDefined size
|
||||
*/
|
||||
static void convertSymbolSizeScale( QgsSymbolV2 * symbol, QgsSymbolV2::ScaleMethod method, const QString & field );
|
||||
/**@note this function is used to convert old rotations expresssions to symbol
|
||||
/**@note this function is used to convert old rotations expresssions to symbol
|
||||
* level DataDefined angle
|
||||
*/
|
||||
static void convertSymbolRotation( QgsSymbolV2 * symbol, const QString & field );
|
||||
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY( QgsFeatureRendererV2 )
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ QgsPhotoWidgetWrapper::QgsPhotoWidgetWrapper( QgsVectorLayer* vl, int fieldIdx,
|
||||
, mButton( 0 )
|
||||
{
|
||||
#ifdef WITH_QTWEBKIT
|
||||
mWebView = 0;
|
||||
mWebView = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,6 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define QGISEXTERN extern "C" __declspec( dllexport )
|
||||
#else
|
||||
#define QGISEXTERN extern "C"
|
||||
#endif
|
||||
|
||||
static const QString name_ = QObject::tr( "Spatial Query Plugin" );
|
||||
static const QString description_ = QObject::tr( "A plugin that makes spatial queries on vector layers" );
|
||||
static const QString category_ = QObject::tr( "Vector" );
|
||||
|
@ -161,7 +161,9 @@ QGis::DataType QgsGdalProviderBase::dataTypeFromGdal( const GDALDataType theGdal
|
||||
case GDT_CInt32: return QGis::CInt32;
|
||||
case GDT_CFloat32: return QGis::CFloat32;
|
||||
case GDT_CFloat64: return QGis::CFloat64;
|
||||
case GDT_Unknown: return QGis::UnknownDataType;
|
||||
case GDT_Unknown:
|
||||
case GDT_TypeCount:
|
||||
return QGis::UnknownDataType;
|
||||
}
|
||||
return QGis::UnknownDataType;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ bool QgsGrassFeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
|
||||
feature.setFeatureId( featureId );
|
||||
feature.initAttributes( mSource->mFields.count() );
|
||||
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
|
||||
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
|
||||
|
||||
if ( mRequest.flags() & QgsFeatureRequest::NoGeometry )
|
||||
feature.setGeometry( 0 );
|
||||
|
@ -159,15 +159,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
|
||||
QgsDebugMsg( "uri = " + uri );
|
||||
|
||||
QgsGrassObject rasterObject( mGisdbase, mLocation, mName, name, QgsGrassObject::Raster );
|
||||
bool isExternal = false;
|
||||
if ( QgsGrass::isExternal( rasterObject ) )
|
||||
{
|
||||
isExternal = true;
|
||||
//rasterObject.setName( rasterObject.name() + " external" );
|
||||
}
|
||||
QgsGrassRasterItem *layer = new QgsGrassRasterItem( this, rasterObject, path, uri, QgsGrass::isExternal( rasterObject ) );
|
||||
|
||||
|
||||
items.append( layer );
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "qgspostgresexpressioncompiler.h"
|
||||
|
||||
QgsPostgresExpressionCompiler::QgsPostgresExpressionCompiler( QgsPostgresFeatureSource* source )
|
||||
: mResult( None )
|
||||
, mSource( source )
|
||||
: mResult( None )
|
||||
, mSource( source )
|
||||
{
|
||||
}
|
||||
|
||||
@ -29,19 +29,19 @@ QgsPostgresExpressionCompiler::~QgsPostgresExpressionCompiler()
|
||||
QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( const QgsExpression* exp )
|
||||
{
|
||||
if ( exp->rootNode() )
|
||||
return compile ( exp->rootNode(), mResult );
|
||||
return compile( exp->rootNode(), mResult );
|
||||
else
|
||||
return Fail;
|
||||
}
|
||||
|
||||
QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( const QgsExpression::Node* node, QString& result )
|
||||
{
|
||||
switch( node->nodeType() )
|
||||
switch ( node->nodeType() )
|
||||
{
|
||||
case QgsExpression::ntUnaryOperator:
|
||||
{
|
||||
const QgsExpression::NodeUnaryOperator* n = static_cast<const QgsExpression::NodeUnaryOperator*>( node );
|
||||
switch( n->op() )
|
||||
switch ( n->op() )
|
||||
{
|
||||
case QgsExpression::uoNot:
|
||||
break;
|
||||
@ -55,14 +55,9 @@ QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( co
|
||||
|
||||
case QgsExpression::ntBinaryOperator:
|
||||
{
|
||||
QString op;
|
||||
QString left;
|
||||
QString right;
|
||||
Result lr;
|
||||
Result rr;
|
||||
|
||||
const QgsExpression::NodeBinaryOperator* n = static_cast<const QgsExpression::NodeBinaryOperator*>( node );
|
||||
|
||||
QString op;
|
||||
switch ( n->op() )
|
||||
{
|
||||
case QgsExpression::boEQ:
|
||||
@ -85,6 +80,14 @@ QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( co
|
||||
op = "<";
|
||||
break;
|
||||
|
||||
case QgsExpression::boIs:
|
||||
op = "IS";
|
||||
break;
|
||||
|
||||
case QgsExpression::boIsNot:
|
||||
op = "IS NOT";
|
||||
break;
|
||||
|
||||
case QgsExpression::boLike:
|
||||
op = "LIKE";
|
||||
break;
|
||||
@ -93,6 +96,14 @@ QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( co
|
||||
op = "ILIKE";
|
||||
break;
|
||||
|
||||
case QgsExpression::boNotLike:
|
||||
op = "NOT LIKE";
|
||||
break;
|
||||
|
||||
case QgsExpression::boNotILike:
|
||||
op = "NOT ILIKE";
|
||||
break;
|
||||
|
||||
case QgsExpression::boOr:
|
||||
op = "OR";
|
||||
break;
|
||||
@ -104,27 +115,55 @@ QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( co
|
||||
case QgsExpression::boNE:
|
||||
op = "<>";
|
||||
break;
|
||||
|
||||
case QgsExpression::boMul:
|
||||
op = "*";
|
||||
break;
|
||||
|
||||
case QgsExpression::boPlus:
|
||||
op = "+";
|
||||
break;
|
||||
|
||||
case QgsExpression::boMinus:
|
||||
op = "-";
|
||||
break;
|
||||
|
||||
case QgsExpression::boDiv:
|
||||
return Fail; // handle cast to real
|
||||
|
||||
case QgsExpression::boMod:
|
||||
op = "%";
|
||||
break;
|
||||
|
||||
case QgsExpression::boConcat:
|
||||
op = "||";
|
||||
break;
|
||||
|
||||
case QgsExpression::boIntDiv:
|
||||
return Fail; // handle cast to int
|
||||
|
||||
case QgsExpression::boPow:
|
||||
op = "^";
|
||||
break;
|
||||
|
||||
case QgsExpression::boRegexp:
|
||||
op = "~";
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !op.isNull() )
|
||||
{
|
||||
lr = compile( n->opLeft(), left );
|
||||
rr = compile( n->opRight(), right );
|
||||
result = left + " " + op + " " + right;
|
||||
return ( lr == Complete && rr == Complete ) ? Complete : Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( op.isNull() )
|
||||
return Fail;
|
||||
}
|
||||
|
||||
break;
|
||||
QString left;
|
||||
Result lr( compile( n->opLeft(), left ) );
|
||||
|
||||
QString right;
|
||||
Result rr( compile( n->opRight(), right ) );
|
||||
|
||||
result = left + " " + op + " " + right;
|
||||
return ( lr == Complete && rr == Complete ) ? Complete : Fail;
|
||||
}
|
||||
|
||||
case QgsExpression::ntFunction:
|
||||
return Fail;
|
||||
break;
|
||||
|
||||
case QgsExpression::ntLiteral:
|
||||
{
|
||||
const QgsExpression::NodeLiteral* n = static_cast<const QgsExpression::NodeLiteral*>( node );
|
||||
@ -136,17 +175,20 @@ QgsPostgresExpressionCompiler::Result QgsPostgresExpressionCompiler::compile( co
|
||||
{
|
||||
const QgsExpression::NodeColumnRef* n = static_cast<const QgsExpression::NodeColumnRef*>( node );
|
||||
|
||||
if ( mSource->mFields.indexFromName( n->name() ) != -1 )
|
||||
{
|
||||
result = QgsPostgresConn::quotedIdentifier( n->name() );
|
||||
return Complete;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mSource->mFields.indexFromName( n->name() ) == -1 )
|
||||
// Not a provider field
|
||||
return Fail;
|
||||
}
|
||||
|
||||
result = QgsPostgresConn::quotedIdentifier( n->name() );
|
||||
|
||||
return Complete;
|
||||
}
|
||||
|
||||
case QgsExpression::ntFunction:
|
||||
case QgsExpression::ntCondition:
|
||||
case QgsExpression::ntInOperator:
|
||||
break;
|
||||
}
|
||||
|
||||
return Fail;
|
||||
}
|
||||
|
@ -22,7 +22,8 @@
|
||||
class QgsPostgresExpressionCompiler
|
||||
{
|
||||
public:
|
||||
enum Result {
|
||||
enum Result
|
||||
{
|
||||
None,
|
||||
Complete,
|
||||
Partial,
|
||||
|
@ -34,7 +34,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
|
||||
, mFeatureQueueSize( sFeatureQueueSize )
|
||||
, mFetched( 0 )
|
||||
, mFetchGeometry( false )
|
||||
, mExpressionCompiled( false)
|
||||
, mExpressionCompiled( false )
|
||||
{
|
||||
if ( !source->mTransactionConnection )
|
||||
{
|
||||
@ -165,8 +165,7 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsGeometry* featureGeom = mFeatureQueue.front().geometryAndOwnership();
|
||||
feature.setGeometry( featureGeom );
|
||||
feature.setGeometry( mFeatureQueue.front().geometryAndOwnership() );
|
||||
}
|
||||
feature.setFeatureId( mFeatureQueue.front().id() );
|
||||
feature.setAttributes( mFeatureQueue.front().attributes() );
|
||||
|
@ -86,7 +86,7 @@ class QgsPostgresFeatureIterator : public QgsAbstractFeatureIteratorFromSource<Q
|
||||
virtual bool fetchFeature( QgsFeature& feature ) override;
|
||||
|
||||
//! fetch next feature filter expression
|
||||
bool nextFeatureFilterExpression(QgsFeature& f);
|
||||
bool nextFeatureFilterExpression( QgsFeature& f );
|
||||
|
||||
//! Setup the simplification of geometries to fetch using the specified simplify method
|
||||
virtual bool prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) override;
|
||||
|
@ -497,7 +497,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
|
||||
closeDb();
|
||||
return;
|
||||
}
|
||||
enabledCapabilities = mPrimaryKey.isEmpty() ? 0 : (QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId);
|
||||
enabledCapabilities = mPrimaryKey.isEmpty() ? 0 : ( QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId );
|
||||
if (( mTableBased || mViewBased ) && !mReadOnly )
|
||||
{
|
||||
// enabling editing only for Tables [excluding Views and VirtualShapes]
|
||||
|
@ -956,384 +956,354 @@ bool QgsSLDConfigParser::rasterSymbologyFromUserStyle( const QDomElement& userSt
|
||||
bool QgsSLDConfigParser::labelSettingsFromUserStyle( const QDomElement& userStyleElement, QgsVectorLayer* vec ) const
|
||||
{
|
||||
if ( userStyleElement.isNull() || !vec )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
vec->enableLabels( false );
|
||||
QDomNodeList featureTypeList = userStyleElement.elementsByTagName( "FeatureTypeStyle" );
|
||||
if ( featureTypeList.size() <= 0 )
|
||||
return false;
|
||||
|
||||
//QGIS WMS server only supports one featureTypeStyle per layer
|
||||
QDomNodeList ruleNodeList = featureTypeList.item( 0 ).toElement().elementsByTagName( "Rule" );
|
||||
// if there are rule elements:
|
||||
if ( ruleNodeList.size() <= 0 )
|
||||
return false;
|
||||
|
||||
// rule element
|
||||
QDomElement ruleElement = ruleNodeList.item( ruleNodeList.size() - 1 ).toElement();
|
||||
//find <TextSymbolizer>.
|
||||
//Unfortunately, QGIS does not support having different labels for different classifications.
|
||||
//Therefore we take the last text symbolizer for all features
|
||||
QDomNodeList textSymbolizerList = ruleElement.elementsByTagName( "TextSymbolizer" );
|
||||
// if there are textSymbolizers
|
||||
if ( textSymbolizerList.size() <= 0 )
|
||||
return false;
|
||||
|
||||
int opacity = 255;
|
||||
int polyColorRed = 0;
|
||||
int polyColorGreen = 0;
|
||||
int polyColorBlue = 0;
|
||||
QString elemText;
|
||||
QString fontfamily = QString( "Helvetica" );
|
||||
QString fontstyle = QString( "Normal" );
|
||||
int fontsize = 14;
|
||||
QString fontweight = QString( "Normal" );
|
||||
QString fontunderline = QString( "Normal" );
|
||||
bool success = false;
|
||||
|
||||
QDomElement textSymbolizerElement = textSymbolizerList.item( textSymbolizerList.size() - 1 ).toElement();
|
||||
// if there is a viable text textSymbolizerElement
|
||||
if ( textSymbolizerElement.isNull() )
|
||||
return false;
|
||||
|
||||
QgsLabelAttributes * myLabelAttributes = vec->label()->labelAttributes();
|
||||
//element <Label> contains the attribute name
|
||||
QDomNodeList labelNodeList = textSymbolizerElement.elementsByTagName( "Label" );
|
||||
// if a viable label element is provided
|
||||
if ( labelNodeList.size() <= 0 )
|
||||
//from the specs: 'if a Label element is not provided ... then no text will be rendered'
|
||||
return false;
|
||||
|
||||
QDomElement labelElement = labelNodeList.item( 0 ).toElement();
|
||||
//we need the text of an <ogc:PropertyName> element
|
||||
QDomNodeList propertyNameList = labelElement.elementsByTagName( "PropertyName" );
|
||||
if ( propertyNameList.size() <= 0 )
|
||||
return false;
|
||||
|
||||
vec->enableLabels( true );
|
||||
QDomElement propertyNameElement = propertyNameList.item( 0 ).toElement();
|
||||
QString labelAttribute = propertyNameElement.text();
|
||||
vec->label()->setLabelField( QgsLabel::Text, vec->dataProvider()->fieldNameIndex( labelAttribute ) );
|
||||
|
||||
// Iterate through each of CssParameter from the sld:font, sld:fill, sld:halo
|
||||
QDomNodeList labelFontElementList = textSymbolizerElement.elementsByTagName( "Font" );
|
||||
QDomNodeList labelFillElementList = textSymbolizerElement.elementsByTagName( "Fill" );
|
||||
QDomNodeList labelBufferElementList = textSymbolizerElement.elementsByTagName( "Halo" );
|
||||
QDomNodeList labelPlacementElementList = textSymbolizerElement.elementsByTagName( "LabelPlacement" );
|
||||
// Iterate through sld:font
|
||||
if (( labelFontElementList.size() > 0 ) )
|
||||
{
|
||||
vec->enableLabels( false );
|
||||
QDomNodeList featureTypeList = userStyleElement.elementsByTagName( "FeatureTypeStyle" );
|
||||
if ( featureTypeList.size() > 0 )
|
||||
if ( !labelFontElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
//QGIS WMS server only supports one featureTypeStyle per layer
|
||||
QDomNodeList ruleNodeList = featureTypeList.item( 0 ).toElement().elementsByTagName( "Rule" );
|
||||
// if there are rule elements:
|
||||
if ( ruleNodeList.size() > 0 )
|
||||
QDomNodeList cssNodes = labelFontElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
// rule element
|
||||
QDomElement ruleElement = ruleNodeList.item( ruleNodeList.size() - 1 ).toElement();
|
||||
//find <TextSymbolizer>.
|
||||
//Unfortunately, QGIS does not support having different labels for different classifications.
|
||||
//Therefore we take the last text symbolizer for all features
|
||||
QDomNodeList textSymbolizerList = ruleElement.elementsByTagName( "TextSymbolizer" );
|
||||
// if there are textSymbolizers
|
||||
if ( textSymbolizerList.size() > 0 )
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
int opacity = 255;
|
||||
int polyColorRed = 0;
|
||||
int polyColorGreen = 0;
|
||||
int polyColorBlue = 0;
|
||||
QString elemText;
|
||||
QString fontfamily = QString( "Helvetica" );
|
||||
QString fontstyle = QString( "Normal" );
|
||||
int fontsize = 14;
|
||||
QString fontweight = QString( "Normal" );
|
||||
QString fontunderline = QString( "Normal" );
|
||||
bool success = false;
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
QDomElement textSymbolizerElement = textSymbolizerList.item( textSymbolizerList.size() - 1 ).toElement();
|
||||
// if there is a viable text textSymbolizerElement
|
||||
if ( !textSymbolizerElement.isNull() )
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "font-family" )
|
||||
{
|
||||
QgsLabelAttributes * myLabelAttributes = vec->label()->labelAttributes();
|
||||
//element <Label> contains the attribute name
|
||||
QDomNodeList labelNodeList = textSymbolizerElement.elementsByTagName( "Label" );
|
||||
// if a viable label element is provided
|
||||
if ( labelNodeList.size() > 0 )
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontfamily = elemText;
|
||||
}
|
||||
else if ( cssName == "font-style" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontstyle = elemText;
|
||||
}
|
||||
else if ( cssName == "font-size" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
success = false;
|
||||
fontsize = elemText.toInt( &success );
|
||||
if ( !success )
|
||||
{
|
||||
QDomElement labelElement = labelNodeList.item( 0 ).toElement();
|
||||
//we need the text of an <ogc:PropertyName> element
|
||||
QDomNodeList propertyNameList = labelElement.elementsByTagName( "PropertyName" );
|
||||
if ( propertyNameList.size() > 0 )
|
||||
fontsize = 12;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( cssName == "font-weight" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontweight = elemText;
|
||||
}
|
||||
else if ( cssName == "font-underline" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontunderline = elemText;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through sld:fill
|
||||
if (( labelFillElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelFillElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
QDomNodeList cssNodes = labelFillElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "fill" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
//accept input in the form of #ff0000
|
||||
if ( elemText.length() == 7 )
|
||||
{
|
||||
bool success;
|
||||
polyColorRed = elemText.mid( 1, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
vec->enableLabels( true );
|
||||
QDomElement propertyNameElement = propertyNameList.item( 0 ).toElement();
|
||||
QString labelAttribute = propertyNameElement.text();
|
||||
vec->label()->setLabelField( QgsLabel::Text, vec->dataProvider()->fieldNameIndex( labelAttribute ) );
|
||||
|
||||
// Iterate through each of CssParameter from the sld:font, sld:fill, sld:halo
|
||||
QDomNodeList labelFontElementList = textSymbolizerElement.elementsByTagName( "Font" );
|
||||
QDomNodeList labelFillElementList = textSymbolizerElement.elementsByTagName( "Fill" );
|
||||
QDomNodeList labelBufferElementList = textSymbolizerElement.elementsByTagName( "Halo" );
|
||||
QDomNodeList labelPlacementElementList = textSymbolizerElement.elementsByTagName( "LabelPlacement" );
|
||||
// Iterate through sld:font
|
||||
if (( labelFontElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelFontElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
QDomNodeList cssNodes = labelFontElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "font-family" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontfamily = elemText;
|
||||
}
|
||||
else if ( cssName == "font-style" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontstyle = elemText;
|
||||
}
|
||||
else if ( cssName == "font-size" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
success = false;
|
||||
fontsize = elemText.toInt( &success );
|
||||
if ( !success )
|
||||
{
|
||||
fontsize = 12;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( cssName == "font-weight" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontweight = elemText;
|
||||
}
|
||||
else if ( cssName == "font-underline" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
fontunderline = elemText;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// Iterate through sld:fill
|
||||
if (( labelFillElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelFillElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
QDomNodeList cssNodes = labelFillElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "fill" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
//accept input in the form of #ff0000
|
||||
if ( elemText.length() == 7 )
|
||||
{
|
||||
bool success;
|
||||
polyColorRed = elemText.mid( 1, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorRed = 0;
|
||||
}
|
||||
polyColorGreen = elemText.mid( 3, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorGreen = 0;
|
||||
}
|
||||
polyColorBlue = elemText.mid( 5, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorBlue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cssName == "fill-opacity" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
bool success;
|
||||
double op = elemText.toDouble( &success );
|
||||
if ( success )
|
||||
{
|
||||
if ( op > 1.0 )
|
||||
{
|
||||
opacity = 255;
|
||||
}
|
||||
else if ( op < 0.0 )
|
||||
{
|
||||
opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
opacity = ( int )( 255 * op );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
myLabelAttributes->setSize( fontsize, QgsLabelAttributes::PointUnits );
|
||||
myLabelAttributes->setFamily( fontfamily );
|
||||
myLabelAttributes->setColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
|
||||
if (( fontstyle == "italic" ) || ( fontstyle == "Italic" ) )
|
||||
{
|
||||
myLabelAttributes->setItalic( true );
|
||||
}
|
||||
if (( fontweight == "bold" ) || ( fontweight == "Bold" ) )
|
||||
{
|
||||
myLabelAttributes->setBold( true );
|
||||
}
|
||||
if (( fontunderline == "underline" ) || ( fontunderline == "Underline" ) )
|
||||
{
|
||||
myLabelAttributes->setUnderline( true );
|
||||
}
|
||||
// set label buffer(sld:halo)
|
||||
|
||||
if (( labelBufferElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelBufferElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
QDomNodeList cssNodes = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "fill" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
//accept input in the form of #ff0000
|
||||
if ( elemText.length() == 7 )
|
||||
{
|
||||
bool success;
|
||||
polyColorRed = elemText.mid( 1, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorRed = 255;
|
||||
}
|
||||
polyColorGreen = elemText.mid( 3, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorGreen = 255;
|
||||
}
|
||||
polyColorBlue = elemText.mid( 5, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorBlue = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cssName == "fill-opacity" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
bool success;
|
||||
double op = elemText.toDouble( &success );
|
||||
if ( success )
|
||||
{
|
||||
if ( op > 1.0 )
|
||||
{
|
||||
opacity = 255;
|
||||
}
|
||||
else if ( op < 0.0 )
|
||||
{
|
||||
opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
opacity = ( int )( 255 * op );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
|
||||
myLabelAttributes->setBufferEnabled( true );
|
||||
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
|
||||
|
||||
#if 0
|
||||
double radius = 5.0;
|
||||
QDomElement radiusElement = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "Radius" ).item( 0 ).toElement();
|
||||
if ( !radiusElement.isNull() )
|
||||
{
|
||||
bool success = false;
|
||||
radius = radiusElement.text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
radius = 5.0;
|
||||
}
|
||||
}
|
||||
myLabelAttributes->setBufferSize( radius, QgsLabelAttributes::PointUnits );
|
||||
#endif
|
||||
|
||||
// ******** BUG ************ see why setting buffersize dows not work (is a problem in QGIS vector layer rendering)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// label placement
|
||||
if (( labelPlacementElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelPlacementElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
double displacementX = 0.0;
|
||||
double displacementY = 0.0;
|
||||
double rotationAngle = 0.0;
|
||||
|
||||
QDomElement pointPlacementElement = labelPlacementElementList.item( 0 ).toElement().elementsByTagName( "PointPlacement" ).item( 0 ).toElement();
|
||||
if ( !pointPlacementElement.isNull() )
|
||||
{
|
||||
bool success = false;
|
||||
rotationAngle = pointPlacementElement.elementsByTagName( "Rotation" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
rotationAngle = 0.0;
|
||||
}
|
||||
success = false;
|
||||
displacementX = pointPlacementElement.elementsByTagName( "DisplacementX" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
displacementX = 0.0;
|
||||
}
|
||||
displacementY = pointPlacementElement.elementsByTagName( "DisplacementY" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
displacementY = 0.0;
|
||||
}
|
||||
}
|
||||
QgsDebugMsg( "rotationAngle " + QString::number( rotationAngle ) );
|
||||
|
||||
myLabelAttributes->setOffset( displacementX, displacementY, QgsLabelAttributes::PointUnits );
|
||||
myLabelAttributes->setAngle( rotationAngle );
|
||||
}
|
||||
} // end labelPlacement
|
||||
vec->enableLabels( true );
|
||||
return true;
|
||||
polyColorRed = 0;
|
||||
}
|
||||
polyColorGreen = elemText.mid( 3, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorGreen = 0;
|
||||
}
|
||||
polyColorBlue = elemText.mid( 5, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorBlue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cssName == "fill-opacity" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
bool success;
|
||||
double op = elemText.toDouble( &success );
|
||||
if ( success )
|
||||
{
|
||||
if ( op > 1.0 )
|
||||
{
|
||||
opacity = 255;
|
||||
}
|
||||
else if ( op < 0.0 )
|
||||
{
|
||||
opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
opacity = ( int )( 255 * op );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//from the specs: 'if a Label element is not provided ... then no text will be rendered'
|
||||
return false;
|
||||
} // end if a viable label element is provided
|
||||
|
||||
} // end if there is a viable text textSymbolizerElement
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end if there are textSymbolizers
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // end if there are rule elements
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
myLabelAttributes->setSize( fontsize, QgsLabelAttributes::PointUnits );
|
||||
myLabelAttributes->setFamily( fontfamily );
|
||||
myLabelAttributes->setColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
|
||||
if (( fontstyle == "italic" ) || ( fontstyle == "Italic" ) )
|
||||
{
|
||||
myLabelAttributes->setItalic( true );
|
||||
}
|
||||
if (( fontweight == "bold" ) || ( fontweight == "Bold" ) )
|
||||
{
|
||||
myLabelAttributes->setBold( true );
|
||||
}
|
||||
if (( fontunderline == "underline" ) || ( fontunderline == "Underline" ) )
|
||||
{
|
||||
myLabelAttributes->setUnderline( true );
|
||||
}
|
||||
// set label buffer(sld:halo)
|
||||
|
||||
if (( labelBufferElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelBufferElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
return false;
|
||||
QDomNodeList cssNodes = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
|
||||
QString cssName;
|
||||
QDomElement currentElement;
|
||||
QgsDebugMsg( "Number of Css Properties: " + QString::number( cssNodes.size() ) );
|
||||
for ( int i = 0; i < cssNodes.size(); ++i )
|
||||
{
|
||||
currentElement = cssNodes.item( i ).toElement();
|
||||
if ( currentElement.isNull() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QString elemText = currentElement.text();
|
||||
|
||||
//switch depending on attribute 'name'
|
||||
cssName = currentElement.attribute( "name", "not_found" );
|
||||
QgsDebugMsg( "property " + QString::number( i ) + ": " + cssName + " " + elemText );
|
||||
if ( cssName != "not_found" )
|
||||
{
|
||||
if ( cssName == "fill" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
//accept input in the form of #ff0000
|
||||
if ( elemText.length() == 7 )
|
||||
{
|
||||
bool success;
|
||||
polyColorRed = elemText.mid( 1, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorRed = 255;
|
||||
}
|
||||
polyColorGreen = elemText.mid( 3, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorGreen = 255;
|
||||
}
|
||||
polyColorBlue = elemText.mid( 5, 2 ).toInt( &success, 16 );
|
||||
if ( !success )
|
||||
{
|
||||
polyColorBlue = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cssName == "fill-opacity" )
|
||||
{
|
||||
QgsDebugMsg( cssName + " " + elemText );
|
||||
bool success;
|
||||
double op = elemText.toDouble( &success );
|
||||
if ( success )
|
||||
{
|
||||
if ( op > 1.0 )
|
||||
{
|
||||
opacity = 255;
|
||||
}
|
||||
else if ( op < 0.0 )
|
||||
{
|
||||
opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
opacity = ( int )( 255 * op );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
|
||||
myLabelAttributes->setBufferEnabled( true );
|
||||
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
|
||||
|
||||
#if 0
|
||||
double radius = 5.0;
|
||||
QDomElement radiusElement = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "Radius" ).item( 0 ).toElement();
|
||||
if ( !radiusElement.isNull() )
|
||||
{
|
||||
bool success = false;
|
||||
radius = radiusElement.text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
radius = 5.0;
|
||||
}
|
||||
}
|
||||
myLabelAttributes->setBufferSize( radius, QgsLabelAttributes::PointUnits );
|
||||
#endif
|
||||
|
||||
// ******** BUG ************ see why setting buffersize dows not work (is a problem in QGIS vector layer rendering)
|
||||
|
||||
}
|
||||
} // end else from the beginning
|
||||
}
|
||||
|
||||
// label placement
|
||||
if (( labelPlacementElementList.size() > 0 ) )
|
||||
{
|
||||
if ( !labelPlacementElementList.item( 0 ).toElement().isNull() )
|
||||
{
|
||||
double displacementX = 0.0;
|
||||
double displacementY = 0.0;
|
||||
double rotationAngle = 0.0;
|
||||
|
||||
QDomElement pointPlacementElement = labelPlacementElementList.item( 0 ).toElement().elementsByTagName( "PointPlacement" ).item( 0 ).toElement();
|
||||
if ( !pointPlacementElement.isNull() )
|
||||
{
|
||||
bool success = false;
|
||||
rotationAngle = pointPlacementElement.elementsByTagName( "Rotation" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
rotationAngle = 0.0;
|
||||
}
|
||||
success = false;
|
||||
displacementX = pointPlacementElement.elementsByTagName( "DisplacementX" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
displacementX = 0.0;
|
||||
}
|
||||
displacementY = pointPlacementElement.elementsByTagName( "DisplacementY" ).item( 0 ).toElement().text().toDouble( &success );
|
||||
if ( !success )
|
||||
{
|
||||
displacementY = 0.0;
|
||||
}
|
||||
}
|
||||
QgsDebugMsg( "rotationAngle " + QString::number( rotationAngle ) );
|
||||
|
||||
myLabelAttributes->setOffset( displacementX, displacementY, QgsLabelAttributes::PointUnits );
|
||||
myLabelAttributes->setAngle( rotationAngle );
|
||||
}
|
||||
} // end labelPlacement
|
||||
vec->enableLabels( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& userStyleElem, QgsRasterLayer* rasterLayer ) const
|
||||
|
@ -2150,7 +2150,7 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
|
||||
fields.append( QgsField( layer->bandName( it.key() ), QVariant::Double ) );
|
||||
feature.setAttribute( index++, QString::number( it.value().toDouble() ) );
|
||||
}
|
||||
feature.setFields( &fields );
|
||||
feature.setFields( fields );
|
||||
|
||||
QgsCoordinateReferenceSystem layerCrs = layer->crs();
|
||||
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
|
||||
|
@ -130,7 +130,7 @@ void TestQgsHistogram::fromLayer()
|
||||
{
|
||||
QgsHistogram h;
|
||||
|
||||
QVERIFY( !h.setValues( 0, QString() ));
|
||||
QVERIFY( !h.setValues( 0, QString() ) );
|
||||
|
||||
QgsVectorLayer* layer = new QgsVectorLayer( "Point?field=col1:real", "layer", "memory" );
|
||||
QVERIFY( layer->isValid() );
|
||||
@ -143,7 +143,7 @@ void TestQgsHistogram::fromLayer()
|
||||
}
|
||||
layer->dataProvider()->addFeatures( features );
|
||||
|
||||
QVERIFY( !h.setValues( layer, QString() ));
|
||||
QVERIFY( !h.setValues( layer, QString() ) );
|
||||
QVERIFY( h.setValues( layer, QString( "col1" ) ) );
|
||||
QList<int>counts = h.counts( 5 );
|
||||
QList<int> expected;
|
||||
|
Loading…
x
Reference in New Issue
Block a user