mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
brought removed operators in JKQTDataStore back
This commit is contained in:
parent
8d01908082
commit
50746a09cf
@ -77,7 +77,6 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>IMPROVED: documentation of styles: automatized doc image generation.</li>
|
||||
<li>IMPROVED: axis labeling: there were some minor differences between compilers</li>
|
||||
<li>IMPROVED: jkqtp_floattounitstr()/jkqtp_floattolatexunitstr(): add all SI-Prefixes from 10^-30...10^30</li>
|
||||
<li>BREAKING removed unused function variant of jkqtp_floattounitstr()</li>
|
||||
<li>NEW: JKQTPFilledCurveXGraph and JKQTPFilledCurveYGraph can now plot wiggle plots with different fill styles above and below the baseline (feature request <a href="https://github.com/jkriege2/JKQtPlotter/issues/68">#68 Wiggle Plots</a> from <a href="https://github.com/xichaoqiang">user:xichaoqiang</a> </li>
|
||||
<li>NEW/BREAKING CHANGE: data tooltip can now also be shown when "just" moving the mouse (so far this was only possible when dragging the mouse with a button pressed). This also removes JKQtPlotter::getActMouseLeftAsToolTip() and adds JKQtPlotter::getActMouseMoveToolTip() instead! Also the default toolbars and context menus changed!</li>
|
||||
<li>NEW: new "seaborn" style for plots, see \ref jkqtpplotter_styling </li>
|
||||
|
@ -346,27 +346,27 @@ JKQTPDatastore::ConstColumnIterator JKQTPDatastore::end() const
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
JKQTPColumnIterator JKQTPDatastore::begin(int i)
|
||||
{
|
||||
if (i<0) return m_invalidColumn->end();
|
||||
if (i<0) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
auto it=columns.find(static_cast<size_t>(i));
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->begin();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
JKQTPColumnIterator JKQTPDatastore::end(int i)
|
||||
{
|
||||
if (i<0) return m_invalidColumn->end();
|
||||
if (i<0) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
auto it=columns.find(static_cast<size_t>(i));
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
JKQTPColumnConstIterator JKQTPDatastore::begin(int i) const
|
||||
{
|
||||
if (i<0) return m_invalidColumn->end();
|
||||
if (i<0) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
auto it=columns.find(static_cast<size_t>(i));
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->begin();
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ JKQTPColumnConstIterator JKQTPDatastore::end(int i) const
|
||||
{
|
||||
if (i<0) return m_invalidColumn->end();
|
||||
auto it=columns.find(static_cast<size_t>(i));
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->end();
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ JKQTPColumnConstIterator JKQTPDatastore::end(int i) const
|
||||
JKQTPColumnIterator JKQTPDatastore::begin(size_t i)
|
||||
{
|
||||
auto it=columns.find(i);
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->begin();
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ JKQTPColumnIterator JKQTPDatastore::begin(size_t i)
|
||||
JKQTPColumnIterator JKQTPDatastore::end(size_t i)
|
||||
{
|
||||
auto it=columns.find(i);
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->end();
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ JKQTPColumnIterator JKQTPDatastore::end(size_t i)
|
||||
JKQTPColumnConstIterator JKQTPDatastore::begin(size_t i) const
|
||||
{
|
||||
auto it=columns.find(i);
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->begin();
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ JKQTPColumnConstIterator JKQTPDatastore::begin(size_t i) const
|
||||
JKQTPColumnConstIterator JKQTPDatastore::end(size_t i) const
|
||||
{
|
||||
auto it=columns.find(i);
|
||||
if (it==columns.end()) return m_invalidColumn->end();
|
||||
if (it==columns.end()) throw std::runtime_error("column "+std::to_string(i)+" does not exist in JKQTPDatastore");
|
||||
else return it->end();
|
||||
}
|
||||
|
||||
|
@ -1763,21 +1763,28 @@ class JKQTPColumnIterator {
|
||||
if (!isValid() && !rhs.isValid()) return 0;
|
||||
if (!isValid() && rhs.isValid() && col_==rhs.col_) return static_cast<difference_type>(col_->getRows())-rhs.pos_;
|
||||
if (isValid() && !rhs.isValid() && col_==rhs.col_) return pos_-static_cast<difference_type>(col_->getRows());
|
||||
JKQTPASSERT(isValid() && rhs.isValid() && col_==rhs.col_);
|
||||
JKQTPASSERT(isValid());
|
||||
JKQTPASSERT(rhs.isValid());
|
||||
JKQTPASSERT(col_==rhs.col_);
|
||||
return pos_-rhs.pos_;
|
||||
}
|
||||
|
||||
/** \brief dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the value does not exist in the column */
|
||||
inline reference operator*() const {
|
||||
JKQTPASSERT((col_!=nullptr) && (pos_>=0) && (pos_<static_cast<int>(col_->getRows())));
|
||||
JKQTPASSERT((col_!=nullptr) );
|
||||
JKQTPASSERT( (pos_>=0) );
|
||||
JKQTPASSERT( (pos_<static_cast<int>(col_->getRows())));
|
||||
return col_->at(pos_);
|
||||
}
|
||||
/** \brief dereferences the iterator at offset \a off, throws an exception if the iterator is invalid (see isValid() ) or the value does not exist in the column */
|
||||
inline reference operator[](difference_type off) const
|
||||
{
|
||||
if (!isValid() && off<0) {
|
||||
return col_->at(static_cast<int>(col_->getRows())+off);
|
||||
}
|
||||
JKQTPASSERT((col_!=nullptr) && (pos_+off>=0) && (pos_+off<static_cast<int>(col_->getRows())));
|
||||
JKQTPASSERT((col_!=nullptr) );
|
||||
JKQTPASSERT( (pos_+off>=0) );
|
||||
JKQTPASSERT( (pos_+off<static_cast<int>(col_->getRows())));
|
||||
return col_->at(pos_+off);
|
||||
}
|
||||
|
||||
@ -1799,6 +1806,60 @@ class JKQTPColumnIterator {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** \brief comparison operator (less than)
|
||||
*
|
||||
* rules:
|
||||
* - ivalid iterators are never smaller than valid operators
|
||||
* - two valid operator must reference the same column
|
||||
* - a valid operator is smaller than another, if it points to a pos_ before another
|
||||
* .
|
||||
*
|
||||
* \see operator<=(), operator>(), operator>=()
|
||||
* */
|
||||
inline bool operator<(const self_type& rhs) const {
|
||||
if (!isValid() && !rhs.isValid()) return false;
|
||||
else if (!isValid() && rhs.isValid()) {
|
||||
return false;
|
||||
} else if (isValid() && !rhs.isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
JKQTPASSERT(col_ == rhs.col_);
|
||||
return pos_<rhs.pos_;
|
||||
}
|
||||
}
|
||||
/** \brief comparison operator (less than, or equal)
|
||||
* \see operator==(), operator<(), operator>(), operator>=()
|
||||
* */
|
||||
inline bool operator<=(const self_type& rhs) const {
|
||||
return operator==(rhs) || operator<(rhs);
|
||||
}
|
||||
/** \brief comparison operator (larger than)
|
||||
*
|
||||
* rules:
|
||||
* - ivalid iterators are always larger than valid operators
|
||||
* - two valid operator must reference the same column
|
||||
* - a valid operator is smaller than another, if it points to a pos_ before another
|
||||
* .
|
||||
*
|
||||
* \see operator<=(), operator<(), operator>=()
|
||||
* */
|
||||
inline bool operator>(const self_type& rhs) const {
|
||||
if (!isValid() && !rhs.isValid()) return false;
|
||||
else if (!isValid() && rhs.isValid()) {
|
||||
return true;
|
||||
} else if (isValid() && !rhs.isValid()) {
|
||||
return false;
|
||||
} else {
|
||||
JKQTPASSERT(col_ == rhs.col_);
|
||||
return pos_>rhs.pos_;
|
||||
}
|
||||
}
|
||||
/** \brief comparison operator (larger than, or equal)
|
||||
* \see operator==(), operator<(), operator>(), operator<=()
|
||||
* */
|
||||
inline bool operator>=(const self_type& rhs) const {
|
||||
return operator==(rhs) || operator>(rhs);
|
||||
}
|
||||
/** \brief comparison operator (unequals), inverse result of operator==()
|
||||
*
|
||||
* \see operator==()
|
||||
@ -2035,13 +2096,17 @@ class JKQTPColumnConstIterator {
|
||||
if (!isValid() && !rhs.isValid()) return 0;
|
||||
if (!isValid() && rhs.isValid() && col_==rhs.col_) return static_cast<difference_type>(col_->getRows())-rhs.pos_;
|
||||
if (isValid() && !rhs.isValid() && col_==rhs.col_) return pos_-static_cast<difference_type>(col_->getRows());
|
||||
JKQTPASSERT(isValid() && rhs.isValid() && col_==rhs.col_);
|
||||
JKQTPASSERT(isValid() );
|
||||
JKQTPASSERT( rhs.isValid() );
|
||||
JKQTPASSERT( col_==rhs.col_);
|
||||
return pos_-rhs.pos_;
|
||||
}
|
||||
|
||||
/** \brief dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the value does not exist in the column */
|
||||
inline reference operator*() {
|
||||
JKQTPASSERT(col_!=nullptr && pos_>=0 && pos_<static_cast<int>(col_->getRows()));
|
||||
JKQTPASSERT(col_!=nullptr );
|
||||
JKQTPASSERT( pos_>=0 );
|
||||
JKQTPASSERT( pos_<static_cast<int>(col_->getRows()));
|
||||
return col_->at(pos_);
|
||||
}
|
||||
inline reference operator[](difference_type off) const
|
||||
@ -2050,15 +2115,72 @@ class JKQTPColumnConstIterator {
|
||||
JKQTPASSERT(col_!=nullptr);
|
||||
return col_->at(static_cast<int>(col_->getRows())+off);
|
||||
}
|
||||
JKQTPASSERT(col_!=nullptr && pos_+off>=0 && pos_+off<static_cast<int>(col_->getRows()));
|
||||
JKQTPASSERT(col_!=nullptr );
|
||||
JKQTPASSERT( pos_+off>=0 );
|
||||
JKQTPASSERT( pos_+off<static_cast<int>(col_->getRows()));
|
||||
return col_->at(pos_+off);
|
||||
}
|
||||
/** \brief dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the value does not exist in the column */
|
||||
inline const_reference operator*() const {
|
||||
JKQTPASSERT(col_!=nullptr && pos_>=0 && pos_<static_cast<int>(col_->getRows()));
|
||||
JKQTPASSERT(col_!=nullptr );
|
||||
JKQTPASSERT( pos_>=0 );
|
||||
JKQTPASSERT( pos_<static_cast<int>(col_->getRows()));
|
||||
return col_->at(pos_);
|
||||
}
|
||||
|
||||
/** \brief comparison operator (less than)
|
||||
*
|
||||
* rules:
|
||||
* - ivalid iterators are never smaller than valid operators
|
||||
* - two valid operator must reference the same column
|
||||
* - a valid operator is smaller than another, if it points to a pos_ before another
|
||||
* .
|
||||
*
|
||||
* \see operator<=(), operator>(), operator>=()
|
||||
* */
|
||||
inline bool operator<(const self_type& rhs) const {
|
||||
if (!isValid() && !rhs.isValid()) return false;
|
||||
else if (!isValid() && rhs.isValid()) {
|
||||
return false;
|
||||
} else if (isValid() && !rhs.isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
JKQTPASSERT(col_ == rhs.col_);
|
||||
return pos_<rhs.pos_;
|
||||
}
|
||||
}
|
||||
/** \brief comparison operator (less than, or equal)
|
||||
* \see operator==(), operator<(), operator>(), operator>=()
|
||||
* */
|
||||
inline bool operator<=(const self_type& rhs) const {
|
||||
return operator==(rhs) || operator<(rhs);
|
||||
}
|
||||
/** \brief comparison operator (larger than)
|
||||
*
|
||||
* rules:
|
||||
* - ivalid iterators are always larger than valid operators
|
||||
* - two valid operator must reference the same column
|
||||
* - a valid operator is smaller than another, if it points to a pos_ before another
|
||||
* .
|
||||
*
|
||||
* \see operator<=(), operator<(), operator>=()
|
||||
* */
|
||||
inline bool operator>(const self_type& rhs) const {
|
||||
if (!isValid() && !rhs.isValid()) return false;
|
||||
else if (!isValid() && rhs.isValid()) {
|
||||
return true;
|
||||
} else if (isValid() && !rhs.isValid()) {
|
||||
return false;
|
||||
} else {
|
||||
JKQTPASSERT(col_ == rhs.col_);
|
||||
return pos_>rhs.pos_;
|
||||
}
|
||||
}
|
||||
/** \brief comparison operator (larger than, or equal)
|
||||
* \see operator==(), operator<(), operator>(), operator<=()
|
||||
* */
|
||||
inline bool operator>=(const self_type& rhs) const {
|
||||
return operator==(rhs) || operator>(rhs);
|
||||
}
|
||||
/** \brief comparison operator (equals)
|
||||
*
|
||||
* two iterators are equal, if:
|
||||
@ -2469,14 +2591,16 @@ inline double JKQTPColumn::getValue(int n) const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline const double& JKQTPColumn::at(int n) const {
|
||||
JKQTPASSERT(datastore && datastore->getItem(datastoreItem));
|
||||
JKQTPASSERT(datastore );
|
||||
JKQTPASSERT( datastore->getItem(datastoreItem));
|
||||
JKQTPASSERT(n>=0);
|
||||
return datastore->getItem(datastoreItem)->at(datastoreOffset, static_cast<size_t>(n));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline double& JKQTPColumn::at(int n) {
|
||||
JKQTPASSERT(datastore && datastore->getItem(datastoreItem));
|
||||
JKQTPASSERT(datastore );
|
||||
JKQTPASSERT( datastore->getItem(datastoreItem));
|
||||
JKQTPASSERT(n>=0);
|
||||
return datastore->getItem(datastoreItem)->at(datastoreOffset, static_cast<size_t>(n));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user