A view template is an ordinary view, which is marked to be a template for other views associated with it. A view template can store and handle many standard settings of associated views:
When a view is associated with a view template, the view template settings override the settings of the view itself.
BimRv SDK implements view handling functionality within the OdBmDBView
class.
The interface of the OdBmDBView
class allow either to determine whether a view is a template one
or get the view's template identifier:
getIsTemplate()
method checks if the view is a template.
getViewTemplateId()
method returns an identifier of the view template for the view object.
Once a view template is changed, all associated views apply all the template changes. Since BimRv SDK version 20.12, it happens automatically.
You can specify parameters, which are not applied for a view from its view template:
add the parameter's identifier to the template’s nonPropagatedTemplateParamIds
array.
For example, if template’s nonPropagatedTemplateParamIds
array contains
the OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_MODEL
parameter,
then all related views use their own display style.
The code fragment below illustrates how to determine whether specified settings from a view template can be applied to a view:
bool OdaBimExViewer::canActiveViewUpdateParam(const OdBm::BuiltInParameter::Enum& param) const
{
bool bCanUpdateParam = true;
OdBmViewPtr pView = getActiveView();
OdBmViewPtr pViewTemplate = pView->getViewTemplateId().openObject();
if (pViewTemplate.get())
{
OdBmObjectIdArray nonPropagatedTemplateParamIds;
pViewTemplate->getNonPropagatedTemplateParamIds(nonPropagatedTemplateParamIds);
bCanUpdateParam = nonPropagatedTemplateParamIds.contains(
pViewTemplate->database()->getObjectId(param));
}
return bCanUpdateParam;
}
The canActiveViewUpdateParam()
method can be used like in the following example:
//Switch view visual Style on toolBar
void OdaBimExViewer::OnSelectWireframe(CCmdUI* pCmdUI)
{
pCmdUI->Enable(canActiveViewUpdateParam(
OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_MODEL));
pCmdUI->SetCheck(getActiveView()->getDisplayStyle() == OdBm::ViewDisplayStyle::Wireframe);
}
Next parameters control graphic overrides:
The following table contains the list of parameters, which control graphic overrides.
Parameter | Description |
---|---|
OdBm::BuiltInParameter::VIS_GRAPHICS_MODEL
|
Controls overrides for Model categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_ANNOTATION
|
Controls overrides for Annotation categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_ANALYTICAL_MODEL
|
Controls overrides for Analytical model categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_IMPORT
|
Controls overrides for Imported categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_FILTERS
|
Controls overrides of view filters. |
The following code fragment illustrates graphic overrides management in a view template:
ODBM_TRANSACTION_BEGIN(t, pDb)
t.start();
OdInt32 iHandle = -1;
iHandle = pIO->getInt("Enter handle:", OdEd::kInpDefault, -1);
if (iHandle < 0)
{
pIO->putString(OD_T("Invalid handle"));
return;
}
OdBmDBViewPtr pViewTemplate = pDb->getObjectId(OdDbHandle(iHandle)).safeOpenObject();
iHandle = pIO->getInt("Enter handle for value:", OdEd::kInpDefault, -1);
if (iHandle < 0)
{
pIO->putString(OD_T("Invalid handle for value"));
return;
}
OdResult es = pViewTemplate->setParam(OdBm::BuiltInParameter::VIEW_PHASE_FILTER, pDb->getObjectId(iHandle));
OdBmOverrideGraphicSettingsPtr ogs = pViewTemplate->getCategoryOverrides(OdBm::BuiltInCategory::OST_DuctTerminal);
if (ogs.isNull())
ogs = OdBmOverrideGraphicSettings::createObject();
OdBmGFillColorOverriderPtr pColorOverrider = OdBmGFillColorOverrider::createObject();
OdBmCmColor clr;
clr.setRGB(0, 255, 0);
pColorOverrider->setColor(clr);
ogs->setProjFillColor(pColorOverrider);
pViewTemplate->setCategoryOverrides(OdBm::BuiltInCategory::OST_DuctTerminal, ogs);
t.commit();
ODBM_TRANSACTION_END();
This example code overrides phase filters in a view template, and these overrides affect all associated views unless
the OdBm::BuiltInParameter::VIS_GRAPHICS_FILTERS
parameter is not added in the
template’s nonPropagatedTemplateParamIds
array.
Since the version 20.12 BimRv SDK supports the following view template parameters:
Parameter | Description |
---|---|
OdBm::BuiltInParameter::VIEW_DETAIL_LEVEL
|
Controls overrides for a view detail level |
OdBm::BuiltInParameter::VIEW_SCALE
|
Controls overrides for view scale |
OdBm::BuiltInParameter::VIEW_PARTS_VISIBILITY
|
Controls overrides for the settings of displaying the parts in this view |
OdBm::BuiltInParameter::VIEW_SHOW_HIDDEN_LINES
|
Controls overrides for showing of hidden lines |
OdBm::BuiltInParameter::VIEW_DISCIPLINE
|
Controls overrides for view discipline (Architectural, Structural, Mechanical, etc.) |
OdBm::BuiltInParameter::VIEW_PHASE_FILTER
|
Controls overrides for view phase filter |
OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_MODEL
|
Controls overrides for view display options (view style, show edges, transparency, jitter, etc.) |
OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_SKETCHY_LINES
|
Controls overrides for view display options sketchy lines |
OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_LIGHTING
|
Controls overrides for view lightning |
OdBm::BuiltInParameter::GRAPHIC_DISPLAY_OPTIONS_PHOTO_EXPOSURE
|
Controls overrides for photographic exposure of a 3D view |
OdBm::BuiltInParameter::VIEWER3D_RENDER_SETTINGS
|
Controls overrides for view’s background |
OdBm::BuiltInParameter::VIS_GRAPHICS_MODEL
|
Controls overrides for Model categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_ANNOTATION
|
Controls overrides for Annotation categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_ANALYTICAL_MODEL
|
Controls overrides for Analytical model categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_IMPORT
|
Controls overrides for Imported categories |
OdBm::BuiltInParameter::VIS_GRAPHICS_FILTERS
|
Controls overrides of view filters |
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|