private void loadData(string filepath) { using (FileStream fs = new FileStream(filepath, FileMode.Open)) { try { DataSet ds = new DataSet(); ds.ReadXml(fs); tds = new TrajectoryDbDataSet(); tds.Merge(ds); //using (TrajectoryDbDataSetTableAdapters.trajectoriesTableAdapter ta = new TrajectoryDbDataSetTableAdapters.trajectoriesTableAdapter()) //{ // Console.WriteLine(ta.Update(tds.trajectories)); //} //using (TrajectoryDbDataSetTableAdapters.pointsTableAdapter ta = new TrajectoryDbDataSetTableAdapters.pointsTableAdapter()) //{ // Console.WriteLine(ta.Update(tds.points)); //} int[] t_ids = new int[882 - 705]; for (int i = 0; i < 882 - 705; i++) { t_ids[i] = i + 705; } writeToCSV(t_ids); //updateDatabase(); foreach (TrajectoryDbDataSet.trajectoriesRow row in tds.trajectories) { //Console.WriteLine(row.average_velocity.CompareTo(Double.NaN)); if (row.average_velocity.CompareTo(Double.NaN) == 0) { row.average_velocity = 0.0; } } } catch (Exception e) { Console.WriteLine(e); } } }
// Add one point to points table, must refer to a trajectory in trajectories table public void addPointData(SkeletonPoint point, double distance, double deltaDistance, double velocity, string direction, TrajectoryDbDataSet.trajectoriesRow t_key,int milliseconds,double vx, double vz) { try { Globals.ds.points.AddpointsRow(point.X, point.Y, point.Z, distance, deltaDistance, velocity, direction, (byte) trackedSkeleton, t_key,milliseconds,vx,vz); } catch { return; } }
private void loadData(string filepath) { using (FileStream fs = new FileStream(filepath, FileMode.Open)) { try { DataSet ds = new DataSet(); ds.ReadXml(fs); tds = new TrajectoryDbDataSet(); tds.Merge(ds); //using (TrajectoryDbDataSetTableAdapters.trajectoriesTableAdapter ta = new TrajectoryDbDataSetTableAdapters.trajectoriesTableAdapter()) //{ // Console.WriteLine(ta.Update(tds.trajectories)); //} //using (TrajectoryDbDataSetTableAdapters.pointsTableAdapter ta = new TrajectoryDbDataSetTableAdapters.pointsTableAdapter()) //{ // Console.WriteLine(ta.Update(tds.points)); //} int[] t_ids = new int[882 - 705]; for (int i = 0; i < 882 - 705; i++) { t_ids[i] = i + 705; } writeToCSV(t_ids); //updateDatabase(); foreach (TrajectoryDbDataSet.trajectoriesRow row in tds.trajectories) { //Console.WriteLine(row.average_velocity.CompareTo(Double.NaN)); if (row.average_velocity.CompareTo(Double.NaN) == 0) { row.average_velocity = 0.0; } } } catch (Exception e) { Console.WriteLine(e); } } }