public void getNextWPT()
        throws IOException {

        if (isWpt()) {
            return;
        }

        boolean moreToDo;
        do {
            moreToDo = true; // common case is no wpt yet

            switch (m_state) {
            case ST_MINI:
            case ST_MICRO:
                skipRestOfDatum();
                m_state = ST_DATUMDONE;
                // break and let the loop go again and go into the
                // correct state. This might be less efficient but
                // avoid complaints from FindBugs.
                break;

            case ST_DATUMDONE:
                m_state = ST_READDATUM;
                // see state ST_MICRO
                break;
                
            case ST_READDATUM:
                enterDatum();
                if (m_state == ST_INVALID) {
                    moreToDo = false;
                    break;
                }

                if (Action.isWpt(iRdAction)) {
                    parseNavRoutePoint();
                    m_state = ST_DATUMDONE;
                    moreToDo = false;

                    break;
                }

                // enterDatum handles mini map changes so this is
                // a datum we don't handle
                skipRestOfDatum();
                break;

            default:
                // will not happen unless there is a programming error
                throw new Error("invalid state " + m_state);
            } // switch
        } while (moreToDo);
    } // getNextWPT