Hi Steve,

I have tested mixed-index branch and it doesn't work for me. Mkgmap creates bigger index file but search work the same in Mapsource, no results when searching for partial label. I'm not able to find the reason. I think function writeSectData doesn't save partial labels, but I can't tell if this is a problem.

I haven't tested in device.

I have modified a bit my version to test some other ideas, patch is attached. I have removed text in parenthesis form partial search, added split at hyphen and excluded numbers at the end of label.

--
Best regards,
Andrzej


--- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java      Wed Jun 25 15:52:12 2014
+++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java      Wed Dec 10 00:41:10 2014
@@ -221,14 +221,48 @@
                                continue;
                        
                        String name = lab.getText();
                        String cleanName = cleanUpName(name);
                        int strOff = createString(cleanName);
+                       int labOff = lab.getOffset();
 
                        // We sort on the dirty name (ie with the Garmin shield 
codes) although those codes do not
                        // affect the sort order. The string for mdr15 does not 
include the shield codes.
-                       mdr7.addStreet(currentMap, name, lab.getOffset(), 
strOff, mdrCity);
+                       mdr7.addStreet(currentMap, name, labOff, strOff, 
mdrCity);
+
+                       // try substrings
+                       //System.out.println("name: " + name);
+                       name = name.replaceAll("\\(.*\\)", ""); // ignore text 
in parenthesis
+                       name = name.trim();                                     
        // removes garmin codes at the beginning
+                       //System.out.println("trim: " + name);
+
+                       boolean stateWord = true;
+                       for (int nameOffset = 0; nameOffset < name.length() -2; 
nameOffset++) {
+                               char c = name.charAt(nameOffset);
+                               if (stateWord) {
+                                       if (Character.isWhitespace(c) || c == 
'-')
+                                               stateWord = false;
+                                       continue;
+                               }
+                               if (Character.isWhitespace(c) || c == '-')
+                                       continue;
+
+                               stateWord   = true;
+                               String part = name.substring(nameOffset);
+
+                               if (part.indexOf(' ') < 0) {    // last word
+                                       if (Character.isDigit(c)) {     // 
probably is a number
+                                               //System.out.println("  --: " + 
part);
+                                               break;
+                                       }
+                               }
+
+                               //System.out.println("  ++: " + part);
+                               cleanName   = cleanUpName(part);
+                               strOff      = createString(cleanName);
+                               mdr7.addStreet(currentMap, part, labOff, 
strOff, mdrCity);
+                       }
                }
        }
 
        /**
         * Remove shields and other kinds of strange characters.  Perform any

_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to