Rhino C++ API  8.6
Public Member Functions | Public Attributes | Friends | List of all members
CRhinoLayerTable Class Reference

#include <rhinoSdkLayer.h>

Inheritance diagram for CRhinoLayerTable:
ON_SimpleArray< CRhinoLayer * >

Public Member Functions

int AddLayer (bool bReference=false)
 
int AddLayer (const ON_Layer &layer, bool bReference=false)
 
int AddLayer (const wchar_t *layer_name, ON_Color layer_color, bool bReturnExistingLayer)
 
void ChangeLayerSortOrder (const ON_SimpleArray< ON_2dex > &sort_order)
 
int CreateLayer (const ON_Layer &layer, unsigned int layer_type, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn)
 
const CRhinoLayerCurrentLayer () const
 
ON_UUID CurrentLayerId () const
 
int CurrentLayerIndex () const
 
bool DeleteLayer (int layer_index, bool bQuiet)
 
int DeleteLayers (int layer_index_count, const int *layer_index_list, bool bQuiet)
 
int DeleteLayers (int layer_index_count, const int *layer_index_list, bool bQuiet, int delete_objects_warning)
 
CRhinoDocDocument () const
 
int FindLayerFromFullPathName (const wchar_t *layer_full_path_name, int not_found_return_value) const
 
int FindLayerFromGetString (class CRhinoGetString &gs, int nothing_layer_index, bool bVerbose) const
 
int FindLayerFromId (ON_UUID layer_id, bool bSearchDefaultLayers, bool bSearchDeletedLayers, int not_found_return_value) const
 
int FindLayerFromName (const wchar_t *layer_name, bool bSearchDefaultLayers, bool bSearchFullPathNames, int not_found_return_value, int multiple_match_return_value) const
 
int FindLayerFromParentAndName (ON_UUID parent_layer_id, const wchar_t *layer_name, int not_found_return_value) const
 
int FindLayerFromUniqueName (const wchar_t *layer_name, int not_found_return_value, int multiple_found_return_value) const
 
int FindLayerFromUniqueName (const wchar_t *short_name, bool bIgnoreDeletedLayers=true) const
 
int FindNextLayerFromName (int layer_index, const wchar_t *layer_name, int not_found_return_value) const
 
void GetDefaultLayerProperties (ON_Layer &layer) const
 
bool GetLayerPathName (int layer_index, const wchar_t *sLayerNamePathDelimeter, ON_wString &layer_path_name) const
 
bool GetLayerPathName (int layer_index, ON_wString &layer_path_name) const
 
void GetSortedList (bool bIgnoreDeleted, bool bIgnoreFiltered, ON_SimpleArray< const CRhinoLayer * > &sorted_list) const
 
void GetSortedList (ON_SimpleArray< const CRhinoLayer * > &, bool=false) const
 
void GetUnusedLayerName (const wchar_t *root_name, ON_wString &unused_layer_name) const
 
void GetUnusedLayerName (ON_wString &unused_layer_name) const
 
bool InLayerTable (const ON_Layer *layer) const
 
bool IsValidLayerTableIndex (int layer_index) const
 
const CRhinoLayerLayer (const ON_ComponentManifestItem &item) const
 
int LayerCount () const
 
void ListTable (ON_TextLog &text_log, unsigned int level_of_detail) const
 
bool ModifyLayer (const ON_Layer &layer, int layer_index, bool bQuiet=false)
 
const CRhinoLayeroperator[] (int) const
 
int RemapIndex (int layer_index) const
 
bool SetCurrentLayerIndex (int layer_index, bool bQuiet=false)
 
void SetRemapIndex (int layer_index, int remap_index)
 
bool SetUnusedLayerName (const wchar_t *root_name, ON_Layer &layer) const
 
void Sort (int(*compare)(const CRhinoLayer *, const CRhinoLayer *, void *), int(*cull)(const CRhinoLayer *, void *), void *p=0)
 
void SortByLayerName (bool bAscending)
 
const class CRhinoDocTableReferenceTableReference () const
 
bool UndeleteLayer (int layer_index)
 
bool UndoModifyLayer (int layer_index, unsigned int ur_sn=0)
 
