| 27 | } |
| 28 | |
| 29 | static 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()) |
nothing calls this directly
no test coverage detected