CFx SDK Documentation  2020SP3
GfxSrvOps.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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 GFXSRV_OPS_H
25 #define GFXSRV_OPS_H
26 
27 
28 #include "OdaCommon.h"
29 #include "Ed/EdCommandStack.h"
30 #include "Ed/EdCommandContext.h"
31 #include "Ed/EdUserIO.h"
32 #include "DynamicLinker.h"
33 #include "DbBaseDatabase.h"
34 #include "TxDefs.h"
35 #include "DbGsManager.h"
36 #include "Gs/GsModel.h"
37 #include "DbLayout.h"
38 #include "DbBlockTableRecord.h"
39 #include "RxObjectImpl.h"
40 #include "Tf/TFSQL.h"
41 #include "MemoryStream.h"
42 
44 
45 using namespace Oda;
46 using namespace OdEd;
47 
49  return !ctx->arbitraryData("AutoUpdateReactor").isNull();
50 }
51 
52 inline void UpdateGs(OdEdCommandContext* ctx) {
54  gsDev->update();
55 }
56 
57 inline OdGsDevicePtr setupDevice(OdRxObject* rxDb, OdGsDevice* gsDev, bool bEnableGsModel, ODCOLORREF palBg, OdGiDefaultContextPtr giCtx) {
58  OdDbBaseDatabasePEPtr dbPx = rxDb;
59  if (giCtx.isNull()) {
60  giCtx = dbPx->createGiContext(rxDb);
61  giCtx->enableGsModel(bEnableGsModel);
62  }
63 
64  OdGsDevicePtr gsHelper = dbPx->setupActiveLayoutViews(gsDev, giCtx);
65  dbPx->setupPalette(gsDev, giCtx, 0, palBg);
66 
67  return gsHelper;
68 }
69 
73  OdRxObjectPtr db = ctx->baseDatabase();
74  BaseDbPxPtr dbpx = BaseDbPxPtr(db);
75  OdRxObjectPtr curLayout = dbpx->currentLayout(db);
76  if (curLayout)
77  return BaseLytPxPtr(curLayout)->name(curLayout);
78  return OdString(L"Model");
79 }
80 
82 public:
84  sewtol = simpltol = 0.0;
85  sortByWeight = false;
86  dataLimit = 0xFFFFFFFF;
87  chunkSz = 0xFFFFFFFF;
88  }
89 
90  const OdString& outFileName() const { return outFName; }
91  void setOutFileName(const OdString& val) { outFName = val; }
92  OdUInt32 chunkSize() const { return chunkSz; }
93  void setChunkSize(OdUInt32 val) { chunkSz = val; }
94  OdUInt32 outputDataLimit() const { return dataLimit; }
96  dataLimit = val;
97  if(val<0xFFFFFFFF)
98  enableSorting(true);
99  }
100 
101  double simplTol() const { return simpltol; }
102  double sewTol() const { return sewtol; }
103  void setSimplificationTolerances(double sewTol, double simplTol) {
104  simpltol = simplTol; sewtol = sewTol;
105  }
106 
107  OdString layoutName() const { return layout; }
108  void setLayoutName(const OdString& name) { layout = name; }
109 
110  bool isSortingEnabled() const { return sortByWeight; }
111  void enableSorting(bool val) { sortByWeight = val; }
112  OdString cachePath() const { return pathToCache; }
113  void setCachePath(const OdString& val) { pathToCache = val; }
114 private:
115  OdString outFName;
116  OdString pathToCache;
117  OdUInt32 chunkSz;
118  OdUInt32 dataLimit;
119  double sewtol;
120  double simpltol;
121  OdString layout;
122  bool sortByWeight;
123 };
124 
125 OdGsDevicePtr newGfxSrv(const OdString& fmtCtx, OdEdCommandContext* ctx, OdGsDCRect& rect, bool autoupdate, GfxSrvcParams& params);
126 
127 
128 
129 using namespace Oda;
132 
133 
135  return strg->prepare(
136  "SELECT layouts.rowid,settings.var,settings.val"
137  " FROM layouts,settings WHERE settings.var='layout' AND layouts.name=settings.val")
138  ->exe()->row().int32(0);
139 }
140 inline void cacheDeviceState(CMDCTX* ctx) {
142  OD::TFSQLP strg = OD::TFSQL::cast(ctx->arbitraryData("stateStorage"));
143  if (helper.get() && strg.get()) {
144  OdUInt32 layoutRow = layoutCacheRowId(strg);
145  OD::TFSQL::BlobP buf = strg->openR("layouts", "state", layoutRow);
146  helper->storeLayoutGsState(buf);
147  }
148 }
149 #endif //GFXSRV_OPS_H
OdString
Definition: OdString.h:95
BaseDbPxPtr
OdDbBaseDatabasePEPtr BaseDbPxPtr
Definition: GfxSrvOps.h:130
OdRxObjectPtr
Definition: RxObject.h:345
EdCommandStack.h
GfxSrvcParams::cachePath
OdString cachePath() const
Definition: GfxSrvOps.h:112
cacheDeviceState
void cacheDeviceState(CMDCTX *ctx)
Definition: GfxSrvOps.h:140
name
GLuint const GLchar * name
Definition: gles2_ext.h:265
OdEdCommandContext::baseDatabase
virtual OdRxObject * baseDatabase()=0
UpdateGs
void UpdateGs(OdEdCommandContext *ctx)
Definition: GfxSrvOps.h:52
newGfxSrv
OdGsDevicePtr newGfxSrv(const OdString &fmtCtx, OdEdCommandContext *ctx, OdGsDCRect &rect, bool autoupdate, GfxSrvcParams &params)
OdRxObject
Definition: RxObject.h:564
GfxSrvcParams::sewTol
double sewTol() const
Definition: GfxSrvOps.h:102
OdGsDCRect
Definition: GsDefs.h:111
Oda
Definition: TxDefs.h:48
OD::TFSQL::prepare
virtual Statement::ParamsP prepare(const char *sql, int at=-1, StatementP *stmt=0)=0
OdGsDevice
Definition: Gs.h:1061
GsModel.h
Oda::arbVarSafe
RXPTR arbVarSafe(OdEdCommandContext *ctx, const WSTR &varName)
Definition: TxDefs.h:165
GfxSrvcParams::setChunkSize
void setChunkSize(OdUInt32 val)
Definition: GfxSrvOps.h:93
GfxSrvcParams::setCachePath
void setCachePath(const OdString &val)
Definition: GfxSrvOps.h:113
GfxSrvcParams::GfxSrvcParams
GfxSrvcParams()
Definition: GfxSrvOps.h:83
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
MemoryStream.h
GfxSrvcParams::setOutputDataLimit
void setOutputDataLimit(OdUInt32 val)
Definition: GfxSrvOps.h:95
DbLayout.h
GfxSrvcParams::setLayoutName
void setLayoutName(const OdString &name)
Definition: GfxSrvOps.h:108
OdEd
Definition: EdUserIO.h:44
sInitializedGs
OdString sInitializedGs
GfxSrvcParams::chunkSize
OdUInt32 chunkSize() const
Definition: GfxSrvOps.h:92
OdBaseObjectPtr::isNull
bool isNull() const
Definition: BaseObjectPtr.h:70
OdString
OdString OdString
Definition: OdString.h:1224
EdUserIO.h
OdSmartPtr
Definition: SmartPtr.h:58
OD::TFSQL
Definition: TFSQL.h:23
GfxSrvcParams::outFileName
const OdString & outFileName() const
Definition: GfxSrvOps.h:90
OdEdCommandContext
Definition: EdCommandContext.h:42
GfxSrvcParams::enableSorting
void enableSorting(bool val)
Definition: GfxSrvOps.h:111
OdSmartPtr::get
const T * get() const
Definition: SmartPtr.h:326
GfxSrvcParams::setOutFileName
void setOutFileName(const OdString &val)
Definition: GfxSrvOps.h:91
DbBaseDatabase.h
setupDevice
OdGsDevicePtr setupDevice(OdRxObject *rxDb, OdGsDevice *gsDev, bool bEnableGsModel, ODCOLORREF palBg, OdGiDefaultContextPtr giCtx)
Definition: GfxSrvOps.h:57
DynamicLinker.h
TxDefs.h
OdaCommon.h
DbBlockTableRecord.h
OdEdCommandContext::arbitraryData
virtual OdRxObjectPtr arbitraryData(const OdString &szPathName) const =0
GfxSrvcParams::layoutName
OdString layoutName() const
Definition: GfxSrvOps.h:107
GfxSrvcParams::simplTol
double simplTol() const
Definition: GfxSrvOps.h:101
GfxSrvcParams::isSortingEnabled
bool isSortingEnabled() const
Definition: GfxSrvOps.h:110
params
GLenum GLint * params
Definition: gles2_ext.h:184
isAutoUpdateReactorAttached
bool isAutoUpdateReactorAttached(OdEdCommandContext *ctx)
Definition: GfxSrvOps.h:48
layoutCacheRowId
OdUInt32 layoutCacheRowId(OD::TFSQL *strg)
Definition: GfxSrvOps.h:134
DbGsManager.h
GfxSrvcParams::outputDataLimit
OdUInt32 outputDataLimit() const
Definition: GfxSrvOps.h:94
OdRxObject::cast
static OdRxObjectPtr cast(const OdRxObject *pointer)
Definition: RxObject.h:640
getCurrentLayoutName
OdString getCurrentLayoutName(OdEdCommandContext *ctx)
Definition: GfxSrvOps.h:70
ODCOLORREF
#define ODCOLORREF
Definition: OdPlatform.h:883
GfxSrvcParams::setSimplificationTolerances
void setSimplificationTolerances(double sewTol, double simplTol)
Definition: GfxSrvOps.h:103
BaseLytPxPtr
OdDbBaseLayoutPEPtr BaseLytPxPtr
Definition: GfxSrvOps.h:131
TFSQL.h
RxObjectImpl.h
EdCommandContext.h
GfxSrvcParams
Definition: GfxSrvOps.h:81