bool UnsortLayer (int layer_index, int sort_index)
 

Public Attributes

const CRhinoLayerDefaultLayer
 

Friends

class CRhinoDoc
 
class CRhinoRead3dmHelper
 for access to CRhinoLayerTable::FindReferenceParentLayer() More...
 
bool RhGetGrandParentLayerId (CRhinoDoc &, unsigned int, unsigned int, unsigned int, const wchar_t *, const wchar_t *, ON_UUID *)
 

Member Function Documentation

◆ AddLayer() [1/3]

int CRhinoLayerTable::AddLayer ( bool  bReference = false)

Description: Adds a new layer with default definition to the layer table.

Parameters: bReference - [in] true if this layer is a reference layer. Reference layers are not saved in files.

Returns: index of new layer

Remarks: In some cases, calling AddLayer() can cause the memory references previously returned by operator[] and CurrentLayer() to become invalid.

◆ AddLayer() [2/3]

int CRhinoLayerTable::AddLayer ( const ON_Layer layer,
bool  bReference = false 
)

Description: Adds a new layer with specified definition to the layer table.

Parameters: layer - [in] definition of new layer. The information in layer is copied. If layer.LayerName() is empty the a unique name of the form "Layer 01" will be automatically created.

bReference - [in] true if this layer is a reference layer. Reference layers are not saved in files.

Returns: @untitled table >=0 index of new layer -1 layer not added because a layer with that name already exists.

Remarks: In some cases, calling AddLayer() can cause the memory references previously returned by operator[] and CurrentLayer() to become invalid.

Parameters
layerlayer
bReferencebReference

◆ AddLayer() [3/3]

int CRhinoLayerTable::AddLayer ( const wchar_t *  layer_name,
ON_Color  layer_color,
bool  bReturnExistingLayer 
)

Description: Create a new layer with a specified name and color. Parameters: layer_name - [in] If the name is nullptr or an empty string, an unused layer name is automatically used. layer_color - [in] If layer_color is ON_Color::UnsetColor, the default layer color is used bReturnExistingLayer - [in] If there is a layer named layer_name and bReturnExistingLayer is true, then the index of the existing layer is returned. If there is a layer named layer_name and bReturnExistingLayer is false, then the ON_UNSET_INT_INDEX is returned. Returns: >= 0: index of the layer ON_UNSET_INT_INDEX: layer could not be added because layer_name was invalid or a layer named layer_name and bReturnExistingLayer was false.

◆ ChangeLayerSortOrder()

void CRhinoLayerTable::ChangeLayerSortOrder ( const ON_SimpleArray< ON_2dex > &  sort_order)

◆ CreateLayer()

int CRhinoLayerTable::CreateLayer ( const ON_Layer layer,
unsigned int  layer_type,
unsigned int  worksession_ref_model_sn,
unsigned int  linked_idef_sn 
)

Description: Basic tool used by the add layer functions. Parameters: layer - [in] settings for new layer. These are copied to the layer table entry and any user data on layer is moved to the layer table entry. layer_type - [in] 0: ordinary layer 2: linked instance definition "filename.3dm" parent layer of the instance defintion's layer tree 4: worksession reference model "filename.3dm" parent layer of the reference model's layer tree worksession_ref_model_sn - [in] 0: layer is not a reference layer 1: layer is a reference layer but not part of a worksession reference file 2-1000: reserved for future use >1000: worksession reference file serial number
linked_idef_sn - [in] 0: layer is not from a liked instance definition 1-1000: reserved for future use >1000: linked instance definition serial number

◆ CurrentLayer()

const CRhinoLayer& CRhinoLayerTable::CurrentLayer ( ) const

Description: At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted.

Returns: Reference to the current layer. Note that this reference may become invalid after a call to AddLayer().

◆ CurrentLayerId()

ON_UUID CRhinoLayerTable::CurrentLayerId ( ) const

◆ CurrentLayerIndex()

int CRhinoLayerTable::CurrentLayerIndex ( ) const

Description: At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted.

Returns: Zero based layer table index of the current layer.

◆ DeleteLayer()

