Skip to content

Commit

Permalink
release 1.0.1+2
Browse files Browse the repository at this point in the history
  • Loading branch information
kb0 committed Jul 26, 2020
1 parent 43fec4f commit 686e446
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [1.0.1+2]

* update Xml package to 4.3.0
* add comments

## [1.0.1+1]

* fix formatting
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In your dart/flutter project add the dependency:
```
dependencies:
...
gpx: ^1.0.1+1
gpx: ^1.0.1+2
```

### Reading XML
Expand Down
1 change: 1 addition & 0 deletions lib/src/gpx_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GpxReader {
//
// }

/// Parse xml string and create Gpx object
Gpx fromString(String xml) {
final iterator = parseEvents(xml).iterator;

Expand Down
2 changes: 2 additions & 0 deletions lib/src/gpx_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import 'model/trk.dart';
import 'model/wpt.dart';

class GpxWriter {
/// Convert Gpx into GPX XML (v1.1) as String
String asString(Gpx gpx, {bool pretty = false}) =>
_build(gpx).toXmlString(pretty: pretty);

/// Convert Gpx into GPX XML (v1.1) as XmlNode
XmlNode asXml(Gpx gpx) => _build(gpx);

XmlNode _build(Gpx gpx) {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/kml_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import 'model/trk.dart';
import 'model/wpt.dart';

class KmlWriter {
/// Convert Gpx into KML as String
String asString(Gpx gpx, {bool pretty = false}) =>
_build(gpx).toXmlString(pretty: pretty);

/// Convert Gpx into KML as XmlNode
XmlNode asXml(Gpx gpx) => _build(gpx);

XmlNode _build(Gpx gpx) {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/model/bounds.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:quiver/core.dart';

/// Two lat/lon pairs defining the extent of an element.
class Bounds {
double minlat;
double minlon;
double maxlat;
double maxlon;

/// Construct a new [Bounds] with rect [minlat, minlon, maxlat, maxlon].
Bounds(
{this.minlat = 0.0,
this.minlon = 0.0,
Expand Down
4 changes: 4 additions & 0 deletions lib/src/model/copyright.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import 'package:quiver/core.dart';

/// Information about the copyright holder and any license governing use of this
/// file. By linking to an appropriate license, you may place your data into the
/// public domain or grant additional usage rights.
class Copyright {
String author = '';
int year;
String license;

/// Construct a new [Copyright] with author, year and license.
Copyright({this.author = '', this.year, this.license});

@override
Expand Down
3 changes: 3 additions & 0 deletions lib/src/model/email.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:quiver/core.dart';

/// An email address. Broken into two parts (id and domain) to help prevent
/// email harvesting.
class Email {
String id;
String domain;

/// Construct a new [Email] with id and domain.
Email({this.id = '', this.domain = ''});

@override
Expand Down
3 changes: 3 additions & 0 deletions lib/src/model/gpx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import 'rte.dart';
import 'trk.dart';
import 'wpt.dart';

/// GPX documents contain a metadata header, followed by waypoints, routes, and
/// tracks. You can add your own elements to the extensions section of the GPX
/// document.
class Gpx {
String version = '1.1';
String creator = '';
Expand Down
1 change: 1 addition & 0 deletions lib/src/model/gpx_tag.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// GPX tags names.
class GpxTagV11 {
static const gpx = 'gpx';
static const version = 'version';
Expand Down
1 change: 1 addition & 0 deletions lib/src/model/kml_tag.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// KML tags names.
class KmlTagV22 {
static const kml = 'kml';

Expand Down
3 changes: 3 additions & 0 deletions lib/src/model/link.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import 'package:quiver/core.dart';

/// A link to an external resource (Web page, digital photo, video clip, etc)
/// with additional information.
class Link {
String href;
String text;
String type;

/// Construct a new [Link] object.
Link({this.href = '', this.text, this.type});

@override
Expand Down
4 changes: 4 additions & 0 deletions lib/src/model/metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import 'copyright.dart';
import 'link.dart';
import 'person.dart';

/// Information about the GPX file, author, and copyright restrictions goes in
/// the metadata section. Providing rich, meaningful information about your GPX
/// files allows others to search for and use your GPS data.
class Metadata {
String name;
String desc;
Expand All @@ -18,6 +21,7 @@ class Metadata {

Map<String, String> extensions = {};

/// Construct a new [Metadata] object.
Metadata(
{this.name,
this.desc,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/model/person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import 'package:quiver/core.dart';
import 'email.dart';
import 'link.dart';

/// A person or organization.
class Person {
String name;
Email email;
Link link;

/// Construct a new [Person] object.
Person({this.name, this.email, this.link});

@override
Expand Down
3 changes: 3 additions & 0 deletions lib/src/model/rte.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:quiver/core.dart';
import 'link.dart';
import 'wpt.dart';

/// Rte represents route - an ordered list of waypoints representing a series of
/// turn points leading to a destination.
class Rte {
String name;
String cmt;
Expand All @@ -17,6 +19,7 @@ class Rte {

List<Wpt> rtepts;

/// Construct a new [Rte] object.
Rte(
{this.name,
this.cmt,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/model/trk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:quiver/core.dart';
import 'link.dart';
import 'trkseg.dart';

/// Trk represents a track - an ordered list of points describing a path.
class Trk {
String name;
String cmt;
Expand All @@ -17,6 +18,7 @@ class Trk {

List<Trkseg> trksegs;

/// Construct a new [Trk] object.
Trk(
{this.name,
this.cmt,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/model/trkseg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import 'package:quiver/core.dart';

import 'wpt.dart';

/// A Track Segment holds a list of Track Points which are logically connected
/// in order. To represent a single GPS track where GPS reception was lost, or
/// the GPS receiver was turned off, start a new Track Segment for each
/// continuous span of track data.
class Trkseg {
List<Wpt> trkpts;
Map<String, String> extensions;

/// Construct a new [Trkseg] object.
Trkseg({List<Wpt> trkpts, Map<String, String> extensions})
: trkpts = trkpts ?? [],
extensions = extensions ?? <String, String>{};
Expand Down
2 changes: 2 additions & 0 deletions lib/src/model/wpt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'link.dart';

enum FixType { fix_2d, fix_3d, dgps, none, pps }

/// Wpt represents a waypoint, point of interest, or named feature on a map.
class Wpt {
double lat;
double lon;
Expand All @@ -29,6 +30,7 @@ class Wpt {

Map<String, String> extensions;

/// Construct a new [Wpt] object.
Wpt(
{this.lat = 0.0,
this.lon = 0.0,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: gpx
description: Package for load, manipulate, and save GPS data in GPX format (a light-weight XML data format for the interchange of GPS data - waypoints, routes, and tracks).
version: 1.0.1+1
version: 1.0.1+2
homepage: https://github.com/kb0/dart-gpx/

environment:
Expand Down

0 comments on commit 686e446

Please sign in to comment.