本文整理汇总了C++中preparePreview函数的典型用法代码示例。如果您正苦于以下问题:C++ preparePreview函数的具体用法?C++ preparePreview怎么用?C++ preparePreview使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preparePreview函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catchEntity
void RS_ActionDrawCircleInscribe::mouseMoveEvent(QMouseEvent* e) {
RS_DEBUG->print("RS_ActionDrawCircle4Line::mouseMoveEvent begin");
if(getStatus() == SetLine3) {
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()->ignoredOnModification())
return;
}
coord= graphicView->toGraph(e->x(), e->y());
lines.resize(getStatus());
lines.push_back(static_cast<RS_Line*>(en));
// lines[getStatus()]=static_cast<RS_Line*>(en);
if(preparePreview()) {
deletePreview();
RS_Circle* e=new RS_Circle(preview.get(), *cData);
preview->addEntity(e);
drawPreview();
}
}
RS_DEBUG->print("RS_ActionDrawCircle4Line::mouseMoveEvent end");
}
示例2: preparePreview
void RS_ActionDrawLineRectangle::trigger() {
RS_PreviewActionInterface::trigger();
RS_Line* line[4];
preparePreview();
// create and add rectangle:
for (int i=0; i<4; ++i) {
line[i] = new RS_Line(container, *data[i]);
line[i]->setLayerToActive();
line[i]->setPenToActive();
container->addEntity(line[i]);
}
// upd. undo list:
if (document) {
document->startUndoCycle();
for (int i=0; i<4; ++i) {
document->addUndoable(line[i]);
}
document->endUndoCycle();
}
// upd. view
graphicView->redraw(RS2::RedrawDrawing);
graphicView->moveRelativeZero(corner2);
}
示例3: snapPoint
void LC_ActionDrawCircle2PR::mouseMoveEvent(QMouseEvent* e) {
RS_Vector mouse = snapPoint(e);
switch (getStatus()) {
case SetPoint1:
point1 = mouse;
break;
case SetPoint2:
if(mouse.distanceTo(point1) <= 2.*data->radius) point2 = mouse;
break;
case SelectCenter: {
if(preparePreview(mouse)){
RS_Circle* circle = new RS_Circle(preview.get(), *data);
deletePreview();
preview->addEntity(circle);
drawPreview();
}else{
if(data->isValid()) trigger();
}
}
}
}
示例4: switch
void RS_ActionDrawEllipse4Points::coordinateEvent(RS_CoordinateEvent* e) {
if (e==NULL) {
return;
}
RS_Vector mouse = e->getCoordinate();
points.alloc(getStatus()+1);
points.set(getStatus(),mouse);
switch (getStatus()) {
case SetPoint1:
graphicView->moveRelativeZero(mouse);
setStatus(SetPoint2);
break;
case SetPoint2:
case SetPoint3:
case SetPoint4:
if( preparePreview()) {
graphicView->moveRelativeZero(mouse);
if(getStatus() == SetPoint4 ||
(points.get(getStatus()) - points.get(getStatus()-1)).squared() <RS_TOLERANCE*RS_TOLERANCE) {
//also draw the entity, if clicked on the same point twice
trigger();
}else{
setStatus(getStatus()+1);
}
}
default:
break;
}
}
示例5: switch
void RS_ActionDrawText::init(int status) {
RS_ActionInterface::init(status);
if (RS_DIALOGFACTORY!=NULL) {
switch (status) {
case ShowDialog: {
clearPreview();
reset();
RS_Text tmp(NULL, data);
if (RS_DIALOGFACTORY->requestTextDialog(&tmp)) {
data = tmp.getData();
preparePreview();
preview->setVisible(false);
setStatus(SetPos);
showOptions();
} else {
hideOptions();
finish();
}
graphicView->redraw();
}
break;
case SetPos:
RS_DIALOGFACTORY->requestOptions(this, true, true);
break;
default:
break;
}
}
}
示例6: preparePreview
void RS_ActionDrawArcTangential::trigger() {
RS_PreviewActionInterface::trigger();
if (point.valid==false || baseEntity==NULL) {
RS_DEBUG->print("RS_ActionDrawArcTangential::trigger: "
"conditions not met");
return;
}
preparePreview();
RS_Arc* arc = new RS_Arc(container, *data);
arc->setLayerToActive();
arc->setPenToActive();
container->addEntity(arc);
// upd. undo list:
if (document!=NULL) {
document->startUndoCycle();
document->addUndoable(arc);
document->endUndoCycle();
}
graphicView->redraw(RS2::RedrawDrawing);
graphicView->moveRelativeZero(arc->getCenter());
setStatus(SetBaseEntity);
reset();
}
示例7: snapPoint
void RS_ActionDrawArc3P::mouseMoveEvent(QMouseEvent* e) {
RS_Vector mouse = snapPoint(e);
switch (getStatus()) {
case SetPoint1:
point1 = mouse;
break;
case SetPoint2:
point2 = mouse;
if (point1.valid) {
RS_Line* line = new RS_Line(preview.get(), RS_LineData(point1, point2));
deletePreview();
preview->addEntity(line);
drawPreview();
}
break;
case SetPoint3:
point3 = mouse;
preparePreview();
if (data->isValid()) {
RS_Arc* arc = new RS_Arc(preview.get(), *data);
deletePreview();
preview->addEntity(arc);
drawPreview();
}
break;
default:
break;
}
}
示例8: preparePreview
void RS_ActionDimDiametric::trigger() {
RS_PreviewActionInterface::trigger();
preparePreview();
if (entity) {
RS_DimDiametric* newEntity = nullptr;
newEntity = new RS_DimDiametric(container,
*data,
*edata);
newEntity->setLayerToActive();
newEntity->setPenToActive();
newEntity->update();
container->addEntity(newEntity);
// upd. undo list:
if (document) {
document->startUndoCycle();
document->addUndoable(newEntity);
document->endUndoCycle();
}
RS_Vector rz = graphicView->getRelativeZero();
graphicView->redraw(RS2::RedrawDrawing);
graphicView->moveRelativeZero(rz);
RS_Snapper::finish();
} else {
RS_DEBUG->print("RS_ActionDimDiametric::trigger:"
" Entity is nullptr\n");
}
}
示例9: snapPoint
void LC_ActionDrawCircle2PR::mouseMoveEvent(QMouseEvent* e) {
RS_Vector mouse = snapPoint(e);
switch (getStatus()) {
case SetPoint1:
pPoints->point1 = mouse;
break;
case SetPoint2:
if(mouse.distanceTo(pPoints->point1) <= 2.*data->radius) pPoints->point2 = mouse;
break;
case SelectCenter: {
if(preparePreview(mouse)){
bool existing=false;
for(auto p: *preview){
if(p->rtti() == RS2::EntityCircle){
if( static_cast<RS_Circle*>(p)->getData() == *data)
existing=true;
}
}
if(!existing){
deletePreview();
preview->addEntity(new RS_Point(preview.get(), RS_PointData(data->center)));
RS_Circle* circle = new RS_Circle(preview.get(), *data);
preview->addEntity(circle);
drawPreview();
}
}else{
if(data->isValid()) trigger();
}
}
}
}
示例10: preparePreview
void RS_ActionDrawCircle2P::trigger() {
RS_PreviewActionInterface::trigger();
preparePreview();
if (data.isValid()) {
RS_Circle* circle = new RS_Circle(container,
data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);
// upd. undo list:
if (document!=NULL) {
document->startUndoCycle();
document->addUndoable(circle);
document->endUndoCycle();
}
RS_Vector rz = graphicView->getRelativeZero();
graphicView->redraw(RS2::RedrawDrawing);
graphicView->moveRelativeZero(rz);
setStatus(SetPoint1);
reset();
} else {
if (RS_DIALOGFACTORY!=NULL) {
RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data."));
}
}
}
示例11: catchEntity
void RS_ActionDrawCircleInscribe::mouseMoveEvent(QMouseEvent* e) {
RS_DEBUG->print("RS_ActionDrawCircle4Line::mouseMoveEvent begin");
if(getStatus() == SetLine3) {
RS_Entity* en = catchEntity(e, RS2::EntityLine, RS2::ResolveAll);
if(!en) 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() && en->getParent()->ignoredOnModification())
return;
pPoints->coord= graphicView->toGraph(e->x(), e->y());
deletePreview();
while(lines.size()==3){
lines.back()->setHighlighted(false);
graphicView->drawEntity(lines.back());
lines.pop_back();
}
en->setHighlighted(true);
lines.push_back(static_cast<RS_Line*>(en));
graphicView->drawEntity(lines.back());
if(preparePreview()) {
RS_Circle* e=new RS_Circle(preview.get(), pPoints->cData);
preview->addEntity(e);
drawPreview();
}
}
RS_DEBUG->print("RS_ActionDrawCircle4Line::mouseMoveEvent end");
}
示例12: kDebug
void EditorToolThreaded::slotPreview()
{
// Computation already in process.
if (d->currentRenderingMode != EditorToolThreaded::NoneRendering)
{
return;
}
d->currentRenderingMode = EditorToolThreaded::PreviewRendering;
kDebug() << "Preview " << toolName() << " started...";
toolSettings()->enableButton(EditorToolSettings::Ok, false);
toolSettings()->enableButton(EditorToolSettings::SaveAs, false);
toolSettings()->enableButton(EditorToolSettings::Load, false);
toolSettings()->enableButton(EditorToolSettings::Default, false);
toolSettings()->enableButton(EditorToolSettings::Try, false);
toolView()->setEnabled(false);
EditorToolIface::editorToolIface()->setToolStartProgress(d->progressMess.isEmpty() ? toolName() : d->progressMess);
kapp->setOverrideCursor(Qt::WaitCursor);
if (d->delFilter && d->threadedFilter)
{
delete d->threadedFilter;
d->threadedFilter = 0;
}
preparePreview();
}
示例13: preparePreview
void RS_ActionDrawArc3P::trigger() {
RS_PreviewActionInterface::trigger();
preparePreview();
if (data.isValid()) {
RS_Arc* arc = new RS_Arc(container,
data);
arc->setLayerToActive();
arc->setPenToActive();
container->addEntity(arc);
// upd. undo list:
if (document!=NULL) {
document->startUndoCycle();
document->addUndoable(arc);
document->endUndoCycle();
}
deleteSnapper();
graphicView->moveRelativeZero(RS_Vector(0.0,0.0));
graphicView->drawEntity(arc);
graphicView->moveRelativeZero(arc->getEndpoint());
drawSnapper();
setStatus(SetPoint1);
reset();
} else {
//RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid arc data."));
RS_DIALOGFACTORY->commandMessage(tr("Invalid arc data."));
}
}
示例14: switch
void RS_ActionDimRadial::mouseMoveEvent(QMouseEvent* e) {
RS_DEBUG->print("RS_ActionDimRadial::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:
if (entity) {
pos = snapPoint(e);
preparePreview();
RS_DimRadial* d = new RS_DimRadial(preview.get(), *data, *edata);
deletePreview();
preview->addEntity(d);
d->update();
drawPreview();
}
break;
default:
break;
}
RS_DEBUG->print("RS_ActionDimRadial::mouseMoveEvent end");
}
示例15: switch
void RS_ActionDrawText::init(int status) {
RS_ActionInterface::init(status);
if (RS_DIALOGFACTORY) {
switch (status) {
case ShowDialog: {
reset();
RS_Text tmp(NULL, *data);
if (RS_DIALOGFACTORY->requestTextDialog(&tmp)) {
data.reset(new RS_TextData(tmp.getData()));
setStatus(SetPos);
showOptions();
} else {
hideOptions();
setFinished();
}
}
break;
case SetPos:
RS_DIALOGFACTORY->requestOptions(this, true, true);
deletePreview();
preview->setVisible(true);
preparePreview();
break;
default:
break;
}
}
}