An application developed with the Drawings SDK can unite multiple databases into a single database or insert one database into another
database. When this occurs, the resulting database must combine the dictionaries of the different databases.
However, databases can contain the same dictionaries and the same objects within those dictionaries, which can
have an unclear outcome. The dictionaries can be cloned, with each object of the dictionary also being cloned,
creating duplicates of some objects, or without copying identical objects in the dictionaries. The dictionary
object has properties that define its behavior during cloning.
In the following examples, the pDict variable stores a pointer to the dictionary object.
Owner Status
The owner status determines whether the dictionary is cloned with its contents or without (entirely or empty).
The dictionary defines the owner status as a Boolean value which is True if the dictionary is cloned together with
its own content, that is, with the objects contained in the dictionary (Hard Owner) or False if the dictionary is
cloned without the content, that is, empty (Soft Owner). The owner status is True by default.
To get the owner status, use the isTreatElementsAsHard() method of the dictionary object; it does not have arguments
and returns True when the status is set to "hard owner" or False when the status is set to "soft owner". For example:
odPrintConsoleString(L"\nOwner status is %s\n", ((pDict->isTreatElementsAsHard()) ? L"Hard" : L"Soft"));
To set the owner status, use the setTreatElementsAsHard() method of the dictionary object; it requires one argument
— the owner status as a Boolean value — and does not return a value. For example:
// Set Hard Owner
pDict->setTreatElementsAsHard(true);
// Set Soft Owner
pDict->setTreatElementsAsHard(false);
Merge Style
The merge style defines how to combine objects of dictionaries. The OdDb::DuplicateRecordCloning enumerator defines
the available values of the merge style. The merge style is set to kDrcIgnore value (=1) by default.
To get the merge style, use the mergeStyle() method of the dictionary object; it does not have arguments
and returns the value of the OdDb::DuplicateRecordCloning enumerator. For example:
odPrintConsoleString(L"\nMerge Style is %s", AboutMergeStyle(pDict->mergeStyle()));
The AboutMergeStyle() function has the following implementation:
OdString AboutMergeStyle(const OdDb::DuplicateRecordCloning msValue)
{
OdString sAbout;
switch(msValue)
{
case OdDb::kDrcIgnore: sAbout = L"Ignore"; break;
case OdDb::kDrcReplace: sAbout = L"Replace"; break;
case OdDb::kDrcXrefMangleName: sAbout = L"XrefMangle"; break;
case OdDb::kDrcMangleName: sAbout = L"Mangle"; break;
case OdDb::kDrcUnmangleName: sAbout = L"Unmangle"; break;
default: sAbout = L"???";
}
return sAbout;
}
To set the merge style, use the setMergeStyle() method of the dictionary object; it requires one argument —
the value of the OdDb::DuplicateRecordCloning enumerator — and does not return a value. For example: