Ejemplo n.º 1
0
        public static Type GetDataType(GpsType type)
        {
            switch (type)
            {
            case GpsType.File:
                return(typeof(FileGpsInfo));

            case GpsType.ComPort:
                return(typeof(ComPortInfo));

            case GpsType.Gpsd:
                return(typeof(GpsdInfo));

            case GpsType.WindowsLocationApi:
                return(typeof(WindowsLocationApiInfo));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 2
0
        public static BaseGpsClient Create(GpsType type)
        {
            switch (type)
            {
            case GpsType.File:
                return(new FileGpsClient(new FileGpsInfo()));

            case GpsType.ComPort:
                return(new ComPortGpsClient(new ComPortInfo()));

            case GpsType.Gpsd:
                return(new GpsdGpsClient(new GpsdInfo()));

            case GpsType.WindowsLocationApi:
                return(new WindowsLocationApiGpsClient(new WindowsLocationApiInfo()));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 3
0
 public GpsConvert(Gps _v, GpsType type)
 {
     if (type == GpsType.Wgs84)
     {
         Wgs84 = _v;
         Wgs84ToDfm();
         Wgs84ToGcj02();
         Gcj02ToBd09();
     }
     else if (type == GpsType.Gcj02)
     {
         Gcj02 = _v;
         Gcj02ToWgs84();
         Wgs84ToDfm();
         Gcj02ToBd09();
     }
     else if (type == GpsType.Bd09)
     {
         Bd09 = _v;
         Bd09ToGcj02();
         Gcj02ToWgs84();
         Wgs84ToDfm();
     }
 }
Ejemplo n.º 4
0
        public static BaseGpsInfo Create(GpsType type)
        {
            var dataType = GetDataType(type);

            return((BaseGpsInfo)Activator.CreateInstance(dataType));
        }
Ejemplo n.º 5
0
 protected BaseGpsClient(GpsType gpsType, BaseGpsInfo gpsInfo)
 {
     GpsType = gpsType;
     GpsInfo = gpsInfo;
 }
Ejemplo n.º 6
0
 public GpsService(GpsType gpsServiceType)
 {
     _client = GpsClientFactory.Create(gpsServiceType);
 }