Exemple #1
0
        public override void Parse(string[] data)
        {
            int index = 1;

            this.Id = data[index++];
            int.TryParse(data[index++], out this.SourceId);
            this.Time = DateTime.Parse(data[index++]);
            double x = 0;

            double.TryParse(data[index++], out x);
            double y = 0;

            double.TryParse(data[index++], out y);
            this.Shape = new GeoPointShape(x, y);
            double.TryParse(data[index++], out this.SOG);
            double.TryParse(data[index++], out this.COG);
            bool.TryParse(data[index++], out this.Lost);
            int.TryParse(data[index++], out this.RateOfTurn);
            double.TryParse(data[index++], out this.Orientation);
            double.TryParse(data[index++], out this.Length);
            double.TryParse(data[index++], out this.Breadth);
            double.TryParse(data[index++], out this.Altitude);
            this.NavStatus     = (NavStatuses)Enum.Parse(typeof(NavStatuses), data[index++]);
            this.UpdSensorType = (UpdSensor)Enum.Parse(typeof(UpdSensor), data[index++]);
            bool.TryParse(data[index++], out this.ATONOffPos);
            this.StaticId   = data[index++];
            this.SourceName = data[index++];
            this.Source     = (SourceTypes)Enum.Parse(typeof(SourceTypes), data[index++]);
            //this.Callsign = data[index++];
            this.Callsign = EncodeStr.Decode(data[index++]);
            //this.ShipName = data[index++];
            this.ShipName   = EncodeStr.Decode(data[index++]);
            this.ObjectType = (ObjectTypes)Enum.Parse(typeof(ObjectTypes), data[index++]);
            this.ShipType   = (ShipTypes)Enum.Parse(typeof(ShipTypes), data[index++]);
            int.TryParse(data[index++], out this.IMO);
            int.TryParse(data[index++], out this.MMSI);
            this.ATONType = (ATONTypes)Enum.Parse(typeof(ATONTypes), data[index++]);
            this.ATONName = data[index++];
            int.TryParse(data[index++], out this.AntPosDistFromFront);
            int.TryParse(data[index++], out this.AntPosDistFromLeft);
            this.NatLangShipName = data[index++];
            this.PortOfRegistry  = data[index++];
            this.CountryFlag     = data[index++];
            double.TryParse(data[index++], out this.MaxAirDraught);
            double.TryParse(data[index++], out this.MaxDraught);
            bool.TryParse(data[index++], out this.DeepWaterVesselind);
            this.VoyageId  = data[index++];
            this.CargoType = (CargoTypes)Enum.Parse(typeof(CargoTypes), data[index++]);
            //this.Destination = data[index++];
            this.Destination = EncodeStr.Decode(data[index++]);
            DateTime.TryParse(data[index++], out this.ETA);
            DateTime.TryParse(data[index++], out this.ATA);
            double.TryParse(data[index++], out this.AirDraught);
            double.TryParse(data[index++], out this.Draught);
            if (index < data.Length)
            {
                this.GID = data[index++];
            }
            if (index < data.Length)
            {
                this.FID = data[index++];
            }
        }
