本文整理汇总了C++中GetFieldHandlePtr::getField方法的典型用法代码示例。如果您正苦于以下问题:C++ GetFieldHandlePtr::getField方法的具体用法?C++ GetFieldHandlePtr::getField怎么用?C++ GetFieldHandlePtr::getField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetFieldHandlePtr
的用法示例。
在下文中一共展示了GetFieldHandlePtr::getField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: internalFieldChanged
/***************************************************************************\
* Instance methods *
\***************************************************************************/
void BoolFieldEditor::internalFieldChanged (void)
{
GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());
bool Value;
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
Value = static_cast<const SFBool*>(TheFieldHandle->getField())->getValue();
}
else
{
Value = static_cast<const MFBool*>(TheFieldHandle->getField())->operator[](getEditingFieldIndex());
}
if(_EditingCheckbox->getSelected() != Value)
{
_ButtonSelectedConnection.disconnect();
_ButtonDeselectedConnection.disconnect();
_EditingCheckbox->setSelected(Value);
}
_ButtonSelectedConnection = _EditingCheckbox->connectButtonSelected(boost::bind(&BoolFieldEditor::handleButtonSelected, this, _1));
_ButtonDeselectedConnection = _EditingCheckbox->connectButtonDeselected(boost::bind(&BoolFieldEditor::handleButtonDeselected, this, _1));
}
示例2: runCommand
void BoolFieldEditor::runCommand (bool value)
{
bool fieldValue;
GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
fieldValue = static_cast<const SFBool*>(TheFieldHandle->getField())->getValue();
}
else
{
fieldValue = static_cast<const MFBool*>(TheFieldHandle->getField())->operator[](getEditingFieldIndex());
}
if(value != fieldValue)
{
//Call the command to set the Field
SetFieldValueCommandPtr SetCommand = SetFieldValueCommand::create(getEditingFC(),
getEditingFieldId(),
(value ? "TRUE" : "FALSE"),
getEditingFieldIndex());
getCommandManager()->executeCommand(SetCommand);
}
}
示例3: addConnection
OSG_BEGIN_NAMESPACE
/*---------------------------------------------------------------------*/
/*! \name Connection handling */
/*! \{ */
/*! \ingroup GrpBaseFieldContainerConnector
\relatesalso AttachmentContainer
*/
bool addConnection( OSG::AttachmentContainer *pSrcContainer,
const OSG::Char8 *szSrcName,
OSG::FieldContainer *pDstContainer,
const OSG::Char8 *szDstName )
{
if(pSrcContainer == NULL || szSrcName == NULL ||
pDstContainer == NULL || szDstName == NULL )
{
return false;
}
const FieldDescriptionBase *pSrcDesc = NULL;
const FieldDescriptionBase *pDstDesc = NULL;
GetFieldHandlePtr pSrcHnd = pSrcContainer->getField(szSrcName);
GetFieldHandlePtr pDstHnd = pDstContainer->getField(szDstName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
// check core for node
if(pSrcDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pSrcContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pSrcHnd = pNode->getCore()->getField(szSrcName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
}
}
// same here
if(pDstDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pDstContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pDstHnd = pNode->getCore()->getField(szDstName);
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
}
}
if(pSrcDesc == NULL || pDstDesc == NULL)
{
FWARNING(("addConnection: Failed to obtain field descriptions for "
"source container [%p] field [%s] desc [%p] - "
"destination container [%p] field [%s] desc [%p]\n",
static_cast<void *>(pSrcContainer),
szSrcName,
static_cast<const void *>(pSrcDesc),
static_cast<void *>(pDstContainer),
szDstName,
static_cast<const void *>(pDstDesc) ));
return false;
}
const Field *pSrcField = pSrcHnd->getField();
Field *pDstField = const_cast<Field *>(pDstHnd->getField());
pSrcContainer =
dynamic_cast<AttachmentContainer *>(pSrcHnd->getContainer());
pDstContainer =
dynamic_cast<FieldContainer *>(pDstHnd->getContainer());
if(pSrcContainer == NULL || pDstContainer == NULL)
{
FWARNING(("addConnection: Failed to obtain field handles for "
"source container [%p] - destination container [%p]\n",
static_cast<void *>(pSrcContainer),
static_cast<void *>(pDstContainer)));
//.........这里部分代码省略.........