Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions include/polyscope/scalar_quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "polyscope/scaled_value.h"
#include "polyscope/standardize_data_array.h"

#include <utility>

namespace polyscope {

// Encapsulates logic which is common to all scalar quantities
Expand Down Expand Up @@ -50,10 +52,11 @@ class ScalarQuantity {
std::string getColorMap();

// Data limits mapped in to colormap
QuantityT* setMapRange(std::pair<double, double> val);
std::pair<double, double> getMapRange();
using ScalarRange = std::pair<double, double>;
QuantityT* setMapRange(ScalarRange val);
ScalarRange getMapRange();
QuantityT* resetMapRange(); // reset to full range
std::pair<double, double> getDataRange();
ScalarRange getDataRange();

// Color bar options (it is always displayed inline in the structures panel)
QuantityT* setOnscreenColorbarEnabled(bool newEnabled);
Expand Down
8 changes: 4 additions & 4 deletions include/polyscope/scalar_quantity.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,19 @@ glm::vec2 ScalarQuantity<QuantityT>::getOnscreenColorbarLocation() {
}

template <typename QuantityT>
QuantityT* ScalarQuantity<QuantityT>::setMapRange(std::pair<double, double> val) {
QuantityT* ScalarQuantity<QuantityT>::setMapRange(ScalarRange val) {
vizRangeMin = val.first;
vizRangeMax = val.second;
colorBar.colormapRange = std::pair<float, float>(vizRangeMin.get(), vizRangeMax.get());
requestRedraw();
return &quantity;
}
template <typename QuantityT>
std::pair<double, double> ScalarQuantity<QuantityT>::getMapRange() {
return std::pair<float, float>(vizRangeMin.get(), vizRangeMax.get());
typename ScalarQuantity<QuantityT>::ScalarRange ScalarQuantity<QuantityT>::getMapRange() {
return ScalarRange(vizRangeMin.get(), vizRangeMax.get());
}
template <typename QuantityT>
std::pair<double, double> ScalarQuantity<QuantityT>::getDataRange() {
typename ScalarQuantity<QuantityT>::ScalarRange ScalarQuantity<QuantityT>::getDataRange() {
return dataRange;
}

Expand Down