3 changes: 2 additions & 1 deletion python/plugins/db_manager/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def __init__(self, editor, db=None):
wordlist = QStringList()
for name, value in dictionary.iteritems():
wordlist << value
wordlist = QStringList() << list(set( wordlist )) # remove duplicates

# setup the completer
QCompleter.__init__(self, sorted(wordlist), editor)
self.setModelSorting(QCompleter.CaseInsensitivelySortedModel)
self.setModelSorting(QCompleter.CaseSensitivelySortedModel)
self.setWrapAround(False)

if isinstance(editor, CompletionTextEdit):
Expand Down
14 changes: 13 additions & 1 deletion python/plugins/db_manager/db_plugins/postgis/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,5 +906,17 @@ def connection_error_types(self):

def getSqlDictionary(self):
from .sql_dictionary import getSqlDictionary
return getSqlDictionary()
sql_dict = getSqlDictionary()

# get schemas, tables and field names
items = []
sql = u"""SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_' AND nspname != 'information_schema'
UNION SELECT relname FROM pg_class WHERE relkind IN ('v', 'r')
UNION SELECT attname FROM pg_attribute WHERE attnum > 0"""
c = self._execute(None, sql)
for row in c.fetchall():
items.append( row[0] )

sql_dict["identifier"] = items
return sql_dict

12 changes: 11 additions & 1 deletion python/plugins/db_manager/db_plugins/spatialite/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,5 +593,15 @@ def connection_error_types(self):

def getSqlDictionary(self):
from .sql_dictionary import getSqlDictionary
return getSqlDictionary()
sql_dict = getSqlDictionary()

items = []
for tbl in self.getTables():
items.append( tbl[1] ) # table name

for fld in self.getTableFields( tbl[0] ):
items.append( fld[1] ) # field name

sql_dict["identifier"] = items
return sql_dict

18 changes: 13 additions & 5 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,12 +1948,20 @@ QgsExpression::Node* QgsExpression::NodeLiteral::createFromOgcFilter( QDomElemen
}
else
{
// probably a text/CDATA node, convert its content to string
operand = new QgsExpression::NodeLiteral( childNode.nodeValue() );
}
// probably a text/CDATA node
QVariant value = childNode.nodeValue();

if ( !operand )
continue;
// try to convert the node content to number if possible,
// otherwise let's use it as string
bool ok;
double d = value.toDouble( &ok );
if ( ok )
value = d;

operand = new QgsExpression::NodeLiteral( value );
if ( !operand )
continue;
}

// use the concat operator to merge the ogc:Literal children
if ( !root )
Expand Down
74 changes: 71 additions & 3 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,14 +863,82 @@ void QgsLinePatternFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &eleme
QgsSymbolLayerV2Utils::createRotationElement( doc, graphicElem, angleFunc );

// <se:Displacement>
QPointF lineOffset( qSin( mLineAngle ) * mOffset, qCos( mLineAngle ) * mOffset );
QPointF lineOffset( sin( mLineAngle ) * mOffset, cos( mLineAngle ) * mOffset );
QgsSymbolLayerV2Utils::createDisplacementElement( doc, graphicElem, lineOffset );

if ( mOutline )
{
// the outline sub symbol should be stored within the Stroke element,
// but it will be stored in a separated LineSymbolizer because it could
// have more than one layer
mOutline->toSld( doc, element, props );
}
}

QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::createFromSld( QDomElement &element )
{
Q_UNUSED( element );
return NULL;
QgsDebugMsg( "Entered." );

QString name;
QColor fillColor, lineColor;
double size, lineWidth;

QDomElement fillElem = element.firstChildElement( "Fill" );
if ( fillElem.isNull() )
return NULL;

QDomElement graphicFillElem = fillElem.firstChildElement( "GraphicFill" );
if ( graphicFillElem.isNull() )
return NULL;

QDomElement graphicElem = graphicFillElem.firstChildElement( "Graphic" );
if ( graphicElem.isNull() )
return NULL;

if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, fillColor, lineColor, lineWidth, size ) )
return NULL;

if ( name != "horline" )
return NULL;

double angle = 0.0;
QString angleFunc;
if ( QgsSymbolLayerV2Utils::rotationFromSldElement( graphicElem, angleFunc ) )
{
bool ok;
double d = angleFunc.toDouble( &ok );
if ( ok )
angle = d;
}

double offset = 0.0;
QPointF vectOffset;
if ( QgsSymbolLayerV2Utils::displacementFromSldElement( graphicElem, vectOffset ) )
{
offset = sqrt( pow( vectOffset.x(), 2 ) + pow( vectOffset.y(), 2 ) );
}

QgsLinePatternFillSymbolLayer* sl = new QgsLinePatternFillSymbolLayer();
sl->setColor( lineColor );
sl->setLineWidth( lineWidth );
sl->setLineAngle( angle );
sl->setOffset( offset );
sl->setDistance( size );

// try to get the outline
QDomElement strokeElem = element.firstChildElement( "Stroke" );
if ( !strokeElem.isNull() )
{
QgsSymbolLayerV2 *l = QgsSymbolLayerV2Utils::createLineLayerFromSld( strokeElem );
if ( l )
{
QgsSymbolLayerV2List layers;
layers.append( l );
sl->setSubSymbol( new QgsLineSymbolV2( layers ) );
}
}

return sl;
}

////////////////////////
Expand Down
16 changes: 8 additions & 8 deletions src/core/symbology-ng/qgslinesymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,11 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen
marker = new QgsMarkerSymbolV2( layers );
}

if ( !marker )
return NULL;

double interval = 0.0;
QDomElement gapElem = element.firstChildElement( "Gap" );
QDomElement gapElem = graphicStrokeElem.firstChildElement( "Gap" );
if ( !gapElem.isNull() )
{
bool ok;
Expand All @@ -790,7 +793,7 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen
}

double offset = 0.0;
QDomElement perpOffsetElem = element.firstChildElement( "PerpendicularOffset" );
QDomElement perpOffsetElem = graphicStrokeElem.firstChildElement( "PerpendicularOffset" );
if ( !perpOffsetElem.isNull() )
{
bool ok;
Expand All @@ -801,12 +804,9 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen

QgsMarkerLineSymbolLayerV2* x = new QgsMarkerLineSymbolLayerV2( rotateMarker );
x->setPlacement( placement );
if ( !doubleNear( interval, 0.0 ) && interval > 0 )
x->setInterval( interval );
if ( marker )
x->setSubSymbol( marker );
if ( !doubleNear( offset, 0.0 ) )
x->setOffset( offset );
x->setInterval( interval );
x->setSubSymbol( marker );
x->setOffset( offset );
return x;
}

Expand Down
Loading