Skip to main content

Post-processing tools 2023 R2

ANSYS::Nexus::GLTFWriter::Legend Class Reference

Last update: 17.04.2023

Legends are colored bars with numbers at intervals along bar. More...

#include <GLTFWriter.h>

Inheritance diagram for ANSYS::Nexus::GLTFWriter::Legend:

Public Types

enum  LegendOrientation { LO_VERTICAL , LO_HORIZONTAL }
 
enum  LegendAttachment {
  LA_X_Y = 0 , LA_X_YBOTTOM = 1 , LA_X_YTOP = 2 , LA_X_YCENTER = 3 ,
  LA_XLEFT_Y = 4 , LA_XLEFT_YBOTTOM = 5 , LA_XLEFT_YTOP = 6 , LA_XLEFT_YCENTER = 7 ,
  LA_XRIGHT_Y = 8 , LA_XRIGHT_YBOTTOM = 9 , LA_XRIGHT_YTOP = 10 , LA_XRIGHT_YCENTER = 11 ,
  LA_XCENTER_Y = 12 , LA_XCENTER_YBOTTOM = 13 , LA_XCENTER_YTOP = 14 , LA_XCENTER_YCENTER = 15
}
 

Static Public Member Functions

static LegendCreate (GLTF *gltf, LegendOrientation orientation, float size, Texture *texture, float mn, float mx, LegendAttachment attachment=LA_XLEFT_YCENTER, const char *title=0, const char *units=0, const char *other=0, unsigned int numTicks=0, const float *valueLocations=0, bool border=false, bool logarithmic=false, float x=0, float y=0, float foregroundR=0, float foregroundG=0, float foregroundB=0, float backgroundR=1, float backgroundG=1, float backgroundB=1, float backgroundA=0)
 

Detailed Description

Legends are colored bars with numbers at intervals along bar.

Definition at line 26 of file GLTFLegend.h.

Member Enumeration Documentation

◆ LegendAttachment

Legend attachment position

Enumerator
LA_X_Y 

Use specified x and y location.

LA_X_YBOTTOM 

use x location and attach to bottom.

LA_X_YTOP 

Use x location and attach to top.

LA_X_YCENTER 

Use x location and position at vertical center.

LA_XLEFT_Y 

Use y location and attach to left.

LA_XLEFT_YBOTTOM 

Attach to left bottom corner.

LA_XLEFT_YTOP 

Attach to left top corner.

LA_XLEFT_YCENTER 

Attach to left and position at vertical center (popular).

LA_XRIGHT_Y 

Use y location and attach to right.

LA_XRIGHT_YBOTTOM 

Attach to right bottom corner.

LA_XRIGHT_YTOP 

Attach to right top corner.

LA_XRIGHT_YCENTER 

Attach to right and position at vertical center.

LA_XCENTER_Y 

Use y location and position at horizontal center.

LA_XCENTER_YBOTTOM 

Attach to bottom and position at horizontal center.

LA_XCENTER_YTOP 

Attach to top and position at horizontal center.

LA_XCENTER_YCENTER 

Position at center.

Definition at line 36 of file GLTFLegend.h.

◆ LegendOrientation

Type of orientation.

Enumerator
LO_VERTICAL 

Top to bottom.

LO_HORIZONTAL 

Left to right.

Definition at line 30 of file GLTFLegend.h.

Member Function Documentation

◆ Create()

static Legend* ANSYS::Nexus::GLTFWriter::Legend::Create ( GLTF gltf,
LegendOrientation  orientation,
float  size,
Texture texture,
float  mn,
float  mx,
LegendAttachment  attachment = LA_XLEFT_YCENTER,
const char *  title = 0,
const char *  units = 0,
const char *  other = 0,
unsigned int  numTicks = 0,
const float *  valueLocations = 0,
bool  border = false,
bool  logarithmic = false,
float  x = 0,
float  y = 0,
float  foregroundR = 0,
float  foregroundG = 0,
float  foregroundB = 0,
float  backgroundR = 1,
float  backgroundG = 1,
float  backgroundB = 1,
float  backgroundA = 0 
)
static

Creates a legend.

Returns
Legend object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]orientationLegend::LegendOrientation defining type of orientation.
[in]sizeHeight or width of legend (excluding other text) as a fraction of minimum screen dimension.
[in]textureTexture object that would be used to color object to which this legend refers.
[in]mnNumeric value associated with first tick mark at bottom/left of legend.
[in]mxNumeric value associated with last tick mark at top.right of legend.
[in]attachmentOptional, Legend::LegendAttachment defining location of legend.
[in]titleOptional, title for legend. The title can span up to 2 lines with a '\n' char.
[in]unitsOptional, units for legend. Located immediately after the color bar.
[in]otherOptional, other text for legend. Other text spans multiple lines with '\n' char.
[in]numTicksOptional, number of tick marks on legend. For non-banded legends, this number can be left 0 for auto-generated tick marks. For a banded legend, this number should be 1 more than the number of bands in the specified texture. If valueLocations is specified, this number must be the number of entry pairs in valueLocations. In any case, this number cannot be 1.
[in]valueLocationsOptional, pairs of tick values as a fraction of mn to mx and tick locations as a fraction of size. The first tick location should be 0 and the last should be 1.
[in]borderOptional, flag that indicates to draw a border around legend.
[in]logarithmicOptional, flag that indicates generated values at tick marks follow logarithmic progression. If valueLocations are specfied this is taken as false.
[in]xOptional, x location of legend.
[in]yOptional, y location of legend.
[in]foregroundROptional, red component of foreground color of legend (text, border, ticks, ..).
[in]foregroundGOptional, green component of foreground color of legend.
[in]foregroundBOptional, blue component of foreground color of legend.
[in]backgroundROptional, red component of background color of legend.
[in]backgroundGOptional, green component of background color of legend.
[in]backgroundBOptional, blue component of background color of legend.
[in]backgroundAOptional, alpha component of background color of legend.
Examples
Test013.cpp.

The documentation for this class was generated from the following file:
  • D:/ANSYSDev/NoBackup/branches/EnSight-Second-Coming/webgl_viewer/gltfwriterlib/include/GLTFLegend.h