CFx SDK Documentation  2020SP3
Public Types | Static Public Member Functions | List of all members
OdDbLayerState Class Reference

#include <DbLayerState.h>

Public Types

enum  Mask {
  kDefMask = (long)0xFFFFFFFF, kNone = 0x0000, kOn = 0x0001, kFrozen = 0x0002,
  kLocked = 0x0004, kPlot = 0x0008, kNewViewport = 0x0010, kColor = 0x0020,
  kLineType = 0x0040, kLineWeight = 0x0080, kPlotStyle = 0x0100, kCurrentViewport = 0x0200,
  kTransparency = 0x0400, kAll, kHidden = 0x8000, kLastRestored = 0x10000
}
 
enum  { kUndefDoNothing = 0x00, kUndefTurnOff = 0x01, kUndefFreeze = 0x02, kRestoreAsOverrides = 0x04 }
 
enum  ImportResult { kImported, kAlreadyExists }
 

Static Public Member Functions

static OdDbObjectId dictionaryId (OdDbDatabase *pDb, bool createIfNotFound=false)
 
static bool has (OdDbDatabase *pDb, const OdString &layerStateName)
 
static void save (OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask, const OdDbObjectId &viewportId=OdDbObjectId::kNull)
 
static void restore (OdDbDatabase *pDb, const OdString &layerStateName, int flags=kUndefDoNothing, const int layerStateMask=kDefMask, const OdDbObjectId &viewportId=OdDbObjectId::kNull)
 
static void setMask (OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask)
 
static int mask (OdDbDatabase *pDb, const OdString &layerStateName)
 
static void remove (OdDbDatabase *pDb, const OdString &layerStateName)
 
static void rename (OdDbDatabase *pDb, const OdString &oldName, const OdString &newName)
 
static ImportResult importData (OdDbDatabase *pDb, OdStreamBuf *pStreamBuf, OdString *pName=0)
 
static void exportData (OdDbDatabase *pDb, const OdString &layerStateName, OdStreamBuf *pStreamBuf)
 
static void setDescription (OdDbDatabase *pDb, const OdString &layerStateName, const OdString &description)
 
static OdString description (OdDbDatabase *pDb, const OdString &layerStateName)
 
static bool hasViewportData (OdDbDatabase *pDb, const OdString &layerStateName)
 
static OdResult addLayerStateLayers (const OdString &sName, OdDbObjectIdArray layerIds)
 
static OdResult removeLayerStateLayers (OdDbDatabase *pDb, const OdString sName, const OdStringArray &layerNames)
 
static OdResult saveGroup (OdDbDatabase *pDb, const OdString &sName, const OdDbObjectIdArray &pLayers, int mask=kOn, int includedLayersState=kOn, int otherLayersState=kNone)
 

Detailed Description

This class implements an interface for manipulating LayerStates in multiple OdDbDatabase instances.

Library: TD_Db <group OdDb_Classes>

Definition at line 36 of file DbLayerState.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kUndefDoNothing 
kUndefTurnOff 
kUndefFreeze 
kRestoreAsOverrides 

Definition at line 65 of file DbLayerState.h.

◆ ImportResult

Enumerator
kImported 
kAlreadyExists 

Definition at line 256 of file DbLayerState.h.

◆ Mask

Enumerator
kDefMask 
kNone 
kOn 
kFrozen 
kLocked 
kPlot 
kNewViewport 
kColor 
kLineType 
kLineWeight 
kPlotStyle 
kCurrentViewport 
kTransparency 
kAll 
kHidden 
kLastRestored 

Definition at line 39 of file DbLayerState.h.

Member Function Documentation

◆ addLayerStateLayers()

static OdResult OdDbLayerState::addLayerStateLayers ( const OdString sName,
OdDbObjectIdArray  layerIds 
)
static

Adds more layers to a layer state.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerIds[in] Array of object Ids of layers to be added to the layer state

◆ description()

static OdString OdDbLayerState::description ( OdDbDatabase pDb,
const OdString layerStateName 
)
static

Returns the description of the specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.

◆ dictionaryId()

static OdDbObjectId OdDbLayerState::dictionaryId ( OdDbDatabase pDb,
bool  createIfNotFound = false 
)
static

Returns the Object ID of the LayerStates dictionary for the specified database.

Parameters
pDb[in] Pointer to the database.
createIfNotFound[in] Controls the creation of the dictionary if it does not exist.

◆ exportData()

static void OdDbLayerState::exportData ( OdDbDatabase pDb,
const OdString layerStateName,
OdStreamBuf pStreamBuf 
)
static

Exports the LayerState from the specified database to the specified file.

Parameters
pDb[in] Pointer to the database.
pStreamBuf[in] Pointer to the StreamBuf object to which the data are to be written.
layerStateName[in] LayerState name.

◆ has()

static bool OdDbLayerState::has ( OdDbDatabase pDb,
const OdString layerStateName 
)
static

Returns true if and only if the specified database has a LayerState with the specified name.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.

◆ hasViewportData()

static bool OdDbLayerState::hasViewportData ( OdDbDatabase pDb,
const OdString layerStateName 
)
static

Returns true if and only if there is viewport data associated with specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.

◆ importData()

static ImportResult OdDbLayerState::importData ( OdDbDatabase pDb,
OdStreamBuf pStreamBuf,
OdString pName = 0 
)
static

Imports the LayerState from the specified file to the specified database.

Parameters
pDb[in] Pointer to the database.
pStreamBuf[in] Pointer to the StreamBuf object from which the data are to be read.
pName[out] Optional pointer to the string where imported layer state name will be stored.

Returns one of the following:

