void Spiral::fillGrid() { Coordinate pos; Direction dir = Up; pos.x = pos.y = m / 2; int count = m * m; int index = 1; while(index <= count) { visit(pos, index++); Direction ideal = getIdealDirection(dir); Coordinate next = getNextCoordinate(ideal, pos); if(hasVisited(next)) next = getNextCoordinate(dir, pos); else dir = ideal; pos = next; } for(int i = 0; i < m; ++i) delete [] visited[i]; delete [] visited; visited = nullptr; }
virtual void visit(ossimConnectableObject* obj) { if(!hasVisited(obj)) { ossimImageHandler* handler = dynamic_cast<ossimImageHandler*>(obj); ossimHistogramSource* histoSource = dynamic_cast<ossimHistogramSource*>(obj); if(handler) { ossimFilename file = handler->createDefaultHistogramFilename(); if(file.exists()) { m_histogram = new ossimMultiResLevelHistogram(); if(!m_histogram->importHistogram(file)) { stopTraversal(); m_histogram = 0; } } } else if(histoSource) { m_histogram = histoSource->getHistogram(); if(m_histogram.valid()) { stopTraversal(); } } } ossimVisitor::visit(obj); }
//--------- void RouteFind::step(const Problem & problem, Route visited) { if (visited.cost > this->bestSolution.cost) return; if (visited.back() == this->end) { if (visited.cost < this->bestSolution.cost) { this->bestSolution = visited; } return; } for (int i=0; i<problem.nodeCount; i++) { if (!hasVisited(i, visited)) { Journey j(visited.back(), i); float cost = problem.getSymmetricCost(j); if (cost == -1) continue; else { Route visitBranch(visited); visitBranch.addStep(i, cost); step(problem, visitBranch); } } } }
void ossimGui::GatherImageViewProjTransVisitor::visit(ossimObject* obj) { if(!hasVisited(obj)) { ossimImageRenderer* renderer = dynamic_cast<ossimImageRenderer*>(obj); if(renderer) { ossimImageViewProjectionTransform* ivpt = dynamic_cast<ossimImageViewProjectionTransform*>(renderer->getImageViewTransform()); if(ivpt) { m_transformList.push_back(new IvtGeomTransform(ivpt, ivpt->getImageGeometry()) ); } else { ossimImageViewAffineTransform* ivat = dynamic_cast<ossimImageViewAffineTransform*>(renderer->getImageViewTransform()); if(ivat&&renderer->getInput()) { ossimTypeNameVisitor v("ossimImageHandler", true); renderer->accept(v); ossimImageHandler* handler = v.getObjectAs<ossimImageHandler>(0); if(handler) { ossimRefPtr<ossimImageGeometry> geom = handler->getImageGeometry(); if(geom.valid()) { m_transformList.push_back(new IvtGeomTransform(ivat, geom.get()) ); } } } } } ossimVisitor::visit(obj); } }
void ossimEventVisitor::visit(ossimConnectableObject* obj) { if(!hasVisited(obj)) { obj->fireEvent(*m_event); } ossimVisitor::visit(obj); }
void ossimTypeIdVisitor::visit(ossimConnectableObject* obj) { if(!hasVisited(obj)) { ossimCollectionVisitor::visit(obj); if(obj&&obj->canCastTo(m_typeId)) { m_collection.push_back(obj); if(m_firstOfTypeFlag) m_stopTraversalFlag = true; } } }
void ossimEventVisitor::visit(ossimObject* obj) { if(!hasVisited(obj)) { ossimListenerManager* manager = dynamic_cast<ossimListenerManager*> (obj); if(manager) { manager->fireEvent(*m_event); ossimVisitor::visit(obj); } } }
void ossimIdVisitor::visit(ossimConnectableObject* obj) { if ( !hasVisited(obj) ) { if(obj->getId() == m_id) { m_object = obj; m_stopTraversalFlag = true; } ossimVisitor::visit(obj); } }
void ossimElevManager::ConnectionStringVisitor::visit(ossimObject* obj) { if(!hasVisited(obj)) { ossimElevationDatabase* databsase = dynamic_cast<ossimElevationDatabase*>(obj); if(databsase) { if(m_connectionString == databsase->getConnectionString()) { m_database = databsase; m_stopTraversalFlag = true; } } } }
void ossimSourceInitializeVisitor::visit(ossimObject* obj) { if( !hasVisited(obj) ) { ossimSource* vi = dynamic_cast<ossimSource*>(obj); if ( vi ) { vi->initialize(); } // This will put the obj in the m_markNode for hasVisited method. ossimVisitor::visit(obj); } }
void ossimViewInterfaceVisitor::visit(ossimObject* obj) { if( !hasVisited(obj) ) { if ( m_view.get() ) { ossimViewInterface* vi = dynamic_cast<ossimViewInterface*>(obj); if ( vi ) { // Set the view: vi->setView( m_view.get() ); // Send property event for outputs connected to us. ossimRefPtr<ossimEvent> propEvent = new ossimPropertyEvent(obj); ossimEventVisitor ev( propEvent.get(), VISIT_OUTPUTS ); obj->accept(ev); } } // This will put the obj in the m_markNode for hasVisited method. ossimVisitor::visit(obj); } }
QColor RecursiveBacktrackerColorizer::getColorForCell(const int idx) const { auto spt = rbm.lock(); if (!spt) return pristine; if (spt->idx == idx) return current; return spt->hasVisited(idx) ? done : pristine; }