Add stucts to be used in gui.

This commit is contained in:
Sergey Magidovich 2015-11-30 16:10:53 +03:00 committed by Sergey Yershov
parent bc4f0d37b7
commit e585f1036a
5 changed files with 121 additions and 1 deletions

17
editor/editor.pro Normal file
View file

@ -0,0 +1,17 @@
# Editor specific things.
TARGET = editor
TEMPLATE = lib
CONFIG += staticlib warn_on
INCLUDEPATH += ../3party/opening_hours/src
ROOT_DIR = ..
include($$ROOT_DIR/common.pri)
SOURCES += \
ui2oh.cpp
HEADERS += \
opening_hours_ui.hpp \
ui2oh.hpp \

View file

@ -0,0 +1,45 @@
#pragma once
#include "std/set.hpp"
#include "std/vector.hpp"
#include "3party/opening_hours/opening_hours.hpp"
namespace editor
{
namespace ui
{
struct Time
{
int hours;
int minutes;
};
struct Timespan
{
Time from;
Time to;
};
enum class OpeningHoursTemplates
{
TwentyFourHours,
Weekdays,
AllDays
};
using TOpeningDays = set<osmoh::Weekday>;
struct TimeTable
{
bool isAllDay;
TOpeningDays weekday;
Timespan openingTime;
vector<Timespan> excludeTime;
};
using TTimeTables = vector<TimeTable>;
} // namespace ui
} // namespace editor

46
editor/ui2oh.cpp Normal file
View file

@ -0,0 +1,46 @@
#include "editor/ui2oh.hpp"
#include "std/array.hpp"
namespace
{
// osmoh::TWeekdayRanges DaysSetToRange( const & days)
// {
// TWeekdayRanges ragnes;
// Weekday previous = Weekday::None;
// for (auto const & wd : days)
// {
// auto & range = ranges.back();
// if (previous == Weekday::None)
// {
// ranges.push_back(WeekdayRange());
// range.SetStart(wd);
// }
// else if (static_cast<int>(wd) - static_cast<int>(previous) > 1)
// {
// ranges.push_back(WeekdayRange());
// range.SetStart(wd);
// }
// }
// return {};
// }
} // namespace
namespace editor
{
// osmoh::OpeningHours ConvertOpeningkHours(ui::TTimeTables const & oh)
// {
// using namespace osmoh;
// // TRuleSequences rule;
// // TWeekdayRanges weekdayRanges;
// return {};
// }
ui::TTimeTables ConvertOpeningkHours(osmoh::OpeningHours const & oh)
{
return {};
}
} // namespace

12
editor/ui2oh.hpp Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include "editor/opening_hours_ui.hpp"
#include "3party/opening_hours/opening_hours.hpp"
namespace editor
{
osmoh::OpeningHours ConvertOpeningHours(ui::TTimeTables const & tt);
ui::TTimeTables ConvertOpeningHours(osmoh::OpeningHours const & oh);
} // namespace editor

View file

@ -23,7 +23,7 @@ HEADERS += defines.hpp
CONFIG *= desktop
}
SUBDIRS = 3party base coding geometry indexer search routing
SUBDIRS = 3party base coding geometry indexer search routing editor
!CONFIG(osrm) {
SUBDIRS *= platform stats storage