Package sabx10 :: Package oxm :: Module segment
[hide private]
[frames] | no frames]

Module segment

source code

Segment handling.

Classes [hide private]
  Waypoint
A Waypoint object sub-classes Point and adds stop and POI references.
  Segment
A Segment object sub-classes Line and adds a host of extra data.
Functions [hide private]
Waypoint
_parse_waypoint(xml_point)
Take the Element for a waypoint and turn it into a Waypoint object.
source code
list of Waypoint
_parse_segment_waypoints(xml_seg)
Take the Element for a segment and parse all the waypoints it contains.
source code
Segment
_parse_segment_xml(xml_seg)
Take the Element for a segment and turn it into a Segment object.
source code
(list of Segment,dict of Segment)
parse_segments(xml_tree)
Get all the segment elements in the given Element tree and create a list of them with Segment objects.
source code
list of Segment
_get_ride_segs(xml_ride, xml_segs)
Process the ride, creating Segment objects for each of its segment references.
source code
None
_correct_points(points, correction)
Apply an elevation correction to all the points in a list of waypoints.
source code
None
_correct_elevations(ride_segs)
Process the ride segments, making sure that the rise/fall between segment ele endpoints is the same as the rise/fall of the USGS data.
source code
None
_connect_segments_to_following_segment(ride_segs)
Process the ride segments, connecting each to the successive segment by making the final point of each segment be the same as the first point of the following segment.
source code
None
_process_segment(seg, index, cum_distance)
Process a Segment, adding pertinent calculated data.
source code
(list,Box)
process_ride_segments(xml_ride, xml_segs, correct_ele=True)
Process the segment references for the given ride and generate a list of Segment objects for it and the bounding box for all of the segments.
source code
Variables [hide private]
  __package__ = 'sabx10.oxm'
Function Details [hide private]

_parse_waypoint(xml_point)

source code 

Take the Element for a waypoint and turn it into a Waypoint object.

Parameters:
  • xml_point (Element) - Element for a waypoint
Returns: Waypoint
Waypoint object

_parse_segment_waypoints(xml_seg)

source code 

Take the Element for a segment and parse all the waypoints it contains.

Parameters:
  • xml_seg (Element) - Element for a segment
Returns: list of Waypoint
list of Waypoint objects

_parse_segment_xml(xml_seg)

source code 

Take the Element for a segment and turn it into a Segment object.

Parameters:
  • xml_seg (Element) - Element for a segment
Returns: Segment
Segment object

parse_segments(xml_tree)

source code 

Get all the segment elements in the given Element tree and create a list of them with Segment objects.

Parameters:
  • xml_tree (Element or ElementTree) - root of Element tree that has segments in it
Returns: (list of Segment,dict of Segment)
segments in a list and a dictionary

_get_ride_segs(xml_ride, xml_segs)

source code 

Process the ride, creating Segment objects for each of its segment references.

Parameters:
  • xml_ride (Element) - Element for a ride
  • xml_segs (list of Elements) - list of Element segment objects for this rideset
Returns: list of Segment
list of Segment objects

_correct_points(points, correction)

source code 

Apply an elevation correction to all the points in a list of waypoints.

Parameters:
  • points (list of Waypoint) - list of points to correct
  • correction (float) - ammount to add to the Waypoint elevations
Returns: None
None

_correct_elevations(ride_segs)

source code 

Process the ride segments, making sure that the rise/fall between segment ele endpoints is the same as the rise/fall of the USGS data. This helps things out because ele data taken from different rides can be off from eachother, though the relative data for the ride is correct. This can make for sudden jumps in the elevation between segments, which makes for funny looking graphs and elevation analysis.

Parameters:
Returns: None
None

_connect_segments_to_following_segment(ride_segs)

source code 

Process the ride segments, connecting each to the successive segment by making the final point of each segment be the same as the first point of the following segment.

Parameters:
Returns: None
None

_process_segment(seg, index, cum_distance)

source code 

Process a Segment, adding pertinent calculated data.

Calculated data includes:

  • length: of segment
  • distance: in ride of start of segment
  • start_dist: same as distance
  • end_dist: distance in ride of end of segment
  • mid_index: index of middle Waypoint
  • lat: latitude of starting Waypoint
  • lon: longitude of starting Waypoint
  • mid_lat: latitude of middle Waypoint
  • mid_lon: longitude of middle Waypoint
  • index: index of segment in ride
  • bounds: bounding box for all Waypoints in the box
Parameters:
  • seg (Segment) - Segment to process
  • index (int) - index for this segment
  • cum_distance (float) - distance so far for this ride
Returns: None
None

process_ride_segments(xml_ride, xml_segs, correct_ele=True)

source code 

Process the segment references for the given ride and generate a list of Segment objects for it and the bounding box for all of the segments.

Parameters:
  • xml_ride (Element) - Element for a ride
  • xml_segs (list of Elements) - list of Element segment objects for this rideset
  • correct_ele (boolean) - make sure that the segment elevations match-up?
Returns: (list,Box)
(list of Segment,bounds)