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


C++ DocumentObject::getNameInDocument方法代码示例

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


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

示例1: apply

bool ExpressionBinding::apply(const std::string & propName)
{
    if (hasExpression()) {
        DocumentObject * docObj = path.getDocumentObject();

        if (!docObj)
            throw Base::Exception("Document object not found.");

        Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').%s.setExpression('%s', u'%s')",
                                docObj->getDocument()->getName(),
                                docObj->getNameInDocument(),
                                path.toEscapedString().c_str(),
                                getEscapedExpressionString().c_str());
        return true;
    }
    else {
        if (isBound()) {
            DocumentObject * docObj = path.getDocumentObject();

            if (!docObj)
                throw Base::Exception("Document object not found.");

            if (lastExpression)
                Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').%s.setExpression('%s', None)",
                                        docObj->getDocument()->getName(),
                                        docObj->getNameInDocument(),
                                        path.toEscapedString().c_str());
        }

        return false;
    }
}
开发者ID:huanyingtianhe,项目名称:FreeCAD,代码行数:32,代码来源:ExpressionBinding.cpp

示例2: slotObjectRenamed

void PropertyExpressionEngine::slotObjectRenamed(const DocumentObject &obj)
{
#ifdef FC_PROPERTYEXPRESSIONENGINE_LOG
    std::clog << "Object " << obj.getOldLabel() << " renamed to " << obj.Label.getValue() << std::endl;
#endif

    DocumentObject * docObj = freecad_dynamic_cast<DocumentObject>(getContainer());

    /* In a document object, and on undo stack? */
    if (!docObj || docObj->getNameInDocument() == 0)
        return;

    RelabelDocumentObjectExpressionVisitor v(boost::bind( &PropertyExpressionEngine::aboutToSetValue, this),
                                             boost::bind( &PropertyExpressionEngine::hasSetValue, this),
                                             obj.getOldLabel(), obj.Label.getStrValue());

    for (ExpressionMap::iterator it = expressions.begin(); it != expressions.end(); ++it) {
        int changed = v.getChanged();

        it->second.expression->visit(v);

        if (changed != v.getChanged())
            expressionChanged(it->first);
    }
}
开发者ID:Jonham,项目名称:FreeCAD,代码行数:25,代码来源:PropertyExpressionEngine.cpp

示例3: getName

Py::String DocumentObjectPy::getName(void) const
{
    DocumentObject* object = this->getDocumentObjectPtr();
    const char* internal = object->getNameInDocument();
    if (!internal) {
        throw Py::RuntimeError(std::string("This object is currently not part of a document"));
    }
    return Py::String(std::string(internal));
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:9,代码来源:DocumentObjectPyImp.cpp

示例4: addObject

DocumentObject* GroupExtension::addObject(const char* sType, const char* pObjectName)
{
    DocumentObject* obj = getExtendedObject()->getDocument()->addObject(sType, pObjectName);
    if(!allowObject(obj)) {
        getExtendedObject()->getDocument()->remObject(obj->getNameInDocument());
        return nullptr;
    }
    if (obj) addObject(obj);
    return obj;
}
开发者ID:wood-galaxy,项目名称:FreeCAD,代码行数:10,代码来源:GroupExtension.cpp

示例5: Save

void PropertyLinkList::Save(Base::Writer &writer) const
{
    writer.Stream() << writer.ind() << "<LinkList count=\"" << getSize() << "\">" << endl;
    writer.incInd();
    for (int i = 0; i<getSize(); i++) {
        DocumentObject* obj = _lValueList[i];
        if (obj)
            writer.Stream() << writer.ind() << "<Link value=\"" << obj->getNameInDocument() << "\"/>" << endl;
        else
            writer.Stream() << writer.ind() << "<Link value=\"\"/>" << endl;
    }

    writer.decInd();
    writer.Stream() << writer.ind() << "</LinkList>" << endl;
}
开发者ID:ulrich1a,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:PropertyLinks.cpp

示例6: slotObjectDeleted

void PropertyExpressionEngine::slotObjectDeleted(const DocumentObject &obj)
{
    DocumentObject * docObj = freecad_dynamic_cast<DocumentObject>(getContainer());

    /* In a document object, and on undo stack? */
    if (!docObj || docObj->getNameInDocument() == 0)
        return;

    ObjectDeletedExpressionVisitor v(&obj);

    for (ExpressionMap::iterator it = expressions.begin(); it != expressions.end(); ++it) {
        it->second.expression->visit(v);

        if (v.isFound()) {
            touch(); // Touch to force recompute; that will trigger a proper error
            return;
        }
    }
}
开发者ID:Jonham,项目名称:FreeCAD,代码行数:19,代码来源:PropertyExpressionEngine.cpp


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