Ejemplo n.º 1
0
void initdatabases(void)
{
    if (!init) {
	clr_index();
	working(1, 0, 0);
	set_color(WHITE, BLACK);
	ftnd_mvprintw( 5, 6, "     INIT DATABASES");
	IsDoing("Init Databases");
    }

    config_read();

    InitArchive();
    InitDomain();
    InitFilearea();
    InitFilefind();
    InitFGroup();
    InitFidonetdb();
    InitFidonet();
    InitHatch();
    InitLanguage();
    InitLimits();
    InitMagics();
    InitMsgarea();
    InitMGroup();
    InitModem();
    InitNewfiles();
    InitNGroup();
    InitNodes();
    InitOneline();
    InitProtocol();
    InitService();
    InitTicarea();
    InitTtyinfo();
    InitUsers();
    InitVirus();
    InitRoute();
    InitFDB();
    InitIBC();
    if (!init) {
	clr_index();
    }
}
Ejemplo n.º 2
0
SegmentList<DataFacadeT>::SegmentList(const InternalRouteResult &raw_route,
                                      const bool extract_alternative,
                                      const unsigned zoom_level,
                                      const bool allow_simplification,
                                      const DataFacade *facade)
    : total_distance(0), total_duration(0)
{
    if (!raw_route.is_valid())
    {
        return;
    }

    if (extract_alternative)
    {
        BOOST_ASSERT(raw_route.has_alternative());
        InitRoute(raw_route.segment_end_coordinates.front().source_phantom,
                  raw_route.alt_source_traversed_in_reverse.front());
        AddLeg(raw_route.unpacked_alternative,
               raw_route.segment_end_coordinates.back().target_phantom,
               raw_route.alt_source_traversed_in_reverse.back(), false, facade);
    }
    else
    {
        InitRoute(raw_route.segment_end_coordinates.front().source_phantom,
                  raw_route.source_traversed_in_reverse.front());
        for (std::size_t raw_index = 0; raw_index < raw_route.segment_end_coordinates.size();
             ++raw_index)
        {
            AddLeg(raw_route.unpacked_path_segments[raw_index],
                   raw_route.segment_end_coordinates[raw_index].target_phantom,
                   raw_route.target_traversed_in_reverse[raw_index],
                   raw_route.is_via_leg(raw_index), facade);
            if (raw_route.is_via_leg(raw_index))
            {
                const auto &source_phantom =
                    raw_route.segment_end_coordinates[raw_index].target_phantom;
                if (raw_route.target_traversed_in_reverse[raw_index] !=
                    raw_route.source_traversed_in_reverse[raw_index + 1])
                {
                    bool traversed_in_reverse = raw_route.target_traversed_in_reverse[raw_index];
                    const extractor::TravelMode travel_mode =
                        (traversed_in_reverse ? source_phantom.backward_travel_mode
                                              : source_phantom.forward_travel_mode);
                    const bool constexpr IS_NECESSARY = true;
                    const bool constexpr IS_VIA_LOCATION = true;
                    segments.emplace_back(source_phantom.location, source_phantom.name_id, 0, 0.f,
                                          extractor::TurnInstruction::UTurn, IS_NECESSARY,
                                          IS_VIA_LOCATION, travel_mode);
                }
            }
        }
    }

    if (!allow_simplification)
    {
        // to prevent any simplifications, we mark all segments as necessary
        for (auto &segment : segments)
        {
            segment.necessary = true;
        }
    }

    Finalize(extract_alternative, raw_route, zoom_level, allow_simplification);
}
Ejemplo n.º 3
0
LRESULT C_BranchProperties::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	C_STLException::install();

	try {

		base::OnInitDialog(uMsg, wParam, lParam, bHandled);

#define LENGTH 48

		for (int n = 0; n < 3; n++) {

			C_NullDC nulldc;

			if (NULL == s_hJoinSel[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawJoinStyle(dc, n, 12, 0x800080);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hJoinSel[n]->SetHandle(meta);					
			}

			if (NULL == s_hJoinUnsel[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawJoinStyle(dc, n, 12, 0xFFFF);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hJoinUnsel[n]->SetHandle(meta);					
			}

			if (NULL == s_hJoinGrey[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawJoinStyle(dc, n, 12, 0xF0F0F0);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hJoinGrey[n]->SetHandle(meta);					
			}
		}

		for (n = 0; n < 3; n++) {

			C_NullDC nulldc;

			if (NULL == s_hEndSel[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawEndStyle(dc, n, 8, 0x800080);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hEndSel[n]->SetHandle(meta);					
			}

			if (NULL == s_hEndUnsel[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawEndStyle(dc, n, 8, 0xFFFF);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hEndUnsel[n]->SetHandle(meta);					
			}

			if (NULL == s_hEndGrey[n]->GetHandle()) {

				HENHMETAFILE meta = NULL;
				HDC metadc = CreateEnhMetaFile(nulldc.GetHandle(), NULL, NULL, NULL);

				if (metadc) {

					C_DC dc(metadc);
					DrawEndStyle(dc, n, 8, 0xF0F0F0);
				}

				meta = CloseEnhMetaFile(metadc);
				s_hEndGrey[n]->SetHandle(meta);					
			}
		}

		RECT r = { 0, 0, 0, 0 };
		m_spinWidth->Create(m_hWnd, r);

		DWORD dwExStyle = 0;

#ifdef SMARTACE

		m_spinRecurveHeight->Create(m_hWnd, r);
		m_spinRecurveRate->Create(m_hWnd, r);

		m_penEnd.Create(m_hWnd, r);
		m_penEnd.ShowWindow(TRUE);
		m_penEnd.SetDialog(this);

		m_penJoin.Create(m_hWnd, r);
		m_penJoin.ShowWindow(TRUE);
		m_penJoin.SetDialog(this);

		m_penRecurve.Create(m_hWnd, r);
		
		dwExStyle = m_penRecurve.GetWindowLong(GWL_STYLE);
		dwExStyle = m_spinRecurveRate->GetWindowLong(GWL_STYLE);	
		m_penRecurve.SetWindowLong(GWL_STYLE, dwExStyle);

		dwExStyle = m_spinRecurveRate->GetWindowLong(GWL_EXSTYLE);	
		m_penRecurve.SetWindowLong(GWL_EXSTYLE, dwExStyle);
		
		m_penRecurve.SetParent(m_hWnd);

		m_penRecurve.ShowWindow(TRUE);
		m_penRecurve.SetButton(this);

		InitEnds();
		InitJoin();

#endif

		m_penRoute.Create(m_hWnd, r);
		
		dwExStyle = m_penRoute.GetWindowLong(GWL_STYLE);
		dwExStyle = m_spinWidth->GetWindowLong(GWL_STYLE);	
		m_penRoute.SetWindowLong(GWL_STYLE, dwExStyle);

		dwExStyle = m_spinWidth->GetWindowLong(GWL_EXSTYLE);	
		m_penRoute.SetWindowLong(GWL_EXSTYLE, dwExStyle);
		
		m_penRoute.SetParent(m_hWnd);

		m_penRoute.ShowWindow(TRUE);
		m_penRoute.SetButton(this);

		HWND wnd = GetDlgItem(IDC_BTN_COLOR);
		m_btnFill.SubclassWindow(wnd);

		TCHAR w[256];
		TCHAR l[256];

		::_stprintf(w, _T("Branch"));

		::_stprintf(l, _T("Fill"));
		m_btnFill.SendMessage(TTM_TOOLTIP_LOADTEXT, reinterpret_cast<WPARAM>(w), reinterpret_cast<WPARAM>(l));

		if (m_spinWidth.get()) {

			::_stprintf(l, _T("Width"));
			m_spinWidth->SendMessage(TTM_TOOLTIP_LOADTEXT, reinterpret_cast<WPARAM>(w), reinterpret_cast<WPARAM>(l));
		}

		m_penRoute.SetItemHeight(24);

#ifdef SMARTACE

		InitRoute();

		wnd = GetDlgItem(IDC_CHK_TAPER_RECURVE);
		m_chkTaperRecurve.SubclassWindow(wnd);

		if (m_spinRecurveHeight.get()) {

			::_stprintf(l, _T("RecurveHeight"));
			m_spinRecurveHeight->SendMessage(TTM_TOOLTIP_LOADTEXT, reinterpret_cast<WPARAM>(w), reinterpret_cast<WPARAM>(l));
			m_spinRecurveHeight->SetMinValue(1);
			m_spinRecurveHeight->SetMaxValue(256);
		}

		if (m_spinRecurveRate.get()) {

			::_stprintf(l, _T("RecurveRate"));
			m_spinRecurveRate->SendMessage(TTM_TOOLTIP_LOADTEXT, reinterpret_cast<WPARAM>(w), reinterpret_cast<WPARAM>(l));
			m_spinRecurveRate->SetMinValue(1);
			m_spinRecurveRate->SetMaxValue(512);
		}

		m_penRecurve.SetItemHeight(24);

		InitRecurve();
#endif
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_BranchProperties::"));
	}


	return S_OK;
}