コード例 #1
0
ファイル: MapItemListDialog.cpp プロジェクト: kwtskran/XCSoar
void
ShowMapItemListDialog(const MapItemList &list,
                      const DialogLook &dialog_look,
                      const MapLook &look,
                      const TrafficLook &traffic_look,
                      const FinalGlideBarLook &final_glide_look,
                      const MapSettings &settings,
                      ProtectedAirspaceWarningManager *airspace_warnings)
{
  switch (list.size()) {
  case 0:
    /* no map items in the list */
    return;

  case 1:
    /* only one map item, show it */
    ShowMapItemDialog(*list[0], airspace_warnings);
    break;

  default:
    /* more than one map item: show a list */

    int i = ShowMapItemListDialog(list, dialog_look, look,
                                  traffic_look, final_glide_look, settings);
    assert(i >= -1 && i < (int)list.size());
    if (i >= 0)
      ShowMapItemDialog(*list[i], airspace_warnings);
  }
}
コード例 #2
0
ファイル: test.cpp プロジェクト: marigostra/deepsolver
int main(int argc, char* argv[])
{
  assert(argc == 3);
  processPkgFile(argv[1]);
  processProvidesFile(argv[2]);
  std::cout << "First list size: " << list1.size() << std::endl;
  std::cout << "Second list size: " << list2.size() << std::endl;
  assert(list1.size() == list2.size());
  for(MapItemList::const_iterator it1 = list1.begin();it1 != list1.end();it1++)
    {
      MapItemList::const_iterator it2 = list2.begin();
      while (it2 != list2.end() && *it1 != *it2)
	it2++;
      assert(it2 != list2.end());
    }
  for(MapItemList::const_iterator it2 = list2.begin();it2 != list2.end();it2++)
    {
      MapItemList::const_iterator it1 = list1.begin();
      while (it1 != list1.end() && *it2 != *it1)
	it1++;
      assert(it1 != list1.end());
    }
  return 0;
}
コード例 #3
0
void
ShowMapItemListDialog(SingleWindow &parent,
                      const GeoVector &_vector,
                      const MapItemList &_list, short _elevation,
                      const MapLook &_look,
                      const TrafficLook &_traffic_look,
                      const MapSettings &_settings,
                      ProtectedAirspaceWarningManager *_airspace_warnings)
{
  switch (_list.size()) {
  case 0:
    /* no map items in the list */
    return;

  case 1:
    /* only one map item, show it */
    ShowMapItemDialog(*_list[0], parent);
    break;

  default:
    /* more than one map item: show a list */
    vector = _vector;
    list = &_list;
    elevation = _elevation;

    look = &_look;
    traffic_look = &_traffic_look;
    settings = &_settings;
    airspace_warnings = _airspace_warnings;

    int i = ShowMapItemListDialog(parent);
    assert(i >= -1 && i < (int)_list.size());
    if (i >= 0)
      ShowMapItemDialog(*_list[i], parent);
  }
}