def __init__(self,nodeCollection,width=800,height=600): self.nodeCollection=nodeCollection self.width=width self.height=height self.pathFind=pathFinder(self.nodeCollection) self.pathFind.load() self.pathFound=self.pathFind.findPath("2016012246","b-Engineering 3") #pick an initial camerax, cameray, zoom factor such that you can see the entire screen maxX=max([node.x for node in self.nodeCollection.vertices.values()]) minX=min([node.x for node in self.nodeCollection.vertices.values()]) maxY=max([node.y for node in self.nodeCollection.vertices.values()]) minY=min([node.y for node in self.nodeCollection.vertices.values()]) #self.camerax=int((maxX+minX)/2) #self.cameray=int((maxY+minY)/2) #self.zoom=min((maxX-minX)/2, (maxY-minY)/2) self.camerax=43.4723642752 self.cameray=-80.5403881748 self.zoom=83372.7046559
def __init__(self, nodeCollection, width=800, height=600): self.nodeCollection = nodeCollection self.width = width self.height = height self.pathFind = pathFinder(self.nodeCollection) self.pathFind.load() self.pathFound = self.pathFind.findPath("2016012246", "b-Engineering 3") #pick an initial camerax, cameray, zoom factor such that you can see the entire screen maxX = max([node.x for node in self.nodeCollection.vertices.values()]) minX = min([node.x for node in self.nodeCollection.vertices.values()]) maxY = max([node.y for node in self.nodeCollection.vertices.values()]) minY = min([node.y for node in self.nodeCollection.vertices.values()]) #self.camerax=int((maxX+minX)/2) #self.cameray=int((maxY+minY)/2) #self.zoom=min((maxX-minX)/2, (maxY-minY)/2) self.camerax = 43.4723642752 self.cameray = -80.5403881748 self.zoom = 83372.7046559
- 2. Receive JSON array back. Array contains the nodes, in order, for the path. """ from socket import * import thread from calc import pathFinder import redis import json BUFF = 1024 HOST = '127.0.0.1' PORT = 7284 # PATH :) cache=redis.Redis() pF = pathFinder(None) pF.load() def read_socket(client): return client.recv(1) def handler(clientsock,addr): global cache global pF data = clientsock.recv(1024) print data.decode("ascii") data=data.decode("ascii").rstrip() if not data: clientsock.close() return