コード例 #1
0
ファイル: tile.py プロジェクト: TimSC/kivmap
	def Draw(self, hints={}):

		#Clear widget drawing
		self.clear_widgets()

		if self.randomBackgroundColour:
			self.DrawCallback(Color(random.random(), random.random(), random.random()))
			self.DrawCallback(Rectangle(pos=(0., 0), size=(self.width, self.height)))

		if self.map is None:
			return

		#Draw background
		Color(253./255., 251./255., 224./255.)
		bg = Rectangle(pos=(0., 0), size=(self.width, self.height))
		self.DrawCallback(bg)

		#Draw foreground
		tl = slippy.num2deg(self.tileNum[0], self.tileNum[1], self.tileZoom)
		br = slippy.num2deg(self.tileNum[0]+1, self.tileNum[1]+1, self.tileZoom)
		wgs84proj = slippy.TileProj(self.tileNum[0], self.tileNum[1], self.tileZoom, self.size[0], self.size[1])
		
		projObjects = {"wgs84": wgs84proj.Proj, "tile_size": self.size}

		self.map.Draw(self.tileNum, self.tileZoom, hints, self.DrawCallback, projObjects)
コード例 #2
0
ファイル: getarea.py プロジェクト: TimSC/mapbin
	def GetTile(self, tilex, tiley, zoom, out, tolerateMissing = True):
		tileNum = (zoom, tilex, tiley)
		nw = slippy.num2deg(tilex, tiley, zoom)
		se = slippy.num2deg(tilex+1, tiley+1, zoom)
		queryArea = [nw[1], nw[0], se[1], se[0]]
		nodesOfInterest = GetNodesInSlippyTile(self.spatialIndex, tileNum, self.osmObjectStore, self.versionStore, tolerateMissing)
		self.NodesToCompleteData(nodesOfInterest, queryArea, out)
コード例 #3
0
ファイル: osmfile.py プロジェクト: TimSC/kivmap
	def Do(self, osmParseObj, tileCode, tileZoom, proj, resolution = 512):

		tl = slippy.num2deg(tileCode[0], tileCode[1], tileZoom)
		#tileResolution = 512
		br = slippy.num2deg(tileCode[0]+1, tileCode[1]+1, tileZoom)
		#proj = slippy.TileProj(tileCode[0], tileCode[1], tileZoom, tileResolution, tileResolution)
		bounds = (tl[1], br[0], br[1], tl[0])

		wgs84proj = slippy.TileProj(tileCode[0], tileCode[1], tileZoom, resolution, resolution)

		wayLines = []
		w = self.DoPoints(osmParseObj, bounds, wgs84proj, proj)
		wayLines.extend(w)
		w = self.DoLinesAndPolys(osmParseObj, bounds, wgs84proj, proj)
		wayLines.extend(w)
		w2 = self.DoMultipolygons(osmParseObj, bounds, wgs84proj, proj)
		wayLines.extend(w2)

		return wayLines, ("tile", wgs84proj.tileWidth, wgs84proj.tileHeight)
コード例 #4
0
ファイル: layer.py プロジェクト: TimSC/kivmap
	def on_touch_move(self, touch):
		#Calculate distance dragged
		relativeMove = (touch.pos[0] - self.lastTouch[0], touch.pos[1] - self.lastTouch[1])
		self.lastTouch = touch.pos
		fractRelativeMove = (relativeMove[0] / self.size[0], relativeMove[1] / self.size[1])

		#Update view
		left, right, top, bottom = self.GetViewBounds() 
		dx = (right - left) * fractRelativeMove[0]
		dy = (bottom - top) * fractRelativeMove[1]
		tilex, tiley = slippy.deg2num(self.viewPos[0], self.viewPos[1], self.viewZoom)
		tilex -= dx
		tiley += dy
		self.viewPos = slippy.num2deg(tilex, tiley, self.viewZoom)

		self.UpdateExistingTilePositions()
		self.AddNewTilesAsRequired()
		self.RemoveUnneededTiles()