Gaia
|
#include <point.h>
Public Member Functions | |
QString | name () const |
Returns the point name, which also acts as its unique identifier. | |
void | setName (const QString &name) |
Sets the point name, which also acts as its unique identifier. | |
void | load (const QString &filename, const QStringList &select=QStringList()<< "*", const QStringList &exclude=QStringList()) |
Loads the given filename into this Point. More... | |
void | loadFromString (const std::string &str, const QStringList &select=QStringList()<< "*", const QStringList &exclude=QStringList()) |
Loads the given string as this Point's data. More... | |
void | fromBase64 (const std::string &data) |
Loads a Point from its base64 representation. | |
void | fromBase64 (const QByteArray &data) |
Loads a Point from its base64 representation. | |
std::string | toBase64 () const |
Returns a base64 representation for this Point. | |
Point (const Point &rhs) | |
Point (const PointLayout &layout) | |
Point (const QString &name, const PointLayout &layout) | |
Point (const std::string &name, const PointLayout &layout) | |
Point & | operator= (const Point &rhs) |
bool | operator== (const Point &rhs) const |
void | setSegment (int nsegment, const Point *point, int origsegment=0) |
Copy the segment from the given Point to a segment into this Point. More... | |
const PointLayout & | layout () const |
Returns the current layout of the point. | |
PointLayout & | layout () |
Returns the current layout of the point. | |
void | setLayout (const PointLayout &layout, int nsegments=0) |
Uses the given layout for this point. More... | |
void | switchLayout (const PointLayout &layout) |
Switches the point to use the given layout. More... | |
const Array< ScopedData > & | data () const |
Array< ScopedData > & | data () |
int | numberSegments () const |
RealDescriptor | value (const QString &name) const |
RealDescriptor | value (int nsegment, const QString &name) const |
StringDescriptor | label (const QString &name) const |
StringDescriptor | label (int nsegment, const QString &name) const |
void | setValue (const QString &name, const RealDescriptor &value) |
void | setValue (int nsegment, const QString &name, const RealDescriptor &value) |
void | setLabel (const QString &name, const StringDescriptor &label) |
void | setLabel (int nsegment, const QString &name, const StringDescriptor &label) |
const Array< RealDescriptor > & | vrealData (int i=0) const |
Array< RealDescriptor > & | vrealData (int i=0) |
const Array< StringDescriptor > & | vstringData (int i=0) const |
Array< StringDescriptor > & | vstringData (int i=0) |
const Array< EnumDescriptor > & | venumData (int i=0) const |
Array< EnumDescriptor > & | venumData (int i=0) |
const RealDescriptor & | frealData (int i=0) const |
RealDescriptor & | frealData (int i=0) |
const StringDescriptor & | fstringData (int i=0) const |
StringDescriptor & | fstringData (int i=0) |
const EnumDescriptor & | fenumData (int i=0) const |
EnumDescriptor & | fenumData (int i=0) |
const Scope & | scope (int i=0) const |
Scope & | scope (int i=0) |
Static Public Member Functions | |
static Point * | fromSingleSegment (const Point *point, int nsegment) |
Returns a new point that is composed only of the specified segment. More... | |
Protected Member Functions | |
void | setLayoutUnsafe (const PointLayout &layout) |
WARNING: Use this function only if you know 100% what you're doing! This neither make sure the layout is correctly applied to the data section of the point, nor maps the enum values... | |
void | remapLayoutAndEnums (const PointLayout &layout) |
WARNING: this doesn't check whether the layout is valid or not, and doesn't apply the layout either. | |
void | applyLayout (int nsegments) |
Once a layout has been determined, this method resizes the _data member variable so that it can accomodate for all values given the layout schema. More... | |
void | yamlNodeToLayout (const yaml::Node &root, PointLayout &layout, const QString &parentName="") |
void | fillLayout (const yaml::Node &root, const PointLayout &layout, UnscopedData &data, const QString &parentName="") |
void | load (yaml::Node &node, const QStringList &select, const QStringList &exclude) |
Static Protected Member Functions | |
static void | checkValidSegment (const Point *point, int segment) |
Throws an exception if given segment number is not a valid one. | |
Protected Attributes | |
QString | _name |
Array< ScopedData > | _data |
PointLayout | _layout |
Friends | |
class | DataSet |
QDataStream & | operator<< (QDataStream &out, const Point &point) |
QDataStream & | operator>> (QDataStream &in, Point &point) |
|
protected |
Once a layout has been determined, this method resizes the _data member variable so that it can accomodate for all values given the layout schema.
This does not set the values to default ones nor reset previous values.
nsegments | the total number of segments in this point, including the main one |
References gaia2::PointLayout::regionSize().
Referenced by load(), setLayout(), and setSegment().
Returns a new point that is composed only of the specified segment.
point | the Point from which to take the segment |
nsegment | the number of the segment to be taken |
References checkValidSegment(), layout(), name(), setLayout(), and setName().
void Point::load | ( | const QString & | filename, |
const QStringList & | select = QStringList() << "*" , |
||
const QStringList & | exclude = QStringList() |
||
) |
Loads the given filename into this Point.
Can specify filters for specifying which data to load.
References applyLayout(), gaia2::PointLayout::filter(), layout(), and gaia2::PointLayout::subsetOf().
Referenced by loadFromString().
void Point::loadFromString | ( | const std::string & | str, |
const QStringList & | select = QStringList() << "*" , |
||
const QStringList & | exclude = QStringList() |
||
) |
void Point::setLayout | ( | const PointLayout & | layout, |
int | nsegments = 0 |
||
) |
Uses the given layout for this point.
This method can optionally take the number of segments this point will have. If unspecified, or 0, the number of segments will be left untouched. WARNING: this invalidates all the data in the point.
References applyLayout(), and remapLayoutAndEnums().
Referenced by gaia2::DataSet::addPoints(), fromSingleSegment(), gaia2::getRegionMeanVar(), gaia2::getRegionMinMax(), gaia2::mapPoint(), gaia2::mergeDataSets(), gaia2::MergeRegionApplier::mergePoint(), gaia2::mergePoints(), gaia2::PointLayout::morphPoint(), and setSegment().
void Point::setSegment | ( | int | nsegment, |
const Point * | point, | ||
int | origsegment = 0 |
||
) |
Copy the segment from the given Point to a segment into this Point.
This method can be used to build a multi-segment point from its constituent segments given as single points. WARNING: if you call this method on a Point which has fewer segments than what you require, it will create those segments, but the value of the data inside those newly created segments will be undefined.
nsegment | the number of the segment to fill |
point | the Point from which to extract the data |
origsegment | the segment inside the original Point to copy |
References applyLayout(), checkValidSegment(), layout(), and setLayout().
void Point::switchLayout | ( | const PointLayout & | layout | ) |
Switches the point to use the given layout.
This only works if the new layout is the same as the one the point had before. This is used to update the enum values in the points.
References gaia2::PointLayout::descriptorLocation(), gaia2::Region::index(), name(), remapLayoutAndEnums(), and gaia2::Region::type().
Referenced by gaia2::DataSet::addPoints().