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


C++ catchEntity函数代码示例

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


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

示例1: catchEntity

void RS_ActionDrawEllipseInscribe::mouseMoveEvent(QMouseEvent* e) {
    RS_DEBUG->print("RS_ActionDrawEllipse4Line::mouseMoveEvent begin");

    if(getStatus() == SetLine4) {
        RS_Entity*  en = catchEntity(e, RS2::EntityLine, RS2::ResolveAll);
        if(!en) return;
        if(!(en->isVisible() && en->rtti()== RS2::EntityLine)) return;
        for(auto p: lines){
            if(en == p) return; //do not pull in the same line again
        }

        if(en->getParent() && en->getParent()->ignoredOnModification()){
                return;
            }

		deletePreview();

		clearLines(true);
		lines.push_back(static_cast<RS_Line*>(en));
		if(preparePreview()) {
			lines.back()->setHighlighted(true);
			graphicView->drawEntity(lines.back());
			RS_Ellipse* e=new RS_Ellipse(preview.get(), *eData);
            preview->addEntity(e);
            drawPreview();
        }

    }
    RS_DEBUG->print("RS_ActionDrawEllipse4Line::mouseMoveEvent end");
}
开发者ID:dinkel,项目名称:LibreCAD,代码行数:30,代码来源:rs_actiondrawellipseinscribe.cpp

示例2: switch

void RS_ActionDrawLineRelAngle::mouseReleaseEvent(QMouseEvent* e) {

    if (e->button()==Qt::LeftButton) {
        switch (getStatus()) {
        case SetEntity: {
				RS_Entity* en = catchEntity(e, enTypeList, RS2::ResolveAll);
				if (en) {
                    entity = en;

                    entity->setHighlighted(true);
                    graphicView->drawEntity(entity);

                    setStatus(SetPos);
                }
            }
            break;

        case SetPos: {
                RS_CoordinateEvent ce(snapPoint(e));
                coordinateEvent(&ce);
            }
            break;

        default:
            break;
        }
    } else if (e->button()==Qt::RightButton) {
        deletePreview();
        if (entity) {
            entity->setHighlighted(false);
            graphicView->drawEntity(entity);
        }
        init(getStatus()-1);
    }
}
开发者ID:aisq2008,项目名称:LibreCAD,代码行数:35,代码来源:rs_actiondrawlinerelangle.cpp

示例3: deletePreview

void RS_ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent* e) {

    if (e->button()==Qt::RightButton) {
        deletePreview();
        init(getStatus()-1);
    } else {

        RS_Vector mouse = RS_Vector(graphicView->toGraphX(e->x()),
                                    graphicView->toGraphY(e->y()));

        switch (getStatus()) {
        case SetLine1: {
                coord1 = mouse;
                RS_Entity* en = catchEntity(e, RS2::ResolveAll);
                if (en!=NULL && en->rtti()==RS2::EntityLine) {
                    line1 = (RS_Line*)en;
                }
            }
            setStatus(SetLine2);
            break;

        case SetLine2:
            coord2 = mouse;
            trigger();
            setStatus(SetLine1);
            break;
        }
    }

}
开发者ID:kevincox,项目名称:LibreCAD,代码行数:30,代码来源:rs_actiondrawlinebisector.cpp

示例4: init

void RS_ActionModifyEntity::mouseReleaseEvent(RS_MouseEvent* e) {
    if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) {
        init(getStatus()-1);
    } else {
        en = catchEntity(e);
        trigger();
    }
}
开发者ID:jacklibj,项目名称:2.0.5.0-1-community.src,代码行数:8,代码来源:rs_actionmodifyentity.cpp

示例5: catchEntity

/**
 * Catches an entity which is close to the mouse cursor.
 *
 * @param e A mouse event.
 * @param level The level of resolving for iterating through the entity
 *        container
 * @return Pointer to the entity or NULL.
 */
RS_Entity* RS_Snapper::catchEntity(RS_MouseEvent* e,
                                   RS2::ResolveLevel level) {

    return catchEntity(
               RS_Vector(graphicView->toGraphX(e->x()),
                         graphicView->toGraphY(e->y())),
               level);
}
开发者ID:jacklibj,项目名称:2.0.5.0-1-community.src,代码行数:16,代码来源:rs_snapper.cpp

示例6: init

void RS_ActionSelectLayer::mouseReleaseEvent(QMouseEvent* e) {
    if (e->button()==Qt::RightButton) {
        init(getStatus()-1);
    } else {
        en = catchEntity(e);
        trigger();
    }
}
开发者ID:0825732889,项目名称:LibreCAD,代码行数:8,代码来源:rs_actionselectlayer.cpp

示例7: init

void RS_ActionSelectSingle::mouseReleaseEvent(QMouseEvent* e) {
    if (e->button()==Qt::RightButton) {
        //need to finish the parent RS_ActionSelect as well, bug#3437138
            //need to check actionSelect is set, bug#3437138
        if(actionSelect) {
            actionSelect->requestFinish(false);
        }
        init(getStatus()-1);
    } else {
        if(entityTypeList.size()) {
//            std::cout<<"RS_ActionSelectSingle::mouseReleaseEvent(): entityTypeList->size()="<< entityTypeList->size()<<std::endl;
            en = catchEntity(e, entityTypeList);
        }else{
            en = catchEntity(e);
        }
        trigger();
    }
}
开发者ID:CNClaus,项目名称:LibreCAD,代码行数:18,代码来源:rs_actionselectsingle.cpp

示例8: switch

void RS_ActionPolylineAdd::mouseReleaseEvent(QMouseEvent* e) {
        if (e->button()==Qt::LeftButton) {
                switch (getStatus()) {
                case ChooseSegment:
                        addEntity = catchEntity(e);
                        if (addEntity==NULL) {
                        RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
                        } else if (addEntity->rtti()!=RS2::EntityPolyline) {

                        RS_DIALOGFACTORY->commandMessage(
                                tr("Entity must be a polyline."));
                        } else {
                                addEntity->setHighlighted(true);
                                graphicView->drawEntity(addEntity);
                                setStatus(SetAddCoord);
////////////////////////////////////////2006/06/15
                                graphicView->redraw(RS2::RedrawDrawing);
////////////////////////////////////////
                        }
                        break;

                case SetAddCoord:
                        addCoord = snapPoint(e);
                        if (addEntity==NULL) {
                                RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
                        } else if (!addCoord.valid) {
                                RS_DIALOGFACTORY->commandMessage(tr("Adding point is invalid."));
                        } else {
                                RS_Vector clickCoord = snapPoint(e);
                                addSegment = NULL;
                                double dist = graphicView->toGraphDX(snapRange)*0.9;
                                addSegment =  ((RS_Polyline*)addEntity)->getNearestEntity( clickCoord, &dist, RS2::ResolveNone);
                                if(addSegment == NULL) {
                                        RS_DIALOGFACTORY->commandMessage(
                                                        tr("Adding point is not on entity."));
                                        break;
                                }
                                deleteSnapper();
                                trigger();
                        }
                        break;

                default:
                        break;
                }
        } else if (e->button()==Qt::RightButton) {
                deleteSnapper();
                if (addEntity) {
                        addEntity->setHighlighted(false);
                        graphicView->drawEntity(addEntity);
////////////////////////////////////////2006/06/15
                        graphicView->redraw(RS2::RedrawDrawing);
////////////////////////////////////////
                }
                init(getStatus()-1);
        }
}
开发者ID:Harpalus,项目名称:LibreCAD,代码行数:57,代码来源:rs_actionpolylineadd.cpp

示例9: catchEntity

void RS_ActionDrawEllipseInscribe::mouseReleaseEvent(QMouseEvent* e) {
    // Proceed to next status
    if (e->button()==Qt::LeftButton) {
        if (e==NULL) {
            return;
        }
        RS_Entity*  en = catchEntity(e, RS2::EntityLine, RS2::ResolveAll);
        if(en == NULL) return;
        if(!(en->isVisible() && en->rtti()== RS2::EntityLine)) return;
        for(int i=0;i<getStatus();i++) {
            if(en->getId() == lines[i]->getId()) return; //do not pull in the same line again
        }
        if(en->getParent() != NULL) {
            if ( en->getParent()->rtti() == RS2::EntityInsert         /**Insert*/
                    || en->getParent()->rtti() == RS2::EntitySpline
                    || en->getParent()->rtti() == RS2::EntityText         /**< Text 15*/
                    || en->getParent()->rtti() == RS2::EntityDimAligned   /**< Aligned Dimension */
                    || en->getParent()->rtti() == RS2::EntityDimLinear    /**< Linear Dimension */
                    || en->getParent()->rtti() == RS2::EntityDimRadial    /**< Radial Dimension */
                    || en->getParent()->rtti() == RS2::EntityDimDiametric /**< Diametric Dimension */
                    || en->getParent()->rtti() == RS2::EntityDimAngular   /**< Angular Dimension */
                    || en->getParent()->rtti() == RS2::EntityDimLeader    /**< Leader Dimension */
                    ){
                return;
        }
        }
        lines.resize(getStatus());
        lines.push_back(static_cast<RS_Line*>(en));

        switch (getStatus()) {
        case SetLine1:
        case SetLine2:
        case SetLine3:
            en->setHighlighted(true);
            setStatus(getStatus()+1);
            graphicView->redraw(RS2::RedrawDrawing);
            break;
        case SetLine4:
            if( preparePreview()) {
                trigger();
            }

        default:
            break;
        }
    } else if (e->button()==Qt::RightButton) {
        // Return to last status:
        if(getStatus()>0){
            lines[getStatus()-1]->setHighlighted(false);
            lines.pop_back();
            graphicView->redraw(RS2::RedrawDrawing);
            deletePreview();

        }
        init(getStatus()-1);
    }
}
开发者ID:RobertvonKnobloch,项目名称:LibreCAD,代码行数:57,代码来源:rs_actiondrawellipseinscribe.cpp

示例10: catchEntity

void RS_ActionModifyRound::mouseMoveEvent(RS_MouseEvent* e) {
    RS_DEBUG->print("RS_ActionModifyRound::mouseMoveEvent begin");

    RS_Vector mouse = graphicView->toGraph(e->x(), e->y());
    RS_Entity* se = catchEntity(e, RS2::ResolveAll);

    switch (getStatus()) {
    case SetEntity1:
        entity1 = se;
        coord1 = mouse;
        break;

    case SetEntity2:
        entity2 = se;
        coord2 = mouse;

        if (entity1!=NULL && entity2!=NULL && entity2->isAtomic() &&
			RS_Information::isTrimmable(entity1, entity2)) {

            deletePreview();
            clearPreview();
            //preview->addSelectionFrom(*container);
            //preview->move(targetPoint-referencePoint);
            RS_Entity* tmp1 = entity1->clone();
            RS_Entity* tmp2 = entity2->clone();
            tmp1->reparent(preview);
            tmp2->reparent(preview);
            preview->addEntity(tmp1);
            preview->addEntity(tmp2);

            bool trim = data.trim;
            data.trim = false;
            RS_Modification m(*preview, NULL, false);
            m.round(coord2,
                    coord1,
                    (RS_AtomicEntity*)tmp1,
                    coord2,
                    (RS_AtomicEntity*)tmp2,
                    data);
            data.trim = trim;

            preview->removeEntity(tmp1);
            preview->removeEntity(tmp2);
            drawPreview();
        }
        break;

    default:
        break;
    }

    RS_DEBUG->print("RS_ActionModifyRound::mouseMoveEvent end");
}
开发者ID:Akaur,项目名称:qdraw,代码行数:53,代码来源:rs_actionmodifyround.cpp

示例11: catchEntity

RS_Entity* RS_ActionDrawCircleTan1_2P::catchCircle(QMouseEvent* e) {
    RS_Entity* ret=NULL;
    RS_Entity*  en = catchEntity(e,enTypeList, RS2::ResolveAll);
    if(en == NULL) return ret;
    if(en->isVisible()==false) return ret;
    if(en->getParent() != NULL) {
        if ( en->getParent()->ignoredOnModification()){
            return NULL;
        }
    }
    return en;
}
开发者ID:CERobertson,项目名称:LibreCAD,代码行数:12,代码来源:rs_actiondrawcircletan1_2p.cpp

示例12: catchEntity

RS_Entity* RS_ActionDrawCircleTan1_2P::catchCircle(QMouseEvent* e) {
	RS_Entity* ret=nullptr;
	RS_Entity* en = catchEntity(e,enTypeList, RS2::ResolveAll);
	if (!en) return ret;
	if (!en->isVisible()) return ret;
	if (en->getParent()) {
        if ( en->getParent()->ignoredOnModification()){
			return nullptr;
        }
    }
    return en;
}
开发者ID:Aly1029,项目名称:LibreCAD,代码行数:12,代码来源:rs_actiondrawcircletan1_2p.cpp

示例13: switch

void RS_ActionPolylineDel::mouseReleaseEvent(QMouseEvent* e) {
    if (e->button()==Qt::LeftButton) {
                switch (getStatus()) {
                case ChooseEntity:
                    delEntity = catchEntity(e);
                    if (delEntity==NULL) {
                        RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
                    } else if (delEntity->rtti()!=RS2::EntityPolyline) {

                        RS_DIALOGFACTORY->commandMessage(
                            tr("Entity must be a polyline."));
                    } else {
							snapPoint(e);
                                delEntity->setHighlighted(true);
                                graphicView->drawEntity(delEntity);
                                setStatus(SetDelPoint);
////////////////////////////////////////2006/06/15
                                graphicView->redraw();
////////////////////////////////////////
                    }
                    break;

                case SetDelPoint:
                    delPoint = snapPoint(e);
                    if (delEntity==NULL) {
                                RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
                    } else if (!delPoint.valid) {
                                RS_DIALOGFACTORY->commandMessage(tr("Deleting point is invalid."));
                    } else if (!delEntity->isPointOnEntity(delPoint)) {
                                RS_DIALOGFACTORY->commandMessage(
                                    tr("Deleting point is not on entity."));
                    } else {
                                deleteSnapper();
                                trigger();
                    }
                    break;

                default:
                    break;
                }
    } else if (e->button()==Qt::RightButton) {
                deleteSnapper();
                if (delEntity) {
                delEntity->setHighlighted(false);
                graphicView->drawEntity(delEntity);
////////////////////////////////////////2006/06/15
                        graphicView->redraw();
////////////////////////////////////////
                }
                init(getStatus()-1);
    }
}
开发者ID:Harpalus,项目名称:LibreCAD,代码行数:52,代码来源:rs_actionpolylinedel.cpp

示例14: catchEntity

RS_Entity* RS_ActionDrawCircleTan2_1P::catchCircle(QMouseEvent* e) {
    RS_Entity* ret=NULL;
    RS_Entity*  en = catchEntity(e,enTypeList, RS2::ResolveAll);
    if(en == NULL) return ret;
    if(en->isVisible()==false) return ret;
	for(auto p: circles){
		if(p && en->getId() == p->getId()) return ret; //do not pull in the same line again
    }
	if(en->getParent() && en->getParent()->ignoredOnModification()){
		return nullptr;
	}
	return en;
}
开发者ID:Harpalus,项目名称:LibreCAD,代码行数:13,代码来源:rs_actiondrawcircletan2_1p.cpp

示例15: mouse

void RS_ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent* e) {
    RS_DEBUG->print("RS_ActionDrawLineRelAngle::mouseMoveEvent begin");

    RS_Vector mouse(graphicView->toGraphX(e->x()),
                    graphicView->toGraphY(e->y()));

    switch (getStatus()) {
    case SetEntity:
        entity = catchEntity(e, RS2::ResolveAll);
        break;

    case SetPos: {
            //length = graphicView->toGraphDX(graphicView->getWidth());
            //RS_Vector mouse = snapPoint(e);
            pos = snapPoint(e);

            /*RS_Creation creation(NULL, NULL);
            RS_Line* l = creation.createLineRelAngle(mouse,
                         entity,
                         angle,
                         length);*/

            deletePreview();

            RS_Creation creation(preview, NULL, false);
            creation.createLineRelAngle(pos,
                                        entity,
                                        angle,
                                        length);

            drawPreview();

            /*if (l!=NULL) {
                if (line!=NULL) {
                    delete line;
                }
                line = (RS_Line*)l->clone();

                deletePreview();
                preview->addEntity(l);
                drawPreview();
        }*/
        }
        break;

    default:
        break;
    }

    RS_DEBUG->print("RS_ActionDrawLineRelAngle::mouseMoveEvent end");
}
开发者ID:0825732889,项目名称:LibreCAD,代码行数:51,代码来源:rs_actiondrawlinerelangle.cpp


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