Exemplo n.º 1
0
    def submit_waypoints(self, waypoint_file):
        if not os.path.exists(waypoint_file.file.name):
            return self.waypoints("<h3>Waypoint file could not be read!</h3>")
            
        path = os.path.join(self.get_dir_job(cherrypy.session.id), 
                            waypoint_file.filename)
        f = open(path, "w")
        print f
        while True:
            data = waypoint_file.file.read(8192)
            if not data:
                break
            f.write(data)
        f.close()
        print path
            
        cherrypy.session['waypoint_file'] = path

        wplist = WaypointList()
        wplist.parse(open(path))
        bounds = wplist.get_bounds()
        print bounds
        cherrypy.session['bounds'] = bounds
        cherrypy.session.save()

        return self.terrain()
Exemplo n.º 2
0
    def SetBoundsByWaypointFile(self, filename):
        print "Setting map boundaries to match waypoint file contents ..."

        print "Reading waypoint file ..."
        if not isinstance(filename, basestring):
            print "failed! (String expected)"
            return False

        if not os.path.exists(filename):
            print "failed! (" + filename + " not found!)"
            return False

        f = open(filename, "r")
        wplist = WaypointList()
        wplist.parse(f)
        f.close()

        return self.SetBounds(wplist.get_bounds())
Exemplo n.º 3
0
    def SetBoundsByWaypointFile(self, filename):
        print "Setting map boundaries to match waypoint file contents ..."

        print "Reading waypoint file ..."
        if not isinstance(filename, basestring):
            print "failed! (String expected)"
            return False

        if not os.path.exists(filename):
            print "failed! (" + filename + " not found!)"
            return False

        f = open(filename, "r")
        wplist = WaypointList()
        wplist.parse(f)
        f.close()

        return self.SetBounds(wplist.get_bounds())