【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.4.20.13 GraphPage::Layers
Contents
Description
A Collection of all GraphLayers in a GraphPage.
Get a GraphLayer object by index.
Get a GraphLayer object by name.
Syntax
Collection<GraphLayer> Layers
GraphLayer Layers(int iIndex = -1)
GraphLayer Layers(LPCSTR lpcszName)
Parameters
- index
- [input]The index (0 offset) of the requested Layer. If iIndex < 0 then the active Layer is returned.
- lpcszName
- [input]The name of the requested layer
Return
Returns a valid GraphLayer object on successful exit and an invalid GraphLayer object on failure.
Returns a valid GraphLayer object on successful exit and an invalid GraphLayer object on failure.
Examples
EX1
int GraphPage_Layers_ex1() { GraphPage gp; gp.Create("origin"); if( gp.IsValid() ) { gp.AddLayer("Test"); gp.AddLayer("Test"); int iLayers = 0; foreach(GraphLayer gl in gp.Layers) iLayers++; printf("%s has %d layer(s)\n", gp.GetName(), iLayers); } return 0; }
EX2
// Get a GraphLayer object by index // For this example to run, a graph window must exist in the project. int GraphPage_Layers_ex2() { GraphPage gp = Project.GraphPages(0); if( gp.IsValid() ) { GraphLayer gl = gp.Layers(0); // Get active layer if( gl.IsValid() ) printf("GraphLayer %s is active\n", gl.GetName()); } return 0; }
EX3
// Get a GraphLayer object by name int GraphPage_Layers_ex3(string strLayerName = "Test") { GraphPage gp; gp.Create("origin"); if( gp.IsValid() ) { gp.AddLayer("Test"); gp.AddLayer("Test"); GraphLayer gl = gp.Layers(strLayerName); if( gl.IsValid() ) printf("The layer %s exists.\n", strLayerName); else printf("The layer %s does not exist.\n", strLayerName); } return 0; }
Remark
Header to Include
origin.h