├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── documentation-report.md └── workflows │ ├── build-test.yml │ └── build.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── docs ├── docs │ └── api │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ ├── allclasses-index.html │ │ ├── allclasses.html │ │ ├── allpackages-index.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── element-list │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── jquery │ │ ├── external │ │ │ └── jquery │ │ │ │ └── jquery.js │ │ ├── images │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ ├── ui-bg_glass_65_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_888888_256x240.png │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ ├── jquery-3.5.1.js │ │ ├── jquery-ui.css │ │ ├── jquery-ui.js │ │ ├── jquery-ui.min.css │ │ ├── jquery-ui.min.js │ │ ├── jquery-ui.structure.css │ │ ├── jquery-ui.structure.min.css │ │ ├── jszip-utils │ │ │ └── dist │ │ │ │ ├── jszip-utils-ie.js │ │ │ │ ├── jszip-utils-ie.min.js │ │ │ │ ├── jszip-utils.js │ │ │ │ └── jszip-utils.min.js │ │ └── jszip │ │ │ └── dist │ │ │ ├── jszip.js │ │ │ └── jszip.min.js │ │ ├── member-search-index.js │ │ ├── member-search-index.zip │ │ ├── mil │ │ └── nga │ │ │ └── mgrs │ │ │ ├── MGRS.html │ │ │ ├── MGRSConstants.html │ │ │ ├── MGRSUtils.html │ │ │ ├── class-use │ │ │ ├── MGRS.html │ │ │ ├── MGRSConstants.html │ │ │ └── MGRSUtils.html │ │ │ ├── features │ │ │ ├── GridLine.html │ │ │ ├── class-use │ │ │ │ └── GridLine.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── grid │ │ │ ├── Grid.html │ │ │ ├── GridLabel.html │ │ │ ├── GridLabeler.html │ │ │ ├── GridType.html │ │ │ ├── Grids.html │ │ │ ├── MGRSLabeler.html │ │ │ ├── ZoomGrids.html │ │ │ ├── class-use │ │ │ │ ├── Grid.html │ │ │ │ ├── GridLabel.html │ │ │ │ ├── GridLabeler.html │ │ │ │ ├── GridType.html │ │ │ │ ├── Grids.html │ │ │ │ ├── MGRSLabeler.html │ │ │ │ └── ZoomGrids.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── gzd │ │ │ ├── BandLetterRange.html │ │ │ ├── GZDLabeler.html │ │ │ ├── GridRange.html │ │ │ ├── GridZone.html │ │ │ ├── GridZones.html │ │ │ ├── LatitudeBand.html │ │ │ ├── LongitudinalStrip.html │ │ │ ├── ZoneNumberRange.html │ │ │ ├── class-use │ │ │ │ ├── BandLetterRange.html │ │ │ │ ├── GZDLabeler.html │ │ │ │ ├── GridRange.html │ │ │ │ ├── GridZone.html │ │ │ │ ├── GridZones.html │ │ │ │ ├── LatitudeBand.html │ │ │ │ ├── LongitudinalStrip.html │ │ │ │ └── ZoneNumberRange.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ ├── package-use.html │ │ │ ├── property │ │ │ ├── MGRSProperties.html │ │ │ ├── class-use │ │ │ │ └── MGRSProperties.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ └── utm │ │ │ ├── UTM.html │ │ │ ├── class-use │ │ │ └── UTM.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ ├── overview-summary.html │ │ ├── overview-tree.html │ │ ├── package-search-index.js │ │ ├── package-search-index.zip │ │ ├── resources │ │ ├── glass.png │ │ └── x.png │ │ ├── script.js │ │ ├── search.js │ │ ├── serialized-form.html │ │ ├── stylesheet.css │ │ ├── type-search-index.js │ │ └── type-search-index.zip ├── index.html └── stylesheets │ ├── github-light.css │ ├── normalize.css │ └── stylesheet.css ├── pom.xml └── src ├── main ├── java │ └── mil │ │ └── nga │ │ └── mgrs │ │ ├── MGRS.java │ │ ├── MGRSConstants.java │ │ ├── MGRSUtils.java │ │ ├── features │ │ └── GridLine.java │ │ ├── grid │ │ ├── Grid.java │ │ ├── GridLabel.java │ │ ├── GridLabeler.java │ │ ├── GridType.java │ │ ├── Grids.java │ │ ├── MGRSLabeler.java │ │ └── ZoomGrids.java │ │ ├── gzd │ │ ├── BandLetterRange.java │ │ ├── GZDLabeler.java │ │ ├── GridRange.java │ │ ├── GridZone.java │ │ ├── GridZones.java │ │ ├── LatitudeBand.java │ │ ├── LongitudinalStrip.java │ │ └── ZoneNumberRange.java │ │ ├── property │ │ └── MGRSProperties.java │ │ └── utm │ │ └── UTM.java └── resources │ └── mgrs.properties └── test └── java └── mil └── nga └── mgrs ├── MGRSTest.java ├── ReadmeTest.java ├── grid └── GridTypeTest.java └── gzd ├── BandLetterRangeTest.java └── GridZonesTest.java /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report an issue 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please fill out as much known and relevant information as possible. 11 | 12 | #### Version Information: 13 | 14 | * MGRS Java Version: 15 | * MGRS Java Source: (e.g. Central Repository, Release, Source Code Build) 16 | * IDE Name & Version: 17 | * Maven Version: (mvn -version) 18 | * Java Version: (java -version) 19 | * Platform & OS: 20 | * Other Relevant Libraries: 21 | 22 | #### Expected Results: 23 | 24 | * What did you expect to happen? 25 | 26 | #### Observed Results: 27 | 28 | * What happened instead? 29 | * How often does this occur? 30 | 31 | #### Output: 32 | 33 | * Any logs, errors, or output messages? 34 | 35 | #### Steps to Reproduce: 36 | 37 | 1. Step One 38 | 2. Step Two 39 | 3. ... 40 | 41 | #### Relevant Code: 42 | 43 | ```java 44 | // Code to reproduce the problem? 45 | ``` 46 | 47 | #### Test Files: 48 | 49 | * Links to any files needed for testing? 50 | 51 | #### Additional Information: 52 | 53 | * Any additional configuration, data, or information that might help with the issue? 54 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | 2 | blank_issues_enabled: false 3 | contact_links: 4 | - name: Discussions 5 | url: https://github.com/ngageoint/mgrs-java/discussions 6 | about: Questions, Feature Requests, Feedback, Conversations 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation report 3 | about: Report a documentation issue 4 | title: '' 5 | labels: documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the documentation issue** 11 | A clear and concise description of what the issue is. 12 | 13 | **Additional context** 14 | Add any other context about the issue here. 15 | -------------------------------------------------------------------------------- /.github/workflows/build-test.yml: -------------------------------------------------------------------------------- 1 | name: Build & Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | 9 | jobs: 10 | 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout Repository 17 | uses: actions/checkout@v3 18 | - name: Set up JDK 11 19 | uses: actions/setup-java@v3 20 | with: 21 | distribution: 'temurin' 22 | java-version: 11 23 | - name: Build & Test 24 | run: mvn clean package 25 | - name: Copy Release Artifacts 26 | run: | 27 | mkdir target/release 28 | cp pom.xml target/*.jar target/release/ 29 | - name: Upload Artifacts 30 | uses: actions/upload-artifact@v1 31 | with: 32 | name: mgrs 33 | path: target/release 34 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - master 7 | 8 | jobs: 9 | 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout Repository 16 | uses: actions/checkout@v3 17 | - name: Set up JDK 11 18 | uses: actions/setup-java@v3 19 | with: 20 | distribution: 'temurin' 21 | java-version: 11 22 | - name: Build 23 | run: mvn clean package -DskipTests 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /bin/ 3 | 4 | # IntelliJ 5 | .idea 6 | *.iml 7 | 8 | # Eclipse Core 9 | .project 10 | .settings/ 11 | 12 | # JDT-specific (Eclipse Java Development Tools) 13 | .classpath 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | Adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | --- 6 | 7 | ## 2.1.4 (TBD) 8 | 9 | * TBD 10 | 11 | ## [2.1.3](https://github.com/ngageoint/mgrs-java/releases/tag/2.1.3) (04-03-2024) 12 | 13 | * grid version 1.1.2 14 | 15 | ## [2.1.2](https://github.com/ngageoint/mgrs-java/releases/tag/2.1.2) (01-23-2023) 16 | 17 | * grid version 1.1.1 18 | 19 | ## [2.1.1](https://github.com/ngageoint/mgrs-java/releases/tag/2.1.1) (01-13-2023) 20 | 21 | * Point to MGRS conversion latitude min/max bounding and longitude normalization 22 | 23 | ## [2.1.0](https://github.com/ngageoint/mgrs-java/releases/tag/2.1.0) (09-22-2022) 24 | 25 | * grid version 1.1.0 26 | 27 | ## [2.0.0](https://github.com/ngageoint/mgrs-java/releases/tag/2.0.0) (07-08-2022) 28 | 29 | * grid-java common grid library dependency and refactor 30 | 31 | ## [1.0.1](https://github.com/ngageoint/mgrs-java/releases/tag/1.0.1) (06-15-2022) 32 | 33 | * Handle parsing invalid Svalbard zones (32X, 34X, 36X) 34 | 35 | ## [1.0.0](https://github.com/ngageoint/mgrs-java/releases/tag/1.0.0) (06-14-2022) 36 | 37 | * Initial Release 38 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 National Geospatial-Intelligence Agency 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MGRS Java 2 | 3 | #### Military Grid Reference System Lib #### 4 | 5 | The MGRS Library was developed at the [National Geospatial-Intelligence Agency (NGA)](http://www.nga.mil/) in collaboration with [BIT Systems](https://www.caci.com/bit-systems/). The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the [MIT license](http://choosealicense.com/licenses/mit/). 6 | 7 | ### Pull Requests ### 8 | If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license. 9 | 10 | Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license. 11 | 12 | ### About ### 13 | 14 | [MGRS](http://ngageoint.github.io/mgrs-java/) is a Java library providing Military Grid Reference System functionality, a geocoordinate standard used by NATO militaries for locating points on Earth. 15 | 16 | ### Usage ### 17 | 18 | View the latest [Javadoc](http://ngageoint.github.io/mgrs-java/docs/api/) 19 | 20 | #### Coordinates #### 21 | 22 | ```java 23 | 24 | MGRS mgrs = MGRS.parse("33XVG74594359"); 25 | Point point = mgrs.toPoint(); 26 | Point pointMeters = point.toMeters(); 27 | UTM utm = mgrs.toUTM(); 28 | String utmCoordinate = utm.toString(); 29 | Point point2 = utm.toPoint(); 30 | 31 | MGRS mgrs2 = MGRS.parse("33X VG 74596 43594"); 32 | 33 | double latitude = 63.98862388; 34 | double longitude = 29.06755082; 35 | Point point3 = Point.point(longitude, latitude); 36 | MGRS mgrs3 = MGRS.from(point3); 37 | String mgrsCoordinate = mgrs3.toString(); 38 | String mgrsGZD = mgrs3.coordinate(GridType.GZD); 39 | String mgrs100k = mgrs3.coordinate(GridType.HUNDRED_KILOMETER); 40 | String mgrs10k = mgrs3.coordinate(GridType.TEN_KILOMETER); 41 | String mgrs1k = mgrs3.coordinate(GridType.KILOMETER); 42 | String mgrs100m = mgrs3.coordinate(GridType.HUNDRED_METER); 43 | String mgrs10m = mgrs3.coordinate(GridType.TEN_METER); 44 | String mgrs1m = mgrs3.coordinate(GridType.METER); 45 | 46 | UTM utm2 = UTM.from(point3); 47 | MGRS mgrs4 = utm2.toMGRS(); 48 | 49 | UTM utm3 = UTM.parse("18 N 585628 4511322"); 50 | MGRS mgrs5 = utm3.toMGRS(); 51 | 52 | ``` 53 | 54 | #### Draw Tile Template #### 55 | 56 | See [mgrs-android](https://github.com/ngageoint/mgrs-android) for a concrete example 57 | 58 | ```java 59 | 60 | // GridTile tile = ...; 61 | 62 | Grids grids = Grids.create(); 63 | 64 | ZoomGrids zoomGrids = grids.getGrids(tile.getZoom()); 65 | if (zoomGrids.hasGrids()) { 66 | 67 | GridRange gridRange = GridZones.getGridRange(tile.getBounds()); 68 | 69 | for (Grid grid : zoomGrids) { 70 | 71 | // draw this grid for each zone 72 | for (GridZone zone : gridRange) { 73 | 74 | List lines = grid.getLines(tile, zone); 75 | if (lines != null) { 76 | PixelRange pixelRange = zone.getBounds() 77 | .getPixelRange(tile); 78 | for (GridLine line : lines) { 79 | Pixel pixel1 = line.getPoint1().getPixel(tile); 80 | Pixel pixel2 = line.getPoint2().getPixel(tile); 81 | // Draw line 82 | } 83 | } 84 | 85 | List labels = grid.getLabels(tile, zone); 86 | if (labels != null) { 87 | for (GridLabel label : labels) { 88 | PixelRange pixelRange = label.getBounds() 89 | .getPixelRange(tile); 90 | Pixel centerPixel = label.getCenter() 91 | .getPixel(tile); 92 | // Draw label 93 | } 94 | } 95 | 96 | } 97 | } 98 | } 99 | 100 | ``` 101 | 102 | #### Properties #### 103 | 104 | Default grid properties including zoom ranges, styles, and labelers are defined in [mgrs.properties](https://github.com/ngageoint/mgrs-java/blob/master/src/main/resources/mgrs.properties). The defaults can be changed in code by modifying the [Grids](https://github.com/ngageoint/mgrs-java/blob/master/src/main/java/mil/nga/mgrs/grid/Grids.java). 105 | 106 | ### Installation ### 107 | 108 | Pull from the [Maven Central Repository](http://search.maven.org/#artifactdetails|mil.nga|mgrs|2.1.3|jar) (JAR, POM, Source, Javadoc) 109 | 110 | 111 | mil.nga 112 | mgrs 113 | 2.1.3 114 | 115 | 116 | ### Build ### 117 | 118 | [![Build & Test](https://github.com/ngageoint/mgrs-java/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/mgrs-java/actions/workflows/build-test.yml) 119 | 120 | Build this repository using Eclipse and/or Maven: 121 | 122 | mvn clean install 123 | 124 | ### Remote Dependencies ### 125 | 126 | * [Grid Java](https://github.com/ngageoint/grid-java) (The MIT License (MIT)) - Grid Library 127 | -------------------------------------------------------------------------------- /docs/docs/api/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: Maven Javadoc Plugin 3.6.3 3 | Build-Jdk-Spec: 11 4 | 5 | -------------------------------------------------------------------------------- /docs/docs/api/allclasses.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |

