trumpimar / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Refactoring: New location iterator in MyTracksProviderUtils #265

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Background:
There is a lot of code duplication across MT that deals with iterating over 
track points. Most of the classes have to deal by its own with batching, 
sampling etc.

Goal:
Introduce a new high level interface to allow to easily express what set of 
columns should be read and in what way and hide the low-level cursor interface.

Consider this example:
  LocationIterator it = providerUtils.newLocationIterator(recordingTrackId)
        .setLocationFactory(...)
        .setMaxResults(MyTracksConstants.MAX_LOADED_TRACK_POINTS)
        .setLocationFilter(MyTracksProviderUtils.VALID_LOCATIONS)
        .setColumnGroups(EnumSet.of(ColumnGroup..METADATA, ColumnGroup.LOCATION)),
        .build();
    while (it.hasNext()) {
      Location location = it.next();
      statsBuilder.addLocation(location, location.getTime());
      if (lastValidLocation != null) {
        length += location.distanceTo(lastValidLocation);
      }
      lastValidLocation = location;
    }

Original issue reported on code.google.com by ba...@google.com on 6 Jan 2011 at 6:19

GoogleCodeExporter commented 8 years ago

Original comment by ba...@google.com on 6 Jan 2011 at 6:20

GoogleCodeExporter commented 8 years ago
Issue 298 has been merged into this issue.

Original comment by simmonmt@google.com on 9 Feb 2011 at 6:32

GoogleCodeExporter commented 8 years ago

Original comment by rdama...@google.com on 30 Apr 2011 at 5:45

GoogleCodeExporter commented 8 years ago

Original comment by jshih@google.com on 9 Dec 2011 at 9:17

GoogleCodeExporter commented 8 years ago

Original comment by jshih@google.com on 10 Sep 2012 at 10:54