private static List<Integer> ptsToGeomCmds(final Geometry geom, final Vec2d cursor) {

        // Guard: empty geometry coordinates
        final Coordinate[] geomCoords = geom.getCoordinates();
        if(geomCoords.length <= 0) {
            return Collections.emptyList();
        }

        /** Tile commands and parameters */
        final List<Integer> geomCmds = new ArrayList<>(geomCmdBuffLenPts(geomCoords.length));

        /** Holds next MVT coordinate */
        final Vec2d mvtPos = new Vec2d();

        /** Length of 'MoveTo' draw command */
        int moveCmdLen = 0;

        // Insert placeholder for 'MoveTo' command header
        geomCmds.add(0);

        Coordinate nextCoord;

        for(int i = 0; i < geomCoords.length; ++i) {
            nextCoord = geomCoords[i];
            mvtPos.set(nextCoord.x, nextCoord.y);

            // Ignore duplicate MVT points
            if(i == 0 || !equalAsInts(cursor, mvtPos)) {
                ++moveCmdLen;
                moveCursor(cursor, geomCmds, mvtPos);
            }
        }


        if(moveCmdLen <= GeomCmdHdr.CMD_HDR_LEN_MAX) {

            // Write 'MoveTo' command header to first index
            geomCmds.set(0, GeomCmdHdr.cmdHdr(GeomCmd.MoveTo, moveCmdLen));

            return geomCmds;

        } else {

            // Invalid geometry, need at least 1 'MoveTo' value to make points
            return Collections.emptyList();
        }
    }
private static List < Integer > ptsToGeomCmds ( final Geometry geom , final Vec2d cursor ) { final Coordinate [ ] geomCoords = geom . getCoordinates ( ) ; if ( geomCoords . length <= 0 ) { return Collections . emptyList ( ) ; } final List < Integer > geomCmds = new ArrayList < > ( geomCmdBuffLenPts ( geomCoords . length ) ) ; final Vec2d mvtPos = new Vec2d ( ) ; int moveCmdLen = 0 ; geomCmds . add ( 0 ) ; Coordinate nextCoord ; for ( int i = 0 ; i < geomCoords . length ; ++ i ) { nextCoord = geomCoords [ i ] ; mvtPos . set ( nextCoord . x , nextCoord . y ) ; if ( i == 0 || ! equalAsInts ( cursor , mvtPos ) ) { ++ moveCmdLen ; moveCursor ( cursor , geomCmds , mvtPos ) ; } } if ( moveCmdLen <= GeomCmdHdr . CMD_HDR_LEN_MAX ) { geomCmds . set ( 0 , GeomCmdHdr . cmdHdr ( GeomCmd . MoveTo , moveCmdLen ) ) ; return geomCmds ; } else { return Collections . emptyList ( ) ; } }
<p>Convert a {@link Point} or {@link MultiPoint} geometry to a list of MVT geometry drawing commands. See
<a href="https://github.com/mapbox/vector-tile-spec">vector-tile-spec</a>
for details.</p>

<p>WARNING: The value of the {@code cursor} parameter is modified as a result of calling this method.</p>

@param geom input of type {@link Point} or {@link MultiPoint}. Type is NOT checked and expected to be correct.
@param cursor modified during processing to contain next MVT cursor position
@return list of commands