This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch master
in repository mkgmap.

commit 04b4e0a4861efae915e3f58560fb4b8a67d970d7
Author: Bas Couwenberg <sebas...@xs4all.nl>
Date:   Thu Dec 25 19:30:56 2014 +0100

    Imported Upstream version 0.0.0+svn3392
---
 resources/mkgmap-version.properties                |  4 +--
 src/uk/me/parabola/imgfmt/app/Coord.java           | 19 +++++++---
 src/uk/me/parabola/mkgmap/build/MapBuilder.java    |  7 ++--
 src/uk/me/parabola/mkgmap/general/MapElement.java  |  9 +++++
 .../parabola/mkgmap/osmstyle/StyledConverter.java  | 21 ++----------
 .../osmstyle/housenumber/HousenumberGenerator.java | 40 +++++++++++++---------
 .../mkgmap/reader/polish/PolishMapDataSource.java  |  4 ++-
 .../parabola/mkgmap/reader/polish/RoadHelper.java  |  4 +--
 test/func/SimpleTest.java                          |  2 +-
 test/func/route/SimpleRouteTest.java               |  4 +--
 10 files changed, 63 insertions(+), 51 deletions(-)

diff --git a/resources/mkgmap-version.properties 
b/resources/mkgmap-version.properties
index 798b028..494b950 100644
--- a/resources/mkgmap-version.properties
+++ b/resources/mkgmap-version.properties
@@ -1,2 +1,2 @@
-svn.version: 3383
-build.timestamp: 2014-12-18T07:11:34+0000
+svn.version: 3392
+build.timestamp: 2014-12-24T17:03:01+0000
diff --git a/src/uk/me/parabola/imgfmt/app/Coord.java 
b/src/uk/me/parabola/imgfmt/app/Coord.java
index c1486e7..eb93e71 100644
--- a/src/uk/me/parabola/imgfmt/app/Coord.java
+++ b/src/uk/me/parabola/imgfmt/app/Coord.java
@@ -590,7 +590,7 @@ public class Coord implements Comparable<Coord> {
         * @param val30 a longitude/latitude value with 30 bit precision
         * @return an angle in radians.
         */
-       private static double int30ToRadians(int val30){
+       public static double int30ToRadians(int val30){
                return BIT30_RAD_FACTOR * val30;
        }
 
@@ -769,10 +769,19 @@ public class Coord implements Comparable<Coord> {
                double deltaLat = bLat - aLat;
 
                double frac;
-               if (deltaLon == 0 && deltaLat == 0) 
-                       frac = 0;
-               else 
-                       frac = ((pLon - aLon) * deltaLon + (pLat - aLat) * 
deltaLat) / (deltaLon * deltaLon + deltaLat * deltaLat);
+               if (deltaLon == 0 && deltaLat == 0){ 
+                       frac = 0; 
+               }
+               else {
+                       // scale for longitude deltas by cosine of average 
latitude  
+                       double scale = Math.cos(Coord.int30ToRadians((aLat + 
bLat + pLat) / 3) );
+                       double deltaLonAP = scale * (pLon - aLon);
+                       deltaLon = scale * deltaLon;
+                       if (deltaLon == 0 && deltaLat == 0)
+                               frac = 0;
+                       else 
+                               frac = (deltaLonAP * deltaLon + (pLat - aLat) * 
deltaLat) / (deltaLon * deltaLon + deltaLat * deltaLat);
+               }
 
                double distance;
                if (frac <= 0) {
diff --git a/src/uk/me/parabola/mkgmap/build/MapBuilder.java 
b/src/uk/me/parabola/mkgmap/build/MapBuilder.java
index 49a9aaf..5273ad5 100644
--- a/src/uk/me/parabola/mkgmap/build/MapBuilder.java
+++ b/src/uk/me/parabola/mkgmap/build/MapBuilder.java
@@ -686,9 +686,10 @@ public class MapBuilder implements Configurable {
                                                log.debug("ADD parent-subdiv", 
parent, srcDivPair.getSource(), ", z=", zoom, " new=", div);
                                        nextList.add(new SourceSubdiv(area, 
div));
                                }
-
-                               Subdivision lastdiv = 
nextList.get(nextList.size() - 1).getSubdiv();
-                               lastdiv.setLast(true);
+                               if (nextList.size() > 0){
+                                       Subdivision lastdiv = 
nextList.get(nextList.size() - 1).getSubdiv();
+                                       lastdiv.setLast(true);
+                               }
                        }
 
                        srcList = nextList;
diff --git a/src/uk/me/parabola/mkgmap/general/MapElement.java 
b/src/uk/me/parabola/mkgmap/general/MapElement.java
index ecefca0..fad3240 100644
--- a/src/uk/me/parabola/mkgmap/general/MapElement.java
+++ b/src/uk/me/parabola/mkgmap/general/MapElement.java
@@ -78,6 +78,15 @@ public abstract class MapElement {
                this.labels[0] = name;
        }
 
+       public void add2Name(String name) {
+               for (int i = 1; i < 4; i++) {
+                       if (this.labels[i] == null) {
+                               this.labels[i] = name;
+                               break;
+                       }
+               }
+       }
+
        public void setLabels(String[] labels) {
                this.labels = Arrays.copyOf(labels, 4);
        }
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java 
b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
index bbc6093..a11ea4d 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
@@ -169,17 +169,6 @@ public class StyledConverter implements OsmConverter {
                housenumberGenerator = new HousenumberGenerator(props);
                
                driveOn = props.getProperty("drive-on", null);
-               if (driveOn == null){
-                       // support legacy options --drive-on-left and 
--drive-on-right
-                       boolean dol = props.getProperty("drive-on-left", false);
-                       boolean dor = props.getProperty("drive-on-right", 
false);
-                       if (dol && dor)
-                               throw new ExitException("options drive-on-left 
and drive-on-right and mutually exclusive");
-                       if (dol)
-                               driveOn = "left";
-                       if (dor)
-                               driveOn = "right";
-               }
                if (driveOn == null)
                        driveOn = "detect,right";
                switch (driveOn) {
@@ -196,7 +185,7 @@ public class StyledConverter implements OsmConverter {
                default:
                        throw new ExitException("invalid parameters for option 
drive-on:"+driveOn);
                }
-               
+                       
                checkRoundabouts = props.getProperty("check-roundabouts",false);
                reportDeadEnds = props.getProperty("report-dead-ends", 1);  
                
@@ -612,12 +601,6 @@ public class StyledConverter implements OsmConverter {
                }
                roads = null;
 
-               // at this point the check-roundabout option might have changed 
the driveOn value 
-//             if ("left".equals(driveOn) && !ignoreDriveOn){
-//                     NODHeader.setDriveOnLeft(true);
-//                     TREHeader.setDriveOnLeft(true);
-//             }
-
                for(Relation relation : throughRouteRelations) {
                        Node node = null;
                        Way w1 = null;
@@ -697,7 +680,7 @@ public class StyledConverter implements OsmConverter {
                        }
                        log.info("detected value for driving on left flag 
is:",dol);                    
                } else {
-                       driveOnLeft = ("left".equals(driveOn));
+                       dol = ("left".equals(driveOn));
                        // warn if user given flag is obviously wrong
                        if ("left".equals(driveOn) && numDriveOnLeftRoads == 0 
&& numDriveOnRightRoads > 0)
                                log.warn("The drive-on-left flag is set but 
tile contains only drive-on-right roads");
diff --git 
a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java 
b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
index 13c7aa2..b9d8950 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
@@ -509,12 +509,10 @@ public class HousenumberGenerator {
         * @return {@code true} point lies on the left side; {@code false} 
point lies on the right side
         */
        private static boolean isLeft(Coord spoint1, Coord spoint2, Coord 
point) {
-               
-               boolean left =  ((spoint2.getLongitude() - 
spoint1.getLongitude())
-                               * (point.getLatitude() - spoint1.getLatitude()) 
- (spoint2.getLatitude() - spoint1
-                               .getLatitude()) * (point.getLongitude() - 
spoint1.getLongitude())) > 0;
-
-                               return left;
+               return ((spoint2.getHighPrecLon() - spoint1.getHighPrecLon())
+                               * (point.getHighPrecLat() - 
spoint1.getHighPrecLat()) - (spoint2
+                               .getHighPrecLat() - spoint1.getHighPrecLat())
+                               * (point.getHighPrecLon() - 
spoint1.getHighPrecLon())) > 0;
        }
        
        /**
@@ -531,7 +529,7 @@ public class HousenumberGenerator {
                } else if (frac >= 1) {
                        return spoint2.distance(point);
                } else {
-                       return spoint1.makeBetweenPoint(spoint2, 
frac).distance(point);
+                       return point.distToLineSegment(spoint1, spoint2);
                }
 
        }
@@ -544,17 +542,27 @@ public class HousenumberGenerator {
         * @return the fraction
         */
        private static double getFrac(Coord spoint1, Coord spoint2, Coord 
point) {
+               int aLon = spoint1.getHighPrecLon();
+               int bLon = spoint2.getHighPrecLon();
+               int pLon = point.getHighPrecLon();
+               int aLat = spoint1.getHighPrecLat();
+               int bLat = spoint2.getHighPrecLat();
+               int pLat = point.getHighPrecLat();
+               
+               double deltaLon = bLon - aLon;
+               double deltaLat = bLat - aLat;
 
-               double dx = spoint2.getLongitude() - spoint1.getLongitude();
-               double dy = spoint2.getLatitude() - spoint1.getLatitude();
-
-               if ((dx == 0) && (dy == 0)) {
+               if (deltaLon == 0 && deltaLat == 0) 
                        return 0;
+               else {
+                       // scale for longitude deltas by cosine of average 
latitude  
+                       double scale = Math.cos(Coord.int30ToRadians((aLat + 
bLat + pLat) / 3) );
+                       double deltaLonAP = scale * (pLon - aLon);
+                       deltaLon = scale * deltaLon;
+                       if (deltaLon == 0 && deltaLat == 0)
+                               return 0;
+                       else 
+                               return (deltaLonAP * deltaLon + (pLat - aLat) * 
deltaLat) / (deltaLon * deltaLon + deltaLat * deltaLat);
                }
-
-               return ((point.getLongitude() - spoint1.getLongitude()) * dx + 
(point
-                               .getLatitude() - spoint1.getLatitude()) * dy)
-                               / (dx * dx + dy * dy);
-
        }
 }
diff --git a/src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java 
b/src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
index a001070..c6f5386 100644
--- a/src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
+++ b/src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
@@ -484,6 +484,8 @@ public class PolishMapDataSource extends 
MapperBasedMapDataSource implements Loa
        private boolean isCommonValue(MapElement elem, String name, String 
value) {
                if (name.equals("Label")) {
                        elem.setName(unescape(recode(value)));
+               } else if (name.equals("Label2") || name.equals("Label3")) {
+                       elem.add2Name(unescape(recode(value)));
                } else if (name.equals("Levels") || name.equals("EndLevel") || 
name.equals("LevelsNumber")) {
                        try {
                                endLevel = Integer.valueOf(value);
@@ -503,7 +505,7 @@ public class PolishMapDataSource extends 
MapperBasedMapDataSource implements Loa
                } else if (name.equals("Phone")) {
                  elem.setPhone(recode(value));                 
                } else if (name.equals("CountryName")) {
-                 elem.setCountry(recode(value));
+                 elem.setCountry(unescape(recode(value)));
                } else if (name.equals("RegionName")) {
                        //System.out.println("RegionName " + value);
                  elem.setRegion(recode(value));                                
diff --git a/src/uk/me/parabola/mkgmap/reader/polish/RoadHelper.java 
b/src/uk/me/parabola/mkgmap/reader/polish/RoadHelper.java
index 73bb9b6..4ee46d1 100644
--- a/src/uk/me/parabola/mkgmap/reader/polish/RoadHelper.java
+++ b/src/uk/me/parabola/mkgmap/reader/polish/RoadHelper.java
@@ -101,8 +101,8 @@ class RoadHelper {
                        roadClass = 0;
                if (roadClass > 4)
                        roadClass = 4;
-               oneway = Integer.parseInt(f[2]) > 0;
-               toll = Integer.parseInt(f[3]) > 0;
+               oneway = (f.length > 2) ? Integer.parseInt(f[2]) > 0: false;
+               toll = (f.length > 3) ? Integer.parseInt(f[3]) > 0: false;
                byte noAccess = 0;
                for (int j = 0; j < f.length - 4; j++){
                        if (Integer.parseInt(f[4+j]) == 0)
diff --git a/test/func/SimpleTest.java b/test/func/SimpleTest.java
index f93a24d..824b77e 100644
--- a/test/func/SimpleTest.java
+++ b/test/func/SimpleTest.java
@@ -113,7 +113,7 @@ public class SimpleTest extends Base {
                                break;
                        case "LBL":
                                count++;
-                               assertEquals("LBL size", 989, size);
+                               assertEquals("LBL size", 999, size);
                                break;
                        }
                }
diff --git a/test/func/route/SimpleRouteTest.java 
b/test/func/route/SimpleRouteTest.java
index c9df2ba..81f3e07 100644
--- a/test/func/route/SimpleRouteTest.java
+++ b/test/func/route/SimpleRouteTest.java
@@ -104,11 +104,11 @@ public class SimpleRouteTest extends Base {
                                break;
                        case "LBL":
                                count++;
-                               assertEquals("LBL size", 989, size);
+                               assertEquals("LBL size", 999, size);
                                break;
                        case "NET":
                                count++;
-                               assertEquals("NET size", 1280, size);
+                               assertEquals("NET size", 1301, size);
                                break;
                        case "NOD":
                                count++;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/mkgmap.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to