diff --git a/GRG/js/ColorPickerEditor.js b/GRG/js/ColorPickerEditor.js deleted file mode 100644 index ed8f21e..0000000 --- a/GRG/js/ColorPickerEditor.js +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright © 2014 - 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -define([ - 'dojo/_base/declare', - "dojo/_base/lang", - 'dojo/_base/Color', - 'dojo/on', - "dojo/query", - "dojo/_base/html", - 'dijit/_WidgetBase', - 'dijit/_TemplatedMixin', - 'dijit/_WidgetsInTemplateMixin', - 'dojo/text!../templates/ColorPickerEditor.html', - "dijit/form/HorizontalSlider", - 'jimu/dijit/ColorPickerPopup', - "dijit/form/NumberSpinner" - ], - function(declare, lang, Color, on, query, html, - _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, - HorizontalSlider, ColorPicker) { - return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { - _defaultColor: '#485566', - templateString: template, - nls: null, - - postCreate: function() { - this.colorPicker = new ColorPicker({ - color: this._defaultColor - }, this.colorPicker); - this.colorPicker.startup(); - - this.slider = new HorizontalSlider({ - name: "slider", - value: 100, - minimum: 0, - maximum: 100, - discreteValues: 101, - intermediateChanges: true, - showButtons: false, - style: "display: inline-block;" - }, this.sliderBar); - this.slider.startup(); - - this.inherited(arguments); - }, - startup: function() { - this.own(on(this.slider, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.spinner.setValue(val); - } - }))); - - this.own(on(this.spinner, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.slider.setValue(val); - } - }))); - - this._stylePolyfill(); - this.inherited(arguments); - }, - _isSameVal: function() { - return this.slider.getValue() === this.spinner.getValue(); - }, - getValues: function() { - var rgb = null, - a = null; - var bgColor = this.colorPicker.getColor(); - if (bgColor && bgColor.toHex) { - rgb = bgColor.toHex(); - } - a = this.spinner.getValue() / 100; - - return { - color: rgb, - transparency: a - }; - }, - setValues: function(obj) { - if (typeof obj === "object" || typeof obj === "string") { - this.colorPicker.setColor(new Color(obj.color)); - - if (typeof obj.transparency === "undefined") { - obj.transparency = 0; - } else { - obj.transparency = obj.transparency * 100; - } - this.slider.setValue(obj.transparency); - this.spinner.setValue(obj.transparency); - } - }, - _stylePolyfill: function() { - var leftBumper = query('.dijitSliderLeftBumper', this.domNode)[0]; - if (leftBumper && leftBumper.parentNode) { - html.setStyle(leftBumper.parentNode, 'background-color', "#24b5cc"); - } - } - }); - }); \ No newline at end of file diff --git a/GRG/js/TransparencyEditor.js b/GRG/js/TransparencyEditor.js deleted file mode 100644 index 88cc56e..0000000 --- a/GRG/js/TransparencyEditor.js +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright © 2014 - 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -define([ - 'dojo/_base/declare', - 'dojo/_base/lang', - 'dojo/_base/Color', - 'dojo/on', - 'dojo/query', - 'dojo/Stateful', - 'dojo/_base/html', - 'dijit/_WidgetBase', - 'dijit/_TemplatedMixin', - 'dijit/_WidgetsInTemplateMixin', - 'dojo/text!../templates/TransparencyEditor.html', - 'dijit/form/HorizontalSlider', - "dijit/form/NumberSpinner" - ], - function(declare, lang, Color, on, query, dojoStateful, html, - _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, - HorizontalSlider) { - return declare([dojoStateful, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { - templateString: template, - transparency: 1, - - postCreate: function() { - this.slider = new HorizontalSlider({ - name: "slider", - value: 0, - minimum: 0, - maximum: 100, - discreteValues: 101, - intermediateChanges: true, - showButtons: false, - style: "width:140px;display: inline-block;" - }, this.sliderBar); - this.slider.startup(); - this.inherited(arguments); - }, - startup: function() { - this.own(on(this.slider, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.spinner.setValue(val); - this._set("transparency", val/100); - } - }))); - - this.own(on(this.spinner, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.slider.setValue(val); - this._set("transparency", val/100); - } - }))); - - this._stylePolyfill(); - this.inherited(arguments); - }, - _isSameVal: function() { - return this.slider.getValue() === this.spinner.getValue(); - }, - getValues: function() { - var a = null; - a = this.spinner.getValue() / 100; - return { - transparency: a - }; - }, - setValues: function(obj) { - if (typeof obj === "object" || typeof obj === "string") { - if (typeof obj.transparency === "undefined") { - obj.transparency = 0; - } else { - obj.transparency = obj.transparency * 100; - } - this.slider.setValue(obj.transparency); - this.spinner.setValue(obj.transparency); - } - }, - _stylePolyfill: function() { - var leftBumper = query('.dijitSliderLeftBumper', this.domNode)[0]; - if (leftBumper && leftBumper.parentNode) { - html.setStyle(leftBumper.parentNode, 'background-color', "#24b5cc"); - } - } - }); - }); \ No newline at end of file diff --git a/GRG/js/VisibleGridZone.js b/GRG/js/VisibleGridZone.js deleted file mode 100644 index 1ad3353..0000000 --- a/GRG/js/VisibleGridZone.js +++ /dev/null @@ -1,128 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright © 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the 'License'); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an 'AS IS' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -/** - * @fileOverview Contains the VisibleGridZone class used by MGRS GRG widget. - * @author Esri - */ - -define([ - "dojo/_base/declare", - "./GridPolygon" -], function( - declare, - GridPolygon -) { - - /** - * @class module:mgrs-utils~VisibleGridZone - * @classdesc A VisibleGridZone object is derived by taking a NonPolarGridZone object - * and displaying it on screen. It holds all the parameters needed to draw and label - * the visible portion of the NonPolarGridZone. - * - * @constructor - * @param {Object} - * properties - * The VisibleGridZone constructor takes an object as described below - * @param {external:Polygon} - * properties.polygon - * The visible area of the grid zone - * @param {Number} - * [properties.offset=0] - * The non-normalized x-offset of the grid - * @param {module:mgrs-utils~NonPolarGridZone} - * properties.nonPolarGridZone - *The NonPolarGridZone object that is related to this VisibleGridZone object - * @param {external:Map} - * properties.map - * The Map object that the grid overlay is associated with - * - * @example - * var offset = -1; // in this case, the current longitude is in the range -540 => -180 - * var nonPolarGridZone = ZonesDictionary["42S"]; - * var zonePolygon = nonPolarGridZone.toPolygon(offset); - * - * convert zonePolygon to web mercator so it can be used with the - * geometryEngine.intersect method - * zonePolygon = webMercatorUtils.geographicToWebMercator(zonePolygon); - * var clippedPolygon = geometryEngine.intersect(zonePolygon, map.extent); - * - * visibleGridZone = new VisibleGridZone({ - * "map": map, - * "polygon": zonePolygon, - * "offset": 0, - * "nonPolarGridZone": nonPolarGridZone - * }); - */ - return declare(null, /** @lends module:mgrs-utils~VisibleGridZone# */ { - - /** The clipped portion of the grid zone polygon that represents the visible area - * @type {external:Polygon} - */ - "polygon": null, - - /** The non-normalized x-offset of the grid. This allows for grid overlays - * to be drawn in wraparound mound - * (i.e. spanning accross the Dateline). - * For Example: An offset of 0 means the x-coordinate is in the longitude range of -180 => 180, - * and an offset of -1 correlates to the range of -540 => -180. - * @type {Number} - */ - "offset": null, - - /** The original NonPolarGridZone object, before it was clipped for visible area - * @type {module:mgrs-utils~NonPolarGridZone} - */ - "nonPolarGridZone": null, - - /** A polygon of the full UTM Zone - * @type {external:Polyline} - */ - "fullZoneGeometry": null, - - /** The Map object that this grid overlay is associated with - * @type {external:Map} - */ - "map": null, - - constructor: function(args) { - // offset must be an integer - this.offset = Math.round(args.offset); - this.polygon = args.polygon; - this.nonPolarGridZone = args.nonPolarGridZone; - this.fullZoneGeometry = args.fullZoneGeometry; - this.map = args.map; - this.utmZone = args.utmZone; - this.latitudeBand = args.latitudeBand; - - // construct a GridPolygon, which is used as the label manager - var gridPolygonArgs = { - "clippedPolygon": this.polygon, - "unclippedPolygon": this.nonPolarGridZone.toPolygon(args.offset), - "map": this.map, - "xmin": this.nonPolarGridZone.extent.xmin, - "ymin": this.nonPolarGridZone.extent.ymin, - "xmax": this.nonPolarGridZone.extent.xmax, - "ymax": this.nonPolarGridZone.extent.ymax, - "minMaxType": "degrees", - "utmZone": this.utmZone, - "text": this.nonPolarGridZone.id, - "latitudeBand": this.latitudeBand - }; - this.gridPolygon = new GridPolygon(gridPolygonArgs); - } - }); -}); \ No newline at end of file diff --git a/GRG/js/dialogConfirm.js b/GRG/js/dialogConfirm.js deleted file mode 100644 index 4b550e9..0000000 --- a/GRG/js/dialogConfirm.js +++ /dev/null @@ -1,121 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Code sourced from https://github.com/speich/DialogConfirm -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -define([ - 'dojo/_base/lang', - 'dojo/_base/declare', - 'dojo/_base/Deferred', - 'dojo/dom-construct', - 'dijit/Dialog', - 'dijit/form/Button', - 'dijit/form/CheckBox' -], function(lang, declare, Deferred, domConstruct, Dialog, Button, Checkbox) { - - /** - * @class - * @name rfe.DialogConfirm - * @extends {dijit.Dialog} - * @property {dijit.form.Button} okButton reference to OK button - * @property {dijit.form.Button} cancelButton reference to Cancel button - * @property {dijit.form.CheckBox} skipCheckBox reference to skipping check box - * @property {boolean} hasOkButton create an OK button? - * @property {boolean} hasCancelButton create a cancel button - * @property {boolean} hasSkipCheckBox create the skipping check box - * @property {boolean} hasUnderlay create the dialog underlay? - * @property {dojo.Deferred} dfd Deferred - * @property {HTMLDivElement} buttonNode reference to div containing buttons - */ - return declare(Dialog, /* @lends rfe.DialogConfirm.prototype */ { - okButton: null, - cancelButton: null, - skipCheckBox: null, - hasOkButton: true, - hasCancelButton: true, - hasSkipCheckBox: true, - hasUnderlay: true, - dfd: null, - buttonNode: null, - - /** - * Instantiates the confirm dialog. - * @constructor - * @param {object} props - */ - constructor: function(props) { - lang.mixin(this, props); - }, - - /** - * Creates the OK/Cancel buttons. - */ - postCreate: function() { - this.inherited('postCreate', arguments); - - var label, div, remember = false; - - div = domConstruct.create('div', { - className: 'dijitDialogPaneContent dialogConfirm' - }, this.domNode, 'last'); - - if (this.hasSkipCheckBox) { - this.skipCheckBox = new Checkbox({ - checked: false - }, domConstruct.create('div')); - div.appendChild(this.skipCheckBox.domNode); - label = domConstruct.create('label', { - 'for': this.skipCheckBox.id, - innerHTML: 'Remember my decision and do not ask again.
' - }, div); - } - if (this.hasOkButton) { - this.okButton = new Button({ - label: 'OK', - onClick: lang.hitch(this, function() { - remember = this.hasSkipCheckBox ? this.skipCheckBox.get('checked') : false; - this.hide(); - this.dfd.resolve(remember); - }) - }, domConstruct.create('div')); - div.appendChild(this.okButton.domNode); - } - if (this.hasCancelButton) { - this.cancelButton = new Button({ - label: 'Cancel', - onClick: lang.hitch(this, function() { - remember = this.hasSkipCheckBox ? this.skipCheckBox.get('checked') : false; - this.hide(); - this.dfd.cancel(remember); - }) - }, domConstruct.create('div')); - div.appendChild(this.cancelButton.domNode); - } - this.buttonNode = div; - }, - - /** - * Shows the dialog. - * @return {Deferred} - */ - show: function() { - this.inherited('show', arguments); - if (!this.hasUnderlay) { - domConstruct.destroy(this.id + '_underlay'); // remove underlay - } - this.dfd = new Deferred(); - return this.dfd; - } - }); -}); diff --git a/GRG/js/util.js b/GRG/js/util.js deleted file mode 100644 index a6c3b04..0000000 --- a/GRG/js/util.js +++ /dev/null @@ -1,579 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -/*global define*/ -define([ - 'dojo/_base/declare', - 'dojo/_base/array', - 'dojo/_base/Deferred', - 'esri/tasks/GeometryService' -], function ( - dojoDeclare, - dojoArray, - Deferred, - EsriGeometryService -) { - 'use strict'; - return dojoDeclare(null, { - - /** - * - **/ - constructor: function (geoServiceURL) { - if (!geoServiceURL) { - geoServiceURL = '//utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer'; - } - this.geomService = new EsriGeometryService(geoServiceURL); - }, - - /** - * - **/ - getCleanInput: function (fromstr) { - fromstr = fromstr.replace(/\n/g,''); - fromstr = fromstr.replace(/\s+/g, ' ').trim(); - return fromstr.toUpperCase(); - }, - - /** - * Send request to get dd coordinates in format string - **/ - getCoordValues: function (fromInput, toType, numDigits) { - var deferred = new Deferred(); - var nd = numDigits || 6; - var tt; - if (toType.name) { - tt = toType.name; - } else { - tt = toType; - } - /** - * for parameter info - * http://resources.arcgis.com/en/help/arcgis-rest-api/#/To_GeoCoordinateString/02r30000026w000000/ - **/ - var params = { - sr: 4326, - coordinates: [[fromInput.x, fromInput.y]], - conversionType: tt, - numOfDigits: nd, - rounding: true, - addSpaces: false - }; - - switch (toType) { - case 'DD': - params.numOfDigits = 6; - break; - case 'USNG': - params.numOfDigits = 5; - break; - case 'MGRS': - params.conversionMode = 'mgrsDefault'; - params.numOfDigits = 5; - break; - case 'UTM (H)': - params.conversionType = 'utm'; - params.conversionMode = 'utmNorthSouth'; - params.addSpaces = true; - break; - case 'UTM': - params.conversionType = 'utm'; - params.conversionMode = 'utmDefault'; - params.addSpaces = true; - break; - case 'GARS': - params.conversionMode = 'garsDefault'; - break; - } - - this.geomService.toGeoCoordinateString(params).then(function(itm) { - deferred.resolve(itm); - },function() { - deferred.resolve(null); - }); - - return deferred.promise; - }, - - /** - * - **/ - getXYNotation: function (fromStr, toType) { - var deferred = new Deferred(); - var a; - var tt; - if (toType.name) { - tt = toType.name; - } else { - tt = toType; - } - - var params = { - sr: 4326, - conversionType: tt, - strings: [] - }; - - switch (tt) { - case 'DD': - case 'DDM': - case 'DMS': - params.numOfDigits = 2; - a = fromStr.replace(/[°˚º^~*"'′¨˝]/g, ''); - params.strings.push(a); - break; - case 'USNG': - params.strings.push(fromStr); - params.addSpaces = 'false'; - break; - case 'MGRS': - params.conversionMode = 'mgrsNewStyle'; - params.strings.push(fromStr); - params.addSpaces = 'false'; - break; - case 'UTM (H)': - params.conversionType = 'utm'; - params.conversionMode = 'utmNorthSouth'; - params.strings.push(fromStr); - break; - case 'UTM': - params.conversionType = 'utm'; - params.conversionMode = 'utmDefault'; - params.strings.push(fromStr); - break; - case 'GARS': - params.conversionMode = 'garsCenter'; - params.strings.push(fromStr); - break; - case 'GEOREF': - params.strings.push(fromStr); - break; - } - - this.geomService.fromGeoCoordinateString(params).then(function(itm) { - deferred.resolve(itm); - },function() { - deferred.resolve(null); - }); - - return deferred.promise; - }, - - getNotations: function () { - var strs = [ - { - name: 'DD', - pattern: /^(([NS\+\-\s])*([0-8]?\d([,.]\d*)?|90([,.]0*)?)([°˚º^~*]*)([NS\+\-\s])*)([,:;\s|\/\\]+)(([EW\+\-\s])*([0]?\d?\d([,.]\d*)?|1[0-7]\d([,.]\d*)?|180([,.]0*)?)([°˚º^~*]*)([EW\+\-\s])*)$/, - notationType: "DD - Latitude/Longitude", - conversionType: "DD" - }, { - name: 'DDrev', - pattern: /^(([EW\+\-\s])*([0]?\d?\d([,.]\d*)?|1[0-7]\d([,.]\d*)?|180([,.]0*)?)([°˚º^~*]*)([EW\+\-\s])*)([,:;\s|\/\\]+)(([NS\+\-\s])*([0-8]?\d([,.]\d*)?|90([,.]0*)?)([°˚º^~*]*)([NS\+\-\s])*)$/, - notationType: "DD - Longitude/Latitude", - conversionType: "DD" - }, { - name: 'DDM', - pattern: /^(([NS\+\-\s])*([0-8]?\d|90)[°˚º^~*\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)['′\s_]*([NS\+\-\s])*)([,:;\s|\/\\]+)(([EW\+\-\s])*([0]?\d?\d|1[0-7]\d|180)[°˚º^~*\s\-_]+(([0-5]\d|\d)([,.]\d*)?)['′\s_]*([EW\+\-\s])*)[\s]*$/, - notationType: "DDM - Latitude/Longitude", - conversionType: "DDM" - }, { - name: 'DDMrev', - pattern: /^(([EW\+\-\s])*([0]?\d?\d|1[0-7]\d|180)[°˚º^~*\s\-_]+(([0-5]\d|\d)([,.]\d*)?)['′\s_]*([EW\+\-\s])*)([,:;\s|\/\\]+)(([NS\+\-\s])*([0-8]?\d|90)[°˚º^~*\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)['′\s_]*([NS\+\-\s])*)[\s]*$/, - notationType: "DDM - Longitude/Latitude", - conversionType: "DDM" - }, { - name: 'DMS', - pattern: /^(([NS\+\-\s])*([0-8]?\d|90)[°˚º^~*\s\-_]+([0-5]?\d|\d)['′\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)["¨˝\s_]*([NS\+\-\s])*)([,:;\s|\/\\]+)(([EW\+\-\s])*([0]?\d?\d|1[0-7]\d|180)[°˚º^~*\s\-_]+([0-5]\d|\d)['′\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)["¨˝\s_]*([EW\+\-\s])*)[\s]*$/, - notationType: "DMS - Latitude/Longitude", - conversionType: "DMS" - }, { - name: 'DMSrev', - pattern: /^(([EW\+\-\s])*([0]?\d?\d|1[0-7]\d|180)[°˚º^~*\s\-_]+([0-5]\d|\d)['′\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)["¨˝\s_]*([EW\+\-\s])*)([,:;\s|\/\\]+)(([NS\+\-\s])*([0-8]?\d|90)[°˚º^~*\s\-_]+([0-5]?\d|\d)['′\s\-_]+(([0-5]?\d|\d)([,.]\d*)?)["¨˝\s_]*([NS\+\-\s])*)[\s]*$/, - notationType: "DMS - Longitude/Latitude", - conversionType: "DMS" - }, { - name: 'GARS', - pattern: /^\d{3}[a-zA-Z]{2}[1-4]?[1-9]?$/, - notationType: "GARS", - conversionType: "GARS" - }, { - name: 'GEOREF', - pattern: /^[a-zA-Z]{4}\d{1,8}$/, - notationType: "GEOREF", - conversionType: "GEOREF" - }, { - name: 'MGRS', - pattern: /^\d{1,2}[-,;:\s]*[C-HJ-NP-X][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d[-,;:\s]+\d|\d{2}[-,;:\s]+\d{2}|\d{3}[-,;:\s]+\d{3}|\d{4}[-,;:\s]+\d{4}|\d{5}[-,;:\s]+\d{5})$|^(\d{1,2}[-,;:\s]*[C-HJ-NP-X][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*)(\d{2}|\d{4}|\d{6}|\d{8}|\d{10})?$|^[ABYZ][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d[-,;:\s]+\d|\d{2}[-,;:\s]+\d{2}|\d{3}[-,;:\s]+\d{3}|\d{4}[-,;:\s]+\d{4}|\d{5}[-,;:\s]+\d{5})$|^[ABYZ][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d{2}|\d{4}|\d{6}|\d{8}|\d{10})?$/, - notationType: "MGRS", - conversionType: "MGRS" - }, - //not sure if USNG is needed as its exactly the same as MGRS - /*{ - name: 'USNG', - pattern: /^\d{1,2}[-,;:\s]*[C-HJ-NP-X][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d[-,;:\s]+\d|\d{2}[-,;:\s]+\d{2}|\d{3}[-,;:\s]+\d{3}|\d{4}[-,;:\s]+\d{4}|\d{5}[-,;:\s]+\d{5})$|^(\d{1,2}[-,;:\s]*[C-HJ-NP-X][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*)(\d{2}|\d{4}|\d{6}|\d{8}|\d{10})?$|^[ABYZ][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d[-,;:\s]+\d|\d{2}[-,;:\s]+\d{2}|\d{3}[-,;:\s]+\d{3}|\d{4}[-,;:\s]+\d{4}|\d{5}[-,;:\s]+\d{5})$|^[ABYZ][-,;:\s]*[A-HJ-NP-Z]{2}[-,;:\s]*(\d{2}|\d{4}|\d{6}|\d{8}|\d{10})?$/, - notationType: "USNG", - conversionType: "USNG" - },*/ - { - name: 'UTM', - pattern: /^\d{1,2}[-,;:\s]*[c-hj-np-xC-HJ-NP-X][-,;:\s]*\d{1,6}\.?\d*[mM]?[-,;:\s]?\d{1,7}\.?\d*[mM]?$/, - notationType: "UTM - Band Letter", - conversionType: "UTM" - }, { - name: 'UTM (H)', - pattern: /^\d{1,2}[-,;:\s]*[NnSs][-,;:\s]*\d{1,6}\.?\d*[mM]?[-,;:\s]+\d{1,7}\.?\d*[mM]?$/, - notationType: "UTM - Hemisphere (N/S)", - conversionType: "UTM (H)" - } - ]; - - return strs; - }, - - getCoordinateType: function (fromInput) { - var clnInput = this.getCleanInput(fromInput); - var deferred = new Deferred(); - //regexr.com - - var strs = this.getNotations(); - - var matchedtype = dojoArray.filter(strs, function (itm) { - return itm.pattern.test(this.v) - }, { - v:clnInput - }); - - if (matchedtype.length > 0) { - deferred.resolve(matchedtype); - } else { - deferred.resolve(null); - } - return deferred.promise; - }, - - /** - * - **/ - getFormattedDDStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - var parts = fromValue[0].split(/[ ,]+/); - - r.latdeg = parts[0].replace(/[nNsS]/, ''); - r.londeg = parts[1].replace(/[eEwW]/, ''); - - if (addSignPrefix) { - parts[0].slice(-1) === 'N'?r.latdeg = '+' + r.latdeg:r.latdeg = '-' + r.latdeg; - parts[1].slice(-1) === "W"?r.londeg = '-' + r.londeg:r.londeg = '+' + r.londeg; - } - - var s = withFormatStr.replace(/X/, r.londeg); - s = s.replace(/[eEwW]/, parts[1].slice(-1)); - s = s.replace(/[nNsS]/, parts[0].slice(-1)); - s = s.replace(/Y/, r.latdeg); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedDDMStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.parts = fromValue[0].split(/[ ,]+/); - - r.latdeg = r.parts[0]; - r.latmin = r.parts[1].replace(/[nNsS]/, ''); - r.londeg = r.parts[2]; - r.lonmin = r.parts[3].replace(/[eEwW]/, ''); - - if (addSignPrefix) { - r.parts[1].slice(-1) === 'N'?r.latdeg = '+' + r.latdeg:r.latdeg = '-' + r.latdeg; - r.parts[3].slice(-1) === 'W'?r.londeg = '-' + r.londeg:r.londeg = '+' + r.londeg; - } - - //A° B'N X° Y'E - var s = withFormatStr.replace(/[EeWw]/, r.parts[3].slice(-1)); - s = s.replace(/Y/, r.lonmin); - s = s.replace(/X/, r.londeg); - s = s.replace(/[NnSs]/, r.parts[1].slice(-1)); - s = s.replace(/B/, r.latmin); - s = s.replace(/A/, r.latdeg); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedDMSStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.parts = fromValue[0].split(/[ ,]+/); - - r.latdeg = r.parts[0]; - r.latmin = r.parts[1]; - r.latsec = r.parts[2].replace(/[NnSs]/, ''); - - - r.londeg = r.parts[3]; - r.lonmin = r.parts[4]; - r.lonsec = r.parts[5].replace(/[EWew]/, ''); - - if (addSignPrefix) { - r.parts[2].slice(-1) === 'N'?r.latdeg = '+' + r.latdeg:r.latdeg = '-' + r.latdeg; - r.parts[5].slice(-1) ==='W'?r.londeg = '-' + r.londeg:r.londeg = '+' + r.londeg; - } - - //A° B' C''N X° Y' Z''E - var s = withFormatStr.replace(/A/, r.latdeg); - s = s.replace(/B/, r.latmin); - s = s.replace(/C/, r.latsec); - s = s.replace(/X/, r.londeg); - s = s.replace(/Y/, r.lonmin); - s = s.replace(/Z/, r.lonsec); - s = s.replace(/[NnSs]/, r.parts[2].slice(-1)); - s = s.replace(/[EeWw]/, r.parts[5].slice(-1)); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedUSNGStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - if(fromValue[0].match(/^[ABYZ]/)) { - r.gzd = fromValue[0].match(/[ABYZ]/)[0].trim(); - } else { - r.gzd = fromValue[0].match(/\d{1,2}[C-HJ-NP-X]/)[0].trim(); - } - r.grdsq = fromValue[0].replace(r.gzd, '').match(/[a-hJ-zA-HJ-Z]{2}/)[0].trim(); - r.easting = fromValue[0].replace(r.gzd + r.grdsq, '').match(/^\d{1,5}/)[0].trim(); - r.northing = fromValue[0].replace(r.gzd + r.grdsq, '').match(/\d{1,5}$/)[0].trim(); - - //Z S X# Y# - var s = withFormatStr.replace(/Y/, r.northing); - s = s.replace(/X/, r.easting); - s = s.replace(/S/, r.grdsq); - s = s.replace(/Z/, r.gzd); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedMGRSStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - if(fromValue[0].match(/^[ABYZ]/)) { - r.gzd = fromValue[0].match(/[ABYZ]/)[0].trim(); - } else { - r.gzd = fromValue[0].match(/\d{1,2}[C-HJ-NP-X]/)[0].trim(); - } - r.grdsq = fromValue[0].replace(r.gzd, '').match(/[a-hJ-zA-HJ-Z]{2}/)[0].trim(); - r.easting = fromValue[0].replace(r.gzd + r.grdsq, '').match(/^\d{1,5}/)[0].trim(); - r.northing = fromValue[0].replace(r.gzd + r.grdsq, '').match(/\d{1,5}$/)[0].trim(); - - //Z S X# Y# - var s = withFormatStr.replace(/Y/, r.northing); - s = s.replace(/X/, r.easting); - s = s.replace(/S/, r.grdsq); - s = s.replace(/Z/, r.gzd); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedGARSStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.lon = fromValue[0].match(/\d{3}/); - r.lat = fromValue[0].match(/[a-zA-Z]{2}/); - - var q = fromValue[0].match(/\d*$/); - r.quadrant = q[0][0]; - r.key = q[0][1]; - - //XYQK - var s = withFormatStr.replace(/K/, r.key); - s = s.replace(/Q/, r.quadrant); - s = s.replace(/Y/, r.lat); - s = s.replace(/X/, r.lon); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedGEOREFStr: function (fromValue, withFormatStr, addSignPrefix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.lon = fromValue[0].match(/[a-zA-Z]{1}/)[0].trim(); - r.lat = fromValue[0].replace(r.lon, '').match(/[a-zA-Z]{1}/)[0].trim(); - r.quadrant15lon = fromValue[0].replace(r.lon + r.lat, '').match(/[a-zA-Z]{1}/)[0].trim(); - r.quadrant15lat = fromValue[0].replace(r.lon + r.lat + r.quadrant15lon, '').match(/[a-zA-Z]{1}/)[0].trim(); - - var q = fromValue[0].replace(r.lon + r.lat + r.quadrant15lon + r.quadrant15lat, ''); - - r.quadrant1lon = q.substr(0,q.length/2); - r.quadrant1lat = q.substr(q.length/2, q.length); - - //ABCDXY - var s = withFormatStr.replace(/Y/, r.quadrant1lat); - s = s.replace(/X/, r.quadrant1lon); - s = s.replace(/D/, r.quadrant15lat); - s = s.replace(/C/, r.quadrant15lon); - s = s.replace(/B/, r.lat); - s = s.replace(/A/, r.lon); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedUTMStr: function (fromValue, withFormatStr, addSignPrefix, addDirSuffix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.parts = fromValue[0].split(/[ ,]+/); - r.zone = r.parts[0].replace(/[A-Z]/,''); - r.bandLetter = r.parts[0].slice(-1); - r.easting = r.parts[1]; - r.westing = r.parts[2]; - - //ZB Xm Ym' - var s = withFormatStr.replace(/Y/, r.westing); - s = s.replace(/X/, r.easting); - s = s.replace (/B/, r.bandLetter); - s = s.replace(/Z/, r.zone); - - r.formatResult = s; - return r; - }, - - /** - * - **/ - getFormattedUTMHStr: function (fromValue, withFormatStr, addSignPrefix, addDirSuffix) { - var r = {}; - r.sourceValue = fromValue; - r.sourceFormatString = withFormatStr; - - r.parts = fromValue[0].split(/[ ,]+/); - r.zone = r.parts[0].replace(/[A-Z]/,''); - r.hemisphere = r.parts[0].slice(-1); - - r.easting = r.parts[1]; - r.westing = r.parts[2]; - - //ZH Xm Ym' - var s = withFormatStr.replace(/Y/, r.westing); - s = s.replace(/X/, r.easting); - s = s.replace (/H/, r.hemisphere); - s = s.replace(/Z/, r.zone); - - r.formatResult = s; - return r; - }, - - - /** - * - **/ - convertMetersToUnits: function (inMeters, fromUnit) { - var convLength = 0; - switch (fromUnit.toLowerCase()) { - case 'meters': - convLength = inMeters; - break; - case 'feet': - convLength = inMeters * 3.28084; - break; - case 'kilometers': - convLength = inMeters * 0.001; - break; - case 'miles': - convLength = inMeters * 0.000621371; - break; - case 'nautical-miles': - convLength = inMeters * 0.000539957; - break; - case 'yards': - convLength = inMeters * 1.09361; - break; - } - return convLength; - }, - - /** - * - **/ - convertToMeters: function (length, inputUnit) { - var convertedLength = length; - switch (inputUnit) { - case 'meters': - convertedLength = length; - break; - case 'feet': - convertedLength = length * 0.3048; - break; - case 'kilometers': - convertedLength = length * 1000; - break; - case 'miles': - convertedLength = length * 1609.34; - break; - case 'nautical-miles': - convertedLength = length * 1852.001376036; - break; - case 'yards': - convertedLength = length * 0.9144; - break; - } - return convertedLength; - } - }); -}); diff --git a/GRG/nls/strings.js b/GRG/nls/strings.js deleted file mode 100644 index 70e1248..0000000 --- a/GRG/nls/strings.js +++ /dev/null @@ -1,143 +0,0 @@ -define({ - root: ({ - _widgetLabel: "Gridded Reference Graphic", // Label of widget - - //main page - "newGRGFromAreaButtonLabel": 'Define a Grid from an Area', // Shown as label to start new GRG from Area button on main page - "newGRGFromPointButtonLabel": 'Define a Grid from a Point', // Shown as label to new GRG from point button on main page - - //GRG from Area and Point Menus - "newGRGFromAreaTitle": 'Define a Grid from an Area', // Shown as Title on Area Menu - "newGRGFromPointTitle": 'Define a Grid from a Point', // Shown as Title on Area Menu - "newGRGBySizeButtonLabel": 'By Dimension', // Shown as label to start new GRG by size button on Area Menu or Point Menu - "newGRGFromRefSystemButtonLabel": 'By Reference System', // Shown as label to start new from reference system button on Area Menu or Point Menu - "newGRGFromNonStandardButtonLabel": 'Define Non-Standard Grid', // Shown as label to start new GRG from non standard button on Area Menu or Point Menu - - //Area GRG By Size Panel - "newGRGAreaBySizeTitle": "GRG from an Area by Dimension", // Shown as title for new GRG from area panel - "newGRGAreaBySizeDefineAreaLabel": 'GRG Area', // Shown as text for new GRG from area toolbar - "addGRGAreaPolygonToolTip": "Draw GRG Area using polygon", // Shown as tooltip on draw rectangle icon - "addGRGAreaExtentToolTip": "Draw GRG Area using extent", // Shown as tooltip on draw extent icon - "rotation": 'Grid Rotation', // Shown as label above rotation input box - "numberRowsColumnsLabel": 'Define number of rows and columns', // Shown as label next to the define rows and columns toggle - - //Area GRG By Reference System Panel - "newGRGAreaByRefSystemTitle": 'GRG from an Area by Reference System', // Shown as title for new GRG from reference system panel - "gridSize": 'Grid Size', // Shown as title for new GRG from reference system panel - "UTMZoneandBand": 'Grid Zone', // Shown as label for UTM Zone and Band in gridSize dropdown - "100000m": '100000 meter', // Shown as label for 100000 meter in gridSize dropdown - "10000m": '10000 meter', // Shown as label for 10000 meter in gridSize dropdown - "1000m": '1000 meter', // Shown as label for 10000 meter in gridSize dropdown - "100m": '100 meter', // Shown as label for 100 meter in gridSize dropdown - "10m": '10 meter', // Shown as label for 10 meter in gridSize dropdown - "clipGrid": 'Clip Grid to GRG Area', // Shown as label for clip grid toggle switch - - //Area GRG from non standard grid Panel - "newGRGAreaFromNonStandardTitle": "New NRG", // Shown as title for new GRG from non standard grid Panel - - //Point GRG By Size Panel - "newGRGPointBySizeTitle": "GRG from Point by Dimension", // Shown as title for new GRG from point panel - - //Point GRG By Reference System Panel - "newGRGPointByRefSystemTitle": "GRG from Point by Reference System", // Shown as title for new GRG from reference system panel - - //Settings Panel - "settingsTitle": "Settings", // Shown as Title for Grid Settings page and label on settings buttons - "labelSettingsLabel": 'Label Settings', // Shown as Title for Label Settings dropdown - "labelSettingsButtonLabel": 'Configure Label Settings', // Shown as tooltip for Label Settings dropdown - "gridSettingsLabel": 'Grid Settings', // Shown as Title for Label Settings dropdown - "gridSettingsButtonLabel": 'Configure Grid Settings', // Shown as tooltip for Label Settings dropdown - "transparency": 'Transparency', // Shown as label on transparency sliders - "labelStyle": 'Label Style', // Shown as label on label settings - "font": 'Font', // Shown as label for font type - "textSize": 'Text Size', // Shown as label for font size - "textColor": 'Text Color', // Shown as label for font colour - "halo": 'Halo', // Shown as label for halo settings - "show": 'Show', // Shown as label for halo settings - "lockSettings": 'Settings have been locked by the application owner', // Shown as tooltip on settings button if locked - - "gridSettings": { - "cellShape": "Cell Shape", // Shown as label to set Cell Shape Type - "cellUnits": "Cell Units", // Shown as label to set Cell Units - "cellOutline": 'Cell Outline Settings', // Shown as label to set cell Outline Settings - "cellFill": 'Cell Fill Settings', // Shown as label to set cell fill Settings - "gridReferenceSystem": 'Reference System', // Shown as label to set Reference System - "gridDatum": 'Datum: WGS84', // Shown as label for datum - "labelStartPosition": "Label Origin", // Shown as label to set label start position - "labelType": "Label Type", // Shown as label to set label type - "labelDirection": "Label Direction", // Shown as label to set label direction - "gridOrigin": "Grid Origin", // Shown as label to set grid origin - - "default": "Rectangle", // Shown as label for default in cell shape dropdown - "hexagon": "Hexagon", // Shown as label for hexagon in cell shape dropdown - - "miles": 'Miles', // Shown as label for miles in cell units dropdown - "kilometers": 'Kilometers', // Shown as label for kilometers in cell units dropdown - "feet": 'Feet', // Shown as label for feet in cell units dropdown - "meters": 'Meters', // Shown as label for meters in cell units dropdown - "yards": 'Yards', // Shown as label for yards in cell units dropdown - "nautical-miles": 'Nautical Miles', // Shown as label for nauticalMiles in cell units dropdown - - "lowerLeft": 'Lower-Left', // Shown as label for lower left in label start position and grid origin dropdowns - "lowerRight": 'Lower-Right', // Shown as label for lower right in label start position and grid origin dropdowns - "upperLeft": 'Upper-Left', // Shown as label for upper left in label start position and grid origin dropdowns - "upperRight": 'Upper-Right', // Shown as label for upper right in label start position and grid origin dropdowns - "center": 'Center', // Shown as label for center in grid origin dropdown - - "alphaNumeric": 'Alpha-Numeric', // Shown as label for Alpha-Numeric in label type dropdown - "alphaAlpha": 'Alpha-Alpha', // Shown as label for Alpha-Alpha in label type dropdown - "numeric": 'Numeric', // Shown as label for Numeric in label type dropdown - - "horizontal": 'Horizontal', // Shown as label for Horizontal in label direction dropdown - "vertical": 'Vertical', // Shown as label for Vertical in label direction dropdown - - "MGRS": 'MGRS', // Shown as label for MGRS in reference system dropdown - "USNG": 'USNG', // Shown as label for USNG in reference system dropdown - - "showLabels": 'Show Labels', // Shown as label for show labels toggle switch - }, - - //Publish Panel - "publishTitle": "Publish GRG to Portal", // Shown as Title for Grid Settings page and label on settings buttons - "publishGRGBtn": 'Publish', // Shown as label on publish GRG button - "GRGLayerName": 'Published GRG Layer Name', // Shown as label for layer name box - "invalidGRGLayerName": 'Layer name must only contain alpha-numeric characters and underscores', //Shown as validation error on published layer name - "missingGRGLayerName": 'You must enter a name for the GRG', //Shown as validation error on empty published layer name - - //publishing error messages - "publishingFailedLayerExists": 'Publishing Failed: You already have a feature service named {0}. Please choose another name.', //Shown as error for layer name already used when publishing {0} will be replaced with the layer name in the code so do not remove - "checkService": 'Check Service: {0}', //{0} will be replaced in the code so do not remove - "createService": 'Create Service: {0}', //{0} will be replaced in the code so do not remove - "unableToCreate": 'Unable to create: {0}', //{0} will be replaced in the code so do not remove - "addToDefinition": 'Add to definition: {0}', //{0} will be replaced in the code so do not remove - "successfullyPublished": 'Successfully published web layer{0}Manage the web layer', //{0} will be replaced in the code so do not remove - - //common - "createGRGBtn": 'Create GRG', // Shown as label on create button - "clearGRGBtn": 'Clear', // Shown as label on clear button - "labelFormat": 'Label Format', // Shown as label above label format input box - "helpIconTooltip": 'Z: Grid Zone Designator (GZD)\nS: 100,000-meter Grid Square Identification (GSID)\nX: Easting (X Coordinate)\nY: Northing (Y Coordinate)\n\nExamples:\nZSXY is 15SWC8081751205\nZS X,Y is 15SWC 80817,51205', // Shown as label above label format input box - "addPointToolTip": 'Add GRG Origin', // Show as tooltip help on the draw point icon - "cellWidth": 'Cell Width (x)', // Shown as label above cell width input - "cellHeight": 'Cell Height (y)', // Shown as label above cell height input - "invalidNumberMessage": 'The value entered is not valid', //Shown as validation error on invalid entries - "invalidRangeMessage": 'Value must be greater than 0', //Shown as validation error on invalid entries - "gridAngleInvalidRangeMessage": 'Value must be between -89.9 and 89.9', //Shown as validation error for the angle input - "formatIconTooltip": 'Format Input', // Shown as tooltip on the format input coordinate button - "coordInputLabel": 'GRG Origin (DD)', // Shown as label for coordinate input box (DD) denotes that decimal degrees is set as the default - "setCoordFormat": 'Set Coordinate Format String', // Shown as label for set format string - "prefixNumbers": 'Add "+/-" prefix to positive and negative numbers', // Shown as text next to the add prefix check box - "cancelBtn": 'Cancel', // Shown as label on cancel button - "applyBtn": 'Apply', // Shown as label on apply button - "comfirmInputNotation": 'Confirm Input Notation', //Shown as panel title when more than one notation match - "notationsMatch": 'notations match your input please confirm which you would like to use:', // Shown as message when more than one notation match - "numberOfCellsHorizontal": '# Horizontal Cells', // Shown as label for number of Horizontal cells - "numberOfCellsVertical": '# Vertical Cells', // Shown as label for number of Vertical cells - "gridAngle": 'Grid Rotation', // Shown as label for grid angle - "missingParametersMessage": '

The GRG creation form has missing or invalid parameters, Please ensure:

', - "drawPointToolTip": 'Click to add GRG origin point', // Shown as tooltip help on the cursor when using the draw point tool - "missingLayerNameMessage": 'You must enter a valid layer name before you can publish', //shown as error message for invalid layer name - "parseCoordinatesError": 'Unable to parse coordinates. Please check your input.' //Shown as error message for unknown coordinates - - }) -}); diff --git a/GRG/setting/ColorPickerEditor.js b/GRG/setting/ColorPickerEditor.js deleted file mode 100644 index 2cf575d..0000000 --- a/GRG/setting/ColorPickerEditor.js +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright © 2014 - 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -define([ - 'dojo/_base/declare', - "dojo/_base/lang", - 'dojo/_base/Color', - 'dojo/on', - "dojo/query", - "dojo/_base/html", - 'dijit/_WidgetBase', - 'dijit/_TemplatedMixin', - 'dijit/_WidgetsInTemplateMixin', - 'dojo/text!./ColorPickerEditor.html', - "dijit/form/HorizontalSlider", - 'jimu/dijit/ColorPickerPopup', - "dijit/form/NumberSpinner" - ], - function(declare, lang, Color, on, query, html, - _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, - HorizontalSlider, ColorPicker) { - return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { - _defaultColor: '#485566', - templateString: template, - nls: null, - - postCreate: function() { - this.colorPicker = new ColorPicker({ - color: this._defaultColor - }, this.colorPicker); - this.colorPicker.startup(); - - this.slider = new HorizontalSlider({ - name: "slider", - value: 0, - minimum: 0, - maximum: 100, - discreteValues: 101, - intermediateChanges: true, - showButtons: false, - style: "width:140px;display: inline-block;" - }, this.sliderBar); - this.slider.startup(); - - this.inherited(arguments); - }, - startup: function() { - this.own(on(this.slider, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.spinner.setValue(val); - } - }))); - - this.own(on(this.spinner, 'change', lang.hitch(this, function(val) { - if (false === this._isSameVal()) { - this.slider.setValue(val); - } - }))); - - this._stylePolyfill(); - this.inherited(arguments); - }, - _isSameVal: function() { - return this.slider.getValue() === this.spinner.getValue(); - }, - getValues: function() { - var rgb = null, - a = null; - var bgColor = this.colorPicker.getColor(); - if (bgColor && bgColor.toHex) { - rgb = bgColor.toHex(); - } - a = this.spinner.getValue() / 100; - - return { - color: rgb, - transparency: a - }; - }, - setValues: function(obj) { - if (typeof obj === "object" || typeof obj === "string") { - this.colorPicker.setColor(new Color(obj.color)); - - if (typeof obj.transparency === "undefined") { - obj.transparency = 0; - } else { - obj.transparency = obj.transparency * 100; - } - this.slider.setValue(obj.transparency); - this.spinner.setValue(obj.transparency); - } - }, - _stylePolyfill: function() { - var leftBumper = query('.dijitSliderLeftBumper', this.domNode)[0]; - if (leftBumper && leftBumper.parentNode) { - html.setStyle(leftBumper.parentNode, 'background-color', "#24b5cc"); - } - } - }); - }); \ No newline at end of file diff --git a/GRG/setting/FontSetting.js b/GRG/setting/FontSetting.js deleted file mode 100644 index 6fc6226..0000000 --- a/GRG/setting/FontSetting.js +++ /dev/null @@ -1,386 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// Copyright © 2014 - 2017 Esri. All Rights Reserved. -// -// Licensed under the Apache License Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////// - -define([ - 'dojo/_base/declare', - "dojo/_base/lang", - 'dojo/on', - 'dojo/_base/html', - 'dojo/_base/array', - 'dojo/Evented', - 'dijit/_WidgetBase', - 'dijit/_TemplatedMixin', - 'dijit/_WidgetsInTemplateMixin', - 'dojo/text!./FontSetting.html', - 'jimu/dijit/ColorPickerPopup', - "dijit/form/HorizontalSlider", - './TransparencyEditor', - "dojo/store/Memory", - "dijit/form/ComboBox", - 'jimu/dijit/CheckBox', - 'jimu/dijit/ImageChooser' -], - function (declare, lang, on, html, array, - Evented, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, - ColorPickerPopup, HorizontalSlider, TransparencyEditor, Memory) { - return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Evented], { - templateString: template, - nls: null, - _FONTS: null, - _MIN_TEXT_SIZE: 12, - _MAX_TEXT_SIZE: 48, - _INTERVAL_TEXT_SIZE: 2, - - _DEFAULT_CONFIG: null, - - postCreate: function () { - this.inherited(arguments); - this._FONTS = "Arial;Comic Sans MS;Courier New;Garamond;Tahoma;Times New Roman;Verdana".split(";"); - this._DEFAULT_CONFIG = { - font: { - fontFamily: this._FONTS[0],//first one - bold: false, - italic: false, - underline: false - }, - fontSize: "24", - textColor: "#282828", - haloSize: 1, - haloColor: "#FFFFFF", - haloOn: true, - labelTransparency: 1, - }; - this.config = lang.mixin(lang.clone(this._DEFAULT_CONFIG), this.config); - - //font - array.forEach(this._FONTS, lang.hitch(this, function (font) { - this.fontSelect.addOption({ value: font, label: font }); - })); - //text size - var textSizeStore = new Memory({}); - for (var i = this._MIN_TEXT_SIZE, max = this._MAX_TEXT_SIZE; i < max; i += this._INTERVAL_TEXT_SIZE) { - textSizeStore.put({ id: i, name: i }); - } - this.textSizeSelect.store = textSizeStore; - this.textSizeSelect.validator = lang.hitch(this, function () { - var s = this.textSizeSelect.getValue(); - if (s !== null && s !== "") { - return !isNaN(s); - } - return false; - }); - this.textSizeSlider = new HorizontalSlider({ - name: "slider", - value: 0, - minimum: this._MIN_TEXT_SIZE, - maximum: this._MAX_TEXT_SIZE, - discreteValues: this.textSizeSelect.store.data.length + 1, - intermediateChanges: true, - showButtons: false, - style: "display: inline-block;" - }, this.sliderBar); - this.textSizeSlider.startup(); - //.textColor - this.textColorPicker = new ColorPickerPopup({ - appearance: { - showTransparent: false, - showColorPalette: true, - showCoustom: true, - showCoustomRecord: true - }, - recordUID: this.recordUID - }); - this.textColorPicker.placeAt(this.textColorBtn); - this.textColorPicker.startup(); - - //transparency - this.labelTransparency = new TransparencyEditor({}, this.transparencySlider); - this.labelTransparency.startup(); - - - - //halo - //halo size - var haloSizeStore = new Memory({}); - for (var i = 1, max = 10; i <= max; i += 1) { - haloSizeStore.put({ id: i, name: i }); - } - this.haloSizeSelect.store = haloSizeStore; - this.haloSizeSelect.validator = lang.hitch(this, function () { - var s = this.haloSizeSelect.getValue(); - if (s !== null && s !== "") { - return !isNaN(s); - } - return false; - }); - - - //halo color picker - this.haloColorPicker = new ColorPickerPopup({ - appearance: { - showTransparent: false, - showColorPalette: true, - showCoustom: true, - showCoustomRecord: true - }, - }); - this.haloColorPicker.placeAt(this.haloColorBtn); - this.haloColorPicker.startup(); - - //font - this.own(on(this.fontSelect, 'change', lang.hitch(this, function (value) { - if(this.config.font.fontFamily === value){ - return; - } - this.onSettingChange({ - font: { - fontFamily: value, - bold: this.config.font.bold, - italic: this.config.font.italic, - underline: this.config.font.underline - } - }); - }))); - this._initAppearance(); - this.own(on(this.bold, 'click', lang.hitch(this, function (/*value*/) { - var isClick = !html.hasClass(this.bold, "selected"); - this.fontBtnClickd({ bold: isClick }); - this.onSettingChange({ - font: { - fontFamily: this.config.font.fontFamily, - bold: isClick, - italic: this.config.font.italic, - underline: this.config.font.underline - } - }); - }))); - this.own(on(this.italic, 'click', lang.hitch(this, function (/*value*/) { - var isClick = !html.hasClass(this.italic, "selected"); - this.fontBtnClickd({ italic: isClick }); - this.onSettingChange({ - font: { - fontFamily: this.config.font.fontFamily, - bold: this.config.font.bold, - italic: isClick, - underline: this.config.font.underline - } - }); - }))); - this.own(on(this.underline, 'click', lang.hitch(this, function (/*value*/) { - var isClick = !html.hasClass(this.underline, "selected"); - this.fontBtnClickd({ underline: isClick }); - this.onSettingChange({ - font: { - fontFamily: this.config.font.fontFamily, - bold: this.config.font.bold, - italic: this.config.font.italic, - underline: isClick - } - }); - }))); - //text size - this.own(on(this.textSizeSelect, 'change', lang.hitch(this, function (value) { - if(this.config.fontSize === value || false === this.textSizeSelect.isValid()){ - return; - } - this.setTextSize(value); - this.onSettingChange({ - fontSize: value - }); - }))); - this.own(on(this.textSizeSlider, 'change', lang.hitch(this, function (value) { - if(this.config.fontSize === value){ - return; - } - this.setTextSize(value); - this.onSettingChange({ - fontSize: value - }); - }))); - //.textColor - this.own(on(this.textColorPicker, 'change', lang.hitch(this, function (color) { - if(this.config.textColor === color){ - return; - } - this.onSettingChange({ - textColor: color.toHex() - }); - }))); - //transparency slider - this.own(this.labelTransparency.watch('transparency', lang.hitch(this, function () { - this.onSettingChange({ - labelTransparency: this.labelTransparency.getValues().transparency - }); - }))); - //halo size - this.own(on(this.haloSizeSelect, 'change', lang.hitch(this, function (value) { - if(this.config.haloSize === value || false === this.haloSizeSelect.isValid()){ - return; - } - this.onSettingChange({ - haloSize: value - }); - }))); - //.haloColor - this.own(on(this.haloColorPicker, 'change', lang.hitch(this, function (color) { - if(this.config.haloColor === color){ - return; - } - this.onSettingChange({ - haloColor: color.toHex() - }); - }))); - //halo toggle switch - this.own(on(this.showHalo, 'change', lang.hitch(this, function () { - this.onSettingChange({ - haloOn: this.showHalo.checked - }); - }))); - }, - startup: function () { - this.inherited(arguments); - this.setConfig(this.config); - this.refresh(); - }, - - onSettingChange: function (configObj) { - this.config = lang.mixin(this.config, configObj); - this.onChange(this.config); - }, - onChange: function (config) { - this.emit("change", config); - }, - refresh: function () { - this.onSettingChange({}); - }, - isValid: function () { - if (false === this.textSizeSelect.isValid()) { - return false; - } - - return true; - }, - getConfig: function () { - if (this.isValid()) { - return this.config; - } else { - return false; - } - }, - - setConfig: function (configObj) { - if ("undefined" === configObj) { - return; - } - - if ("undefined" !== typeof configObj.font) { - this.config.font = configObj.font; - if (this.config.font.fontFamily) { - this.fontSelect.set('value', this.config.font.fontFamily); - } - this.fontBtnClickd(this.config.font); - } - if ("undefined" !== typeof configObj.fontSize) { - this.config.fontSize = configObj.fontSize; - this.setTextSize(this.config.fontSize); - } - if ("undefined" === typeof configObj.textColor || "" === configObj.textColor) { - configObj.textColor = this._DEFAULT_CONFIG.textColor;//"#000001"; - } - this.config.textColor = configObj.textColor; - - if ("undefined" === typeof configObj.labelTransparency || "" === configObj.labelTransparency) { - configObj.labelTransparency = this._DEFAULT_CONFIG.labelTransparency;//"1"; - } - this.config.labelTransparency = configObj.labelTransparency; - this.labelTransparency.setValues({"transparency": this.config.labelTransparency}); - - if ("undefined" === typeof configObj.haloSize || "" === configObj.haloSize) { - configObj.haloSize = this._DEFAULT_CONFIG.haloSize;//"1"; - - } - this.config.haloSize = configObj.haloSize; - this.haloSizeSelect.set('value', configObj.haloSize); - - if ("undefined" === typeof configObj.haloColor || "" === configObj.haloColor) { - configObj.haloColor = this._DEFAULT_CONFIG.haloColor;//"#FFFFFF"; - } - this.config.haloColor = configObj.haloColor; - - html.setStyle(this.textColorPicker.domNode, 'backgroundColor', this.config.textColor); - this.textColorPicker.picker.refreshRecords(); - this.textColorPicker.picker.setColor(this.config.textColor, false, true); - - html.setStyle(this.haloColorPicker.domNode, 'backgroundColor', this.config.haloColor); - this.haloColorPicker.picker.refreshRecords(); - this.haloColorPicker.picker.setColor(this.config.haloColor, false, true); - - if ("undefined" === typeof configObj.haloOn || "" === configObj.haloOn) { - configObj.haloOn = this._DEFAULT_CONFIG.haloOn;//"#FFFFFF"; - } - this.showHalo.set("checked",this.config.haloOn); - }, - - setTextSize: function (size) { - if (size !== this.textSizeSelect.getValue()) { - this.textSizeSelect.set('value', size); - } - - if (size !== this.textSizeSlider.getValue()) { - if (size > this._MAX_TEXT_SIZE) { - size = this._MAX_TEXT_SIZE; - } else if (size < this._MIN_TEXT_SIZE) { - size = this._MIN_TEXT_SIZE; - } - this.textSizeSlider.set('value', size); - } - }, - - fontBtnClickd: function (fontConfig) { - if (true === fontConfig.bold) { - html.addClass(this.bold, "selected"); - } else if (false === fontConfig.bold) { - html.removeClass(this.bold, "selected"); - } - - if (true === fontConfig.italic) { - html.addClass(this.italic, "selected"); - } else if (false === fontConfig.italic) { - html.removeClass(this.italic, "selected"); - } - - if (true === fontConfig.underline) { - html.addClass(this.underline, "selected"); - } else if (false === fontConfig.underline) { - html.removeClass(this.underline, "selected"); - } - }, - - _initAppearance: function () { - if (this.appearance) { - if (false === this.appearance.bold) { - html.addClass(this.bold, "hide"); - } - if (false === this.appearance.italic) { - html.addClass(this.italic, "hide"); - } - if (false === this.appearance.underline) { - html.addClass(this.underline, "hide"); - } - } - } - }); - }); \ No newline at end of file diff --git a/GRG/templates/ColorPickerEditor.html b/GRG/templates/ColorPickerEditor.html deleted file mode 100644 index 33aaab2..0000000 --- a/GRG/templates/ColorPickerEditor.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
- ${nls.transparency} -
- - % -
- diff --git a/GRG/templates/FontSetting.html b/GRG/templates/FontSetting.html deleted file mode 100644 index 641fbe6..0000000 --- a/GRG/templates/FontSetting.html +++ /dev/null @@ -1,57 +0,0 @@ -
-
-
${nls.font}
-
- -
-
-
-
${nls.textSize}
-
-
- -
-
-
-
-
-
-
-
${nls.textColor}
-
-
-
-
-
-
-
-
-
-
-
-
-
${nls.transparency}
-
-
-
-
-
-
-
-
${nls.halo}
-
-
- -
-
-
-
-
-
${nls.show}
-
-
- -
-
-
-
\ No newline at end of file diff --git a/GRG/templates/TransparencyEditor.html b/GRG/templates/TransparencyEditor.html deleted file mode 100644 index 9ef4677..0000000 --- a/GRG/templates/TransparencyEditor.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
- - % -
- diff --git a/GRG/Widget.html b/GriddedReferenceGraphic/Widget.html similarity index 74% rename from GRG/Widget.html rename to GriddedReferenceGraphic/Widget.html index a4d164b..28eda4d 100644 --- a/GRG/Widget.html +++ b/GriddedReferenceGraphic/Widget.html @@ -63,6 +63,13 @@
+ +
+
+ ${nls.newGRGByTimeLabel}
+
+
+
@@ -203,7 +210,7 @@ -
+
${nls.labelFormat}
@@ -328,8 +335,7 @@
- - + @@ -385,7 +391,7 @@ -
+
${nls.labelFormat}
@@ -402,6 +408,140 @@
+ + + +
+
+ +
+
+
+ +
+ ${nls.newGRGPointByTimeTitle} +
+ +
+ +
+ +
+
${nls.coordInputLabel}
+
+ +
+
+
+
+ + +
+
+
${nls.time}
+ +
+
+
 
+ +
+
+ + +
+
+
${nls.rate}
+ +
+
+
 
+ +
+
+ + +
+ + +
+ +
+
+
${nls.numberOfCellsHorizontal}
+ +
+
+
${nls.numberOfCellsVertical}
+ +
+
+ +
+ +
+
${nls.cellWidth}
+ +
+ +
+
${nls.cellHeight}
+ +
+
+ +
+
+
${nls.rotation}
+ +
+
+ + +
+
+
${nls.createGRGBtn}
+
+
+
${nls.clearGRGBtn}
+
+
+
+
+
+
${nls.gridSettings.labelType}
@@ -83,6 +83,14 @@
+ +
+
+ ${nls.gridSettings.labelType}
+ +
+
diff --git a/GRG/setting/TransparencyEditor.html b/GriddedReferenceGraphic/templates/TransparencyEditor.html similarity index 100% rename from GRG/setting/TransparencyEditor.html rename to GriddedReferenceGraphic/templates/TransparencyEditor.html diff --git a/GRG/version.txt b/GriddedReferenceGraphic/version.txt similarity index 79% rename from GRG/version.txt rename to GriddedReferenceGraphic/version.txt index 6714917..3cf0ae0 100644 --- a/GRG/version.txt +++ b/GriddedReferenceGraphic/version.txt @@ -1,3 +1,3 @@ -ArcGIS Solutions - September 2016 Release +ArcGIS Solutions - January 2018 Release This version.txt reflects when the widget code was released. Other parts of the solution (e.g. map document or sample data) may have updated in a later release. diff --git a/README.md b/README.md index 097e87e..0238cf0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A GRG (Gridded Reference Graphic) is a grid overlay used for a common reference ![App](solutions-grg-widget.png) -[View it live](https://nationalsecurity.esri.com/solutionsweb/grg/) +[View it live](https://nationalsecurity.esri.com/solutionsweb/GriddedReferenceGraphic) ## Sections @@ -29,10 +29,10 @@ Allows users to create an gridded reference graphic from: * By Reference System ## Instructions -In order to develop and test widgets you need to deploy the GRG directory to the stemapp/widgets directory in your WebApp Builder installation. +In order to develop and test widgets you need to deploy the GRG directory to the `stemapp/widgets directory` in your WebApp Builder installation. ## Requirements -* Minimum requirement is ArcGIS WebApp Builder v.1.0. +* Minimum requirement is ArcGIS Web AppBuilder v.1.0. * Widget has been updated to v.2.6. ## Resources