Exemple #2
0
        public override string Format()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("ATLAS2,");
            sb.Append(DataTime.ToString());
            sb.Append(",");
            sb.Append(TrackId);
            sb.Append(",");
            sb.Append(Status);
            sb.Append(",");
            //sb.Append(Name);
            sb.Append(EncodeStr.Encode(Name));
            sb.Append(",");
            sb.Append(ShortName);
            sb.Append(",");
            //5
            sb.Append(CallSign);
            sb.Append(",");
            sb.Append(ShipType);
            sb.Append(",");
            sb.Append(Length);
            sb.Append(",");
            sb.Append(Width);
            sb.Append(",");
            sb.Append(Lon.ToString("F6"));
            sb.Append(",");
            //10
            sb.Append(Lat.ToString("F6"));
            sb.Append(",");
            sb.Append(COG.ToString("F1"));
            sb.Append(",");
            sb.Append(SOG.ToString("F1"));
            sb.Append(",");
            sb.Append(Heading);
            sb.Append(",");
            sb.Append(TimeLastUpdate.ToString());
            sb.Append(",");
            //15
            sb.Append(ObjType);
            sb.Append(",");
            sb.Append(TargetType);
            sb.Append(",");
            sb.Append(PilotStatus);
            sb.Append(",");
            sb.Append(Rating);
            sb.Append(",");
            sb.Append(LabelColorIndex);
            sb.Append(",");
            //20
            sb.Append(Category);
            sb.Append(",");
            sb.Append(MMSI);
            sb.Append(",");
            sb.Append(TransponderState);
            sb.Append(",");
            sb.Append(DBTrackId);
            sb.Append(",");
            sb.Append(Draught);
            sb.Append(",");
            //25
            //sb.Append(InfoTxt);
            sb.Append(EncodeStr.Encode(InfoTxt));
            sb.Append(",");
            sb.Append(ETA);
            sb.Append(",");
            sb.Append(ETAEndPoint);
            sb.Append(",");
            sb.Append(RateOfTurn);
            sb.Append(",");
            sb.Append(AISNavStatus);
            sb.Append(",");
            //30
            sb.Append(AISRateOfTurn);
            sb.Append(",");
            sb.Append(AISSOG);
            sb.Append(",");
            sb.Append(AISLatitude);
            sb.Append(",");
            sb.Append(AISLongitude);
            sb.Append(",");
            sb.Append(AISCOG);
            sb.Append(",");
            //35
            sb.Append(AISTrueHeading);
            sb.Append(",");
            sb.Append(AISETA);
            sb.Append(",");
            sb.Append(AISDraught);
            sb.Append(",");
            sb.Append(AISTimeOfLastUpdate);
            sb.Append(",");
            sb.Append(Time.ToString());
            sb.Append(",");
            //40
            sb.Append(GID);
            sb.Append(",");
            sb.Append(FID);
            sb.Append(",");
            string result = sb.ToString();

            return(result);
        }
Exemple #3
0
        public override string Format()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("HITT,");
            sb.Append(this.Id);
            sb.Append(",");
            sb.Append(this.SourceId);
            sb.Append(",");
            sb.Append(this.Time.ToString());
            sb.Append(",");
            sb.Append(this.Lon.ToString("F6"));
            sb.Append(",");
            sb.Append(this.Lat.ToString("F6"));
            sb.Append(",");
            sb.Append(this.SOG.ToString("F1"));
            sb.Append(",");
            sb.Append(this.COG.ToString("F1"));
            sb.Append(",");
            sb.Append(this.Lost);
            sb.Append(",");
            sb.Append(this.RateOfTurn);
            sb.Append(",");
            sb.Append(this.Orientation);
            sb.Append(",");
            sb.Append(this.Length);
            sb.Append(",");
            sb.Append(this.Breadth);
            sb.Append(",");
            sb.Append(this.Altitude);
            sb.Append(",");
            sb.Append(this.NavStatus.ToString());
            sb.Append(",");
            sb.Append(this.UpdSensorType.ToString());
            sb.Append(",");
            sb.Append(this.ATONOffPos);
            sb.Append(",");
            sb.Append(this.StaticId);
            sb.Append(",");
            sb.Append(this.SourceName);
            sb.Append(",");
            sb.Append(this.Source);
            sb.Append(",");
            //sb.Append(this.Callsign);
            sb.Append(EncodeStr.Encode(this.Callsign));
            sb.Append(",");
            //sb.Append(this.ShipName);
            sb.Append(EncodeStr.Encode(this.ShipName));
            sb.Append(",");
            sb.Append(this.ObjectType.ToString());
            sb.Append(",");
            sb.Append(this.ShipType.ToString());
            sb.Append(",");
            sb.Append(this.IMO);
            sb.Append(",");
            sb.Append(this.MMSI);
            sb.Append(",");
            sb.Append(this.ATONType.ToString());
            sb.Append(",");
            sb.Append(this.ATONName);
            sb.Append(",");
            sb.Append(this.AntPosDistFromFront);
            sb.Append(",");
            sb.Append(this.AntPosDistFromLeft);
            sb.Append(",");
            sb.Append(this.NatLangShipName);
            sb.Append(",");
            sb.Append(this.PortOfRegistry);
            sb.Append(",");
            sb.Append(this.CountryFlag);
            sb.Append(",");
            sb.Append(this.MaxAirDraught);
            sb.Append(",");
            sb.Append(this.MaxDraught);
            sb.Append(",");
            sb.Append(this.DeepWaterVesselind);
            sb.Append(",");
            sb.Append(this.VoyageId);
            sb.Append(",");
            sb.Append(this.CargoType.ToString());
            sb.Append(",");
            //sb.Append(this.Destination);
            sb.Append(EncodeStr.Encode(this.Destination));
            sb.Append(",");
            sb.Append(this.ETA.ToString());
            sb.Append(",");
            sb.Append(this.ATA.ToString());
            sb.Append(",");
            sb.Append(this.AirDraught);
            sb.Append(",");
            sb.Append(this.Draught);
            sb.Append(",");
            sb.Append(GID);
            sb.Append(",");
            sb.Append(FID);
            sb.Append(",");
            string result = sb.ToString();

            return(result);
        }
