Commit Graph

72 Commits

Author SHA1 Message Date
John Firebaugh
53ed9df2b7 A no-op Graph#replace should not create a new graph
This is useful for reducing graph churn.
2013-02-06 13:42:34 -08:00
John Firebaugh
b62f106be8 Extract Relation#replaceMember 2013-02-06 13:42:34 -08:00
John Firebaugh
5eb0644242 Improve multipolygon rendering
Multipolygon relations report their geometry as 'area' and are rendered
as such. However, they do not render a stroke. The stroke rendering
will come from the individual lines, which are given the tag
classes of their parent relations, allowing them to have a stroke
style matching the style of simple areas with the same tags.

Untagged circular ways are no longer considered areas. This prevents
an untagged inner way of a multipolygon from rendering as an area and
is consistent with how P2 and JOSM treat them.

In the CSS, it's no longer necessary to deal with multipolygons
explicitly in selectors. But keep in mind that area boundaries can
now be rendered either as lines or as area strokes. In most cases
the selector should be `path.stroke.tag-_____`, i.e. an explicit
`.area` or `.line` classes should not be included.

Finally, the parent ways of selected multipolygons are given the 'selected'
class.
2013-02-05 15:20:11 -08:00
John Firebaugh
13a784bea5 Better Way#asGeoJSON 2013-02-05 15:20:11 -08:00
John Firebaugh
8735413974 Relation#asGeoJSON 2013-02-05 15:20:11 -08:00
John Firebaugh
72cd6b91fa Relation#multipolygon returns coordinate arrays 2013-02-05 15:20:11 -08:00
Tom MacWright
bd7f302730 Show deprecated tags in save commit, validate them, add deprecatedTags
to entity type.
2013-02-04 16:45:18 -05:00
John Firebaugh
80a5a083b0 Remove unused 2013-02-02 19:57:36 -05:00
John Firebaugh
fc00f154a9 Dispatch a change event on merge 2013-02-02 19:47:56 -05:00
John Firebaugh
11d723819d Difference#extantIDs 2013-02-02 19:47:56 -05:00
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
John Firebaugh
20730e5f1a Entity#mergeTags 2013-02-01 17:31:32 -05:00
Ansis Brammanis
846cf6e43d Add difference tests 2013-01-31 13:37:54 -05:00
Ansis Brammanis
a82b81a3c2 Add tests for #replace #remove #rebase 2013-01-30 16:40:00 -05:00
Ansis Brammanis
a317859b0f Don't re-add removed parentways, don't duplicate 2013-01-30 15:44:03 -05:00
Ansis Brammanis
1b5a1b8268 Merge takes an entities object, not graph 2013-01-30 14:20:39 -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
John Firebaugh
c5d691d79d Graph#rebase 2013-01-28 16:08:08 -05:00
John Firebaugh
08bd7e583a Define Relation#asJXON (allow relations to be saved) 2013-01-28 10:19:11 -05:00
John Firebaugh
2ac0f1dc26 Don't rely on OSM IDs being in range of JS numbers 2013-01-28 10:15:17 -05:00
John Firebaugh
47ef222f38 Convert iD.format.XML to member functions 2013-01-27 21:50:08 -05:00
John Firebaugh
646c746991 Convert iD.format.GeoJSON to member functions 2013-01-27 21:50:07 -05:00
John Firebaugh
e09666bbdc Fixing draw mode bugs
Disabling interactive draw undo for now. I know how to fix it
but it's a bit tricky. So undo will just drop you out to browse
mode for the time being.

Fixes #477.
Fixes #516.
2013-01-26 15:24:14 -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
John Firebaugh
3105923371 Wrap all actions in Graph#update 2013-01-25 13:43:35 -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
John Firebaugh
1be596c21b Fix tests 2013-01-24 11:26:57 -05:00
John Firebaugh
278bb4a51c Fix some cases where a degenerate way was created 2013-01-23 12:40:27 -05:00
John Firebaugh
292c916cb1 Converting some actions to entity methods
The guidelines here are:

Entity methods:
  return a modified entity
  don't necessarily maintain whole-graph consistency

Actions:
  return a modified graph
  always maintain whole-graph consistency
  call entity methods liberally
  generally don't call other actions
2013-01-23 12:40:27 -05:00
John Firebaugh
381794e7a1 Fix Relation#multipolygon for unmatched inner rings (fixes #461) 2013-01-22 17:54:57 -05:00
John Firebaugh
814c3608db Hook into undos in a different way
This way doesn't depend on details of keybindings and
the undo button.

Also, implement this in DrawArea mode.
2013-01-22 14:55:08 -05:00
Brandon Liu
ded802049a add history.numChanges method.
Use hasChanges/numChanges to toggle Save button and show confirmation dialog when navigating away from page.
2013-01-19 23:16:48 -08:00
Brandon Liu
d83ec7f1eb Create method history.hasChanges 2013-01-19 23:01:47 -08:00
John Firebaugh
95800741fd Add some utility methods to Way 2013-01-18 14:44:29 -08:00
John Firebaugh
020c56b3a2 Move Entity#intersects test 2013-01-18 14:44:28 -08:00
John Firebaugh
b27903f7b5 Add Relation#isRestriction 2013-01-18 14:44:28 -08:00
John Firebaugh
3349e1f69c Add some utility methods to Relation 2013-01-18 14:44:28 -08:00
John Firebaugh
bf251dce15 Handle incomplete relations 2013-01-17 17:37:50 -08:00
John Firebaugh
9abe3af312 Fix extent and difference rendering for multi polygons 2013-01-17 14:27:01 -08:00
John Firebaugh
5a2444b551 Extract and fix extent/intersection calculations
Extents are now [[min x, min y], [max x, max y]].
2013-01-17 14:27:01 -08:00
John Firebaugh
1d707b0eb2 Match inners with outers
After thinking about how the `evenodd` fill rule works, I pretty sure
we don't actually need to do this. If I'm right, I'll back it out, and
it will be in the history if we need it for some other purpose.
2013-01-13 18:17:16 -08:00
John Firebaugh
67c8e287cf Start on multipolygon reconstruction algorithm 2013-01-13 17:20:04 -08:00
Tom MacWright
eedc0fce9d Fast parent calculation. 2013-01-09 14:52:39 -05:00
John Firebaugh
62efa1948e Add Entity#geometry, use in inspector
Fixes the icon for areas, but breaks it for vertices.
Needs a big-vertex sprite.
2013-01-02 21:59:55 -08:00
John Firebaugh
2a6145ef10 Move friendlyName to Entity 2013-01-02 21:43:35 -08:00
Tom MacWright
3544bb9d3c Add osmId to entity tests 2013-01-02 13:30:14 -05:00
John Firebaugh
d181df4c51 Polymorphism 2012-12-28 22:24:52 -08:00
John Firebaugh
31502c6214 Simplify; test; fix 2012-12-28 22:13:36 -08:00
John Firebaugh
5fe22be7a0 Introduce real Entity subclasses 2012-12-28 18:42:21 -08:00