public void addFrame(kFrame frame) { //System.Console.WriteLine("New frame"); try { //reference table code //"CREATE TABLE frameManager (session INTEGER, frame INTEGER, object VARCHAR(20), accept VARCHAR(20), x DOUBLE, y DOUBLE, z DOUBLE, PRIMARY KEY(session, frame, object));"; queries = "INSERT INTO frameManager (session, frame, object, accept, x, y, z) VALUES (@session, @frame, @object, @accept, @x, @y, @z);"; sqCmd = new SQLiteCommand(queries, sqConnection); sqCmd.Parameters.AddWithValue("@session", frame.getSession()); sqCmd.Parameters.AddWithValue("@frame", frame.getFrame()); sqCmd.Parameters.AddWithValue("@object", frame.getObject()); sqCmd.Parameters.AddWithValue("@accept", frame.getAccept()); sqCmd.Parameters.AddWithValue("@x", frame.getX()); sqCmd.Parameters.AddWithValue("@y", frame.getY()); sqCmd.Parameters.AddWithValue("@z", frame.getZ()); sqCmd.ExecuteNonQuery(); } catch (Exception e) { System.Console.WriteLine(e); } //System.Console.WriteLine("New frame END"); }
/* pointless function with zero use so far but left in code public kFrame getObjkFrame(int framenum, int sessionid, string obj) { System.Console.WriteLine("Get frame for obj" + obj.ToString()); kFrame frame = null; try { queries = "SELECT * FROM frameManager WHERE frame=@frame, and session=@sessionid, and object=@object"; sqCmd = new SQLiteCommand(queries, sqConnection); sqCmd.Parameters.AddWithValue("@frame", framenum); sqCmd.Parameters.AddWithValue("@sessionid", sessionid); sqCmd.Parameters.AddWithValue("@object", obj); sqDatareader = sqCmd.ExecuteReader(); sqDatareader.Read(); frame = new kFrame((int)sqDatareader["session"], (int)sqDatareader["frame"], (string)sqDatareader["object"], (string)sqDatareader["accept"], (double)sqDatareader["x"], (double)sqDatareader["y"], (double)sqDatareader["z"]); } catch (Exception e) { System.Console.WriteLine(e); } System.Console.WriteLine("Return found frame"); return frame; } */ //create the frame for acceptable movement, highly recommended to change range multipliers with further testing public void createBox(kFrame frame) { //System.Console.WriteLine("Creating box parameter"); try { //reference for table code //"CREATE TABLE boxManager (session INTEGER, object VARCHAR(20), minx DOUBLE, miny DOUBLE, minz DOUBLE, maxx DOUBLE, maxy DOUBLE, maxz double, PRIMARY KEY (session, object));"; queries = "INSERT INTO boxManager (session, object, minx, miny, minz, maxx, maxy, maxz) VALUES (@session, @object, @minx, @miny, @minz, @maxx, @maxy, @maxz);"; sqCmd = new SQLiteCommand(queries, sqConnection); sqCmd.Parameters.AddWithValue("@session", frame.getSession()); sqCmd.Parameters.AddWithValue("@object", frame.getObject()); sqCmd.Parameters.AddWithValue("@minx", frame.getX() * 1 / 4); sqCmd.Parameters.AddWithValue("@miny", frame.getY() * 1 / 4); sqCmd.Parameters.AddWithValue("@minz", frame.getZ() * 1 / 4); sqCmd.Parameters.AddWithValue("@maxx", frame.getX() * 2); sqCmd.Parameters.AddWithValue("@maxy", frame.getY() * 2); sqCmd.Parameters.AddWithValue("@maxz", frame.getZ() * 2); sqCmd.ExecuteNonQuery(); } catch (Exception e) { System.Console.WriteLine(e); } //System.Console.WriteLine("Box parameters inserted"); }