Ignore:
Timestamp:
2009-09-30T22:14:09+02:00 (15 years ago)
Author:
miken
Message:

JOSM Adr Interpolation Plugin - Accept numeric plus alpha combo

Location:
applications/editors/josm/plugins/addrinterpolation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/addrinterpolation/build.xml

    r17745 r17883  
    9191                <attribute name="Plugin-Description" value="Group common Address Interpolation inputs in a single dialog,"/>
    9292                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AddrInterpolation"/>
    93                 <attribute name="Plugin-Mainversion" value="2100"/>
     93                <attribute name="Plugin-Mainversion" value="2161"/>
    9494                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    9595            </manifest>
  • applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java

    r17762 r17883  
    334334                                // Both end with alpha
    335335                                SelectInterpolationMethod("alphabetic");
    336                         }
    337 
     336                                return;
     337                        }
     338
     339                        if ( (IsNumeric("" + startingChar)) &&  (!IsNumeric("" + endingChar)) ) {
     340                                endingChar = Character.toUpperCase(endingChar);
     341                                if ( (endingChar >= 'A') && (endingChar <= 'Z') ) {
     342                                        // First is a number, last is Latin alpha
     343                                        SelectInterpolationMethod("alphabetic");
     344                                }
     345                        }
    338346
    339347
     
    873881                        char endingChar = endValueString.charAt(endValueString.length()-1);
    874882
    875                         if ( (IsNumeric("" + startingChar)) || (IsNumeric("" + endingChar)) ) {
     883
     884                        boolean isOk = false;
     885                        if ( (IsNumeric("" + startingChar)) &&  (!IsNumeric("" + endingChar)) ) {
     886                                endingChar = Character.toUpperCase(endingChar);
     887                                if ( (endingChar >= 'A') && (endingChar <= 'Z') ) {
     888                                        // First is a number, last is Latin alpha
     889                                        isOk = true;
     890                                }
     891                        } else if ( (!IsNumeric("" + startingChar)) && (!IsNumeric("" + endingChar)) ) {
     892                                // Both are alpha
     893                                isOk = true;
     894                        }
     895                        if (!isOk) {
    876896                                errorMessage = tr("Alphabetic address must end with a letter");
     897                        }
     898
     899
     900                        // if a number is included, validate that it is the same number
     901                        if (endValueString.length() > 1) {
     902
     903                                // Get number portion of first item: may or may not have letter suffix
     904                                String numStart = startValueString.substring(0, startValueString.length()-1);
     905                                if (IsNumeric(startValueString)) {
     906                                        numStart = startValueString;
     907                                }
     908
     909                                String numEnd = endValueString.substring(0, endValueString.length()-1);
     910                                if (!numStart.equals(numEnd)) {
     911                                        errorMessage = tr("Starting and ending numbers must be the same for alphabetic addresses");
     912                                }
    877913                        }
    878914
Note: See TracChangeset for help on using the changeset viewer.