Exemple #4
0
        public override void Parse(string[] data)
        {
            int index = 1;

            DataTime = DateTime.Parse(data[index++]);
            int.TryParse(data[index++], out TrackId);
            int.TryParse(data[index++], out Status);
            Name      = EncodeStr.Decode(data[index++]);
            ShortName = data[index++];
            //5
            CallSign = data[index++];
            int.TryParse(data[index++], out ShipType);
            int.TryParse(data[index++], out Length);
            int.TryParse(data[index++], out Width);
            double x = 0;

            double.TryParse(data[index++], out x);
            //10
            double y = 0;

            double.TryParse(data[index++], out y);
            Shape = new GeoPointShape(x, y);
            double.TryParse(data[index++], out COG);
            double.TryParse(data[index++], out SOG);
            int.TryParse(data[index++], out Heading);
            TimeLastUpdate = DateTime.Parse(data[index++]);
            //15
            ObjType = (ObjTypes)Enum.Parse(typeof(ObjTypes), data[index++]);
            int.TryParse(data[index++], out TargetType);
            int.TryParse(data[index++], out PilotStatus);
            int.TryParse(data[index++], out Rating);
            int.TryParse(data[index++], out LabelColorIndex);
            //20
            int.TryParse(data[index++], out Category);
            int.TryParse(data[index++], out MMSI);
            int.TryParse(data[index++], out TransponderState);
            int.TryParse(data[index++], out DBTrackId);
            double.TryParse(data[index++], out Draught);
            //25
            InfoTxt = EncodeStr.Decode(data[index++]);
            double.TryParse(data[index++], out ETA);
            double.TryParse(data[index++], out ETAEndPoint);
            double.TryParse(data[index++], out RateOfTurn);
            int.TryParse(data[index++], out AISNavStatus);
            //30
            int.TryParse(data[index++], out AISRateOfTurn);
            int.TryParse(data[index++], out AISSOG);
            int.TryParse(data[index++], out AISLatitude);
            int.TryParse(data[index++], out AISLongitude);
            int.TryParse(data[index++], out AISCOG);
            //35
            int heading = 511;

            if (int.TryParse(data[index++], out heading))
            {
                AISTrueHeading = heading;
            }
            int.TryParse(data[index++], out AISETA);
            double.TryParse(data[index++], out AISDraught);
            double.TryParse(data[index++], out AISTimeOfLastUpdate);
            Time = DateTime.Parse(data[index++]);
            //40
            if (index < data.Length)
            {
                this.GID = data[index++];
            }
            if (index < data.Length)
            {
                this.FID = data[index++];
            }

            Id = GetID();
        }