All Classes

22 |
23 | 46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/docs/api/allpackages-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Packages (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

All Packages

98 |
99 |
100 | 137 |
138 |
139 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /docs/docs/api/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Deprecated API

98 |

Contents

99 |
100 |
101 |
102 | 146 |

Copyright © 2024 National Geospatial-Intelligence Agency. All rights reserved.

147 |
148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/element-list: -------------------------------------------------------------------------------- 1 | mil.nga.mgrs 2 | mil.nga.mgrs.features 3 | mil.nga.mgrs.grid 4 | mil.nga.mgrs.gzd 5 | mil.nga.mgrs.property 6 | mil.nga.mgrs.utm 7 | -------------------------------------------------------------------------------- /docs/docs/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |

Military Grid Reference System 2.1.3 API

97 |
98 |
99 |
100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 |
Packages 
PackageDescription
mil.nga.mgrs 
mil.nga.mgrs.features 
mil.nga.mgrs.grid 
mil.nga.mgrs.gzd 
mil.nga.mgrs.property 
mil.nga.mgrs.utm 
133 |
134 |
135 |
136 | 180 |

Copyright © 2024 National Geospatial-Intelligence Agency. All rights reserved.

181 |
182 | 183 | 184 | -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_glass_65_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_glass_65_dadada_1x400.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/jquery/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /docs/docs/api/jquery/jquery-ui.structure.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.12.1 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | /* Layout helpers 12 | ----------------------------------*/ 13 | .ui-helper-hidden { 14 | display: none; 15 | } 16 | .ui-helper-hidden-accessible { 17 | border: 0; 18 | clip: rect(0 0 0 0); 19 | height: 1px; 20 | margin: -1px; 21 | overflow: hidden; 22 | padding: 0; 23 | position: absolute; 24 | width: 1px; 25 | } 26 | .ui-helper-reset { 27 | margin: 0; 28 | padding: 0; 29 | border: 0; 30 | outline: 0; 31 | line-height: 1.3; 32 | text-decoration: none; 33 | font-size: 100%; 34 | list-style: none; 35 | } 36 | .ui-helper-clearfix:before, 37 | .ui-helper-clearfix:after { 38 | content: ""; 39 | display: table; 40 | border-collapse: collapse; 41 | } 42 | .ui-helper-clearfix:after { 43 | clear: both; 44 | } 45 | .ui-helper-zfix { 46 | width: 100%; 47 | height: 100%; 48 | top: 0; 49 | left: 0; 50 | position: absolute; 51 | opacity: 0; 52 | filter:Alpha(Opacity=0); /* support: IE8 */ 53 | } 54 | 55 | .ui-front { 56 | z-index: 100; 57 | } 58 | 59 | 60 | /* Interaction Cues 61 | ----------------------------------*/ 62 | .ui-state-disabled { 63 | cursor: default !important; 64 | pointer-events: none; 65 | } 66 | 67 | 68 | /* Icons 69 | ----------------------------------*/ 70 | .ui-icon { 71 | display: inline-block; 72 | vertical-align: middle; 73 | margin-top: -.25em; 74 | position: relative; 75 | text-indent: -99999px; 76 | overflow: hidden; 77 | background-repeat: no-repeat; 78 | } 79 | 80 | .ui-widget-icon-block { 81 | left: 50%; 82 | margin-left: -8px; 83 | display: block; 84 | } 85 | 86 | /* Misc visuals 87 | ----------------------------------*/ 88 | 89 | /* Overlays */ 90 | .ui-widget-overlay { 91 | position: fixed; 92 | top: 0; 93 | left: 0; 94 | width: 100%; 95 | height: 100%; 96 | } 97 | .ui-autocomplete { 98 | position: absolute; 99 | top: 0; 100 | left: 0; 101 | cursor: default; 102 | } 103 | .ui-menu { 104 | list-style: none; 105 | padding: 0; 106 | margin: 0; 107 | display: block; 108 | outline: 0; 109 | } 110 | .ui-menu .ui-menu { 111 | position: absolute; 112 | } 113 | .ui-menu .ui-menu-item { 114 | margin: 0; 115 | cursor: pointer; 116 | /* support: IE10, see #8844 */ 117 | list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); 118 | } 119 | .ui-menu .ui-menu-item-wrapper { 120 | position: relative; 121 | padding: 3px 1em 3px .4em; 122 | } 123 | .ui-menu .ui-menu-divider { 124 | margin: 5px 0; 125 | height: 0; 126 | font-size: 0; 127 | line-height: 0; 128 | border-width: 1px 0 0 0; 129 | } 130 | .ui-menu .ui-state-focus, 131 | .ui-menu .ui-state-active { 132 | margin: -1px; 133 | } 134 | 135 | /* icon support */ 136 | .ui-menu-icons { 137 | position: relative; 138 | } 139 | .ui-menu-icons .ui-menu-item-wrapper { 140 | padding-left: 2em; 141 | } 142 | 143 | /* left-aligned */ 144 | .ui-menu .ui-icon { 145 | position: absolute; 146 | top: 0; 147 | bottom: 0; 148 | left: .2em; 149 | margin: auto 0; 150 | } 151 | 152 | /* right-aligned */ 153 | .ui-menu .ui-menu-icon { 154 | left: auto; 155 | right: 0; 156 | } 157 | -------------------------------------------------------------------------------- /docs/docs/api/jquery/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.12.1 - 2018-12-06 2 | * http://jqueryui.com 3 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} -------------------------------------------------------------------------------- /docs/docs/api/jquery/jszip-utils/dist/jszip-utils-ie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | ;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\r\n"+ 18 | "\r\n"; 32 | 33 | // inject VBScript 34 | document.write(IEBinaryToArray_ByteStr_Script); 35 | 36 | global.JSZipUtils._getBinaryFromXHR = function (xhr) { 37 | var binary = xhr.responseBody; 38 | var byteMapping = {}; 39 | for ( var i = 0; i < 256; i++ ) { 40 | for ( var j = 0; j < 256; j++ ) { 41 | byteMapping[ String.fromCharCode( i + (j << 8) ) ] = 42 | String.fromCharCode(i) + String.fromCharCode(j); 43 | } 44 | } 45 | var rawBytes = IEBinaryToArray_ByteStr(binary); 46 | var lastChr = IEBinaryToArray_ByteStr_Last(binary); 47 | return rawBytes.replace(/[\s\S]/g, function( match ) { 48 | return byteMapping[match]; 49 | }) + lastChr; 50 | }; 51 | 52 | // enforcing Stuk's coding style 53 | // vim: set shiftwidth=4 softtabstop=4: 54 | 55 | },{}]},{},[1]) 56 | ; 57 | -------------------------------------------------------------------------------- /docs/docs/api/jquery/jszip-utils/dist/jszip-utils-ie.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); 11 | -------------------------------------------------------------------------------- /docs/docs/api/jquery/jszip-utils/dist/jszip-utils.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g 2 | 3 | 4 | 5 | 6 | Uses of Class mil.nga.mgrs.MGRSConstants (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Class
mil.nga.mgrs.MGRSConstants

98 |
99 |
No usage of mil.nga.mgrs.MGRSConstants
100 |
101 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/class-use/MGRSUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class mil.nga.mgrs.MGRSUtils (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Class
mil.nga.mgrs.MGRSUtils

98 |
99 |
No usage of mil.nga.mgrs.MGRSUtils
100 |
101 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/features/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs.features (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Package mil.nga.mgrs.features

98 |
99 |
100 |
    101 |
  • 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 114 | 115 | 116 |
    Class Summary 
    ClassDescription
    GridLine 112 |
    Line between two points
    113 |
    117 |
  • 118 |
119 |
120 |
121 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/grid/class-use/MGRSLabeler.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class mil.nga.mgrs.grid.MGRSLabeler (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Class
mil.nga.mgrs.grid.MGRSLabeler

98 |
99 |
No usage of mil.nga.mgrs.grid.MGRSLabeler
100 |
101 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/gzd/class-use/GZDLabeler.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class mil.nga.mgrs.gzd.GZDLabeler (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Class
mil.nga.mgrs.gzd.GZDLabeler

98 |
99 |
No usage of mil.nga.mgrs.gzd.GZDLabeler
100 |
101 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/gzd/class-use/GridZones.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class mil.nga.mgrs.gzd.GridZones (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Class
mil.nga.mgrs.gzd.GridZones

98 |
99 |
No usage of mil.nga.mgrs.gzd.GridZones
100 |
101 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Package mil.nga.mgrs

98 |
99 |
100 |
    101 |
  • 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 114 | 115 | 116 | 117 | 120 | 121 | 122 | 123 | 126 | 127 | 128 |
    Class Summary 
    ClassDescription
    MGRS 112 |
    Military Grid Reference System Coordinate
    113 |
    MGRSConstants 118 |
    Military Grid Reference System Constants
    119 |
    MGRSUtils 124 |
    Military Grid Reference System utilities
    125 |
    129 |
  • 130 |
131 |
132 |
133 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs Class Hierarchy (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Hierarchy For Package mil.nga.mgrs

98 | Package Hierarchies: 99 | 102 |
103 |
104 |
105 |

Class Hierarchy

106 | 115 |
116 |
117 |
118 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/property/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs.property (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Package mil.nga.mgrs.property

98 |
99 |
100 |
    101 |
  • 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 114 | 115 | 116 |
    Class Summary 
    ClassDescription
    MGRSProperties 112 |
    MGRS property loader
    113 |
    117 |
  • 118 |
119 |
120 |
121 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/property/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs.property Class Hierarchy (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Hierarchy For Package mil.nga.mgrs.property

98 | Package Hierarchies: 99 | 102 |
103 |
104 |
105 |

Class Hierarchy

106 | 117 |
118 |
119 |
120 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/property/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Package mil.nga.mgrs.property (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Uses of Package
mil.nga.mgrs.property

98 |
99 |
100 | 136 |
137 |
138 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/utm/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs.utm (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Package mil.nga.mgrs.utm

98 |
99 |
100 |
    101 |
  • 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 114 | 115 | 116 |
    Class Summary 
    ClassDescription
    UTM 112 |
    Universal Transverse Mercator Projection
    113 |
    117 |
  • 118 |
119 |
120 |
121 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/docs/api/mil/nga/mgrs/utm/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mil.nga.mgrs.utm Class Hierarchy (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Hierarchy For Package mil.nga.mgrs.utm

98 | Package Hierarchies: 99 | 102 |
103 |
104 |
105 |

Class Hierarchy

106 |
    107 |
  • java.lang.Object 108 |
      109 |
    • mil.nga.mgrs.utm.UTM
    • 110 |
    111 |
  • 112 |
113 |
114 |
115 |
116 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/docs/api/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Military Grid Reference System 2.1.3 API 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 |
17 | 20 |

index.html

21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/docs/api/package-search-index.js: -------------------------------------------------------------------------------- 1 | packageSearchIndex = [{"l":"All Packages","url":"allpackages-index.html"},{"l":"mil.nga.mgrs"},{"l":"mil.nga.mgrs.features"},{"l":"mil.nga.mgrs.grid"},{"l":"mil.nga.mgrs.gzd"},{"l":"mil.nga.mgrs.property"},{"l":"mil.nga.mgrs.utm"}] -------------------------------------------------------------------------------- /docs/docs/api/package-search-index.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/package-search-index.zip -------------------------------------------------------------------------------- /docs/docs/api/resources/glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/resources/glass.png -------------------------------------------------------------------------------- /docs/docs/api/resources/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/resources/x.png -------------------------------------------------------------------------------- /docs/docs/api/script.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. 3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 | * 5 | * 6 | * 7 | * 8 | * 9 | * 10 | * 11 | * 12 | * 13 | * 14 | * 15 | * 16 | * 17 | * 18 | * 19 | * 20 | * 21 | * 22 | * 23 | * 24 | */ 25 | 26 | var moduleSearchIndex; 27 | var packageSearchIndex; 28 | var typeSearchIndex; 29 | var memberSearchIndex; 30 | var tagSearchIndex; 31 | function loadScripts(doc, tag) { 32 | createElem(doc, tag, 'jquery/jszip/dist/jszip.js'); 33 | createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js'); 34 | if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 || 35 | window.navigator.userAgent.indexOf('Edge/') > 0) { 36 | createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js'); 37 | } 38 | createElem(doc, tag, 'search.js'); 39 | 40 | $.get(pathtoroot + "module-search-index.zip") 41 | .done(function() { 42 | JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) { 43 | JSZip.loadAsync(data).then(function(zip){ 44 | zip.file("module-search-index.json").async("text").then(function(content){ 45 | moduleSearchIndex = JSON.parse(content); 46 | }); 47 | }); 48 | }); 49 | }); 50 | $.get(pathtoroot + "package-search-index.zip") 51 | .done(function() { 52 | JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) { 53 | JSZip.loadAsync(data).then(function(zip){ 54 | zip.file("package-search-index.json").async("text").then(function(content){ 55 | packageSearchIndex = JSON.parse(content); 56 | }); 57 | }); 58 | }); 59 | }); 60 | $.get(pathtoroot + "type-search-index.zip") 61 | .done(function() { 62 | JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) { 63 | JSZip.loadAsync(data).then(function(zip){ 64 | zip.file("type-search-index.json").async("text").then(function(content){ 65 | typeSearchIndex = JSON.parse(content); 66 | }); 67 | }); 68 | }); 69 | }); 70 | $.get(pathtoroot + "member-search-index.zip") 71 | .done(function() { 72 | JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) { 73 | JSZip.loadAsync(data).then(function(zip){ 74 | zip.file("member-search-index.json").async("text").then(function(content){ 75 | memberSearchIndex = JSON.parse(content); 76 | }); 77 | }); 78 | }); 79 | }); 80 | $.get(pathtoroot + "tag-search-index.zip") 81 | .done(function() { 82 | JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) { 83 | JSZip.loadAsync(data).then(function(zip){ 84 | zip.file("tag-search-index.json").async("text").then(function(content){ 85 | tagSearchIndex = JSON.parse(content); 86 | }); 87 | }); 88 | }); 89 | }); 90 | if (!moduleSearchIndex) { 91 | createElem(doc, tag, 'module-search-index.js'); 92 | } 93 | if (!packageSearchIndex) { 94 | createElem(doc, tag, 'package-search-index.js'); 95 | } 96 | if (!typeSearchIndex) { 97 | createElem(doc, tag, 'type-search-index.js'); 98 | } 99 | if (!memberSearchIndex) { 100 | createElem(doc, tag, 'member-search-index.js'); 101 | } 102 | if (!tagSearchIndex) { 103 | createElem(doc, tag, 'tag-search-index.js'); 104 | } 105 | $(window).resize(function() { 106 | $('.navPadding').css('padding-top', $('.fixedNav').css("height")); 107 | }); 108 | } 109 | 110 | function createElem(doc, tag, path) { 111 | var script = doc.createElement(tag); 112 | var scriptElement = doc.getElementsByTagName(tag)[0]; 113 | script.src = pathtoroot + path; 114 | scriptElement.parentNode.insertBefore(script, scriptElement); 115 | } 116 | 117 | function show(type) { 118 | count = 0; 119 | for (var key in data) { 120 | var row = document.getElementById(key); 121 | if ((data[key] & type) !== 0) { 122 | row.style.display = ''; 123 | row.className = (count++ % 2) ? rowColor : altColor; 124 | } 125 | else 126 | row.style.display = 'none'; 127 | } 128 | updateTabs(type); 129 | } 130 | 131 | function updateTabs(type) { 132 | for (var value in tabs) { 133 | var sNode = document.getElementById(tabs[value][0]); 134 | var spanNode = sNode.firstChild; 135 | if (value == type) { 136 | sNode.className = activeTableTab; 137 | spanNode.innerHTML = tabs[value][1]; 138 | } 139 | else { 140 | sNode.className = tableTab; 141 | spanNode.innerHTML = "" + tabs[value][1] + ""; 142 | } 143 | } 144 | } 145 | 146 | function updateModuleFrame(pFrame, cFrame) { 147 | top.packageFrame.location = pFrame; 148 | top.classFrame.location = cFrame; 149 | } 150 | -------------------------------------------------------------------------------- /docs/docs/api/serialized-form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Serialized Form (Military Grid Reference System 2.1.3 API) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 33 | 36 |
37 | 94 |
95 |
96 |
97 |

