예제 #1
0
 def get_template_data(self):
     """
     Culls unused items from the SABX 1.0 data.
     """
     SabxProcessor.get_template_data(self)
     self._get_used_item_ids()
     self._cull_unused_items()
예제 #2
0
 def get_template_data(self):
     """
     Renumber all the ids for all the SABX 1.0 data.
     """
     SabxProcessor.get_template_data(self)
     self.id = Id(self.options.start, self.options.unique)
     self._create_translations()
     self._renumber_ids()
예제 #3
0
파일: styles.py 프로젝트: jfarrimo/sabx
    def process_options(self):
        """
        Process the OSM data file file and logo directory.
        """
        SabxProcessor.process_options(self)

        base_path, base_file = os.path.split(self.options.out_file)
        self.template_data['osm_data'] = \
            os.path.abspath(os.path.join(base_path, "map.osm"))
        self.template_data['logo_dir'] = strip_end_slash(self.options.logo_dir)
예제 #4
0
파일: sabx_csv.py 프로젝트: jfarrimo/sabx
    def process_options(self):
        """
        Get the CSV file name.  It's expected to be the last command-line
        argument.  Print a blank CSV file and exit if asked to.
        """
        SabxProcessor.process_options(self, 1)
        self.csv = self.args[-1]

        if self.options.blank:
            self._generate_blank()
            sys.exit(0)
예제 #5
0
    def __init__(self, template_file=None, man=None):
        """
        Add C{optparse} options for the usage.

        @param template_file: (optional) file name of template file
        @type template_file: C{string}
        @param man: (optional) extended program help
        @type man: C{string}
        """
        SabxProcessor.__init__(self, template_file, man)
        self.parser.usage = "%s seg_id" % self.parser.usage
예제 #6
0
파일: sabx2html.py 프로젝트: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Add C{optparse} options for the index.

        @param template_file: (optional) file name of template file
        @type template_file: C{string}
        @param man: (optional) extended program help
        @type man: C{string}
        """
        SabxProcessor.__init__(self, template_file, man)

        self.parser.add_option("-n", "--index", dest="ride_index",
                               default="1", 
                               help="ride index")
예제 #7
0
파일: sabx2html.py 프로젝트: jfarrimo/sabx
    def get_template_data(self):
        """
        Add the points to the SABX 1.0 data.
        """
        SabxProcessor.get_template_data(self)

        points = []
        for seg_id in \
                self.template_data['ride_dict'][self.options.ride_index].segs:
            for pt in self.template_data['seg_dict'][seg_id].waypoints:
                points.append( {'index': pt.id, 
                                'lat': pt.lat, 
                                'lon': pt.lon,
                                'ele': pt.ele} )
        self.template_data['points'] = points
예제 #8
0
파일: sabx_csv.py 프로젝트: jfarrimo/sabx
 def get_template_data(self):
     """
     Update the template data by merging it with the specified CSV data.
     """
     SabxProcessor.get_template_data(self)
     new_sabx = self._parse_csv()
     self.template_data['park_list'], self.template_data['park_dict'] = \
         new_sabx['park_list'], new_sabx['park_dict']
     self.template_data['turn_list'], self.template_data['turn_dict'] = \
         new_sabx['turn_list'], new_sabx['turn_dict']
     self.template_data['seg_list'], self.template_data['seg_dict'] = \
         new_sabx['seg_list'], new_sabx['seg_dict']
     self.template_data['stop_list'], self.template_data['stop_dict'] = \
         new_sabx['stop_list'], new_sabx['stop_dict']
     self.template_data['poi_list'], self.template_data['poi_dict'] = \
         new_sabx['poi_list'], new_sabx['poi_dict']
     self.template_data['ride_list'], self.template_data['ride_dict'] = \
         new_sabx['ride_list'], new_sabx['ride_dict']
예제 #9
0
    def __init__(self, template_file=None, man=None):
        """
        Adds the "start" and "unique" options to the command-line options.

        @param template_file: (optional) file name of template file
        @type template_file: C{string}
        @param man: (optional) extended program help
        @type man: C{string}
        """
        SabxProcessor.__init__(self, template_file, man)

        self.parser.add_option("-s", "--start", dest="start",
                               help="number to start at", 
                               type="int", default=1, metavar="START")
        self.parser.add_option("-u", "--unique", dest="unique",
                               action="store_true",
                               help="all unique ids?", 
                               default=False, metavar="UNIQUE")
예제 #10
0
파일: sabx_usgs.py 프로젝트: jfarrimo/sabx
    def get_template_data(self):
        """
        Add the USGS elevations to the template data.
        """
        SabxProcessor.get_template_data(self)

        count = 0
        for seg in self.template_data['seg_list']:
            for pt in seg.waypoints:
                pt.usgs = get_usgs(pt.lat, pt.lon)

                count += 1
                if count % 100 == 0:
                    sys.stderr.write("%s" % count)
                else:
                    sys.stderr.write(".")
                
        sys.stderr.write("\n")
예제 #11
0
파일: styles.py 프로젝트: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Add support for an OSM data file and a logo directory.

        @param template_file: name of template file to use
        @type template_file: C{string}
        @param man: text for man page
        @type man: C{string}
        """
        SabxProcessor.__init__(self, template_file, man)

        self.parser.add_option("-d", "--datafile", dest="data_file",
                               help="osm data FILE name", 
                               metavar="FILE")
        self.parser.add_option("-l", "--logodir", dest="logo_dir",
                               help="osm logo directory", 
                               metavar="LOGO")

        self.template_data['PIX_SCALE_FACTOR'] = PIX_SCALE_FACTOR
예제 #12
0
파일: sabx_csv.py 프로젝트: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Adds the id, csv, and generate options to the standard SABX 1.0
        template processor.

        @param template_file: (optional) file name of template file
        @type template_file: C{string}
        @param man: (optional) extended program help
        @type man: C{string}
        """
        SabxProcessor.__init__(self, template_file, man)

        self.parser.usage = "%s csv_file" % self.parser.usage
        self.parser.add_option("-d", "--id", dest="id",
                               help="id of segment to merge into", 
                               default="1", metavar="ID")
        self.parser.add_option("-b", "--blank", dest="blank",
                               action="store_true",
                               help="generate a blank CSV file", 
                               default=False, metavar="BLANK")
예제 #13
0
 def get_template_data(self):
     """
     Reverse the waypoints of the designated segment.
     """
     SabxProcessor.get_template_data(self)
     self.template_data['seg_dict'][self.seg].waypoints.reverse()
예제 #14
0
 def process_options(self):
     """
     Get the seg id.  It's expected to be the last command-line argument.
     """
     SabxProcessor.process_options(self, 1)
     self.seg = self.args[-1]