The OdBmDBView class provides a number of methods to get parameters of a DBView.
In the next examples, pDBView stores a pointer to an object of the OdBmDBView class.
To get the name of the view, use the getViewName() method, which returns the view name as an OdString value. To check whether or not the view has a name, use the getNamed() method, which returns 'true' if the view has a name. For example:
OdBmDBViewPtr pDBView = OdBmDBView::createObject();
// Get the view name
if (pDBView->getNamed())
{
message.format(L"View name: %s", pDBView->getViewName().c_str());
pIO->putString(message);
}
else
{
message.format(L"View is unnamed");
pIO->putString(message);
}
To get the type of the view, use the getViewType() method, which returns the view type as one value from OdBm::ViewType::Enum. For example:
if (pDBView->getViewType() == OdBm::ViewType::Plan)
{
message.format(L"\nView is the Plan view");
pIO->putString(message);
}
The OdBmDBView class has several methods to get the view directions.
To get the view direction towards the top of the screen, use the getUpDirection() method, which returns the direction as an object of the OdGeVector3d class. For example:
OdGeVector3d vect = pDBView->getUpDirection();
message.format(L"Up direction vector is (%f %f %f)", vect.x, vect.y, vect.z);
pIO->putString(message);
To get the view direction towards the right side of the screen, use the getRightDirection() method, which returns the direction as an object of the OdGeVector3d class. For example:
vect = pDBView->getRightDirection();
message.format(L"Right direction vector is (%f %f %f)", vect.x, vect.y, vect.z);
pIO->putString(message);
To get the direction towards the OdBmViewer, use the getViewDirection() method, which returns the direction as an object of the OdGeVector3d class. For example:
vect = pDBView->getViewDirection();
message.format(L"Direction towards the OdBmViewer is (%f %f %f)", vect.x, vect.y, vect.z);
pIO->putString(message);
A view can be dependent on another view. A dependent view is synchronized with the primary view and all other dependent views. This means that when view-specific changes are made in one of those views, they are repeated in all other views.
To get the primary view, use the getPrimaryViewId() method, which returns the primary view ID as an object of the OdBmObjectId class. For example:
OdBmObjectId primaryId = pDBView->getPrimaryViewId();
To get all dependent views of the current view, use the getDependentViewIds() method, which returns the dependent views as an array of OdBmObjectId objects. For example:
OdBmObjectIdArray dependentIds;
pDBView->getDependentViewIds(dependentIds);
A view can be a template view, which means that it holds template values for the view parameters.
To check whether the view is a template view, use the getIsTemplate() method, which returns 'true' if this view is a template view. For example:
// Get the isTemplate flag
bool bTempl;
bTempl = pDBView->getIsTemplate();
message.format(L"View %s template view", ((bTempl) ? L"is a" : L"is not a"));
pIO->putString(message);
To get the template view of the current view that contains the current view's parameters, use the getViewTemplateId() method, which returns the ID of the template view as an object of the OdBmObjectId class. For example:
OdBmObjectId templView = pDBView->getViewTemplateId();
Each view has a default template view. To get it, use the getDefaultTemplateId() method, which returns the ID of the default template view as an object of the OdBmObjectId class. For example:
OdBmObjectId defTemplView = pDBView->getDefaultTemplateId();
A view can have a description.
To get the description of a view, use the getViewDescription() method, which returns the view description as an OdString value. For example:
// Get the View description
OdString sDescr;
sDescr = pDBView->getViewDescription();
message.format(L"View description is %s", sDescr.c_str());
pIO->putString(message);
To get the scale of a view, use the getScale() method, which returns the scale as a double value. For example:
// Get the View scale
double dScale = pDBView->getScale();
message.format(L"View scale is %f", dScale);
pIO->putString(message);
To get the DBDrawing associated with a view, use the getDbDrawingId() method, which returns the ID of the DBDrawing as an object of the OdBmObjectId class. For example:
OdBmObjectId dbDrawing = pDBView->getDbDrawingId();
To get the ID of the view type, use the getDBViewTypeId() method, which returns the ID of the view type as an object of the OdBmObjectId class. For example:
OdBmObjectId viewType = pDBView->getDBViewTypeId();
To get the ID of the viewer, use the getViewerId() method, which returns the ID of the viewer as an object of the OdBmObjectId class. For example:
if (pDBView->getViewerId())
OdBmViewerPtr pViewer = pDBView->getViewerId().safeOpenObject();
To get the set of draw filters, use the getDrawFilters() method, which returns the filters as an array of pointers of OdBmDrawFilter objects. For example:
OdArray < OdBmDrawFilterPtr > arrFilter;
pDBView->getDrawFilters(arrFilter);
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|