Serialized Form

98 |
99 |
100 |
    101 |
  • 102 |
    103 |

    Package mil.nga.mgrs.features

    104 |
      105 |
    • 106 | 107 | 108 |

      Class mil.nga.mgrs.features.GridLine extends Line implements Serializable

      109 |
      110 |
      serialVersionUID:
      111 |
      1L
      112 |
      113 |
        114 |
      • 115 |

        Serialized Fields

        116 |
          117 |
        • 118 |

          gridType

          119 |
          GridType gridType
          120 |
          Grid type the line represents if any
          121 |
        • 122 |
        123 |
      • 124 |
      125 |
    • 126 |
    127 |
    128 |
  • 129 |
130 |
131 |
132 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/docs/api/type-search-index.js: -------------------------------------------------------------------------------- 1 | typeSearchIndex = [{"l":"All Classes","url":"allclasses-index.html"},{"p":"mil.nga.mgrs.gzd","l":"BandLetterRange"},{"p":"mil.nga.mgrs.grid","l":"Grid"},{"p":"mil.nga.mgrs.grid","l":"GridLabel"},{"p":"mil.nga.mgrs.grid","l":"GridLabeler"},{"p":"mil.nga.mgrs.features","l":"GridLine"},{"p":"mil.nga.mgrs.gzd","l":"GridRange"},{"p":"mil.nga.mgrs.grid","l":"Grids"},{"p":"mil.nga.mgrs.grid","l":"GridType"},{"p":"mil.nga.mgrs.gzd","l":"GridZone"},{"p":"mil.nga.mgrs.gzd","l":"GridZones"},{"p":"mil.nga.mgrs.gzd","l":"GZDLabeler"},{"p":"mil.nga.mgrs.gzd","l":"LatitudeBand"},{"p":"mil.nga.mgrs.gzd","l":"LongitudinalStrip"},{"p":"mil.nga.mgrs","l":"MGRS"},{"p":"mil.nga.mgrs","l":"MGRSConstants"},{"p":"mil.nga.mgrs.grid","l":"MGRSLabeler"},{"p":"mil.nga.mgrs.property","l":"MGRSProperties"},{"p":"mil.nga.mgrs","l":"MGRSUtils"},{"p":"mil.nga.mgrs.utm","l":"UTM"},{"p":"mil.nga.mgrs.gzd","l":"ZoneNumberRange"},{"p":"mil.nga.mgrs.grid","l":"ZoomGrids"}] -------------------------------------------------------------------------------- /docs/docs/api/type-search-index.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngageoint/mgrs-java/5eb9daf231d18b4ae7200a89225bfb80995f1c65/docs/docs/api/type-search-index.zip -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MGRS Java 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 22 | 23 |
24 | 25 |

The MGRS Java library was developed by the National Geospatial-Intelligence Agency (NGA) in collaboration with BIT Systems. 26 | 27 |

MGRS is a Java library providing Military Grid Reference System functionality, a geocoordinate standard used by NATO militaries for locating points on Earth.

