mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
external modules for core
This commit is contained in:
1
Makefile
1
Makefile
@@ -45,7 +45,6 @@ $(BUILDJS_TARGETS): $(BUILDJS_SOURCES) build.js
|
||||
MODULE_TARGETS = \
|
||||
js/lib/id/index.js \
|
||||
js/lib/id/behavior.js \
|
||||
js/lib/id/core.js \
|
||||
js/lib/id/geo.js \
|
||||
js/lib/id/modes.js \
|
||||
js/lib/id/operations.js \
|
||||
|
||||
1677
js/lib/id/index.js
1677
js/lib/id/index.js
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ import { Entity } from './entity';
|
||||
import { Way } from './way';
|
||||
import { Relation } from './relation';
|
||||
import { Node } from './node';
|
||||
import { Extent } from '../geo/index';
|
||||
|
||||
export function Connection(useHttps) {
|
||||
if (typeof useHttps !== 'boolean') {
|
||||
@@ -384,7 +385,7 @@ export function Connection(useHttps) {
|
||||
|
||||
return {
|
||||
id: tile.toString(),
|
||||
extent: iD.geo.Extent(
|
||||
extent: Extent(
|
||||
projection.invert([x, y + ts]),
|
||||
projection.invert([x + ts, y]))
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getPrototypeOf } from '../util/index';
|
||||
|
||||
export function Graph(other, mutable) {
|
||||
if (!(this instanceof Graph)) return new Graph(other, mutable);
|
||||
|
||||
@@ -97,9 +99,9 @@ Graph.prototype = {
|
||||
|
||||
base: function() {
|
||||
return {
|
||||
'entities': iD.util.getPrototypeOf(this.entities),
|
||||
'parentWays': iD.util.getPrototypeOf(this._parentWays),
|
||||
'parentRels': iD.util.getPrototypeOf(this._parentRels)
|
||||
'entities': getPrototypeOf(this.entities),
|
||||
'parentWays': getPrototypeOf(this._parentWays),
|
||||
'parentRels': getPrototypeOf(this._parentRels)
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@ import { Entity } from './entity';
|
||||
import { Graph } from './graph';
|
||||
import { Difference } from './difference';
|
||||
import { Tree } from './tree';
|
||||
import { SessionMutex } from '../util/index';
|
||||
import { Loading } from '../ui/core/index';
|
||||
|
||||
export function History(context) {
|
||||
var stack, index, tree,
|
||||
imageryUsed = ['Bing'],
|
||||
dispatch = d3.dispatch('change', 'undone', 'redone'),
|
||||
lock = iD.util.SessionMutex('lock');
|
||||
lock = SessionMutex('lock');
|
||||
|
||||
function perform(actions) {
|
||||
actions = Array.prototype.slice.call(actions);
|
||||
@@ -291,7 +293,7 @@ export function History(context) {
|
||||
loadComplete = false;
|
||||
context.redrawEnable(false);
|
||||
|
||||
var loading = iD.ui.Loading(context).blocking(true);
|
||||
var loading = Loading(context).blocking(true);
|
||||
context.container().call(loading);
|
||||
|
||||
var childNodesLoaded = function(err, result) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// iD.Node = iD.Entity.node;
|
||||
import { Entity } from './entity';
|
||||
import { Extent } from '../geo/index';
|
||||
|
||||
export function Node() {
|
||||
if (!(this instanceof Node)) {
|
||||
return (new Node()).initialize(arguments);
|
||||
@@ -16,7 +18,7 @@ _.extend(Node.prototype, {
|
||||
type: 'node',
|
||||
|
||||
extent: function() {
|
||||
return new iD.geo.Extent(this.loc);
|
||||
return new Extent(this.loc);
|
||||
},
|
||||
|
||||
geometry: function(graph) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Entity } from './entity';
|
||||
import { Extent, joinWays, polygonContainsPolygon, polygonIntersectsPolygon } from '../geo/index';
|
||||
|
||||
export function Relation() {
|
||||
if (!(this instanceof Relation)) {
|
||||
@@ -41,11 +42,11 @@ _.extend(Relation.prototype, {
|
||||
|
||||
extent: function(resolver, memo) {
|
||||
return resolver.transient(this, 'extent', function() {
|
||||
if (memo && memo[this.id]) return iD.geo.Extent();
|
||||
if (memo && memo[this.id]) return Extent();
|
||||
memo = memo || {};
|
||||
memo[this.id] = true;
|
||||
|
||||
var extent = iD.geo.Extent();
|
||||
var extent = Extent();
|
||||
for (var i = 0; i < this.members.length; i++) {
|
||||
var member = resolver.hasEntity(this.members[i].id);
|
||||
if (member) {
|
||||
@@ -224,8 +225,8 @@ _.extend(Relation.prototype, {
|
||||
var outers = this.members.filter(function(m) { return 'outer' === (m.role || 'outer'); }),
|
||||
inners = this.members.filter(function(m) { return 'inner' === m.role; });
|
||||
|
||||
outers = iD.geo.joinWays(outers, resolver);
|
||||
inners = iD.geo.joinWays(inners, resolver);
|
||||
outers = joinWays(outers, resolver);
|
||||
inners = joinWays(inners, resolver);
|
||||
|
||||
outers = outers.map(function(outer) { return _.map(outer.nodes, 'loc'); });
|
||||
inners = inners.map(function(inner) { return _.map(inner.nodes, 'loc'); });
|
||||
@@ -241,13 +242,13 @@ _.extend(Relation.prototype, {
|
||||
|
||||
for (o = 0; o < outers.length; o++) {
|
||||
outer = outers[o];
|
||||
if (iD.geo.polygonContainsPolygon(outer, inner))
|
||||
if (polygonContainsPolygon(outer, inner))
|
||||
return o;
|
||||
}
|
||||
|
||||
for (o = 0; o < outers.length; o++) {
|
||||
outer = outers[o];
|
||||
if (iD.geo.polygonIntersectsPolygon(outer, inner))
|
||||
if (polygonIntersectsPolygon(outer, inner))
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Entity } from './entity';
|
||||
import { oneWayTags } from './tags';
|
||||
import { cross, Extent } from '../geo/index';
|
||||
|
||||
export function Way() {
|
||||
if (!(this instanceof Way)) {
|
||||
return (new Way()).initialize(arguments);
|
||||
@@ -34,7 +36,7 @@ _.extend(Way.prototype, {
|
||||
|
||||
extent: function(resolver) {
|
||||
return resolver.transient(this, 'extent', function() {
|
||||
var extent = iD.geo.Extent();
|
||||
var extent = Extent();
|
||||
for (var i = 0; i < this.nodes.length; i++) {
|
||||
var node = resolver.hasEntity(this.nodes[i]);
|
||||
if (node) {
|
||||
@@ -113,7 +115,7 @@ _.extend(Way.prototype, {
|
||||
var o = coords[(i+1) % coords.length],
|
||||
a = coords[i],
|
||||
b = coords[(i+2) % coords.length],
|
||||
res = iD.geo.cross(o, a, b);
|
||||
res = cross(o, a, b);
|
||||
|
||||
curr = (res > 0) ? 1 : (res < 0) ? -1 : 0;
|
||||
if (curr === 0) {
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
import * as actions from './actions/index';
|
||||
|
||||
export { Connection } from './core/connection';
|
||||
export { Difference } from './core/difference';
|
||||
export { Entity } from './core/entity';
|
||||
export { Graph } from './core/graph';
|
||||
export { History } from './core/history';
|
||||
export { Node } from './core/node';
|
||||
export { Relation } from './core/relation';
|
||||
export { oneWayTags, pavedTags, interestingTag } from './core/tags';
|
||||
export { Tree } from './core/tree';
|
||||
export { Way } from './core/way';
|
||||
|
||||
export {
|
||||
actions
|
||||
};
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
<script src='../js/id/id.js'></script>
|
||||
<script src='../js/lib/id/index.js'></script>
|
||||
<script src='../js/lib/id/core.js'></script>
|
||||
<script src='../js/lib/id/behavior.js'></script>
|
||||
<script src='../js/lib/id/geo.js'></script>
|
||||
<script src='../js/lib/id/modes.js'></script>
|
||||
|
||||
Reference in New Issue
Block a user