3 #include <SimoxUtility/algorithm/string.h>
6 #include <ArmarXCore/interface/core/BasicVectorTypes.h>
17 { OVERRIDE_MATERIAL,
"Override_Material" },
23 { ORIGINAL,
"Original" },
24 { COLLISION,
"Collision" },
25 { OVERRIDE_COLOR,
"Override_Color" },
31 j[
"x"] = coloredPoint.x;
32 j[
"y"] = coloredPoint.y;
33 j[
"z"] = coloredPoint.z;
34 j[
"color"] = coloredPoint.color;
39 coloredPoint.x = j.at(
"x");
40 coloredPoint.y = j.at(
"y");
41 coloredPoint.z = j.at(
"z");
42 coloredPoint.color = j.at(
"color");
49 j[
"length"] = arrow.length;
50 j[
"width"] = arrow.width;
55 arrow.length = j.at(
"length");
56 arrow.width = j.at(
"width");
60 void data::to_json(nlohmann::json& j,
const ElementArrowCircle& arrowCircle)
63 j[
"radius"] = arrowCircle.radius;
64 j[
"completion"] = arrowCircle.completion;
65 j[
"width"] = arrowCircle.width;
70 arrowCircle.radius = j.at(
"radius");
71 arrowCircle.completion = j.at(
"completion");
72 arrowCircle.width = j.at(
"width");
84 box.size = j.at(
"size").get<armarx::Vector3f>();
91 j[
"height"] = cylinder.height;
92 j[
"radius"] = cylinder.radius;
97 cylinder.height = j.at(
"height");
98 cylinder.radius = j.at(
"radius");
105 j[
"height"] = cylindroid.height;
106 j[
"axisLengths"] = cylindroid.axisLengths;
107 j[
"curvature"] = cylindroid.curvature;
112 cylindroid.height = j.at(
"height");
113 cylindroid.axisLengths = j.at(
"axisLengths").get<armarx::Vector2f>();
114 cylindroid.curvature = j.at(
"curvature").get<armarx::Vector2f>();
121 j[
"from"] = line.from;
123 j[
"lineWidth"] = line.lineWidth;
128 line.from = j.at(
"from").get<armarx::Vector3f>();
129 line.to = j.at(
"to").get<armarx::Vector3f>();
130 line.lineWidth = j.at(
"lineWidth").get<
float>();
137 j[
"# Vertices"] = mesh.vertices.size();
138 j[
"# Colors"] = mesh.colors.size();
139 j[
"# Faces"] = mesh.faces.size();
154 j[
"transparency"] = pointCloud.transparency;
155 j[
"pointSizeInPixels"] = pointCloud.pointSizeInPixels;
157 std::size_t numPoints = pointCloud.points.size() /
sizeof (ColoredPoint);
158 j[
"# Points"] = numPoints;
161 ColoredPoint
const* begin = (ColoredPoint
const*)pointCloud.points.data();
162 ColoredPoint
const* end = begin +
std::min(std::size_t(10), numPoints);
163 j[
"Points[0:10]"] = ColoredPointList(begin, end);
168 pointCloud.transparency = j.at(
"transparency");
169 pointCloud.pointSizeInPixels = j.at(
"pointSizeInPixels");
176 j[
"lineColor"] = polygon.lineColor;
178 j[
"lineWidth"] = polygon.lineWidth;
179 j[
"points"] = polygon.points;
184 polygon.lineColor = j.at(
"lineColor");
185 polygon.lineWidth = j.at(
"lineWidth");
186 polygon.points = j.at(
"points").get<std::vector<armarx::Vector3f>>();
203 j[
"points"] = path.points;
209 path.points = j.at(
"points").get<armarx::Vector3fSeq>();
216 j[
"radius"] = sphere.radius;
221 sphere.radius = j.at(
"radius");
228 j[
"axisLengths"] = ellipsoid.axisLengths;
229 j[
"curvature"] = ellipsoid.curvature;
234 ellipsoid.axisLengths = j.at(
"axisLengths");
235 ellipsoid.curvature = j.at(
"curvature");
242 j[
"text"] = text.text;
247 text.text = j.at(
"text");
251 namespace data::ModelDrawStyle
255 std::vector<std::string> flag_names;
256 for (
int flag :
names.values())
258 if (drawStyle == flag
261 flag_names.push_back(
names.to_name(flag));
264 return simox::alg::join(flag_names,
" | ");
269 bool trim_elements =
true;
274 flag |=
names.from_name(
s);
284 j[
"project"] =
object.project;
285 j[
"filename"] =
object.filename;
293 object.project = j.at(
"project");
294 object.filename = j.at(
"filename");
302 j[
"project"] = robot.project;
303 j[
"filename"] = robot.filename;
304 j[
"jointValues"] = robot.jointValues;
312 robot.project = j.at(
"project");
313 robot.filename = j.at(
"filename");
314 robot.jointValues = j.at(
"jointValues").get<armarx::StringFloatDictionary>();