28 | 29 | 39 | 40 |
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/stylesheets/github-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 GitHub Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | 18 | .pl-c /* comment */ { 19 | color: #969896; 20 | } 21 | 22 | .pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, 23 | .pl-s .pl-v /* string variable */ { 24 | color: #0086b3; 25 | } 26 | 27 | .pl-e /* entity */, 28 | .pl-en /* entity.name */ { 29 | color: #795da3; 30 | } 31 | 32 | .pl-s .pl-s1 /* string source */, 33 | .pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { 34 | color: #333; 35 | } 36 | 37 | .pl-ent /* entity.name.tag */ { 38 | color: #63a35c; 39 | } 40 | 41 | .pl-k /* keyword, storage, storage.type */ { 42 | color: #a71d5d; 43 | } 44 | 45 | .pl-pds /* punctuation.definition.string, string.regexp.character-class */, 46 | .pl-s /* string */, 47 | .pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, 48 | .pl-sr /* string.regexp */, 49 | .pl-sr .pl-cce /* string.regexp constant.character.escape */, 50 | .pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, 51 | .pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { 52 | color: #183691; 53 | } 54 | 55 | .pl-v /* variable */ { 56 | color: #ed6a43; 57 | } 58 | 59 | .pl-id /* invalid.deprecated */ { 60 | color: #b52a1d; 61 | } 62 | 63 | .pl-ii /* invalid.illegal */ { 64 | background-color: #b52a1d; 65 | color: #f8f8f8; 66 | } 67 | 68 | .pl-sr .pl-cce /* string.regexp constant.character.escape */ { 69 | color: #63a35c; 70 | font-weight: bold; 71 | } 72 | 73 | .pl-ml /* markup.list */ { 74 | color: #693a17; 75 | } 76 | 77 | .pl-mh /* markup.heading */, 78 | .pl-mh .pl-en /* markup.heading entity.name */, 79 | .pl-ms /* meta.separator */ { 80 | color: #1d3e81; 81 | font-weight: bold; 82 | } 83 | 84 | .pl-mq /* markup.quote */ { 85 | color: #008080; 86 | } 87 | 88 | .pl-mi /* markup.italic */ { 89 | color: #333; 90 | font-style: italic; 91 | } 92 | 93 | .pl-mb /* markup.bold */ { 94 | color: #333; 95 | font-weight: bold; 96 | } 97 | 98 | .pl-md /* markup.deleted, meta.diff.header.from-file */ { 99 | background-color: #ffecec; 100 | color: #bd2c00; 101 | } 102 | 103 | .pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { 104 | background-color: #eaffea; 105 | color: #55a532; 106 | } 107 | 108 | .pl-mdr /* meta.diff.range */ { 109 | color: #795da3; 110 | font-weight: bold; 111 | } 112 | 113 | .pl-mo /* meta.output */ { 114 | color: #1d3e81; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /docs/stylesheets/stylesheet.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; } 3 | 4 | body { 5 | padding: 0; 6 | margin: 0; 7 | font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; 8 | font-size: 16px; 9 | line-height: 1.5; 10 | color: #606c71; } 11 | 12 | a { 13 | color: #1e6bb8; 14 | text-decoration: none; } 15 | a:hover { 16 | text-decoration: underline; } 17 | 18 | .btn { 19 | display: inline-block; 20 | margin-bottom: 1rem; 21 | color: rgba(255, 255, 255, 0.7); 22 | background-color: rgba(255, 255, 255, 0.08); 23 | border-color: rgba(255, 255, 255, 0.2); 24 | border-style: solid; 25 | border-width: 1px; 26 | border-radius: 0.3rem; 27 | transition: color 0.2s, background-color 0.2s, border-color 0.2s; } 28 | .btn + .btn { 29 | margin-left: 1rem; } 30 | 31 | .btn:hover { 32 | color: rgba(255, 255, 255, 0.8); 33 | text-decoration: none; 34 | background-color: rgba(255, 255, 255, 0.2); 35 | border-color: rgba(255, 255, 255, 0.3); } 36 | 37 | @media screen and (min-width: 64em) { 38 | .btn { 39 | padding: 0.75rem 1rem; } } 40 | 41 | @media screen and (min-width: 42em) and (max-width: 64em) { 42 | .btn { 43 | padding: 0.6rem 0.9rem; 44 | font-size: 0.9rem; } } 45 | 46 | @media screen and (max-width: 42em) { 47 | .btn { 48 | display: block; 49 | width: 100%; 50 | padding: 0.75rem; 51 | font-size: 0.9rem; } 52 | .btn + .btn { 53 | margin-top: 1rem; 54 | margin-left: 0; } } 55 | 56 | .page-header { 57 | color: #fff; 58 | text-align: center; 59 | background-color: #159957; 60 | background-image: linear-gradient(120deg, #155799, #159957); } 61 | 62 | @media screen and (min-width: 64em) { 63 | .page-header { 64 | padding: 5rem 6rem; } } 65 | 66 | @media screen and (min-width: 42em) and (max-width: 64em) { 67 | .page-header { 68 | padding: 3rem 4rem; } } 69 | 70 | @media screen and (max-width: 42em) { 71 | .page-header { 72 | padding: 2rem 1rem; } } 73 | 74 | .project-name { 75 | margin-top: 0; 76 | margin-bottom: 0.1rem; } 77 | 78 | @media screen and (min-width: 64em) { 79 | .project-name { 80 | font-size: 3.25rem; } } 81 | 82 | @media screen and (min-width: 42em) and (max-width: 64em) { 83 | .project-name { 84 | font-size: 2.25rem; } } 85 | 86 | @media screen and (max-width: 42em) { 87 | .project-name { 88 | font-size: 1.75rem; } } 89 | 90 | .project-tagline { 91 | margin-bottom: 2rem; 92 | font-weight: normal; 93 | opacity: 0.7; } 94 | 95 | @media screen and (min-width: 64em) { 96 | .project-tagline { 97 | font-size: 1.25rem; } } 98 | 99 | @media screen and (min-width: 42em) and (max-width: 64em) { 100 | .project-tagline { 101 | font-size: 1.15rem; } } 102 | 103 | @media screen and (max-width: 42em) { 104 | .project-tagline { 105 | font-size: 1rem; } } 106 | 107 | .main-content :first-child { 108 | margin-top: 0; } 109 | .main-content img { 110 | max-width: 100%; } 111 | .main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 { 112 | margin-top: 2rem; 113 | margin-bottom: 1rem; 114 | font-weight: normal; 115 | color: #159957; } 116 | .main-content p { 117 | margin-bottom: 1em; } 118 | .main-content code { 119 | padding: 2px 4px; 120 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 121 | font-size: 0.9rem; 122 | color: #383e41; 123 | background-color: #f3f6fa; 124 | border-radius: 0.3rem; } 125 | .main-content pre { 126 | padding: 0.8rem; 127 | margin-top: 0; 128 | margin-bottom: 1rem; 129 | font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; 130 | color: #567482; 131 | word-wrap: normal; 132 | background-color: #f3f6fa; 133 | border: solid 1px #dce6f0; 134 | border-radius: 0.3rem; } 135 | .main-content pre > code { 136 | padding: 0; 137 | margin: 0; 138 | font-size: 0.9rem; 139 | color: #567482; 140 | word-break: normal; 141 | white-space: pre; 142 | background: transparent; 143 | border: 0; } 144 | .main-content .highlight { 145 | margin-bottom: 1rem; } 146 | .main-content .highlight pre { 147 | margin-bottom: 0; 148 | word-break: normal; } 149 | .main-content .highlight pre, .main-content pre { 150 | padding: 0.8rem; 151 | overflow: auto; 152 | font-size: 0.9rem; 153 | line-height: 1.45; 154 | border-radius: 0.3rem; } 155 | .main-content pre code, .main-content pre tt { 156 | display: inline; 157 | max-width: initial; 158 | padding: 0; 159 | margin: 0; 160 | overflow: initial; 161 | line-height: inherit; 162 | word-wrap: normal; 163 | background-color: transparent; 164 | border: 0; } 165 | .main-content pre code:before, .main-content pre code:after, .main-content pre tt:before, .main-content pre tt:after { 166 | content: normal; } 167 | .main-content ul, .main-content ol { 168 | margin-top: 0; } 169 | .main-content blockquote { 170 | padding: 0 1rem; 171 | margin-left: 0; 172 | color: #819198; 173 | border-left: 0.3rem solid #dce6f0; } 174 | .main-content blockquote > :first-child { 175 | margin-top: 0; } 176 | .main-content blockquote > :last-child { 177 | margin-bottom: 0; } 178 | .main-content table { 179 | display: block; 180 | width: 100%; 181 | overflow: auto; 182 | word-break: normal; 183 | word-break: keep-all; } 184 | .main-content table th { 185 | font-weight: bold; } 186 | .main-content table th, .main-content table td { 187 | padding: 0.5rem 1rem; 188 | border: 1px solid #e9ebec; } 189 | .main-content dl { 190 | padding: 0; } 191 | .main-content dl dt { 192 | padding: 0; 193 | margin-top: 1rem; 194 | font-size: 1rem; 195 | font-weight: bold; } 196 | .main-content dl dd { 197 | padding: 0; 198 | margin-bottom: 1rem; } 199 | .main-content hr { 200 | height: 2px; 201 | padding: 0; 202 | margin: 1rem 0; 203 | background-color: #eff0f1; 204 | border: 0; } 205 | 206 | @media screen and (min-width: 64em) { 207 | .main-content { 208 | max-width: 64rem; 209 | padding: 2rem 6rem; 210 | margin: 0 auto; 211 | font-size: 1.1rem; } } 212 | 213 | @media screen and (min-width: 42em) and (max-width: 64em) { 214 | .main-content { 215 | padding: 2rem 4rem; 216 | font-size: 1.1rem; } } 217 | 218 | @media screen and (max-width: 42em) { 219 | .main-content { 220 | padding: 2rem 1rem; 221 | font-size: 1rem; } } 222 | 223 | .site-footer { 224 | padding-top: 2rem; 225 | margin-top: 2rem; 226 | border-top: solid 1px #eff0f1; } 227 | 228 | .site-footer-owner { 229 | display: block; 230 | font-weight: bold; } 231 | 232 | .site-footer-credits { 233 | color: #819198; } 234 | 235 | @media screen and (min-width: 64em) { 236 | .site-footer { 237 | font-size: 1rem; } } 238 | 239 | @media screen and (min-width: 42em) and (max-width: 64em) { 240 | .site-footer { 241 | font-size: 1rem; } } 242 | 243 | @media screen and (max-width: 42em) { 244 | .site-footer { 245 | font-size: 0.9rem; } } 246 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | mil.nga 5 | mgrs 6 | 2.1.4 7 | jar 8 | Military Grid Reference System 9 | https://github.com/ngageoint/mgrs-java 10 | Library providing Military Grid Reference System (MGRS) functionality 11 | 12 | git@github.com:ngageoint/mgrs-java.git 13 | scm:git:git@github.com:ngageoint/mgrs-java.git 14 | scm:git:git@github.com:ngageoint/mgrs-java.git 15 | 16 | 17 | 18 | The MIT License (MIT) 19 | https://github.com/ngageoint/mgrs-java/blob/master/LICENSE.txt 20 | repo 21 | 22 | 23 | 24 | National Geospatial-Intelligence Agency 25 | https://www.nga.mil/ 26 | 27 | 28 | 29 | newmanw 30 | Billy Newman 31 | winewman@caci.com 32 | BIT Systems 33 | https://www.caci.com/bit-systems 34 | 35 | developer 36 | 37 | UTC−07 38 | 39 | 40 | bosborn 41 | Brian Osborn 42 | bosborn@caci.com 43 | BIT Systems 44 | https://www.caci.com/bit-systems 45 | 46 | developer 47 | 48 | UTC−07 49 | 50 | 51 | 52 | 11 53 | 11 54 | UTF-8 55 | 56 | 57 | 58 | mil.nga 59 | grid 60 | 1.1.2 61 | 62 | 63 | junit 64 | junit 65 | 4.13.2 66 | test 67 | 68 | 69 | 70 | 71 | 72 | 73 | org.apache.maven.plugins 74 | maven-source-plugin 75 | 3.3.0 76 | 77 | 78 | attach-sources 79 | 80 | jar-no-fork 81 | 82 | 83 | 84 | 85 | 86 | org.apache.maven.plugins 87 | maven-javadoc-plugin 88 | 3.6.3 89 | 90 | 91 | https://ngageoint.github.io/grid-java/docs/api/ 92 | https://ngageoint.github.io/simple-features-java/docs/api/ 93 | https://ngageoint.github.io/color-java/docs/api/ 94 | 95 | 96 | 97 | 98 | attach-javadocs 99 | 100 | jar 101 | 102 | 103 | -Xdoclint:none 104 | 105 | 106 | 107 | 108 | 109 | org.apache.maven.plugins 110 | maven-gpg-plugin 111 | 3.2.2 112 | 113 | 114 | sign-artifacts 115 | deploy 116 | 117 | sign 118 | 119 | 120 | 121 | 122 | 123 | org.sonatype.plugins 124 | nexus-staging-maven-plugin 125 | 1.6.13 126 | true 127 | 128 | ossrh 129 | https://oss.sonatype.org/ 130 | true 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | ossrh 139 | https://oss.sonatype.org/content/repositories/snapshots 140 | 141 | 142 | ossrh 143 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/MGRSConstants.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs; 2 | 3 | import mil.nga.grid.GridConstants; 4 | 5 | /** 6 | * Military Grid Reference System Constants 7 | * 8 | * @author osbornb 9 | */ 10 | public class MGRSConstants { 11 | 12 | /** 13 | * Minimum longitude 14 | */ 15 | public static final double MIN_LON = GridConstants.MIN_LON; 16 | 17 | /** 18 | * Maximum longitude 19 | */ 20 | public static final double MAX_LON = GridConstants.MAX_LON; 21 | 22 | /** 23 | * Minimum latitude 24 | */ 25 | public static final double MIN_LAT = -80.0; 26 | 27 | /** 28 | * Maximum latitude 29 | */ 30 | public static final double MAX_LAT = 84.0; 31 | 32 | /** 33 | * Minimum grid zone number 34 | */ 35 | public static final int MIN_ZONE_NUMBER = 1; 36 | 37 | /** 38 | * Maximum grid zone number 39 | */ 40 | public static final int MAX_ZONE_NUMBER = 60; 41 | 42 | /** 43 | * Grid zone width 44 | */ 45 | public static final double ZONE_WIDTH = 6.0; 46 | 47 | /** 48 | * Minimum grid band letter 49 | */ 50 | public static final char MIN_BAND_LETTER = 'C'; 51 | 52 | /** 53 | * Maximum grid band letter 54 | */ 55 | public static final char MAX_BAND_LETTER = 'X'; 56 | 57 | /** 58 | * Number of bands 59 | */ 60 | public static final int NUM_BANDS = 20; 61 | 62 | /** 63 | * Grid band height for all by but the {@link #MAX_BAND_LETTER} 64 | */ 65 | public static final double BAND_HEIGHT = 8.0; 66 | 67 | /** 68 | * Grid band height for the {@link #MAX_BAND_LETTER} 69 | */ 70 | public static final double MAX_BAND_HEIGHT = 12.0; 71 | 72 | /** 73 | * Last southern hemisphere band letter 74 | */ 75 | public static final char BAND_LETTER_SOUTH = 'M'; 76 | 77 | /** 78 | * First northern hemisphere band letter 79 | */ 80 | public static final char BAND_LETTER_NORTH = 'N'; 81 | 82 | /** 83 | * Min zone number in Svalbard grid zones 84 | */ 85 | public static final int MIN_SVALBARD_ZONE_NUMBER = 31; 86 | 87 | /** 88 | * Max zone number in Svalbard grid zones 89 | */ 90 | public static final int MAX_SVALBARD_ZONE_NUMBER = 37; 91 | 92 | /** 93 | * Band letter in Svalbard grid zones 94 | */ 95 | public static final char SVALBARD_BAND_LETTER = MAX_BAND_LETTER; 96 | 97 | /** 98 | * Min zone number in Norway grid zones 99 | */ 100 | public static final int MIN_NORWAY_ZONE_NUMBER = 31; 101 | 102 | /** 103 | * Max zone number in Norway grid zones 104 | */ 105 | public static final int MAX_NORWAY_ZONE_NUMBER = 32; 106 | 107 | /** 108 | * Band letter in Norway grid zones 109 | */ 110 | public static final char NORWAY_BAND_LETTER = 'V'; 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/MGRSUtils.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs; 2 | 3 | import mil.nga.grid.GridUtils; 4 | import mil.nga.grid.Hemisphere; 5 | 6 | /** 7 | * Military Grid Reference System utilities 8 | * 9 | * @author wnewman 10 | * @author osbornb 11 | */ 12 | public class MGRSUtils { 13 | 14 | /** 15 | * Validate the zone number 16 | * 17 | * @param number 18 | * zone number 19 | */ 20 | public static void validateZoneNumber(int number) { 21 | if (number < MGRSConstants.MIN_ZONE_NUMBER 22 | || number > MGRSConstants.MAX_ZONE_NUMBER) { 23 | throw new IllegalArgumentException("Illegal zone number (expected " 24 | + MGRSConstants.MIN_ZONE_NUMBER + " - " 25 | + MGRSConstants.MAX_ZONE_NUMBER + "): " + number); 26 | } 27 | } 28 | 29 | /** 30 | * Validate the band letter 31 | * 32 | * @param letter 33 | * band letter 34 | */ 35 | public static void validateBandLetter(char letter) { 36 | if (letter < MGRSConstants.MIN_BAND_LETTER 37 | || letter > MGRSConstants.MAX_BAND_LETTER 38 | || GridUtils.isOmittedBandLetter(letter)) { 39 | throw new IllegalArgumentException( 40 | "Illegal band letter (CDEFGHJKLMNPQRSTUVWX): " + letter); 41 | } 42 | } 43 | 44 | /** 45 | * Get the next band letter 46 | * 47 | * @param letter 48 | * band letter 49 | * @return next band letter, 'Y' ({@link MGRSConstants#MAX_BAND_LETTER} + 1) 50 | * if no next bands 51 | */ 52 | public static char nextBandLetter(char letter) { 53 | validateBandLetter(letter); 54 | letter++; 55 | if (GridUtils.isOmittedBandLetter(letter)) { 56 | letter++; 57 | } 58 | return letter; 59 | } 60 | 61 | /** 62 | * Get the previous band letter 63 | * 64 | * @param letter 65 | * band letter 66 | * @return previous band letter, 'B' ({@link MGRSConstants#MIN_BAND_LETTER} 67 | * - 1) if no previous bands 68 | */ 69 | public static char previousBandLetter(char letter) { 70 | validateBandLetter(letter); 71 | letter--; 72 | if (GridUtils.isOmittedBandLetter(letter)) { 73 | letter--; 74 | } 75 | return letter; 76 | } 77 | 78 | /** 79 | * Get the label name 80 | * 81 | * @param zoneNumber 82 | * zone number 83 | * @param bandLetter 84 | * band letter 85 | * @return name 86 | */ 87 | public static String getLabelName(int zoneNumber, char bandLetter) { 88 | return String.valueOf(zoneNumber) + bandLetter; 89 | } 90 | 91 | /** 92 | * Get the hemisphere from the band letter 93 | * 94 | * @param bandLetter 95 | * band letter 96 | * @return hemisphere 97 | */ 98 | public static Hemisphere getHemisphere(char bandLetter) { 99 | return bandLetter < MGRSConstants.BAND_LETTER_NORTH ? Hemisphere.SOUTH 100 | : Hemisphere.NORTH; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/features/GridLine.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.features; 2 | 3 | import mil.nga.grid.features.Line; 4 | import mil.nga.grid.features.Point; 5 | import mil.nga.mgrs.grid.GridType; 6 | 7 | /** 8 | * Line between two points 9 | * 10 | * @author wnewman 11 | * @author osbornb 12 | */ 13 | public class GridLine extends Line { 14 | 15 | /** 16 | * Serial Version UID 17 | */ 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * Grid type the line represents if any 22 | */ 23 | private GridType gridType; 24 | 25 | /** 26 | * Create a line 27 | * 28 | * @param point1 29 | * first point 30 | * @param point2 31 | * second point 32 | * @return line 33 | */ 34 | public static GridLine line(Point point1, Point point2) { 35 | return new GridLine(point1, point2); 36 | } 37 | 38 | /** 39 | * Create a line 40 | * 41 | * @param point1 42 | * first point 43 | * @param point2 44 | * second point 45 | * @param gridType 46 | * line grid type 47 | * @return line 48 | */ 49 | public static GridLine line(Point point1, Point point2, GridType gridType) { 50 | return new GridLine(point1, point2, gridType); 51 | } 52 | 53 | /** 54 | * Create a line 55 | * 56 | * @param line 57 | * line to copy 58 | * @return line 59 | */ 60 | public static GridLine line(Line line) { 61 | return new GridLine(line); 62 | } 63 | 64 | /** 65 | * Create a line 66 | * 67 | * @param line 68 | * line to copy 69 | * @param gridType 70 | * line grid type 71 | * @return line 72 | */ 73 | public static GridLine line(Line line, GridType gridType) { 74 | return new GridLine(line, gridType); 75 | } 76 | 77 | /** 78 | * Copy a line 79 | * 80 | * @param line 81 | * line to copy 82 | * @return line 83 | */ 84 | public static GridLine line(GridLine line) { 85 | return new GridLine(line); 86 | } 87 | 88 | /** 89 | * Constructor 90 | * 91 | * @param point1 92 | * first point 93 | * @param point2 94 | * second point 95 | */ 96 | public GridLine(Point point1, Point point2) { 97 | super(point1, point2); 98 | } 99 | 100 | /** 101 | * Constructor 102 | * 103 | * @param point1 104 | * first point 105 | * @param point2 106 | * second point 107 | * @param gridType 108 | * line grid type 109 | */ 110 | public GridLine(Point point1, Point point2, GridType gridType) { 111 | this(point1, point2); 112 | this.gridType = gridType; 113 | } 114 | 115 | /** 116 | * Constructor 117 | * 118 | * @param line 119 | * line to copy 120 | */ 121 | public GridLine(Line line) { 122 | super(line); 123 | } 124 | 125 | /** 126 | * Constructor 127 | * 128 | * @param line 129 | * line to copy 130 | * @param gridType 131 | * line grid type 132 | */ 133 | public GridLine(Line line, GridType gridType) { 134 | this(line); 135 | this.gridType = gridType; 136 | } 137 | 138 | /** 139 | * Copy Constructor 140 | * 141 | * @param line 142 | * line to copy 143 | */ 144 | public GridLine(GridLine line) { 145 | this(line, line.getGridType()); 146 | } 147 | 148 | /** 149 | * Get the line grid type 150 | * 151 | * @return grid type 152 | */ 153 | public GridType getGridType() { 154 | return gridType; 155 | } 156 | 157 | /** 158 | * Check if the line has a grid type 159 | * 160 | * @return true if has grid type 161 | */ 162 | public boolean hasGridType() { 163 | return gridType != null; 164 | } 165 | 166 | /** 167 | * Set the line grid type 168 | * 169 | * @param gridType 170 | * grid type 171 | */ 172 | public void setGridType(GridType gridType) { 173 | this.gridType = gridType; 174 | } 175 | 176 | /** 177 | * Copy the line 178 | * 179 | * @return line copy 180 | */ 181 | public GridLine copy() { 182 | return new GridLine(this); 183 | } 184 | 185 | /** 186 | * {@inheritDoc} 187 | */ 188 | @Override 189 | public int hashCode() { 190 | final int prime = 31; 191 | int result = super.hashCode(); 192 | result = prime * result 193 | + ((gridType == null) ? 0 : gridType.hashCode()); 194 | return result; 195 | } 196 | 197 | /** 198 | * {@inheritDoc} 199 | */ 200 | @Override 201 | public boolean equals(Object obj) { 202 | if (this == obj) 203 | return true; 204 | if (!super.equals(obj)) 205 | return false; 206 | if (getClass() != obj.getClass()) 207 | return false; 208 | GridLine other = (GridLine) obj; 209 | if (gridType != other.gridType) 210 | return false; 211 | return true; 212 | } 213 | 214 | } 215 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/grid/GridLabel.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.grid; 2 | 3 | import mil.nga.grid.Label; 4 | import mil.nga.grid.features.Bounds; 5 | import mil.nga.grid.features.Point; 6 | import mil.nga.mgrs.MGRS; 7 | 8 | /** 9 | * MGRS Grid Label 10 | * 11 | * @author wnewman 12 | * @author osbornb 13 | */ 14 | public class GridLabel extends Label { 15 | 16 | /** 17 | * Grid type 18 | */ 19 | private GridType gridType; 20 | 21 | /** 22 | * MGRS coordinate 23 | */ 24 | private MGRS coordinate; 25 | 26 | /** 27 | * Constructor 28 | * 29 | * @param name 30 | * name 31 | * @param center 32 | * center point 33 | * @param bounds 34 | * bounds 35 | * @param gridType 36 | * grid type 37 | * @param coordinate 38 | * MGRS coordinate 39 | */ 40 | public GridLabel(String name, Point center, Bounds bounds, 41 | GridType gridType, MGRS coordinate) { 42 | super(name, center, bounds); 43 | this.gridType = gridType; 44 | this.coordinate = coordinate; 45 | } 46 | 47 | /** 48 | * Get the grid type 49 | * 50 | * @return grid type 51 | */ 52 | public GridType getGridType() { 53 | return gridType; 54 | } 55 | 56 | /** 57 | * Set the grid type 58 | * 59 | * @param gridType 60 | * grid type 61 | */ 62 | public void setGridType(GridType gridType) { 63 | this.gridType = gridType; 64 | } 65 | 66 | /** 67 | * Get the MGRS coordinate 68 | * 69 | * @return MGRS coordinate 70 | */ 71 | public MGRS getCoordinate() { 72 | return coordinate; 73 | } 74 | 75 | /** 76 | * Set the MGRS coordinate 77 | * 78 | * @param coordinate 79 | * MGRS coordinate 80 | */ 81 | public void setCoordinate(MGRS coordinate) { 82 | this.coordinate = coordinate; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/grid/GridLabeler.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.grid; 2 | 3 | import java.util.List; 4 | 5 | import mil.nga.color.Color; 6 | import mil.nga.grid.Labeler; 7 | import mil.nga.grid.features.Bounds; 8 | import mil.nga.grid.property.PropertyConstants; 9 | import mil.nga.mgrs.gzd.GridZone; 10 | import mil.nga.mgrs.property.MGRSProperties; 11 | 12 | /** 13 | * Grid Labeler 14 | * 15 | * @author osbornb 16 | */ 17 | public abstract class GridLabeler extends Labeler { 18 | 19 | /** 20 | * Default text size 21 | */ 22 | public static final double DEFAULT_TEXT_SIZE = MGRSProperties.getInstance() 23 | .getDoubleProperty(PropertyConstants.LABELER, 24 | PropertyConstants.TEXT_SIZE); 25 | 26 | /** 27 | * Default buffer size 28 | */ 29 | public static final double DEFAULT_BUFFER = MGRSProperties.getInstance() 30 | .getDoubleProperty(PropertyConstants.LABELER, 31 | PropertyConstants.BUFFER); 32 | 33 | /** 34 | * Default Constructor 35 | */ 36 | public GridLabeler() { 37 | super(true, 0, null, Color.black(), DEFAULT_TEXT_SIZE, DEFAULT_BUFFER); 38 | } 39 | 40 | /** 41 | * Constructor 42 | * 43 | * @param minZoom 44 | * minimum zoom 45 | * @param color 46 | * label color 47 | */ 48 | public GridLabeler(int minZoom, Color color) { 49 | this(minZoom, color, DEFAULT_TEXT_SIZE); 50 | } 51 | 52 | /** 53 | * Constructor 54 | * 55 | * @param minZoom 56 | * minimum zoom 57 | * @param color 58 | * label color 59 | * @param textSize 60 | * label text size 61 | */ 62 | public GridLabeler(int minZoom, Color color, double textSize) { 63 | super(minZoom, color, textSize, DEFAULT_BUFFER); 64 | } 65 | 66 | /** 67 | * Constructor 68 | * 69 | * @param minZoom 70 | * minimum zoom 71 | * @param color 72 | * label color 73 | * @param textSize 74 | * label text size 75 | * @param buffer 76 | * grid zone edge buffer (greater than or equal to 0.0 and less 77 | * than 0.5) 78 | */ 79 | public GridLabeler(int minZoom, Color color, double textSize, 80 | double buffer) { 81 | super(minZoom, null, color, textSize, buffer); 82 | } 83 | 84 | /** 85 | * Constructor 86 | * 87 | * @param minZoom 88 | * minimum zoom 89 | * @param maxZoom 90 | * maximum zoom 91 | * @param color 92 | * label color 93 | */ 94 | public GridLabeler(int minZoom, Integer maxZoom, Color color) { 95 | this(minZoom, maxZoom, color, DEFAULT_TEXT_SIZE); 96 | } 97 | 98 | /** 99 | * Constructor 100 | * 101 | * @param minZoom 102 | * minimum zoom 103 | * @param maxZoom 104 | * maximum zoom 105 | * @param color 106 | * label color 107 | * @param textSize 108 | * label text size 109 | */ 110 | public GridLabeler(int minZoom, Integer maxZoom, Color color, 111 | double textSize) { 112 | super(minZoom, maxZoom, color, textSize, DEFAULT_BUFFER); 113 | } 114 | 115 | /** 116 | * Constructor 117 | * 118 | * @param minZoom 119 | * minimum zoom 120 | * @param maxZoom 121 | * maximum zoom 122 | * @param color 123 | * label color 124 | * @param textSize 125 | * label text size 126 | * @param buffer 127 | * grid zone edge buffer (greater than or equal to 0.0 and less 128 | * than 0.5) 129 | */ 130 | public GridLabeler(int minZoom, Integer maxZoom, Color color, 131 | double textSize, double buffer) { 132 | super(true, minZoom, maxZoom, color, textSize, buffer); 133 | } 134 | 135 | /** 136 | * Constructor 137 | * 138 | * @param enabled 139 | * enabled labeler 140 | * @param minZoom 141 | * minimum zoom 142 | * @param maxZoom 143 | * maximum zoom 144 | * @param color 145 | * label color 146 | */ 147 | public GridLabeler(boolean enabled, int minZoom, Integer maxZoom, 148 | Color color) { 149 | this(enabled, minZoom, maxZoom, color, DEFAULT_TEXT_SIZE); 150 | } 151 | 152 | /** 153 | * Constructor 154 | * 155 | * @param enabled 156 | * enabled labeler 157 | * @param minZoom 158 | * minimum zoom 159 | * @param maxZoom 160 | * maximum zoom 161 | * @param color 162 | * label color 163 | * @param textSize 164 | * label text size 165 | */ 166 | public GridLabeler(boolean enabled, int minZoom, Integer maxZoom, 167 | Color color, double textSize) { 168 | super(enabled, minZoom, maxZoom, color, textSize, DEFAULT_BUFFER); 169 | } 170 | 171 | /** 172 | * Constructor 173 | * 174 | * @param enabled 175 | * enabled labeler 176 | * @param minZoom 177 | * minimum zoom 178 | * @param maxZoom 179 | * maximum zoom 180 | * @param color 181 | * label color 182 | * @param textSize 183 | * label text size 184 | * @param buffer 185 | * grid zone edge buffer (greater than or equal to 0.0 and less 186 | * than 0.5) 187 | */ 188 | public GridLabeler(boolean enabled, int minZoom, Integer maxZoom, 189 | Color color, double textSize, double buffer) { 190 | super(enabled, minZoom, maxZoom, color, textSize, buffer); 191 | } 192 | 193 | /** 194 | * Get labels for the bounds 195 | * 196 | * @param tileBounds 197 | * tile bounds 198 | * @param gridType 199 | * grid type 200 | * @param zone 201 | * grid zone 202 | * @return labels 203 | */ 204 | public abstract List getLabels(Bounds tileBounds, 205 | GridType gridType, GridZone zone); 206 | 207 | } 208 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/grid/GridType.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.grid; 2 | 3 | import java.util.Arrays; 4 | import java.util.LinkedHashSet; 5 | import java.util.Set; 6 | 7 | /** 8 | * Grid type enumeration 9 | * 10 | * @author wnewman 11 | * @author osbornb 12 | */ 13 | public enum GridType { 14 | 15 | /** 16 | * Grid Zone Designator 17 | */ 18 | GZD(0), 19 | 20 | /** 21 | * Hundred Kilometer 22 | */ 23 | HUNDRED_KILOMETER(100000), 24 | 25 | /** 26 | * Ten Kilometer 27 | */ 28 | TEN_KILOMETER(10000), 29 | 30 | /** 31 | * Kilometer 32 | */ 33 | KILOMETER(1000), 34 | 35 | /** 36 | * Hundred Meter 37 | */ 38 | HUNDRED_METER(100), 39 | 40 | /** 41 | * Ten Meter 42 | */ 43 | TEN_METER(10), 44 | 45 | /** 46 | * Meter 47 | */ 48 | METER(1); 49 | 50 | /** 51 | * Grid precision in meters 52 | */ 53 | private int precision; 54 | 55 | /** 56 | * Constructor 57 | * 58 | * @param precision 59 | * precision in meters 60 | */ 61 | private GridType(int precision) { 62 | this.precision = precision; 63 | } 64 | 65 | /** 66 | * Get the precision in meters 67 | * 68 | * @return precision meters 69 | */ 70 | public int getPrecision() { 71 | return precision; 72 | } 73 | 74 | /** 75 | * Get the Grid Type accuracy number of digits in the easting and northing 76 | * values 77 | * 78 | * @return accuracy digits 79 | */ 80 | public int getAccuracy() { 81 | return Math.max(ordinal() - 1, 0); 82 | } 83 | 84 | /** 85 | * Get the Grid Type with the accuracy number of digits in the easting and 86 | * northing values. Accuracy must be inclusively between 0 87 | * ({@link GridType#HUNDRED_KILOMETER}) and 5 ({@link GridType#METER}). 88 | * 89 | * @param accuracy 90 | * accuracy digits between 0 (inclusive) and 5 (inclusive) 91 | * @return grid type 92 | */ 93 | public static GridType withAccuracy(int accuracy) { 94 | if (accuracy < 0 || accuracy > 5) { 95 | throw new IllegalArgumentException( 96 | "Grid Type accuracy digits must be >= 0 and <= 5. accuracy digits: " 97 | + accuracy); 98 | } 99 | return values()[accuracy + 1]; 100 | } 101 | 102 | /** 103 | * Get the precision of the value in meters based upon trailing 0's 104 | * 105 | * @param value 106 | * value in meters 107 | * @return precision grid type 108 | */ 109 | public static GridType getPrecision(double value) { 110 | GridType precision = null; 111 | if (value % HUNDRED_KILOMETER.precision == 0) { 112 | precision = HUNDRED_KILOMETER; 113 | } else if (value % TEN_KILOMETER.precision == 0) { 114 | precision = TEN_KILOMETER; 115 | } else if (value % KILOMETER.precision == 0) { 116 | precision = KILOMETER; 117 | } else if (value % HUNDRED_METER.precision == 0) { 118 | precision = HUNDRED_METER; 119 | } else if (value % TEN_METER.precision == 0) { 120 | precision = TEN_METER; 121 | } else { 122 | precision = METER; 123 | } 124 | return precision; 125 | } 126 | 127 | /** 128 | * Get the less precise (larger precision value) grid types 129 | * 130 | * @param type 131 | * grid type 132 | * @return grid types less precise 133 | */ 134 | public static Set lessPrecise(GridType type) { 135 | GridType[] types = Arrays.copyOfRange(GridType.values(), 0, 136 | type.ordinal()); 137 | return new LinkedHashSet<>(Arrays.asList(types)); 138 | } 139 | 140 | /** 141 | * Get the more precise (smaller precision value) grid types 142 | * 143 | * @param type 144 | * grid type 145 | * @return grid types more precise 146 | */ 147 | public static Set morePrecise(GridType type) { 148 | GridType[] values = GridType.values(); 149 | GridType[] types = Arrays.copyOfRange(values, type.ordinal() + 1, 150 | values.length); 151 | return new LinkedHashSet<>(Arrays.asList(types)); 152 | } 153 | 154 | } 155 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/grid/ZoomGrids.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.grid; 2 | 3 | import mil.nga.grid.BaseZoomGrids; 4 | 5 | /** 6 | * Zoom Level Matching Grids 7 | * 8 | * @author osbornb 9 | */ 10 | public class ZoomGrids extends BaseZoomGrids { 11 | 12 | /** 13 | * Constructor 14 | * 15 | * @param zoom 16 | * zoom level 17 | */ 18 | public ZoomGrids(int zoom) { 19 | super(zoom); 20 | } 21 | 22 | /** 23 | * Get the grid type precision 24 | * 25 | * @return grid type precision 26 | */ 27 | public GridType getPrecision() { 28 | GridType type = null; 29 | if (hasGrids()) { 30 | type = grids.first().getType(); 31 | } 32 | return type; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/BandLetterRange.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import java.util.Iterator; 4 | 5 | import mil.nga.mgrs.MGRSConstants; 6 | import mil.nga.mgrs.MGRSUtils; 7 | 8 | /** 9 | * Band Letter Range 10 | * 11 | * @author osbornb 12 | */ 13 | public class BandLetterRange implements Iterable { 14 | 15 | /** 16 | * Southern band letter 17 | */ 18 | private char south; 19 | 20 | /** 21 | * Northern band letter 22 | */ 23 | private char north; 24 | 25 | /** 26 | * Constructor, full range 27 | */ 28 | public BandLetterRange() { 29 | this(MGRSConstants.MIN_BAND_LETTER, MGRSConstants.MAX_BAND_LETTER); 30 | } 31 | 32 | /** 33 | * Constructor 34 | * 35 | * @param south 36 | * southern band letter 37 | * @param north 38 | * northern band letter 39 | */ 40 | public BandLetterRange(char south, char north) { 41 | this.south = south; 42 | this.north = north; 43 | } 44 | 45 | /** 46 | * Get the southern band letter 47 | * 48 | * @return southern band letter 49 | */ 50 | public char getSouth() { 51 | return south; 52 | } 53 | 54 | /** 55 | * Set the southern band letter 56 | * 57 | * @param south 58 | * southern band letter 59 | */ 60 | public void setSouth(char south) { 61 | this.south = south; 62 | } 63 | 64 | /** 65 | * Get the northern band letter 66 | * 67 | * @return northern band letter 68 | */ 69 | public char getNorth() { 70 | return north; 71 | } 72 | 73 | /** 74 | * Set the northern band letter 75 | * 76 | * @param north 77 | * northern band letter 78 | */ 79 | public void setNorth(char north) { 80 | this.north = north; 81 | } 82 | 83 | /** 84 | * Get the southern latitude 85 | * 86 | * @return latitude 87 | */ 88 | public double getSouthLatitude() { 89 | return GridZones.getLatitudeBand(south).getSouth(); 90 | } 91 | 92 | /** 93 | * Get the northern latitude 94 | * 95 | * @return latitude 96 | */ 97 | public double getNorthLatitude() { 98 | return GridZones.getLatitudeBand(north).getNorth(); 99 | } 100 | 101 | /** 102 | * {@inheritDoc} 103 | */ 104 | @Override 105 | public Iterator iterator() { 106 | return new Iterator() { 107 | 108 | /** 109 | * Band letter 110 | */ 111 | private char letter = south; 112 | 113 | /** 114 | * {@inheritDoc} 115 | */ 116 | @Override 117 | public boolean hasNext() { 118 | return letter <= north; 119 | } 120 | 121 | /** 122 | * {@inheritDoc} 123 | */ 124 | @Override 125 | public Character next() { 126 | char value = letter; 127 | letter = MGRSUtils.nextBandLetter(letter); 128 | return value; 129 | } 130 | 131 | }; 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/GZDLabeler.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import mil.nga.color.Color; 7 | import mil.nga.grid.features.Bounds; 8 | import mil.nga.grid.features.Point; 9 | import mil.nga.mgrs.MGRS; 10 | import mil.nga.mgrs.grid.GridLabel; 11 | import mil.nga.mgrs.grid.GridLabeler; 12 | import mil.nga.mgrs.grid.GridType; 13 | 14 | /** 15 | * Grid Zone Designator labeler 16 | * 17 | * @author osbornb 18 | */ 19 | public class GZDLabeler extends GridLabeler { 20 | 21 | /** 22 | * Default Constructor 23 | */ 24 | public GZDLabeler() { 25 | super(); 26 | } 27 | 28 | /** 29 | * Constructor 30 | * 31 | * @param minZoom 32 | * minimum zoom 33 | * @param color 34 | * label color 35 | */ 36 | public GZDLabeler(int minZoom, Color color) { 37 | super(minZoom, color); 38 | } 39 | 40 | /** 41 | * Constructor 42 | * 43 | * @param minZoom 44 | * minimum zoom 45 | * @param color 46 | * label color 47 | * @param textSize 48 | * label text size 49 | */ 50 | public GZDLabeler(int minZoom, Color color, double textSize) { 51 | super(minZoom, color, textSize); 52 | } 53 | 54 | /** 55 | * Constructor 56 | * 57 | * @param minZoom 58 | * minimum zoom 59 | * @param color 60 | * label color 61 | * @param textSize 62 | * label text size 63 | * @param buffer 64 | * grid zone edge buffer (greater than or equal to 0.0 and less 65 | * than 0.5) 66 | */ 67 | public GZDLabeler(int minZoom, Color color, double textSize, 68 | double buffer) { 69 | super(minZoom, color, textSize, buffer); 70 | } 71 | 72 | /** 73 | * Constructor 74 | * 75 | * @param minZoom 76 | * minimum zoom 77 | * @param maxZoom 78 | * maximum zoom 79 | * @param color 80 | * label color 81 | */ 82 | public GZDLabeler(int minZoom, Integer maxZoom, Color color) { 83 | super(minZoom, maxZoom, color); 84 | } 85 | 86 | /** 87 | * Constructor 88 | * 89 | * @param minZoom 90 | * minimum zoom 91 | * @param maxZoom 92 | * maximum zoom 93 | * @param color 94 | * label color 95 | * @param textSize 96 | * label text size 97 | */ 98 | public GZDLabeler(int minZoom, Integer maxZoom, Color color, 99 | double textSize) { 100 | super(minZoom, maxZoom, color, textSize); 101 | } 102 | 103 | /** 104 | * Constructor 105 | * 106 | * @param minZoom 107 | * minimum zoom 108 | * @param maxZoom 109 | * maximum zoom 110 | * @param color 111 | * label color 112 | * @param textSize 113 | * label text size 114 | * @param buffer 115 | * grid zone edge buffer (greater than or equal to 0.0 and less 116 | * than 0.5) 117 | */ 118 | public GZDLabeler(int minZoom, Integer maxZoom, Color color, 119 | double textSize, double buffer) { 120 | super(minZoom, maxZoom, color, textSize, buffer); 121 | } 122 | 123 | /** 124 | * Constructor 125 | * 126 | * @param enabled 127 | * enabled labeler 128 | * @param minZoom 129 | * minimum zoom 130 | * @param maxZoom 131 | * maximum zoom 132 | * @param color 133 | * label color 134 | */ 135 | public GZDLabeler(boolean enabled, int minZoom, Integer maxZoom, 136 | Color color) { 137 | super(enabled, minZoom, maxZoom, color); 138 | } 139 | 140 | /** 141 | * Constructor 142 | * 143 | * @param enabled 144 | * enabled labeler 145 | * @param minZoom 146 | * minimum zoom 147 | * @param maxZoom 148 | * maximum zoom 149 | * @param color 150 | * label color 151 | * @param textSize 152 | * label text size 153 | */ 154 | public GZDLabeler(boolean enabled, int minZoom, Integer maxZoom, 155 | Color color, double textSize) { 156 | super(enabled, minZoom, maxZoom, color, textSize); 157 | } 158 | 159 | /** 160 | * Constructor 161 | * 162 | * @param enabled 163 | * enabled labeler 164 | * @param minZoom 165 | * minimum zoom 166 | * @param maxZoom 167 | * maximum zoom 168 | * @param color 169 | * label color 170 | * @param textSize 171 | * label text size 172 | * @param buffer 173 | * grid zone edge buffer (greater than or equal to 0.0 and less 174 | * than 0.5) 175 | */ 176 | public GZDLabeler(boolean enabled, int minZoom, Integer maxZoom, 177 | Color color, double textSize, double buffer) { 178 | super(enabled, minZoom, maxZoom, color, textSize, buffer); 179 | } 180 | 181 | /** 182 | * {@inheritDoc} 183 | */ 184 | @Override 185 | public List getLabels(Bounds tileBounds, GridType gridType, 186 | GridZone zone) { 187 | List labels = new ArrayList<>(); 188 | Bounds bounds = zone.getBounds(); 189 | Point center = bounds.getCentroid(); 190 | labels.add(new GridLabel(zone.getName(), center, bounds, gridType, 191 | MGRS.from(center))); 192 | return labels; 193 | } 194 | 195 | } 196 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/GridRange.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import mil.nga.grid.features.Bounds; 8 | import mil.nga.mgrs.MGRSUtils; 9 | 10 | /** 11 | * Grid Range 12 | * 13 | * @author osbornb 14 | */ 15 | public class GridRange implements Iterable { 16 | 17 | /** 18 | * Zone Number Range 19 | */ 20 | private ZoneNumberRange zoneNumberRange; 21 | 22 | /** 23 | * Band Letter Range 24 | */ 25 | private BandLetterRange bandLetterRange; 26 | 27 | /** 28 | * Constructor, full range 29 | */ 30 | public GridRange() { 31 | this.zoneNumberRange = new ZoneNumberRange(); 32 | this.bandLetterRange = new BandLetterRange(); 33 | } 34 | 35 | /** 36 | * Constructor 37 | * 38 | * @param zoneNumberRange 39 | * zone number range 40 | * @param bandLetterRange 41 | * band letter range 42 | */ 43 | public GridRange(ZoneNumberRange zoneNumberRange, 44 | BandLetterRange bandLetterRange) { 45 | this.zoneNumberRange = zoneNumberRange; 46 | this.bandLetterRange = bandLetterRange; 47 | } 48 | 49 | /** 50 | * Get the zone number range 51 | * 52 | * @return zone number range 53 | */ 54 | public ZoneNumberRange getZoneNumberRange() { 55 | return zoneNumberRange; 56 | } 57 | 58 | /** 59 | * Set the zone number range 60 | * 61 | * @param zoneNumberRange 62 | * zone number range 63 | */ 64 | public void setZoneNumberRange(ZoneNumberRange zoneNumberRange) { 65 | this.zoneNumberRange = zoneNumberRange; 66 | } 67 | 68 | /** 69 | * Get the band letter range 70 | * 71 | * @return band letter range 72 | */ 73 | public BandLetterRange getBandLetterRange() { 74 | return bandLetterRange; 75 | } 76 | 77 | /** 78 | * Set the band letter range 79 | * 80 | * @param bandLetterRange 81 | * band letter range 82 | */ 83 | public void setBandLetterRange(BandLetterRange bandLetterRange) { 84 | this.bandLetterRange = bandLetterRange; 85 | } 86 | 87 | /** 88 | * Get the grid range bounds 89 | * 90 | * @return bounds 91 | */ 92 | public Bounds getBounds() { 93 | 94 | double west = zoneNumberRange.getWestLongitude(); 95 | double south = bandLetterRange.getSouthLatitude(); 96 | double east = zoneNumberRange.getEastLongitude(); 97 | double north = bandLetterRange.getNorthLatitude(); 98 | 99 | return Bounds.degrees(west, south, east, north); 100 | } 101 | 102 | /** 103 | * {@inheritDoc} 104 | */ 105 | @Override 106 | public Iterator iterator() { 107 | return new Iterator() { 108 | 109 | /** 110 | * Minimum zone number 111 | */ 112 | private final int minZoneNumber = zoneNumberRange.getWest(); 113 | 114 | /** 115 | * Maximum zone number 116 | */ 117 | private final int maxZoneNumber = zoneNumberRange.getEast(); 118 | 119 | /** 120 | * Minimum band letter 121 | */ 122 | private final char minBandLetter = bandLetterRange.getSouth(); 123 | 124 | /** 125 | * Minimum band letter 126 | */ 127 | private final char maxBandLetter = bandLetterRange.getNorth(); 128 | 129 | /** 130 | * Zone number 131 | */ 132 | private int zoneNumber = minZoneNumber; 133 | 134 | /** 135 | * Band letter 136 | */ 137 | private char bandLetter = minBandLetter; 138 | 139 | /** 140 | * Grid zone 141 | */ 142 | private GridZone gridZone = null; 143 | 144 | /** 145 | * Additional special case grid zones 146 | */ 147 | private List additional = new ArrayList<>(); 148 | 149 | /** 150 | * {@inheritDoc} 151 | */ 152 | @Override 153 | public boolean hasNext() { 154 | 155 | while (gridZone == null && zoneNumber <= maxZoneNumber) { 156 | 157 | gridZone = GridZones.getGridZone(zoneNumber, bandLetter); 158 | 159 | // Handle special case grid gaps (Svalbard) 160 | if (gridZone == null) { 161 | 162 | // Retrieve the western grid if on the left edge 163 | if (zoneNumber == minZoneNumber) { 164 | additional.add(GridZones.getGridZone(zoneNumber - 1, 165 | bandLetter)); 166 | } 167 | 168 | // Expand to the eastern grid if on the right edge 169 | if (zoneNumber == maxZoneNumber) { 170 | additional.add(GridZones.getGridZone(zoneNumber + 1, 171 | bandLetter)); 172 | } 173 | 174 | } else { 175 | 176 | // Handle special case grid zone expansions (Norway) 177 | int expand = gridZone.getStripExpand(); 178 | if (expand != 0) { 179 | if (expand > 0) { 180 | for (int expandZone = zoneNumber 181 | + expand; expandZone > zoneNumber; expandZone--) { 182 | if (expandZone > maxZoneNumber) { 183 | additional.add(GridZones.getGridZone( 184 | expandZone, bandLetter)); 185 | } else { 186 | break; 187 | } 188 | } 189 | } else { 190 | for (int expandZone = zoneNumber 191 | + expand; expandZone < zoneNumber; expandZone++) { 192 | if (expandZone < minZoneNumber) { 193 | additional.add(GridZones.getGridZone( 194 | expandZone, bandLetter)); 195 | } else { 196 | break; 197 | } 198 | } 199 | } 200 | } 201 | 202 | } 203 | 204 | bandLetter = MGRSUtils.nextBandLetter(bandLetter); 205 | if (bandLetter > maxBandLetter) { 206 | zoneNumber++; 207 | bandLetter = minBandLetter; 208 | } 209 | 210 | } 211 | 212 | if (gridZone == null && !additional.isEmpty()) { 213 | gridZone = additional.remove(0); 214 | } 215 | 216 | return gridZone != null; 217 | } 218 | 219 | /** 220 | * {@inheritDoc} 221 | */ 222 | @Override 223 | public GridZone next() { 224 | GridZone next = gridZone; 225 | gridZone = null; 226 | return next; 227 | } 228 | 229 | }; 230 | } 231 | 232 | } 233 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/LatitudeBand.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import mil.nga.grid.Hemisphere; 4 | import mil.nga.mgrs.MGRSUtils; 5 | 6 | /** 7 | * Latitude (horizontal) band 8 | * 9 | * @author osbornb 10 | */ 11 | public class LatitudeBand { 12 | 13 | /** 14 | * Band letter 15 | */ 16 | private char letter; 17 | 18 | /** 19 | * Southern latitude 20 | */ 21 | private double south; 22 | 23 | /** 24 | * Northern latitude 25 | */ 26 | private double north; 27 | 28 | /** 29 | * Hemisphere 30 | */ 31 | private Hemisphere hemisphere; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param letter 37 | * band letter 38 | * @param south 39 | * southern latitude 40 | * @param north 41 | * northern latitude 42 | */ 43 | public LatitudeBand(char letter, double south, double north) { 44 | setLetter(letter); 45 | this.south = south; 46 | this.north = north; 47 | } 48 | 49 | /** 50 | * Get the band letter 51 | * 52 | * @return band letter 53 | */ 54 | public char getLetter() { 55 | return letter; 56 | } 57 | 58 | /** 59 | * Set the band letter 60 | * 61 | * @param letter 62 | * band letter 63 | */ 64 | public void setLetter(char letter) { 65 | this.letter = letter; 66 | this.hemisphere = MGRSUtils.getHemisphere(letter); 67 | } 68 | 69 | /** 70 | * Get the southern latitude 71 | * 72 | * @return southern latitude 73 | */ 74 | public double getSouth() { 75 | return south; 76 | } 77 | 78 | /** 79 | * Set the southern latitude 80 | * 81 | * @param south 82 | * southern latitude 83 | */ 84 | public void setSouth(double south) { 85 | this.south = south; 86 | } 87 | 88 | /** 89 | * Get the northern latitude 90 | * 91 | * @return northern latitude 92 | */ 93 | public double getNorth() { 94 | return north; 95 | } 96 | 97 | /** 98 | * Set the northern latitude 99 | * 100 | * @param north 101 | * northern latitude 102 | */ 103 | public void setNorth(double north) { 104 | this.north = north; 105 | } 106 | 107 | /** 108 | * Get the hemisphere 109 | * 110 | * @return hemisphere 111 | */ 112 | public Hemisphere getHemisphere() { 113 | return hemisphere; 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/LongitudinalStrip.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | /** 4 | * Longitudinal (vertical) strip 5 | * 6 | * @author osbornb 7 | */ 8 | public class LongitudinalStrip { 9 | 10 | /** 11 | * Zone number 12 | */ 13 | private int number; 14 | 15 | /** 16 | * Western longitude 17 | */ 18 | private double west; 19 | 20 | /** 21 | * Eastern longitude 22 | */ 23 | private double east; 24 | 25 | /** 26 | * Expansion for range iterations over neighboring strips 27 | */ 28 | private int expand; 29 | 30 | /** 31 | * Constructor 32 | * 33 | * @param number 34 | * zone number 35 | * @param west 36 | * western longitude 37 | * @param east 38 | * eastern longitude 39 | */ 40 | public LongitudinalStrip(int number, double west, double east) { 41 | this(number, west, east, 0); 42 | } 43 | 44 | /** 45 | * Constructor 46 | * 47 | * @param number 48 | * zone number 49 | * @param west 50 | * western longitude 51 | * @param east 52 | * eastern longitude 53 | * @param expand 54 | * expansion for range iterations over neighboring strips 55 | */ 56 | public LongitudinalStrip(int number, double west, double east, int expand) { 57 | this.number = number; 58 | this.west = west; 59 | this.east = east; 60 | this.expand = expand; 61 | } 62 | 63 | /** 64 | * Get the zone number 65 | * 66 | * @return zone number 67 | */ 68 | public int getNumber() { 69 | return number; 70 | } 71 | 72 | /** 73 | * Set the zone number 74 | * 75 | * @param number 76 | * zone number 77 | */ 78 | public void setNumber(int number) { 79 | this.number = number; 80 | } 81 | 82 | /** 83 | * Get the western longitude 84 | * 85 | * @return western longitude 86 | */ 87 | public double getWest() { 88 | return west; 89 | } 90 | 91 | /** 92 | * Set the western longitude 93 | * 94 | * @param west 95 | * western longitude 96 | */ 97 | public void setWest(double west) { 98 | this.west = west; 99 | } 100 | 101 | /** 102 | * Get the eastern longitude 103 | * 104 | * @return eastern longitude 105 | */ 106 | public double getEast() { 107 | return east; 108 | } 109 | 110 | /** 111 | * Set the eastern longitude 112 | * 113 | * @param east 114 | * eastern longitude 115 | */ 116 | public void setEast(double east) { 117 | this.east = east; 118 | } 119 | 120 | /** 121 | * Get expand, number of additional neighbors to iterate over in combination 122 | * with this strip 123 | * 124 | * @return neighbor iteration expansion 125 | */ 126 | public int getExpand() { 127 | return expand; 128 | } 129 | 130 | /** 131 | * Set the expand, number of additional neighbors to iterate over in 132 | * combination with this strip 133 | * 134 | * @param expand 135 | * neighbor iteration expansion 136 | */ 137 | public void setExpand(int expand) { 138 | this.expand = expand; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/gzd/ZoneNumberRange.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import java.util.Iterator; 4 | 5 | import mil.nga.mgrs.MGRSConstants; 6 | 7 | /** 8 | * Zone Number Range 9 | * 10 | * @author osbornb 11 | */ 12 | public class ZoneNumberRange implements Iterable { 13 | 14 | /** 15 | * Western zone number 16 | */ 17 | private int west; 18 | 19 | /** 20 | * Eastern zone number 21 | */ 22 | private int east; 23 | 24 | /** 25 | * Constructor, full range 26 | */ 27 | public ZoneNumberRange() { 28 | this(MGRSConstants.MIN_ZONE_NUMBER, MGRSConstants.MAX_ZONE_NUMBER); 29 | } 30 | 31 | /** 32 | * Constructor 33 | * 34 | * @param west 35 | * western zone number 36 | * @param east 37 | * eastern zone number 38 | */ 39 | public ZoneNumberRange(int west, int east) { 40 | this.west = west; 41 | this.east = east; 42 | } 43 | 44 | /** 45 | * Get the western zone number 46 | * 47 | * @return western zone number 48 | */ 49 | public int getWest() { 50 | return west; 51 | } 52 | 53 | /** 54 | * Set the western zone number 55 | * 56 | * @param west 57 | * western zone number 58 | */ 59 | public void setWest(int west) { 60 | this.west = west; 61 | } 62 | 63 | /** 64 | * Get the eastern zone number 65 | * 66 | * @return eastern zone number 67 | */ 68 | public int getEast() { 69 | return east; 70 | } 71 | 72 | /** 73 | * Set the eastern zone number 74 | * 75 | * @param east 76 | * eastern zone number 77 | */ 78 | public void setEast(int east) { 79 | this.east = east; 80 | } 81 | 82 | /** 83 | * Get the western longitude 84 | * 85 | * @return longitude 86 | */ 87 | public double getWestLongitude() { 88 | return GridZones.getLongitudinalStrip(west).getWest(); 89 | } 90 | 91 | /** 92 | * Get the eastern longitude 93 | * 94 | * @return longitude 95 | */ 96 | public double getEastLongitude() { 97 | return GridZones.getLongitudinalStrip(east).getEast(); 98 | } 99 | 100 | /** 101 | * {@inheritDoc} 102 | */ 103 | @Override 104 | public Iterator iterator() { 105 | return new Iterator() { 106 | 107 | /** 108 | * Zone number 109 | */ 110 | private int number = west; 111 | 112 | /** 113 | * {@inheritDoc} 114 | */ 115 | @Override 116 | public boolean hasNext() { 117 | return number <= east; 118 | } 119 | 120 | /** 121 | * {@inheritDoc} 122 | */ 123 | @Override 124 | public Integer next() { 125 | return number++; 126 | } 127 | 128 | }; 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/mil/nga/mgrs/property/MGRSProperties.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.property; 2 | 3 | import mil.nga.grid.property.GridProperties; 4 | 5 | /** 6 | * MGRS property loader 7 | * 8 | * @author osbornb 9 | */ 10 | public class MGRSProperties extends GridProperties { 11 | 12 | /** 13 | * Property file name 14 | */ 15 | public static final String PROPERTIES_FILE = "mgrs.properties"; 16 | 17 | /** 18 | * Singleton instance 19 | */ 20 | public static MGRSProperties instance = new MGRSProperties(); 21 | 22 | /** 23 | * Get the singleton instance 24 | * 25 | * @return instance 26 | */ 27 | public static MGRSProperties getInstance() { 28 | return instance; 29 | } 30 | 31 | /** 32 | * {@inheritDoc} 33 | */ 34 | @Override 35 | public String getFile() { 36 | return PROPERTIES_FILE; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/mgrs.properties: -------------------------------------------------------------------------------- 1 | 2 | grid.width=2.0 3 | labeler.text_size=24.0 4 | labeler.buffer=0.05 5 | 6 | grids.gzd.enabled=true 7 | grids.gzd.min_zoom=0 8 | grids.gzd.max_zoom= 9 | grids.gzd.color=EF5350 10 | grids.gzd.width=2.0 11 | 12 | grids.gzd.labeler.enabled=true 13 | grids.gzd.labeler.min_zoom=4 14 | grids.gzd.labeler.max_zoom= 15 | grids.gzd.labeler.color=EF5350 16 | grids.gzd.labeler.text_size=24.0 17 | grids.gzd.labeler.buffer=0.05 18 | 19 | grids.propagate=true 20 | 21 | grids.hundred_kilometer.enabled=true 22 | grids.hundred_kilometer.min_zoom=5 23 | grids.hundred_kilometer.max_zoom= 24 | grids.hundred_kilometer.lines.min_zoom= 25 | grids.hundred_kilometer.lines.max_zoom=8 26 | grids.hundred_kilometer.color=3D8C40 27 | grids.hundred_kilometer.width=2.0 28 | 29 | grids.hundred_kilometer.labeler.enabled=true 30 | grids.hundred_kilometer.labeler.min_zoom=6 31 | grids.hundred_kilometer.labeler.max_zoom= 32 | grids.hundred_kilometer.labeler.color=3D8C40 33 | grids.hundred_kilometer.labeler.text_size=24.0 34 | grids.hundred_kilometer.labeler.buffer=0.05 35 | 36 | grids.ten_kilometer.enabled=true 37 | grids.ten_kilometer.min_zoom=9 38 | grids.ten_kilometer.max_zoom=11 39 | grids.ten_kilometer.color=888888 40 | grids.ten_kilometer.width=2.0 41 | 42 | grids.ten_kilometer.labeler.enabled=false 43 | grids.ten_kilometer.labeler.min_zoom=10 44 | grids.ten_kilometer.labeler.max_zoom=11 45 | grids.ten_kilometer.labeler.color=888888 46 | grids.ten_kilometer.labeler.text_size=24.0 47 | grids.ten_kilometer.labeler.buffer=0.05 48 | 49 | grids.kilometer.enabled=true 50 | grids.kilometer.min_zoom=12 51 | grids.kilometer.max_zoom=14 52 | grids.kilometer.color=888888 53 | grids.kilometer.width=2.0 54 | 55 | grids.kilometer.labeler.enabled=false 56 | grids.kilometer.labeler.min_zoom=13 57 | grids.kilometer.labeler.max_zoom=14 58 | grids.kilometer.labeler.color=888888 59 | grids.kilometer.labeler.text_size=24.0 60 | grids.kilometer.labeler.buffer=0.05 61 | 62 | grids.hundred_meter.enabled=true 63 | grids.hundred_meter.min_zoom=15 64 | grids.hundred_meter.max_zoom=17 65 | grids.hundred_meter.color=888888 66 | grids.hundred_meter.width=2.0 67 | 68 | grids.hundred_meter.labeler.enabled=false 69 | grids.hundred_meter.labeler.min_zoom=16 70 | grids.hundred_meter.labeler.max_zoom=17 71 | grids.hundred_meter.labeler.color=888888 72 | grids.hundred_meter.labeler.text_size=24.0 73 | grids.hundred_meter.labeler.buffer=0.05 74 | 75 | grids.ten_meter.enabled=true 76 | grids.ten_meter.min_zoom=18 77 | grids.ten_meter.max_zoom=20 78 | grids.ten_meter.color=888888 79 | grids.ten_meter.width=2.0 80 | 81 | grids.ten_meter.labeler.enabled=false 82 | grids.ten_meter.labeler.min_zoom=19 83 | grids.ten_meter.labeler.max_zoom=20 84 | grids.ten_meter.labeler.color=888888 85 | grids.ten_meter.labeler.text_size=24.0 86 | grids.ten_meter.labeler.buffer=0.05 87 | 88 | grids.meter.enabled=true 89 | grids.meter.min_zoom=21 90 | grids.meter.max_zoom= 91 | grids.meter.color=888888 92 | grids.meter.width=2.0 93 | -------------------------------------------------------------------------------- /src/test/java/mil/nga/mgrs/ReadmeTest.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs; 2 | 3 | import java.text.ParseException; 4 | import java.util.List; 5 | 6 | import org.junit.Test; 7 | 8 | import mil.nga.grid.features.Point; 9 | import mil.nga.grid.tile.GridTile; 10 | import mil.nga.grid.tile.Pixel; 11 | import mil.nga.grid.tile.PixelRange; 12 | import mil.nga.mgrs.features.GridLine; 13 | import mil.nga.mgrs.grid.Grid; 14 | import mil.nga.mgrs.grid.GridLabel; 15 | import mil.nga.mgrs.grid.GridType; 16 | import mil.nga.mgrs.grid.Grids; 17 | import mil.nga.mgrs.grid.ZoomGrids; 18 | import mil.nga.mgrs.gzd.GridRange; 19 | import mil.nga.mgrs.gzd.GridZone; 20 | import mil.nga.mgrs.gzd.GridZones; 21 | import mil.nga.mgrs.utm.UTM; 22 | 23 | /** 24 | * README example tests 25 | * 26 | * @author osbornb 27 | */ 28 | public class ReadmeTest { 29 | 30 | /** 31 | * Test MGRS coordinates 32 | * 33 | * @throws ParseException 34 | * upon failure to parse 35 | */ 36 | @Test 37 | public void testCoordinates() throws ParseException { 38 | 39 | MGRS mgrs = MGRS.parse("33XVG74594359"); 40 | Point point = mgrs.toPoint(); 41 | Point pointMeters = point.toMeters(); 42 | UTM utm = mgrs.toUTM(); 43 | String utmCoordinate = utm.toString(); 44 | Point point2 = utm.toPoint(); 45 | 46 | MGRS mgrs2 = MGRS.parse("33X VG 74596 43594"); 47 | 48 | double latitude = 63.98862388; 49 | double longitude = 29.06755082; 50 | Point point3 = Point.point(longitude, latitude); 51 | MGRS mgrs3 = MGRS.from(point3); 52 | String mgrsCoordinate = mgrs3.toString(); 53 | String mgrsGZD = mgrs3.coordinate(GridType.GZD); 54 | String mgrs100k = mgrs3.coordinate(GridType.HUNDRED_KILOMETER); 55 | String mgrs10k = mgrs3.coordinate(GridType.TEN_KILOMETER); 56 | String mgrs1k = mgrs3.coordinate(GridType.KILOMETER); 57 | String mgrs100m = mgrs3.coordinate(GridType.HUNDRED_METER); 58 | String mgrs10m = mgrs3.coordinate(GridType.TEN_METER); 59 | String mgrs1m = mgrs3.coordinate(GridType.METER); 60 | 61 | UTM utm2 = UTM.from(point3); 62 | MGRS mgrs4 = utm2.toMGRS(); 63 | 64 | UTM utm3 = UTM.parse("18 N 585628 4511322"); 65 | MGRS mgrs5 = utm3.toMGRS(); 66 | 67 | } 68 | 69 | /** 70 | * Test draw tile template logic 71 | */ 72 | @Test 73 | public void testDrawTile() { 74 | testDrawTile(GridTile.tile(512, 512, 8, 12, 5)); 75 | } 76 | 77 | /** 78 | * Test draw tile template logic 79 | * 80 | * @param tile 81 | * grid tile 82 | */ 83 | private static void testDrawTile(GridTile tile) { 84 | 85 | // GridTile tile = ...; 86 | 87 | Grids grids = Grids.create(); 88 | 89 | ZoomGrids zoomGrids = grids.getGrids(tile.getZoom()); 90 | if (zoomGrids.hasGrids()) { 91 | 92 | GridRange gridRange = GridZones.getGridRange(tile.getBounds()); 93 | 94 | for (Grid grid : zoomGrids) { 95 | 96 | // draw this grid for each zone 97 | for (GridZone zone : gridRange) { 98 | 99 | List lines = grid.getLines(tile, zone); 100 | if (lines != null) { 101 | PixelRange pixelRange = zone.getBounds() 102 | .getPixelRange(tile); 103 | for (GridLine line : lines) { 104 | Pixel pixel1 = line.getPoint1().getPixel(tile); 105 | Pixel pixel2 = line.getPoint2().getPixel(tile); 106 | // Draw line 107 | } 108 | } 109 | 110 | List labels = grid.getLabels(tile, zone); 111 | if (labels != null) { 112 | for (GridLabel label : labels) { 113 | PixelRange pixelRange = label.getBounds() 114 | .getPixelRange(tile); 115 | Pixel centerPixel = label.getCenter() 116 | .getPixel(tile); 117 | // Draw label 118 | } 119 | } 120 | 121 | } 122 | } 123 | } 124 | 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /src/test/java/mil/nga/mgrs/grid/GridTypeTest.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.grid; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Grid Type Test 9 | * 10 | * @author osbornb 11 | */ 12 | public class GridTypeTest { 13 | 14 | /** 15 | * Test precisions 16 | */ 17 | @Test 18 | public void testPrecision() { 19 | 20 | assertEquals(0, GridType.GZD.getPrecision()); 21 | assertEquals(100000, GridType.HUNDRED_KILOMETER.getPrecision()); 22 | assertEquals(10000, GridType.TEN_KILOMETER.getPrecision()); 23 | assertEquals(1000, GridType.KILOMETER.getPrecision()); 24 | assertEquals(100, GridType.HUNDRED_METER.getPrecision()); 25 | assertEquals(10, GridType.TEN_METER.getPrecision()); 26 | assertEquals(1, GridType.METER.getPrecision()); 27 | 28 | } 29 | 30 | /** 31 | * Test digit accuracies 32 | */ 33 | @Test 34 | public void testAccuracy() { 35 | 36 | assertEquals(0, GridType.GZD.getAccuracy()); 37 | 38 | assertEquals(GridType.HUNDRED_KILOMETER, GridType.withAccuracy(0)); 39 | assertEquals(0, GridType.HUNDRED_KILOMETER.getAccuracy()); 40 | 41 | assertEquals(GridType.TEN_KILOMETER, GridType.withAccuracy(1)); 42 | assertEquals(1, GridType.TEN_KILOMETER.getAccuracy()); 43 | 44 | assertEquals(GridType.KILOMETER, GridType.withAccuracy(2)); 45 | assertEquals(2, GridType.KILOMETER.getAccuracy()); 46 | 47 | assertEquals(GridType.HUNDRED_METER, GridType.withAccuracy(3)); 48 | assertEquals(3, GridType.HUNDRED_METER.getAccuracy()); 49 | 50 | assertEquals(GridType.TEN_METER, GridType.withAccuracy(4)); 51 | assertEquals(4, GridType.TEN_METER.getAccuracy()); 52 | 53 | assertEquals(GridType.METER, GridType.withAccuracy(5)); 54 | assertEquals(5, GridType.METER.getAccuracy()); 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/mil/nga/mgrs/gzd/BandLetterRangeTest.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Band Letter Range test 9 | * 10 | * @author osbornb 11 | */ 12 | public class BandLetterRangeTest { 13 | 14 | /** 15 | * Band Letters 16 | */ 17 | public static final String BAND_LETTERS = "CDEFGHJKLMNPQRSTUVWXX"; 18 | 19 | /** 20 | * Test the full range 21 | */ 22 | @Test 23 | public void testFullRange() { 24 | 25 | BandLetterRange bandRange = new BandLetterRange(); 26 | for (char bandLetter : bandRange) { 27 | assertEquals(GridZones.getSouthLatitude(bandLetter), 28 | (BAND_LETTERS.indexOf(bandLetter) - 10) * 8, 0.0); 29 | } 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/mil/nga/mgrs/gzd/GridZonesTest.java: -------------------------------------------------------------------------------- 1 | package mil.nga.mgrs.gzd; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | 7 | import mil.nga.mgrs.MGRSConstants; 8 | import mil.nga.mgrs.MGRSUtils; 9 | 10 | /** 11 | * Grid Zones Test 12 | * 13 | * @author osbornb 14 | */ 15 | public class GridZonesTest { 16 | 17 | /** 18 | * Test zone numbers 19 | */ 20 | @Test 21 | public void testZoneNumbers() { 22 | 23 | int zoneNumber = MGRSConstants.MIN_ZONE_NUMBER; 24 | for (double longitude = MGRSConstants.MIN_LON; longitude <= MGRSConstants.MAX_LON; longitude += MGRSConstants.ZONE_WIDTH) { 25 | 26 | int west = (longitude > MGRSConstants.MIN_LON 27 | && longitude < MGRSConstants.MAX_LON) ? zoneNumber - 1 28 | : zoneNumber; 29 | int east = zoneNumber; 30 | 31 | if (longitude < MGRSConstants.MAX_LON) { 32 | assertEquals(east, 33 | (int) Math.floor(longitude / 6 + 31)); 34 | } 35 | 36 | assertEquals(west, GridZones.getZoneNumber(longitude, false)); 37 | assertEquals(east, GridZones.getZoneNumber(longitude, true)); 38 | assertEquals(east, GridZones.getZoneNumber(longitude)); 39 | 40 | if (zoneNumber < MGRSConstants.MAX_ZONE_NUMBER) { 41 | zoneNumber++; 42 | } 43 | 44 | } 45 | 46 | } 47 | 48 | /** 49 | * Test band letters 50 | */ 51 | @Test 52 | public void testBandLetters() { 53 | 54 | char bandLetter = MGRSConstants.MIN_BAND_LETTER; 55 | for (double latitude = MGRSConstants.MIN_LAT; latitude <= MGRSConstants.MAX_LAT; latitude += (latitude < 80.0 56 | ? MGRSConstants.BAND_HEIGHT 57 | : 4.0)) { 58 | 59 | char south = (latitude > MGRSConstants.MIN_LAT && latitude < 80.0) 60 | ? MGRSUtils.previousBandLetter(bandLetter) 61 | : bandLetter; 62 | char north = bandLetter; 63 | 64 | assertEquals(north, 65 | BandLetterRangeTest.BAND_LETTERS 66 | .charAt((int) Math.floor(latitude / 8 + 10))); 67 | 68 | assertEquals(south, GridZones.getBandLetter(latitude, false)); 69 | assertEquals(north, GridZones.getBandLetter(latitude, true)); 70 | assertEquals(north, GridZones.getBandLetter(latitude)); 71 | 72 | if (bandLetter < MGRSConstants.MAX_BAND_LETTER) { 73 | bandLetter = MGRSUtils.nextBandLetter(bandLetter); 74 | } 75 | 76 | } 77 | 78 | } 79 | 80 | } 81 | --------------------------------------------------------------------------------