189 Commits

Author SHA1 Message Date
Bryan Housel
ed4929273d Return entities from iD.Connection via callbacks
(instead of dispatching `load` event to merge them into `history`)

This is cleaner becuase now `context` doesn't need to keep an
`altGraph` state used only for Conflict Resolution.

The conflict resolution code calls the `iD.Connection` methods directly,
and other places in the code call `loadEntity` and `loadTiles` wrappers
that merge the entities into the main history.
2015-01-08 14:44:58 -05:00
Bryan Housel
d9f204cf45 Remove Graph#freeze 2015-01-07 11:52:17 -05:00
Bryan Housel
90147b23db Make copy handle circular and other degenerate Relations 2015-01-04 23:15:47 -05:00
Bryan Housel
f6d144c151 Improvements, and simplify code
* don't worry about deep copying, because immutability
* don't need `attrs` parameter which is usually empty
* don't worry about resetting `v` entity version
2015-01-01 22:49:44 -05:00
Bryan Housel
dae0d2d55e Add entity copy methods 2014-12-28 22:00:55 -05:00
Bryan Housel
d85da08cfe fix "inherits entities from base prototypally" test 2014-12-10 00:11:09 -05:00
Bryan Housel
1c3d198b96 add force option for rebase to overwrite existing entities
related: openstreetmap/iD#2467
2014-12-04 19:50:32 -05:00
Bryan Housel
1f544e883b bump chai to 1.9.2 and fix tests affected by change in equality testing
re #2388
2014-10-28 21:37:04 -04:00
John Firebaugh
e0020c37e2 Add test for #2421 2014-10-24 10:34:39 -07:00
John Firebaugh
a7fb35663c Optimize Way#area 2014-10-13 16:46:32 -07:00
Bryan Housel
0c5f563a26 add test for iD.Entity.layer(), fix spelling of man_made. 2014-06-09 23:39:16 -04:00
John Firebaugh
0c09871c4a Don’t show turn restriction editor for non-highways (fixes #2240) 2014-05-27 14:35:57 -07:00
Bryan Housel
b8501bcf89 iD.Way.isOneWay should return false if oneway=no #2220
i.e. overrides implied oneway tag like `highway=motorway` or `junction=roundabout`
2014-05-20 00:14:23 -04:00
Bryan Housel
d245121b19 Fix isConvex() to correctly test the angle that closes the way. 2014-04-23 14:12:20 -04:00
Bryan Housel
a2331f8c93 Add tests for iD.geo.cross and iD.way.isConvex 2014-04-15 00:26:53 -04:00
John Firebaugh
2ab9239a9f More accurate modification tests 2014-02-25 10:12:34 -08:00
tyr
efd3223e0c extend history loading fix to deletions
Deleted objects need to be kept in the base of the history stack, too.

This also improves the respective unit tests.
2014-02-22 14:09:17 +01:00
tyr
86c4bc9105 add tests for "restoring from v3 JSON" (core/history.js) 2014-02-21 10:19:36 +01:00
tyr
fc0a15e6c4 fix duplicate objects after restoring data from localStorage
This makes sure that the originals of changed entities get merged
into the base of the stack after restoring the data from JSON.
This is necessary, because the stack will only have elements for
the current viewport after a restart and previously *modified*
objects will now be falsely detected as *created* ones.

Also removed some ineffective code.
2014-02-21 10:01:26 +01:00
tyr
b71c98cfca protect against relation loops, part 2. fixes #2096 2014-01-10 11:12:10 +01:00
John Firebaugh
1561c366be Update OSM.org links 2014-01-08 16:29:00 -08:00
John Firebaugh
ab8a4ffd7b Update GitHub links 2014-01-08 16:14:28 -08:00
John Firebaugh
4bf21cbc8a Restore deleted nodes that are discovered to have extant parents
This bug has existed since 1.0!

Fixes #2085
2014-01-06 16:23:15 -08:00
John Firebaugh
7bbca76a20 Protect against relation loops (fixes #2072) 2014-01-02 17:42:57 -08:00
Adam Solove
2213b072dd Clean up and test relation sorting code. 2013-12-10 22:39:37 -05:00
John Firebaugh
15590525d3 Fix build 2013-11-21 14:51:52 -08:00
tyr
2cf4c20a47 don't load parent multiple times into tree when multiple childs are changed
when an action (e.g. moving a way) caused multiple child elements
of the same parent to be changed, their parent was also loaded into
the tree multiple times during `tree.intersects()`.

this fixes #1978
2013-11-19 11:27:29 +01:00
John Firebaugh
b383bfec1f Fix unclosed area rendering (fixes #1958) 2013-11-13 17:41:57 -08:00
John Firebaugh
492fc88aa4 Make the Graph#rebase argument an array 2013-10-31 16:24:31 -07:00
John Firebaugh
14bfc52e33 Remove repetition of entity IDs in tests
There were several places where the key and entity id
didn't match up.
2013-10-31 15:57:47 -07:00
John Firebaugh
ffdeef398d Rewrite tree logic
The main problem with the existing logic was that it
did not update the extents of relations when previously incomplete members were loaded.

It was also overly stateful; the various queues and flags
are no longer required.

Fixes #1928.
Fixes #1540.
2013-10-28 16:57:18 -07:00
John Firebaugh
95e667d6b7 More tests 2013-10-28 16:34:08 -07:00
John Firebaugh
e0e08115e5 Pass entity array to Tree#rebase 2013-10-28 16:34:08 -07:00
John Firebaugh
e6d3cb242c Clean up tests 2013-10-28 14:07:28 -07:00
John Firebaugh
fbf2118c76 Fix change summary calculation after restoring
We can't rely on identity equality here due to how
restoring works, and don't want to anyway -- the summary
should ignore net-no-op tag changes.

Fixes #1915.
2013-10-23 17:35:35 -07:00
John Firebaugh
2de500a90a Add a few more vertex cases to summary 2013-10-23 13:36:58 -07:00
John Firebaugh
697faf0265 Use summary to calculate # in Save button 2013-10-23 13:36:58 -07:00
John Firebaugh
b8e88a7aaf Convert relevantChanges to a method on Difference 2013-10-23 13:36:58 -07:00
John Firebaugh
26e38d7f8f Return geometries rather than features in asGeoJSON
No code needs the tags, and it eliminates one level
of function calls in the d3 stream pipeline.
2013-10-16 09:40:01 -04:00
John Firebaugh
81bc280aba More reliable method for mutexed localStorage saves
Fixes #1883
2013-10-10 14:59:48 -07:00
John Firebaugh
a32ce33238 Add Way#affix 2013-08-30 13:59:29 -07:00
John Firebaugh
163c85bacb Delete relations that become empty
Fixes #465
Fixes #1454
2013-08-27 12:27:11 -07:00
John Firebaugh
7215e91ff2 Ensure asGeoJSON returns winding orders expected by D3 2013-08-26 14:39:08 -07:00
John Firebaugh
a8f6c30a36 Fix test 2013-08-16 14:19:56 -07:00
John Firebaugh
2efafa087b Deduplicate entities in serialized history
Fixes #1403
2013-08-14 16:49:53 -07:00
Vladimir Agafonkin
454eecae8f replace RTree with RBush 2013-07-21 17:20:14 +03:00
John Firebaugh
3861879f62 Remove Connection#user and always use #userDetails
Because the embedded iD does not show the account
UI, Connection#userDetails was not being called, so
the commit UI didn't show the user name and image.

Fixes #1464
2013-06-14 13:06:13 -07:00
John Firebaugh
7ec1222402 Try to insert relation members at a sensible index (#1539) 2013-06-05 16:00:53 -07:00
John Firebaugh
2d7cc2a2d1 Preserve member order as much as possible 2013-06-05 16:00:12 -07:00
John Firebaugh
33cf029d43 Extract and refactor iD.geo.joinMemberWays 2013-06-05 16:00:12 -07:00