本文整理汇总了C++中Stroke::getElementHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Stroke::getElementHeight方法的具体用法?C++ Stroke::getElementHeight怎么用?C++ Stroke::getElementHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stroke
的用法示例。
在下文中一共展示了Stroke::getElementHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onButtonReleaseEvent
void InputHandler::onButtonReleaseEvent(GdkEventButton * event, PageRef page) {
XOJ_CHECK_TYPE(InputHandler);
if (!this->tmpStroke) {
return;
}
// Backward compatibility and also easier to handle for me;-)
// I cannot draw a line with one point, to draw a visible line I need two points,
// twice the same Point is also OK
if (this->tmpStroke->getPointCount() == 1) {
ArrayIterator<Point> it = this->tmpStroke->pointIterator();
if (it.hasNext()) {
this->tmpStroke->addPoint(it.next());
}
// No pressure sensitivity
this->tmpStroke->clearPressure();
}
this->tmpStroke->freeUnusedPointItems();
if (page.getSelectedLayerId() < 1) {
// This creates a layer if none exists
page.getSelectedLayer();
page.setSelectedLayerId(1);
xournal->getControl()->getWindow()->updateLayerCombobox();
}
Layer * layer = page.getSelectedLayer();
UndoRedoHandler * undo = xournal->getControl()->getUndoRedoHandler();
undo->addUndoAction(new InsertUndoAction(page, layer, this->tmpStroke, this->redrawable));
ToolHandler * h = xournal->getControl()->getToolHandler();
if (h->isShapeRecognizer()) {
if (this->reco == NULL) {
this->reco = new ShapeRecognizer();
}
ShapeRecognizerResult * result = this->reco->recognizePatterns(this->tmpStroke);
if (result != NULL) {
UndoRedoHandler * undo = xournal->getControl()->getUndoRedoHandler();
Stroke * recognized = result->getRecognized();
RecognizerUndoAction * recognizerUndo = new RecognizerUndoAction(page, this->redrawable, layer, this->tmpStroke, recognized);
undo->addUndoAction(recognizerUndo);
layer->addElement(result->getRecognized());
Range range(recognized->getX(), recognized->getY());
range.addPoint(recognized->getX() + recognized->getElementWidth(), recognized->getY() + recognized->getElementHeight());
range.addPoint(this->tmpStroke->getX(), this->tmpStroke->getY());
range.addPoint(this->tmpStroke->getX() + this->tmpStroke->getElementWidth(), this->tmpStroke->getY() + this->tmpStroke->getElementHeight());
ListIterator<Stroke *> l = result->getSources();
while (l.hasNext()) {
Stroke * s = l.next();
layer->removeElement(s, false);
recognizerUndo->addSourceElement(s);
range.addPoint(s->getX(), s->getY());
range.addPoint(s->getX() + s->getElementWidth(), s->getY() + s->getElementHeight());
}
this->redrawable->rerenderRange(range);
// delete the result object, this is not needed anymore, the stroke are not deleted with this
delete result;
} else {
layer->addElement(this->tmpStroke);
this->redrawable->rerenderElement(this->tmpStroke);
}
} else {
layer->addElement(this->tmpStroke);
this->redrawable->rerenderElement(this->tmpStroke);
}
this->tmpStroke = NULL;
if (currentInputDevice == event->device) {
currentInputDevice = NULL;
INPUTDBG("currentInputDevice = NULL\n", 0);
}
this->tmpStrokeDrawElem = 0;
}