// Deactivates the given dataset. // This can only be done when the tracker is not running. public override bool DeactivateDataSet(DataSet dataSet) { if (dataSet == null) { Debug.LogError("Dataset is null."); return(false); } DataSetImpl dataSetImpl = (DataSetImpl)dataSet; if (QCARWrapper.Instance.ImageTrackerDeactivateDataSet(dataSetImpl.DataSetPtr) == 0) { Debug.LogError("Could not deactivate dataset."); return(false); } StateManagerImpl stateManager = (StateManagerImpl)TrackerManager.Instance.GetStateManager(); // Deactivate all Trackables. foreach (Trackable trackable in dataSet.GetTrackables()) { stateManager.EnableTrackableBehavioursForTrackable(trackable, false); } mActiveDataSets.Remove(dataSetImpl); return(true); }
// Destroy the given dataset. // Returns false if the given dataset is active. public override bool DestroyDataSet(DataSet dataSet, bool destroyTrackables) { if (dataSet == null) { Debug.LogError("Dataset is null."); return(false); } if (destroyTrackables) { dataSet.DestroyAllTrackables(true); } DataSetImpl dataSetImpl = (DataSetImpl)dataSet; if (QCARWrapper.Instance.ImageTrackerDestroyDataSet(dataSetImpl.DataSetPtr) == 0) { Debug.LogError("Could not destroy dataset."); return(false); } mDataSets.Remove(dataSet); return(true); }
public VirtualButtonImpl(string name, int id, RectangleData area, ImageTarget imageTarget, DataSet dataSet) { this.mName = name; this.mID = id; this.mArea = area; this.mIsEnabled = true; this.mParentImageTarget = imageTarget; this.mParentDataSet = (DataSetImpl)dataSet; }
public VirtualButtonImpl(string name, int id, RectangleData area, ImageTarget imageTarget, DataSet dataSet) { mName = name; mID = id; mArea = area; mIsEnabled = true; mParentImageTarget = imageTarget; mParentDataSet = (DataSetImpl)dataSet; }
/// <summary> /// Sample code to set datasets (SQL & XML) using a .rdlx file. /// </summary> /// <param name="args">nothing</param> static void Main(string[] args) { // Initialize the engine Report.Init(); // Open template file and create output file using (FileStream template = new FileStream("../../files/Sample Dataset Template.docx", FileMode.Open, FileAccess.Read, FileShare.Read)) { using (FileStream output = new FileStream("../../files/Sample Dataset Report.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) { // Create report process using (Report myReport = new ReportPdf(template, output)) { // read in the template myReport.ProcessSetup(); // XML datasource using (FileStream xmlFile = new FileStream("../../files/SouthWind.xml", FileMode.Open, FileAccess.Read, FileShare.Read)) using (FileStream xmlSchema = new FileStream("../../files/SouthWind.xsd", FileMode.Open, FileAccess.Read, FileShare.Read)) using (SaxonDataSourceImpl dsSaxon = new SaxonDataSourceImpl(xmlFile, xmlSchema)) using (DataSetImpl dsEmployeesUnder5 = new DataSetImpl("employeesUnder5", "/windward-studios/Employees/Employee[@EmployeeID < 5]", dsSaxon)) using (DataSetImpl dsCustStartA = new DataSetImpl("CustStartA", "/windward-studios/Customers/Customer[starts-with(CompanyName, 'A')]", dsSaxon)) // SQL datasource using (AdoDataSourceImpl dsAdo = new AdoDataSourceImpl("System.Data.SqlClient", "Data Source=mssql.windward.net;Initial Catalog=Northwind;User ID=demo;Password=demo")) using (DataSetImpl dsEmployeesMoreThan5 = new DataSetImpl("EmpMoreThan5", "SELECT * FROM dbo.Employees WHERE(dbo.Employees.EmployeeID > 5)", dsAdo)) using (DataSetImpl dsCustStartWithB = new DataSetImpl("CustStartWithB", "SELECT * FROM dbo.Customers WHERE(dbo.Customers.CompanyName like 'B%')", dsAdo)) { IDictionary <string, IReportDataSource> datasources = new Dictionary <string, IReportDataSource>(); datasources.Add("SW", dsSaxon); datasources.Add("employeesUnder5", dsEmployeesUnder5); datasources.Add("CustStartA", dsCustStartA); datasources.Add("MSSQL", dsAdo); datasources.Add("EmpMoreThan5", dsEmployeesMoreThan5); datasources.Add("CustStartWithB", dsCustStartWithB); myReport.ProcessData(datasources); } // all data applied, finish up the report. myReport.ProcessComplete(); // no need to call close because of the using constructs } } } // Opens the finished report string fullPath = Path.GetFullPath("../../files/Sample Dataset Report.pdf"); Console.Out.WriteLine(string.Format("launching {0}", fullPath)); System.Diagnostics.Process.Start(fullPath); }
public ImageTargetImpl(string name, int id, ImageTargetType imageTargetType, DataSet dataSet) : base(name, id) { this.mImageTargetType = imageTargetType; this.mDataSet = (DataSetImpl)dataSet; IntPtr size = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector2))); QCARWrapper.Instance.ImageTargetGetSize(this.mDataSet.DataSetPtr, base.Name, size); this.mSize = (Vector2)Marshal.PtrToStructure(size, typeof(Vector2)); Marshal.FreeHGlobal(size); this.mVirtualButtons = new Dictionary <int, VirtualButton>(); this.CreateVirtualButtonsFromNative(); }
public CylinderTargetImpl(string name, int id, DataSet dataSet) : base(name, id) { this.mDataSet = (DataSetImpl)dataSet; float[] destination = new float[3]; IntPtr dimensions = Marshal.AllocHGlobal((int)(3 * Marshal.SizeOf(typeof(float)))); QCARWrapper.Instance.CylinderTargetGetSize(this.mDataSet.DataSetPtr, base.Name, dimensions); Marshal.Copy(dimensions, destination, 0, 3); Marshal.FreeHGlobal(dimensions); this.mSideLength = destination[0]; this.mTopDiameter = destination[1]; this.mBottomDiameter = destination[2]; }
public override DataSet CreateDataSet() { IntPtr dataSetPtr = QCARWrapper.Instance.ImageTrackerCreateDataSet(); if (dataSetPtr == IntPtr.Zero) { Debug.LogError("Could not create dataset."); return(null); } DataSet item = new DataSetImpl(dataSetPtr); this.mDataSets.Add(item); return(item); }
public ImageTargetImpl(string name, int id, ImageTargetType imageTargetType, DataSet dataSet) : base(name, id) { Type = TrackableType.IMAGE_TARGET; mImageTargetType = imageTargetType; mDataSet = (DataSetImpl)dataSet; // read size from native: IntPtr sizePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector2))); QCARWrapper.Instance.ImageTargetGetSize(mDataSet.DataSetPtr, Name, sizePtr); mSize = (Vector2)Marshal.PtrToStructure(sizePtr, typeof(Vector2)); Marshal.FreeHGlobal(sizePtr); mVirtualButtons = new Dictionary<int, VirtualButton>(); CreateVirtualButtonsFromNative(); }
public ImageTargetImpl(string name, int id, ImageTargetType imageTargetType, DataSet dataSet) : base(name, id) { Type = TrackableType.IMAGE_TARGET; mImageTargetType = imageTargetType; mDataSet = (DataSetImpl)dataSet; // read size from native: IntPtr sizePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector2))); QCARWrapper.Instance.ImageTargetGetSize(mDataSet.DataSetPtr, Name, sizePtr); mSize = (Vector2)Marshal.PtrToStructure(sizePtr, typeof(Vector2)); Marshal.FreeHGlobal(sizePtr); mVirtualButtons = new Dictionary <int, VirtualButton>(); CreateVirtualButtonsFromNative(); }
public CylinderTargetImpl(string name, int id, DataSet dataSet) : base(name, id) { Type = TrackableType.CYLINDER_TARGET; mDataSet = (DataSetImpl)dataSet; // read size from native: var dimensions = new float[3]; IntPtr sizePtr = Marshal.AllocHGlobal(3 * Marshal.SizeOf(typeof(float))); QCARWrapper.Instance.CylinderTargetGetSize(mDataSet.DataSetPtr, Name, sizePtr); Marshal.Copy(sizePtr, dimensions, 0, 3); Marshal.FreeHGlobal(sizePtr); mSideLength = dimensions[0]; mTopDiameter = dimensions[1]; mBottomDiameter = dimensions[2]; }
public override bool ActivateDataSet(DataSet dataSet) { if (dataSet == null) { Debug.LogError("Dataset is null."); return(false); } DataSetImpl item = (DataSetImpl)dataSet; if (QCARWrapper.Instance.ImageTrackerActivateDataSet(item.DataSetPtr) == 0) { Debug.LogError("Could not activate dataset."); return(false); } StateManagerImpl stateManager = (StateManagerImpl)TrackerManager.Instance.GetStateManager(); foreach (Trackable trackable in item.GetTrackables()) { stateManager.EnableTrackableBehavioursForTrackable(trackable, true); } this.mActiveDataSets.Add(item); return(true); }
/// <summary> /// Checks if a data set exists at the given path. /// Storage type is used to correctly interpret the given path. /// </summary> public static bool Exists(String path, StorageType storageType) { return(DataSetImpl.ExistsImpl(path, storageType)); }
// Creates a new empty dataset. public override DataSet CreateDataSet() { IntPtr dataSetPtr = QCARWrapper.Instance.ImageTrackerCreateDataSet(); if (dataSetPtr == IntPtr.Zero) { Debug.LogError("Could not create dataset."); return null; } DataSet dataSet = new DataSetImpl(dataSetPtr); mDataSets.Add(dataSet); return dataSet; }
public MultiTargetImpl(string name, int id, DataSet dataSet) : base(name, id) { this.mDataSet = (DataSetImpl)dataSet; }