├── .gitignore
├── CONTRIBUTING.md
├── CoordinateConversion.png
├── README.md
├── application
└── CoordinateConversionLibrary.dll.config
├── license.txt
└── source
└── CoordinateConversion
├── ArcMapAddinCoordinateConversion
├── ArcMapAddinCoordinateConversion.csproj
├── ArcMapCoordinateGet.cs
├── CCUserControlProxy.cs
├── Config.Designer.cs
├── Config.esriaddinx
├── ContextMenuCommands.cs
├── CoordinateConversionButton.cs
├── DockableWindowCoordinateConversion.xaml
├── DockableWindowCoordinateConversion.xaml.cs
├── Helpers
│ ├── ArcMapHelpers.cs
│ └── InputFormatHelper.cs
├── Images
│ ├── ArcMapAddinCoordinateConversion.png
│ ├── CoordinateConversionButton.png
│ ├── CoordinateConversionButton1.png
│ ├── DockableWindowCoordinateConversion.png
│ ├── GenericErrorStop16.png
│ └── coordinate-conversion-16.png
├── MainViewModel.cs
├── MapPointTool.cs
├── Models
│ ├── AMGraphic.cs
│ ├── AddInPoint.cs
│ ├── CCAMGraphic.cs
│ ├── FeatureClassUtils.cs
│ └── KMLUtils.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── ValueConverters
│ ├── IPointToStringConverter.cs
│ └── OppositeBoolValueConverter.cs
├── ViewModels
│ ├── ArcMapTabBaseViewModel.cs
│ ├── CollectTabViewModel.cs
│ ├── ConvertTabViewModel.cs
│ └── SaveAsFormatViewModel.cs
└── Views
│ ├── SaveAsFormatView.xaml
│ └── SaveAsFormatView.xaml.cs
├── CoordinateConversion.sln
├── CoordinateConversionLibrary.Tests
├── CoordinateConversionLibrary.Tests.csproj
├── CoordinateConversionLibraryTests.cs
├── Properties
│ └── AssemblyInfo.cs
├── json
│ ├── fromGeo2DDM.json
│ ├── fromGeo2DMS.json
│ ├── fromGeo2GARS.json
│ ├── fromGeo2GEOREF.json
│ ├── fromGeo2MGRS.json
│ ├── fromGeo2UTMBand.json
│ ├── fromGeo2UTMHem.json
│ ├── mgrs2geo.json
│ ├── processCoordinateStrings.json
│ ├── toGeoFromDDM.json
│ ├── toGeoFromDMS.json
│ ├── toGeoFromGARS.json
│ ├── toGeoFromGEOREF.json
│ ├── toGeoFromMGRS.json
│ ├── toGeoFromUTMBand.json
│ └── toGeoFromUTMHem.json
└── packages.config
├── CoordinateConversionLibrary
├── Attributes
│ └── LocalizableDescriptionAttribute.cs
├── Behaviors
│ └── WindowBehavior.cs
├── CoordinateConversionLibrary.csproj
├── Enums
│ └── Enums.cs
├── Helpers
│ ├── Constants.cs
│ ├── ConversionUtils.cs
│ ├── CoordinateConversionExtensions.cs
│ ├── ExportCSV.cs
│ ├── ImportCSV.cs
│ ├── Mediator.cs
│ ├── NotificationObject.cs
│ ├── RelayCommand.cs
│ ├── SerializableDictionary.cs
│ ├── Storyboard.cs
│ ├── UIHelpers.cs
│ └── Wpf.cs
├── Images
│ ├── Add_Point.png
│ ├── Delete.png
│ ├── EditCopy16.png
│ ├── GenericDeleteRed32_d.png
│ ├── GenericErrorStop16.png
│ ├── GeoprocessingEnvironmentSettings16.png
│ ├── RowHandle.png
│ ├── SelectionSelectTool16.png
│ ├── TableMinusCollaps16_d.png
│ ├── TablePlusExpand16_d.png
│ ├── copy.png
│ ├── copyall.png
│ ├── gears.png
│ ├── hand.png
│ ├── pointtool.png
│ └── tip.png
├── MAResourceDictionary.xaml
├── Models
│ ├── CoordinateBase.cs
│ ├── CoordinateConversionLibraryConfig.cs
│ ├── CoordinateDD.cs
│ ├── CoordinateDDM.cs
│ ├── CoordinateDMS.cs
│ ├── CoordinateFormatterBase.cs
│ ├── CoordinateGARS.cs
│ ├── CoordinateGetBase.cs
│ ├── CoordinateHandler.cs
│ ├── CoordinateMGRS.cs
│ ├── CoordinateUSNG.cs
│ ├── CoordinateUTM.cs
│ ├── DefaultFormatModel.cs
│ └── OutputCoordinateModel.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── ValueConverters
│ ├── EnumToFriendlyNameConverter.cs
│ └── MaxHeightConverter.cs
├── ViewModels
│ ├── BaseViewModel.cs
│ ├── EditOutputCoordinateViewModel.cs
│ ├── EditPropertiesViewModel.cs
│ ├── MainViewModel.cs
│ ├── OutputCoordinateViewModel.cs
│ ├── SelectCoordinateFieldsViewModel.cs
│ └── TabBaseViewModel.cs
└── Views
│ ├── AdditionalFieldsView.xaml
│ ├── AdditionalFieldsView.xaml.cs
│ ├── AmbiguousCoordsView.xaml
│ ├── AmbiguousCoordsView.xaml.cs
│ ├── CCCollectTabView.xaml
│ ├── CCCollectTabView.xaml.cs
│ ├── CCConvertTabView.xaml
│ ├── CCConvertTabView.xaml.cs
│ ├── EditOutputCoordinateView.xaml
│ ├── EditOutputCoordinateView.xaml.cs
│ ├── EditPropertiesView.xaml
│ ├── EditPropertiesView.xaml.cs
│ ├── InputCoordinateConversionView.xaml
│ ├── InputCoordinateConversionView.xaml.cs
│ ├── OutputCoordinateView.xaml
│ ├── OutputCoordinateView.xaml.cs
│ ├── SelectCoordinateFieldsCCView.xaml
│ ├── SelectCoordinateFieldsCCView.xaml.cs
│ ├── SelectCoordinateFieldsView.xaml
│ └── SelectCoordinateFieldsView.xaml.cs
└── ProAppCoordConversionModule
├── Common
└── ValueConverters.cs
├── Config.daml
├── ContextMenuCommands.cs
├── CoordinateConversionDockpane.xaml
├── CoordinateConversionDockpane.xaml.cs
├── CoordinateConversionDockpaneViewModel.cs
├── CoordinateMapTool.cs
├── DarkImages
├── AddInDesktop16.png
├── AddInDesktop32.png
├── coordinate-conversion-16.png
└── coordinate-conversion-32.png
├── Helpers
├── InputFormatHelper.cs
└── MapPointHelper.cs
├── Images
├── AddInDesktop16.png
├── AddInDesktop32.png
├── CoordinateConversionIcon.png
├── DownArrow.png
├── GenericButtonBlue16.png
├── GenericButtonBlue32.png
├── GenericButtonPurple16.png
├── GenericButtonPurple32.png
├── GenericButtonRed16.png
├── GenericButtonRed32.png
├── coordinate-conversion-16.png
└── coordinate-conversion-32.png
├── Models
├── AddInPoint.cs
├── CCProGraphic.cs
├── ColorCollection.cs
├── FeatureClassUtils.cs
├── KMLUtils.cs
├── ProGraphic.cs
└── Symbol.cs
├── Module1.cs
├── ProAppCoordConversionModule.csproj
├── ProCoordinateGet.cs
├── Properties
├── AssemblyInfo.cs
├── FileResources.Designer.cs
└── FileResources.resx
├── PropertiesButton.cs
├── Resources
└── sr_out.csv
├── UI
├── CoordSysDialog.xaml
├── CoordSysDialog.xaml.cs
├── CoordSysPickerView.xaml
├── CoordSysPickerView.xaml.cs
├── CoordSysPickerViewModel.cs
├── FlashEmbeddedControl.xaml
├── FlashEmbeddedControl.xaml.cs
└── FlashEmbeddedControlViewModel.cs
├── ViewModels
├── ProAmbiguousCoordsViewModel.cs
├── ProCollectTabViewModel.cs
├── ProConvertTabViewModel.cs
├── ProEditPropertiesViewModel.cs
├── ProOutputCoordinateViewModel.cs
├── ProSaveAsFormatViewModel.cs
└── ProTabBaseViewModel.cs
└── Views
├── ProAdditionalFieldsView.xaml
├── ProAdditionalFieldsView.xaml.cs
├── ProAmbiguousCoordsView.xaml
├── ProAmbiguousCoordsView.xaml.cs
├── ProEditOutputCoordinateView.xaml
├── ProEditOutputCoordinateView.xaml.cs
├── ProEditPropertiesView.xaml
├── ProEditPropertiesView.xaml.cs
├── ProOutputCoordinateView.xaml
├── ProOutputCoordinateView.xaml.cs
├── ProSaveAsFormatView.xaml
├── ProSaveAsFormatView.xaml.cs
├── ProSelectCoordinateFieldsView.xaml
└── ProSelectCoordinateFieldsView.xaml.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | # Defense Template specific ignores
2 | NuGet.exe
3 | *.pyt.xml
4 | *.zip
5 | *.zip
6 | *-old.*
7 | *-old
8 | *-sav
9 | *-sav.*
10 | *.sav
11 | *- Copy.*
12 |
13 | #############
14 | ## Python
15 | #############
16 |
17 | *.py[co]
18 |
19 | # Packages
20 | *.egg
21 | *.egg-info
22 | dist
23 | build
24 | eggs
25 | parts
26 | bin
27 | var
28 | sdist
29 | develop-eggs
30 | .installed.cfg
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
37 | [Bb]in/
38 | [Oo]bj/
39 | *.vshost.*
40 |
41 | #################
42 | ## Eclipse
43 | #################
44 |
45 | # General
46 | .metadata
47 | bin/
48 | tmp/
49 | dist/
50 | *.tmp
51 | *.bak
52 | *.swp
53 | *~.nib
54 |
55 | # Eclipse
56 | local.properties
57 | .classpath
58 | .settings/
59 | .loadpath
60 |
61 | # External tool builders
62 | .externalToolBuilders/
63 |
64 | # Locally stored "Eclipse launch configurations"
65 | *.launch
66 |
67 | # CDT-specific
68 | .cproject
69 |
70 | # PDT-specific
71 | .buildpath
72 | # mstest test results
73 | TestResults
74 |
75 | ## Ignore Visual Studio temporary files, build results, and
76 | ## files generated by popular Visual Studio add-ons.
77 |
78 | # User-specific files
79 | *.suo
80 | *.user
81 | *.sln.docstates
82 |
83 | # Build results
84 | [Dd]ebug/
85 | [Rr]elease/
86 | x64/
87 | *_i.c
88 | *_p.c
89 | *.ilk
90 | *.meta
91 | *.obj
92 | *.pch
93 | *.pdb
94 | *.pgc
95 | *.pgd
96 | *.rsp
97 | *.sbr
98 | *.tlb
99 | *.tli
100 | *.tlh
101 | *.tmp
102 | *.log
103 | *.vspscc
104 | *.vssscc
105 | .builds
106 |
107 | # Visual C++ cache files
108 | ipch/
109 | *.aps
110 | *.ncb
111 | *.opensdf
112 | *.sdf
113 |
114 | # Visual Studio profiler
115 | *.psess
116 | *.vsp
117 | *.vspx
118 |
119 | # Guidance Automation Toolkit
120 | *.gpState
121 |
122 | # ReSharper is a .NET coding add-in
123 | _ReSharper*
124 |
125 | # NCrunch
126 | *.ncrunch*
127 | .*crunch*.local.xml
128 |
129 | # Installshield output folder
130 | [Ee]xpress
131 |
132 | # DocProject is a documentation generator add-in
133 | DocProject/buildhelp/
134 | DocProject/Help/*.HxT
135 | DocProject/Help/*.HxC
136 | DocProject/Help/*.hhc
137 | DocProject/Help/*.hhk
138 | DocProject/Help/*.hhp
139 | DocProject/Help/Html2
140 | DocProject/Help/html
141 |
142 | # Click-Once directory
143 | publish
144 |
145 | # Publish Web Output
146 | *.Publish.xml
147 |
148 | # NuGet Packages Directory
149 | packages
150 |
151 | # Windows Azure Build Output
152 | csx
153 | *.build.csdef
154 |
155 | # Windows Store app package directory
156 | AppPackages/
157 |
158 | # Others
159 | [Bb]in
160 | [Oo]bj
161 | sql
162 | TestResults
163 | [Tt]est[Rr]esult*
164 | *.Cache
165 | ClientBin
166 | [Ss]tyle[Cc]op.*
167 | ~$*
168 | *.dbmdl
169 | Generated_Code #added for RIA/Silverlight projects
170 |
171 | # Backup & report files from converting an old project file to a newer
172 | # Visual Studio version. Backup files are not needed, because we have git ;-)
173 | _UpgradeReport_Files/
174 | Backup*/
175 | UpgradeLog*.XML
176 |
177 | ############
178 | ## Windows
179 | ############
180 |
181 | # Windows image file caches
182 | Thumbs.db
183 |
184 | # Folder config file
185 | Desktop.ini
186 |
187 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).
--------------------------------------------------------------------------------
/CoordinateConversion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/CoordinateConversion.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # coordinate-conversion-addin-dotnet
2 |
3 | ## *This repository is no longer maintained.*
4 |
5 | ___Beginning at ArcGIS Pro 2.6 this functionality is installed with ArcGIS Pro.___
6 |
7 |
8 | Coordinate Conversion window in ArcGIS Pro
9 | Coordinate Conversion allows analysts to input and quickly convert coordinates between several common formats, including Universal Transverse Mercator (UTM) and Military Grid Reference System (MGRS).
10 |
11 | 
12 |
13 | ## Features
14 |
15 | * Convert several coordinate formats in one dialog
16 | * Copy coordinates to support other applications
17 | * Customize output format for converted coordinates
18 | * Import and export coordinate lists
19 |
20 | ## Sections
21 |
22 | * [Requirements](#requirements)
23 | * [Instructions](#instructions)
24 | * [Resources](#resources)
25 | * [Issues](#issues)
26 | * [Contributing](#contributing)
27 | * [Licensing](#licensing)
28 |
29 | ## Requirements
30 |
31 | ### Build Requirements
32 |
33 | * Visual Studio 2015
34 | * Important Note: Visual Studio 2013 [may also be required if building on ArcGIS 10.4.1-10.5.1](https://support.esri.com/en/technical-article/000012659)
35 | * ArcGIS for Desktop
36 | * ArcMap 10.4.1+
37 | * ArcGIS Pro 2.2+
38 | * ArcGIS Desktop SDK for .NET 10.4.1+
39 | * [ArcGIS Desktop for .NET Requirements](https://desktop.arcgis.com/en/desktop/latest/get-started/system-requirements/arcobjects-sdk-system-requirements.htm)
40 | * [ArcGIS Pro SDK](http://pro.arcgis.com/en/pro-app/sdk/) 2.2+
41 |
42 | ### Run Requirements
43 |
44 | * ArcGIS for Desktop
45 | * ArcMap 10.4.1+
46 | * ArcGIS Pro 2.2+
47 |
48 | ## Instructions
49 |
50 | ### General Help
51 |
52 | * [New to Github? Get started here.](http://htmlpreview.github.com/?https://github.com/Esri/esri.github.com/blob/master/help/esri-getting-to-know-github.html)
53 |
54 | ### Getting Started with the Coordinate Conversion Addin (.NET)
55 |
56 | ## Development Environment
57 |
58 | * Building
59 | * To Build Using Visual Studio
60 | * Open and build solution file
61 | * To use MSBuild to build the solution
62 | * Open a Visual Studio Command Prompt: Start Menu | Visual Studio 2015 | Visual Studio Tools | Developer Command Prompt for VS2015
63 | * ` cd coordinate-conversion-addin-dotnet\source\CoordinateConversion `
64 | * ` msbuild CoordinateConversion.sln /property:Configuration=Release `
65 | * To run Unit test from command prompt
66 | * Open a Visual Studio Command Prompt: Start Menu | Visual Studio 2015 | Visual Studio Tools | Developer Command Prompt for VS2015
67 | * ` cd coordinate-conversion-addin-dotnet\source\CoordinateConversion\CoordinateConversionLibrary.Tests\bin\Release `
68 | * ` MSTest /testcontainer:CoordinateConversionLibrary.Tests.dll `
69 | * Note : Assembly references are based on a default install of the SDK, you may have to update the references if you chose an alternate install option
70 |
71 |
72 |
73 | ## Resources
74 |
75 | * [Coordinate Conversion online documentation](http://solutions.arcgis.com/defense/help/coordinate-conversion/)
76 | * [Military Tools for ArcGIS](https://esri.github.io/military-tools-desktop-addins/)
77 | * [Military Tools for ArcGIS Solutions Pages](http://solutions.arcgis.com/defense/help/military-tools/)
78 | * [ArcGIS for Defense Downloads](http://appsforms.esri.com/products/download/#ArcGIS_for_Defense)
79 | * [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/)
80 | * [ArcGIS Solutions Website](http://solutions.arcgis.com/)
81 |
82 | ## Issues
83 |
84 | Find a bug or want to request a new feature? Please let us know by submitting an [issue](https://github.com/Esri/coordinate-tool-addin-dotnet/issues).
85 |
86 | ## Contributing
87 |
88 | Anyone and everyone is welcome to contribute. Please see our [guidelines for contributing](https://github.com/esri/contributing).
89 |
90 | ## Repository Points of Contact
91 | Contact the [Military Tools team](mailto:defensesolutions@esri.com)
92 |
93 | ## Licensing
94 | Copyright 2018 Esri
95 |
96 | Licensed under the Apache License, Version 2.0 (the "License");
97 | you may not use this file except in compliance with the License.
98 | You may obtain a copy of the License at:
99 |
100 | http://www.apache.org/licenses/LICENSE-2.0.
101 |
102 | Unless required by applicable law or agreed to in writing, software
103 | distributed under the License is distributed on an "AS IS" BASIS,
104 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
105 | See the License for the specific language governing permissions and
106 | limitations under the License.
107 |
108 | A copy of the license is available in the repository's [license.txt](./License.txt) file.
109 |
110 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Config.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Config.Designer.cs
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Config.esriaddinx:
--------------------------------------------------------------------------------
1 |
2 | Coordinate Conversion
3 | {19b92973-746a-4114-9232-3467ca1fc631}
4 | Quickly convert coordinates between several formats
5 | 2.1.2
6 | Images\ArcMapAddinCoordinateConversion.png
7 | Esri
8 | Esri
9 | 11/30/2017
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/ContextMenuCommands.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2016 Esri
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 | using System;
18 | using System.Linq;
19 | using ESRI.ArcGIS.Geometry;
20 | using ESRI.ArcGIS.Desktop.AddIns;
21 | using CoordinateConversionLibrary.Models;
22 |
23 | namespace ArcMapAddinCoordinateConversion
24 | {
25 | public class ContextCopyBase : ESRI.ArcGIS.Desktop.AddIns.Button
26 | {
27 | public ContextCopyBase()
28 | {
29 | }
30 |
31 | internal CoordinateType ctype = CoordinateType.Unknown;
32 |
33 | protected override void OnClick()
34 | {
35 | if (ArcMap.Document == null || ArcMap.Document.CurrentLocation == null
36 | || ctype == CoordinateConversionLibrary.Models.CoordinateType.Unknown)
37 | return;
38 |
39 | var point = ArcMap.Document.CurrentLocation;
40 | if (point == null)
41 | return;
42 |
43 | string coord = string.Empty;
44 | try
45 | {
46 | var cn = (IConversionNotation)point;
47 |
48 | switch(ctype)
49 | {
50 | case CoordinateType.DD:
51 | coord = cn.GetDDFromCoords(6);
52 | break;
53 | case CoordinateType.DDM:
54 | coord = cn.GetDDMFromCoords(6);
55 | break;
56 | case CoordinateType.DMS:
57 | coord = cn.GetDMSFromCoords(2);
58 | break;
59 | case CoordinateType.GARS:
60 | coord = cn.GetGARSFromCoords();
61 | break;
62 | case CoordinateType.MGRS:
63 | coord = cn.CreateMGRS(5, true, esriMGRSModeEnum.esriMGRSMode_Automatic);
64 | break;
65 | case CoordinateType.USNG:
66 | coord = cn.GetUSNGFromCoords(5, true, true);
67 | break;
68 | case CoordinateType.UTM:
69 | coord = cn.GetUTMFromCoords(esriUTMConversionOptionsEnum.esriUTMAddSpaces | esriUTMConversionOptionsEnum.esriUTMUseNS);
70 | break;
71 | default:
72 | break;
73 | }
74 |
75 | coord = CoordinateHandler.GetFormattedCoordinate(coord, ctype);
76 |
77 | System.Windows.Clipboard.SetText(coord);
78 | }
79 | catch { /* Conversion Failed */ }
80 | }
81 |
82 | protected override void OnUpdate()
83 | {
84 | Enabled = ArcMap.Document != null;
85 | }
86 | }
87 |
88 | public class ContextCopyDD : ContextCopyBase
89 | {
90 | public ContextCopyDD()
91 | {
92 | ctype = CoordinateType.DD;
93 | }
94 | }
95 |
96 | public class ContextCopyDDM : ContextCopyBase
97 | {
98 | public ContextCopyDDM()
99 | {
100 | ctype = CoordinateType.DDM;
101 | }
102 | }
103 |
104 | public class ContextCopyDMS : ContextCopyBase
105 | {
106 | public ContextCopyDMS()
107 | {
108 | ctype = CoordinateType.DMS;
109 | }
110 | }
111 | public class ContextCopyGARS : ContextCopyBase
112 | {
113 | public ContextCopyGARS()
114 | {
115 | ctype = CoordinateType.GARS;
116 | }
117 | }
118 | public class ContextCopyMGRS : ContextCopyBase
119 | {
120 | public ContextCopyMGRS()
121 | {
122 | ctype = CoordinateType.MGRS;
123 | }
124 | }
125 | public class ContextCopyUSNG : ContextCopyBase
126 | {
127 | public ContextCopyUSNG()
128 | {
129 | ctype = CoordinateType.USNG;
130 | }
131 | }
132 | public class ContextCopyUTM : ContextCopyBase
133 | {
134 | public ContextCopyUTM()
135 | {
136 | ctype = CoordinateType.UTM;
137 | }
138 | }
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/CoordinateConversionButton.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2015 Esri
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 | using System;
18 | using ESRI.ArcGIS.esriSystem;
19 | using ESRI.ArcGIS.Framework;
20 | using ESRI.ArcGIS.Carto;
21 | using ESRI.ArcGIS.Geometry;
22 | using ESRI.ArcGIS.Desktop.AddIns;
23 | using ESRI.ArcGIS.Controls;
24 | using CoordinateConversionLibrary.ViewModels;
25 |
26 | namespace ArcMapAddinCoordinateConversion
27 | {
28 | public class CoordinateConversionButton : ESRI.ArcGIS.Desktop.AddIns.Button
29 | {
30 | public CoordinateConversionButton()
31 | {
32 | }
33 |
34 | protected override void OnClick()
35 | {
36 | ArcMap.Application.CurrentTool = null;
37 |
38 | UID dockWinID = new UIDClass();
39 | dockWinID.Value = ThisAddIn.IDs.DockableWindowCoordinateConversion;
40 |
41 | IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
42 | dockWindow.Show(true);
43 | }
44 | protected override void OnUpdate()
45 | {
46 | Enabled = ArcMap.Application != null;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/DockableWindowCoordinateConversion.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/ArcMapAddinCoordinateConversion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/ArcMapAddinCoordinateConversion.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/CoordinateConversionButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/CoordinateConversionButton.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/CoordinateConversionButton1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/CoordinateConversionButton1.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/DockableWindowCoordinateConversion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/DockableWindowCoordinateConversion.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/GenericErrorStop16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/GenericErrorStop16.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/coordinate-conversion-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/coordinate-conversion-addin-dotnet/2ea17743bbc35f99436667e5a54792231ed37cca/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Images/coordinate-conversion-16.png
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2015 Esri
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 | using System;
18 | using System.Windows.Data;
19 | using System.Windows.Controls;
20 | using CoordinateConversionLibrary;
21 | using CoordinateConversionLibrary.Helpers;
22 | using CoordinateConversionLibrary.Views;
23 | using CoordinateConversionLibrary.ViewModels;
24 |
25 | namespace ArcMapAddinCoordinateConversion.ViewModels
26 | {
27 | public class MainViewModel : BaseViewModel
28 | {
29 | public MainViewModel()
30 | {
31 | ConvertTabView = new CCConvertTabView();
32 | ConvertTabView.DataContext = new ConvertTabViewModel();
33 | }
34 |
35 | public CCConvertTabView ConvertTabView { get; set; }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Models/AMGraphic.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using ESRI.ArcGIS.Geometry;
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | namespace ArcMapAddinCoordinateConversion.Models
20 | {
21 | public class AMGraphic
22 | {
23 | public AMGraphic(string _uniqueid, IGeometry _geometry, bool _isTemp = false, Dictionary> _dictionary = null)
24 | {
25 | UniqueId = _uniqueid;
26 | Geometry = _geometry;
27 | IsTemp = _isTemp;
28 | FieldsDictionary = _dictionary;
29 | }
30 |
31 | // properties
32 |
33 | ///
34 | /// Property for the unique id of the graphic (guid)
35 | ///
36 | public string UniqueId { get; set; }
37 |
38 | ///
39 | /// Property for the geometry of the graphic
40 | ///
41 | public IGeometry Geometry { get; set; }
42 |
43 | ///
44 | /// Property to determine if graphic is temporary or not
45 | ///
46 | public bool IsTemp { get; set; }
47 |
48 | public Dictionary> FieldsDictionary;
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Models/AddInPoint.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using ESRI.ArcGIS.Geometry;
16 | using CoordinateConversionLibrary.Helpers;
17 | using ArcMapAddinCoordinateConversion.ValueConverters;
18 | using System.Collections.Generic;
19 | using System;
20 |
21 | namespace ArcMapAddinCoordinateConversion.Models
22 | {
23 | public class AddInPoint : NotificationObject
24 | {
25 | public AddInPoint()
26 | {
27 |
28 | }
29 |
30 | private IPointToStringConverter pointConverter = new IPointToStringConverter();
31 |
32 | private IPoint point = null;
33 | public IPoint Point
34 | {
35 | get
36 | {
37 | return point;
38 | }
39 | set
40 | {
41 | point = value;
42 |
43 | RaisePropertyChanged(() => Point);
44 | RaisePropertyChanged(() => Text);
45 | }
46 | }
47 | public string Text
48 | {
49 | get
50 | {
51 | try
52 | {
53 | return pointConverter.Convert(point as object, typeof(string), null, null) as string;
54 | }
55 | catch
56 | {
57 | return "NA";
58 | }
59 |
60 | }
61 | }
62 |
63 | private string guid = string.Empty;
64 | public string GUID
65 | {
66 | get
67 | {
68 | return guid;
69 | }
70 | set
71 | {
72 | guid = value;
73 | RaisePropertyChanged(() => GUID);
74 | }
75 | }
76 | ///
77 | /// Property used to determine if it is selected in the listbox
78 | ///
79 | private bool isSelected = false;
80 | public bool IsSelected
81 | {
82 | get
83 | {
84 | return isSelected;
85 | }
86 | set
87 | {
88 | isSelected = value;
89 | RaisePropertyChanged(() => IsSelected);
90 | }
91 | }
92 |
93 | private Dictionary> fieldsDictionary;
94 | public Dictionary> FieldsDictionary
95 | {
96 | get { return fieldsDictionary; }
97 | set { fieldsDictionary = value; }
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Models/CCAMGraphic.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ArcMapAddinCoordinateConversion.Models
8 | {
9 | public class CCAMGraphic
10 | {
11 | public AMGraphic MapPoint { get; set; }
12 | public Dictionary Attributes { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Models/KMLUtils.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2016 Esri
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 | // System
18 | using System;
19 |
20 | // Esri
21 | using ESRI.ArcGIS.Carto;
22 | using ESRI.ArcGIS.Display;
23 | using ESRI.ArcGIS.esriSystem;
24 | using ESRI.ArcGIS.Geodatabase;
25 | using ESRI.ArcGIS.Geometry;
26 | using ESRI.ArcGIS.Geoprocessing;
27 |
28 | namespace ArcMapAddinCoordinateConversion.Models
29 | {
30 | class KMLUtils
31 | {
32 |
33 | public bool ConvertLayerToKML(IFeatureClass fc, string kmzOutputPath, string tmpShapefilePath, ESRI.ArcGIS.Carto.IMap map)
34 | {
35 | try
36 | {
37 | string kmzName = System.IO.Path.GetFileName(kmzOutputPath);
38 | string folderName = System.IO.Path.GetDirectoryName(kmzOutputPath);
39 | var fcName = System.IO.Path.GetFileNameWithoutExtension(kmzName);
40 |
41 | IFeatureLayer fLayer = new FeatureLayer();
42 | fLayer.FeatureClass = fc;
43 | var geoLayer = (fLayer as IGeoFeatureLayer);
44 | if (geoLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
45 | {
46 | ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass();
47 | pSimpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
48 | pSimpleMarkerSymbol.Size = CoordinateConversionLibrary.Constants.SymbolSize;
49 | pSimpleMarkerSymbol.Color = new RgbColorClass() { Red = 255 };
50 | ISimpleRenderer pSimpleRenderer;
51 | pSimpleRenderer = new SimpleRenderer();
52 | pSimpleRenderer.Symbol = (ISymbol)pSimpleMarkerSymbol;
53 | geoLayer.Name = fcName;
54 | geoLayer.Renderer = (IFeatureRenderer)pSimpleRenderer;
55 | }
56 | var featureLayer = geoLayer as FeatureLayer;
57 |
58 | map.AddLayer(geoLayer);
59 |
60 | // Initialize the geoprocessor.
61 | IGeoProcessor2 gp = new GeoProcessorClass();
62 | IVariantArray parameters = new VarArrayClass();
63 | parameters.Add(featureLayer.Name);
64 | parameters.Add(folderName + "\\" + kmzName);
65 | var result = gp.Execute(CoordinateConversionLibrary.Constants.LayerToKMLGPTool, parameters, null);
66 |
67 | // Remove the temporary layer from the TOC
68 | for (int i = 0; i < map.LayerCount; i++)
69 | {
70 | ILayer layer = map.get_Layer(i);
71 | if (layer.Name == fcName)
72 | {
73 | map.DeleteLayer(layer);
74 | break;
75 | }
76 | }
77 |
78 | return true;
79 | }
80 | catch (Exception ex)
81 | {
82 | System.Diagnostics.Debug.WriteLine(ex.Message);
83 | }
84 |
85 | return false;
86 | }
87 | }
88 |
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ArcMapAddinCoordinateConversion")]
9 | [assembly: AssemblyDescription("ArcMapAddinCoordinateConversion")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Esri")]
12 | [assembly: AssemblyProduct("ArcMapAddinCoordinateConversion")]
13 | [assembly: AssemblyCopyright("Copyright © ESRI 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("19b92973-746a-4114-9232-3467ca1fc631")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.1.0")]
36 | [assembly: AssemblyFileVersion("2.1.0")]
37 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ArcMapAddinCoordinateConversion.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | public class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | public static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ArcMapAddinCoordinateConversion.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | public static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/ValueConverters/IPointToStringConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Windows.Data;
17 | using ESRI.ArcGIS.Geometry;
18 | using CoordinateConversionLibrary;
19 | using CoordinateConversionLibrary.Models;
20 | using System.Text.RegularExpressions;
21 | using System.Globalization;
22 | using ESRI.ArcGIS.Carto;
23 | using ESRI.ArcGIS.ArcMapUI;
24 | using ArcMapAddinCoordinateConversion.Helpers;
25 | using System.Linq;
26 |
27 | namespace ArcMapAddinCoordinateConversion.ValueConverters
28 | {
29 | [ValueConversion(typeof(IPoint), typeof(String))]
30 | public class IPointToStringConverter : IValueConverter
31 | {
32 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
33 | {
34 | if (value == null)
35 | return "NA";
36 |
37 | var point = value as IPoint;
38 | if (point == null)
39 | return "NA";
40 |
41 | var result = string.Format("{0:0.0#####} {1:0.0#####}", point.Y, point.X);
42 |
43 | if (point.SpatialReference == null)
44 | return result;
45 |
46 | var cn = point as IConversionNotation;
47 | if (cn != null)
48 | {
49 | switch (CoordinateConversionLibraryConfig.AddInConfig.DisplayCoordinateType)
50 | {
51 | case CoordinateTypes.DD:
52 | result = cn.GetDDFromCoords(6);
53 | break;
54 | case CoordinateTypes.DDM:
55 | result = cn.GetDDMFromCoords(4);
56 | break;
57 | case CoordinateTypes.DMS:
58 | result = cn.GetDMSFromCoords(2);
59 | break;
60 | //case CoordinateTypes.GARS:
61 | // result = cn.GetGARSFromCoords();
62 | // break;
63 | case CoordinateTypes.MGRS:
64 | result = cn.CreateMGRS(5, true, esriMGRSModeEnum.esriMGRSMode_Automatic);
65 | break;
66 | case CoordinateTypes.USNG:
67 | result = cn.GetUSNGFromCoords(5, true, true);
68 | break;
69 | case CoordinateTypes.UTM:
70 | result = cn.GetUTMFromCoords(esriUTMConversionOptionsEnum.esriUTMAddSpaces | esriUTMConversionOptionsEnum.esriUTMUseNS);
71 | break;
72 | default:
73 | break;
74 | }
75 | }
76 | if (CoordinateConversionLibraryConfig.AddInConfig.IsCustomFormat)
77 | {
78 | InputFormatHelper inputFormatHelper = new InputFormatHelper();
79 | result = inputFormatHelper.ProcessInput(result);
80 | }
81 | return result;
82 | }
83 |
84 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
85 | {
86 | throw new NotImplementedException();
87 | }
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/ValueConverters/OppositeBoolValueConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Windows.Data;
17 |
18 | namespace ArcMapAddinCoordinateConversion.ValueConverters
19 | {
20 | public class BoolToOppositeBoolConverter : IValueConverter
21 | {
22 | #region IValueConverter Members
23 |
24 | public object Convert(object value, Type targetType, object parameter,
25 | System.Globalization.CultureInfo culture)
26 | {
27 | if (targetType != typeof(bool))
28 | throw new InvalidOperationException("The target must be a boolean");
29 |
30 | return !(bool)value;
31 | }
32 |
33 | public object ConvertBack(object value, Type targetType, object parameter,
34 | System.Globalization.CultureInfo culture)
35 | {
36 | throw new NotSupportedException();
37 | }
38 |
39 | #endregion
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/ViewModels/SaveAsFormatViewModel.cs:
--------------------------------------------------------------------------------
1 |
2 | /*******************************************************************************
3 | * Copyright 2016 Esri
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | ******************************************************************************/
17 |
18 | using CoordinateConversionLibrary.ViewModels;
19 |
20 | namespace ArcMapAddinCoordinateConversion.ViewModels
21 | {
22 | class SaveAsFormatViewModel : BaseViewModel
23 | {
24 |
25 | private bool featureShapeIsChecked = true;
26 | public bool FeatureShapeIsChecked
27 | {
28 | get
29 | {
30 | return featureShapeIsChecked;
31 | }
32 |
33 | set
34 | {
35 | featureShapeIsChecked = value;
36 | RaisePropertyChanged(() => FeatureShapeIsChecked);
37 | }
38 | }
39 |
40 | private bool kmlIsChecked = false;
41 | public bool KmlIsChecked
42 | {
43 | get
44 | {
45 | return kmlIsChecked;
46 | }
47 |
48 | set
49 | {
50 | kmlIsChecked = value;
51 | RaisePropertyChanged(() => KmlIsChecked);
52 | }
53 | }
54 |
55 | private bool csvIsChecked = false;
56 | public bool CSVIsChecked
57 | {
58 | get
59 | {
60 | return csvIsChecked;
61 | }
62 |
63 | set
64 | {
65 | csvIsChecked = value;
66 | RaisePropertyChanged(() => CSVIsChecked);
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Views/SaveAsFormatView.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/ArcMapAddinCoordinateConversion/Views/SaveAsFormatView.xaml.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2016 Esri
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 | using System.Windows;
18 |
19 |
20 | namespace ArcMapAddinCoordinateConversion.Views
21 | {
22 | ///
23 | /// Interaction logic for SaveAsFormatView.xaml
24 | ///
25 | public partial class AMSaveAsFormatView : Window
26 | {
27 | public AMSaveAsFormatView()
28 | {
29 | InitializeComponent();
30 | }
31 |
32 | private void Button_Click(object sender, RoutedEventArgs e)
33 | {
34 | DialogResult = true;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversion.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcMapAddinCoordinateConversion", "ArcMapAddinCoordinateConversion\ArcMapAddinCoordinateConversion.csproj", "{A6297643-B920-4951-915F-046B266E023A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordinateConversionLibrary", "CoordinateConversionLibrary\CoordinateConversionLibrary.csproj", "{67FFDFAE-F8EC-45AA-A3F9-6109BCF5BBF4}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordinateConversionLibrary.Tests", "CoordinateConversionLibrary.Tests\CoordinateConversionLibrary.Tests.csproj", "{07C3BFDE-D76D-425A-8CE9-A9C174D21DA9}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProAppCoordConversionModule", "ProAppCoordConversionModule\ProAppCoordConversionModule.csproj", "{D91D391E-03A3-4376-8BBB-EAF6F0DA1EBF}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {A6297643-B920-4951-915F-046B266E023A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {A6297643-B920-4951-915F-046B266E023A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {A6297643-B920-4951-915F-046B266E023A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {A6297643-B920-4951-915F-046B266E023A}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {67FFDFAE-F8EC-45AA-A3F9-6109BCF5BBF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {67FFDFAE-F8EC-45AA-A3F9-6109BCF5BBF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {67FFDFAE-F8EC-45AA-A3F9-6109BCF5BBF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {67FFDFAE-F8EC-45AA-A3F9-6109BCF5BBF4}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {07C3BFDE-D76D-425A-8CE9-A9C174D21DA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {07C3BFDE-D76D-425A-8CE9-A9C174D21DA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {07C3BFDE-D76D-425A-8CE9-A9C174D21DA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {07C3BFDE-D76D-425A-8CE9-A9C174D21DA9}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {D91D391E-03A3-4376-8BBB-EAF6F0DA1EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {D91D391E-03A3-4376-8BBB-EAF6F0DA1EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {D91D391E-03A3-4376-8BBB-EAF6F0DA1EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {D91D391E-03A3-4376-8BBB-EAF6F0DA1EBF}.Release|Any CPU.Build.0 = Release|Any CPU
36 | EndGlobalSection
37 | GlobalSection(SolutionProperties) = preSolution
38 | HideSolutionNode = FALSE
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("CoordinateConversionLibrary.Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("CoordinateConversionLibrary.Tests")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("82be6a82-5fd1-4be9-9dce-d3a4353c8502")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary.Tests/json/processCoordinateStrings.json:
--------------------------------------------------------------------------------
1 | {
2 | "tests": [
3 | { "testNumber": "1",
4 | "testString": "01CDA9347609646",
5 | "type": {
6 | "name": "MGRS",
7 | "pattern": "/^(\d{1,2}[-,;:\s]*[c-hj-np-xC-HJ-NP-X][-,;:\s]*[a-hj-np-zA-HJ-NP-Z]{2}[-,;:\s]*\d{1,5}[-,;:\s]*\d{1,5}$)|([AaBbYyZz][-,;:\s]*[a-hj-np-zA-HJ-NP-Z]{2}[-,;:\s]*\d{1,5}[-,;:\s]*\d{1,5})$/",
8 | "notationType": "MGRS"
9 | }
10 | }
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Attributes/LocalizableDescriptionAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Resources;
17 | using System.Reflection;
18 | using System.Globalization;
19 | using System.ComponentModel;
20 |
21 | namespace CoordinateConversionLibrary
22 | {
23 | ///
24 | /// Attribute for localization.
25 | ///
26 | [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
27 | public sealed class LocalizableDescriptionAttribute : DescriptionAttribute
28 | {
29 | #region Public methods.
30 | // ------------------------------------------------------------------
31 |
32 | ///
33 | /// Initializes a new instance of the class.
34 | ///
35 | /// The description.
36 | /// Type of the resources.
37 | public LocalizableDescriptionAttribute(string description, Type resourcesType)
38 | : base(description)
39 | {
40 | _resourcesType = resourcesType;
41 | }
42 |
43 | // ------------------------------------------------------------------
44 | #endregion
45 |
46 | #region Public properties.
47 | // ------------------------------------------------------------------
48 |
49 | ///
50 | /// Get the string value from the resources.
51 | ///
52 | ///
53 | /// The description stored in this attribute.
54 | public override string Description
55 | {
56 | get
57 | {
58 | if (!_isLocalized)
59 | {
60 | ResourceManager resMan =
61 | _resourcesType.InvokeMember(
62 | @"ResourceManager",
63 | BindingFlags.GetProperty | BindingFlags.Static |
64 | BindingFlags.Public | BindingFlags.NonPublic,
65 | null,
66 | null,
67 | new object[] { }) as ResourceManager;
68 |
69 | CultureInfo culture =
70 | _resourcesType.InvokeMember(
71 | @"Culture",
72 | BindingFlags.GetProperty | BindingFlags.Static |
73 | BindingFlags.Public | BindingFlags.NonPublic,
74 | null,
75 | null,
76 | new object[] { }) as CultureInfo;
77 |
78 | _isLocalized = true;
79 |
80 | if (resMan != null)
81 | {
82 | DescriptionValue =
83 | resMan.GetString(DescriptionValue, culture);
84 | }
85 | }
86 |
87 | return DescriptionValue;
88 | }
89 | }
90 |
91 | // ------------------------------------------------------------------
92 | #endregion
93 |
94 | #region Private variables.
95 | // ------------------------------------------------------------------
96 |
97 | private readonly Type _resourcesType;
98 | private bool _isLocalized;
99 |
100 | // ------------------------------------------------------------------
101 | #endregion
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Enums/Enums.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using CoordinateConversionLibrary.Properties;
16 |
17 | namespace CoordinateConversionLibrary
18 | {
19 |
20 | public enum GeomType : int
21 | {
22 | Point = 1,
23 | PolyLine = 2,
24 | Polygon = 3
25 | }
26 |
27 | public enum SaveAsType : int
28 | {
29 | FileGDB = 1,
30 | Shapefile = 2,
31 | KML = 3
32 | }
33 |
34 | public enum CoordinateTypes : int
35 | {
36 | [LocalizableDescription(@"EnumCTDefaults", typeof(Resources))]
37 | Default = 0,
38 |
39 | [LocalizableDescription(@"EnumCTDD", typeof(Resources))]
40 | DD = 1,
41 |
42 | [LocalizableDescription(@"EnumCTDDM", typeof(Resources))]
43 | DDM = 2,
44 |
45 | [LocalizableDescription(@"EnumCTDMS", typeof(Resources))]
46 | DMS = 3,
47 |
48 | //[LocalizableDescription(@"EnumCTGARS", typeof(Resources))]
49 | //GARS = 4,
50 |
51 | [LocalizableDescription(@"EnumCTMGRS", typeof(Resources))]
52 | MGRS = 5,
53 |
54 | [LocalizableDescription(@"EnumCTUSNG", typeof(Resources))]
55 | USNG = 6,
56 |
57 | [LocalizableDescription(@"EnumCTUTM", typeof(Resources))]
58 | UTM = 7,
59 |
60 | [LocalizableDescription(@"EnumCTNone", typeof(Resources))]
61 | None = 8,
62 |
63 | [LocalizableDescription(@"EnumCTCustom", typeof(Resources))]
64 | Custom = 9
65 | }
66 |
67 | ///
68 | /// Enumeration used for the different tool modes
69 | ///
70 | public enum MapPointToolMode : int
71 | {
72 | Unknown = 0,
73 | Convert = 1,
74 | Collect = 2
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Helpers/Constants.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2015 Esri
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 | namespace CoordinateConversionLibrary
19 | {
20 | public class Constants
21 | {
22 | public const int MAX_HISTORY_COUNT = 5;
23 |
24 | public const string CopyAllCoordinateOutputs = "COPY_ALL_COORDINATE_OUTPUTS";
25 | public const string SelectSpatialReference = "SELECTSR";
26 | public const string SpatialReferenceSelected = "SRSELECTED";
27 | public const string RequestCoordinateBroadcast = "BROADCAST_COORDINATE_NEEDED";
28 | public const string ClearOutputCoordinates = "BROADCAST_CLEAR_OUTPUT_COORDINATES";
29 | public const string AddNewOutputCoordinate = "ADD_NEW_OUTPUT_COORDINATE";
30 | public const string BroadcastCoordinateValues = "BROADCAST_COORDINATE_VALUES";
31 | public const string RequestOutputUpdate = "REQUEST_OUTPUT_UPDATE";
32 | public const string SetListBoxItemAddInPoint = "SET_LISTBOX_ITEM_ADDINPOINT";
33 | public const string NewMapPointSelection = "NEW_MAP_POINT_SELECTION";
34 | public const string SetCoordinateGetter = "SET_COORDINATE_GETTER";
35 | public const string NEW_MAP_POINT = "NEW_MAP_POINT";
36 | public const string MOUSE_MOVE_POINT = "MOUSE_MOVE_POINT";
37 | public const string IMPORT_COORDINATES = "IMPORT_COORDINATES";
38 | public const string CollectListHasItems = "COLLECT_LIST_HAS_ITEMS";
39 | public const string SELECT_MAP_POINT = "SELECT_MAP_POINT";
40 | public const string DEACTIVATE_TOOL = "DEACTIVATE_TOOL";
41 | public const string VALIDATE_MAP_POINT = "VALIDATE_MAP_POINT";
42 |
43 | public const string DefaultCustomFormat = "Y0.0##### X0.0#####";
44 | public const string DDCustomFormat = "Y0.0##### X0.0#####";
45 | public const string DDMCustomFormat = "A0° B0.0###' X0° Y0.0###'";
46 | public const string DMSCustomFormat = "A0° B0' C0.0#\" X0° Y0' Z0.0#\"";
47 | public const string MGRSCustomFormat = "ZSX00000Y00000";
48 | public const string USNGCustomFormat = "ZSX00000Y00000";
49 | public const string UTMCustomFormat = "Z#B X0 Y0";
50 | public const double SymbolSize = 10;
51 | public const string LayerToKMLGPTool = "LayerToKML_conversion";
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Helpers/ConversionUtils.cs:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2018 Esri
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 | using System;
17 | using System.Collections.Generic;
18 | using System.Linq;
19 | using System.Text;
20 | using System.Threading.Tasks;
21 | using CoordinateConversionLibrary.Models;
22 |
23 | namespace CoordinateConversionLibrary.Helpers
24 | {
25 | public class ConversionUtils
26 | {
27 | ///
28 | /// Returns a formatted coordinate string for an input coordinate string
29 | /// IMPORTANT: if a coordinate format is not matched:
30 | /// Returns CoordinateType.Unknown, the input string as the formattedString
31 | ///
32 | /// Input coord string
33 | /// Formatted coord string
34 | /// CoordinateType of the format that matched, Unknown if unmatched
35 | public static CoordinateType GetCoordinateString(string input, out string formattedString)
36 | {
37 | // We don't want the Ambiguous Coords Dialog to show during these calls
38 | // But don't overwrite the setting in case user has set to prompt for this
39 | bool savedAmbigCoordSetting = CoordinateConversionLibraryConfig.AddInConfig.DisplayAmbiguousCoordsDlg;
40 | CoordinateConversionLibraryConfig.AddInConfig.DisplayAmbiguousCoordsDlg = false;
41 |
42 | formattedString = input;
43 | // DD
44 | CoordinateDD dd;
45 | if (CoordinateDD.TryParse(input, out dd, true) == true)
46 | {
47 | formattedString = dd.ToString("Y0.0#####N X0.0#####E", new CoordinateDDFormatter());
48 | return CoordinateType.DD;
49 | }
50 |
51 | // DDM
52 | CoordinateDDM ddm;
53 | if (CoordinateDDM.TryParse(input, out ddm, true) == true)
54 | {
55 | dd = new CoordinateDD(ddm);
56 | formattedString = ddm.ToString("", new CoordinateDDMFormatter());
57 | return CoordinateType.DDM;
58 | }
59 |
60 | // DMS
61 | CoordinateDMS dms;
62 | if (CoordinateDMS.TryParse(input, out dms, true) == true)
63 | {
64 | dd = new CoordinateDD(dms);
65 | formattedString = dms.ToString("A0°B0'C0.0##\"N X0°Y0'Z0.0##\"E", new CoordinateDMSFormatter());
66 | return CoordinateType.DMS;
67 | }
68 |
69 | // restore the setting (not needed for others, only DD/DMS
70 | CoordinateConversionLibraryConfig.AddInConfig.DisplayAmbiguousCoordsDlg = savedAmbigCoordSetting;
71 |
72 | // GARS
73 | CoordinateGARS gars;
74 | if (CoordinateGARS.TryParse(input, out gars) == true)
75 | {
76 | formattedString = gars.ToString("", new CoordinateGARSFormatter());
77 | return CoordinateType.GARS;
78 | }
79 |
80 | // MGRS
81 | CoordinateMGRS mgrs;
82 | if (CoordinateMGRS.TryParse(input, out mgrs) == true)
83 | {
84 | formattedString = mgrs.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
85 | return CoordinateType.MGRS;
86 | }
87 |
88 | // USNG
89 | CoordinateUSNG usng;
90 | if (CoordinateUSNG.TryParse(input, out usng) == true)
91 | {
92 | formattedString = usng.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
93 | return CoordinateType.USNG;
94 | }
95 |
96 | // UTM
97 | CoordinateUTM utm;
98 | if (CoordinateUTM.TryParse(input, out utm) == true)
99 | {
100 | formattedString = utm.ToString("", new CoordinateUTMFormatter());
101 | return CoordinateType.UTM;
102 | }
103 |
104 | return CoordinateType.Unknown;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Helpers/CoordinateConversionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace CoordinateConversionLibrary.Helpers
4 | {
5 | public static class CoordinateConversionExtensions
6 | {
7 | public static bool ValidatePrefix(this Group group, bool showHyphen, bool showPlus)
8 | {
9 | if (group.ToString().Contains("+"))
10 | return !(showPlus && group.ToString().Contains("+"));
11 | else if (group.ToString().Contains("-"))
12 | return true;
13 | return group.Success;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/source/CoordinateConversion/CoordinateConversionLibrary/Helpers/Mediator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Esri
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 |
18 | namespace CoordinateConversionLibrary.Helpers
19 | {
20 | static public class Mediator
21 | {
22 | static readonly IDictionary>> pl_dict = new Dictionary>>();
23 |
24 | static public void Register(string token, Action