Ignore:
Timestamp:
2015-11-05T13:43:10+01:00 (10 years ago)
Author:
malcolmh
Message:

[seachart] updates

File:
1 edited

Legend:

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

    r31722 r31731  
    4747                public double lon;      // Longitude in radians
    4848                public Nflag flg;               // Role of node
     49                public double val;      // Optional value
    4950
    5051                public Snode() {
     
    5253                        lat = 0;
    5354                        lon = 0;
     55                        val = 0;
    5456                }
    5557                public Snode(double ilat, double ilon) {
     
    5759                        lat = ilat;
    5860                        lon = ilon;
     61                        val = 0;
    5962                }
    6063                public Snode(double ilat, double ilon, Nflag iflg) {
     
    6265                        lon = ilon;
    6366                        flg = iflg;
    64                 }
    65         }
    66 
    67         public class Dnode extends Snode {      // All depth soundings
    68                 public double val;      // Sounding value
    69 
    70                 public Dnode() {
    71                         flg = Nflag.DPTH;
    72                         lat = 0;
    73                         lon = 0;
    7467                        val = 0;
    7568                }
    76                 public Dnode(double ilat, double ilon, double ival) {
     69                public Snode(double ilat, double ilon, double ival) {
    7770                        flg = Nflag.DPTH;
    7871                        lat = ilat;
     
    8174                }
    8275        }
    83        
     76
    8477        public class Edge {             // A polyline segment
    8578                public long first;      // First CONN node
     
    207200       
    208201        public class Feature {
     202                public long id;                         // Ref for this feature
    209203                public Rflag reln;              // Relationship status
    210204                public Geom geom;                       // Geometry data
     
    215209
    216210                Feature() {
     211                        id = 0;
    217212                        reln = Rflag.UNKN;
    218213                        geom = new Geom(Pflag.NOSP);
     
    261256
    262257        public void newNode(long id, double lat, double lon, double depth) {
    263                 nodes.put(id, new Dnode(Math.toRadians(lat), Math.toRadians(lon), depth));
     258                nodes.put(id, new Snode(Math.toRadians(lat), Math.toRadians(lon), depth));
    264259        }
    265260
     
    271266                if (obj == Obj.BOYWTW)
    272267                        obj = Obj.BOYLAT;
    273                 if (obj == Obj.C_AGGR)
    274                         feature.reln = Rflag.UNKN;
    275268                feature.geom = new Geom(p);
    276269                feature.type = obj;
    277270                if (obj != Obj.UNKOBJ) {
    278271                        index.put(id, feature);
     272                        feature.id = id;
    279273                }
    280274        }
     
    378372                nodes.put(id, node);
    379373                feature = new Feature();
     374                feature.id = id;
    380375                feature.reln = Rflag.UNKN;
    381376                feature.geom.prim = Pflag.POINT;
     
    387382        public void addEdge(long id) {
    388383                feature = new Feature();
     384                feature.id = id;
    389385                feature.reln = Rflag.UNKN;
    390386                feature.geom.prim = Pflag.LINE;
     
    408404        public void addArea(long id) {
    409405                feature = new Feature();
     406                feature.id = id;
    410407                feature.reln = Rflag.UNKN;
    411408                feature.geom.prim = Pflag.AREA;
     
    445442                                }
    446443                                AttVal<?> attval = S57val.convertValue(val, att);
    447                                 if (attval.val != null)
     444                                if (attval.val != null) {
     445                                        if (att == Att.VALSOU) {
     446                                                Snode node = nodes.get(feature.geom.elems.get(0).id);
     447                                                node.val = (double) attval.val;
     448                                        }
    448449                                        atts.put(att, attval);
     450                                }
    449451                        } else {
    450452                                if (subkeys[1].equals("type")) {
     
    461463                                                objs.put(0, atts);
    462464                                        }
     465                                        if ((obj == Obj.SOUNDG) && (feature.geom.prim == Pflag.POINT)) {
     466                                                Snode node = nodes.get(feature.geom.elems.get(0).id);
     467                                                node.flg = Nflag.DPTH;
     468                                        }
    463469                                } else {
    464470                                        Att att = S57att.enumAttribute(subkeys[1], Obj.UNKOBJ);
     
    485491                case POINT:
    486492                        Snode node = nodes.get(id);
    487                         if (node.flg != Nflag.CONN) {
     493                        if ((node.flg != Nflag.CONN) && (node.flg != Nflag.DPTH) && (!feature.objs.isEmpty())) {
    488494                                node.flg = Nflag.ISOL;
    489495                        }
Note: See TracChangeset for help on using the changeset viewer.