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


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

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


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

示例1: readParametersFromFeature

PyObject* AttachEnginePy::readParametersFromFeature(PyObject* args)
{
    PyObject* obj;
    if (!PyArg_ParseTuple(args, "O!",&(App::DocumentObjectPy::Type),&obj))
        return NULL;    // NULL triggers exception

    try{
        App::DocumentObjectPy* dobjpy = static_cast<App::DocumentObjectPy*>(obj);
        App::DocumentObject* dobj = dobjpy->getDocumentObjectPtr();
        if (! dobj->hasExtension(Part::AttachExtension::getExtensionClassTypeId())){
            throw Py::TypeError("Supplied object has no Part::AttachExtension");
        }
        Part::AttachExtension* feat = dobj->getExtensionByType<Part::AttachExtension>();
        AttachEngine &attacher = *(this->getAttachEnginePtr());
        attacher.setUp(feat->Support,
                       eMapMode(feat->MapMode.getValue()),
                       feat->MapReversed.getValue(),
                       feat->MapPathParameter.getValue(),
                       0.0,0.0,
                       feat->AttachmentOffset.getValue());
        return Py::new_reference_to(Py::None());
    } ATTACHERPY_STDCATCH_METH;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:23,代码来源:AttachEnginePyImp.cpp

示例2: writeParametersToFeature

PyObject* AttachEnginePy::writeParametersToFeature(PyObject* args)
{
    PyObject* obj;
    if (!PyArg_ParseTuple(args, "O!",&(App::DocumentObjectPy::Type),&obj))
        return NULL;    // NULL triggers exception

    try{
        App::DocumentObjectPy* dobjpy = static_cast<App::DocumentObjectPy*>(obj);
        App::DocumentObject* dobj = dobjpy->getDocumentObjectPtr();
        if (! dobj->hasExtension(Part::AttachExtension::getExtensionClassTypeId())){
            throw Py::TypeError("Supplied object has no Part::AttachExtension");
        }
        Part::AttachExtension* feat = dobj->getExtensionByType<Part::AttachExtension>();
        const AttachEngine &attacher = *(this->getAttachEnginePtr());
        AttachEngine::verifyReferencesAreSafe(attacher.references);
        feat->Support.Paste(attacher.references);
        feat->MapMode.setValue(attacher.mapMode);
        feat->MapReversed.setValue(attacher.mapReverse);
        feat->MapPathParameter.setValue(attacher.attachParameter);
        feat->AttachmentOffset.setValue(attacher.attachmentOffset);
        return Py::new_reference_to(Py::None());
    } ATTACHERPY_STDCATCH_METH;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:23,代码来源:AttachEnginePyImp.cpp

示例3: slotChangedObject

void ShapeBinder::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
    App::Document* doc = getDocument();
    if (!doc || doc->testStatus(App::Document::Restoring))
        return;
    if (this == &Obj)
        return;
    if (!TraceSupport.getValue())
        return;
    if (!Prop.getTypeId().isDerivedFrom(App::PropertyPlacement::getClassTypeId()))
        return;

    Part::Feature* obj = nullptr;
    std::vector<std::string> subs;
    ShapeBinder::getFilteredReferences(&Support, obj, subs);
    if (obj) {
        if (obj == &Obj) {
            // the directly referenced object has changed
            enforceRecompute();
        }
        else if (Obj.hasExtension(App::GroupExtension::getExtensionClassTypeId())) {
            // check if the changed property belongs to a group-like object
            // like Body or Part
            std::vector<App::DocumentObject*> chain;
            std::vector<App::DocumentObject*> list = getInListRecursive();
            chain.insert(chain.end(), list.begin(), list.end());
            list = obj->getInListRecursive();
            chain.insert(chain.end(), list.begin(), list.end());

            auto it = std::find(chain.begin(), chain.end(), &Obj);
            if (it != chain.end()) {
                enforceRecompute();
            }
        }
    }
}
开发者ID:frankhardy,项目名称:FreeCAD,代码行数:36,代码来源:ShapeBinder.cpp


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