BOOL
CConvertWizardSheet::PreTranslateMessage(MSG* pMsg)
{
    PGPBoolean	weProcessed	= FALSE;
    PGPUInt8	vCode;
    PGPUInt32	activeIndex, randomIndex;

    switch (pMsg->message)
    {
    case WM_KEYDOWN:
        vCode = pMsg->wParam & 0x7F;

        activeIndex	= GetActiveIndex();
        randomIndex	= GetPageIndex(&mRandomDataPage);

        if ((activeIndex == randomIndex) &&
                !mRandomDataPage.mIsDoneCollecting)
        {
            // Punt key messages down for random data collection.
            mRandomDataPage.PostMessage(pMsg->message, pMsg->wParam,
                                        pMsg->lParam);

            weProcessed = TRUE;
        }
        break;
    }

    return (weProcessed ? TRUE : CPropertySheet::PreTranslateMessage(pMsg));
}
// Get preferences set from N samples
std::vector<bm::bvector<> *> *RandomSampler::GetNSampleAndPreferenceSet(float nInlierThreshold, unsigned int nSampleN, std::vector<bm::bvector<> *> *nPrevPointsPrefSet, unsigned int nModelSpanN, std::vector<std::vector<float> *> *nPrevModels, void (*OnProgress)(float)){

	// TODO: Add multithreading support to this function.

	// Allocate empty bit vector
	if(nPrevPointsPrefSet == NULL){
		nPrevPointsPrefSet = new std::vector<bm::bvector<> *>(mMaxAllocablePoints);
		for(unsigned int i=0; i < mMaxAllocablePoints; i++)
			(*nPrevPointsPrefSet)[i] = new bm::bvector<>;
	}

	assert(nPrevPointsPrefSet->size() == mMaxAllocablePoints);

	if(this->mActivePoints < this->mMSS){
		return nPrevPointsPrefSet;
	}

	// Get all the sample
	for(unsigned int n=0; n<nSampleN; n++){

		unsigned int currentModelIndex = nModelSpanN + n;

		std::vector<unsigned int> nSample(mMSS);

		if(OnProgress != NULL)
			OnProgress((float)n / (float)nSampleN);
		
		#ifdef _DEBUG
		// If we are in debug mode, generate hypotesis in a non random way
			static unsigned int nCounter = 0;
			nCounter = nCounter % this->mActivePoints;
			nSample[0] = (unsigned int)GetActiveIndex(nCounter);
			nCounter++;
		#else
			nSample[0] = (unsigned int)RandomSampleOnCumSumHist (mNeighCustomVecFCumSum);
		#endif

		GetNonFirstSamples(&nSample);
		
		std::vector<float> *nModelParams =	mGetFunction(mDataPoints, nSample);
		for(unsigned int i=0; i < mMaxAllocablePoints; i++) {
			if(mDataPoints[i]->mActive && (*mDistanceFunction)(*nModelParams, *mDataPoints[i]->mCoord) <nInlierThreshold ){
				// Fill bit vector
				assert(!(*(*nPrevPointsPrefSet)[i])[currentModelIndex]);
				(*(*nPrevPointsPrefSet)[i])[currentModelIndex] = true;
			}
		}
		if(nPrevModels == NULL)
			delete (nModelParams);
		else
			(*nPrevModels)[currentModelIndex] = nModelParams;

	}
	
	for(unsigned int i=0; i<mMaxAllocablePoints; i++)
		if(mDataPoints[i]->mActive)
			(*nPrevPointsPrefSet)[i]->optimize();

	return nPrevPointsPrefSet;
}
Example #3
0
LRESULT CPropSheet::WizardBack()//前一页面
{
	int nPrint = _wtoi(g_sorFileArray.reportConfig.Print); //是否为报表
	int nActivePage = GetActiveIndex();
	switch (nActivePage)
	{
	case REPORT_PAGE::PROP_SETTING:
		break;	
	
	case REPORT_PAGE::PROP_FILE_SELECT:
		{
			SetActivePage(PROP_SETTING);
			break;
		}
	
	case PROP_CONFIG:
		{
			//SetActivePage(PROP_FILE_SELECT);
			MAIN->ShowMainSetting(TRUE);
			break;
		}
	
	case REPORT_PAGE::PROP_OUTPUT:
		{
			//MAIN->ShowMainSetting(TRUE);
			SetActivePage(PROP_CONFIG);
			break;
		}
	}

	return 0;
}
Example #4
0
BOOL MeaPreferences::OnCommand(WPARAM wParam, LPARAM lParam)
{
    UINT const id = LOWORD( wParam );

    if (IDOK == id || IDCANCEL ==id) {
        // HACK: CPropertySheet::GetActiveIndex() behaves differently depending
        // on whether the window exists [e.g. whether inside DoModal()].
        // If window exists, it actually asks the tab control for the active
        // page. Otherwise it merely returns m_psh.nStartPage -- meaning that
        // after DoModal() returns, the value is simply what we startedwith.
        // This makes it impossible to bring up the sheet next time with
        // whatever page the user last had active -- a desirable behavior.
        //
        // To make GetActivePage() return what page the user actually had
        // active, stuff the value in m_psh.nStartPage here. Note that this
        // makes any static CGenPropertySheet instances retain the active page
        // automatically. Non-static instances will need to save the
        // GetActiveIndex() value in a static variable and call SetActivePage()
        // on the next creation/invocation.
        //
        m_psh.nStartPage = GetActiveIndex();
    }

    return CPropertySheet::OnCommand(wParam, lParam);
}
Example #5
0
void CTreePropSheet::ActivatePreviousPage()
{
	if (!IsWindow(m_hWnd))
		return;

	if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
	{
		// normal tab property sheet. Simply use page index
		int	nPageIndex = GetActiveIndex();
		if (nPageIndex<0 || nPageIndex>=GetPageCount())
			return;

		int	nPrevIndex = (nPageIndex==0)? GetPageCount()-1 : nPageIndex-1;
		SetActivePage(nPrevIndex);
	}
	else
	{
		// property sheet with page tree.
		// we need a more sophisticated handling here, than simply using
		// the page index, because we won't skip empty pages.
		// so we have to walk the page tree
		HTREEITEM	hItem = m_pwndPageTree->GetSelectedItem();
		ASSERT(hItem);
		if (!hItem)
			return;

		HTREEITEM	hPrevItem = NULL;
		if (hPrevItem=m_pwndPageTree->GetPrevSiblingItem(hItem))
		{
			while (m_pwndPageTree->ItemHasChildren(hPrevItem))
			{
				hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
				while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
					hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
			}
		}
		else 
			hPrevItem=m_pwndPageTree->GetParentItem(hItem);

		if (!hPrevItem)
		{
			// no prev item, so cycle to the last item
			hPrevItem = m_pwndPageTree->GetRootItem();

			while (TRUE)
			{
				while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
					hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);

				if (m_pwndPageTree->ItemHasChildren(hPrevItem))
					hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
				else
					break;
			}
		}

		if (hPrevItem)
			m_pwndPageTree->SelectItem(hPrevItem);
	}
}
Example #6
0
void CClientWizSheet::OnHelp() 
{
	DWORD helpID=0;

	
	// TODO: might want to use the p4win.hm file for topic IDs in the help
	// file, and then call SetHelpID for each property page.  Then see what 
	// happens when OnHelp() isnt handled here..

	// Currently, the app's WinHelp function always sets HELP_FINDER mode
	// So long as items with no help do not have help IDs, it will be 
	// possible to have the app help function still run HELP_FINDER when
	// the help ID is not provided.

	switch(GetActiveIndex())
	{
	case 0: helpID= INTRO_CLIENT_WORKSPACE; break;
	case 1: helpID= INTRO_CLIENT_WORKSPACE; break;
	default:
		ASSERT(0);
	}

	if(helpID)
		AfxGetApp()->WinHelp(helpID);
	else
		CPropertySheet::OnHelp();
}
Example #7
0
void CPreferencesDlg::OnHelp()
{
	int iCurSel = GetActiveIndex();
	//Xman no crash on F1 (remark: 12 pages are official)
	/*
	if (iCurSel >= 0)
	*/
	if (iCurSel >= 0 && iCurSel<=12)
	//Xman end
	{
		CPropertyPage* pPage = GetPage(iCurSel);
		if (pPage)
		{
			HELPINFO hi = {0};
			hi.cbSize = sizeof hi;
			hi.iContextType = HELPINFO_WINDOW;
			hi.iCtrlId = 0;
			hi.hItemHandle = pPage->m_hWnd;
			hi.dwContextId = 0;
			pPage->SendMessage(WM_HELP, 0, (LPARAM)&hi);
			return;
		}
	}

	theApp.ShowHelp(0, HELP_CONTENTS);
}
Example #8
0
inline bool
OrderedTask::RunDijsktraMin(const GeoPoint &location)
{
  const unsigned task_size = TaskSize();
  if (task_size < 2)
    return false;

  if (dijkstra_min == nullptr)
    dijkstra_min = new TaskDijkstraMin();
  TaskDijkstraMin &dijkstra = *dijkstra_min;

  const unsigned active_index = GetActiveIndex();
  dijkstra.SetTaskSize(task_size - active_index);
  for (unsigned i = active_index; i != task_size; ++i) {
    const SearchPointVector &boundary = task_points[i]->GetSearchPoints();
    dijkstra.SetBoundary(i - active_index, boundary);
  }

  SearchPoint ac(location, task_projection);
  if (!dijkstra.DistanceMin(ac))
    return false;

  for (unsigned i = active_index; i != task_size; ++i)
    SetPointSearchMin(i, dijkstra.GetSolution(i - active_index));

  return true;
}
Example #9
0
void CPreferencesDlg::OnHelp() 
{
	// who is the active page?
	int nSel = GetActiveIndex();
	CString sHelpPage = "prefs";
	
	switch (nSel)
	{
	case PREFPAGE_GEN:
		sHelpPage += "#General";
		break;
		
	case PREFPAGE_MULTIUSER:
		sHelpPage += "#MultiUserControl";
		break;
		
	case PREFPAGE_FILE:
		sHelpPage += "#FileActions";
		break;

	case PREFPAGE_FILE2:
		sHelpPage += "#FileActionsmore";
		break;
		
	case PREFPAGE_UI:
		sHelpPage += "#UserInterfacegtGeneral";
		break;
		
	case PREFPAGE_UITASK:
		sHelpPage += "#UserInterfacegtTasklistgtAttributes";
		break;
		
	case PREFPAGE_UIFONTCOLOR:
		sHelpPage += "#UserInterfacegtTasklistgtFontsandColours";
		break;
		
	case PREFPAGE_TASK:
		sHelpPage += "#TasksgtAttributeCalculations";
		break;
		
	case PREFPAGE_TASKDEF:
		sHelpPage += "#TasksgtDefaultTaskAttributes";
		break;
		
	case PREFPAGE_TOOL:
		sHelpPage += "#Tools";
		break;
		
	case PREFPAGE_SHORTCUT:
		sHelpPage += "#KeyboardShortcuts";
		break;

	default:
		ASSERT(0);
		break;
	}
	
	AfxGetApp()->WinHelp((DWORD)(LPCTSTR)sHelpPage);
}
Example #10
0
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg)
{
	// TODO: 在此添加专用代码和/或调用基类
/*
	if(pMsg!=NULL && pMsg->message == WM_LBUTTONDOWN)
	{
		CWnd *pWnd = (CWnd*)CPropertySheet::GetTabControl();
		if(pWnd !=NULL &&pWnd->GetSafeHwnd() == pMsg->hwnd)
		{
			::SendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
			if(GetActiveIndex() == 0)
			{

			}else
			{

			}
			return TRUE;
		}
	}
*/
	if(pMsg->message == WM_KEYUP && pMsg->wParam ==  VK_PRIOR)
	{
		if(GetPageCount()>1)
		{
			if(GetActiveIndex()==0)
				SetActivePage(GetPageCount()-1);
			else
				SetActivePage(GetActiveIndex()-1);
		}
	}

	if(pMsg->message == WM_KEYUP && pMsg->wParam == VK_NEXT)
	{
		if(GetPageCount()>1)
		{
			if(GetActiveIndex()==(GetPageCount()-1))
				SetActivePage(0);
			else
				SetActivePage(GetActiveIndex()+1);
		}
	}


	return CPropertySheet::PreTranslateMessage(pMsg);
}
Example #11
0
void OptionsDlg::OnDestroy()
{
	active_page_index_ = GetActiveIndex();

	position_.StoreState(*this);

	CPropertySheet::OnDestroy();
}
Example #12
0
void CPreferencesDlg::OnDestroy()
{
	CTreePropSheet::OnDestroy();
	if (m_bSaveIniFile)
	{
		thePrefs.Save();
		m_bSaveIniFile = false;
	}
	m_pPshStartPage = GetPage(GetActiveIndex())->m_psp.pszTemplate;
}
Example #13
0
void CMainWizard::OnInitMenuPopup(CMenu* pPopupMenu, UINT uIndex, BOOL fSysMenu)
{
	__super::OnInitMenuPopup(pPopupMenu, uIndex, fSysMenu);

	if (fSysMenu)
	{
		ASSERT_VALID(pPopupMenu);
		UINT fuEnable = MF_BYCOMMAND | (GetActiveIndex() > 0 ? MF_GRAYED : MF_ENABLED);
		pPopupMenu->EnableMenuItem(IDM_SC_IMPORT_SETTINGS, fuEnable); 
	}
}
Example #14
0
void MeaPreferences::OnApply()
{
    if (GetActivePage()->OnKillActive()) {
        GetActivePage()->UpdateData(TRUE);
        GetParent()->SendMessage(MeaPrefsApplyMsg, 0, GetActiveIndex());
        m_calibrationPrefs.SetModified(FALSE);
        m_rulerPrefs.SetModified(FALSE);
        m_toolsPrefs.SetModified(FALSE);
        m_precisionPrefs.SetModified(FALSE);
        m_customPrefs.SetModified(FALSE);
        m_advancedPrefs.SetModified(FALSE);
    }
}
Example #15
0
void CTreePropSheet::ActivateNextPage()
{
	if (!IsWindow(m_hWnd))
		return;

	if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
	{
		// normal tab property sheet. Simply use page index
		int	nPageIndex = GetActiveIndex();
		if (nPageIndex<0 || nPageIndex>=GetPageCount())
			return;

		int	nNextIndex = (nPageIndex==GetPageCount()-1)? 0 : nPageIndex+1;
		SetActivePage(nNextIndex);
	}
	else
	{
		// property sheet with page tree.
		// we need a more sophisticated handling here, than simply using
		// the page index, because we won't skip empty pages.
		// so we have to walk the page tree
		HTREEITEM	hItem = m_pwndPageTree->GetSelectedItem();
		ASSERT(hItem);
		if (!hItem)
			return;

		HTREEITEM	hNextItem = NULL;
		if (hNextItem=m_pwndPageTree->GetChildItem(hItem))
			;
		else if (hNextItem=m_pwndPageTree->GetNextSiblingItem(hItem))
			;
		else if (m_pwndPageTree->GetParentItem(hItem))
		{
			while (!hNextItem)
			{
				hItem = m_pwndPageTree->GetParentItem(hItem);
				if (!hItem)
					break;

				hNextItem	= m_pwndPageTree->GetNextSiblingItem(hItem);
			}
		}

		if (!hNextItem)
			// no next item -- so cycle to the first item
			hNextItem = m_pwndPageTree->GetRootItem();

		if (hNextItem)
			m_pwndPageTree->SelectItem(hNextItem);
	}
}
Example #16
0
int CSheetExchMain::Apply()
{
	int iEnd = GetPageCount();
 	int iRet = 0;
 	int iActive = GetActiveIndex();
 
 	CWizPageExchBase* pPage = (CWizPageExchBase*)GetPage(iActive);
 	if( pPage == NULL )
 		return -1;
 	pPage->SetData();
 	pPage->SaveOption();
	
	return 0;
}
Example #17
0
void CMainDlg::OnChatMsg(network::CChatMsg *pMsg)
{
	AssertBotE(pMsg);
	switch (GetActiveIndex())
	{
	case 1:
		m_pChooseRace->AddChatMsg(pMsg->GetSenderName(), pMsg->GetMessage());
		break;

	case 2:
//		m_pPlayGame->AddChatMsg(pMsg);
		break;
	}
}
Example #18
0
fixed
OrderedTask::scan_distance_min(const GeoPoint &location, bool full)
{
  if (full) {
    if (dijkstra_min == NULL)
      dijkstra_min = new TaskDijkstraMin(*this);

    SearchPoint ac(location, task_projection);
    if (dijkstra_min->DistanceMin(ac)) {
      for (unsigned i = GetActiveIndex(), end = TaskSize(); i != end; ++i)
        set_tp_search_min(i, dijkstra_min->GetSolution(i));
    }

    m_location_min_last = location;
  }
  return taskpoint_start->scan_distance_min();
}
Example #19
0
inline fixed
OrderedTask::ScanDistanceMin(const GeoPoint &location, bool full)
{
  if (full) {
    if (dijkstra_min == NULL)
      dijkstra_min = new TaskDijkstraMin();

    SearchPoint ac(location, task_projection);
    if (dijkstra_min->DistanceMin(*this, ac)) {
      for (unsigned i = GetActiveIndex(), end = TaskSize(); i != end; ++i)
        SetPointSearchMin(i, dijkstra_min->GetSolution(i));
    }

    last_min_location = location;
  }

  return taskpoint_start->ScanDistanceMin();
}
void CTreePropertySheet::OnPaint() 
{
	CPaintDC	dc(this); // device context for painting
	TEXTMETRIC	tm;
	
	RenderCaptionBar();

	m_cCaptionDC.FitInto(m_rcCaptionBar.Width(),
						 m_rcCaptionBar.Height());

	m_cCaptionDC.BitBlt(0,0,m_rcCaptionBar.Width(),m_rcCaptionBar.Height(),
						&m_cCaptionBarDC,0,0,SRCCOPY);

	CSize		extent;
	CFont		*pOldFont;
	int			nPage=GetActiveIndex();
	cPropPage&	curPage=m_acPropPages[nPage];

	pOldFont	=m_cCaptionDC.GetCurrentFont();

	m_cCaptionDC.SelectObject(m_pCaptionFont);
	m_cCaptionDC.GetTextMetrics(&tm);
	m_cCaptionDC.SetTextColor(m_clrCaptionTextLeft);
	m_cCaptionDC.SetBkMode(TRANSPARENT);
	m_cCaptionDC.TextOut(5,m_nCaptionHeight-tm.tmAscent-tm.tmDescent-2,
						 curPage.sCaption);

	m_cCaptionDC.SelectObject(m_pCaptionDescrFont);
	m_cCaptionDC.GetTextMetrics(&tm);
	m_cCaptionDC.SetTextColor(m_clrCaptionTextRight);
	m_cCaptionDC.SetBkMode(TRANSPARENT);
	extent		=m_cCaptionDC.GetTextExtent(curPage.sCaptionDescr);
	m_cCaptionDC.TextOut(m_rcCaptionBar.Width()-4-extent.cx,m_nCaptionHeight-tm.tmAscent-tm.tmDescent-4,
						 curPage.sCaptionDescr);
					
	dc.BitBlt(	m_rcCaptionBar.left,
				m_rcCaptionBar.top,
				m_rcCaptionBar.Width(),
				m_rcCaptionBar.Height(),
				&m_cCaptionDC,0,0,
				SRCCOPY);
}
void CTreePropSheetBase::ActivatePreviousPage()
{
	if( !IsWindow(m_hWnd) || 0 == GetPageCount() )
		return;

	if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
	{
		// normal tab property sheet. Simply use page index
		int	nPageIndex = GetActiveIndex();
		if (nPageIndex<0 || nPageIndex>=GetPageCount())
			return;

		int	nPrevIndex = (nPageIndex==0)? GetPageCount()-1 : nPageIndex-1;
		SetActivePage(nPrevIndex);
	}
	else
	{
		HTREEITEM	hItem = m_pwndPageTree->GetSelectedItem();
    ActivatePreviousPage( hItem );
	}
}
void CTreePropSheetBase::ActivateNextPage()
{
  // Window must be defined and a least one property page.
	if (!IsWindow(m_hWnd) || 0 == GetPageCount() )
		return;

	if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
	{
		// normal tab property sheet. Simply use page index
		int	nPageIndex = GetActiveIndex();
		if (nPageIndex<0 || nPageIndex>=GetPageCount())
			return;

		int	nNextIndex = (nPageIndex==GetPageCount()-1)? 0 : nPageIndex+1;
		SetActivePage(nNextIndex);
	}
	else
	{
		HTREEITEM	hItem = m_pwndPageTree->GetSelectedItem();
    ActivateNextPage( hItem );
	}
}
//-------------------------------  Function  -----------------------------------
BOOL CSheetConfigGSD::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	WORD wSwitch = (WORD)wParam;
	switch (wSwitch)	{
	case ID_HELP: // F1 KEY
	case IDHELP:  // HELP BUTTON
		if (m_pHelpConnection)	{
			DWORD dwIndex = GetActiveIndex();
			if (dwIndex == 2 && !m_bHasExtUserPrm)
				dwIndex = 4;
			// dwIndex:	0 -> Slave Infos
			//			1 -> Modules
			//			2 -> Extended Parameters
			//			3 -> Error Messages
			//			4 -> Config and Userdata
			m_pHelpConnection->CallHelpWithIndex(dwIndex);
		}
		break;
	default:
		break;
	}
	return CPropertySheet::OnCommand(wParam, lParam);
}
Example #24
0
fixed
OrderedTask::ScanDistanceMax()
{
  if (task_points.empty()) // nothing to do!
    return fixed_zero;

  assert(active_task_point < task_points.size());

  // for max calculations, since one can still travel further in the
  // sector, we pretend we are on the previous turnpoint so the
  // search samples will contain the full boundary
  const unsigned atp = active_task_point;
  if (atp) {
    active_task_point--;
    taskpoint_start->ScanActive(*task_points[active_task_point]);
  }

  if (dijkstra_max == NULL)
    dijkstra_max = new TaskDijkstraMax(*this);

  if (dijkstra_max->DistanceMax()) {
    for (unsigned i = 0, active = GetActiveIndex(), end = TaskSize();
         i != end; ++i) {
      const SearchPoint &solution = dijkstra_max->GetSolution(i);
      SetPointSearchMax(i, solution);
      if (i <= active)
        set_tp_search_achieved(i, solution);
    }
  }

  if (atp) {
    active_task_point = atp;
    taskpoint_start->ScanActive(*task_points[active_task_point]);
  }
  return taskpoint_start->ScanDistanceMax();
}
Example #25
0
BOOL DlgPropSheet::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT *pLResult) {
	// Save last tab
	m_nLastTab = GetActiveIndex();
	return CPropertySheet::OnChildNotify(message, wParam, lParam, pLResult);
}
void CGameOptionsPropSheet::OnHelp()
{
	int nPageIndex = GetActiveIndex();
	int nHelpContextID = DIALOG_GAME_OPTIONS_INTERFACE_PAGE + nPageIndex;
	WinHelp(nHelpContextID);
}
void CDispOptionsPropSheet::OnHelp()
{
	int nPageIndex = GetActiveIndex();
	int nHelpContextID = DIALOG_DISPLAY_OPTIONS_SUITS_PAGE + nPageIndex;
	WinHelp(nHelpContextID);
}
void CFileDetailDialog::OnDestroy()
{
	if (m_uPshInvokePage == 0)
		m_pPshStartPage = GetPage(GetActiveIndex())->m_psp.pszTemplate;
	CListViewWalkerPropertySheet::OnDestroy();
}
Example #29
0
LRESULT CPropSheet::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
    lastPage = GetActiveIndex();
    return 0;
}
Example #30
0
inline bool
OrderedTask::RunDijsktraMax()
{
  const unsigned task_size = TaskSize();
  if (task_size < 2)
    return false;

  if (dijkstra_max == nullptr)
    dijkstra_max = new TaskDijkstraMax();
  TaskDijkstraMax &dijkstra = *dijkstra_max;

  const unsigned active_index = GetActiveIndex();
  dijkstra.SetTaskSize(task_size);
  for (unsigned i = 0; i != task_size; ++i) {
    const SearchPointVector &boundary = i == active_index
      /* since one can still travel further in the current sector, use
         the full boundary here */
      ? task_points[i]->GetBoundaryPoints()
      : task_points[i]->GetSearchPoints();
    dijkstra_max->SetBoundary(i, boundary);
  }

  double start_radius(-1), finish_radius(-1);
  if (subtract_start_finish_cylinder_radius) {
    /* to subtract the start/finish cylinder radius, we use only the
       nominal points (i.e. the cylinder's center), and later replace
       it with a point on the cylinder boundary */

    const auto &start = *task_points.front();
    start_radius = GetCylinderRadiusOrMinusOne(start);
    if (start_radius > 0)
      dijkstra.SetBoundary(0, start.GetNominalPoints());

    const auto &finish = *task_points.back();
    finish_radius = GetCylinderRadiusOrMinusOne(finish);
    if (finish_radius > 0)
      dijkstra.SetBoundary(task_size - 1, finish.GetNominalPoints());
  }

  if (!dijkstra_max->DistanceMax())
    return false;

  for (unsigned i = 0; i != task_size; ++i) {
    SearchPoint solution = dijkstra.GetSolution(i);

    if (i == 0 && start_radius > 0) {
      /* subtract start cylinder radius by finding the intersection
         with the cylinder boundary */
      const GeoPoint &current = task_points.front()->GetLocation();
      const GeoPoint &neighbour = dijkstra.GetSolution(i + 1).GetLocation();
      GeoPoint gp = current.IntermediatePoint(neighbour, start_radius);
      solution = SearchPoint(gp, task_projection);
    }

    if (i == task_size - 1 && finish_radius > 0) {
      /* subtract finish cylinder radius by finding the intersection
         with the cylinder boundary */
      const GeoPoint &current = task_points.back()->GetLocation();
      const GeoPoint &neighbour = dijkstra.GetSolution(i - 1).GetLocation();
      GeoPoint gp = current.IntermediatePoint(neighbour, finish_radius);
      solution = SearchPoint(gp, task_projection);
    }

    SetPointSearchMax(i, solution);
    if (i <= active_index)
      set_tp_search_achieved(i, solution);
  }

  return true;
}