private bool IsInvalidMessage(string code, IGeoPoint message) { var discardReason = DiscardReason.None; if (Coche == null && !MessageIdentifierX.IsEntityMessage(code)) { discardReason = DiscardReason.NoAssignedMobile; } else if (message.GeoPoint != null && FechaInvalida(message.GeoPoint.Date, DeviceParameters)) { discardReason = DiscardReason.InvalidDate; } else if (message.GeoPoint != null && FueraDelGlobo(message.GeoPoint)) { discardReason = DiscardReason.OutOfGlobe; } else if (IsVelocidadInvalida(message)) { discardReason = DiscardReason.InvalidSpeed; } if (discardReason.Equals(DiscardReason.None)) { return(false); } DiscardEvent(code, message, discardReason); return(true); }
public void TestGetLeftBottomOffsetPoint() { IGeoPoint <double> point = _center.GetLeftBottomOffsetPoint(_pointList, 0, 0); IGeoPoint <double> expected = new GeoPoint(0.95, 0.95); AssertSamePoints(point, expected); }
private string ProcessVelocidadExcedidaGenericEvent(IGeoPoint generico) { var text = ExtraText.GetVelocidadExcedidaExtraText(generico, Coche); var chofer = GetChofer(generico.GetRiderId()); var fecha = generico.GetDateTime(); var evento = MessageSaver.Save(generico, MessageCode.SpeedingTicket.GetMessageCode(), Dispositivo, Coche, chofer, fecha, generico.GeoPoint, text, ZonaManejo); var infraccion = new Infraccion { Vehiculo = Coche, Alcanzado = generico.GeoPoint.Speed.Unpack(), CodigoInfraccion = Infraccion.Codigos.ExcesoVelocidad, Empleado = evento.Chofer, Fecha = fecha, Latitud = generico.GeoPoint.Lat, Longitud = generico.GeoPoint.Lon, FechaFin = null, LatitudFin = 0, LongitudFin = 0, Permitido = 0, Zona = ZonaManejo, FechaAlta = DateTime.UtcNow }; DaoFactory.InfraccionDAO.Save(infraccion); return(MessageCode.SpeedingTicket.GetMessageCode()); }
public void TestGetRightTopOffsetPoint() { IGeoPoint <double> point = _center.GetRightTopOffsetPoint(_pointList, 0, 0); IGeoPoint <double> expected = new GeoPoint(1.15, 1.15); AssertSamePoints(point, expected); }
public EvaluationRegion(IGeoPoint <double> leftBottom, IGeoPoint <double> rightTop, double distanceInMeter) { if ((leftBottom.Longtitute >= rightTop.Longtitute) || (leftBottom.Lattitute >= rightTop.Lattitute)) { throw new ArgumentOutOfRangeException("leftBottom"); } degreeInterval = distanceInMeter.GetDegreeInterval(); int xDimensionPoints = (int)Math.Ceiling((rightTop.Longtitute - leftBottom.Longtitute) / degreeInterval); int yDimensionPoints = (int)Math.Ceiling((rightTop.Lattitute - leftBottom.Lattitute) / degreeInterval); pointList = new MeasurePoint[xDimensionPoints * yDimensionPoints]; for (int i = 0; i < xDimensionPoints; i++) { for (int j = 0; j < yDimensionPoints; j++) { pointList[i * yDimensionPoints + j] = new MeasurePoint { Longtitute = leftBottom.Longtitute + i * degreeInterval, Lattitute = leftBottom.Lattitute + j * degreeInterval }; } } }
public static IGeoPoint <double> Move(this IGeoPoint <double> origin, double radiusInMeter, double azimuth) { var degree = radiusInMeter * 180 / 1000 / EarthRadius / Math.Cos(origin.Lattitute * Math.PI / 180); return(new GeoPoint(origin.Longtitute + degree * Math.Sin(azimuth * Math.PI / 180), origin.Lattitute + degree * Math.Cos(azimuth * Math.PI / 180))); }
public LocationManagerMock(IGeoPoint point) { this.point = point; this.timer = new Timer(_ => ping()); this.interval = new ThreadSafe <int>(Timeout.Infinite); this.listener = new ThreadSafe <ILocationListener>(); this.provider = new ThreadSafe <string>(); }
public void TestMovePoint_50m_Northwest() { GeoPoint origin = new GeoPoint(112.1, 23.1); IGeoPoint <double> point = origin.Move(50, 315); Assert.AreEqual(point.Longtitute, 112.0989140, 1E-6); Assert.AreEqual(point.Lattitute, 23.101086, 1E-6); }
public EvaluationInfrastructure(IGeoPoint<double> leftBottom, IGeoPoint<double> rightTop, IEnumerable<EvaluationOutdoorCell> cells) : this() { Region = new EvaluationRegion(leftBottom, rightTop, EvaluationSettings.DistanceInMeter); CellList = cells.Where(x => x.Height > 0).ToList(); Region.InitializeParameters(CellList, EvaluationSettings.DegreeSpan); }
public EvaluationInfrastructure(IGeoPoint <double> leftBottom, IGeoPoint <double> rightTop, IEnumerable <EvaluationOutdoorCell> cells) : this() { Region = new EvaluationRegion(leftBottom, rightTop, EvaluationSettings.DistanceInMeter); CellList = cells.Where(x => x.Height > 0).ToList(); Region.InitializeParameters(CellList, EvaluationSettings.DegreeSpan); }
public static IGeoPoint <double>[] GetTopPoints(this IGeoPoint <double>[] geoPoints, IGeoPoint <double> center) { IEnumerable <IGeoPoint <double> > topPoints = geoPoints.Where(x => x.Lattitute >= center.Lattitute); var points = topPoints as IGeoPoint <double>[] ?? topPoints.ToArray(); return(points); }
public static IGeoPoint <double>[] GetLeftPoints(this IGeoPoint <double>[] geoPoints, IGeoPoint <double> center) { IEnumerable <IGeoPoint <double> > leftPoints = geoPoints.Where(x => x.Longtitute <= center.Longtitute); var points = leftPoints as IGeoPoint <double>[] ?? leftPoints.ToArray(); return(points); }
private static double GetLongtituteOffset(this IGeoPoint <double>[] leftPoints, IGeoPoint <double> center, double defaultLongtituteOffset) { double longtituteOffset = (leftPoints.Any()) ? (leftPoints.Select(x => x.Longtitute).Average() - center.Longtitute) * 2 : defaultLongtituteOffset; return(longtituteOffset); }
public static IGeoPoint <double>[] GetBottomPoints(this IGeoPoint <double>[] geoPoints, IGeoPoint <double> center) { IEnumerable <IGeoPoint <double> > bottomPoints = geoPoints.Where(x => x.Lattitute <= center.Lattitute); var enumerable = bottomPoints as IGeoPoint <double>[] ?? bottomPoints.ToArray(); return(enumerable); }
private static double GetLattituteOffset(this IGeoPoint <double>[] bottomPoints, IGeoPoint <double> center, double defaultLattituteOffset) { double lattituteOffset = (bottomPoints.Any()) ? (bottomPoints.Select(x => x.Lattitute).Average() - center.Lattitute) * 2 : defaultLattituteOffset; return(lattituteOffset); }
public static IGeoPoint <double>[] GetRightPoints(this IGeoPoint <double>[] geoPoints, IGeoPoint <double> center) { IEnumerable <IGeoPoint <double> > rightPoints = geoPoints.Where(x => x.Longtitute >= center.Longtitute); var enumerable = rightPoints as IGeoPoint <double>[] ?? rightPoints.ToArray(); return(enumerable); }
private void TestInitialize(double distance) { _point2 = new StubGeoPoint(point, distance, 45); _ocell = new StubOutdoorCell(_point2, 195) { Height = 40, ETilt = 4, MTilt = 1 }; _ccell = new ComparableCell(point, _ocell); _cell = new MeasurableCell(_ccell, point, budget); }
public override bool OnSingleTapUp(MotionEvent p0, MapView p1) { var x = p0.GetX(); var y = p0.GetY(); IProjection proj = p1.Projection; IGeoPoint p = proj.FromPixels((int)p0.GetX(), (int)p0.GetY()); GeoPointTapped?.Invoke(this, p); return(base.OnSingleTapUp(p0, p1)); }
private static void ProcessPosition(IGeoPoint message) { var pos = message.GeoPoint; if (pos == null || (pos.Date < new DateTime(2010, 1, 1)) || (pos.Lat == 0) || (pos.Lon == 0)) { return; } new Positions().HandleMessage((Position)pos.ToPosition(message.DeviceId, 0)); }
private void TestInitialize(double distance) { point2 = new StubGeoPoint(point, distance, 45); ocell = new StubOutdoorCell(point2, 225); ocell.Height = 40; ocell.ETilt = 4; ocell.MTilt = 1; ccell = new ComparableCell(point, ocell); cell = new MeasurableCell(ccell, point, budget); }
public void ImportCellList(IENodebRepository eNodebRepository, ICellRepository cellRepository, IGeoPoint <double> southWest, IGeoPoint <double> northEast) { IEnumerable <ENodeb> eNodebs = eNodebRepository.GetAll().FilterGeoPointList( southWest.Longtitute - GeoMath.BaiduLongtituteOffset, southWest.Lattitute - GeoMath.BaiduLattituteOffset, northEast.Longtitute - GeoMath.BaiduLongtituteOffset, northEast.Lattitute - GeoMath.BaiduLattituteOffset).ToList(); ImportCellList(cellRepository.Query(eNodebs)); }
private string ProcessEstadoLogistico(string code, IGeoPoint generico) { if (code.Length == 1) { code = code.PadLeft(2, '0'); } MessageSaver.Save(generico, code, Dispositivo, Coche, null, generico.GetDateTime(), generico.GeoPoint, string.Empty, ZonaManejo); return(code); }
public static ComparableCell[] GenerateComparableCellList(this IGeoPoint <double> p, IOutdoorCell[] cl) { int length = cl.Length; ComparableCell[] ccl = new ComparableCell[length]; for (int i = 0; i < length; i++) { ccl[i] = new ComparableCell(p, cl[i]); } return(ccl); }
public static IGeoPoint <double> GetLeftBottomOffsetPoint( this IGeoPoint <double> center, IEnumerable <IGeoPoint <double> > pointList, double defaultLongtituteOffset, double defaultLattituteOffset) { var geoPoints = pointList as IGeoPoint <double>[] ?? pointList.ToArray(); var leftPoints = geoPoints.GetLeftPoints(center); var longtituteOffset = leftPoints.GetLongtituteOffset(center, defaultLongtituteOffset); var bottomPoints = geoPoints.GetBottomPoints(center); var lattituteOffset = bottomPoints.GetLattituteOffset(center, defaultLattituteOffset); return(new GeoPoint(center, longtituteOffset, lattituteOffset)); }
public static IGeoPoint <double> GetRightTopOffsetPoint( this IGeoPoint <double> center, IEnumerable <IGeoPoint <double> > pointList, double defaultLongtituteOffset, double defaultLattituteOffset) { var geoPoints = pointList as IGeoPoint <double>[] ?? pointList.ToArray(); var rightPoints = geoPoints.GetRightPoints(center); double longtituteOffset = rightPoints.GetLongtituteOffset(center, defaultLongtituteOffset); var topPoints = geoPoints.GetTopPoints(center); double lattituteOffset = topPoints.GetLattituteOffset(center, defaultLattituteOffset); return(new GeoPoint(center, longtituteOffset, lattituteOffset)); }
private bool IsVelocidadInvalida(IGeoPoint message) { if (message.GeoPoint == null) { return(false); } var velocidadNegativa = message.GeoPoint.Velocidad < 0; var velocidadMuyGrande = message.GeoPoint.Velocidad > Coche.TipoCoche.MaximaVelocidadAlcanzable; return(velocidadNegativa || velocidadMuyGrande); }
public static double DistanceMeters(IGeoPoint a, IGeoPoint b, bool includeElevation) { var m = DistanceMeters(a, b); if (includeElevation && a.Elevation.HasValue && b.Elevation.HasValue) { var h = Math.Abs(a.Elevation.Value - b.Elevation.Value); return(Math.Sqrt(Convert.ToDouble(h * h) + Convert.ToDouble(m * m))); } else { return(m); } }
public ComparableCell(IGeoPoint<double> point, IOutdoorCell cell, IList<ILinkBudget<double>> budgetList, byte modBase = 3) { SetupComparableCell(point, cell); ILinkBudget<double> budget = budgetList.FirstOrDefault( x => Math.Abs(x.TransmitPower - cell.RsPower) < Eps && Math.Abs(x.AntennaGain - cell.AntennaGain) < Eps && x.Model.Earfcn == cell.Frequency); if (budget == null) { budget = new LinkBudget(cell); budgetList.Add(budget); } Budget = budget; PciModx = (byte)(cell.Pci % modBase); }
public ComparableCell(IGeoPoint<double> point, IOutdoorCell cell, IList<ILinkBudget<double>> budgetList, IBroadcastModel model, byte pciModx = 0) { SetupComparableCell(point, cell); ILinkBudget<double> budget = budgetList.FirstOrDefault( x => Math.Abs(x.TransmitPower - cell.RsPower) < Eps && Math.Abs(x.AntennaGain - cell.AntennaGain) < Eps); if (budget == null) { budget = new LinkBudget(model, cell.RsPower, cell.AntennaGain); budgetList.Add(budget); } Budget = budget; PciModx = pciModx; }
public ComparableCell(IGeoPoint <double> point, IOutdoorCell cell, IList <ILinkBudget <double> > budgetList, IBroadcastModel model, byte pciModx = 0) { SetupComparableCell(point, cell); ILinkBudget <double> budget = budgetList.FirstOrDefault( x => Math.Abs(x.TransmitPower - cell.RsPower) < Eps && Math.Abs(x.AntennaGain - cell.AntennaGain) < Eps); if (budget == null) { budget = new LinkBudget(model, cell.RsPower, cell.AntennaGain); budgetList.Add(budget); } Budget = budget; PciModx = pciModx; }
public ComparableCell(IGeoPoint <double> point, IOutdoorCell cell, IList <ILinkBudget <double> > budgetList, byte modBase = 3) { SetupComparableCell(point, cell); ILinkBudget <double> budget = budgetList.FirstOrDefault( x => Math.Abs(x.TransmitPower - cell.RsPower) < Eps && Math.Abs(x.AntennaGain - cell.AntennaGain) < Eps && x.Model.Earfcn == cell.Frequency); if (budget == null) { budget = new LinkBudget(cell); budgetList.Add(budget); } Budget = budget; PciModx = (byte)(cell.Pci % modBase); }
public void TestInitialize() { _point = new StubGeoPoint(112, 23); _cell = new StubOutdoorCell { RsPower = 15.2, AntennaGain = 17.5, Azimuth = 60, Longtitute = 112.01, Lattitute = 23.01, Height = 30, MTilt = 5, ETilt = 1, Pci = 22, Frequency = 100, CellName = "Cell-1" }; }
public static SectorTriangle GetSectorPoints(this IOutdoorCell outdoorCell, double radiusInMeter) { IGeoPoint <double> point1 = outdoorCell.Move(radiusInMeter, outdoorCell.Azimuth + 30); IGeoPoint <double> point2 = outdoorCell.Move(radiusInMeter, outdoorCell.Azimuth - 30); return(new SectorTriangle { X1 = outdoorCell.Longtitute + GeoMath.BaiduLongtituteOffset, Y1 = outdoorCell.Lattitute + GeoMath.BaiduLattituteOffset, X2 = point1.Longtitute + GeoMath.BaiduLongtituteOffset, Y2 = point1.Lattitute + GeoMath.BaiduLattituteOffset, X3 = point2.Longtitute + GeoMath.BaiduLongtituteOffset, Y3 = point2.Lattitute + GeoMath.BaiduLattituteOffset, Info = outdoorCell.Info(), CellName = outdoorCell.CellName, ColorString = "8C8C8C" }); }
public void TestInitialize() { p = new StubGeoPoint(112, 23); }
private void AssertSamePoints(IGeoPoint<double> point1, IGeoPoint<double> point2) { Assert.AreEqual(point1.Longtitute, point2.Longtitute, Eps, "Longtitute should be " + point1.Longtitute); Assert.AreEqual(point1.Lattitute, point2.Lattitute, Eps, "Lattitute should be " + point1.Lattitute); }
public void SetAzimuthAngle(IGeoPoint<double> point, double value) { Cell.Azimuth = value; AzimuthAngle = Cell.AngleFromCellAzimuth(point); }
private void TestInitialize(double distance) { _point2 = new StubGeoPoint(point, distance, 45); _ocell = new StubOutdoorCell(_point2, 195) {Height = 40, ETilt = 4, MTilt = 1}; _ccell = new ComparableCell(point, _ocell); _cell = new MeasurableCell(_ccell, point, budget); }
public ComparableCell(IGeoPoint<double> point, IOutdoorCell cell, byte pciModx = 0) { SetupComparableCell(point, cell); Budget = new LinkBudget(cell); PciModx = pciModx; }
public void SetupComparableCell(IGeoPoint<double> point, IOutdoorCell cell) { Cell = cell; Distance = point.SimpleDistance(cell); AzimuthAngle = cell.AngleFromCellAzimuth(point); }
public void ImportCellList(IENodebRepository eNodebRepository, ICellRepository cellRepository, IGeoPoint<double> southWest, IGeoPoint<double> northEast) { IEnumerable<ENodeb> eNodebs = eNodebRepository.GetAll().FilterGeoPointList( southWest.Longtitute - GeoMath.BaiduLongtituteOffset, southWest.Lattitute - GeoMath.BaiduLattituteOffset, northEast.Longtitute - GeoMath.BaiduLongtituteOffset, northEast.Lattitute - GeoMath.BaiduLattituteOffset).ToList(); ImportCellList(cellRepository.Query(eNodebs)); }
public MeasurableCell(IGeoPoint<double> point, IOutdoorCell cell, byte modBase = 3) : this(new ComparableCell(point, cell, (byte)(cell.Pci % modBase)), point) { }
public MeasurableCell(ComparableCell cell, IGeoPoint<double> point) { Cell = cell; Budget = cell.Budget; TiltAngle = cell.Cell.AngleFromCellTilt(point); }
public static double TiltFromCell(this IOutdoorCell c, IGeoPoint<double> p) { double d = p.SimpleDistance(c); return Math.Atan2(c.Height, d * 1000) * 180 / Math.PI; }
public static double AngleFromCellTilt(this IOutdoorCell c, IGeoPoint<double> p) { return Math.Abs(c.MTilt + c.ETilt - c.TiltFromCell(p)); }
public static double AngleFromCellAzimuth(this IOutdoorCell c, IGeoPoint<double> p) { double pa = p.PositionAzimuth(c); return GeoMath.AllAngleBetweenAzimuths(pa, c.Azimuth); }