23#ifndef vtkMRMLMarkupsJsonElement_h
24#define vtkMRMLMarkupsJsonElement_h
27#include "vtkSlicerMarkupsModuleMRMLExport.h"
30#include "vtkSmartPointer.h"
44 void PrintSelf(ostream& os, vtkIndent indent)
override;
Simple class for storing standard coded entries (coding scheme, value, meaning triplets)
Represents a json object or list.
double GetDoubleProperty(const char *propertyName)
friend class vtkMRMLMarkupsJsonReader
VTK_NEWINSTANCE vtkMRMLMarkupsJsonElement * GetArrayItem(int childItemIndex)
bool GetVectorProperty(const char *propertyName, double *v, int numberOfComponents=3)
bool GetStringVectorProperty(const char *propertyName, std::vector< std::string > &arrayValues)
int GetArraySize()
Returns the number of elements in this array.
int GetIntProperty(const char *propertyName)
VTK_NEWINSTANCE vtkMRMLMarkupsJsonElement * GetArrayProperty(const char *arrayName)
bool GetDoubleProperty(const char *propertyName, double &propertyValue)
vtkMRMLMarkupsJsonElement(const vtkMRMLMarkupsJsonElement &)
bool GetArrayItemsStringProperty(const char *arrayName, const char *propertyName, std::vector< std::string > &propertyValues)
bool GetStringProperty(const char *propertyName, std::string &propertyValue)
bool HasErrors()
Returns true if user messages contain error messages.
bool GetIntProperty(const char *propertyName, int &propertyValue)
bool GetMatrix4x4Property(const char *propertyName, double v[16], bool flipRasLps)
VTK_NEWINSTANCE vtkDoubleArray * GetDoubleArrayProperty(const char *propertyName)
void operator=(const vtkMRMLMarkupsJsonElement &)
vtkNew< vtkMRMLMessageCollection > UserMessages
vtkMRMLMarkupsJsonElement()
VTK_NEWINSTANCE vtkMRMLMarkupsJsonElement * GetObjectProperty(const char *objectName)
~vtkMRMLMarkupsJsonElement() override
VTK_NEWINSTANCE vtkCodedEntry * GetCodedEntryProperty(const char *propertyName)
std::string GetSchema()
Get the JSON schema name.
std::string GetStringProperty(const char *propertyName)
static vtkMRMLMarkupsJsonElement * New()
void PrintSelf(ostream &os, vtkIndent indent) override
bool GetBoolProperty(const char *propertyName)
Get Boolean property value.
bool HasMember(const char *propertyName)
Returns true if the JSON object contains a member by this name.
bool IsArray()
Returns true if this element is an array.
vtkMRMLMarkupsJsonReader()
void PrintSelf(ostream &os, vtkIndent indent) override
void operator=(const vtkMRMLMarkupsJsonReader &)
vtkNew< vtkMRMLMessageCollection > UserMessages
~vtkMRMLMarkupsJsonReader() override
bool HasErrors()
Returns true if user messages contain error messages.
VTK_NEWINSTANCE vtkMRMLMarkupsJsonElement * ReadFromFile(const char *filePath)
vtkMRMLMarkupsJsonReader(const vtkMRMLMarkupsJsonReader &)
static vtkMRMLMarkupsJsonReader * New()
void PrintSelf(ostream &os, vtkIndent indent) override
vtkMRMLMarkupsJsonWriter(const vtkMRMLMarkupsJsonWriter &)
bool HasErrors()
Returns true if user messages contain error messages.
void WriteDoubleArrayProperty(const char *propertyName, vtkDoubleArray *doubleArray)
void WriteCodedEntryProperty(const std::string &propertyName, vtkCodedEntry *codedEntry)
void WriteStringProperty(const std::string &propertyName, const std::string &propertyValue)
void WriteStringPropertyIfNotEmpty(const std::string &propertyName, const std::string &propertyValue)
void WriteArrayPropertyEnd()
This method must be called when all array items are written.
void WriteMatrix4x4Property(const std::string &propertyName, double v[16], bool flipRasLps)
void WriteBoolProperty(const std::string &propertyName, bool propertyValue)
vtkNew< vtkMRMLMessageCollection > UserMessages
void WriteDoubleProperty(const std::string &propertyName, double propertyValue)
vtkMRMLMarkupsJsonWriter()
bool WriteToFileBegin(const char *filePath, const char *schema)
void operator=(const vtkMRMLMarkupsJsonWriter &)
~vtkMRMLMarkupsJsonWriter() override
static vtkMRMLMarkupsJsonWriter * New()
void WriteIntProperty(const std::string &propertyName, int propertyValue)
void WriteObjectEnd()
This method must be called when all properties of the object are written.
void WriteStringVectorProperty(const std::string &propertyName, const std::vector< std::string > &arrayValues)
void WriteObjectPropertyEnd()
This method must be called when all properties of the object are written.
void WriteObjectPropertyStart(const std::string &propertyName)
This method creates a new object as a property.
void WriteArrayPropertyStart(const std::string &propertyName)
This method creates a new array as a property.
void WriteObjectStart()
This method creates a new object in an array.
void WriteVectorProperty(const std::string &propertyName, double *v, int numberOfComponents=3)