Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
padanyi-gulyasg committed Feb 18, 2020
0 parents commit b762fb7
Show file tree
Hide file tree
Showing 16 changed files with 957 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Declare files that will always have CRLF line endings on checkout.
*.dart text eol=lf
*.yaml text eol=lf
*.md text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Files and directories created by pub
.dart_tool/
.packages
.pub
# Remove the following pattern if you wish to check in your lock file
pubspec.lock

# Conventional directory for build outputs
build/

# Directory created by dartdoc
doc/api/

# IDE
.project
.settings
.idea
*.iml

# Temp files
*~
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: fabeb2a16f1d008ab8230f450c49141d35669798
channel: beta

project_type: package
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "0.2.0",
"configurations": [{
"name": "Dart",
"program": "example/mgrs_dart_example.dart",
"request": "launch",
"type": "dart"
}]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [0.0.1] - TODO: Add release date.

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# mgrs_dart

Utility for converting between WGS84 lat/lng and MGRS coordinates (Dart version of [proj4js/mgrs](https://github.com/proj4js/mgrs)).

Has 3 methods

- forward, takes an array of `[lon,lat]` and optional accuracy and returns an mgrs string
<!-- - inverse, takes an mgrs string and returns a bbox. -->
- toPoint, takes an mgrs string, returns an array of '[lon,lat]'
14 changes: 14 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml

# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types

analyzer:
# exclude:
# - path/to/excluded/files/**
16 changes: 16 additions & 0 deletions example/mgrs_dart_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:mgrs_dart/mgrs_dart.dart';

void main() {
List<double> point = [-115.08209766323476, 36.236123461597515];
String mgrsString = '11SPA7234911844';
int accuracy = 5;

var calculatedPoint = Mgrs.toPoint(mgrsString);
print('Mgrs.toPoint($mgrsString) = $calculatedPoint');

var calculatedMgrsString = Mgrs.forward(point, accuracy);
print('Mgrs.forward($point, $accuracy) = $calculatedMgrsString');

// var calculatedBox = Mgrs.inverse(mgrsString);
// print(calculatedBox);
}
6 changes: 6 additions & 0 deletions lib/mgrs_dart.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library mgrs_dart;

export 'package:mgrs_dart/src/classes/bbox.dart';
export 'package:mgrs_dart/src/classes/lonlat.dart';
export 'package:mgrs_dart/src/classes/utm.dart';
export 'package:mgrs_dart/src/mgrs.dart';
12 changes: 12 additions & 0 deletions lib/src/classes/bbox.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class BBox {
double top;
double bottom;
double right;
double left;

BBox({double top, double bottom, double right, double left})
: top = top,
bottom = bottom,
right = right,
left = left;
}
8 changes: 8 additions & 0 deletions lib/src/classes/lonlat.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class LonLat {
double lon;
double lat;

LonLat({double lon, double lat})
: lon = lon,
lat = lat;
}
19 changes: 19 additions & 0 deletions lib/src/classes/utm.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class UTM {
double easting;
double northing;
String zoneLetter;
int zoneNumber;
int accuracy;

UTM(
{double easting,
double northing,
String zoneLetter,
int zoneNumber,
int accuracy})
: easting = easting,
northing = northing,
zoneLetter = zoneLetter,
zoneNumber = zoneNumber,
accuracy = accuracy;
}
Loading

0 comments on commit b762fb7

Please sign in to comment.