User:Johnparis/sets
Elements
Nodes
Node ... basic element. Persistent. "Deleting" a node means setting the VISIBLE flag to FALSE
Node flag:
- VISIBLE
Ways
Elementary way ... ordered set of nodes. It can include invisible nodes.
Segment ... connects two adjacent visible nodes in an elementary way
Way ... ordered set of elementary ways. First node of each elementary way is the last node of its predecessor, if any. (FIXME: what if node is invisible?) It can include invisible elementary ways. (FIXME: right?)
Rules:
- segments in a way may intersect only at visible nodes in the way.
- visible nodes in a way may connect at most two segments in the way
Way flags:
- CLOSED : first and last nodes are considered adjacent
- AREA : way is considered to bound an area (can be inner or outer boundary) when CLOSED flag is set
- Note: if AREA is set and CLOSED is clear, this could be an extra flag (OLDAPI?)
- VISIBLE
Areas
Elementary area ... a way with the CLOSED and AREA flags set. The way is the perimeter of the area.
Area ... ordered set of elementary areas. The initial elementary area in the set encloses all the others. (Note: after the initial element, the order might not matter.)
Rules:
- Perimeters in an area may intersect only at visible nodes.
- A node where perimeters intersect must connect exactly two segments from each perimeter.
- If perimeters intersect, they must either abut (area of overlap is zero) or nest (area of overlap equals area of the smaller).
- No two elementary areas in the set may be contiguous.
Relations
Elementary relation ... ordered set of nodes, ways and areas. It can include invisible nodes, ways and areas. It has echelon 0.
Relation ... unordered set of elementary relations of echelon 0 to n-1. It has echelon n. It can include invisible relations. (FIXME: right?)
Relation flags:
- VISIBLE
- OLDAPI
Operations
Joining
Joining a node to a way -- joins to an elementary way
Joining a node to an area -- joins to an elementary area
Joining a node to a relation -- joins to an elementary relation
Joining a way to a way
Joining a way to an area -- joins to an elementary area
Joining a way to a relation -- joins to an elementary relation
Joining an area to an area
Joining an area to a relation -- joins to an elementary relation
Joining a relation to a relation -- echelon number of superior relation is either unchanged or one more than the echelon number of the inferior relation, whichever is more
Splitting
Splitting a way
Splitting an area
Splitting a relation
Undeleting
Undeleting a node
Undeleting a way
Undeleting an area
Undeleting a relation