void RDirNode::applyForces(QuadTree & quadtree) { //child nodes for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* node = (*it); node->applyForces(quadtree); } if(parent == 0) return; DirForceFunctor dff(this); quadtree.visitItemsInBounds(quadItemBounds, dff); gGourceDirNodeInnerLoops += dff.getLoopCount(); //always call on parent no matter how far away applyForceDir(parent); //pull towards parent float parent_dist = distanceToParent(); // * dirs should attract to sit on the radius of the parent dir ie: // should attract to distance_to_parent * normal_to_parent accel += gGourceForceGravity * parent_dist * normalise(parent->getPos() - pos); // * dirs should be pushed along the parent_parent to parent normal by a force smaller than the parent radius force RDirNode* pparent = parent->getParent(); if(pparent != 0) { vec2 parent_edge = (parent->getPos() - pparent->getPos()); vec2 parent_edge_normal = normalise(parent_edge); vec2 dest = (parent->getPos() + (parent->getRadius() + getRadius()) * parent_edge_normal) - pos; accel += dest; } // * dirs should repulse from other dirs of this parent const std::list<RDirNode*> & siblings = parent->getChildren(); if(!siblings.empty()) { vec2 sib_accel; int visible = 1; for(std::list<RDirNode*>::const_iterator it = siblings.begin(); it != siblings.end(); it++) { RDirNode* node = (*it); if(node == this) continue; if(!node->isVisible()) continue; visible++; sib_accel -= normalise(node->getPos() - pos); } //parent circumfrence divided by the number of visible child nodes if(visible>1) { float slice_size = (parent->getRadius() * PI) / (float) (visible+1); sib_accel *= slice_size; accel += sib_accel; } } }
bool PerigeeMove::Run() { if ( m_options.debug_prompt ) { DlgConfirmDelete dcd(m_files); CString csCaption; CString csTempl; CString csPrompt; csCaption.LoadString(IDS_CONFIRM_MOVE); csTempl.LoadString(IDS_CONFIRM_MOVE_PROMPT_TEMPL); csPrompt.Format(csTempl, (LPCTSTR)m_files[0].dest); dcd.ChangeCaption(csCaption, csPrompt); if ( IDCANCEL == dcd.DoModal() ) { return false; } } m_progress.ShowWindow(SW_SHOW); // On Windows Vista, verify the user has permission to create files // in the destination folder, and prompt for elevation otherwise if (!m_files.empty() && EnableElevatePrompt() && !VistaHelper::CheckAccess(m_files[0].dest, GENERIC_WRITE, m_token)) { CString message; message.Format(IDS_ELEVATION_REQUIRED_TO_CREATE_FILES_IN_FOLDER, m_files[0].dest); DoElevatePrompt(message); if (m_cancel) return false; } PostPrompt(); Reset(); if (!InitIt()) return false; for(;;) { Reset(); if ( DoIt() ) { return true; } if ( m_cancel ) return false; bool retry = false; // if we're in "postpone" mode, enable prompting now if (m_options.overwrite == CPerigeeCopyOptions::overwrite_postpone) { retry = true; m_options.overwrite = CPerigeeCopyOptions::overwrite_prompt; } // show skipped files dialog if (!retry) { PrePrompt(false); CDialogFailedFiles dff(NULL, m_error_files); retry = IDOK == dff.DoModal(); PostPrompt(); } if ( retry ) { // move failed files back to source list and try again m_files.clear(); for(file_list::iterator it = m_error_files.begin(); it != m_error_files.end(); ++it) { if ( it->error_type < warn_first ) { m_files.push_back(*it); } } } else { return false; } } }