Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Aug 27, 2012
2 parents ec6b5a5 + 924e7eb commit 1720575
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 87 deletions.
13 changes: 5 additions & 8 deletions CMakeLists.txt
Expand Up @@ -463,17 +463,14 @@ SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIB_SUBDIR})
# if run from the build directory QGIS will detect it and alter the paths
FILE(WRITE ${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/path.txt "${CMAKE_SOURCE_DIR}\n${QGIS_OUTPUT_DIRECTORY}")

# symlink provider plugins dir for Mac unit tests
# symlink extra provider plugin frameworks for Mac unit tests
IF (APPLE AND ENABLE_TESTS)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_BINARY_DIR}/Plugins"
"${CMAKE_CURRENT_BINARY_DIR}/output/Plugins")
"${CMAKE_BINARY_DIR}/Plugins/qgis/qgisgrass.framework"
"${CMAKE_BINARY_DIR}/output/lib/qgisgrass.framework")
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_BINARY_DIR}/Plugins/qgis/qgisgrass.framework"
"${CMAKE_CURRENT_BINARY_DIR}/output/lib/qgisgrass.framework")
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_BINARY_DIR}/Plugins/qgis/qgissqlanyconnection.framework"
"${CMAKE_CURRENT_BINARY_DIR}/output/lib/qgissqlanyconnection.framework")
"${CMAKE_BINARY_DIR}/Plugins/qgis/qgissqlanyconnection.framework"
"${CMAKE_BINARY_DIR}/output/lib/qgissqlanyconnection.framework")
ENDIF (APPLE AND ENABLE_TESTS)

# manual page - makes sense only on unix systems
Expand Down
5 changes: 0 additions & 5 deletions cmake/UsePythonTest.cmake
Expand Up @@ -46,11 +46,6 @@ ELSE(WIN32)
MESSAGE(\"LD_LIBRARY_PATH:\$ENV{LD_LIBRARY_PATH}\")
ENDIF(WIN32)
IF(APPLE)
SET(ENV{QGIS_MAC_PKGDATA_DIR} \"${CMAKE_SOURCE_DIR}\")
SET(ENV{QGIS_MAC_SVG_DIR} \"${CMAKE_SOURCE_DIR}/images/svg\")
ENDIF(APPLE)
MESSAGE(\"PYTHONPATH:\$ENV{PYTHONPATH}\")
MESSAGE(STATUS \"Running ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolon}\")
EXECUTE_PROCESS(
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/db_manager/completer.py
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
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
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
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
86 changes: 80 additions & 6 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -80,12 +80,16 @@ void QgsSimpleFillSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
}

QColor selColor = context.selectionColor();
// selColor.setAlphaF( context.alpha() );
QColor selPenColor = selColor == mColor ? selColor : mBorderColor;
if ( ! selectionIsOpaque ) selColor.setAlphaF( context.alpha() );
mSelBrush = QBrush( selColor );
// N.B. unless a "selection line colour" is implemented in addition to the "selection colour" option
// this would mean symbols with "no fill" look the same whether or not they are selected
if ( selectFillStyle )
mSelBrush.setStyle( mBrushStyle );
mBorderColor.setAlphaF( context.alpha() );
mPen = QPen( mBorderColor );
mSelPen = QPen( selPenColor );
mPen.setStyle( mBorderStyle );
mPen.setWidthF( context.outputLineWidth( mBorderWidth ) );
}
Expand All @@ -105,6 +109,7 @@ void QgsSimpleFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList<Q

p->setBrush( context.selected() ? mSelBrush : mBrush );
p->setPen( mPen );
p->setPen( context.selected() ? mSelPen : mPen );

if ( !mOffset.isNull() )
p->translate( mOffset );
Expand Down Expand Up @@ -213,8 +218,9 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
if ( context.selected() )
{
QColor selColor = context.selectionColor();
if ( ! selectionIsOpaque )
selColor.setAlphaF( context.alpha() );
// Alister - this doesn't seem to work here
//if ( ! selectionIsOpaque )
// selColor.setAlphaF( context.alpha() );
p->setBrush( QBrush( selColor ) );
_renderPolygon( p, points, rings );
}
Expand Down Expand Up @@ -857,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
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.h
Expand Up @@ -80,6 +80,7 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
Qt::PenStyle mBorderStyle;
double mBorderWidth;
QPen mPen;
QPen mSelPen;

QPointF mOffset;
};
Expand Down
16 changes: 8 additions & 8 deletions src/core/symbology-ng/qgslinesymbollayerv2.cpp
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

0 comments on commit 1720575

Please sign in to comment.