2.2.4.8.7 DataPlot::GetColormapGetColormap
Description
Gets the colormap properties of the dataplot (applies to dataplot with colormaps, like contour plot).
Gets the z-levels for of colormap of the dataplot (applies to dataplot with colormaps, like contour plot).
Syntax
BOOL GetColormap( TreeNode & trColormap )
BOOL GetColormap( vector<double> & vz, BOOL & bLogScale )
Parameters
- trColormap
- [Output] A TreeNode object with the Tree structure of GetColormap
- vz
- [Output] A Vector of Doubles giving the Z-level values
- bLogScale
- [Output] bLogScale, TRUE means Logarithmic, FALSE for linear
Return
The BOOL returned is TRUE for success and FALSE for failure.
The BOOL returned is TRUE for success and FALSE for failure.
Examples
EX1
//Get the colormap tree of the contour graph.
void DataPlot_GetColormap_ex1()
{
MatrixLayer mlayer=Project.ActiveLayer();
MatrixObject mobj = mlayer.MatrixObjects();
LPCSTR lpcszTemplate="contour";
GraphPage gp;
string strTemp;
gp.Create(lpcszTemplate, CREATE_HIDDEN);
GraphLayer glay = gp.Layers();
int nPlot = glay.AddPlot(mobj, IDM_PLOT_CONTOUR);
glay.Rescale();
gp.SetShow();
if(!glay)
return;
DataPlot dp = glay.DataPlots(0);
vector vZs;
BOOL bLogScale = FALSE;
BOOL bRet = dp.GetColormap(vZs, bLogScale);
Tree tr;
BOOL bRetT = dp.GetColormap(tr);
if(bRetT)
out_str("get colormap success!");
}
EX2
//Clear the contour line of the contour graph.
void DataPlot_GetColormap_ex2()
{
MatrixLayer mlayer=Project.ActiveLayer();
MatrixObject mobj = mlayer.MatrixObjects();
LPCSTR lpcszTemplate="contour";
GraphPage gp;
string strTemp;
gp.Create(lpcszTemplate, CREATE_HIDDEN);
GraphLayer glay = gp.Layers();
int nPlot = glay.AddPlot(mobj, IDM_PLOT_CONTOUR);
glay.Rescale();
gp.SetShow();
if(!glay)
return;
DataPlot dp = glay.DataPlots(0);
if(!dp.IsValid())
return ;
int nShow = 0;
TreeNode tr;
dp.GetColormap(tr);
vector<int> vLShow;
vLShow = tr.Details.ShowLines.nVals;
vLShow = nShow;
tr.Details.Remove();
tr.Details.ShowLines.nVals =vLShow;
dp.SetColormap(tr);
return;
}
Remark
See Also
DataPlot::SetColormap
Header to Include
origin.h
|