001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.imagery.vectortile.mapbox;
003
004/**
005 * Command integers for Mapbox Vector Tiles
006 * @author Taylor Smock
007 * @since 17862
008 */
009public enum Command {
010    /**
011     * For {@link GeometryTypes#POINT}, each {@link #MoveTo} is a new point.
012     * For {@link GeometryTypes#LINESTRING} and {@link GeometryTypes#POLYGON}, each {@link #MoveTo} is a new geometry of the same type.
013     */
014    MoveTo((byte) 1, (byte) 2),
015    /**
016     * While not explicitly prohibited for {@link GeometryTypes#POINT}, it should be ignored.
017     * For {@link GeometryTypes#LINESTRING} and {@link GeometryTypes#POLYGON}, each {@link #LineTo} extends that geometry.
018     */
019    LineTo((byte) 2, (byte) 2),
020    /**
021     * This is only explicitly valid for {@link GeometryTypes#POLYGON}. It closes the {@link GeometryTypes#POLYGON}.
022     */
023    ClosePath((byte) 7, (byte) 0);
024
025    private final byte id;
026    private final byte parameters;
027
028    Command(byte id, byte parameters) {
029        this.id = id;
030        this.parameters = parameters;
031    }
032
033    /**
034     * Get the command id
035     * @return The id
036     */
037    public byte getId() {
038        return this.id;
039    }
040
041    /**
042     * Get the number of parameters
043     * @return The number of parameters
044     */
045    public byte getParameterNumber() {
046        return this.parameters;
047    }
048}