Refactor Entity, Node, Relation, Tags, Way from core to osm

This commit is contained in:
Bryan Housel
2016-10-11 22:41:24 -04:00
parent fd742518c6
commit 07fa5fcc34
52 changed files with 215 additions and 239 deletions
+8 -8
View File
@@ -14,9 +14,9 @@ import {
} from '../modes/index';
import {
coreNode,
coreWay
} from '../core/index';
osmNode,
osmWay
} from '../osm/index';
import {
geoChooseEdge,
@@ -44,9 +44,9 @@ export function behaviorDrawWay(context, wayId, index, mode, baseGraph) {
draw = behaviorDraw(context);
var startIndex = typeof index === 'undefined' ? way.nodes.length - 1 : 0,
start = coreNode({loc: context.graph().entity(way.nodes[startIndex]).loc}),
end = coreNode({loc: context.map().mouseCoordinates()}),
segment = coreWay({
start = osmNode({loc: context.graph().entity(way.nodes[startIndex]).loc}),
end = osmNode({loc: context.map().mouseCoordinates()}),
segment = osmWay({
nodes: typeof index === 'undefined' ? [start.id, end.id] : [end.id, start.id],
tags: _.clone(way.tags)
});
@@ -165,7 +165,7 @@ export function behaviorDrawWay(context, wayId, index, mode, baseGraph) {
var last = context.hasEntity(way.nodes[way.nodes.length - (isArea ? 2 : 1)]);
if (last && last.loc[0] === loc[0] && last.loc[1] === loc[1]) return;
var newNode = coreNode({loc: loc});
var newNode = osmNode({loc: loc});
context.replace(
actionAddEntity(newNode),
@@ -188,7 +188,7 @@ export function behaviorDrawWay(context, wayId, index, mode, baseGraph) {
if (!isArea && geoEdgeEqual(edge, previousEdge))
return;
var newNode = coreNode({ loc: loc });
var newNode = osmNode({ loc: loc });
context.perform(
actionAddMidpoint({ loc: loc, edge: edge}, newNode),
+2 -2
View File
@@ -1,6 +1,6 @@
import * as d3 from 'd3';
import { d3keybinding } from '../lib/d3.keybinding.js';
import { coreEntity } from '../core/index';
import { osmEntity } from '../osm/index';
import { utilRebind } from '../util/rebind';
@@ -54,7 +54,7 @@ export function behaviorHover() {
selection.selectAll('.hover-suppressed')
.classed('hover-suppressed', false);
if (target instanceof coreEntity) {
if (target instanceof osmEntity) {
var selector = '.' + target.id;
if (target.type === 'relation') {
+2 -2
View File
@@ -1,7 +1,7 @@
import * as d3 from 'd3';
import _ from 'lodash';
import { modeBrowse, modeSelect } from '../modes/index';
import { coreEntity } from '../core/index';
import { osmEntity } from '../osm/index';
export function behaviorSelect(context) {
@@ -27,7 +27,7 @@ export function behaviorSelect(context) {
lasso = d3.select('#surface .lasso').node(),
mode = context.mode();
if (!(datum instanceof coreEntity)) {
if (!(datum instanceof osmEntity)) {
if (!d3.event.shiftKey && !lasso && mode.id !== 'browse')
context.enter(modeBrowse(context));