10 #include "mtl/environment.h"
11 #include "mtl/envXmlWriter.h"
19 #include "vrfExtProtocol/objectType.h"
20 #include "vrfExtProtocol/rangedObjectType.h"
31 #include "vlutil/vlStringUtil.h"
32 #include "vlutil/vlFilename.h"
34 #include <boost/function.hpp>
35 #include <boost/lexical_cast.hpp>
55 static DtEnvValueSP findObjectElementByMatchType(
DtEnvironmentSP env,
const DtObjectType& objType);
56 static DtEnvValueSP findObjectElementByObjectType(
DtEnvironmentSP env,
const DtObjectType& objType);
79 static DtString GetObjectValue(DtEnvValueSP root)
81 return XmlBindingCharToMtl(root->value());
85 DtEnvValueSP root,
const DtString& paramName = DtString::nullString())
87 FindAndRemove(env, type, paramName, root);
88 DtEnvValueSP newElement = env->addObject(type, type, root);
89 if (paramName != DtString::nullString())
100 newElement->setValue(value ?
"True" :
"False");
107 DtEnvValueSP newElement = AddElement(env,
DtXMLRealType, root, name);
108 newElement->setValue(
DtString(value));
114 return env->addAttribute(name, value ?
"True" :
"False", root);
122 DtEnvValueSP newElement = AddElement(env,
DtXMLStringType, root, name);
123 newElement->setValue(MtlBindingCharToXml(value));
129 DtEnvValueSP attr = env->getAttribute(name, root);
139 static void setObjectType(
DtEnvironmentSP env, DtEnvValueSP root,
const DtObjectType& t)
144 static void setMatchType(
DtEnvironmentSP env, DtEnvValueSP root,
const DtObjectType& t)
171 const DtEnvValueSP parentNode, DtTaitBryan& orientation)
173 orientation.setPsi(getDoubleAttribute(env,
DtXMLYaw, parentNode));
174 orientation.setTheta(getDoubleAttribute(env,
DtXMLPitch, parentNode));
175 orientation.setPhi(getDoubleAttribute(env,
DtXMLRoll, parentNode));
181 static void CreateVariableBinding(
const DtString& bindingType,
201 const DtString& dataSourceFilename,
bool showConsoleOutput =
true);
204 const DtString& type, DtEnvValueSP root);
227 DtEnvValueSP envValue,
bool traverseElements =
true)
230 attributeValue, envValue);
235 const DtString& attributeValue, DtEnvValueSP envValue,
236 bool traverseElements =
true);
246 static bool IsGroupedElement(
const DtString& rwName,
250 DtEnvValueSP parentNode,
const DtString& groupName,
251 bool createIfMissing =
true);
254 DtEnvValueSP parentNode,
const DtString& groupName);
261 DtEnvValueSP parent,
DtString bindingName =
"")
264 DtEnvValueSP newObject = env->addObject(name, name, parent);
265 if (bindingName !=
"")
276 DtEnvValueSP simObjectNode);
283 const DtString& dataSourceFilename,
bool showConsoleOutput =
true);
290 writer.setIndentation(
" ");
291 writer.writeFile(*env, filename);
302 DtString objType = getAttribute(env, attributeName, root);
305 ot = objType.c_str();
311 bool fallbackOnObjectType =
true)
314 if (matchType == DtObjectType::nullType() && fallbackOnObjectType)
323 bool fallbackOnMatchType =
true)
325 DtObjectType objectType = getObjectTypeAttr(env,
DtXMLObjectType, root);
326 if (objectType == DtObjectType::nullType() && fallbackOnMatchType)
328 return getMatchType(env, root,
false);
335 double& x,
double& y,
double& z)
355 const DtRwVector* vec,
bool writeAsBodyPosition)
357 if (writeAsBodyPosition)
374 sprintf(buff,
"%X", number);