mupp 1.1.0
Loading...
Searching...
No Matches
PmuppXY Class Reference

Data structure for X-Y axis label associations. More...

#include <PmuppGui.h>

Public Member Functions

 PmuppXY ()
 Default constructor. Initializes with invalid collection tag.
 
void setCollectionTag (int tag)
 Sets the collection tag (identifier).
 
void setXlabel (QString str)
 Sets the X-axis label.
 
void addYlabel (QString str)
 Adds a Y-axis label to the list.
 
void setYlabel (int idx, QString str)
 Sets the Y-axis label at a specific index.
 
void removeYlabel (int idx)
 Removes a Y-axis label by index.
 
void removeYlabel (QString str)
 Removes a Y-axis label by name.
 
int getCollectionTag ()
 Gets the collection tag.
 
QString getXlabel ()
 Gets the X-axis label.
 
int getXlabelIdx ()
 Extracts the parameter index from the X-axis label.
 
int getYlabelSize ()
 Gets the number of Y-axis labels.
 
QString getYlabel (int idx)
 Gets a Y-axis label by index.
 
int getYlabelIdx (int idx)
 Extracts the parameter index from a Y-axis label.
 
QVector< QString > getYlabels ()
 Gets all Y-axis labels.
 

Private Member Functions

void init ()
 Initializes the object to default state.
 

Private Attributes

int fCollectionTag
 identifier for the associated data collection
 
QString fXlabel
 X-axis parameter label.
 
QVector< QString > fYlabel
 vector of Y-axis parameter labels
 

Detailed Description

Data structure for X-Y axis label associations.

PmuppXY stores the relationship between X-axis and Y-axis parameter labels for plotting. Each instance represents one plot configuration with:

  • One X-axis parameter (independent variable)
  • Multiple Y-axis parameters (dependent variables)
  • Association with a specific data collection

The class supports:

  • Managing multiple Y-labels for a single X-label
  • Extracting parameter indices from formatted label strings
  • Dynamic addition/removal of Y-axis parameters

Definition at line 100 of file PmuppGui.h.

Constructor & Destructor Documentation

◆ PmuppXY()

PmuppXY::PmuppXY ( )
inline

Default constructor. Initializes with invalid collection tag.

Definition at line 106 of file PmuppGui.h.

Member Function Documentation

◆ addYlabel()

void PmuppXY::addYlabel ( QString str)
inline

Adds a Y-axis label to the list.

Parameters
strY-axis parameter label to add

Definition at line 124 of file PmuppGui.h.

◆ getCollectionTag()

int PmuppXY::getCollectionTag ( )
inline

Gets the collection tag.

Returns
collection identifier

Definition at line 149 of file PmuppGui.h.

◆ getXlabel()

QString PmuppXY::getXlabel ( )
inline

Gets the X-axis label.

Returns
X-axis parameter label

Definition at line 155 of file PmuppGui.h.

◆ getXlabelIdx()

int PmuppXY::getXlabelIdx ( )

Extracts the parameter index from the X-axis label.

Returns
parameter index, or -1 on error

Parameter labels are formatted as "name (-index-)" where index is the parameter number. This method parses the label string to extract the numeric index value.

The parsing process:

  1. Finds the closing marker "-)"
  2. Finds the opening marker "(-"
  3. Extracts the numeric string between them
  4. Converts to integer
Returns
parameter index on success, -1 on parsing error or invalid format

Definition at line 205 of file PmuppGui.cpp.

◆ getYlabel()

QString PmuppXY::getYlabel ( int idx)

Gets a Y-axis label by index.

Parameters
idxindex of the Y-label
Returns
Y-axis parameter label, or empty string if invalid index

Returns the Y-axis parameter label at the specified position. If the index is out of bounds, returns an empty string instead of causing an error.

Parameters
idxzero-based index of the Y-label to retrieve
Returns
Y-axis label string if valid index, empty string otherwise

Definition at line 181 of file PmuppGui.cpp.

◆ getYlabelIdx()

int PmuppXY::getYlabelIdx ( int idx)

Extracts the parameter index from a Y-axis label.

Parameters
idxindex of the Y-label
Returns
parameter index, or -1 on error

Similar to getXlabelIdx(), this method parses a Y-axis label formatted as "name (-index-)" to extract the parameter number. The method first validates that the requested Y-label exists in the vector.

The parsing process:

  1. Validates the Y-label index is in range
  2. Finds the closing marker "-)"
  3. Finds the opening marker "(-"
  4. Extracts the numeric string between them
  5. Converts to integer
Parameters
idxzero-based index of the Y-label to process
Returns
parameter index on success, -1 on error or invalid format

Definition at line 249 of file PmuppGui.cpp.

◆ getYlabels()

QVector< QString > PmuppXY::getYlabels ( )
inline

Gets all Y-axis labels.

Returns
vector of all Y-axis parameter labels

Definition at line 187 of file PmuppGui.h.

◆ getYlabelSize()

int PmuppXY::getYlabelSize ( )
inline

Gets the number of Y-axis labels.

Returns
count of Y-labels

Definition at line 167 of file PmuppGui.h.

◆ init()

void PmuppXY::init ( )
private

Initializes the object to default state.

Initializes the PmuppXY object to default state.

Sets the collection tag to -1 (invalid), clears the X-axis label, and empties the Y-axis label vector. This provides a clean starting state for the X-Y configuration.

Definition at line 107 of file PmuppGui.cpp.

◆ removeYlabel() [1/2]

void PmuppXY::removeYlabel ( int idx)

Removes a Y-axis label by index.

Parameters
idxindex of the Y-label to remove

Deletes the Y-axis label at the specified position from the vector. If the index is out of bounds, the operation is silently ignored.

Parameters
idxzero-based index of the Y-label to remove

Definition at line 141 of file PmuppGui.cpp.

◆ removeYlabel() [2/2]

void PmuppXY::removeYlabel ( QString str)

Removes a Y-axis label by name.

Parameters
strY-axis parameter label to remove

Searches for a Y-axis label matching the given string and removes it if found. Only the first matching label is removed. If no match is found, the vector remains unchanged.

Parameters
strY-axis parameter label string to remove

Definition at line 159 of file PmuppGui.cpp.

◆ setCollectionTag()

void PmuppXY::setCollectionTag ( int tag)
inline

Sets the collection tag (identifier).

Parameters
tagcollection identifier

Definition at line 112 of file PmuppGui.h.

◆ setXlabel()

void PmuppXY::setXlabel ( QString str)
inline

Sets the X-axis label.

Parameters
strX-axis parameter label

Definition at line 118 of file PmuppGui.h.

◆ setYlabel()

void PmuppXY::setYlabel ( int idx,
QString str )

Sets the Y-axis label at a specific index.

Sets a Y-axis label at a specific index.

Parameters
idxindex of the Y-label to modify
strnew Y-axis parameter label

Replaces the Y-axis label at the given index with a new value. If the index is out of bounds, the operation is silently ignored.

Parameters
idxzero-based index of the Y-label to modify
strnew Y-axis parameter label string

Definition at line 124 of file PmuppGui.cpp.

Member Data Documentation

◆ fCollectionTag

int PmuppXY::fCollectionTag
private

identifier for the associated data collection

Definition at line 190 of file PmuppGui.h.

◆ fXlabel

QString PmuppXY::fXlabel
private

X-axis parameter label.

Definition at line 191 of file PmuppGui.h.

◆ fYlabel

QVector<QString> PmuppXY::fYlabel
private

vector of Y-axis parameter labels

Definition at line 192 of file PmuppGui.h.


The documentation for this class was generated from the following files: