Classes | Macros | Typedefs | Enumerations
Level Cache

A LevelCache provides access to level definitions. More...

Classes

struct  LevelDefinitionStyleBase
 Base class for style that is used by a level. More...
 
struct  LevelDefinitionColor
 Represents a color used by a level. More...
 
struct  LevelDefinitionLineStyle
 Represents a line style used by a level. More...
 
struct  LevelDefinitionIdBase
 Represents a style used by a level. More...
 
struct  LevelDefinitionMaterial
 Represents a material used by a level. More...
 
struct  LevelDefinitionPlotStyle
 Represents a PlotStyleID used by a level. More...
 
struct  LevelHandle
 Read-only access to a level definition. More...
 
struct  EditLevelHandle
 Read-write access to a level definition. More...
 
struct  LevelCache
 A level cache holds level definitions. More...
 
struct  PersistentLevelCache
 Abstract base class for persistent LevelCaches that support Write. More...
 
struct  FileLevelCache
 A FileLevelCache contains the level definitions for a file. More...
 
struct  DgnAttachmentLevelCache
 Provides access to levels used by elements in a referenced model. More...
 
struct  LevelUtils
 

Macros

#define LEVEL_NAME_DISPLAY_FORMAT_STRING   L"N"
 Level Display Name Format Defines. More...
 
#define LEVEL_CODE_DISPLAY_FORMAT_STRING   L"C"
 
#define LEVEL_DESCRIPTION_DISPLAY_FORMAT_STRING   L"D"
 
#define LEVEL_NAME_DISPLAY_FORMAT   L'N'
 Level Display Name Format Values. More...
 
#define LEVEL_CODE_DISPLAY_FORMAT   L'C'
 
#define LEVEL_DESCRIPTION_DISPLAY_FORMAT   L'D'
 
#define LEVEL_ID_DISPLAY_FORMAT   L'I'
 

Typedefs

typedef bset< byte >::iterator T_LevelIdToDefinitionMapIterator
 
typedef RefCountedPtr
< FileLevelCache > 
FileLevelCachePtr
 Smart pointer wrapper for FileLevelCache. More...
 
typedef bvector
< FileLevelCachePtr > 
T_LevelCachePtrVector
 

Enumerations

enum  LevelCacheErrorCode {
  None = BSISUCCESS, Error = BSIERROR, TableIsReadOnly = 2, LevelIsReadOnly = 4,
  LevelNameIsNull = 7, LevelNameIsInvalid = 8, LevelNameIsDuplicate = 9, LevelIsUsed = 11,
  LevelCodeIsDuplicate = 23, LevelIdIsDuplicate = 46, LibraryLevelNotEditable = 49, CannotFindLevel = 56,
  LevelTableIntegrityFailure = 59, DgnAttachmentNotResolved = 60, LevelNullId = 92, NoLevels = 1000,
  AttachmentSharesFileLevelCache = 1001
}
 Error codes returned by LevelCache function. More...
 
enum  EditPropertiesChangeWrite { Always = 0, IfNewChangesOnly = 1, Never = 2 }
 Controls Change writing for LevelCache EditProperties method. More...
 

Detailed Description

A LevelCache provides access to level definitions.

DgnFile::GetLevelCacheR accesses the level definitions of a file. Levels are stored in a level table. A DgnFile has a FileLevelCache to provide access to the information in its level table.

FileLevelCache::GetLevel accesses the definition of a level. Every element in a file is associated with a level. The Elm_hdr.level member of an element is the internal LevelId of the level in the file that contains the element. (Example)

LevelHandle accesses the attributes of a level. Level attributes tell you if elements on the level should be displayed, what the element by-level symbology is for that level, and so on. (Example)

FileLevelCache::CreateLevel allows you to create a new level. (Example)

EditLevelHandle allows you to modify the attributes of an existing level. You can only get a EditLevelHandle from a FileLevelCache to which you have read-write access.

DgnAttachment::GetAttachmentLevelCache accesses level definition overrides for a reference attachment. When one model is referenced into another, the elements in the referenced model refer to levels in the file that contains that referenced model. A reference attachment can override the definition of some or all of the referenced levels. A DgnAttachmentLevelCache provides access to both levels that were overridden by the attachment and levels that are defined by the referenced file.

FileLevelCache and DgnAttachmentLevelCache are both derived from LevelCache. LevelCache defines the basic level look-up and iteration functions that are common to both kinds of level cache. Only FileLevelCache provides functions to create or remove levels or to modify level attributes.

Collections and Iterators

See Iterate levels in a level cache

Example Code

See LevelCache Code Samples

A LevelCache collaborates with DgnFile and DgnModel to keep track of which levels are actually used by elements. A level is used if:

Macro Definition Documentation

#define LEVEL_CODE_DISPLAY_FORMAT   L'C'
#define LEVEL_CODE_DISPLAY_FORMAT_STRING   L"C"
#define LEVEL_DESCRIPTION_DISPLAY_FORMAT   L'D'
#define LEVEL_DESCRIPTION_DISPLAY_FORMAT_STRING   L"D"
#define LEVEL_ID_DISPLAY_FORMAT   L'I'
#define LEVEL_NAME_DISPLAY_FORMAT   L'N'

Level Display Name Format Values.

#define LEVEL_NAME_DISPLAY_FORMAT_STRING   L"N"

Level Display Name Format Defines.

Typedef Documentation

typedef RefCountedPtr<FileLevelCache> FileLevelCachePtr

Smart pointer wrapper for FileLevelCache.

typedef bvector<FileLevelCachePtr> T_LevelCachePtrVector
typedef bset<byte>::iterator T_LevelIdToDefinitionMapIterator

Enumeration Type Documentation

enum EditPropertiesChangeWrite
strong

Controls Change writing for LevelCache EditProperties method.

Enumerator
Always 

Write changes to the file regardless of whether there were pre-existing changes.

IfNewChangesOnly 

Write changes to the file only if there were previously no unsaved changes.

Never 

Don't write changes to the file.

enum LevelCacheErrorCode
strong

Error codes returned by LevelCache function.

Enumerator
None 

Success.

Error 

An unspecified error.

TableIsReadOnly 

The level cache is marked as read-only.

LevelIsReadOnly 

The level is read-only.

LevelNameIsNull 

The level name cannot be NULL.

LevelNameIsInvalid 

The name contains invalid characters. See LevelUtils::ContainsInvalidCharacters.

LevelNameIsDuplicate 

The name is already used by a level in this cache.

LevelIsUsed 

The level is in use.

LevelCodeIsDuplicate 

The LevelCode is already used by a level in this cache.

LevelIdIsDuplicate 

The LevelId is already used by a level in this cache.

LibraryLevelNotEditable 

The level is in a library, and cannot be edited.

CannotFindLevel 

Cannot find level.

LevelTableIntegrityFailure 

Integrity check failure.

DgnAttachmentNotResolved 

Attempt to query a FileLevelCache for a DgnAttachment that is not resolved (not found or not read).

LevelNullId 

A level element with levelId - LEVEL_NULL_ID is in the level table element descriptor and that level definition is ignored.

NoLevels 

There are no levels in the LevelCache.

AttachmentSharesFileLevelCache 

An attempt was made to Write the LevelCache associated with a DgnAttachment that shares the FileLevelCache for the root model.


Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.