MeshLib C++ Docs
Loading...
Searching...
No Matches

Class to hold one dimension texture with value to UV mapping. More...

#include <MRViewer/MRPalette.h>

Classes

struct  Label
 structure for label More...
struct  Parameters
 base parameters of palette More...

Public Member Functions

 Palette (const std::vector< Color > &colors)
void setBaseColors (const std::vector< Color > &colors)
 Set base palette colors colors.size() should be more or equal 2 for discrete palette using vector of colors calculated by mixing the base colors i.e. base {blue, red} -> discrete 3 {blue, 0.5*blue + 0.5*red, red}.
void setRangeMinMax (float min, float max)
 set range limits for palette (need for find color by value) all palette colors are evenly distributed between min and max
void setRangeMinMaxNegPos (float minNeg, float maxNeg, float minPos, float maxPos)
 set range limits for palette (need for find color by value) two half palette colors are evenly distributed between MinNeg / MaxNeg and MinPos / MaxPos for values between MaxNeg / MinPos return one color (from center palette)
void setDiscretizationNumber (int discretization)
 set number of different colors for discrete palette
void setFilterType (FilterType type)
 set palette type (linear / discrete)
void draw (const std::string &windowName, const ImVec2 &pose, const ImVec2 &size, bool onlyTopHalf=false)
void draw (ImDrawList *drawList, float scaling, const ImVec2 &pos, const ImVec2 &size, const Color &labelBgColor, bool onlyTopHalf=false) const
void draw (ImDrawList *drawList, float scaling, const ImVec2 &pos, const ImVec2 &size, bool onlyTopHalf=false) const
void resetLabels ()
 reset labels to standard view
void setCustomLabels (const std::vector< Label > &labels)
 set labels manually
void setLabelsVisible (bool visible)
 set labels visible
bool loadFromJson (const Json::Value &root)
void saveCurrentToJson (Json::Value &root) const
 Serialize this palette data to JsonValue.
Color getColor (float relativeValue) const
Color getInvalidColor () const
 return invalid color
VertColors getVertColors (const VertScalars &values, const VertBitSet &region, const VertBitSet *valids, const VertBitSet *validsForStats)
const MeshTexturegetTexture () const
float getRelativePos (float val) const
 get relative position in [0,1], where 0 is for minimum and 1 is for maximum
UVCoord getUVcoord (float val, bool valid=true) const
VertUVCoords getUVcoords (const VertScalars &values, const VertBitSet &region, const VertPredicate &valids={}, const VertPredicate &validsForStats={})
VertUVCoords getUVcoords (const VertScalars &values, const VertBitSet &region, const VertBitSet *valids, const VertBitSet *validsForStats=nullptr)
const ParametersgetParameters () const
float getRangeMin () const
 returns minimum value in the palette's range
float getRangeMax () const
 returns maximum value in the palette's range
float getRangeSq () const
 returns minimum squared value, not smaller than all squared values of palette's range
std::string getStringValue (float value) const
 returns formated string for this value of palette
int getMaxLabelCount ()
 returns maximal label count
void setMaxLabelCount (int val)
 sets maximal label count
void setLegendLimits (const MinMaxf &limits)
 set legend limits. if min > max - limits are disabled
bool isHistogramEnabled () const
 Histogram:
int getNumHistogramBuckets () const
void setNumHistogramBuckets (int n)
int getDefaultNumHistogramBuckets () const
 Returns the recommended argument for setNumHistogramBuckets().
bool isDiscretizationPercentagesEnabled () const
 Should we maintain the percentages of distances in each discretization step?
void enableDiscretizationPercentages (bool enable)

Static Public Member Functions

static const std::vector< Color > & BlueGreenRedColors ()
static const std::vector< Color > & GreenRedColors ()
 simpler palette colors: from green to red
static VertPredicate predFromBitSet (const VertBitSet *bits)
static void resizeCallback_ (ImGuiSizeCallbackData *data)

Public Attributes

int drawDelayFrames_ = 0

Static Public Attributes

static const std::vector< ColorDefaultColors
 preset palette colors: from blue via green to red

Detailed Description

Class to hold one dimension texture with value to UV mapping.

Discrete mode will draw rectangle for each color Continuous mode will draw interpolated color


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