| 789 | } |
| 790 | |
| 791 | XMLFeature ToXML(osm::EditableMapObject const & object, bool serializeType) |
| 792 | { |
| 793 | bool const isPoint = object.GetGeomType() == feature::GeomType::Point; |
| 794 | XMLFeature toFeature(isPoint ? XMLFeature::Type::Node : XMLFeature::Type::Way); |
| 795 | |
| 796 | if (isPoint) |
| 797 | { |
| 798 | toFeature.SetCenter(object.GetMercator()); |
| 799 | } |
| 800 | else |
| 801 | { |
| 802 | auto const & triangles = object.GetTriangesAsPoints(); |
| 803 | toFeature.SetGeometry(begin(triangles), end(triangles)); |
| 804 | } |
| 805 | |
| 806 | if (serializeType) |
| 807 | { |
| 808 | feature::TypesHolder types = object.GetTypes(); |
| 809 | types.SortBySpec(); |
| 810 | ASSERT(!types.Empty(), ("Feature does not have a type")); |
| 811 | uint32_t mainType = types.front(); |
| 812 | toFeature.SetOSMTagsForType(mainType); |
| 813 | } |
| 814 | |
| 815 | object.GetNameMultilang().ForEach([&toFeature](uint8_t const & lang, string_view name) |
| 816 | { toFeature.SetName(lang, name); }); |
| 817 | |
| 818 | string const & house = object.GetHouseNumber(); |
| 819 | if (!house.empty()) |
| 820 | toFeature.SetHouse(house); |
| 821 | |
| 822 | auto const cuisines = object.GetCuisines(); |
| 823 | if (!cuisines.empty()) |
| 824 | { |
| 825 | auto const cuisineStr = strings::JoinStrings(cuisines, ";"); |
| 826 | toFeature.SetCuisine(cuisineStr); |
| 827 | } |
| 828 | |
| 829 | object.ForEachMetadataItem([&toFeature](string_view tag, string_view value) { toFeature.SetTagValue(tag, value); }); |
| 830 | |
| 831 | return toFeature; |
| 832 | } |
| 833 | |
| 834 | XMLFeature TypeToXML(uint32_t type, feature::GeomType geomType, m2::PointD mercator) |
| 835 | { |