Example #1
0
        public void Constructor__CreatesPointWithEmptyPositionAndNullTimestamp()
        {
            var target = new GpsPoint();

            Assert.Equal(Coordinate.Empty, target.Position);
            Assert.Null(target.Timestamp);
        }
Example #2
0
        public void Constructor_Coordinate_CreatesPointWithPositionAndNullTimestamp()
        {
            var target = new GpsPoint(_coordinate);

            Assert.Equal(_coordinate, target.Position);
            Assert.Null(target.Timestamp);
        }
Example #3
0
        // pomnoži koordinate točke s koeficijentom za ispravnu veličinu rute (scaling)

        /// <summary>
        /// Corrects the position of the point by a calculated offset
        /// </summary>
        /// <param name="point">Input point</param>
        /// <returns>Correctly positioned point after offset is applied</returns>
        private static GpsPoint DislocatePointByFactor(GpsPoint point)
        {
            point.Lon *= _scalingFactorX;
            point.Lat *= _scalingFactorY;

            return(point);
        }
Example #4
0
        private bool AddPoint(GpsPoint point)
        {
            if (point == null)
            {
                return(false);
            }

            // first point added by default
            if (filteredTrack.PointCount == 0)
            {
                filteredTrack.AddPoint(point);
                return(true);
            }
            // check to see if teh maximum time has elapsed, if so add the point no matter what the distance
            else if (point.Time - filteredTrack.Points.Last().Time > maxTimeSeconds)
            {
                filteredTrack.AddPoint(point);
                return(true);
            }
            // finally only add teh point if the min distance is exceeded
            else if (TimeDistanceFilter.Distance(point, filteredTrack.Points.Last()) > minDistanceMiles)
            {
                filteredTrack.AddPoint(point);
                return(true);
            }

            return(false);
        }
Example #5
0
 public GeoObject(string marker, GpsPoint gps, string popupText, int id)
 {
     Marker    = marker;
     GpsPoint  = gps;
     PopupText = popupText;
     Id        = id;
 }
Example #6
0
        void AddMarker(GMapOverlay markersOverlay, GpsPoint point, GMarkerGoogleType mark)
        {
            GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(point.Latitude.Value, point.Longitude.Value),
                                                     mark);

            markersOverlay.Markers.Add(marker);
        }
Example #7
0
 public TransposerParams(ImgPoint imgA, ImgPoint imgB, GpsPoint gpsA, GpsPoint gpsB, int step)
 {
     _imgStartPoint = imgA;
     _imgEndPoint   = imgB;
     _gpsStartPoint = gpsA;
     _gpsEndPoint   = gpsB;
     _stepLength    = step;
 }
Example #8
0
        public void CacluatesDistanceBetweenTwoGpsPointsCorrectly()
        {
            GpsPoint gps1 = new GpsPoint(40.25, -76.83);
            GpsPoint gps2 = new GpsPoint(41.26549647088418, -75.46848847257391);

            // Should be around 100 miles
            Assert.AreEqual(100 * GpsPoint.METERSPERMILE, 1, gps1.GetDistanceToPoint(gps2));
        }
Example #9
0
        public void Constructor_LonLatElevationTimestamp_CreatesPointWithPositionAndTimestamp()
        {
            var timestamp = DateTime.Now;
            var target    = new GpsPoint(_xOrdinate, _yOrdinate, _zOrdinate, timestamp);

            Assert.Equal(_coordinate, target.Position);
            Assert.Equal(timestamp, target.Timestamp);
        }
        public bool MoveToPoint(GpsPoint point)
        {
            if (point != null)
            {
                return(Host.MoveTo(point.x, point.y, point.z));
            }

            return(false);
        }
Example #11
0
 /// <summary>
 /// set props from Creature object
 /// </summary>
 /// <param name="p"></param>
 public void SetPoint(GpsPoint p)
 {
     this.X      = p.x;
     this.Y      = p.y;
     this.Z      = p.z;
     this.name   = p.name;
     this.type   = 5;
     this.radius = 1; // why no radius in GpsPoint if it exists in db?
 }
Example #12
0
        /// <summary>
        /// Transposes a GPS point into a coordinate system point
        /// </summary>
        /// <param name="point">GPS point</param>
        /// <returns>Transposed point for coordinate system</returns>
        private static GpsPoint TransposePoint(GpsPoint point)
        {
            double factorX = _maxLng < 0 ? Math.Abs(_maxLng) : _maxLng * -1;
            double factorY = _maxLat < 0 ? Math.Abs(_maxLat) : _maxLat * -1;

            point.Lon += factorX;
            point.Lat  = Math.Abs(point.Lat + factorY);

            return(point);
        }
Example #13
0
        public void CacluatesDestinationGpsPointCorrectly()
        {
            GpsPoint gps = new GpsPoint(40.25, -76.83);

            // Go 100 miles in a NE bearing
            GpsPoint dest = gps.GetDestinationPoint(45, 100 * GpsPoint.METERSPERMILE);

            Assert.AreEqual(41.26549647088418, dest.Latitude, 14);
            Assert.AreEqual(-75.46848847257391, dest.Longitude, 14);
        }
Example #14
0
        /// <summary> 
        /// Imports a DxfFile that is in the specified Format. Any changes on the import schema may cause Errors!
        /// </summary>
        /// <param name="filepath"></param>
        public static void importFromDxf(string filepath, string DB_PATH)
        {
            StreamReader sr = new StreamReader(filepath);
            DatabaseDataContext dataContext = new DatabaseDataContext(DB_PATH);
            foreach (t_PolygonPoint tp in dataContext.t_PolygonPoints)
            {
                dataContext.t_PolygonPoints.DeleteOnSubmit(tp);
            }
               ///dataContext.t_PolygonPoints.DeleteAllOnSubmit(dataContext.t_PolygonPoints.ToList());
            dataContext.SubmitChanges();
            dataContext.t_Polygons.DeleteAllOnSubmit(dataContext.t_Polygons);
            dataContext.SubmitChanges();
            int id = 1;

            List<string> lineList = new List<string>();
            while (!sr.EndOfStream)
            {
                lineList.Add(sr.ReadLine());
            }
            string[] lines = lineList.ToArray();
            for (int i = 1; i < lines.Length; i++) //Looping through Array, starting with 1 (lines[0] is "0")
            {
                //Find Lines Containing a new Element Definition
                if (lines[i] == "LWPOLYLINE" && lines[i - 1] == "  0") //
                {
                    //Reading out Layer ( "8" [\n] layerName) = Type of Element
                    if (lines[i + 5] == "  8" && lines[i + 6].Contains("PROH")) // "Prohibited Zone" = ForbiddenZone
                    {
                        if (lines[i + 9] == " 90")
                        {
                            int numberOfVertexes = int.Parse(lines[i + 10]);
                            t_Polygon p = new t_Polygon();
                            p.ID = id++;

                            for (int j = 0; j < numberOfVertexes; j++)
                            {
                                t_PolygonPoint point = new t_PolygonPoint();
                                GpsPoint gp = new GpsPoint(double.Parse(lines[i + (j * 4) + 18], NumberFormatInfo.InvariantInfo) * 1000, double.Parse(lines[i + (j * 4) + 16], NumberFormatInfo.InvariantInfo) * 1000, GpsPointFormatImport.Swiss);
                                point.longitude = (decimal)gp.Longitude;
                                point.latitude = (decimal)gp.Latitude;
                                point.ID_Polygon = p.ID;
                                dataContext.t_PolygonPoints.InsertOnSubmit(point);
                            }
                            dataContext.t_Polygons.InsertOnSubmit(p);
                        }
                    }
                }
            }

            dataContext.SubmitChanges();
        }
Example #15
0
 private void gpsPreMove(GpsPoint point)
 {
     CheckBadBosses();
     host.commonModule.CheckSealedEquips();
     while (host.farmModule.aggroMobsCount() > 0 && host.me.isAlive())
     {
         Thread.Sleep(300);
     }
     while (regenBetweenGpsMoves && host.farmModule.aggroMobsCount() == 0 && host.me.isAlive() && (host.me.hpp < 65 || host.me.mpp < 40))
     {
         Thread.Sleep(100);
     }
     host.farmModule.PickUpNearMe();
 }
        public IActionResult UpdateLocation(int idCar, [FromBody] GpsPoint gpsPoint)
        {
            var car = _dbContext.FireCars.FirstOrDefault(c => c.Id == idCar);

            if (car == null)
            {
                return(NotFound("Car not found."));
            }
            _dbContext.GpsPoints.Load();
            car.GpsPoint.Lat   = gpsPoint.Lat;
            car.GpsPoint.Lon   = gpsPoint.Lon;
            car.LastUpdateTime = DateTime.Now;
            _dbContext.SaveChanges();
            return(Ok());
        }
