public Points GetAlternativeWaySegments(Car car) { var result = new Points(); var myCell = GetCell(car.X, car.Y); result.Add(new Point(car)); Cell prevCell = null; var passedWayPoints = new List<Cell>(); for (var e = 1; result.Count < 5; e++) { var nextWp = GetNextWayPoint(car, e); for (var curCell = myCell; !curCell.Equals(nextWp); ) { var nextCell = DijkstraNextCell(curCell, nextWp, prevCell == null ? new Cell[] { } : new[] { prevCell }); var nextCenter = GetCenter(nextCell); for (var i = 0; i < result.Count; i++) { if (CheckVisibilityAndWp(car, result[i], nextCenter, passedWayPoints)) { result.RemoveRange(i + 1, result.Count - i - 1); break; } } result.Add(nextCenter); prevCell = curCell; curCell = nextCell; } myCell = nextWp; passedWayPoints.Add(nextWp); } var extended = ExtendWaySegments(result, 100); result.Clear(); passedWayPoints.Clear(); foreach (var t in extended) { if (result.Count > 0 && result.Last().Equals(t)) continue; if (GetNextWayPoint(car).Equals(GetCell(t))) passedWayPoints.Add(GetCell(t)); while (result.Count > 1 && CheckVisibilityAndWp(car, result[result.Count - 2], t, passedWayPoints)) result.Pop(); result.Add(t); } return result; }
public void UpdatePolygon(int offset = 0, float overrideWidth = -1) { Points.Clear(); Points.Add( Start + (overrideWidth > 0 ? overrideWidth : Width + offset) * Perpendicular - offset * Direction); Points.Add( Start - (overrideWidth > 0 ? overrideWidth : Width + offset) * Perpendicular - offset * Direction); Points.Add( End - (overrideWidth > 0 ? overrideWidth : Width + offset) * Perpendicular + offset * Direction); Points.Add( End + (overrideWidth > 0 ? overrideWidth : Width + offset) * Perpendicular + offset * Direction); }
public void UpdatePolygon(int offset = 0, float overrideWidth = -1) { Points.Clear(); var outRadius = (overrideWidth > 0 ? overrideWidth : (offset + Radius) / (float)Math.Cos(2 * Math.PI / _quality)); for (var i = 1; i <= _quality; i++) { var angle = i * 2 * Math.PI / _quality; var point = new Vector2(Center.X + outRadius * (float)Math.Cos(angle), Center.Y + outRadius * (float)Math.Sin(angle)); Points.Add(point); } }
public void UpdatePolygon(int offset = 0) { Points.Clear(); var outRadius = (Radius + offset) / (float)Math.Cos(2 * Math.PI / _quality); var side1 = EndPos.CommonRotated(-Angle * 0.5f); for (var i = 0; i <= _quality; i++) { var cDirection = side1.CommonRotated(i * Angle / _quality).CommmonNormalized(); Points.Add(new Vector2(StartPos.X + outRadius * cDirection.X, StartPos.Y + outRadius * cDirection.Y)); } }
public bool ButtonEvent(int x, int y, bool pressed, Gdk.EventButton evnt) { if (!pressed) { last_pressed_bound = null; return(false); } last_pressed_bound = BoundObject; Points.Add(new Gdk.Point(x, y)); return(true); }
public override bool TryAddPoint(Point point) { if (Points.Count < 2) { Points.Add(point); return(true); } else { return(false); } }
internal void UpdateSegment(int index, NotifyCollectionChangedAction action, IChartTransformer transformer) { if (action == NotifyCollectionChangedAction.Remove) { this.Points.RemoveAt(index); } else if (action == NotifyCollectionChangedAction.Add) { Point point = transformer.TransformToVisible(xChartVals[index], yChartVals[index]); Points.Add(point); UpdateVisual(false); } }
void OnControllerColliderHit(ControllerColliderHit a_collision) { CollectibleValue collectible = a_collision.collider.GetComponent <CollectibleValue>(); if (collectible != null && CollectibleValue.m_instances.Contains(collectible)) { Points componentPoints = GetComponent <Points>(); componentPoints.Add(collectible.Points); CollectibleValue.m_instances.Remove(collectible); Destroy(collectible.gameObject); } }
public void SetPolygon(String Coordinates) { Points.Clear(); foreach (String Coordinate in Coordinates.Split(',')) { String[] XY = Coordinate.Split(' '); float lng = 0; float lat = 0; float.TryParse(XY[0], out lat); float.TryParse(XY[1], out lng); Points.Add(new GPSPoint(lat, lng)); } }
/// <summary> /// Конструктор для развертывания фигуры по структуре /// </summary> /// <param name="box"></param> public AbstractBox(StructBox box) { _pen = new Pen(box.Color, box.Width); for (int i = 0; i < box.Points.Count; i++) { Point point = new Point(box.Points[i].Point_X, box.Points[i].Point_Y); Points.Add(point); } Font = box.Font; RectangleWidth = SizeWidth(); RectangleHeight = SizeHeight(); IDataCommon = box.Data; }
public override void MouseMove(bool leftPressed, bool rightPressed, Point p) { if (Points.Count > 0 && leftPressed) { Points.Add(p); RaiseDrawPrimitiveInteractiveState(p); } else if (Points.Count > 0) { RaiseDrawPrimitiveInBitmap(); Reset(); } }
private void CalculateVertices() { var x1 = A.X - X; var y1 = A.Y - Y; Points.Add(new Point(x1 + X, y1 + Y)); Points.Add(new Point((int)(-0.5 * x1 - Math.Sqrt(3) * y1 / 2) + X, (int)(Math.Sqrt(3) * x1 / 2 - 0.5 * y1) + Y)); Points.Add(new Point((int)(-0.5 * x1 + Math.Sqrt(3) * y1 / 2) + X, (int)(-Math.Sqrt(3) * x1 / 2 - 0.5 * y1) + Y)); }
public void MakePoints(Vector2 pTopLeft) { Centre = new Vector2(pTopLeft.X + 16, pTopLeft.Y + 16); // top left vertices Points.Add(pTopLeft); // top right Points.Add(new Vector2(pTopLeft.X + 32, pTopLeft.Y)); // bottom right Points.Add(new Vector2(pTopLeft.X + 32, pTopLeft.Y + 32)); // bottom left Points.Add(new Vector2(pTopLeft.X, pTopLeft.Y + 32)); }
protected void AddToPointList(Point3D point) { // The point is added only if the list is empty or if it is different // than the previously added point (check for the two point coincidence) if (Points.Count == 0) { Points.Add(point); } else if (!Points[Points.Count - 1].IsEqual(point)) { Points.Add(point); } }
public void CreateFrom(List <Point> shape) { Points.Clear(); IsActive = 1; IsDetailing = 0; IsTorsion = 1; foreach (var item in shape) { IXEP_EmdPointData pointData = XEP_EmdFactrory.CreateEmdPointData(); pointData.CreateFrom(item); Points.Add(pointData); } }
public DragonPrimTrailTwo(NPC npc) { Entity = npc; EntityType = npc.type; DrawType = PrimTrailManager.DrawProjectile; angle = Main.rand.NextFloat(6.28f); start = Entity.Center + (angle.ToRotationVector2() * Entity.height * 1.5f); end = Entity.Center + ((angle + 3.14f).ToRotationVector2() * Entity.height * 1.5f); for (float i = 0; i < 1; i += 0.025f) { Points.Add(Vector2.Lerp(start, end, i)); } }
public DesignData1() { var p = new NodeViewModel(250, 250); var ps = BuildCircle(250, 250, 200, 6).ToArray(); _connections = ConnectionFactory.Build(p, 1000, ps); Observable.Interval(TimeSpan.FromSeconds(2)).Zip(ps.ToObservable().StartWith(p), (a, b) => b) .ObserveOn(App.Current.Dispatcher) .Subscribe(p => { Points.Add(p); }); }
private void DrawPoint(KeyPoint point, int offset, double color = -1, int sizeMultiplier = 1) { Application.Current.Dispatcher.Invoke((Action) delegate { var ellipse = new Ellipse() { Width = 2 * sizeMultiplier, Height = 2 * sizeMultiplier, Stroke = ColorGenerator.GenerateColor(color), Fill = ColorGenerator.GenerateColor(color) }; Canvas.SetLeft(ellipse, point.X + offset - ellipse.Width / 2); Canvas.SetTop(ellipse, point.Y - ellipse.Width / 2); _overlay.Children.Add(ellipse); Points.Add(ellipse); }); }
public Graph(int n) { this.CallStack = new List <int>(); this.Points = new List <TspPoint>(); for (var i = 0; i < n; i++) { Points.Add(new TspPoint(i)); } for (var i = 0; i < n; i++) { Points[i].InitVisits(this); } }
public override void OnActivate() { base.OnActivate(); DefinedPointCount = 0; ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.PointAsked); Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.Suspend); var fastAccessTools = new SplineFastAccessTools(ActionsGraph); RibbonPanel.Children.Add(fastAccessTools); Document.Transact(); Points.Add(new Point3D()); }
public void AddPoint(PointF inPoint, bool iskeyframe) { if (Points.Count < 2) { Points.Add(new KeyValuePair <bool, PointF>(iskeyframe, inPoint)); } else { KeyValuePair <bool, PointF>[] tmpList = new KeyValuePair <bool, PointF> [Points.Count]; Points.CopyTo(tmpList); Points.Clear(); for (int i = 1; i < tmpList.Length; i++) { //check if first point and new point are the same if (i == 1 && tmpList[0].Value.X != inPoint.X) { Points.Add(tmpList[0]); } else if (i == 1 && tmpList[0].Value.X == inPoint.X) { Points.Add(new KeyValuePair <bool, PointF>(true, inPoint)); } //add new point if not hitting some other point if (tmpList[i - 1].Value.X <inPoint.X && tmpList[i].Value.X> inPoint.X) { Points.Add(new KeyValuePair <bool, PointF>(iskeyframe, inPoint)); if (iskeyframe) { SelectedPoint = i - 1; } else { SelectedPoint = i; } } //heck if current point and new point are the same if (tmpList[i].Value.X == inPoint.X) { Points.Add(new KeyValuePair <bool, PointF>(true, inPoint)); SelectedPoint = i - 1; } else { Points.Add(tmpList[i]); } } } }
/// <summary> /// Generates the points and segments of the arrow Figure object. /// </summary> public override void BuildFigure() { Points.Clear(); double headLength = _formatRatio * _headLengthRatio; double bodyLength = _formatRatio - headLength; double bodyHeight = _headWidthRatio != 0.0 ? 1.0 / _headWidthRatio : 1.0; double bodyTop = 0.5 - bodyHeight / 2; double bodyBottom = 0.5 + bodyHeight / 2; Points.Add(new Point(0.0, bodyTop)); Points.Add(new Point(0.0, bodyBottom)); Points.Add(new Point(bodyLength, bodyBottom)); Points.Add(new Point(bodyLength, 1.0)); Points.Add(new Point(_formatRatio, 0.5)); Points.Add(new Point(bodyLength, 0.0)); Points.Add(new Point(bodyLength, bodyTop)); bool scaling = false; ScaleTransform transform = new ScaleTransform(); if (!Double.IsNaN(Width)) { transform.ScaleX = _formatRatio != 0.0 ? (Width - 2 * StrokeThickness) / _formatRatio : 1.0; scaling = true; } if (!Double.IsNaN(Height)) { transform.ScaleY = Height - 2 * StrokeThickness; scaling = true; } Figure.Segments.Clear(); if (scaling) { Points[0] = transform.Transform(Points[0]); } Figure.StartPoint = Points[0]; for (int i = 0; i < Points.Count; i++) { if (i < Points.Count - 1) { if (scaling) { Points[i + 1] = transform.Transform(Points[i + 1]); } LineSegment segment = new LineSegment(Points[i + 1], true); Figure.Segments.Add(segment); } } }
public void AddPoint(double x, double y) { if (y < MininimumY) { MininimumY = y; } if (y > MaximumY) { MaximumY = y; } Points.Add(new DataPoint(x, y)); }
public void Read(Stream input, Endian endian = Endian.Little) { ushort pointsCount = input.ReadValueU16(endian); Length = input.ReadValueF32(endian); for (int i = 0; i < pointsCount; i++) { Vector3 point = Vector3.Zero; point.X = input.ReadValueF32(endian); point.Y = input.ReadValueF32(endian); point.Z = input.ReadValueF32(endian); Points.Add(point); } }
public CGRect AddPointOfType(PointType pointType, UITouch touch) { var previousPoint = Points.LastOrDefault(); var previousSequenceNumber = previousPoint != null ? previousPoint.SequenceNumber : -1; var point = new LinePoint(touch, previousSequenceNumber + 1, pointType); if (point.EstimationUpdateIndex != null && point.EstimatedPropertiesExpectingUpdates != 0) { pointsWaitingForUpdatesByEstimationIndex [point.EstimationUpdateIndex] = point; } Points.Add(point); return(UpdateRectForLinePoint(point, previousPoint)); }
/// <summary> /// DrawDiagram Method for adding the points to the polyline /// </summary> private void DrawDiagram() { Point point; double j = -30; while (j < 30) { point = new Point(); point.X = (j * 20) + 520; point.Y = -(CheckEquationType(j) * 20) + 520; Points.Add(point); j += 0.1; } }
private void AddNextPoint(Point3D coordinate) { if (_targetOjectsSelected) { Points[Points.Count - 1] = coordinate; Inputs[InputNames.CoordinateParser].Send(NotificationNames.SetLastPoint, coordinate); if (Points.Count > 1) { BuildCopy(); } Points.Add(new Point3D()); } }
public void CreateFromEmdElement(IXEP_EmdElement elem) { XEP_BaseEmdFile.CheckName(elem.Name, XEP_EmdNames.s_KeyStirrupBranch); Points.Clear(); foreach (var item in elem.Elements) { IXEP_EmdPointData pointData = XEP_EmdFactrory.CreateEmdPointData(); pointData.CreateFromEmdElement(item); Points.Add(pointData); } IsActive = elem.GetAttribute(XEP_EmdNames.s_KeyStirrupIsActive).GetIntValue(); IsDetailing = elem.GetAttribute(XEP_EmdNames.s_KeyStirrupIsDetailing).GetIntValue(); IsTorsion = elem.GetAttribute(XEP_EmdNames.s_KeyStirrupIsTorsion).GetIntValue(); }
public override void AddToList(IPoint Point) { SMobPoint p = Point as SMobPoint; int i = Points.Count; Points.Add(p); if (ListView == null) { return; } ListView.Items.Add(FactoryMobPoint.BuildListItem(this, i, p)); }
public override PointF[] Update(PointF point) { if (Points.Count < 4) { Points.Add(point); return(Points.ToArray()); } else { Points = new List <PointF>(); Points.Add(point); return(Points.ToArray()); } }
/// <summary> /// Updates the polygon. Call this after changing something. /// </summary> /// <param name="offset">Added radius</param> public void UpdatePolygon(int offset = 0) { Points.Clear(); var outRadius = (Radius + offset) / (float)Math.Cos(2 * Math.PI / _quality); Points.Add(Center); var side1 = Direction.Rotated(-Angle * 0.5f); for (var i = 0; i <= _quality; i++) { var cDirection = side1.Rotated(i * Angle / _quality).Normalized(); Points.Add(new Vector2(Center.X + (outRadius * cDirection.X), Center.Y + (outRadius * cDirection.Y))); } }
public static Points ExtendWaySegments(Points pts, double delta) { var res = new Points(); for (var idx = 1; idx < pts.Count; idx++) { EnumeratePointsBetween(pts[idx - 1], pts[idx], delta, point => { if (res.Count == 0 || !res[res.Count - 1].Equals(point)) res.Add(point); return true; }); } return res; }
void AddValues(double[] _x, double[] _y, double[,] _z) { var p = new Points<ContourPoint>(); var xmin = double.MaxValue; var xmax = double.MinValue; var ymin = double.MaxValue; var ymax = double.MinValue; var zmin = double.MaxValue; var zmax = double.MinValue; var dx = Math.Min(_x.Length, _z.GetLength(0)); var dy = Math.Min(_y.Length, _z.GetLength(1)); for (var i = 0; i < dx; i++) { for (var j = 0; j < dy; j++) { var x = _x[i]; var y = _y[j]; var z = _z[i, j]; p.Add(new ContourPoint { X = x, Y = y, Magnitude = z }); if (y < ymin) ymin = y; if (ymax < y) ymax = y; if (z< zmin) zmin = z; if (zmax < z) zmax = z; if (x < xmin) xmin = x; if (xmax < x) xmax = x; } } if (Count == 0 || xmin < MinX) MinX = xmin; if (Count == 0 || xmax > MaxX) MaxX = xmax; if (Count == 0 || ymin < MinY) MinY = ymin; if (Count == 0 || ymax > MaxY) MaxY = ymax; SetLevels(zmin, zmax, Math.Min(Math.Max(dx, dy), 10)); AddSeries(p); }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var p2 = new Plot2DValue(); using (var ds = Deserializer.Create(content)) { p2.Deserialize(ds); p2.IsLogX = ds.GetBoolean(); p2.IsLogY = ds.GetBoolean(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<PointPair>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetDouble(); var y = ds.GetDouble(); points.Add(new PointPair { X = x, Y = y }); } p2.AddSeries(points); } } return p2; }
void AddValues(double[] _x, double[] _y, double[] _z) { var p = new Points<PointTriple>(); var length = Math.Min(_x.Length, Math.Min(_y.Length, _z.Length)); var xmin = MinX; var xmax = MaxX; var ymin = MinY; var ymax = MaxY; var zmin = MinZ; var zmax = MaxZ; for (var i = 0; i < length; i++) { var x = _x[i]; var y = _y[i]; var z = _z[i]; p.Add(new PointTriple { X = x, Y = y, Z = z }); if (x < xmin) xmin = x; if (xmax < x) xmax = x; if (y < ymin) ymin = y; if (ymax < y) ymax = y; if (z < zmin) zmin = z; if (zmax < z) zmax = z; } if (Count == 0 || xmin < MinX) MinX = xmin; if (Count == 0 || xmax > MaxX) MaxX = xmax; if (Count == 0 || ymin < MinY) MinY = ymin; if (Count == 0 || ymax > MaxY) MaxY = ymax; if (Count == 0 || zmin < MinZ) MinZ = zmin; if (Count == 0 || zmax > MaxZ) MaxZ = zmax; AddSeries(p); }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var p3 = new Plot3DValue(); using (var ds = Deserializer.Create(content)) { p3.Deserialize(ds); p3.IsLogX = ds.GetBoolean(); p3.IsLogY = ds.GetBoolean(); p3.IsLogZ = ds.GetBoolean(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<PointTriple>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetDouble(); var y = ds.GetDouble(); var z = ds.GetDouble(); points.Add(new PointTriple { X = x, Y = y, Z = z }); } p3.AddSeries(points); } } return p3; }
void AddValues(double[] _x, double[] _y, double[] _xerr, double[] _yerr) { var p = new Points<ErrorPointPair>(); var xmin = double.MaxValue; var xmax = double.MinValue; var ymin = double.MaxValue; var ymax = double.MinValue; for (var i = 0; i < _y.Length; i++) { var x = _x[i]; var y = _y[i]; p.Add(new ErrorPointPair { X = x, Y = y, Xerr = _xerr.Length > i ? _xerr[i] : 0.0, Yerr = _yerr.Length > i ? _yerr[i] : 0.0 }); if (x < xmin) xmin = x; if (xmax < x) xmax = x; if (y < ymin) ymin = y; if (ymax < y) ymax = y; } if (Count == 0 || xmin < MinX) MinX = xmin; if (Count == 0 || xmax > MaxX) MaxX = xmax; if (Count == 0 || ymin < MinY) MinY = ymin; if (Count == 0 || ymax > MaxY) MaxY = ymax; AddSeries(p); }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var pp = new PolarPlotValue(); using (var ds = Deserializer.Create(content)) { pp.Deserialize(ds); pp.FractionSymbol = ds.GetString(); pp.FractionUnit = ds.GetDouble(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<PointPair>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetDouble(); var y = ds.GetDouble(); points.Add(new PointPair { Angle = x, Magnitude = y }); } pp.AddSeries(points); } } return pp; }
void AddValues(double[] _x, double[] _y) { var p = new Points<PointPair>(); MinX = 0.0; MaxX = 2.0 * Math.PI; var ymin = MinY; var ymax = MaxY; for (var i = 0; i < _y.Length; i++) { var x = _x[i]; var y = _y[i]; p.Add(new PointPair { Angle = x, Magnitude = y }); if (y < ymin) ymin = y; if (ymax < y) ymax = y; } if (Count == 0 || ymin < MinY) MinY = ymin; if (Count == 0 || ymax > MaxY) MaxY = ymax; AddSeries(p); }
void AddValues(double[] _x, double[] _y) { var p = new Points<PointPair>(); var xmin = MinX; var xmax = MaxX; var ymin = MinY; var ymax = MaxY; for (var i = 0; i < _y.Length; i++) { var x = _x[i]; var y = _y[i]; p.Add(new PointPair { X = x, Y = y }); if (x < xmin) xmin = x; if (xmax < x) xmax = x; if (y < ymin) ymin = y; if (ymax < y) ymax = y; } if (Count == 0 || xmin < MinX) MinX = xmin; if (Count == 0 || xmax > MaxX) MaxX = xmax; if (Count == 0 || ymin < MinY) MinY = ymin; if (Count == 0 || ymax > MaxY) MaxY = ymax; AddSeries(p); }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var cp = new ContourPlotValue(); using (var ds = Deserializer.Create(content)) { cp.Deserialize(ds); cp.ColorPalette = (ColorPalettes)ds.GetInt(); cp.ShowLevel = ds.GetBoolean(); cp.Levels = new double[ds.GetInt()]; for (var i = 0; i < Levels.Length; i++) Levels[i] = ds.GetDouble(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<ContourPoint>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetDouble(); var y = ds.GetDouble(); var z = ds.GetDouble(); points.Add(new ContourPoint { X = x, Y = y, Magnitude = z }); } cp.AddSeries(points); } } return cp; }
public Points GetWaySegments(Car car) { var result = new Points(); var isWayPoint = new List<bool>(); var myCell = GetCell(car.X, car.Y); result.Add(new Point(car)); isWayPoint.Add(false); Cell prevCell = null; for (var e = 1; result.Count < 5; e++) { var nextWp = GetNextWayPoint(car, e); for (var curCell = myCell; !curCell.Equals(nextWp);) { var nextCell = DijkstraNextCell(curCell, nextWp, prevCell == null ? new Cell[] { } : new[] { prevCell }); var nextPoint = GetCenter(nextCell); while (result.Count > 1 && !isWayPoint[isWayPoint.Count - 1] && CheckVisibility(car, result[result.Count - 2], nextPoint, car.Height / 2 + 10)) { result.Pop(); isWayPoint.RemoveAt(isWayPoint.Count - 1); } result.Add(nextPoint); isWayPoint.Add(nextCell.Equals(nextWp)); prevCell = curCell; curCell = nextCell; } myCell = nextWp; } return result; }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var ep = new ErrorPlotValue(); using (var ds = Deserializer.Create(content)) { ep.Deserialize(ds); ep.IsLogX = ds.GetBoolean(); ep.IsLogY = ds.GetBoolean(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<ErrorPointPair>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetDouble(); var y = ds.GetDouble(); var xerr = ds.GetDouble(); var yerr = ds.GetDouble(); points.Add(new ErrorPointPair { X = x, Y = y, Xerr = xerr, Yerr = yerr }); } ep.AddSeries(points); } } return ep; }
/// <summary> /// Converts a set of bytes to a new instance. /// </summary> /// <param name="content">The binary representation.</param> /// <returns>The new instance.</returns> public override Value Deserialize(byte[] content) { var hm = new HeatmapPlotValue(); using (var ds = Deserializer.Create(content)) { hm.Deserialize(ds); hm.ColorPalette = (ColorPalettes)ds.GetInt(); hm.Minimum = ds.GetDouble(); hm.Maximum = ds.GetDouble(); var length = ds.GetInt(); for (var i = 0; i < length; i++) { var points = new Points<HeatPoint>(); points.Deserialize(ds); var count = ds.GetInt(); for (int j = 0; j < count; j++) { var x = ds.GetInt(); var y = ds.GetInt(); var z = ds.GetDouble(); points.Add(new HeatPoint { Column = x, Row = y, Magnitude = z }); } hm.AddSeries(points); } } return hm; }