Skip to content
Permalink
Browse files

TopoViewer: add layer for full faces

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Nov 1, 2012
1 parent a5553b7 commit bbedc4e00f80f3285b4973d5938d4d313d2f3606
@@ -97,6 +97,15 @@ def run(item, action, mainwindow):
provider = db.dbplugin().providerName()
uri = db.uri();

# face
layer = db.toSqlLayer(u'SELECT face_id, topology.ST_GetFaceGeometry(%s, face_id) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'%s.face' % toponame)
layer.loadNamedStyle(os.path.join(template_dir, 'face.qml'))
registry.addMapLayer(layer)
legend.setLayerVisible(layer, False)
legend.moveLayer(layer, group)

# node
uri.setDataSource(toponame, 'node', 'geom', '', 'node_id')
layer = QgsVectorLayer(uri.uri(), u'%s.nodes' % toponame, provider)
@@ -150,7 +159,6 @@ def run(item, action, mainwindow):
legend.setLayerVisible(layer, False)
legend.moveLayer(layer, group)

# TODO: add full faces ?
# TODO: add polygon0, polygon1 and polygon2 ?

finally:
@@ -0,0 +1,229 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="1.9.0-Master" minimumScale="0" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
<transparencyLevelInt>255</transparencyLevelInt>
<renderer-v2 symbollevels="0" type="RuleRenderer">
<rules>
<rule filter="face_id % 10 = 0" symbol="0"/>
<rule filter="face_id % 10 = 1" symbol="1"/>
<rule filter="face_id % 10 = 2" symbol="2"/>
<rule filter="face_id % 10 = 3" symbol="3"/>
<rule filter="face_id % 10 = 4" symbol="4"/>
<rule filter="face_id % 10 = 5" symbol="5"/>
<rule filter="face_id % 10 = 6" symbol="6"/>
<rule filter="face_id % 10 = 7" symbol="7"/>
<rule filter="face_id % 10 = 8" symbol="8"/>
<rule filter="face_id % 10 = 9" symbol="9"/>
</rules>
<symbols>
<symbol outputUnit="MM" alpha="1" type="fill" name="0">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="191,122,200,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="1">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="200,122,122,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="2">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="122,200,122,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="3">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="122,181,200,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="4">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="122,136,200,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="5">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="199,200,192,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="6">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="122,200,156,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="7">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="200,177,122,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="8">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="200,122,166,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
<symbol outputUnit="MM" alpha="1" type="fill" name="9">
<layer pass="0" class="SimpleFill" locked="0">
<prop k="color" v="188,200,122,255"/>
<prop k="color_border" v="0,0,0,255"/>
<prop k="offset" v="0,0"/>
<prop k="style" v="solid"/>
<prop k="style_border" v="solid"/>
<prop k="width_border" v="0.26"/>
</layer>
</symbol>
</symbols>
</renderer-v2>
<customproperties>
<property key="labeling" value="pal"/>
<property key="labeling/addDirectionSymbol" value="false"/>
<property key="labeling/angleOffset" value="0"/>
<property key="labeling/bufferColorB" value="255"/>
<property key="labeling/bufferColorG" value="255"/>
<property key="labeling/bufferColorR" value="255"/>
<property key="labeling/bufferJoinStyle" value="64"/>
<property key="labeling/bufferNoFill" value="false"/>
<property key="labeling/bufferSize" value="1"/>
<property key="labeling/bufferSizeInMapUnits" value="false"/>
<property key="labeling/bufferTransp" value="0"/>
<property key="labeling/centroidWhole" value="false"/>
<property key="labeling/dataDefinedProperty0" value=""/>
<property key="labeling/dataDefinedProperty1" value=""/>
<property key="labeling/dataDefinedProperty10" value=""/>
<property key="labeling/dataDefinedProperty11" value=""/>
<property key="labeling/dataDefinedProperty12" value=""/>
<property key="labeling/dataDefinedProperty13" value=""/>
<property key="labeling/dataDefinedProperty14" value=""/>
<property key="labeling/dataDefinedProperty15" value=""/>
<property key="labeling/dataDefinedProperty16" value=""/>
<property key="labeling/dataDefinedProperty17" value=""/>
<property key="labeling/dataDefinedProperty18" value=""/>
<property key="labeling/dataDefinedProperty19" value=""/>
<property key="labeling/dataDefinedProperty2" value=""/>
<property key="labeling/dataDefinedProperty3" value=""/>
<property key="labeling/dataDefinedProperty4" value=""/>
<property key="labeling/dataDefinedProperty5" value=""/>
<property key="labeling/dataDefinedProperty6" value=""/>
<property key="labeling/dataDefinedProperty7" value=""/>
<property key="labeling/dataDefinedProperty8" value=""/>
<property key="labeling/dataDefinedProperty9" value=""/>
<property key="labeling/decimals" value="0"/>
<property key="labeling/displayAll" value="false"/>
<property key="labeling/dist" value="0"/>
<property key="labeling/distInMapUnits" value="false"/>
<property key="labeling/enabled" value="false"/>
<property key="labeling/fieldName" value="face_id"/>
<property key="labeling/fontCapitals" value="0"/>
<property key="labeling/fontFamily" value="DejaVu Sans"/>
<property key="labeling/fontItalic" value="false"/>
<property key="labeling/fontLetterSpacing" value="0"/>
<property key="labeling/fontSize" value="8"/>
<property key="labeling/fontSizeInMapUnits" value="false"/>
<property key="labeling/fontStrikeout" value="false"/>
<property key="labeling/fontUnderline" value="false"/>
<property key="labeling/fontWeight" value="50"/>
<property key="labeling/fontWordSpacing" value="0"/>
<property key="labeling/formatNumbers" value="false"/>
<property key="labeling/isExpression" value="false"/>
<property key="labeling/labelOffsetInMapUnits" value="true"/>
<property key="labeling/labelPerPart" value="false"/>
<property key="labeling/mergeLines" value="false"/>
<property key="labeling/minFeatureSize" value="0"/>
<property key="labeling/multilineAlign" value="0"/>
<property key="labeling/multilineHeight" value="1"/>
<property key="labeling/namedStyle" value="Condensed"/>
<property key="labeling/obstacle" value="true"/>
<property key="labeling/placement" value="0"/>
<property key="labeling/placementFlags" value="0"/>
<property key="labeling/plussign" value="true"/>
<property key="labeling/preserveRotation" value="true"/>
<property key="labeling/previewBkgrdColor" value="#ffffff"/>
<property key="labeling/priority" value="5"/>
<property key="labeling/scaleMax" value="0"/>
<property key="labeling/scaleMin" value="0"/>
<property key="labeling/textColorB" value="0"/>
<property key="labeling/textColorG" value="0"/>
<property key="labeling/textColorR" value="170"/>
<property key="labeling/textTransp" value="0"/>
<property key="labeling/upsidedownLabels" value="0"/>
<property key="labeling/wrapChar" value=""/>
<property key="labeling/xOffset" value="0"/>
<property key="labeling/xQuadOffset" value="0"/>
<property key="labeling/yOffset" value="0"/>
<property key="labeling/yQuadOffset" value="0"/>
</customproperties>
<displayfield>face_id</displayfield>
<label>0</label>
<labelattributes>
<label fieldname="" text="Label"/>
<family fieldname="" name="DejaVu Sans"/>
<size fieldname="" units="pt" value="12"/>
<bold fieldname="" on="0"/>
<italic fieldname="" on="0"/>
<underline fieldname="" on="0"/>
<strikeout fieldname="" on="0"/>
<color fieldname="" red="0" blue="0" green="0"/>
<x fieldname=""/>
<y fieldname=""/>
<offset x="0" y="0" units="pt" yfieldname="" xfieldname=""/>
<angle fieldname="" value="0" auto="0"/>
<alignment fieldname="" value="center"/>
<buffercolor fieldname="" red="255" blue="255" green="255"/>
<buffersize fieldname="" units="pt" value="1"/>
<bufferenabled fieldname="" on=""/>
<multilineenabled fieldname="" on=""/>
<selectedonly on=""/>
</labelattributes>
<edittypes>
<edittype type="0" name="face_id"/>
</edittypes>
<editform></editform>
<editforminit></editforminit>
<annotationform></annotationform>
<excludeAttributesWMS/>
<excludeAttributesWFS/>
<attributeactions/>
</qgis>

0 comments on commit bbedc4e

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