本文整理汇总了C++中ListIterator::hasNext方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator::hasNext方法的具体用法?C++ ListIterator::hasNext怎么用?C++ ListIterator::hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListIterator
的用法示例。
在下文中一共展示了ListIterator::hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: erase
/**
* Handle eraser event: "Delete Stroke" and "Standard", Whiteout is not handled here
*/
void EraseHandler::erase(double x, double y) {
XOJ_CHECK_TYPE(EraseHandler);
ListIterator<Layer*> it = this->page.layerIterator();
int selected = page.getSelectedLayerId();
this->halfEraserSize = this->handler->getThickness();
GdkRectangle eraserRect = { x - halfEraserSize, y - halfEraserSize, halfEraserSize * 2, halfEraserSize * 2 };
Range * range = new Range(x, y);
while (it.hasNext() && selected) {
Layer * l = it.next();
ListIterator<Element *> eit = l->elementIterator();
eit.freeze();
while (eit.hasNext()) {
Element * e = eit.next();
if (e->getType() == ELEMENT_STROKE && e->intersectsArea(&eraserRect)) {
Stroke * s = (Stroke *) e;
eraseStroke(l, s, x, y, range);
}
}
selected--;
}
this->view->rerenderRange(*range);
delete range;
}
示例2: search
bool SearchControl::search(const char * text, int * occures, double * top) {
XOJ_CHECK_TYPE(SearchControl);
freeSearchResults();
if (text == NULL) {
return true;
}
if (this->pdf) {
this->results = this->pdf->findText(text);
}
int selected = this->page.getSelectedLayerId();
ListIterator<Layer*> it = this->page.layerIterator();
while (it.hasNext() && selected) {
Layer * l = it.next();
ListIterator<Element *> eit = l->elementIterator();
while (eit.hasNext()) {
Element * e = eit.next();
if (e->getType() == ELEMENT_TEXT) {
Text * t = (Text *) e;
GList * textResult = TextView::findText(t, text);
this->results = g_list_concat(this->results, textResult);
}
}
selected--;
}
if (occures) {
*occures = g_list_length(this->results);
}
if (top) {
if (this->results == NULL) {
*top = 0;
} else {
double min = ((XojPopplerRectangle *) this->results->data)->y1;
for (GList * l = this->results->next; l != NULL; l = l->next) {
XojPopplerRectangle * rect = (XojPopplerRectangle *) l->data;
min = MIN(min, rect->y1);
}
*top = min;
}
}
return this->results != NULL;
}
示例3: selectObjectAt
void PageView::selectObjectAt(double x, double y) {
XOJ_CHECK_TYPE(PageView);
int selected = this->page.getSelectedLayerId();
GdkRectangle matchRect = { x - 10, y - 10, 20, 20 };
Stroke * strokeMatch = NULL;
double gap = 1000000000;
Element * elementMatch = NULL;
// clear old selection anyway
this->xournal->getControl()->clearSelection();
ListIterator<Layer*> it = this->page.layerIterator();
while (it.hasNext() && selected) {
Layer * l = it.next();
ListIterator<Element *> eit = l->elementIterator();
while (eit.hasNext()) {
Element * e = eit.next();
if (e->intersectsArea(&matchRect)) {
if (e->getType() == ELEMENT_STROKE) {
Stroke * s = (Stroke *) e;
double tmpGap = 0;
if (s->intersects(x, y, 5, &tmpGap)) {
if (gap > tmpGap) {
gap = tmpGap;
strokeMatch = s;
}
}
} else {
elementMatch = e;
}
}
}
selected--;
}
if (strokeMatch) {
elementMatch = strokeMatch;
}
if (elementMatch) {
xournal->setSelection(new EditSelection(xournal->getControl()->getUndoRedoHandler(), elementMatch, this, page));
repaintPage();
}
}
示例4: render
void Scene::render(Pixel* px, Vertex *eyePoint, double attenuation)
{
//create the zbuffer matrix
int width = px->getWidth();
int height = px->getHeight();
Matrix* zbuffer = new Matrix(height, width); //rows come first
//populate zbuffer with -1
for (int i = 1; i <= height; i++)
{
for (int j = 1; j <= width; j++)
{
zbuffer->setElement(i, j, -1.0);
}
}
//loop over all the Instance instances in the Scene and render them
ListIterator<TransformNode>* ioIter = transformNodes->iterator();
while (ioIter->hasNext())
{
TransformNode* tn = ioIter->next();
tn->render(px, sceneTransform, zbuffer, ambientLight, pointLight, eyePoint, attenuation);
}
delete ioIter;
delete zbuffer;
}
示例5: saveToKeyFile
void ToolbarData::saveToKeyFile(GKeyFile* config)
{
XOJ_CHECK_TYPE(ToolbarData);
const char* group = getId().c_str();
std::vector<ToolbarEntry>::iterator it;
for (it = this->contents.begin(); it != this->contents.end(); it++)
{
ToolbarEntry& e = *it;
String line = "";
ListIterator<ToolbarItem*> it = e.iterator();
while (it.hasNext())
{
line += ",";
line += *it.next();
}
if (line.length() > 2)
{
g_key_file_set_string(config, group, e.getName().c_str(),
line.substring(1).c_str());
}
}
g_key_file_set_string(config, group, "name", this->name.c_str());
}
示例6: start
void SystemTimer::start(void)
{
updateHiddenDelays();
ListIterator<TickListener*> iter = tlList.getListIterator();
iter.reset();
while (iter.hasNext())
{
TickListener *tl = iter.next();
if (tl != NULL)
tl->onTick();
}
while (time < stoptime)
{
time++;
ListIterator< List<Line*>* > refIter = refLists.getListIterator();
refIter.reset();
while (refIter.hasNext())
{
List<Line*> *list = refIter.next();
Line *line = list->first();
if (line != NULL)
line->update();
}
updateHiddenDelays();
if (clock != NULL)
clock->tick();
updateHiddenDelays();
ListIterator<TickListener*> iter = tlList.getListIterator();
iter.reset();
while (iter.hasNext())
{
TickListener *tl = iter.next();
if (tl != NULL)
tl->onTick();
}
}
}
示例7: render
/**
* render
* Renders the scene.
* Preconditions:
* The pixel object.
* Postconditions:
* The scene is rendered when the final render method is reached.
*/
void Scene::render( Pixel* pix )
{
ListIterator<Node>* iter = scene->iterator();
while( iter->hasNext() ) {
iter->next()->render( pix, wnd );
}
delete iter;
}
示例8: render
/**
* render
* Renders the basic object.
* Preconditions:
* The windowing transform matrix, the pixel object.
* Postconditions:
* Calls the next render method within the hierarchy.
*/
void BasicObject::render( Matrix* wnd, Pixel* pix, Color* material,
Matrix* zbuffer )
{
ListIterator<Face>* iter = faces->iterator();
while( iter->hasNext() ) {
iter->next()->render( wnd, pix, material, zbuffer );
}
delete iter;
}
示例9: addFace
/**
* addFace
* Adds a new face to the object.
* Preconditions:
* The face to add to the object.
* Postconditions:
* A new face is added to the faces list.
* The vertices from the new face is added to the vertices list.
*/
void BasicObject::addFace( Face* face )
{
faces->add( face );
ListIterator<Vertex>* iter = face->getVertices()->iterator();
while ( iter->hasNext() ) {
vertices->add( iter->next() );
}
delete iter;
}
示例10: while
Scene::~Scene()
{
ListIterator<Node>* iter = scene->iterator();
while ( iter->hasNext() ) {
iter->next()->removeRef();
}
delete iter;
delete scene;
delete wnd;
}
示例11: render
void TransformNode::render(Pixel* pix, Matrix* mat)
{
ListIterator<Node>* iter = nodes->iterator();
while(iter->hasNext())
{
iter->next()->render(pix, mat->multiply(transform));
}
delete iter;
}
示例12: destroyModules
void HiddenModuleManager::destroyModules(void)
{
ListIterator<Module*> li = modList.getListIterator();
li.reset();
while (li.hasNext())
{
Module *mod = li.next();
if (mod != NULL)
delete mod;
}
}
示例13: while
TransformNode::~TransformNode()
{
ListIterator<Node>* iter = children->iterator();
while (iter->hasNext())
{
Node* node = iter->next();
node->removeRef();
}
delete children;
delete iter;
}
示例14: render
void BasicObject::render(Pixel* pix, Matrix* transformMatrix)
{
int count = 1;
ListIterator<Face>* iter = faces.iterator();
while(iter->hasNext())
{
//printf("\nPrinting face #%d", count);
count++;
iter->next()->render(pix, transformMatrix);
}
delete iter;
}
示例15: startText
void PageView::startText(double x, double y) {
XOJ_CHECK_TYPE(PageView);
this->xournal->endTextAllPages(this);
if (this->textEditor == NULL) {
// Is there already a textfield?
ListIterator<Element *> eit = this->page.getSelectedLayer()->elementIterator();
Text * text = NULL;
while (eit.hasNext()) {
Element * e = eit.next();
if (e->getType() == ELEMENT_TEXT) {
GdkRectangle matchRect = { x - 10, y - 10, 20, 20 };
if (e->intersectsArea(&matchRect)) {
text = (Text *) e;
break;
}
}
}
bool ownText = false;
if (text == NULL) {
ToolHandler * h = xournal->getControl()->getToolHandler();
ownText = true;
text = new Text();
text->setX(x);
text->setY(y);
text->setColor(h->getColor());
text->setFont(settings->getFont());
}
this->textEditor = new TextEditor(this, xournal->getWidget(), text, ownText);
if (!ownText) {
this->textEditor->mousePressed(x - text->getX(), y - text->getY());
}
rerenderPage();
} else {
Text * text = this->textEditor->getText();
GdkRectangle matchRect = { x - 10, y - 10, 20, 20 };
if (!text->intersectsArea(&matchRect)) {
endText();
} else {
this->textEditor->mousePressed(x - text->getX(), y - text->getY());
}
}
}