bool CRhinoLayerTable::DeleteLayer ( int  layer_index,
bool  bQuiet 
)

Description: Deletes layer

Parameters: layer_index - [in] zero based index of layer to delete. This must be in the range 0 <= layer_index < LayerCount(). bQuiet - [in] If true, no warning message box appears if a layer the layer cannot be deleted because it is the current layer or it contains active geometry.

Returns: true if successful. false if layer_index is out of range or the the layer cannot be deleted because it is the current layer or because it layer contains active geometry.

◆ DeleteLayers() [1/2]

int CRhinoLayerTable::DeleteLayers ( int  layer_index_count,
const int *  layer_index_list,
bool  bQuiet 
)

Description: Deletes multiple layers. Parameters: layer_index_count - [in] length of layer_index[] array. layer_index_list - [in] array zero based indices of layers to delete. The indices must be in the range 0 <= layer_index < LayerCount(). bQuiet - [in] If true, no warning message box appears if a layer cannot be deleted because it is the current layer, contains active geometry, and so on. Returns: Number of layers that were deleted. If this is < layer_index_count, you can dig through the layer table and check which ones were not deleted.

◆ DeleteLayers() [2/2]

int CRhinoLayerTable::DeleteLayers ( int  layer_index_count,
const int *  layer_index_list,
bool  bQuiet,
int  delete_objects_warning 
)

Description: Deletes multiple layers. Parameters: layer_index_count - [in] length of layer_index_list[] array. layer_index_list - [in] array zero based indices of layers to delete. The indices must be in the range 0 <= layer_index < LayerCount(). bQuiet - [in] If true, no warning message box appears if a layer cannot be deleted because it is the current layer, contains active geometry, and so on. delete_objects_warning - [in] Action to take when multiple delete warnings occur, where: 0 == No to all, 1 == Yes to all, 2 == Ask the user. Returns: Number of layers that were deleted. If this is < layer_index_count, you can dig through the layer table and check which ones were not deleted.

◆ Document()

CRhinoDoc& CRhinoLayerTable::Document ( ) const

Description: Layer tables store the list of layers in a Rhino document.

Returns: CRhinoDocument that owns this layer table.

◆ FindLayerFromFullPathName()

int CRhinoLayerTable::FindLayerFromFullPathName ( const wchar_t *  layer_full_path_name,
int  not_found_return_value 
) const

Description: Finds the layer from a layer path name. Parameters: layer_full_path_name - [in] name of layer to search for in the form "reference : alpha::beta::gamma"

The "reference" portion of the name is present when a layer is from a reference model in a worksession. The delimiter between the reference and the rest of the name is the string returned by ON_Layer::LayerNameReferenceDelimiter()

The delimiter between the layer names is a names in the path is the string returned by ON_Layer::LayerNamePathDelimiter()

not_found_return_value - [in] If no layer is found this value is returned.

Returns: index of the layer with a matching name or not_found_return_value is no layer is found.

◆ FindLayerFromGetString()

int CRhinoLayerTable::FindLayerFromGetString ( class CRhinoGetString gs,
int  nothing_layer_index,
bool  bVerbose 
) const

Description: When user interface code is using a GetString to find a layer name, set up the getter and then call FindLayer(CRhinoGetString&). Parameters: gs - [in] gs.GetString() is called to get the layer name. Set up options, prompts, and so on before calling FindLayer(gs,...) nothing_layer_index - [in] If >= 0, then this index is used if gs returns CRhinoGet::nothing. bVerbose - [in] If true and the layer is not found or two or more layers have the same name, then RhinoApp().Print() is used to print a message in the command feedback window. Returns: -5: gs.CommandResult() != CRhinoCommand::success -4: gs.Result() != CRhinoGet::string -3: empty string entered -2: two or more layers with the same name -1: no layer with specified name >=0: index of the layer with the given name

◆ FindLayerFromId()

int CRhinoLayerTable::FindLayerFromId ( ON_UUID  layer_id,
bool  bSearchDefaultLayers,
bool  bSearchDeletedLayers,
int  not_found_return_value 
) const

Description: Search for a layer with a matching id. Parameters: layer_id - [in] bSearchDefaultLayers - [in] If true, the system default layers (DefaultLayer) are included in the search. If you are searching for a layer to use as it exists, bSearchDefaultLayers should be true. If you are searching for a layer to modify, bSearchDefaultLayers should be false because the default layers cannot be modified. bSearchDeletedDeletedLayers - [in] If true, deleted layers are included in the search. not_found_return_value - [in] Value to return if no layer has a matching id. Depending on what should happen if the id is not found, CurrentLayerIndex(), DefaultLayer.Index() and ON_UNSET_INT_INDEX are common choices for this value. Returns: The index of the matching layer is returned. If no match is found, then not_found_return_value is returned.

◆ FindLayerFromName()

int CRhinoLayerTable::FindLayerFromName ( const wchar_t *  layer_name,
bool  bSearchDefaultLayers,
bool  bSearchFullPathNames,
int  not_found_return_value,
int  multiple_match_return_value 
) const

Description: Search for a layer with a matching name. Parameters: layer_name - [in] bSearchDefaultLayers - [in] If true, the system default layers (DefaultLayer) are included in the search. If you are searching for a layer to use as it exists, bSearchDefaultLayers should be true. If you are searching for a layer to modify, bSearchDefaultLayers should be false because the default layers cannot be modified. bSearchFullPathNames - [in] true: search for the full path name parent_name::...:leaf_name that uniquely identify a layer. false: search layer names (when the layer tree contains child nodes, there may be multiple layers with the same name. not_found_return_value - [in] Value to return if no layer has a matching name. Depending on what should happen if the name is not found, CurrentLayerIndex(), DefaultLayer.Index() and ON_UNSET_INT_INDEX are common choices for this value. multiple_found_return_value - [in] Value to return if bSearchFullPathNames is false and two or more layers have a matching name. Depending on what should happen if the name is not found, CurrentLayerIndex(), DefaultLayer.Index() and ON_UNSET_INT_INDEX are common choices for this value. Returns: The index of the matching layer is returned. If no match is found, then not_found_return_value is returned. If multiple matches are found, then multiple_match_return_value is returned. Example: If bSearchFullPathNames is falues and there are layers with indices and names:

0: "alpha" 1: "beta" 2: "beta::alpha" 3: "beta::gamma" 4: "beta::gamma::pi" 5: "beta::gamma::omega" 5: "beta::gamma::omega::pi"

Then FindLayerFromUniqueName( "alpha" ) returns 0. FindLayerFromUniqueName( "beta::alpha" ) returns 2. FindLayerFromUniqueName( "gamma" ) returns 3. FindLayerFromUniqueName( "pi" ) returns multiple_found_return_value. (multiple possible answers) FindLayerFromUniqueName( "beta::gamma::pi" ) returns 4. FindLayerFromUniqueName( "beta::gamma::omega::pi" ) returns 5. FindLayerFromUniqueName( "sigma" ) returns not_found_return_value. (no matches) FindLayerFromUniqueName( "" ) returns not_found_return_value. (no matches) FindLayerFromUniqueName( null ) returns not_found_return_value. (no matches)

◆ FindLayerFromParentAndName()

int CRhinoLayerTable::FindLayerFromParentAndName ( ON_UUID  parent_layer_id,
const wchar_t *  layer_name,
int  not_found_return_value 
) const

Description: Find the layer with a specified parent and name. Parameters: parent_layer_id - [in] ON_nil_uuid for a root level layer (no parent) layer_name - [in] layer name not_found_return_value - [in] If no layer is found this value is returned. Returns: != not_found_return_value: index of the layer with the specified parent and name == not_found_return_value: no layer has the specified parent and name Remarks: Layers with different parents may have identical names.

◆ FindLayerFromUniqueName() [1/2]

int CRhinoLayerTable::FindLayerFromUniqueName ( const wchar_t *  layer_name,
int  not_found_return_value,
int  multiple_found_return_value 
) const

Description: Find a layer from a name that uniquely identifies a layer. Parameters: layer_name - [in] name of layer to find not_found_return_value - [in] value to return if no layer found multiple_found_return_value - [in] value to return if multiple layers found Returns: multiple_found_return_value: two or more layers with the same name not_found_return_value: no layer with specified name >=0: index of the layer with the given name Example: If there are layers with indices and names:

0: "alpha" 1: "beta" 2: "beta::alpha" 3: "beta::gamma" 4: "beta::gamma::pi" 5: "beta::gamma::omega" 5: "beta::gamma::omega::pi"

Then FindLayerFromUniqueName( "alpha" ) returns 0. FindLayerFromUniqueName( "beta::alpha" ) returns 2. FindLayerFromUniqueName( "gamma" ) returns 3. FindLayerFromUniqueName( "pi" ) returns -2. (multiple possible answers) FindLayerFromUniqueName( "beta::gamma::pi" ) returns 4. FindLayerFromUniqueName( "beta::gamma::omega::pi" ) returns 5. FindLayerFromUniqueName( "sigma" ) returns -1. (no matches) FindLayerFromUniqueName( "" ) returns -1. (no matches) FindLayerFromUniqueName( null ) returns -1. (no matches)

◆ FindLayerFromUniqueName() [2/2]

int CRhinoLayerTable::FindLayerFromUniqueName ( const wchar_t *  short_name,
bool  bIgnoreDeletedLayers = true 
) const

Description: Find a layer from a name that uniquely identifies a layer. Parameters: layer_name - [in] - name of layer to find bIgnoreDeletedLayers - [in] - parameter is unused Returns: -2: two or more layers with the same name -1: no layer with specified name >=0: index of the layer with the given name Example: If there are layers with indices and names:

0: "alpha" 1: "beta" 2: "beta::alpha" 3: "beta::gamma" 4: "beta::gamma::pi" 5: "beta::gamma::omega" 5: "beta::gamma::omega::pi"

Then FindLayerFromUniqueName( "alpha" ) returns 0. FindLayerFromUniqueName( "beta::alpha" ) returns 2. FindLayerFromUniqueName( "gamma" ) returns 3. FindLayerFromUniqueName( "pi" ) returns -2. (multiple possible answers) FindLayerFromUniqueName( "beta::gamma::pi" ) returns 4. FindLayerFromUniqueName( "beta::gamma::omega::pi" ) returns 5. FindLayerFromUniqueName( "sigma" ) returns -1. (no matches) FindLayerFromUniqueName( "" ) returns -1. (no matches) FindLayerFromUniqueName( null ) returns -1. (no matches)

Deprecated:
use overload that accepts not_found_return_value and multiple_found_return_value parameters

◆ FindNextLayerFromName()

int CRhinoLayerTable::FindNextLayerFromName ( int  layer_index,
const wchar_t *  layer_name,
int  not_found_return_value 
) const

Description: Finds a layer with the given name. Parameters: layer_index - [in] index of the first layer tested. ON_UNSET_INT_INDEX: The search with default layers 0: The search will begin the first custom layer. >0: layer_table[i] is the first layer tested. layer_name - [in] name to search for not_found_return_value - [in] If no layer is found this value is returned. Returns: >=0 smallest index > layer_index of a layer the given name -1 no layer with index > layer_index has the given name

◆ GetDefaultLayerProperties()

void CRhinoLayerTable::GetDefaultLayerProperties ( ON_Layer layer) const

Description: Initializes an ON_Layer with the current default layer properties.

Parameters: layer - [out] properties returned here

Remarks: The default layer properties are:

@untitled table color RhinoApp().AppSettings().AppearanceSettings.m_default_layer_color line style RhinoApp().AppSettings().AppearanceSettings.m_default_layer_line_style material index -1 iges level -1 mode ON::normal_layer name empty layer index 0 (ignored by AddLayer)

◆ GetLayerPathName() [1/2]

bool CRhinoLayerTable::GetLayerPathName ( int  layer_index,
const wchar_t *  sLayerNamePathDelimeter,
ON_wString layer_path_name 
) const

◆ GetLayerPathName() [2/2]

bool CRhinoLayerTable::GetLayerPathName ( int  layer_index,
ON_wString layer_path_name 
) const

Description: Get the layer path name. Parameters: layer_index - [in] layer_path_name - [out] Returns: true: layer_index was valid and layer_path_name was set. false: layer_index was not valid. Remarks: If a layer does not have a parent, then its layer path name is identical to its layer name. If a layer has a parent, then its layer path name is made by prepending names of parent layers separated by the string returned from ON_Layer::LayerNamePathDelimiter().

◆ GetSortedList() [1/2]

void CRhinoLayerTable::GetSortedList ( bool  bIgnoreDeleted,
bool  bIgnoreFiltered,
ON_SimpleArray< const CRhinoLayer * > &  sorted_list 
) const
Parameters
bIgnoreDeletedIgnore deleted layers
bIgnoreFilteredIgnore filtered layers

◆ GetSortedList() [2/2]

void CRhinoLayerTable::GetSortedList ( ON_SimpleArray< const CRhinoLayer * > &  ,
bool  = false 
) const

Description: Gets an array of pointers to layers that is sorted by the values of CRhinoLayer::m_sort_index.

Parameters: sorted_list - [out] this array is returned with length LayerCount() and is sorted by the values of CRhinoLayer::m_sort_index. bIgnoreDeleted - [in] true means don't include deleted layers.

Remarks: Use Sort() to set the values of m_sort_index.

◆ GetUnusedLayerName() [1/2]

void CRhinoLayerTable::GetUnusedLayerName ( const wchar_t *  root_name,
ON_wString unused_layer_name 
) const

◆ GetUnusedLayerName() [2/2]

void CRhinoLayerTable::GetUnusedLayerName ( ON_wString unused_layer_name) const

Description: Gets unused layer name used as default when creating new layers. Parameters: root_name - [in] The returned name is "root_name nn" If root_name is empty, then "Layer" (localized) is used. layer_name - [out] A valid layer name that is not in use. bIgnoreDeleted - [in] When bIgnoreDeleted is true, then the returned name may be used by a deleted layer.

◆ InLayerTable()

bool CRhinoLayerTable::InLayerTable ( const ON_Layer layer) const

Returns: true The layer is an element in this layer table.

◆ IsValidLayerTableIndex()

bool CRhinoLayerTable::IsValidLayerTableIndex ( int  layer_index) const

Returns: true The layer_index is a valid index of a layer element in this layer table.

◆ Layer()

const CRhinoLayer* CRhinoLayerTable::Layer ( const ON_ComponentManifestItem item) const

◆ LayerCount()

int CRhinoLayerTable::LayerCount ( ) const

Returns: Number of layers in the layer table, including deleted layers.

◆ ListTable()

void CRhinoLayerTable::ListTable ( ON_TextLog text_log,
unsigned int  level_of_detail 
) const

◆ ModifyLayer()

bool CRhinoLayerTable::ModifyLayer ( const ON_Layer layer,
int  layer_index,
bool  bQuiet = false 
)

Description: Modify layer settings

Parameters: layer - [in] new settings. This information is copied. layer_index - [in] zero based index of layer to set. This must be in the range 0 <= layer_index < LayerCount(). bQuiet - [in] if true, information message boxes pop up when illegal changes are attempted.

Returns: true if successful. false if layer_index is out of range or the settings attempt to lock or hide the current layer.

◆ operator[]()

const CRhinoLayer& CRhinoLayerTable::operator[] ( int  ) const

Description: Conceptually, the layer table is an array of LayerCount() layers. The operator[] can be used to get individual layers. A layer is either active or deleted and this state is reported by CRhinoLayer::IsDeleted().

Parameters: layer_index - zero based array index

Returns: Reference to the layer. If layer_index is out of range, the current layer is returned. Note that this reference may become invalid after AddLayer() is called.

◆ RemapIndex()

int CRhinoLayerTable::RemapIndex ( int  layer_index) const

◆ SetCurrentLayerIndex()

bool CRhinoLayerTable::SetCurrentLayerIndex ( int  layer_index,
bool  bQuiet = false 
)

Description: At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted.

Parameters: layer_index - [in] value for new current layer. 0 <= layer_index < LayerCount(). The layer's mode is automatically set to ON::normal_mode. bQuiet - [in] if true, then no warning message box pops up if the current layer request can't be satisfied. Returns: true if current layer index successfully set.

◆ SetRemapIndex()

void CRhinoLayerTable::SetRemapIndex ( int  layer_index,
int  remap_index 
)

◆ SetUnusedLayerName()

bool CRhinoLayerTable::SetUnusedLayerName ( const wchar_t *  root_name,
ON_Layer layer 
) const

◆ Sort()

void CRhinoLayerTable::Sort ( int(*)(const CRhinoLayer *, const CRhinoLayer *, void *)  compare,
int(*)(const CRhinoLayer *, void *)  cull,
void *  p = 0 
)

Description: Use this to set CRhinoLayer::m_sort_index so that the values of m_sort_index run from 0 to LayerCount()-1 and compare(layer_table[i],layer_table[j]) < 0 ) implies layer_table[i].m_sort_index < layer_table[j].m_sort_index.

Parameters: compare - [in] compare function with prototype int compare(const CRhinoLayer* arg1,const CRhinoLayer* arg2,void* p). that returns <0 if arg1<arg2, 0 if arg1=arg2, and >0 if arg1>arg2. If you want to preserve the existing sort order, pass null for the compare function. cull - [in] optional filter function with prototype bool cull(const CRhinoLayer* arg,void* p). that returns true if the layer should be ignored when sorting. Layers that are ignored are not included in the list returned by GetSortedList(). Pass 0 if you do not need to cull layers p - [in] pointer passed as last argument to compare() and cull().

Remarks: After calling Sort(), you can repeatedly call GetSortedList() to get a sorted list of CRhinoLayer pointers. Sort() and GetSortedList() do not modify the order or persistent information in the layer table. They are intended to be used to get sorted lists of layers for dialogs, etc.

◆ SortByLayerName()

void CRhinoLayerTable::SortByLayerName ( bool  bAscending)

Description: Sort layers, in the layer table, by their name in either ascending or descending order. This function sorts layers in the same manner as Rhino's Layers panel. Parameters: bAscending - [in] Sort in ascending (true) or descending (false) order. Remarks: This function changes the value of CRhinoLayer::m_sort_index. It does not change the index order of layers in the layer table.

◆ TableReference()

const class CRhinoDocTableReference& CRhinoLayerTable::TableReference ( ) const

◆ UndeleteLayer()

bool CRhinoLayerTable::UndeleteLayer ( int  layer_index)

Description: Undeletes a layer that has been deleted by DeleteLayer().

Parameters: layer_index - [in] zero based index of layer to undelete. This must be in the range 0 <= layer_index < LayerCount().

Returns: true if successful.

◆ UndoModifyLayer()

bool CRhinoLayerTable::UndoModifyLayer ( int  layer_index,
unsigned int  ur_sn = 0 
)

Description: If the layer has been modified and the modification can be undone, then UndoModify() will restore the layer to its previous state.

Returns: true if this layer had been modified and the modifications were undone.

See Also: IsModified.

◆ UnsortLayer()

bool CRhinoLayerTable::UnsortLayer ( int  layer_index,
int  sort_index 
)

Friends And Related Function Documentation

◆ CRhinoDoc

friend class CRhinoDoc
friend

◆ CRhinoRead3dmHelper

friend class CRhinoRead3dmHelper
friend

for access to CRhinoLayerTable::FindReferenceParentLayer()

◆ RhGetGrandParentLayerId

bool RhGetGrandParentLayerId ( CRhinoDoc ,
unsigned int  ,
unsigned int  ,
unsigned int  ,
const wchar_t *  ,
const wchar_t *  ,
ON_UUID  
)
friend

Member Data Documentation

◆ DefaultLayer

const CRhinoLayer& CRhinoLayerTable::DefaultLayer

Description: CRhinoLayer::DefaultLayer is returned when an invalid index is passed to operator[] and in other emergencies when a valid reference to a layer is needed and there is there is not a layer in the table that can be used.

This is not the layer with the English name "Default". CRhinoLayer::DefaultLayer is never saved in files.

CRhinoLayer::DefaultLayer.Index() = -1 CRhinoLayer::DefaultLayer.Id() = nil, CRhinoLayer::DefaultLayer.Name() = ""