Ignore:
Timestamp:
2015-02-20T12:34:09+01:00 (9 years ago)
Author:
malcolmh
Message:

cope with missing nodes

Location:
applications/editors/josm/plugins/seachart
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java

    r31028 r31031  
    210210                }
    211211               
    212 //              img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
    213                 Rectangle rect = new Rectangle(2048, 2048);
     212                int size = 256;
     213                for (int i = 0; i < (12 - zoom); i++) size *= 2;
     214                Rectangle rect = new Rectangle(size, size);
    214215                img = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_ARGB);
    215216                Renderer.reRender(img.createGraphics(), rect, zoom, 0.05, map, context);
     
    218219//              empty = bos.size();
    219220//              tile(zoom, 1, 0, 0);
    220                 FileOutputStream fos = new FileOutputStream(dstdir + "tst_" + zoom + ".png");
     221                FileOutputStream fos = new FileOutputStream(dstdir + "tst_" + zoom + "-" + xtile + "-" + ytile + ".png");
    221222                bos.writeTo(fos);
    222223                fos.close();
     
    232233//                      svgGenerator.translate(-256, -256);
    233234                        Renderer.reRender(svgGenerator, rect, zoom, 0.05, map, context);
    234                         svgGenerator.stream(dstdir + "tst_" + zoom + ".svg");
     235                        svgGenerator.stream(dstdir + "tst_" + zoom + "-" + xtile + "-" + ytile + ".svg");
    235236//              }
    236237        }
  • applications/editors/josm/plugins/seachart/src/render/Renderer.java

    r31028 r31031  
    195195                                        git.nextEdge();
    196196                                        while (git.hasNode()) {
     197                                                Snode node = git.next();
     198                                                if (node == null) continue;
    197199                                                prev = next;
    198                                                 next = context.getPoint(git.next());
     200                                                next = context.getPoint(node);
    199201                                                angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX());
    200202                                                piv = true;
     
    265267                                }
    266268                                while (git.hasNode()) {
    267                                         point = context.getPoint(git.next());
     269                                        Snode node = git.next();
     270                                        if (node == null) continue;
     271                                        point = context.getPoint(node);
    268272                                        p.lineTo(point.getX(), point.getY());
    269273                                }
     
    343347                                        p.moveTo(point.getX(), point.getY());
    344348                                        while (git.hasNode()) {
    345                                                 point = context.getPoint(git.next());
     349                                                Snode node = git.next();
     350                                                if (node == null) continue;
     351                                                point = context.getPoint(node);
    346352                                                p.lineTo(point.getX(), point.getY());
    347353                                        }
     
    492498                                        git.nextEdge();
    493499                                        while (git.hasNode()) {
     500                                                Snode node = git.next();
     501                                                if (node == null) continue;
    494502                                                prev = next;
    495                                                 next = context.getPoint(git.next());
     503                                                next = context.getPoint(node);
    496504                                                angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX());
    497505                                                piv = true;
  • applications/editors/josm/plugins/seachart/src/s57/S57map.java

    r31028 r31031  
    942942                                while (git.hasNode()) {
    943943                                        node = git.next();
    944                                         if (node != null) {
    945                                                 llon = lon;
    946                                                 llat = lat;
    947                                                 lat = node.lat;
    948                                                 lon = node.lon;
    949                                                 sigma += (lon * Math.sin(llat)) - (llon * Math.sin(lat));
    950                                         }
     944                                        if (node == null) continue;
     945                                        llon = lon;
     946                                        llat = lat;
     947                                        lat = node.lat;
     948                                        lon = node.lon;
     949                                        sigma += (lon * Math.sin(llat)) - (llon * Math.sin(lat));
    951950                                }
    952951                        }
     
    10091008                                        while (git.hasNode()) {
    10101009                                                Snode node = git.next();
     1010                                                if (node == null) continue;
    10111011                                                lat = node.lat;
    10121012                                                lon = node.lon;
     
    10311031                                        while (git.hasNode()) {
    10321032                                                Snode node = git.next();
     1033                                                if (node == null) continue;
    10331034                                                lat = node.lat;
    10341035                                                lon = node.lon;
Note: See TracChangeset for help on using the changeset viewer.