Ignore:
Timestamp:
2013-12-26T14:18:04+01:00 (11 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

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

    r30150 r30152  
    11package s57;
     2
     3import java.util.EnumMap;
    24
    35public class S57dat {
    46       
    5         private enum S57field { DSID, DSSI, DSPM, DSPR, DSRC, DSHT, DSAC, CATD, CATX, DDDF, DDDR, DDDI, DDOM, DDRF, DDSI, DDSC,
     7        public enum Dom { BT, GT, DG, DATE, INT, REAL, AN, HEX, CL }
     8       
     9        public static class S57conv {
     10                int asc;        // 0=A(), 1+=A(n)
     11                int bin;        // 0=ASCII, +ve=b1n, -ve=b2n
     12                Dom dom;        // S57 data domain
     13                S57conv(int a, int b, Dom d) {
     14                        asc = a; bin = b; dom = d;
     15                }
     16        }
     17       
     18        public enum S57field { DSID, DSSI, DSPM, DSPR, DSRC, DSHT, DSAC, CATD, CATX, DDDF, DDDR, DDDI, DDOM, DDRF, DDSI, DDSC,
    619                FRID, FOID, ATTF, NATF, FFPC, FFPT, FSPC, FSPT, VRID, ATTV, VRPC, VRPT, SGCC, SG2D, SG3D, ARCC, AR2D, EL2D, CT2D }
    7         private enum S57dsid { RCNM, RCID, EXPP, INTU, DSNM, EDTN, UPDN, UADT, ISDT, STED, PRSP, PSDN, PRED, PROF, AGEN, COMT }
    8         private enum S57dssi { DSTR, AALL, NALL, NOMR, NOCR, NOGR, NOLR, NOIN, NOCN, NOED, NOFA }
    9         private enum S57dspm { RCNM, RCID, HDAT, VDAT, SDAT, CSCL, DUNO, HUNI, PUNI, COUN, COMF, SOMF, COMT }
    10         private enum S57dspr { PROJ, PRP1, PRP2, PRP3, PRP4, FEAS, FNOR, FPMF, COMT }
    11         private enum S57dsrc { RPID, RYCO, RXCO, CURP, FPMF, RXVL, RYVL, COMT }
    12         private enum S57dsht { RCNM, RCID, PRCO, ESDT, LSDT, DCRT, CODT, COMT }
    13         private enum S57dsac { RCNM, RCID, PACC, HACC, SACC, FPMF, COMT }
    14         private enum S57catd { RCNM, RCID, FILE, LFIL, VOLM, IMPL, SLAT, WLON, NLAT, ELON, CRCS, COMT }
    15         private enum S57catx { RCNM, RCID, NAM1, NAM2, COMT }
    16         private enum S57dddf { RCNM, RCID, OORA, OAAC, OACO, OALL, OATY, DEFN, AUTH, COMT }
    17         private enum S57dddr { RFTP, RFVL }
    18         private enum S57dddi { RCNM, RCID, ATLB, ATDO, ADMU, ADFT, AUTH, COMT }
    19         private enum S57ddom { RAVA, DVAL, DVSD, DEFN, AUTH }
    20         private enum S57ddrf { RFTP, RFVL }
    21         private enum S57ddsi { RCNM, RCID, OBLB }
    22         private enum S57ddsc { ATLB, ASET, AUTH }
    23         private enum S57frid { RCNM, RCID, PRIM, GRUP, OBJL, RVER, RUIN }
    24         private enum S57foid { AGEN, FIDN, FIDS }
    25         private enum S57attf { ATTL, ATVL }
    26         private enum S57natf { ATTL, ATVL }
    27         private enum S57ffpc { FFUI, FFIX, NFPT }
    28         private enum S57ffpt { LNAM, RIND, COMT }
    29         private enum S57fspc { FSUI, FSIX, NSPT }
    30         private enum S57fspt { NAME, ORNT, USAG, MASK }
    31         private enum S57vrid { RCNM, RCID, RVER, RUIN }
    32         private enum S57attv { ATTL, ATVL }
    33         private enum S57vrpc { VPUI, VPIX, NVPT }
    34         private enum S57vrpt { NAME, ORNT, USAG, TOPI, MASK }
    35         private enum S57sgcc { CCUI, CCIX, CCNC }
    36         private enum S57sg2d { YCOO, XCOO }
    37         private enum S57sg3d { YCOO, XCOO, VE3D }
    38         private enum S57arcc { ATYP, SURF, ORDR, RESO, FPMF }
    39         private enum S57ar2d { STPT, CTPT, ENPT, YCOO, XCOO }
    40         private enum S57el2d { STPT, CTPT, ENPT, CDPM, CDPR, YCOO, XCOO }
    41         private enum S57ct2d { YCOO, XCOO }
     20        public enum S57dsid { RCNM, RCID, EXPP, INTU, DSNM, EDTN, UPDN, UADT, ISDT, STED, PRSP, PSDN, PRED, PROF, AGEN, COMT }
     21        public enum S57dssi { DSTR, AALL, NALL, NOMR, NOCR, NOGR, NOLR, NOIN, NOCN, NOED, NOFA }
     22        public enum S57dspm { RCNM, RCID, HDAT, VDAT, SDAT, CSCL, DUNO, HUNI, PUNI, COUN, COMF, SOMF, COMT }
     23        public enum S57dspr { PROJ, PRP1, PRP2, PRP3, PRP4, FEAS, FNOR, FPMF, COMT }
     24        public enum S57dsrc { RPID, RYCO, RXCO, CURP, FPMF, RXVL, RYVL, COMT }
     25        public enum S57dsht { RCNM, RCID, PRCO, ESDT, LSDT, DCRT, CODT, COMT }
     26        public enum S57dsac { RCNM, RCID, PACC, HACC, SACC, FPMF, COMT }
     27        public enum S57catd { RCNM, RCID, FILE, LFIL, VOLM, IMPL, SLAT, WLON, NLAT, ELON, CRCS, COMT }
     28        public enum S57catx { RCNM, RCID, NAM1, NAM2, COMT }
     29        public enum S57dddf { RCNM, RCID, OORA, OAAC, OACO, OALL, OATY, DEFN, AUTH, COMT }
     30        public enum S57dddr { RFTP, RFVL }
     31        public enum S57dddi { RCNM, RCID, ATLB, ATDO, ADMU, ADFT, AUTH, COMT }
     32        public enum S57ddom { RAVA, DVAL, DVSD, DEFN, AUTH }
     33        public enum S57ddrf { RFTP, RFVL }
     34        public enum S57ddsi { RCNM, RCID, OBLB }
     35        public enum S57ddsc { ATLB, ASET, AUTH }
     36        public enum S57frid { RCNM, RCID, PRIM, GRUP, OBJL, RVER, RUIN }
     37        public enum S57foid { AGEN, FIDN, FIDS }
     38        public enum S57attf { ATTL, ATVL }
     39        public enum S57natf { ATTL, ATVL }
     40        public enum S57ffpc { FFUI, FFIX, NFPT }
     41        public enum S57ffpt { LNAM, RIND, COMT }
     42        public enum S57fspc { FSUI, FSIX, NSPT }
     43        public enum S57fspt { NAME, ORNT, USAG, MASK }
     44        public enum S57vrid { RCNM, RCID, RVER, RUIN }
     45        public enum S57attv { ATTL, ATVL }
     46        public enum S57vrpc { VPUI, VPIX, NVPT }
     47        public enum S57vrpt { NAME, ORNT, USAG, TOPI, MASK }
     48        public enum S57sgcc { CCUI, CCIX, CCNC }
     49        public enum S57sg2d { YCOO, XCOO }
     50        public enum S57sg3d { YCOO, XCOO, VE3D }
     51        public enum S57arcc { ATYP, SURF, ORDR, RESO, FPMF }
     52        public enum S57ar2d { STPT, CTPT, ENPT, YCOO, XCOO }
     53        public enum S57el2d { STPT, CTPT, ENPT, CDPM, CDPR, YCOO, XCOO }
     54        public enum S57ct2d { YCOO, XCOO }
    4255       
     56        public enum S57subf { RCNM, RCID, EXPP, INTU, DSNM, EDTN, UPDN, UADT, ISDT, STED, PRSP, PSDN, PRED, PROF, AGEN, COMT, DSTR, AALL, NALL,
     57                NOMR, NOCR, NOGR, NOLR, NOIN, NOCN, NOED, NOFA, HDAT, VDAT, SDAT, CSCL, DUNI, HUNI, PUNI, COUN, COMF, SOMF, PROJ, PRP1, PRP2, PRP3, PRP4,
     58                FEAS, FNOR, FPMF, RPID, RYCO, RXCO, CURP, RXVL, RYVL, PRCO, ESDT, LSDT, DCRT, CODT, PACC, HACC, SACC, FILE, LFIL, VOLM, IMPL, SLAT, WLON, NLAT, ELON,
     59                CRCS, NAM1, NAM2, OORA, OAAC, OACO, OALL, OATY, DEFN, AUTH, RFTP, RFVL, ATLB, ATDO, ADMU, ADFT, RAVA, DVAL, DVSD, OBLB, ASET, PRIM, GRUP, RVER, RUIN,
     60                FIDN, FIDS, ATTL, ATVL, FFUI, FFIX, NFPT, LNAM, RIND, FSUI, FSIX, NSPT, NAME, ORNT, USAG, MASK, VPUI, VPIX, NVPT, TOPI, CCUI, CCIX, CCNC, YCOO, XCOO,
     61                VE3D, ATYP, SURF, ORDR, RESO, STPT, CTPT, ENPT, CDPM, CDPR }
     62
     63        private static final EnumMap<S57subf, S57conv> convs = new EnumMap<S57subf, S57conv>(S57subf.class);
     64        static {
     65                convs.put(S57subf.RCNM, new S57conv(2,1,Dom.AN)); convs.put(S57subf.RCID, new S57conv(10,4,Dom.INT)); convs.put(S57subf.EXPP, new S57conv(1,1,Dom.AN));
     66                convs.put(S57subf.INTU, new S57conv(1,1,Dom.INT)); convs.put(S57subf.DSNM, new S57conv(0,0,Dom.BT)); convs.put(S57subf.EDTN, new S57conv(0,0,Dom.BT));
     67                convs.put(S57subf.UPDN, new S57conv(0,0,Dom.BT)); convs.put(S57subf.UADT, new S57conv(8,0,Dom.DATE)); convs.put(S57subf.ISDT, new S57conv(8,0,Dom.DATE));
     68                convs.put(S57subf.STED, new S57conv(4,0,Dom.REAL)); convs.put(S57subf.PRSP, new S57conv(3,1,Dom.AN)); convs.put(S57subf.PSDN, new S57conv(0,0,Dom.BT));
     69                convs.put(S57subf.PRED, new S57conv(0,0,Dom.BT)); convs.put(S57subf.PROF, new S57conv(2,1,Dom.AN)); convs.put(S57subf.AGEN, new S57conv(2,2,Dom.AN));
     70                convs.put(S57subf.COMT, new S57conv(0,0,Dom.BT)); convs.put(S57subf.DSTR, new S57conv(2,1,Dom.AN)); convs.put(S57subf.AALL, new S57conv(1,1,Dom.INT));
     71                convs.put(S57subf.NALL, new S57conv(1,1,Dom.INT)); convs.put(S57subf.NOMR, new S57conv(0,4,Dom.INT)); convs.put(S57subf.NOCR, new S57conv(0,4,Dom.INT));
     72                convs.put(S57subf.NOGR, new S57conv(0,4,Dom.INT)); convs.put(S57subf.NOLR, new S57conv(0,4,Dom.INT)); convs.put(S57subf.NOIN, new S57conv(0,4,Dom.INT));
     73                convs.put(S57subf.NOCN, new S57conv(0,4,Dom.INT)); convs.put(S57subf.NOED, new S57conv(0,4,Dom.INT)); convs.put(S57subf.NOFA, new S57conv(0,4,Dom.INT));
     74                convs.put(S57subf.HDAT, new S57conv(3,1,Dom.INT)); convs.put(S57subf.VDAT, new S57conv(2,1,Dom.INT)); convs.put(S57subf.SDAT, new S57conv(2,1,Dom.INT));
     75                convs.put(S57subf.CSCL, new S57conv(0,4,Dom.INT)); convs.put(S57subf.DUNI, new S57conv(2,1,Dom.INT)); convs.put(S57subf.HUNI, new S57conv(2,1,Dom.INT));
     76                convs.put(S57subf.PUNI, new S57conv(2,1,Dom.INT)); convs.put(S57subf.COUN, new S57conv(2,1,Dom.AN)); convs.put(S57subf.COMF, new S57conv(0,4,Dom.INT));
     77                convs.put(S57subf.SOMF, new S57conv(0,4,Dom.INT)); convs.put(S57subf.PROJ, new S57conv(3,1,Dom.AN)); convs.put(S57subf.PRP1, new S57conv(0,-4,Dom.REAL));
     78                convs.put(S57subf.PRP2, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.PRP3, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.PRP4, new S57conv(0,-4,Dom.REAL));
     79                convs.put(S57subf.FEAS, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.FNOR, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.FPMF, new S57conv(0,4,Dom.INT));
     80                convs.put(S57subf.RPID, new S57conv(1,1,Dom.DG)); convs.put(S57subf.RYCO, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.RXCO, new S57conv(0,-4,Dom.REAL));
     81                convs.put(S57subf.CURP, new S57conv(2,1,Dom.AN)); convs.put(S57subf.RXVL, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.RYVL, new S57conv(0,-4,Dom.REAL));
     82                convs.put(S57subf.PRCO, new S57conv(2,2,Dom.AN)); convs.put(S57subf.ESDT, new S57conv(8,0,Dom.DATE)); convs.put(S57subf.LSDT, new S57conv(8,0,Dom.DATE));
     83                convs.put(S57subf.DCRT, new S57conv(0,0,Dom.BT)); convs.put(S57subf.CODT, new S57conv(8,0,Dom.DATE)); convs.put(S57subf.PACC, new S57conv(0,4,Dom.REAL));
     84                convs.put(S57subf.HACC, new S57conv(0,4,Dom.REAL)); convs.put(S57subf.SACC, new S57conv(0,4,Dom.REAL)); convs.put(S57subf.FILE, new S57conv(0,0,Dom.BT));
     85                convs.put(S57subf.LFIL, new S57conv(0,0,Dom.BT)); convs.put(S57subf.VOLM, new S57conv(0,0,Dom.BT)); convs.put(S57subf.IMPL, new S57conv(3,0,Dom.AN));
     86                convs.put(S57subf.SLAT, new S57conv(0,0,Dom.REAL)); convs.put(S57subf.WLON, new S57conv(0,0,Dom.REAL)); convs.put(S57subf.NLAT, new S57conv(0,0,Dom.REAL));
     87                convs.put(S57subf.ELON, new S57conv(0,0,Dom.REAL)); convs.put(S57subf.CRCS, new S57conv(0,0,Dom.HEX)); convs.put(S57subf.NAM1, new S57conv(12,5,Dom.AN));
     88                convs.put(S57subf.NAM2, new S57conv(12,5,Dom.AN)); convs.put(S57subf.OORA, new S57conv(1,1,Dom.AN)); convs.put(S57subf.OAAC, new S57conv(6,0,Dom.BT));
     89                convs.put(S57subf.OACO, new S57conv(5,2,Dom.INT)); convs.put(S57subf.OALL, new S57conv(0,0,Dom.BT)); convs.put(S57subf.OATY, new S57conv(1,1,Dom.AN));
     90                convs.put(S57subf.DEFN, new S57conv(0,0,Dom.BT)); convs.put(S57subf.AUTH, new S57conv(2,2,Dom.AN)); convs.put(S57subf.RFTP, new S57conv(2,1,Dom.AN));
     91                convs.put(S57subf.RFVL, new S57conv(0,0,Dom.BT)); convs.put(S57subf.ATLB, new S57conv(5,2,Dom.INT)); convs.put(S57subf.ATDO, new S57conv(1,1,Dom.AN));
     92                convs.put(S57subf.ADMU, new S57conv(0,0,Dom.BT)); convs.put(S57subf.ADFT, new S57conv(0,0,Dom.BT)); convs.put(S57subf.RAVA, new S57conv(1,1,Dom.AN));
     93                convs.put(S57subf.DVAL, new S57conv(0,0,Dom.BT)); convs.put(S57subf.DVSD, new S57conv(0,0,Dom.BT)); convs.put(S57subf.OBLB, new S57conv(5,2,Dom.INT));
     94                convs.put(S57subf.ASET, new S57conv(1,1,Dom.AN)); convs.put(S57subf.PRIM, new S57conv(1,1,Dom.AN)); convs.put(S57subf.GRUP, new S57conv(3,1,Dom.INT));
     95                convs.put(S57subf.RVER, new S57conv(3,2,Dom.INT)); convs.put(S57subf.RUIN, new S57conv(1,1,Dom.AN)); convs.put(S57subf.FIDN, new S57conv(10,4,Dom.INT));
     96                convs.put(S57subf.FIDS, new S57conv(5,2,Dom.INT)); convs.put(S57subf.ATTL, new S57conv(5,2,Dom.INT)); convs.put(S57subf.ATVL, new S57conv(0,0,Dom.GT));
     97                convs.put(S57subf.FFUI, new S57conv(1,1,Dom.AN)); convs.put(S57subf.FFIX, new S57conv(0,2,Dom.INT)); convs.put(S57subf.NFPT, new S57conv(0,2,Dom.INT));
     98                convs.put(S57subf.LNAM, new S57conv(17,8,Dom.AN)); convs.put(S57subf.RIND, new S57conv(0,1,Dom.AN)); convs.put(S57subf.FSUI, new S57conv(1,1,Dom.AN));
     99                convs.put(S57subf.FSIX, new S57conv(0,2,Dom.INT)); convs.put(S57subf.NSPT, new S57conv(0,2,Dom.INT)); convs.put(S57subf.NAME, new S57conv(12,5,Dom.AN));
     100                convs.put(S57subf.ORNT, new S57conv(1,1,Dom.AN)); convs.put(S57subf.USAG, new S57conv(1,1,Dom.AN)); convs.put(S57subf.MASK, new S57conv(1,1,Dom.AN));
     101                convs.put(S57subf.VPUI, new S57conv(1,1,Dom.AN)); convs.put(S57subf.VPIX, new S57conv(0,2,Dom.INT)); convs.put(S57subf.NVPT, new S57conv(0,2,Dom.INT));
     102                convs.put(S57subf.TOPI, new S57conv(1,1,Dom.AN)); convs.put(S57subf.CCUI, new S57conv(1,1,Dom.AN)); convs.put(S57subf.CCIX, new S57conv(0,2,Dom.INT));
     103                convs.put(S57subf.CCNC, new S57conv(0,2,Dom.INT)); convs.put(S57subf.YCOO, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.XCOO, new S57conv(0,-4,Dom.REAL));
     104                convs.put(S57subf.VE3D, new S57conv(0,-4,Dom.REAL)); convs.put(S57subf.ATYP, new S57conv(1,1,Dom.AN)); convs.put(S57subf.SURF, new S57conv(1,1,Dom.AN));
     105                convs.put(S57subf.ORDR, new S57conv(1,1,Dom.INT)); convs.put(S57subf.RESO, new S57conv(0,4,Dom.REAL)); convs.put(S57subf.STPT, new S57conv(0,0,Dom.CL));
     106                convs.put(S57subf.CTPT, new S57conv(0,0,Dom.CL)); convs.put(S57subf.ENPT, new S57conv(0,0,Dom.CL)); convs.put(S57subf.CDPM, new S57conv(0,0,Dom.CL));
     107                convs.put(S57subf.CDPR, new S57conv(0,0,Dom.CL));
     108        }
     109
    43110}
Note: See TracChangeset for help on using the changeset viewer.