CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbLayerState.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24#ifndef DBLAYERSTATEMANAGER_H
25#define DBLAYERSTATEMANAGER_H
26
27#include "TD_PackPush.h"
28#include "StringArray.h"
29
31class OdDbLayerStateManagerImpl;
32
39{
40protected:
41 OdDbLayerStateManager(OdDbLayerStateManagerImpl*);
42public:
43//DOM-IGNORE-BEGIN
45//DOM-IGNORE-END
46
51
56
62 kNone = 0x0000, //None
63 kOn = 0x0001, //On
64 kFrozen = 0x0002, //Frozen
65 kLocked = 0x0004, //Locked
66 kPlot = 0x0008, //Plot
67 kNewViewport = 0x0010, //New viewport
68 kColor = 0x0020, //Color
69 kLineType = 0x0040, //Line type
70 kLineWeight = 0x0080, //Line weight
71 kPlotStyle = 0x0100, //Plot style
72 kCurrentViewport = 0x0200, //Current viewport
73 kTransparency = 0x0400, //Transparency
74 kAll = kOn | kFrozen | kLocked | kPlot | kNewViewport |
75 kColor | kLineType | kLineWeight | kPlotStyle |
76 kCurrentViewport | kTransparency, //All
77 kStateIsHidden = 0x8000, //State is hidden
78 kLastRestored = 0x10000, //Last restored
79 kDecomposition = kAll | 0x20000 //Decomposition
80 };
81
87 enum {
88 kUndefDoNothing = 0, //Restore as is
89 kUndefTurnOff = 1, //Restore as turned off
90 kUndefFreeze = 2, //Restore as frozen
91 kRestoreAsOverrides = 4 //Restore as overrides
92 };
93
103
113
126 OdDbObjectId layerStatesDictionaryId(bool bCreateIfNotPresent=false);
127
137 bool hasLayerState(const OdString& sName);
138
173
182
217
252
261
270 OdResult renameLayerState(const OdString& sName, const OdString& sNewName);
271
280
290 OdResult exportLayerState(const OdString& sNameToExport, OdStreamBuf* pStreamBuf);
292 OdResult restoreLayerState(const OdString& sName, const OdDbObjectId& idVp, int nRestoreFlags = 0, const LayerStateMask* pClientMask = NULL);
297 OdResult getLayerStateNames(OdStringArray& lsArray, bool bIncludeHidden = true, bool bIncludeXref = true);
299 OdResult getLayerStateLayers(OdStringArray& layerArray, const OdString& sName, bool bInvert = false);
300 bool compareLayerStateToDb(const OdString& sName, const OdDbObjectId& idVp);
302 OdResult removeLayerStateLayers(const OdString& sName, const OdStringArray& layerNames);
303 bool isDependentLayerState(const OdString& sName);
305protected:
306 OdDbLayerStateManagerImpl* m_pImpl;
307 friend class OdDbLayerStateManagerImpl;
308 friend class OdDbDatabase;
309};
310
311//FELIX_CHANGE_BEGIN
317{
318public:
321
325 virtual bool load() = 0;
326
330 virtual bool save() = 0;
331
335 virtual OdString getActiveLayer() const = 0;
336 virtual OdResult setActiveLayer( const OdString& layerStateName ) = 0;
337
341 virtual bool isOn( const OdString& layerName ) const = 0;
342 virtual OdResult setOn( const OdString& layerName, const bool& bOn ) = 0;
343
347 virtual bool isFreezed( const OdString& layerName, OdDbObjectId id = NULL ) const = 0;
348 virtual OdResult setFreeze( const OdString& layerName, const bool& bFreeze, OdDbObjectId id = NULL ) = 0;
349
353 virtual bool isLocked( const OdString& layerName ) const = 0;
354 virtual OdResult setLocked( const OdString& layerName, const bool& bLock ) = 0;
355
359 virtual OdCmColor getLineColor( const OdString& layerName ) const = 0;
360 virtual OdResult setLineColor( const OdString& layerName, const OdCmColor& color ) = 0;
361
365 virtual OdDb::LineWeight getLineWeight( const OdString& layerName ) const = 0;
366 virtual OdResult setLineWeight( const OdString& layerName, const OdDb::LineWeight& lweight ) = 0;
367
371 virtual OdDbObjectId getLineType( const OdString& layerName ) const = 0;
372 virtual OdResult setLineType( const OdString& layerName, const OdDbObjectId& ltype ) = 0;
373
377 virtual OdString getPlotStyle( const OdString& layerName ) const = 0;
378 virtual OdResult setPlotStyle( const OdString& layerName, const OdString& plotStyle ) = 0;
379
383 virtual OdCmTransparency getTransparency( const OdString& layerName) const = 0;
384 virtual OdResult setTransparency ( const OdString& layerName, const OdCmTransparency& transparency ) = 0;
385
389 virtual bool isPlotable( const OdString& layerName ) const = 0;
390 virtual OdResult setPlotable( const OdString& layerName, const bool& bPlot ) = 0;
391
395 virtual bool isNewVPFreeze( const OdString& layerName ) const = 0;
396 virtual OdResult setNewVPFreeze( const OdString& layerName, const bool& bNewVPFreeze ) = 0;
397
401 virtual OdDbDatabase* database() const = 0;
402
406 virtual OdString getLayerStateName() const = 0;
407 };
408
410
416{
417public:
420
423
424private:
425 OdDbDatabasePtr m_pDb;
426};
427//FELIX_CHANGE_END
428
429
438{
439public:
440//DOM-IGNORE-BEGIN
442//DOM-IGNORE-END
443
450 virtual void layerStateCreated(const OdString& layerStateName,
451 const OdDbObjectId& layerStateId);
452
463 virtual void layerStateCompareFailed(const OdString& layerStateName,
464 const OdDbObjectId& layerStateId);
465
472 virtual void layerStateToBeRestored(const OdString& layerStateName,
473 const OdDbObjectId& layerStateId);
474
481 virtual void layerStateRestored(const OdString& layerStateName,
482 const OdDbObjectId& layerStateId);
483
491 virtual void abortLayerStateRestore(const OdString& layerStateName,
492 const OdDbObjectId& layerStateId);
493
494
501 virtual void layerStateToBeDeleted(const OdString& layerStateName,
502 const OdDbObjectId& layerStateId);
503
509 virtual void layerStateDeleted(const OdString& layerStateName);
510
518 virtual void abortLayerStateDelete(const OdString& layerStateName,
519 const OdDbObjectId& layerStateId);
520
521
528 virtual void layerStateToBeRenamed(const OdString& oldLayerStateName,
529 const OdString& newLayerStateName);
530
537 virtual void layerStateRenamed(const OdString& oldLayerStateName,
538 const OdString& newLayerStateName);
539
547 virtual void abortLayerStateRename(const OdString& oldLayerStateName,
548 const OdString& newLayerStateName);
549};
550
551
557
565{
566public:
567
576 static OdDbObjectId dictionaryId(OdDbDatabase *pDb, bool createIfNotFound = false);
577
588 static bool has(OdDbDatabase *pDb, const OdString &layerStateName);
589
623 static void save(OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask, const OdDbObjectId &viewportId = OdDbObjectId::kNull);
624
670 static void restore(OdDbDatabase *pDb, const OdString &layerStateName,
671 int flags = OdDbLayerStateManager::kUndefDoNothing, const int layerStateMask = -1, const OdDbObjectId& viewportId = OdDbObjectId::kNull);
704 static void setMask(OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask);
705
740 static int mask(OdDbDatabase *pDb, const OdString &layerStateName);
741
748 static void remove(OdDbDatabase *pDb, const OdString &layerStateName);
749
757 static void rename(OdDbDatabase *pDb, const OdString &oldName, const OdString &newName);
758
764 {
765 kImported, //Layer state was imported
766 kAlreadyExists //Layer state already exists in the database
767 };
768
784 static ImportResult importData(OdDbDatabase *pDb, OdStreamBuf* pStreamBuf, OdString* pName = 0);
785
793 static void exportData(OdDbDatabase *pDb, const OdString &layerStateName, OdStreamBuf* pStreamBuf);
794
802 static void setDescription(OdDbDatabase *pDb, const OdString &layerStateName, const OdString &description);
811 static OdString description(OdDbDatabase *pDb, const OdString &layerStateName);
812
822 static bool hasViewportData(OdDbDatabase *pDb, const OdString &layerStateName);
823
834
844 static OdResult removeLayerStateLayers(OdDbDatabase* pDb, const OdString sName, const OdStringArray& layerNames);
845
857 static OdResult saveGroup(OdDbDatabase *pDb, const OdString &sName,
859 int includedLayersState = OdDbLayerStateManager::kOn, int otherLayersState = OdDbLayerStateManager::kNone);
860};
861
862#include "TD_PackPop.h"
863
864#endif //#ifndef DBLAYERSTATEMANAGER_H
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdSmartPtr< OdDbLayerStateManagerReactor > OdDbLayerStateManagerReactorPtr
Definition: DbLayerState.h:556
TOOLKIT_EXPORT OdDbLayerStateProperties * fxGetLayerStateProperties(OdDbDatabase *pDb, const OdString &layerState)
ltype
Definition: DimVarDefs.h:2949
OdResult
Definition: OdResult.h:29
static OdString description(OdDbDatabase *pDb, const OdString &layerStateName)
static void restore(OdDbDatabase *pDb, const OdString &layerStateName, int flags=OdDbLayerStateManager::kUndefDoNothing, const int layerStateMask=-1, const OdDbObjectId &viewportId=OdDbObjectId::kNull)
static ImportResult importData(OdDbDatabase *pDb, OdStreamBuf *pStreamBuf, OdString *pName=0)
static void remove(OdDbDatabase *pDb, const OdString &layerStateName)
static OdResult saveGroup(OdDbDatabase *pDb, const OdString &sName, const OdDbObjectIdArray &pLayers, int mask=OdDbLayerStateManager::kOn, int includedLayersState=OdDbLayerStateManager::kOn, int otherLayersState=OdDbLayerStateManager::kNone)
static OdResult addLayerStateLayers(const OdString &sName, OdDbObjectIdArray layerIds)
static OdResult removeLayerStateLayers(OdDbDatabase *pDb, const OdString sName, const OdStringArray &layerNames)
static bool hasViewportData(OdDbDatabase *pDb, const OdString &layerStateName)
static void exportData(OdDbDatabase *pDb, const OdString &layerStateName, OdStreamBuf *pStreamBuf)
static OdDbObjectId dictionaryId(OdDbDatabase *pDb, bool createIfNotFound=false)
static void setMask(OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask)
static int mask(OdDbDatabase *pDb, const OdString &layerStateName)
static bool has(OdDbDatabase *pDb, const OdString &layerStateName)
static void setDescription(OdDbDatabase *pDb, const OdString &layerStateName, const OdString &description)
static void rename(OdDbDatabase *pDb, const OdString &oldName, const OdString &newName)
static void save(OdDbDatabase *pDb, const OdString &layerStateName, int layerStateMask, const OdDbObjectId &viewportId=OdDbObjectId::kNull)
OdResult renameLayerState(const OdString &sName, const OdString &sNewName)
OdResult getLayerStateDescription(const OdString &sName, OdString &sDesc)
OdResult getLastRestoredLayerState(OdString &sName, OdDbObjectId &restoredLSId)
OdResult setLayerStateDescription(const OdString &sName, const OdString &sDesc)
OdResult saveLayerState(const OdString &sName, LayerStateMask mask)
OdDbDatabase * getDatabase() const
bool compareLayerStateToDb(const OdString &sName, const OdDbObjectId &idVp)
bool addReactor(OdDbLayerStateManagerReactor *pReactor)
OdResult getLayerStateMask(const OdString &sName, LayerStateMask &returnMask)
OdResult restoreLayerState(const OdString &sName, const OdDbObjectId &idVp, int nRestoreFlags=0, const LayerStateMask *pClientMask=NULL)
OdResult importLayerStateFromDb(const OdString &pStateName, OdDbDatabase *pDb)
OdResult setLayerStateMask(const OdString &sName, LayerStateMask mask)
bool layerStateHasViewportData(const OdString &sName)
OdResult importLayerState(OdStreamBuf *pStreamBuf, OdString &sName)
OdResult removeLayerStateLayers(const OdString &sName, const OdStringArray &layerNames)
OdResult restoreLayerState(const OdString &sName)
OdResult exportLayerState(const OdString &sNameToExport, OdStreamBuf *pStreamBuf)
OdResult saveLayerState(const OdString &sName, LayerStateMask mask, const OdDbObjectId &idVp)
OdResult getLayerStateLayers(OdStringArray &layerArray, const OdString &sName, bool bInvert=false)
OdDbLayerStateManagerImpl * m_pImpl
Definition: DbLayerState.h:306
OdResult addLayerStateLayers(const OdString &sName, const OdDbObjectIdArray &layerIds)
OdResult getLayerStateNames(OdStringArray &lsArray, bool bIncludeHidden=true, bool bIncludeXref=true)
bool isDependentLayerState(const OdString &sName)
bool hasLayerState(const OdString &sName)
OdResult importLayerState(OdStreamBuf *pStreamBuf)
OdResult deleteLayerState(const OdString &sName)
OdDbLayerStateManager(OdDbLayerStateManagerImpl *)
OdDbObjectId layerStatesDictionaryId(bool bCreateIfNotPresent=false)
ODRX_DECLARE_MEMBERS(OdDbLayerStateManager)
bool removeReactor(OdDbLayerStateManagerReactor *pReactor)
virtual void layerStateCompareFailed(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual void abortLayerStateDelete(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual void layerStateDeleted(const OdString &layerStateName)
virtual void layerStateRestored(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual void layerStateToBeRenamed(const OdString &oldLayerStateName, const OdString &newLayerStateName)
virtual void layerStateToBeRestored(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual void layerStateRenamed(const OdString &oldLayerStateName, const OdString &newLayerStateName)
virtual void layerStateToBeDeleted(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual void abortLayerStateRename(const OdString &oldLayerStateName, const OdString &newLayerStateName)
virtual void abortLayerStateRestore(const OdString &layerStateName, const OdDbObjectId &layerStateId)
ODRX_DECLARE_MEMBERS(OdDbLayerStateManagerReactor)
virtual void layerStateCreated(const OdString &layerStateName, const OdDbObjectId &layerStateId)
virtual bool load()=0
virtual OdDbObjectId getLineType(const OdString &layerName) const =0
virtual OdResult setOn(const OdString &layerName, const bool &bOn)=0
virtual OdResult setNewVPFreeze(const OdString &layerName, const bool &bNewVPFreeze)=0
virtual OdResult setFreeze(const OdString &layerName, const bool &bFreeze, OdDbObjectId id=NULL)=0
virtual OdResult setLineColor(const OdString &layerName, const OdCmColor &color)=0
virtual bool isNewVPFreeze(const OdString &layerName) const =0
virtual OdCmTransparency getTransparency(const OdString &layerName) const =0
virtual OdString getActiveLayer() const =0
virtual bool isLocked(const OdString &layerName) const =0
virtual OdResult setLineWeight(const OdString &layerName, const OdDb::LineWeight &lweight)=0
virtual bool isFreezed(const OdString &layerName, OdDbObjectId id=NULL) const =0
virtual OdResult setLineType(const OdString &layerName, const OdDbObjectId &ltype)=0
virtual OdResult setPlotStyle(const OdString &layerName, const OdString &plotStyle)=0
virtual OdString getPlotStyle(const OdString &layerName) const =0
virtual OdResult setLocked(const OdString &layerName, const bool &bLock)=0
virtual bool isPlotable(const OdString &layerName) const =0
virtual ~OdDbLayerStateProperties()
Definition: DbLayerState.h:320
virtual OdResult setPlotable(const OdString &layerName, const bool &bPlot)=0
virtual OdString getLayerStateName() const =0
virtual OdDb::LineWeight getLineWeight(const OdString &layerName) const =0
virtual OdResult setTransparency(const OdString &layerName, const OdCmTransparency &transparency)=0
virtual OdDbDatabase * database() const =0
virtual bool save()=0
virtual OdResult setActiveLayer(const OdString &layerStateName)=0
virtual bool isOn(const OdString &layerName) const =0
virtual OdCmColor getLineColor(const OdString &layerName) const =0
OdDbLegacyLayerStateImporter(OdDbDatabasePtr pDb)
Definition: DbLayerState.h:418
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:110
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
LineWeight
Definition: OdaDefs.h:386