Commit Graph

51 Commits

Author SHA1 Message Date
John Firebaugh
ddc5e324f6 Extract iD.Difference
iD.Difference represents the difference between two graphs.
It knows how to calculate the set of entities that were
created, modified, or deleted, and also contains the logic
for recursively extending a difference to the complete set
of entities that will require a redraw, taking into account
child and parent relationships.

Additionally, all history mutators now return a difference.
2013-02-02 19:47:56 -05:00
Ansis Brammanis
846cf6e43d Add difference tests 2013-01-31 13:37:54 -05:00
Ansis Brammanis
5c8aa46e1f Fix graph.difference 2013-01-31 12:47:02 -05:00
Ansis Brammanis
9862238a84 Fix graph.rebase() 2013-01-30 17:04:51 -05:00
Ansis Brammanis
2fa48df9a1 Small parentWays, parentRelations perf improvements 2013-01-30 16:09:15 -05:00
Ansis Brammanis
a317859b0f Don't re-add removed parentways, don't duplicate 2013-01-30 15:44:03 -05:00
Ansis Brammanis
5a35b6bfa4 Fix difference 2013-01-30 14:11:54 -05:00
Ansis Brammanis
e08364d492 working parentRels 2013-01-30 13:18:44 -05:00
Ansis Brammanis
ba68a238fe Working rebase 2013-01-30 12:26:40 -05:00
Ansis Brammanis
6c1e4e5b4d Working more-efficient parentWays 2013-01-29 13:32:39 -05:00
Ansis Brammanis
7d32af5264 work towards using prototypes for entities 2013-01-29 12:49:00 -05:00
John Firebaugh
c5d691d79d Graph#rebase 2013-01-28 16:08:08 -05:00
Ansis Brammanis
8f8e3955b5 Revert "Use object.create for graph.entities"
This reverts commit 78993bc080.
2013-01-25 18:08:48 -05:00
Ansis Brammanis
db0ba2c88c Revert "Difference only changed entities"
This reverts commit 74d006ea08.

Conflicts:

	js/id/graph/graph.js
2013-01-25 18:05:38 -05:00
Tom MacWright
5645a48feb More jshint 2013-01-25 17:55:43 -05:00
John Firebaugh
5ea855e18d Replace Graph#fetch with Graph#childNodes
Having two kinds of Ways (fetched and non-fetched)
introduced some accidental complexity. This brings things
more in line with how parentWays/parentRelations work.

Fixes #73.
2013-01-25 15:10:44 -05:00
Ansis Brammanis
74d006ea08 Difference only changed entities 2013-01-25 15:07:58 -05:00
Ansis Brammanis
78993bc080 Use object.create for graph.entities 2013-01-25 14:35:46 -05:00
John Firebaugh
4874199401 Add Graph#update
This can be used to reduce graph churn when there are
multiple changes to make.
2013-01-25 13:27:33 -05:00
Tom MacWright
32ea30c3fb Use isPoi for determining whether points are pois or not 2013-01-23 19:14:54 -05:00
Ansis Brammanis
a97a4e4617 Fix redrawing shared vertices 2013-01-20 19:05:53 -05:00
Tom MacWright
0e9e14102e Cache fetch results, higher features limit 2013-01-16 13:54:53 -05:00
Tom MacWright
87c341d7e0 Fix jshint problems. 2013-01-16 12:39:35 -05:00
Ansis Brammanis
fc272199c7 Fix difference 2013-01-16 11:34:50 -05:00
Ansis Brammanis
0a1e16a319 Nodes with changed parents added to difference 2013-01-16 11:31:36 -05:00
John Firebaugh
ddaca08fb1 Clean up parentWays, apply same algorithm to relations 2013-01-12 11:03:45 -08:00
John Firebaugh
6e044f3607 Store flag on _parentWays itself, fixes #392
Relying here on the fact that `calculated` will never
collide with an actual entity ID.
2013-01-12 10:55:18 -08:00
Ansis Brammanis
bb65916e06 Fix careless naming, fixing node dragging 2013-01-12 02:15:33 -05:00
Ansis Brammanis
62e78b5b9b clean up parentWays 2013-01-11 20:37:32 -05:00
Ansis Brammanis
a08dd7ecce More efficient parentways 2013-01-11 19:14:17 -05:00
John Firebaugh
577398ca21 Fix .shared classing
Now that Graph#parentWays is cached, the specialized Graph#parentStructure
method is no longer necessary.

This commit also demonstrates that it's relatively easy to write specs for
rendering now!
2013-01-11 11:56:37 -08:00
Tom MacWright
eedc0fce9d Fast parent calculation. 2013-01-09 14:52:39 -05:00
Tom MacWright
850e7d6568 Optimize difference and parentWays 2013-01-09 13:45:04 -05:00
Tom MacWright
4347b134de Optimize difference 2013-01-08 15:33:29 -05:00
John Firebaugh
c66ea58d56 Move transients to graph (fixes #285) 2012-12-27 18:52:56 -08:00
Tom MacWright
e8a14f8b5b Make handles connected to more than one way cyan. Fixes #205 2012-12-17 14:06:27 -05:00
Tom MacWright
0db5193e0c Fix parentRelations 2012-12-07 14:16:11 -05:00
John Firebaugh
ea4b93d88b Graph#difference 2012-12-07 12:35:57 -05:00
John Firebaugh
255e3aaabd Modify Graph so it can track deleted ids 2012-12-07 12:32:24 -05:00
John Firebaugh
3e45afbc5e Move history annotation to History#perform/replace
Actions are too low-level for annotations.
2012-12-07 10:35:39 -05:00
John Firebaugh
67ffd2e71b Revert "Copy entity in Graph#fetch"
This reverts commit 12d02e0a6b.
2012-12-06 19:16:54 -05:00
John Firebaugh
6b08193125 Introduce Entity transients; fix #187 2012-12-06 14:11:45 -05:00
John Firebaugh
d26c8638b3 Allow Graph to be constructed with an array of entities
Useful for tests.
2012-12-05 16:14:39 -05:00
John Firebaugh
4a3169bb1d Test/refine iD.actions.remove 2012-12-05 16:14:39 -05:00
John Firebaugh
551a2df24e Replace Entity.{lat,lon} with Entity.loc
Fixes #189
2012-12-05 09:48:00 -05:00
John Firebaugh
12d02e0a6b Copy entity in Graph#fetch
This shouldn't be necessary, but someone is modifying them
in place and it's causing problems elsewhere.
2012-12-04 17:27:02 -05:00
John Firebaugh
60e7698f1a Don't mutate entity in place 2012-12-04 14:00:29 -05:00
John Firebaugh
f06ae6b70e Eliminate temporary 2012-11-30 07:17:32 -08:00
Tom MacWright
80ea085f35 Get node-dependent osmChange working 2012-11-28 15:13:31 -05:00
Tom MacWright
c1a87ed8b6 Work on road drawing, index ways on demand 2012-11-28 13:59:28 -05:00