set_contour_lines

 

Description

Set lines color, style and thickness on Contour

Syntax

int set_contour_lines( DataPlot & dp, const vector<double> & dLevels, const vector<uint> & vnColors, const vector<uint> & vnStyles = NULL, const vector<double> & vThickness = NULL, const vector<uint>& vnShowLines = NULL, bool bRemoveFill = true )

Parameters

dp
[input] one contour data plot to set line format
dLevels
[input] Z range levels.
vnColors
[input] the color of Z level line. Keep vnColors.GetSize() is equal to vLevels.GetSize() - 1.
vnStyles
[input] optional, the style of Z level line
vThickness
[input] optional, the thickness of Z level line
vnShowLines
[input] optional, the visibility of Z level line, default show all lines.
bRemoveFill
[input] default is true to remove fill color.

Return

returns 0 for success, <0 means error.

Examples

EX1

//For this example to run, a graph layer with at least one dataplot must exist and be active in the project
void set_contour_lines_ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    DataPlot dp = gl.DataPlots(0);
    if(!dp)
        return;
    
    vector     vLevels, vdThickness;    
    vector<uint>     vnLineColors, vnStyles;    
    
    BOOL bLogScale = false;
    dp.GetColormap(vLevels, bLogScale);
    
    // the size of color, style and thickness vector is equal to the size of levels - 1
    vnLineColors.SetSize(vLevels.GetSize()-1);
    vnStyles.SetSize(vLevels.GetSize()-1);
    vdThickness.SetSize(vLevels.GetSize()-1);
    
    vnLineColors.Data(1, vLevels.GetSize()-1, 1);//color is begin from red and increase with 1
    vnStyles = 5; // Short Dash
    vdThickness = 2.0; 
    
    set_contour_lines(dp, vLevels, vnLineColors, vnStyles, vdThickness);
}

Remark

See Also

dataplot_set_colormap

Header to Include

origin.h

Reference