# Last edited on 2012-08-28 22:54:35 by stolfilocal Wikimapia proposed feature: POLYGONS AS CONCATENATED POLYLINES Wikimapia should allow polygons to be defined as concatenation of independent 'polyline' objects. The main motivation is that many polygons share boundaries with other polygons. Representing these shared parts only once would save editor's work and maintain consistency automatically. Another motivation is that polygons with many points, too large to be edited as a single objects, could be segmented into several smaller polylines which could be edited individually. Namely, in this proposal, the 'outline' of a Wikimapia object Z has a new binary attribute OPEN or CLOSED, and may be (TYPE0) empty (missing) (TYPE1) a list of one or more points p[0],..p[n-1] (TYPE2) a list of one or more objects X[0],..X[m-1] with signs s[0],..s[m-1] In TYPE1, the outline of Z consists of the polygonal line with corners p[0],.. p[n-1]; namely, the n-1 segments p[i]<--->p[i+1], for i in 0..n-2. If Z is CLOSED, then n must be at least 3, and there is also the segment p[n-1]<--->p[0]. In TYPE2, the outlines of the objects X[0],.. X[m-1] (the /children/ of Z) are implicitly concatenated, in that order, with one extra segment between the last point of of X[i] and the first point of X[i+1], for i in 0..m-2. If Z is CLOSED then the total number of points must be at least 3, and there is also a segment from the last point of X[m-1] and the first point of X[0]. Each sign s[i] is either +1 or -1; if the latter, the corresponding child X[i]} is implicitlly reversed. In the current Wikimapia, objects with oultines are always TYPE1 CLOSED. Under the new proposal, creating a new polygonal object from scratch works pretty much as in the current Wikimapia. The user first draws a polyline, and the object is implicitly OPEN. After adding three points, the user may click on the initial point, which makes the outline CLOSED. However, under the new proposal, the user shall also have the option of saving the object while still in the OPEN state. Either way, the new object is TYPE1. There will be little change also when editing the outline of an existing object Z. In both TYPEs, the user will see a yellow polygon or polyline with draggable red dots at the corners. If Z is CLOSED, the closing segment is drawn and the interior is filled, as now. Dragging a point will behave just as now. However, if Z is TYPE2, the action will actually modify a point of the TYPE1 descendant Y of Z that contains that point; and it will affect every other TYPE2 outline that uses (is an ancestor of) object Y. Inserting a new corner in Z has some restrictions. Suppose the corners or Z are p[0]...p[n-1] in order. We define J(Z,r,i) as i if r is +1, and as n-i-1 if r is -1. We will denote B(Z,r,i) the operation of inserting a new corner in Z before point p[J(Z,r,i)] if r is +1, and after that point if r is -1. Then prepending a new point at the beginning B(Z,+1,0) and appending at the end is B(Z,-1,0). If Z is CLOSED then these last two operations are visually indistinguishable; the interface may use the same gesture for both and choose arbitrarily between them. (However, if Z is then made OPEN the system's choice will become obvious). If Z is TYPE1 then the action B(Z,r,i) is performed on its point list in the obvious way. Now suppose Z is TYPE2. let Y be the child of Z that owns u, and k the absolute difference |J(Z,r,i) - J(Z,r,0)| *ETC* of such that corner j of Y is corner i of Z. are applied to its first child X[0] and to its last child X[m-1], respectively; except that I(Y) becomes F(Y), and vice-versa, if the sign s[0] and equivalent to an I() operation on its firts Z Let U,V be the two TYPE1 descendants of Z that contain the two corners. The action If U=V (in particular, when Z is TYPE1) then insertion is allowed and works as now. If the two corners belong the same TYPE1 eleting a point from Z also The editor shall have some way of toggling the OPEN/CLOSED attribute of Z while editing, as long as Z is a top-level object (not the child of any other object). If the object being edited is TYPE2, dragging a point will modify the point of some object