Example #17
0
        public void TestDistance()
        {
            GpsPoint p1       = new GpsPoint(0, 87, 15);
            GpsPoint p2       = new GpsPoint(0, 32, -67);
            double   distance = TimeDistanceFilter.Distance(p1, p2);

            Assert.AreEqual(6408 * 0.621371, distance, 0.5);


            p1 = new GpsPoint(0, 50.851, 5.985);
            p2 = new GpsPoint(0, 58.148, 3.08);
            double distance2 = TimeDistanceFilter.Distance(p1, p2);

            Assert.AreEqual(832.6 * 0.621371, distance2, 0.5);
        }
        public bool MoveToPoint(GpsPoint point)
        {
            if (point != null)
            {
                if (!MeshEnabled)
                {
                    return(GpsMove(point));
                }
                else
                {
                    return(Host.MoveTo(point.x, point.y, point.z));
                }
            }

            return(false);
        }
Example #19
0
        /// <summary>
        /// Distance, in miles, between two latitude, longitude points on the Earth using the haversine formula
        /// </summary>
        /// <param name="point1"></param>
        /// <param name="point2"></param>
        /// <returns>Distance in miles</returns>
        public static double Distance(GpsPoint point1, GpsPoint point2)
        {
            double deg2rad     = Math.PI / 180.0;
            double radius      = 3959; //average Earth radius in miles
            double phi1        = point1.Latitude.Value * deg2rad;
            double phi2        = point2.Latitude.Value * deg2rad;
            double deltaPhi    = (point2.Latitude.Value - point1.Latitude.Value) * deg2rad;
            double deltalambda = (point2.Longitude.Value - point1.Longitude.Value) * deg2rad;

            double sinPhiOver2    = Math.Sin(deltaPhi / 2);
            double sinLambdaOver2 = Math.Sin(deltalambda / 2);

            double a = sinPhiOver2 * sinPhiOver2 + Math.Cos(phi1) * Math.Cos(phi2) * sinLambdaOver2 * sinLambdaOver2;
            double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));

            return(radius * c);
        }
Example #20
0
        /// <summary>
        /// Получение ретрансляционных сообщений по мере поступления
        /// </summary>
        /// <param name="token"><see cref="CancellationToken"/></param>
        /// <returns><see cref="GpsPoint"/></returns>
        public async IAsyncEnumerable <GpsPoint> Messages([EnumeratorCancellation] CancellationToken token = default)
        {
            var header = await ReadHeader(token);

            if (string.IsNullOrEmpty(header))
            {
                throw new FormatException($"The device ID is missing in the first line of the stream.");
            }

            Regex regex = new(PatternL);
            Match match = regex.Match(header);

            if (!match.Success)
            {
                throw new FormatException($"Header `{header}` in received data packet, doesn't match the format `{PatternL}`.");
            }
            var uid = match.Groups["uid"].Value;

            regex = new Regex(PatternD);
            await foreach (var message in ReadBody(token).ConfigureAwait(false))
            {
                match = regex.Match(message);
                if (!match.Success)
                {
                    throw new FormatException($"Message `{message}` in received data packet, doesn't match the format `{PatternD}`.");
                }

                var point = new GpsPoint(
                    monitoringNumber: uid,
                    time: Convert($"{match.Groups["date"].Value}{match.Groups["time"].Value}"),
                    latitude: Wgs84(double.Parse(match.Groups["lat1"].Value, CultureInfo.InvariantCulture)),
                    longitude: Wgs84(double.Parse(match.Groups["lon1"].Value, CultureInfo.InvariantCulture)),
                    speed: uint.Parse(match.Groups["speed"].Value),
                    course: uint.Parse(match.Groups["course"].Value)
                    );

                // Причина появления этого условия см. https://github.com/bars43ru/gps2Yandex/issues/11
                if ((int)point.Latitude == 90 && (int)point.Longitude == 0)
                {
                    continue;
                }

                yield return(point);
            }
        }
