当前位置: 首页>>代码示例>>C++>>正文


C++ GetFieldHandlePtr类代码示例

本文整理汇总了C++中GetFieldHandlePtr的典型用法代码示例。如果您正苦于以下问题:C++ GetFieldHandlePtr类的具体用法?C++ GetFieldHandlePtr怎么用?C++ GetFieldHandlePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GetFieldHandlePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getEditingFC

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);
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGBoolFieldEditor.cpp

示例2: undo

void SetFieldValueCommand::undo(void)
{
    Inherited::undo();

    //reset the value
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);
    if(TheFieldHandle->getCardinality() == FieldType::SingleField)
    {
        if(TheFieldHandle->isPointerField())
        {
            FieldContainer* FC = FieldContainerFactory::the()->getContainer(boost::lexical_cast<UInt32>(_PrevValue));
            dynamic_cast<EditSFieldHandle<FieldContainerPtrSFieldBase>*>(_FC->editField(_FieldId).get())->set(FC);
        }
        else
        {
            _FC->editField(_FieldId)->pushValueFromCString(_PrevValue.c_str());
        }
    }
    else
    {
        if(TheFieldHandle->isPointerField())
        {
            FieldContainer* FC = FieldContainerFactory::the()->getContainer(boost::lexical_cast<UInt32>(_PrevValue));
            dynamic_cast<EditMFieldHandle<FieldContainerPtrMFieldBase>*>(_FC->editField(_FieldId).get())->replace(_Index, FC);
        }
        else
        {
            _FC->editField(_FieldId)->pushIndexedValueFromCString(_PrevValue.c_str(), _Index);
        }
    }
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:31,代码来源:OSGSetFieldValueCommand.cpp

示例3: cancelEditing

