mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
@@ -59,7 +59,6 @@
|
||||
"rbush": false,
|
||||
"JXON": false,
|
||||
"osmAuth": false,
|
||||
"sexagesimal": false,
|
||||
"toGeoJSON": false,
|
||||
"marked": false,
|
||||
"Mapillary": false,
|
||||
|
||||
3
Makefile
3
Makefile
@@ -69,7 +69,7 @@ js/lib/id/ui/index.js: $(shell find modules/ui -type f)
|
||||
|
||||
js/lib/id/ui/core.js: $(shell find modules/ui/core -type f)
|
||||
@rm -f $@
|
||||
node_modules/.bin/rollup -f umd -n iD.ui modules/ui/core/index.js --no-strict -o $@
|
||||
node_modules/.bin/rollup -c modules/ui/core/rollup.config.js -f umd -n iD.ui modules/ui/core/index.js --no-strict -o $@
|
||||
|
||||
js/lib/id/ui/intro.js: $(shell find modules/ui/intro -type f)
|
||||
@rm -f $@
|
||||
@@ -96,7 +96,6 @@ dist/iD.js: \
|
||||
js/lib/lodash.js \
|
||||
js/lib/osmauth.js \
|
||||
js/lib/rbush.js \
|
||||
js/lib/sexagesimal.js \
|
||||
js/lib/togeojson.js \
|
||||
js/lib/marked.js \
|
||||
js/id/start.js \
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<script src='js/lib/bootstrap-tooltip.js'></script>
|
||||
<script src='js/lib/diff3.js'></script>
|
||||
<script src='js/lib/rbush.js'></script>
|
||||
<script src='js/lib/sexagesimal.js'></script>
|
||||
<script src='js/lib/togeojson.js'></script>
|
||||
<script src='js/lib/marked.js'></script>
|
||||
|
||||
|
||||
12053
js/lib/id/ui/core.js
12053
js/lib/id/ui/core.js
File diff suppressed because it is too large
Load Diff
@@ -1,73 +0,0 @@
|
||||
(function(e){if("function"==typeof bootstrap)bootstrap("sexagesimal",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSexagesimal=e}else"undefined"!=typeof window?window.sexagesimal=e():global.sexagesimal=e()})(function(){var define,ses,bootstrap,module,exports;
|
||||
return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
module.exports = element;
|
||||
module.exports.pair = pair;
|
||||
module.exports.format = format;
|
||||
module.exports.formatPair = formatPair;
|
||||
|
||||
function element(x, dims) {
|
||||
return search(x, dims).val;
|
||||
}
|
||||
|
||||
function formatPair(x) {
|
||||
return format(x.lat, 'lat') + ' ' + format(x.lon, 'lon');
|
||||
}
|
||||
|
||||
// Is 0 North or South?
|
||||
function format(x, dim) {
|
||||
var dirs = {
|
||||
lat: ['N', 'S'],
|
||||
lon: ['E', 'W']
|
||||
}[dim] || '',
|
||||
dir = dirs[x >= 0 ? 0 : 1],
|
||||
abs = Math.abs(x),
|
||||
whole = Math.floor(abs),
|
||||
fraction = abs - whole,
|
||||
fractionMinutes = fraction * 60,
|
||||
minutes = Math.floor(fractionMinutes),
|
||||
seconds = Math.floor((fractionMinutes - minutes) * 60);
|
||||
|
||||
return whole + '° ' +
|
||||
(minutes ? minutes + "' " : '') +
|
||||
(seconds ? seconds + '" ' : '') + dir;
|
||||
}
|
||||
|
||||
function search(x, dims, r) {
|
||||
if (!dims) dims = 'NSEW';
|
||||
if (typeof x !== 'string') return { val: null, regex: r };
|
||||
r = r || /[\s\,]*([\-|\—|\―]?[0-9.]+)°? *(?:([0-9.]+)['’′‘] *)?(?:([0-9.]+)(?:''|"|”|″) *)?([NSEW])?/gi;
|
||||
var m = r.exec(x);
|
||||
if (!m) return { val: null, regex: r };
|
||||
else if (m[4] && dims.indexOf(m[4]) === -1) return { val: null, regex: r };
|
||||
else return {
|
||||
val: (((m[1]) ? parseFloat(m[1]) : 0) +
|
||||
((m[2] ? parseFloat(m[2]) / 60 : 0)) +
|
||||
((m[3] ? parseFloat(m[3]) / 3600 : 0))) *
|
||||
((m[4] && m[4] === 'S' || m[4] === 'W') ? -1 : 1),
|
||||
regex: r,
|
||||
raw: m[0],
|
||||
dim: m[4]
|
||||
};
|
||||
}
|
||||
|
||||
function pair(x, dims) {
|
||||
x = x.trim();
|
||||
var one = search(x, dims);
|
||||
if (one.val === null) return null;
|
||||
var two = search(x, dims, one.regex);
|
||||
if (two.val === null) return null;
|
||||
// null if one/two are not contiguous.
|
||||
if (one.raw + two.raw !== x) return null;
|
||||
if (one.dim) return swapdim(one.val, two.val, one.dim);
|
||||
else return [one.val, two.val];
|
||||
}
|
||||
|
||||
function swapdim(a, b, dim) {
|
||||
if (dim == 'N' || dim == 'S') return [a, b];
|
||||
if (dim == 'W' || dim == 'E') return [b, a];
|
||||
}
|
||||
|
||||
},{}]},{},[1])
|
||||
(1)
|
||||
});
|
||||
;
|
||||
@@ -1,3 +1,5 @@
|
||||
import { default as sexagesimal } from 'sexagesimal';
|
||||
|
||||
export function FeatureList(context) {
|
||||
var geocodeResults;
|
||||
|
||||
|
||||
9
modules/ui/core/rollup.config.js
Normal file
9
modules/ui/core/rollup.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import nodeResolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
nodeResolve({ jsnext: true, main: true }),
|
||||
commonjs()
|
||||
]
|
||||
};
|
||||
@@ -21,6 +21,9 @@
|
||||
"openstreetmap"
|
||||
],
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"sexagesimal": "~0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.9.2",
|
||||
"d3": "3.5.5",
|
||||
@@ -41,6 +44,8 @@
|
||||
"phantomjs-prebuilt": "2.1.7",
|
||||
"request": "~2.16.2",
|
||||
"rollup": "0.31.2",
|
||||
"rollup-plugin-commonjs": "3.1.0",
|
||||
"rollup-plugin-node-resolve": "1.7.1",
|
||||
"sinon": "~1.6",
|
||||
"sinon-chai": "~2.3.1",
|
||||
"smash": "0.0",
|
||||
|
||||
Reference in New Issue
Block a user