PageSourceSearch

https://asce7tsunami.online/app/js/components/Criteria/LocationSelection.js?0.1.40

js asce7tsunami.online collected 2026-10-04 13:25:34 UTC 12,172 bytes, 261 lines download raw bytes

1define(['exports', 'react', 'actions/CriteriaActions', 'actions/MapActions', 'dms-conversion', 'js/config/config'], function (exports, _react, _actionsCriteriaActions, _actionsMapActions, _dmsConversion, _jsConfigConfig) {
2  'use strict';
3
4  Object.defineProperty(exports, '__esModule', {
5    value: true
6  });
7
8  var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
9
10  var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
11
12  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13
14  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
15
16  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
17
18  var _React = _interopRequireDefault(_react);
19
20  var _config = _interopRequireDefault(_jsConfigConfig);
21
22  var LocationSelection = (function (_React$Component) {
23    _inherits(LocationSelection, _React$Component);
24
25    function LocationSelection() {
26      _classCallCheck(this, LocationSelection);
27
28      _get(Object.getPrototypeOf(LocationSelection.prototype), 'constructor', this).apply(this, arguments);
29    }
30
31    _createClass(LocationSelection, [{
32      key: 'componentDidMount',
33      value: function componentDidMount() {
34        $('ul.tabs').tabs();
35        $('ul.tabs li a:not(:first)').removeClass('active');
36      }
37    }, {
38      key: 'handleClick',
39      value: function handleClick(event) {
40        switch (event.target.text) {
41          case 'Address':
42            _actionsMapActions.mapActions.toggleMapLock(true);
43            _actionsCriteriaActions.criteriaActions.toggleLocationDiv('address');
44
45            document.getElementById('latitude').value = '';
46            document.getElementById('longitude').value = '';
47            break;
48          case 'Lat/Long':
49            _actionsMapActions.mapActions.toggleMapLock(true);
50            _actionsCriteriaActions.criteriaActions.toggleLocationDiv('latlon');
51            break;
52          case 'Find on Map':
53            _actionsMapActions.mapActions.toggleMapLock(false);
54            _actionsCriteriaActions.criteriaActions.toggleLocationDiv('mapclick');
55
56            document.getElementById('latitude').value = '';
57            document.getElementById('longitude').value = '';
58            break;
59        }
60      }
61    }, {
62      key: 'latLongEntry',
63      value: function latLongEntry(event) {
64        var keyCode = event.which || event.keyCode;
65        if (keyCode === 13) {
66          this.fireReverseGeoCode();
67        }
68      }
69    }, {
70      key: 'fireReverseGeoCode',
71      value: function fireReverseGeoCode() {
72        var latlon = [document.getElementById('latitude').value, document.getElementById('longitude').value];
73        var result = latlon.map(_dmsConversion.parseDms);
74
75        var latitude = result[0];
76        var longitude = result[1];
77
78        var latCheck = false;
79        var lonCheck = false;
80
81        if (!isNaN(latitude) && latitude >= -90 && latitude <= 90) {
82          latCheck = true;
83        } else {
84          document.getElementById('latitude').value = 'Invalid Entry';
85        }
86
87        if (!isNaN(longitude) && longitude >= -180) {
88          if (longitude > 180) {
89            longitude -= 360;
90            if (longitude >= -180 && longitude <= 180) {
91              lonCheck = true;
92            } else {
93              document.getElementById('longitude').value = 'Invalid Entry';
94            }
95          } else {
96            lonCheck = true;
97          }
98        } else {
99          document.getElementById('longitude').value = 'Invalid Entry';
100        }
101
102        if (latCheck && lonCheck) {
103          _actionsMapActions.mapActions.reverseGeocoder(latitude, longitude);
104        }
105      }
106    }, {
107      key: 'fireAddressSearch',
108      value: function fireAddressSearch(event) {
109        var address = document.getElementById('geocoder_input').value;
110        _actionsMapActions.mapActions.searchAddress(address);
111      }
112    }, {
113      key: 'updateSnapToAddress',
114      value: function updateSnapToAddress(evt) {
115        _actionsCriteriaActions.criteriaActions.updatedSnapToAddress(evt.target.checked);
116      }
117    }, {
118      key: 'render',
119      value: function render() {
120        return _React['default'].createElement(
121          'div',
122          { id: 'locationSelection' },
123          _React['default'].createElement(
124            'h3',
125            { className: 'location-selection-container__title' },
126            _React['default'].createElement(
127              'span',
128              null,
129              _config['default'].strings.locationSelectionLabel
130            )
131          ),
132          _React['default'].createElement(
133            'div',
134            { className: 'margin--small white location-selectioncontainer__content' },
135            _React['default'].createElement(
136              'div',
137              { className: 'row' },
138              _React['default'].createElement(
139                'div',
140                { className: 'col s12' },
141                _React['default'].createElement(
142                  'div',
143                  { className: 'enter-location-container' },
144                  _React['default'].createElement(
145                    'h3',
146                    { className: 'enter-location-container__label' },
147                    _React['default'].createElement('img', { className: 'title-icon', src: 'app/images/sm_icon_location.svg', alt: '' }),
148                    _React['default'].createElement(
149                      'span',
150                      null,
151                      'Enter Location'
152                    ),
153                    _React['default'].createElement('img', { className: 'info-icon', src: 'app/images/icon_info.svg', title: _config['default'].strings.locationInfo })
154                  )
155                ),
156                _React['default'].createElement(
157                  'ul',
158                  { className: 'tabs' },
159                  _React['default'].createElement(
160                    'li',
161                    { id: 'addressTab', className: 'tab col tab-selector' },
162                    _React['default'].createElement(
163                      'a',
164                      { href: '', className: 'grey-text text-darken-4', onClick: this.handleClick },
165                      'Address'
166                    )
167                  ),
168                  _React['default'].createElement(
169                    'li',
170                    { id: 'latlonTab', className: 'tab col tab-selector' },
171                    _React['default'].createElement(
172                      'a',
173                      { href: '', className: 'grey-text text-darken-4', onClick: this.handleClick },
174                      'Lat/Long'
175                    )
176                  ),
177                  _React['default'].createElement(
178                    'li',
179                    { id: 'mapclickTab', className: 'tab col tab-selector' },
180                    _React['default'].createElement(
181                      'a',
182                      { href: '', className: 'grey-text text-darken-4', onClick: this.handleClick },
183                      'Find on Map'
184                    )
185                  )
186                )
187              )
188            ),
189            _React['default'].createElement(
190              'div',
191              { className: 'location-inputs' },
192              _React['default'].createElement(
193                'div',
194                { id: 'geocoderContainer', className: 'location-input-item padding--small ' + (this.props.activeLocationDiv === 'address' ? '' : 'hidden') },
195                _React['default'].createElement('div', { id: 'geocoder' }),
196                _React['default'].createElement(
197                  'div',
198                  { className: 'waves-effect waves-light btn blue lighten-1 locate-btn', id: 'locate-address', onClick: this.fireAddressSearch },
199                  'SEARCH'
200                )
201              ),
202              _React['default'].createElement(
203                'div',
204                { id: 'latlong', className: 'location-input-item padding--small ' + (this.props.activeLocationDiv === 'latlon' ? '' : 'hidden') },
205                _React['default'].createElement(
206                  'div',
207                  { className: 'row' },
208                  _React['default'].createElement(
209                    'div',
210                    { className: 'input-field col s6 latlong-container' },
211                    _React['default'].createElement('input', { id: 'latitude', onKeyDown: this.latLongEntry.bind(this), type: 'text' }),
212                    _React['default'].createElement(
213                      'label',
214                      { className: 'active', htmlFor: 'latitude' },
215                      'Latitude'
216                    )
217                  ),
218                  _React['default'].createElement(
219                    'div',
220                    { className: 'input-field col s6 latlong-container' },
221                    _React['default'].createElement('input', { id: 'longitude', onKeyDown: this.latLongEntry.bind(this), type: 'text' }),
222                    _React['default'].createElement(
223                      'label',
224                      { className: 'active', htmlFor: 'longitude' },
225                      'Longitude'
226                    )
227                  )
228                ),
229                _React['default'].createElement(
230                  'div',
231                  { className: 'waves-effect waves-light btn blue lighten-1 locate-btn', id: 'locate-latlon', onClick: this.fireReverseGeoCode },
232                  'SEARCH'
233                )
234              ),
235              _React['default'].createElement(
236                'div',
237                { id: 'mapclick', className: 'location-input-item ' + (this.props.activeLocationDiv === 'mapclick' ? '' : 'hidden') },
238                _React['default'].createElement(
239                  'div',
240                  { className: 'valign-wrapper fill' },
241                  _React['default'].createElement(
242                    'div',
243                    { className: 'valign center-align center-block' },
244                    'Click on Map to select location '
245                  )
246                )
247              )
248            )
249          )
250        );
251      }
252    }]);
253
254    return LocationSelection;
255  })(_React['default'].Component);
256
257  exports.LocationSelection = LocationSelection;
258});
259/*<input type='checkbox' className='blue darken-2 filled-in' checked={this.props.snapToAddress} id='toggleSnapTo' onChange={this.updateSnapToAddress.bind(this)}></input>
260<label id='toggleSnapToLabel' htmlFor='toggleSnapTo'>Snap to Address</label>*/
261//# sourceMappingURL=LocationSelection.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.