MCPcopy Create free account
hub / github.com/Kitware/ParaView / serializeToJSON

Method serializeToJSON

Qt/Components/pqCameraKeyFrameWidget.cxx:276–309  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

274
275//-----------------------------------------------------------------------------
276Json::Value pqCameraKeyFrameWidget::serializeToJSON() const
277{
278 Json::Value keyFrame;
279
280 auto addJSONVector = [&keyFrame](const char* name, const double* value, size_t size)
281 {
282 for (unsigned int idx = 0; idx < size; idx++)
283 {
284 keyFrame[name].insert(idx, value[idx]);
285 }
286 };
287
288 if (this->usePathBasedMode())
289 {
290 auto positions = vtkSMPropertyHelper(this->Internal->PSplineProxy, "Points").GetDoubleArray();
291 addJSONVector("positions", positions.data(), positions.size());
292 keyFrame["positionPathClosed"] =
293 vtkSMPropertyHelper(this->Internal->PSplineProxy, "Closed").GetAsInt();
294 auto focalPoints = vtkSMPropertyHelper(this->Internal->FSplineProxy, "Points").GetDoubleArray();
295 addJSONVector("focalPoints", focalPoints.data(), focalPoints.size());
296 keyFrame["focalPointPathClosed"] =
297 vtkSMPropertyHelper(this->Internal->FSplineProxy, "Closed").GetAsInt();
298 addJSONVector("viewUp", this->Internal->viewUp_Path(), 3);
299 }
300 else
301 {
302 keyFrame["parallelScale"] = this->Internal->getParallelScale();
303 keyFrame["viewAngle"] = this->Internal->getViewAngle();
304 addJSONVector("viewUp", this->Internal->viewUp_NonPath(), 3);
305 addJSONVector("position", this->Internal->position(), 3);
306 addJSONVector("focalPoint", this->Internal->focalPoint(), 3);
307 }
308 return keyFrame;
309}
310
311//-----------------------------------------------------------------------------
312void pqCameraKeyFrameWidget::setPositionPoints(const std::vector<double>& positions)

Callers

nothing calls this directly

Calls 12

usePathBasedModeMethod · 0.95
GetDoubleArrayMethod · 0.80
GetAsIntMethod · 0.80
viewUp_PathMethod · 0.80
getParallelScaleMethod · 0.80
getViewAngleMethod · 0.80
viewUp_NonPathMethod · 0.80
positionMethod · 0.80
focalPointMethod · 0.80
insertMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected