35template <
typename T >
39 v.
write(out, asBinary);
40 if (!asBinary) { out << std::endl; }
45inline bool CSOWriteValueToStream<Variant>(std::ostream& out,
const Variant& value,
bool asBinary)
47 value.
write(out, asBinary);
48 if (!asBinary) { out << std::endl; }
53inline bool CSOWriteValueToStream<CSOPathPoints>(std::ostream& out,
const CSOPathPoints& value,
bool asBinary)
56 numPathPoints.
write(out, asBinary);
57 if (!asBinary) { Variant::writeValue(out,
" ", asBinary); }
59 for (
unsigned int k = 0; k < static_cast<unsigned int>(numPathPoints.
toInt()); ++k)
62 for (
unsigned int i = 0; i < 3; ++i)
64 Variant::writeValue(out, pos[i], asBinary);
65 if (!asBinary) { Variant::writeValue(out,
" ", asBinary); }
68 if (!asBinary) { out << std::endl; }
74template <
typename T >
79 if (!asBinary) { in.ignore(); }
92inline bool CSOReadValueFromStream<Variant>(std::istream& in,
Variant& value,
bool asBinary)
94 value.
read(in, asBinary);
95 if (!asBinary) { in.ignore(); }
100inline bool CSOReadValueFromStream<CSOPathPoints>(std::istream& in,
CSOPathPoints& value,
bool asBinary)
103 numPathPoints.
read(in, asBinary);
109 for (
unsigned int k = 0; k < static_cast<unsigned int>(numPathPoints.
toInt()); ++k)
112 for (
unsigned int i = 0; i < 3; ++i)
114 Variant::readValue(in, pos[i], asBinary);
118 if (!asBinary) { in.ignore(); }
145 bool saveTo(std::ostream& outStream)
const;
150 void loadFrom(std::istream& inStream,
short version,
bool swapBytes);
214 void sendAttributesChangedPreEvent();
216 void sendAttributesChangedPostEvent();
224 std::map < std::string, Variant > _variantMap;
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
This class comprises some attributes that are common for a CSO and a CSOGroup.
~CSOAttributes()
Destructor.
float seedPointSize
The marker's size.
void loadFrom(std::istream &inStream, short version, bool swapBytes)
Loads attributes from specified file stream.
bool readFromStream(std::istream &inStream, bool asBinary, short version)
Reads the attribute values from the specified stream.
void getUserDataNames(std::vector< std::string > &names) const
Fills the specified vector with the keys/name under which user data are stored for this CSO.
void setUserData(const std::string &name, Variant value)
int pathPointStyle
The line style of this CSO or CSOGroup.
bool saveToASCII(std::ostream &outStream) const
Saves attributes to specified stream in ASCII format. Returns whether saving was successful.
void setCSOGroup(CSOGroup *group)
Sets a pointer to the associated CSOGroup.
void reset()
Sets default values to all members.
Vector3 seedPointColor
The marker's color.
std::string label
Label string for this contour.
float voxelWriteValue
The target voxel value.
bool showState
Should this CSO or CSOGroup be shown?
int seedPointStyle
The marker mode.
void removeUserData(const std::string &name)
Removes a user data entry.
std::string description
Description string for this contour.
float pathPointWidth
The line width of this CSO or CSOGroup.
bool saveTo(std::ostream &outStream) const
Saves attributes to specified stream and returns whether the saving was successful.
bool editableState
Should this CSO or CSOGroup be editable?
bool voxelizeState
Should this CSO or CSOGroup be voxelized?
Variant getUserData(const std::string &name) const
Returns the user data under the specified name or an invalid value if the entry does not exist.
float seedPointAlpha
The marker's alpha value.
int timePointIndex
The time point index of this contour.
float pathPointAlpha
The alpha value of this CSO or CSOGroup.
int voxelWriteMode
The write mode for voxel values.
Vector3 pathPointColor
The color of this CSO or CSOGroup.
void setCSO(CSO *cso)
Sets a pointer to the associated CSO.
void loadFromASCII(std::istream &inStream, short version)
Loads attributes from specified file stream in ASCII format.
bool writeToStream(std::ostream &outStream, bool asBinary) const
Writes the attribute values to the specified stream.
A CSOGroup comprises a number of CSOs, which themselves can be in a number of different CSOGroups.
The CSOPathPoints is a list of world coordinates that are interpolated by a certain interpolation sch...
unsigned int numPathPoints() const
Returns the number of stored points.
void appendPosition(const Vector3 &pos)
Adds a new position to the internal vector.
Vector3 getPosAt(unsigned int index) const
Returns a position at a specified index index.
The CSO represents a contour segmentation object.
The Variant class stores different data types.
std::ostream & write(std::ostream &out, bool asBinary, bool writeType=true) const
write variant to/read variant from stream, either as text or in binary form
MLint32 toInt(bool *ok=nullptr) const
std::istream & read(std::istream &in, bool asBinary)
bool isValid() const
check if the Variants type is not Invalid
const T & asType() const
access content of variant directly, NOTE: use with care
bool CSOWriteValueToStream(std::ostream &out, const T &value, bool asBinary)
bool CSOReadValueFromStream(std::istream &in, T &value, bool asBinary)