Example #21
0
        /// <summary>
        /// Calculates the scaling factor of a route as well as x/y offset for correct points positioning
        /// </summary>
        private static void CalculateFactorAndOffset()
        {
            GpsPoint firstGpsPoint = new GpsPoint(_params.GpsStartPoint.Lon, _params.GpsStartPoint.Lat, null);

            firstGpsPoint = TransposePoint(firstGpsPoint);

            GpsPoint lastGpsPoint = new GpsPoint(_params.GpsEndPoint.Lon, _params.GpsEndPoint.Lat, null);

            lastGpsPoint = TransposePoint(lastGpsPoint);

            _scalingFactorX = Math.Abs(_params.ImgStartPoint.X - _params.ImgEndPoint.X) / Math.Abs(firstGpsPoint.Lon - lastGpsPoint.Lon);
            _scalingFactorY = Math.Abs(_params.ImgStartPoint.Y - _params.ImgEndPoint.Y) / Math.Abs(firstGpsPoint.Lat - lastGpsPoint.Lat);

            firstGpsPoint = DislocatePointByFactor(firstGpsPoint);

            _offsetX = _params.ImgStartPoint.X > firstGpsPoint.Lon ? _params.ImgStartPoint.X - firstGpsPoint.Lon : firstGpsPoint.Lon - _params.ImgStartPoint.X;
            _offsetY = _params.ImgStartPoint.Y > firstGpsPoint.Lat ? _params.ImgStartPoint.Y - firstGpsPoint.Lat : firstGpsPoint.Lat - _params.ImgStartPoint.Y;
        }
Example #22
0
        /// <summary>Calculates distance of two positions in given unit</summary>
        /// <param name="pos1">A position</param>
        /// <param name="pos2">A position</param>
        /// <param name="unit">The unit to get result in</param>
        /// <returns>Distance between given points in given unit; 0 if <paramref name="unit"/> is not one of the <see cref="OpenNETCF.IO.Serial.GPS.Units"/> values.</returns>
        /// <exception cref="ArgumentException"><see cref="Latitude"/> or <paramref name="Longitude"/> of <paramref name="pos1"/> or <paramref name="pos2"/> is null.</exception>
        public static decimal CalculateDistance(GpsPosition pos1, GpsPosition pos2, OpenNETCF.IO.Serial.GPS.Units unit)
        {
            if (!pos1.Longitude.HasValue || !pos1.Latitude.HasValue)
            {
                throw new ArgumentException(GPSTracka.Properties.Resources.err_PositionIsNull, "pos1");
            }
            if (!pos2.Longitude.HasValue || !pos2.Latitude.HasValue)
            {
                throw new ArgumentException(GPSTracka.Properties.Resources.err_PositionIsNull, "pos2");
            }
            var ret = GpsPoint.CalculateDistance(new GpsPoint(pos1.Latitude.Value, pos1.Longitude.Value, pos1.Altitude), new GpsPoint(pos2.Latitude.Value, pos1.Longitude.Value, pos2.Altitude));

            switch (unit)
            {
            case OpenNETCF.IO.Serial.GPS.Units.Kilometers: return(ret);

            case OpenNETCF.IO.Serial.GPS.Units.Knots: return(ret / 1.85200m);

            case OpenNETCF.IO.Serial.GPS.Units.Miles: return(ret / 1.609344m);

            default: throw new ArgumentException("Invalid enum argument");
            }
        }
