private void DrawTrajectory(int t_id, Color color,string direction,ModelVisual3D model) { //find trajectory id of last inserted trajectory if (tds.trajectories.Count == 0) { return; } //int t_id = Globals.ds.trajectories[Globals.ds.trajectories.Count - 1].t_id; TrajectoryDbDataSet.pointsRow[] pointsRows = (TrajectoryDbDataSet.pointsRow[])tds.points.Select("t_id = " + t_id); if (pointsRows.Count() < 30 && pointsRows.Count() > 2) { Point3D firstPoint = new Point3D((float)pointsRows[0].X, (float)pointsRows[0].Y, (float)pointsRows[0].Z); Point3DCollection pointCollection = new Point3DCollection(); for (int i = 1; i < pointsRows.Length; i++) { TrajectoryDbDataSet.pointsRow currentRow; TrajectoryDbDataSet.pointsRow lastRow; try { currentRow = pointsRows[i]; lastRow = pointsRows[i - 1]; } catch (Exception e) { return; } pointCollection.Add(new Point3D(currentRow.X, currentRow.Y, currentRow.Z)); } if (direction.Equals("R")) { arrow = Petzold.Media2D.ArrowEnds.End; } else if (direction.Equals("L")) { arrow = Petzold.Media2D.ArrowEnds.Start; } else arrow = Petzold.Media2D.ArrowEnds.None; WirePolyline wl = new WirePolyline() { Points = pointCollection, Thickness = 1, Rounding = 1, Color = color, ArrowEnds = Petzold.Media2D.ArrowEnds.End }; model.Children.Add(wl); model.Transform = new Transform3DGroup(); } }
private void DrawTrajectory(int t_id, Color color, string direction, ModelVisual3D model) { //find trajectory id of last inserted trajectory if (tds.trajectories.Count == 0) { return; } //int t_id = Globals.ds.trajectories[Globals.ds.trajectories.Count - 1].t_id; TrajectoryDbDataSet.pointsRow[] pointsRows = (TrajectoryDbDataSet.pointsRow[])tds.points.Select("t_id = " + t_id); if (pointsRows.Count() < 30 && pointsRows.Count() > 2) { Point3D firstPoint = new Point3D((float)pointsRows[0].X, (float)pointsRows[0].Y, (float)pointsRows[0].Z); Point3DCollection pointCollection = new Point3DCollection(); for (int i = 1; i < pointsRows.Length; i++) { TrajectoryDbDataSet.pointsRow currentRow; TrajectoryDbDataSet.pointsRow lastRow; try { currentRow = pointsRows[i]; lastRow = pointsRows[i - 1]; } catch (Exception e) { return; } pointCollection.Add(new Point3D(currentRow.X, currentRow.Y, currentRow.Z)); } if (direction.Equals("R")) { arrow = Petzold.Media2D.ArrowEnds.End; } else if (direction.Equals("L")) { arrow = Petzold.Media2D.ArrowEnds.Start; } else { arrow = Petzold.Media2D.ArrowEnds.None; } WirePolyline wl = new WirePolyline() { Points = pointCollection, Thickness = 1, Rounding = 1, Color = color, ArrowEnds = Petzold.Media2D.ArrowEnds.End }; model.Children.Add(wl); model.Transform = new Transform3DGroup(); } }