Drawings SDK allows a host application to provide an implementation for certain services, including status notification (for file loading, saving, etc.), font file locating, etc. These services are defined by the OdDbHostAppServices class, and a default implementation of OdDbHostAppServices is provided in the ExHostAppServices class.
A Database object is represented by the OdDbDatabase class and can be created by an OdDbHostAppServices object which provides two options to create a Database instance:
Some of the symbol tables of the initial database already contain one or more records. The layer table contains one record, layer 0. The block table initially contains three records: *MODEL_SPACE, *PAPER_SPACE, and *PAPER_SPACE0. The linetype table always has CONTINUOUS, BY_LAYER, and BY_BLOCK linetype table records. If the false value is passed, an empty database will be created, and it can be populated by the OdDbDatabase::readFile() method:
void OdDbDatabase::readFile(OdStreamBuf* pStreamBuf, bool partialLoad = false, OdDbAuditInfo *pAuditInfo = 0, const OdPassword& password = OdPassword(), bool allowCPConversion = false);
void OdDbDatabase::readFile(const OdString& filename, bool partialLoad = false, Oda::FileShareMode shareMode = Oda::kShareDenyWrite, const OdPassword& password = OdPassword(), bool allowCPConversion = false);
For example, to create a default database (where svsc is an instance of OdDbHostAppServices):
OdDbDatabasePtr pDb = svcs.createDatabase(true);
To create an empty database and then populate it by reading an input file:
OdDbDatabasePtr pDb = svcs.createDatabase(false);
pDb->readFile("drawing1.dwg");
To create a database by reading an input file:
OdDbDatabasePtr pDb = svcs.readFile("drawing1.dwg");
For more details, see Creating Host Applications.
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|