Esempio n. 1
0
int DrawProjGroup::removeProjection(const char *viewProjType)
{
    if ( checkViewProjType(viewProjType) ) {
        if(!hasProjection(viewProjType)) {
            throw Base::Exception("The projection doesn't exist in the group");
        }

        // Iterate through the child views and find the projection type
        const std::vector<App::DocumentObject *> &views = Views.getValues();
        for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {

            TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(*it);
            if(view->getTypeId() == TechDraw::DrawProjGroupItem::getClassTypeId()) {
                TechDraw::DrawProjGroupItem *projPtr = dynamic_cast<TechDraw::DrawProjGroupItem *>(*it);

                if ( strcmp(viewProjType, projPtr->Type.getValueAsString()) == 0 ) {
                    // Remove from the document
                    getDocument()->remObject((*it)->getNameInDocument());
                    moveToCentre();
                    return views.size();
                }
            }
        }
    }

    return -1;
}
void ViewProviderDrawingView::hide(void)
{
    TechDraw::DrawView* obj = getViewObject();
    if (!obj || obj->isRestoring())
        return;

    if (obj->getTypeId().isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
        QGIView* qView = getQView();
        if (qView) {
            qView->isVisible(false);
            qView->draw();
            qView->hide();
        }
    }
    ViewProviderDocumentObject::hide();
}
Esempio n. 3
0
bool DrawProjGroup::hasProjection(const char *viewProjType) const
{
    const std::vector<App::DocumentObject *> &views = Views.getValues();

    for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {

        TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(*it);
        if(view->getTypeId() == TechDraw::DrawProjGroupItem::getClassTypeId()) {
            TechDraw::DrawProjGroupItem *projPtr = dynamic_cast<TechDraw::DrawProjGroupItem *>(*it);

            if( strcmp(viewProjType, projPtr->Type.getValueAsString()) == 0 ) {
                return true;
            }
        }
    }
    return false;
}