Example #23
0
    private void LoadData()
    {
        if (tracks != null) {
            return;
        }

        JSONObject json = new JSONObject (asset.text);

        var nodesJson = JSONHelper.getByKey (json, "nodes").list;
        var nodeMap = new Dictionary<long, Node> ();
        foreach (JSONObject n in nodesJson) {
            Node node = new Node (n);
            nodeMap [node.id] = node;
        }

        var tracksJson = JSONHelper.getByKey (json, "tracks").list;
        tracks = new List<Track> ();
        foreach (JSONObject t in tracksJson) {
            tracks.Add (new Track (t, nodeMap));
        }

        var runJson = JSONHelper.getByKey (json, "run");
        var gpsPointsJson = JSONHelper.getByKey (runJson, "gpsPoints").list;
        gpsPoints = new List<GpsPoint> ();
        foreach (JSONObject g in gpsPointsJson) {
            GpsPoint gpsPoint = new GpsPoint (g);
            gpsPoints.Add (gpsPoint);
            gpsPoint.absoluteTime = (gpsPoint.timeStamp - gpsPoints [0].timeStamp) / 1000.0;
        }

        origin = gpsPoints [0];
        Node.origin = origin;
        Debug.Log ("origin: " + origin.lat + " " + origin.lon + " " + origin.ele);

        GpsPoint last = null;
        foreach (GpsPoint g in gpsPoints) {
            if (last != null) {
                last.updateRotation (g);
            }
            last = g;
        }

        List<Vector3> vectors = new List<Vector3> ();
        List<int> triangles = new List<int> ();

        int count = 0;
        last = null;
        foreach (GpsPoint g in gpsPoints) {
            if (last != null) {
                float width = 1.5f / 2.0f;
                float h = 2.0f;

                Vector3 centerLast = last.project ();
                Vector3 leftLast = centerLast + (last.rotation * new Vector3 (-width, -h, 0));
                Vector3 rightLast = centerLast + (last.rotation * new Vector3 (width, -h, 0));

                Vector3 center = g.project ();
                Vector3 left = center + (g.rotation * new Vector3 (-width, -h, 0));
                Vector3 right = center + (g.rotation * new Vector3 (width, -h, 0));

                vectors.Add (right);
                vectors.Add (rightLast);
                vectors.Add (leftLast);

                vectors.Add (right);
                vectors.Add (leftLast);
                vectors.Add (left);

                triangles.Add (count++);
                triangles.Add (count++);
                triangles.Add (count++);
                triangles.Add (count++);
                triangles.Add (count++);
                triangles.Add (count++);

                //Instantiate (trackProfile, Vector3.zero, Quaternion.identity);
            }
            last = g;
        }

        //		Mesh mesh = new Mesh ();
        //		GetComponent<MeshFilter> ().mesh = mesh;
        //		mesh.vertices = vectors.ToArray ();
        //		mesh.uv = new Vector2[]{};
        //		mesh.triangles = triangles.ToArray ();
    }
 public double DistToPoint(GpsPoint point)
 {
     return((point != null) ? Host.dist(point.x, point.y, point.z) : 0);
 }
Example #25
0
 /// <summary>Class constructor overload</summary><param name="s">GpsPoint type poin</param><seealso cref="Jungler.Bot.Classes.GpsPoint"/>
 public Point3D(GpsPoint s)
 {
     SetPoint(s);
 }
