source: josm/trunk/src/org/openstreetmap/josm/data/osm/IWay.java@ 13608

Last change on this file since 13608 was 13564, checked in by Don-vip, 6 years ago

introduce PrimitiveRenderer to replace OsmPrimitivRenderer (now deprecated). Change NameFormatter API to support IPrimitive instead of OsmPrimitive. Enhances interfaces in consequence.

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4/**
5 * IWay captures the common functions of {@link Way} and {@link WayData}.
6 * @since 4098
7 */
8public interface IWay extends IPrimitive {
9
10 /**
11 * Replies the number of nodes in this way.
12 *
13 * @return the number of nodes in this way.
14 */
15 int getNodesCount();
16
17 /**
18 * Replies the real number of nodes in this way (full number of nodes minus one if this way is closed)
19 *
20 * @return the real number of nodes in this way.
21 *
22 * @see #getNodesCount()
23 * @see #isClosed()
24 * @since 5847
25 * @since 13564 (IWay)
26 */
27 default int getRealNodesCount() {
28 int count = getNodesCount();
29 return isClosed() ? count-1 : count;
30 }
31
32 /**
33 * Returns id of the node at given index.
34 * @param idx node index
35 * @return id of the node at given index
36 */
37 long getNodeId(int idx);
38
39 /**
40 * Determines if this way is closed.
41 * @return {@code true} if this way is closed, {@code false} otherwise
42 */
43 boolean isClosed();
44
45 @Override
46 default String getDisplayName(NameFormatter formatter) {
47 return formatter.format(this);
48 }
49}
Note: See TracBrowser for help on using the repository browser.