本文整理汇总了C#中ConfigData.CopyImageTargetNames方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigData.CopyImageTargetNames方法的具体用法?C# ConfigData.CopyImageTargetNames怎么用?C# ConfigData.CopyImageTargetNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigData
的用法示例。
在下文中一共展示了ConfigData.CopyImageTargetNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLatestITName
// Returns the name of the Image Target that has been parsed the latest.
// Returns null if no Image Target has been parsed yet.
private static string GetLatestITName(ConfigData backlog)
{
if (backlog == null)
return null;
string[] itNames = new string[backlog.NumImageTargets];
try
{
backlog.CopyImageTargetNames(itNames, 0);
}
catch
{
return null;
}
return itNames[backlog.NumImageTargets - 1];
}
示例2: structToFile
// This method reads a config.xml file at the given path and fills the
// ConfigData object with the data.
public bool structToFile(string configXMLPath, ConfigData configData)
{
// If there are no trackables in the data set we don't write a config file.
if (configData.NumTrackables <= 0)
return false;
XmlWriterSettings configWriterSettings = new XmlWriterSettings();
configWriterSettings.Indent = true;
using (XmlWriter configWriter =
XmlWriter.Create(configXMLPath, configWriterSettings))
{
configWriter.WriteStartDocument();
configWriter.WriteStartElement("QCARConfig");
configWriter.WriteAttributeString("xmlns", "xsi", null,
"http://www.w3.org/2001/XMLSchema-instance");
configWriter.WriteAttributeString("xsi",
"noNamespaceSchemaLocation", null, "qcar_config.xsd");
configWriter.WriteStartElement("Tracking");
// Writing Image Target elements into config.xml file.
string[] imageTargetNames = new string[configData.NumImageTargets];
configData.CopyImageTargetNames(imageTargetNames, 0);
for (int i = 0; i < imageTargetNames.Length; ++i)
{
ConfigData.ImageTarget it;
configData.GetImageTarget(imageTargetNames[i], out it);
configWriter.WriteStartElement("ImageTarget");
string imageTargetSize = it.size.x.ToString() + " " +
it.size.y.ToString();
configWriter.WriteAttributeString("size", imageTargetSize);
configWriter.WriteAttributeString("name", imageTargetNames[i]);
// Writing Virtual Button elements into config.xml file per
// Image Target.
List<ConfigData.VirtualButton> vbs = it.virtualButtons;
for (int j = 0; j < vbs.Count; j++)
{
configWriter.WriteStartElement("VirtualButton");
configWriter.WriteAttributeString("name", vbs[j].name);
string virtualButtonRectangle =
vbs[j].rectangle.x.ToString() + " " +
vbs[j].rectangle.y.ToString() + " " +
vbs[j].rectangle.z.ToString() + " " +
vbs[j].rectangle.w.ToString();
configWriter.WriteAttributeString("rectangle",
virtualButtonRectangle);
if (vbs[j].enabled)
configWriter.WriteAttributeString("enabled",
"true");
else
configWriter.WriteAttributeString("enabled",
"false");
if (vbs[j].sensitivity ==
VirtualButtonBehaviour.Sensitivity.LOW)
configWriter.WriteAttributeString("sensitivity",
"low");
else if (vbs[j].sensitivity ==
VirtualButtonBehaviour.Sensitivity.MEDIUM)
configWriter.WriteAttributeString("sensitivity",
"medium");
else if (vbs[j].sensitivity ==
VirtualButtonBehaviour.Sensitivity.HIGH)
configWriter.WriteAttributeString("sensitivity",
"high");
configWriter.WriteEndElement(); // VirtualButton
}
configWriter.WriteEndElement(); // ImageTarget
}
// Writing Multi Target elements into config.xml file
string[] multiTargetNames = new string[configData.NumMultiTargets];
configData.CopyMultiTargetNames(multiTargetNames, 0);
for (int i = 0; i < multiTargetNames.Length; i++)
{
ConfigData.MultiTarget mt;
configData.GetMultiTarget(multiTargetNames[i], out mt);
configWriter.WriteStartElement("MultiTarget");
configWriter.WriteAttributeString("name", multiTargetNames[i]);
// Writing Multi Target Part elements into config.xml file
List<ConfigData.MultiTargetPart> prts = mt.parts;
for (int j = 0; j < prts.Count; j++)
{
configWriter.WriteStartElement("Part");
configWriter.WriteAttributeString("name", prts[j].name);
string multiTargetTranslation =
prts[j].translation.x.ToString() + " " +
prts[j].translation.z.ToString() + " " +
prts[j].translation.y.ToString();
configWriter.WriteAttributeString("translation",
multiTargetTranslation);
float rotationAngle;
//.........这里部分代码省略.........