Ignore:
Timestamp:
2014-01-05T14:28:30+01:00 (12 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/s57/S57map.java

    r30157 r30183  
    1313
    1414import s57.S57att;
    15 import s57.S57val.AttVal;
    1615import s57.S57att.*;
    1716import s57.S57obj;
     
    2524                ANON,   // Edge inner nodes
    2625                ISOL,   // Node not part of Edge
    27                 CONN    // Edge first and last nodes
     26                CONN,   // Edge first and last nodes
     27                DPTH    // Sounding nodes
    2828        }
    2929
     
    5050        }
    5151
     52        public class Dnode extends Snode {      // All depth soundings
     53                public double val;      // Sounding value
     54
     55                public Dnode() {
     56                        flg = Nflag.DPTH;
     57                        lat = 0;
     58                        lon = 0;
     59                        val = 0;
     60                }
     61                public Dnode(double ilat, double ilon, double ival) {
     62                        flg = Nflag.DPTH;
     63                        lat = ilat;
     64                        lon = ilon;
     65                        val = ival;
     66                }
     67        }
     68       
    5269        public class Edge {             // A polyline segment
    5370                public long first;      // First CONN node
     
    157174        public class Feature {
    158175                public Fflag flag;
    159                 public long refs;
     176                public long id;
    160177                public Obj type;
    161178                public AttMap atts;
     
    167184                Feature() {
    168185                        flag = Fflag.UNKN;
    169                         refs = 0;
     186                        id = 0;
    170187                        type = Obj.UNKOBJ;
    171188                        atts = new AttMap();
     
    287304                nodes.put(id, new Snode(Math.toRadians(lat), Math.toRadians(lon)));
    288305                feature = new Feature();
    289                 feature.refs = id;
     306                feature.id = id;
    290307                feature.flag = Fflag.POINT;
    291308                edge = null;
    292309        }
    293310
     311        public void addNode(long id, double lat, double lon, double depth) {
     312                nodes.put(id, new Dnode(Math.toRadians(lat), Math.toRadians(lon), depth));
     313                feature = new Feature();
     314                feature.id = id;
     315                feature.flag = Fflag.POINT;
     316                edge = null;
     317        }
     318
    294319        public void addEdge(long id) {
    295320                feature = new Feature();
    296                 feature.refs = id;
     321                feature.id = id;
    297322                feature.flag = Fflag.LINE;
    298323                edge = new Edge();
     
    312337        public void addArea(long id) {
    313338                feature = new Feature();
    314                 feature.refs = id;
     339                feature.id = id;
    315340                feature.flag = Fflag.AREA;
    316341                outers = new ArrayList<Long>();
     
    505530                switch (feature.flag) {
    506531                case POINT:
    507                         return nodes.get(feature.refs);
     532                        return nodes.get(feature.id);
    508533                case LINE:
    509                         Edge edge = edges.get(feature.refs);
     534                        Edge edge = edges.get(feature.id);
    510535                        EdgeIterator eit = new EdgeIterator(edge, true);
    511536                        while (eit.hasNext()) {
     
    542567                        return new Snode(llat + ((lat - llat) * harc / sarc), llon + ((lon - llon) * harc / sarc));
    543568                case AREA:
    544                         Bound bound = areas.get(feature.refs).get(0);
     569                        Bound bound = areas.get(feature.id).get(0);
    545570                        BoundIterator bit = new BoundIterator(bound);
    546571                        while (bit.hasNext()) {
Note: See TracChangeset for help on using the changeset viewer.