Example #26
0
        /// <summary>
        /// Optimizes the distance between points so that too dense and too sparse areas of points are evened-out.
        /// </summary>
        private static void PointDistanceOptimization()
        {
            GpsPoint lastPushed = new GpsPoint();
            GpsPoint current    = new GpsPoint();

            for (int i = 0; i < GpsPoints.Count; i++)
            {
                current     = TransposePoint(GpsPoints[i]);
                current     = DislocatePointByFactor(current);
                current.Lon = Math.Abs(current.Lon) + _offsetX;
                current.Lat = Math.Abs(current.Lat) + _offsetY;

                // check if this is the last point of the list to optimize, if yes then add it and break the loop
                if (Math.Sqrt(Math.Pow(current.Lon - _params.ImgEndPoint.X, 2) + Math.Pow(current.Lat - _params.ImgEndPoint.Y, 2)) < _params.StepLength / 1000)
                {
                    if (i == GpsPoints.Count - 1)
                    {
                        current.Lon = _params.ImgEndPoint.X;
                        current.Lat = _params.ImgEndPoint.Y;
                        _imgPoints.Add(new ImgPoint(current.Lon, current.Lat, current.Elev));
                        break;
                    }
                }

                if (i == 0)
                {
                    lastPushed = current;
                    _imgPoints.Add(new ImgPoint(lastPushed.Lon, lastPushed.Lat, lastPushed.Elev));
                }
                else
                {
                    double distPx      = Math.Sqrt(Math.Pow(current.Lon - lastPushed.Lon, 2) + Math.Pow(current.Lat - lastPushed.Lat, 2)); // distance between the current and the preceeding point
                    double angle       = Math.Acos(Math.Abs(current.Lon - lastPushed.Lon) / distPx);                                       // angle between the current and the preceeding point
                    double distPxRnded = Math.Round(distPx * 1000);

                    double   offsetX = Math.Cos(angle) * (_params.StepLength / 1000);
                    double   offsetY = Math.Sin(angle) * (_params.StepLength / 1000);
                    GpsPoint filler  = new GpsPoint();

                    if (distPxRnded >= _params.StepLength && distPxRnded < 2 * _params.StepLength)
                    {
                        // acceptable point distance, add the point to the list
                        lastPushed = current;
                        _imgPoints.Add(new ImgPoint(lastPushed.Lon, lastPushed.Lat, lastPushed.Elev));
                    }
                    else if (distPxRnded >= 2 * _params.StepLength)
                    {
                        // add additional points to fill up too scarse area of points
                        if (lastPushed.Lon == current.Lon)                              // if the points are on the same vertical line
                        {
                            filler.Lon  = lastPushed.Lon;
                            filler.Lat  = lastPushed.Lat < current.Lat ? lastPushed.Lat + _params.StepLength / 1000 : lastPushed.Lat - _params.StepLength / 1000;
                            filler.Elev = lastPushed.Elev;

                            lastPushed = filler;
                            _imgPoints.Add(new ImgPoint(lastPushed.Lon, lastPushed.Lat, lastPushed.Elev));
                        }
                        else if (lastPushed.Lat == current.Lat)  // if the points are on the same horizontal line
                        {
                            filler.Lat  = lastPushed.Lat;
                            filler.Lon  = lastPushed.Lon < current.Lon ? lastPushed.Lon + _params.StepLength / 1000 : lastPushed.Lon - _params.StepLength / 1000;
                            filler.Elev = lastPushed.Elev;

                            lastPushed = filler;
                            _imgPoints.Add(new ImgPoint(lastPushed.Lon, lastPushed.Lat, lastPushed.Elev));
                        }
                        else
                        {
                            // calculate and add the "filler" point
                            do
                            {
                                filler.Lon  = lastPushed.Lon < current.Lon ? lastPushed.Lon + offsetX : lastPushed.Lon - offsetX;
                                filler.Lat  = lastPushed.Lat < current.Lat ? lastPushed.Lat + offsetY : lastPushed.Lat - offsetY;
                                filler.Elev = lastPushed.Elev;

                                lastPushed = filler;
                                _imgPoints.Add(new ImgPoint(lastPushed.Lon, lastPushed.Lat, lastPushed.Elev));

                                distPx      = Math.Sqrt(Math.Pow(current.Lon - lastPushed.Lon, 2) + Math.Pow(current.Lat - lastPushed.Lat, 2));
                                distPxRnded = Math.Round(distPx * 1000);
                            } while (distPxRnded >= 2 * _params.StepLength);
                        }
                    }
                }
            }
        }
Example #27
0
        public string GetCarPoint(string id, string type)
        {
            string sn        = "";
            string startTime = "";
            string endTime   = "";
            string Url       = new DataItemDetailBLL().GetItemValue("IOTUrl");

            switch (type)
            {
            case "0":
                break;

            case "1":
                break;

            case "2":
                break;

            case "3":
                var visitcar = visitbll.GetEntity(id);
                sn = visitcar.GPSID;
                if (visitcar.InTime != null)
                {
                    startTime = Convert.ToDateTime(visitcar.InTime).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }

                if (visitcar.OutTime != null)
                {
                    endTime = Convert.ToDateTime(visitcar.InTime).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }

                break;

            case "4":
                var opercar = operbll.GetEntity(id);
                sn = opercar.GpsId;
                if (opercar.Getdata != null)
                {
                    startTime = Convert.ToDateTime(opercar.Getdata).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }

                if (opercar.OutDate != null)
                {
                    endTime = Convert.ToDateTime(opercar.OutDate).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }
                break;

            case "5":
                var hazardouscar = hazarbll.GetEntity(id);
                sn = hazardouscar.GPSID;
                if (hazardouscar.InTime != null)
                {
                    startTime = Convert.ToDateTime(hazardouscar.InTime).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }

                if (hazardouscar.OutTime != null)
                {
                    endTime = Convert.ToDateTime(hazardouscar.InTime).ToString("yyyy-MM-ddTHH:mm:ss");
                }
                else
                {
                    endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
                }
                break;
            }
            string          json      = "{\"sn\": \"" + sn + "\",\"startTime\": \"" + startTime + "\",\"endTime\": \"" + endTime + "\"}";
            string          msg       = HttpCommon.HttpPostJson(Url + "/services/app/GpsCar/GetDeviceGpsData", json);
            IotCar          car       = JsonConvert.DeserializeObject <IotCar>(msg);
            GpsList         gps       = new GpsList();
            List <GpsPoint> PointList = new List <GpsPoint>();

            foreach (var carGpsData in car.result)
            {
                GpsPoint point = new GpsPoint();
                point.X = Convert.ToDouble(carGpsData.Latitude);
                point.Y = Convert.ToDouble(carGpsData.Longitude);
                point.Z = 200;
                PointList.Add(point);
            }

            gps.ID   = id;
            gps.data = PointList;
            return(gps.ToJson());
        }
Example #28
0
 /// <summary>Class constructor overload</summary><param name="s">GpsPoint type poin</param><seealso cref="Jungler.Bot.Classes.GpsPoint"/>
 public Point3D(GpsPoint s)
 {
     SetPoint(s);
 }
Example #29
0
 private double getFract(GpsPoint second, double time)
 {
     double deltaTime = second.absoluteTime - absoluteTime;
     double deltaFirst = time - absoluteTime;
     return deltaFirst / deltaTime;
 }
Example #30
0
 public bool ComeToPoint(GpsPoint point, double dist = 1, double doneDist = 1.5, Func <bool> eval = null)
 => ComeTo(point.x, point.y, point.z, dist, doneDist, eval);
Example #31
0
 private void gpsPreMove(GpsPoint point)
 {
     CheckBadBosses();
     host.commonModule.CheckSealedEquips();
     while (host.farmModule.aggroMobsCount() > 0 && host.me.isAlive())
         Thread.Sleep(300);
     while (regenBetweenGpsMoves && host.farmModule.aggroMobsCount() == 0 && host.me.isAlive() && (host.me.hpp < 65 || host.me.mpp < 40))
         Thread.Sleep(100);
     host.farmModule.PickUpNearMe();
 }
Example #32
0
 private void gps_onGpsPreMove(GpsPoint point)
 {
     // nothing left to do in here for now - probably mount support later on
 }
Example #33
0
 public Vector3 interpolatePos(GpsPoint second, double time)
 {
     return Vector3.Lerp (project (), second.project (), (float) getFract(second, time));
 }
Example #34
0
 public double MyDistanceVectorGpsPoint(Vector3F loc1, GpsPoint loc2)
 {
     return(Math.Sqrt(Math.Pow((loc1.X - loc2.X), 2) + Math.Pow((loc1.Y - loc2.Y), 2) + Math.Pow((loc1.Z - loc2.Z), 2)));
 }
Example #35
0
 /// <summary>
 /// set props from Creature object
 /// </summary>
 /// <param name="p"></param>
 public void SetPoint(GpsPoint p)
 {
     this.X = p.x;
     this.Y = p.y;
     this.Z = p.z;
     this.name = p.name;
     this.type = 5;
     this.radius = 1; // why no radius in GpsPoint if it exists in db?
 }
Example #36
0
 public Quaternion interpolateRot( GpsPoint second, double time)
 {
     return Quaternion.Lerp (rotation, second.rotation, (float) getFract(second, time));
 }
Example #37
0
 public OperatorZoneAndName(string name, GpsPoint geoZone)
 {
     Name    = name;
     GeoZone = geoZone;
 }
Example #38
0
 public void updateRotation(GpsPoint second)
 {
     rotation = getRotation (second);
 }