/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/
bool FieldEditorComponent::attachField(FieldContainer* fc, UInt32 fieldId, UInt32 index)
{
    //Cancel current editing
    cancelEditing();

    //Check that this is a valid FieldContainer
    if(fc == NULL)
    {
        SWARNING << "Cannot attach to a Null FieldContainer." << std::endl;
        return false;
    }

    //Check that this is a valid FieldId
    const FieldDescriptionBase* Desc(fc->getFieldDescription(fieldId));
    if(Desc == NULL)
    {
        SWARNING << "Cannot attach to field with id " << fieldId
                 << ", on a FieldContainer with type " << fc->getType().getCName()
                 << " because that is an invalid field id." << std::endl;
        return false;
    }
    //Check that this is a type to edit for this editor
    if(!isTypeEditable(Desc->getFieldType().getContentType()))
    {
        SWARNING << " Cannot attach to field " << Desc->getCName() 
                 << ", with content type " << Desc->getFieldType().getContentType().getCName()
                 << " because that content type is not supported by this editor type." << std::endl;
        return false;
    }

    //Check that this is a valid index
    GetFieldHandlePtr TheFieldHandle = fc->getField(fieldId);
    if(!TheFieldHandle.get())
    {
        SWARNING << "Cannot attach to field " << Desc->getCName() 
                 << ", on a FieldContainer with type " << fc->getType().getCName()
                 << " because no GetFieldHandle is defined for that field type." << std::endl;
        return false;
    }

    if(!internalAttachField(fc, fieldId, index))
    {
        return false;
    }

    //Attach to the field
    setEditingFC(fc);
    setEditingFieldId(fieldId);

    //Tell the Editor that the field has changed
    fieldChanged(fc, Desc->getFieldMask());

    //Attach to the Changed function callback for the container
    attachFieldCallback();

    return true;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:60,代码来源:OSGFieldEditorComponent.cpp

示例4: getCommandDescription

std::string InsertFieldElementCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description + "Insert " + _Value + " to " + TheFieldHandle->getDescription()->getName() + " at index " + boost::lexical_cast<std::string>(_Index);
	
	return Description;
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGInsertFieldElementCommand.cpp

示例5: getCommandDescription

std::string SetFieldValueCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description + "Set " + TheFieldHandle->getDescription()->getName() + " to " + _Value;
	
	return Description;
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGSetFieldValueCommand.cpp

示例6: isSignificant

bool SetFieldValueCommand::isSignificant(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);
    if(TheFieldHandle->isPointerField())
    {
        return _PrevPtrValue != _PtrValue;
    }
    else
    {
        return _Value.compare(_PrevValue) != 0;
    }
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:12,代码来源:OSGSetFieldValueCommand.cpp

示例7: getCommandDescription

std::string SwapFieldElementCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description 
                + "Move " + TheFieldHandle->getDescription()->getName()
                + " index " + boost::lexical_cast<std::string>(_FromIndex) 
                + " to index " + boost::lexical_cast<std::string>(_ToIndex);
	
	return Description;
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:13,代码来源:OSGSwapFieldElementCommand.cpp

示例8: FCInfoHelper

void OSGWriter::visitContainer(FieldContainer * const pFC)
{

    if(pFC == NULL)
    {
        return;
    }

    typedef std::pair<FCInfoHelperMap::iterator, bool> MapInsertInfo;

          std::string         containerName;
//    const FieldContainerType &fcType    = pFC->getType();
          UInt32              numFields = pFC->getNumFields();
          MapInsertInfo       insertInfo;

    insertInfo = _visitedFCMap.insert(std::make_pair(pFC, FCInfoHelper()));

    if(insertInfo.second == true)
    {
        //the FC was NOT visited before
        for(UInt32 field = 1; field <= numFields; field++)
        {
            GetFieldHandlePtr fHandle = pFC->getField(field);

            if(fHandle == NULL || (fHandle != NULL && fHandle->isInternal()))
            {
                continue;
            }

            visitField(fHandle);
        }
    }
    else
    {
        //the FC was in the map => FC is shared

        FCInfoHelperMap::iterator iter = _visitedFCMap.find(pFC);

        if(iter == _visitedFCMap.end())
        {
            SWARNING << "OSGWriter::visitContainer(): FieldContainer * "
                     << "not found in map" << std::endl;
            return;
        }
        if(iter->second.hasName == false)
        {
            iter->second.setName(pFC);
            iter->second.hasName = true;
        }
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:51,代码来源:OSGOSGWriter.cpp

示例9: deepClone

FieldContainerTransitPtr deepClone(
          OSG::FieldContainer const                        *src,
    const std::vector<const OSG::ReflexiveContainerType *> &shareTypes,
    const std::vector<const OSG::ReflexiveContainerType *> &ignoreTypes,
    const std::vector<OSG::UInt16>                         &shareGroupIds,
    const std::vector<OSG::UInt16>                         &ignoreGroupIds)
{
    if(src == NULL)
        return FieldContainerTransitPtr(NULL);

    const FieldContainerType &fcType  = src->getType();
    FieldContainerTransitPtr  fcClone = fcType.createContainer();

    UInt32 fCount = osgMin(fcType            .getNumFieldDescs(),
                           fcClone->getType().getNumFieldDescs() );

    for(UInt32 i = 1; i <= fCount; ++i)
    {
        const FieldDescriptionBase *fDesc = fcType.getFieldDesc(i);

        if(fDesc->isInternal())
            continue;

        GetFieldHandlePtr  srcField = src    ->getField (i);
        EditFieldHandlePtr dstField = fcClone->editField(i);

        if(dstField == NULL || dstField->isValid() == false || 
           srcField == NULL || srcField->isValid() == false)
        {
            continue;
        }

        if(srcField->isPointerField() == false)
        {
            dstField->copyValues(srcField);
        }
        else
        {
            dstField->cloneValues(srcField, 
                                  shareTypes,    
                                  ignoreTypes,
                                  shareGroupIds, 
                                  ignoreGroupIds);
        }
    }

    return fcClone;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:48,代码来源:OSGFieldContainer.cpp

示例10: getEditingFC

void FCPtrFieldEditor::internalFieldChanged (void)
{
    GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());

    assert(TheFieldHandle->getType().getClass() == FieldType::PtrField ||
           TheFieldHandle->getType().getClass() == FieldType::ChildPtrField);

    //Get the Editing FCPtr
    FieldContainer* EditingFC(NULL);
    if(TheFieldHandle->getCardinality() == FieldType::SingleField)
    {
        GetSFieldHandle<FieldContainerPtrSFieldBase>* ThePtrFieldHandle(dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get()));
        EditingFC = ThePtrFieldHandle->get();
    }
    else
    {
        GetMFieldHandle<FieldContainerPtrMFieldBase>* ThePtrFieldHandle(dynamic_cast<GetMFieldHandle<FieldContainerPtrMFieldBase>*>(TheFieldHandle.get()));
        EditingFC = ThePtrFieldHandle->get(getEditingFieldIndex());
    }

    //Update the Editing Text
    std::string EditingText("NULL");
    std::string Name("");
    std::string TypeName("");

    if(EditingFC != NULL)
    {
        //Get the Id of the FieldContainer
        EditingText = boost::lexical_cast<std::string>(EditingFC->getId());

        //If the FieldContainer has a name attachment then get the name
        if(EditingFC->getType().isDerivedFrom(AttachmentContainer::getClassType()) && 
           getName(dynamic_cast<AttachmentContainer*>(EditingFC)))
        {
            Name = getName(dynamic_cast<AttachmentContainer*>(EditingFC));
        }

        //Get the name of the type of the FieldContainer
        TypeName = EditingFC->getType().getName();
    }


    //Update the Labels and TextFields
    _EditingTextField->setText(EditingText);
    _NameTypeLabel->setText(Name + " [" + TypeName + "]");
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:46,代码来源:OSGFCPtrFieldEditor.cpp

示例11: getEditingFC

void TextFieldEditor::internalFieldChanged (void)
{
    GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());

    std::ostringstream StrStream;
    OutStream TheOutStream(StrStream);
    if(TheFieldHandle->getCardinality() == FieldType::SingleField)
    {
        TheFieldHandle->pushValueToStream(TheOutStream);
    }
    else
    {
        TheFieldHandle->pushIndexedValueToStream(TheOutStream, getEditingFieldIndex());
    }
        
    _EditingTextArea->setText(StrStream.str());

}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:18,代码来源:OSGTextFieldEditor.cpp

示例12: getEditingFC

/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/
void GenericFieldEditor::internalFieldChanged (void)
{
    GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());

    if(TheFieldHandle->isPointerField())
    {
        if(TheFieldHandle->getCardinality() == FieldType::SingleField)
        {
            GetSFieldHandle<FieldContainerPtrSFieldBase>* ThePtrFieldHandle(dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get()));
            if(ThePtrFieldHandle->get() != NULL)
            {
                _EditingTextField->setText(boost::lexical_cast<std::string>(ThePtrFieldHandle->get()->getId()));
            }
            else
            {
                _EditingTextField->setText("0");
            }
        }
        else
        {
            GetMFieldHandle<FieldContainerPtrMFieldBase>* ThePtrFieldHandle(dynamic_cast<GetMFieldHandle<FieldContainerPtrMFieldBase>*>(TheFieldHandle.get()));
            if(ThePtrFieldHandle->size() > getEditingFieldIndex() &&
               ThePtrFieldHandle->get(getEditingFieldIndex()) != NULL)
            {
                _EditingTextField->setText(boost::lexical_cast<std::string>(ThePtrFieldHandle->get(getEditingFieldIndex())->getId()));
            }
            else
            {
                _EditingTextField->setText("0");
            }
        }
    }
    else
    {
        std::ostringstream StrStream;
        OutStream TheOutStream(StrStream);
        if(TheFieldHandle->getCardinality() == FieldType::SingleField)
        {
            TheFieldHandle->pushValueToStream(TheOutStream);
        }
        else
        {
            TheFieldHandle->pushIndexedValueToStream(TheOutStream, getEditingFieldIndex());
        }

        //Remove quotes from strings
        if(TheFieldHandle->getType().getContentType() == FieldTraits<std::string>::getType())
        {
            _EditingTextField->setText(StrStream.str().substr(1,StrStream.str().size()-2));
        }
        else
        {
            _EditingTextField->setText(StrStream.str());
        }
    }

}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:60,代码来源:OSGGenericFieldEditor.cpp

