internal IMessage ParsePayload(string payload) { var bitVector = ConvertPayload(payload); try { switch (payload.First()) { case '1': var msg1 = new MessageType1(bitVector); msg1.Distance = _distanceCalculator.Calc(_observationPoint.Longitude, _observationPoint.Latitude, msg1.Longitude, msg1.Latitude); return(msg1); case '3': var msg3 = new MessageType3(bitVector); msg3.Distance = _distanceCalculator.Calc(msg3.Longitude, msg3.Latitude, _observationPoint.Longitude, _observationPoint.Latitude); return(msg3); case '4': var msg4 = new MessageType4(bitVector); msg4.Distance = _distanceCalculator.Calc(msg4.Longitude, msg4.Latitude, _observationPoint.Longitude, _observationPoint.Latitude); return(msg4); case '5': return(new MessageType5(bitVector)); default: return(new MessageTypeNotImplemented(payload)); } } catch (Exception ex) { return(new MessageParsingError($"Payload: {payload}, {ex.Message}", ex.StackTrace)); } }
protected override void DrawGeometry(StreamGeometryContext context) { context.BeginFigure(FromPoint, true, false); var l1 = DistanceCalculator.Calc(FromPoint, LeftBezierControl.PosPoint); var l2 = DistanceCalculator.Calc(LeftBezierControl.PosPoint, RightBezierControl.PosPoint); var l3 = DistanceCalculator.Calc(RightBezierControl.PosPoint, TargetPoint); var stepSize = 1 / (l1 + l2 + l3); for (double step = 0; step <= 1; step += stepSize) { context.LineTo(GetPoint(step, FromPoint, TargetPoint), true, true); } }