10 #include "mtl/environment.h"
11 #include "mtl/envXmlWriter.h"
31 #include "vlutil/vlStringUtil.h"
32 #include "vlutil/vlFilename.h"
34 #include <boost/function.hpp>
35 #include <boost/lexical_cast.hpp>
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));
115 DtEnvValueSP newElement = AddElement(env,
DtXMLIntType, root, name);
116 newElement->setValue(
DtString(value));
122 return env->addAttribute(name, value ?
"True" :
"False", root);
130 DtEnvValueSP newElement = AddElement(env,
DtXMLStringType, root, name);
131 newElement->setValue(MtlBindingCharToXml(value));
137 DtEnvValueSP attr = env->getAttribute(name, root);
157 static std::list<DtObjectType> additionalMatchTypes(
DtEnvironmentSP env, DtEnvValueSP root);
158 static void setAdditionalMatchTypes(
DtEnvironmentSP env, DtEnvValueSP root,
const std::list<DtObjectType>& types);
182 const DtEnvValueSP parentNode, DtTaitBryan& orientation)
184 orientation.setPsi(getDoubleAttribute(env,
DtXMLYaw, parentNode));
185 orientation.setTheta(getDoubleAttribute(env,
DtXMLPitch, parentNode));
186 orientation.setPhi(getDoubleAttribute(env,
DtXMLRoll, parentNode));
192 static void CreateVariableBinding(
const DtString& bindingType,
212 const DtString& dataSourceFilename,
bool showConsoleOutput =
true);
215 const DtString& type, DtEnvValueSP root);
238 DtEnvValueSP envValue,
bool traverseElements =
true)
241 attributeValue, envValue);
246 const DtString& attributeValue, DtEnvValueSP envValue,
247 bool traverseElements =
true);
257 static bool IsGroupedElement(
const DtString& rwName,
261 DtEnvValueSP parentNode,
const DtString& groupName,
262 bool createIfMissing =
true);
265 DtEnvValueSP parentNode,
const DtString& groupName);
276 DtEnvValueSP parent,
DtString bindingName =
"")
279 DtEnvValueSP newObject = env->addObject(name, name, parent);
280 if (bindingName !=
"")
291 DtEnvValueSP simObjectNode);
298 const DtString& dataSourceFilename,
bool showConsoleOutput =
true);
305 writer.setIndentation(
" ");
306 writer.writeFile(*env, filename);
317 DtString objType = getAttribute(env, attributeName, root);
320 ot = objType.c_str();
326 bool fallbackOnObjectType =
true)
337 static std::list<DtObjectType> getMatchTypes(
DtEnvironmentSP env, DtEnvValueSP root,
338 bool fallbackOnObjectType =
true);
341 bool fallbackOnMatchType =
true)
346 return getMatchType(env, root,
false);
353 double& x,
double& y,
double& z)
373 const DtRwVector* vec,
bool writeAsBodyPosition)
375 if (writeAsBodyPosition)
392 sprintf(buff,
"%X", number);