示例13: doLog

void CSMLogger::doLog(FieldContainer *pContainer, 
                      BitVector       bvFlags   ,
                      UInt32          origin    ,
                      UInt32          uiRefFieldId,
                      BitVector       uiRefFieldMask)
{
    if(0x0000 != (bvFlags & uiRefFieldMask) && _sfEnabled.getValue() == true)
    {
        GetFieldHandlePtr pFH = pContainer->getField(uiRefFieldId);

        if(pFH && pFH->isValid() == true)
        {
            static CErrOutStream cerrStream;

            const FieldDescriptionBase *pDesc = 
                pContainer->getFieldDescription(uiRefFieldId);

            AttachmentContainer *pAtt = 
                dynamic_cast<AttachmentContainer *>(pContainer);

            if(pAtt != NULL)
            {
                const Char8 *szName = getName(pAtt);

                if(szName != NULL)
                {
                    cerrStream << "[" << szName << "]:";
                }
            }

            cerrStream << pContainer->getType().getName() 
                       << "."
                       << pDesc->getName()
                       << " : ";
            
            pFH->pushValueToStream(cerrStream);

            cerrStream << std::endl;
        }
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:41,代码来源:OSGCSMLogger.cpp

示例14: visitField

void OSGWriter::visitField(GetFieldHandlePtr hF)
{
    if(hF->isValid() == false)
    {
        return;
    }

//    const FieldType &fType       = hF->getType();

    GetMapFieldHandlePtr sfMap = 
        boost::dynamic_pointer_cast<
            GetMapFieldHandle>(hF);

    if(sfMap != NULL && sfMap->isValid() == true)
    {
        sfMap->traverse(boost::bind(&OSGWriter::visitContainer, this, _1));
    }
    else
    {
        FieldContainerPtrSFieldBase::GetHandlePtr sfFCPtr = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrSFieldBase::GetHandle>(hF);

        FieldContainerPtrMFieldBase::GetHandlePtr mfFCPtr = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrMFieldBase::GetHandle>(hF);

        if(sfFCPtr != NULL && sfFCPtr->isValid() == true)
        {
            visitContainer((*sfFCPtr)->getValue());
        }
        else if(mfFCPtr != NULL && mfFCPtr->isValid() == true)
        {
            SizeT mfSize = (*mfFCPtr)->size();

            for(SizeT i = 0; i < mfSize; i++)
            {
                visitContainer((**mfFCPtr)[i]);
            }
        }
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:42,代码来源:OSGOSGWriter.cpp

示例15: 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)));

//.........这里部分代码省略.........
开发者ID:vossg,项目名称:OpenSGDevMaster,代码行数:101,代码来源:OSGFieldConnector.cpp


注:本文中的GetFieldHandlePtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。