Skip to content
Permalink
Browse files
OSM provider ported to new API
  • Loading branch information
wonder-sk committed Jan 27, 2013
1 parent b16c68e commit 600baca9a479f7339d069968aafe119aefac4a89
@@ -323,7 +323,6 @@ def findFeature(self,mapPoint):
lay=self.pointLayers[self.currentKey]
lay.select([],area,True,True)
result=lay.nextFeature(feat)
lay.dataProvider().rewind()

if result:
return (feat,'Point')
@@ -332,7 +331,6 @@ def findFeature(self,mapPoint):
lay=self.lineLayers[self.currentKey]
lay.select([],area,True,True)
result=lay.nextFeature(feat)
lay.dataProvider().rewind()

if result:
# line vertices
@@ -341,7 +339,7 @@ def findFeature(self,mapPoint):
,{"minLat":area.yMinimum(),"maxLat":area.yMaximum(),"minLon":area.xMinimum(),"maxLon":area.xMaximum(),"lineId":str(feat.id())})

for rec in c:
feat2=QgsFeature(rec[0],"Point")
feat2=QgsFeature(rec[0])
feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(rec[2],rec[1])))
# without features' attributes here! we don't need them...
c.close()
@@ -354,7 +352,6 @@ def findFeature(self,mapPoint):
lay=self.polygonLayers[self.currentKey]
lay.select([],area,True,True)
result=lay.nextFeature(feat)
lay.dataProvider().rewind()

if result:
# polygon vertices
@@ -363,7 +360,7 @@ def findFeature(self,mapPoint):
,{"minLat":area.yMinimum(),"maxLat":area.yMaximum(),"minLon":area.xMinimum(),"maxLon":area.xMaximum(),"polygonId":str(feat.id())})

for rec in c:
feat2=QgsFeature(rec[0],"Point")
feat2=QgsFeature(rec[0])
feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(rec[2],rec[1])))
# without features' attributes here! we don't need them...
c.close()
@@ -416,7 +413,7 @@ def findAllFeatures(self,mapPoint):
,{"minLat":area.yMinimum(),"maxLat":area.yMaximum(),"minLon":area.xMinimum(),"maxLon":area.xMaximum(),"lineId":str(feat.id())})

for rec in c:
feat2=QgsFeature(rec[0],"Point")
feat2=QgsFeature(rec[0])
feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(rec[2],rec[1])))
# without features' attributes here! we don't need them...
featMap[feat2.id()]=feat2
@@ -439,7 +436,7 @@ def findAllFeatures(self,mapPoint):
,{"minLat":area.yMinimum(),"maxLat":area.yMaximum(),"minLon":area.xMinimum(),"maxLon":area.xMaximum(),"polygonId":str(feat.id())})

for rec in c:
feat2=QgsFeature(rec[0],"Point")
feat2=QgsFeature(rec[0])
feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(rec[2],rec[1])))
# without features' attributes here! we don't need them...
featMap[feat2.id()]=feat2
@@ -471,7 +468,7 @@ def createPoint(self,mapPoint,snapFeat,snapFeatType,doCommit=True):
nodeId=self.__getFreeFeatureId()

affected=set()
feat=QgsFeature(nodeId,"Point")
feat=QgsFeature(nodeId)
feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(mapPoint.x(),mapPoint.y())))

# should snapping be done? if not, everything's easy
@@ -612,7 +609,7 @@ def createLine(self,mapPoints, doCommit=True):

# finishing...
c.close()
feat=QgsFeature(lineId,"Line")
feat=QgsFeature(lineId)
feat.setGeometry(QgsGeometry.fromPolyline(pline))

if doCommit:
@@ -691,7 +688,7 @@ def createPolygon(self,mapPoints, doCommit=True):

# finish
c.close()
feat=QgsFeature(polygonId,"Polygon")
feat=QgsFeature(polygonId)
polygon=[]
polygon.append(pline)
feat.setGeometry(QgsGeometry.fromPolygon(polygon))
@@ -6,7 +6,7 @@ ADD_SUBDIRECTORY(memory)
ADD_SUBDIRECTORY(ogr)
ADD_SUBDIRECTORY(wms)
ADD_SUBDIRECTORY(delimitedtext)
#ADD_SUBDIRECTORY(osm) # TODO: enable when migrated to new api
ADD_SUBDIRECTORY(osm)
#ADD_SUBDIRECTORY(sqlanywhere) # TODO: enable when migrated to new api
ADD_SUBDIRECTORY(gdal)
#ADD_SUBDIRECTORY(mssql) # TODO: enable when migrated to new api
@@ -3,6 +3,7 @@
# Files

SET(OSM_SRCS
osmfeatureiterator.cpp
osmhandler.cpp
osmprovider.cpp
osmrenderer.cpp
Loading

0 comments on commit 600baca

Please sign in to comment.