Skip to content

Commit

Permalink
Quality topology layer names
Browse files Browse the repository at this point in the history
... so you can recognize them in the snapping option dialog
  • Loading branch information
Sandro Santilli committed Jan 8, 2013
1 parent 67c4e17 commit a9ff3cf
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def run(item, action, mainwindow):
# 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'geom')
'geom', 'face_id', u'%s.face' % toponame)
layer.loadNamedStyle(os.path.join(template_dir, 'face.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -117,7 +117,7 @@ def run(item, action, mainwindow):
# face_seed
layer = db.toSqlLayer(u'SELECT face_id, ST_PointOnSurface(topology.ST_GetFaceGeometry(%s, face_id)) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'seed')
'geom', 'face_id', u'%s.face_seed' % toponame)
layer.loadNamedStyle(os.path.join(template_dir, 'face_seed.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -134,7 +134,7 @@ def run(item, action, mainwindow):

# node
uri.setDataSource(toponame, 'node', 'geom', '', 'node_id')
layer = QgsVectorLayer(uri.uri(), u'geom', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.node' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'node.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -143,7 +143,7 @@ def run(item, action, mainwindow):

# node labels
uri.setDataSource(toponame, 'node', 'geom', '', 'node_id')
layer = QgsVectorLayer(uri.uri(), u'node_id', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.node_id' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'node_label.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -157,15 +157,15 @@ def run(item, action, mainwindow):

# edge
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'geom', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.edge' % toponame, provider)
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# directed edge
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'directed_geom', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.directed_edge' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'edge.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -175,7 +175,7 @@ def run(item, action, mainwindow):

# edge labels
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'edge_id', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.edge_id' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'edge_label.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -184,7 +184,7 @@ def run(item, action, mainwindow):

# face_left
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'face_left', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.face_left' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'face_left.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -193,7 +193,7 @@ def run(item, action, mainwindow):

# face_right
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'face_right', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.face_right' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'face_right.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -202,7 +202,7 @@ def run(item, action, mainwindow):

# next_left
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'next_left', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.next_left' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'next_left.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -211,7 +211,7 @@ def run(item, action, mainwindow):

# next_right
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'next_right', provider)
layer = QgsVectorLayer(uri.uri(), u'%s.next_right' % toponame, provider)
layer.loadNamedStyle(os.path.join(template_dir, 'next_right.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand Down

0 comments on commit a9ff3cf

Please sign in to comment.