MCPcopy Create free account
hub / github.com/Kitware/VTK / Serialize_vtkXYPlotActor

Function Serialize_vtkXYPlotActor

Rendering/Annotation/vtkXYPlotActorSerDesHelper.cxx:29–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29static nlohmann::json Serialize_vtkXYPlotActor(vtkObjectBase* object, vtkSerializer* serializer)
30{
31 using json = nlohmann::json;
32 if (auto* xyPlotActor = vtkXYPlotActor::SafeDownCast(object))
33 {
34 json state;
35 if (auto superSerializer = serializer->GetHandler(typeid(vtkXYPlotActor::Superclass)))
36 {
37 state = superSerializer(object, serializer);
38 }
39 state["SuperClassNames"].push_back("vtkObject");
40
41 auto& stateOfInputDataObjects = state["InputDataObjects"] = json::array();
42 for (unsigned int index = 0; index < xyPlotActor->GetNumberOfDataObjectInputConnections();
43 ++index)
44 {
45 auto* inputAlgorithm = xyPlotActor->GetDataObjectInputConnection(index)->GetProducer();
46 inputAlgorithm->Update();
47 auto* inputDataObject = inputAlgorithm->GetOutputDataObject(0);
48 stateOfInputDataObjects.push_back(serializer->SerializeJSON(inputDataObject));
49 }
50
51 auto& stateOfInputDataSets = state["InputDataSets"] = json::array();
52 for (unsigned int index = 0; index < xyPlotActor->GetNumberOfDataSetInputConnections(); ++index)
53 {
54 auto* inputAlgorithm = xyPlotActor->GetDataSetInputConnection(index)->GetProducer();
55 inputAlgorithm->Update();
56 auto* inputDataObject = inputAlgorithm->GetOutputDataObject(0);
57 stateOfInputDataSets.push_back(serializer->SerializeJSON(inputDataObject));
58 }
59
60 state["DataObjectPlotMode"] = xyPlotActor->GetDataObjectPlotMode();
61 state["PlotCurvePoints"] = xyPlotActor->GetPlotCurvePoints();
62 state["PlotCurveLines"] = xyPlotActor->GetPlotCurveLines();
63 state["ExchangeAxes"] = xyPlotActor->GetExchangeAxes();
64 state["ReverseXAxis"] = xyPlotActor->GetReverseXAxis();
65 state["ReverseYAxis"] = xyPlotActor->GetReverseYAxis();
66 if (auto ptr = xyPlotActor->GetTitle())
67 {
68 state["Title"] = ptr;
69 }
70 if (auto ptr = xyPlotActor->GetXTitle())
71 {
72 state["XTitle"] = ptr;
73 }
74 if (auto ptr = xyPlotActor->GetYTitle())
75 {
76 state["YTitle"] = ptr;
77 }
78 if (auto ptr = xyPlotActor->GetXRange())
79 {
80 auto& dst = state["XRange"] = json::array();
81 for (int i = 0; i < 2; ++i)
82 {
83 dst.push_back(ptr[i]);
84 }
85 }
86 if (auto ptr = xyPlotActor->GetYRange())

Callers

nothing calls this directly

Calls 15

arrayClass · 0.85
GetProducerMethod · 0.80
SerializeJSONMethod · 0.80
GetXTitleMethod · 0.80
GetXRangeMethod · 0.80
GetYRangeMethod · 0.80

Tested by

no test coverage detected