Value
kImported 0
kAlreadyExists 1

◆ mask()

static int OdDbLayerState::mask ( OdDbDatabase pDb,
const OdString layerStateName 
)
static

Returns the LayerState mask for the specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
Remarks
The layer state mask determines which layer attributes are to be restored from the LayerState.

mask() returns a combination of one or more of the following:

Value
kNone 0x0000
kOn 0x0001
kFrozen 0x0002
kLocked 0x0004
kPlot 0x0008
kNewViewport 0x0010
kColor 0x0020
kLineType 0x0040
kLineWeight 0x0080
kPlotStyle 0x0100
kCurrentViewport 0x0200
kTransparency 0x0400 kAll kOn | kFrozen | kLocked | kPlot | kNewViewport | kColor | kLineType | kLineWeight | kPlotStyle | kCurrentViewport | kTransparency
kHidden 0x8000

◆ remove()

static void OdDbLayerState::remove ( OdDbDatabase pDb,
const OdString layerStateName 
)
static

Removes the specified LayerState from the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.

◆ removeLayerStateLayers()

static OdResult OdDbLayerState::removeLayerStateLayers ( OdDbDatabase pDb,
const OdString  sName,
const OdStringArray layerNames 
)
static

Removes layers from a layer state.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerNames[in] Array of names of layers to be removed from the layer state.

◆ rename()

static void OdDbLayerState::rename ( OdDbDatabase pDb,
const OdString oldName,
const OdString newName 
)
static

Renames the specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
oldName[in] Old name.
newName[in] New name.

◆ restore()

static void OdDbLayerState::restore ( OdDbDatabase pDb,
const OdString layerStateName,
int  flags = kUndefDoNothing,
const int  layerStateMask = kDefMask,
const OdDbObjectId viewportId = OdDbObjectId::kNull 
)
static

Restores the specified LayerState of the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerStateMask[in] LayerState mask.
viewportId[in] Viewport whose LayerState is to be saved.
undefAction[in] Action for undefined layers.
Remarks
undefAction specified the action for layers not defined in the LayerState. undefAction must be one of the following:

Value
kUndefDoNothing 0
kUndefTurnOff 1
kUndefFreeze 2

layerStateMask determines which layer attributes are to be restored from the LayerState.
layerStateMask must be a combination of one or more of the following:

Value
kDefMask 0xFFFFFFFF
kNone 0x0000
kOn 0x0001
kFrozen 0x0002
kLocked 0x0004
kPlot 0x0008
kNewViewport 0x0010
kColor 0x0020
kLineType 0x0040
kLineWeight 0x0080
kPlotStyle 0x0100
kCurrentViewport 0x0200
kTransparency 0x0400 kAll kOn | kFrozen | kLocked | kPlot | kNewViewport | kColor | kLineType | kLineWeight | kPlotStyle | kCurrentViewport | kTransparency
kHidden 0x8000

◆ save()

static void OdDbLayerState::save ( OdDbDatabase pDb,
const OdString layerStateName,
int  layerStateMask,
const OdDbObjectId viewportId = OdDbObjectId::kNull 
)
static

Saves the current LayerState of the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerStateMask[in] LayerState mask.
viewportId[in] Viewport whose LayerState is to be saved.
Remarks
layerStateMask determines which layer attributes are to be stored in the LayerState.
layerStateMask must be a combination of one or more of the following:

Value
kNone 0x0000
kOn 0x0001
kFrozen 0x0002
kLocked 0x0004
kPlot 0x0008
kNewViewport 0x0010
kColor 0x0020
kLineType 0x0040
kLineWeight 0x0080
kPlotStyle 0x0100
kCurrentViewport 0x0200
kTransparency 0x0400 kAll kOn | kFrozen | kLocked | kPlot | kNewViewport | kColor | kLineType | kLineWeight | kPlotStyle | kCurrentViewport | kTransparency
kHidden 0x8000

◆ saveGroup()

static OdResult OdDbLayerState::saveGroup ( OdDbDatabase pDb,
const OdString sName,
const OdDbObjectIdArray pLayers,
int  mask = kOn,
int  includedLayersState = kOn,
int  otherLayersState = kNone 
)
static

Creates a layer state where specified layers are assigned one state (e.g. ON), and all the others are assigned other state (e.g. OFF).

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerIds[in] Array of object Ids of layers to be added to the layer state
mask[in] created

◆ setDescription()

static void OdDbLayerState::setDescription ( OdDbDatabase pDb,
const OdString layerStateName,
const OdString description 
)
static

Sets the description of the specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
description[in] Description.

◆ setMask()

static void OdDbLayerState::setMask ( OdDbDatabase pDb,
const OdString layerStateName,
int  layerStateMask 
)
static

Sets the LayerState mask for the specified LayerState in the specified database.

Parameters
pDb[in] Pointer to the database.
layerStateName[in] LayerState name.
layerStateMask[in] LayerState mask.
Remarks
layerStateMask determines which layer attributes are to be restored from the LayerState.
layerStateMask must be a combination of one or more of the following:

Value
kNone 0x0000
kOn 0x0001
kFrozen 0x0002
kLocked 0x0004
kPlot 0x0008
kNewViewport 0x0010
kColor 0x0020
kLineType 0x0040
kLineWeight 0x0080
kPlotStyle 0x0100
kCurrentViewport 0x0200
kTransparency 0x0400 kAll kOn | kFrozen | kLocked | kPlot | kNewViewport | kColor | kLineType | kLineWeight | kPlotStyle | kCurrentViewport | kTransparency
kHidden 0x8000


The documentation for this class was generated from the following file: