diff options
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/resources/bg.lproj/Foundation.strings | 291 | ||||
-rw-r--r-- | platform/darwin/resources/bg.lproj/Foundation.stringsdict | 54 | ||||
-rw-r--r-- | platform/darwin/resources/hu.lproj/Foundation.stringsdict | 54 | ||||
-rw-r--r-- | platform/darwin/resources/pt-BR.lproj/Foundation.strings | 291 | ||||
-rw-r--r-- | platform/darwin/src/MGLGeometry.mm | 49 | ||||
-rw-r--r-- | platform/darwin/src/MGLGeometry_Private.h | 42 | ||||
-rw-r--r-- | platform/darwin/src/MGLImageSource.h | 5 | ||||
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.h | 9 | ||||
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 127 | ||||
-rw-r--r-- | platform/darwin/src/MGLShapeSource.h | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 27 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle_Private.h | 9 |
12 files changed, 926 insertions, 35 deletions
diff --git a/platform/darwin/resources/bg.lproj/Foundation.strings b/platform/darwin/resources/bg.lproj/Foundation.strings new file mode 100644 index 0000000000..f2a9c6eae0 --- /dev/null +++ b/platform/darwin/resources/bg.lproj/Foundation.strings @@ -0,0 +1,291 @@ +/* Clock position format, long: {hours} o’clock */ +"CLOCK_FMT_LONG" = "%@ часа"; + +/* Clock position format, medium: {hours} o’clock */ +"CLOCK_FMT_MEDIUM" = "%@ часа"; + +/* Clock position format, short: {hours}:00 */ +"CLOCK_FMT_SHORT" = "%@:00"; + +/* East, long */ +"COMPASS_E_LONG" = "изток"; + +/* East, short */ +"COMPASS_E_SHORT" = "И"; + +/* East by north, long */ +"COMPASS_EbN_LONG" = "ийст-тен-уест"; + +/* East by north, short */ +"COMPASS_EbN_SHORT" = "EbN"; + +/* East by south, long */ +"COMPASS_EbS_LONG" = "ийст-тен-саут"; + +/* East by south, short */ +"COMPASS_EbS_SHORT" = "EbS"; + +/* East-northeast, long */ +"COMPASS_ENE_LONG" = "север-североизток"; + +/* East-northeast, short */ +"COMPASS_ENE_SHORT" = "ССИ"; + +/* East-southeast, long */ +"COMPASS_ESE_LONG" = "изток-югоизток"; + +/* East-southeast, short */ +"COMPASS_ESE_SHORT" = "ИЮИ"; + +/* North, long */ +"COMPASS_N_LONG" = "север"; + +/* North, short */ +"COMPASS_N_SHORT" = "С"; + +/* North by east, long */ +"COMPASS_NbE_LONG" = "норд-тен-ийст"; + +/* North by east, short */ +"COMPASS_NbE_SHORT" = "NbE"; + +/* North by west, long */ +"COMPASS_NbW_LONG" = "норд-тен-уест"; + +/* North by west, short */ +"COMPASS_NbW_SHORT" = "NbW"; + +/* Northeast, long */ +"COMPASS_NE_LONG" = "североизток"; + +/* Northeast, short */ +"COMPASS_NE_SHORT" = "СИ"; + +/* Northeast by east, long */ +"COMPASS_NEbE_LONG" = "нордийст-тен-ийст"; + +/* Northeast by east, short */ +"COMPASS_NEbE_SHORT" = "NEbE"; + +/* Northeast by north, long */ +"COMPASS_NEbN_LONG" = "нордийст-тен-норд"; + +/* Northeast by north, short */ +"COMPASS_NEbN_SHORT" = "NEnN"; + +/* North-northeast, long */ +"COMPASS_NNE_LONG" = "север-североизток"; + +/* North-northeast, short */ +"COMPASS_NNE_SHORT" = "ССИ"; + +/* North-northwest, long */ +"COMPASS_NNW_LONG" = "север-северозапад"; + +/* North-northwest, short */ +"COMPASS_NNW_SHORT" = "ССЗ"; + +/* Northwest, long */ +"COMPASS_NW_LONG" = "северозапад"; + +/* Northwest, short */ +"COMPASS_NW_SHORT" = "СЗ"; + +/* Northwest by north, long */ +"COMPASS_NWbN_LONG" = "нордуест-тен-норд"; + +/* Northwest by north, short */ +"COMPASS_NWbN_SHORT" = "NWbN"; + +/* Northwest by west, long */ +"COMPASS_NWbW_LONG" = "нордуест-тен-уест"; + +/* Northwest by west, short */ +"COMPASS_NWbW_SHORT" = "NWbW"; + +/* South, long */ +"COMPASS_S_LONG" = "юг"; + +/* South, short */ +"COMPASS_S_SHORT" = "Ю"; + +/* South by east, long */ +"COMPASS_SbE_LONG" = "саут-тен-ийст"; + +/* South by east, short */ +"COMPASS_SbE_SHORT" = "SbE"; + +/* South by west, long */ +"COMPASS_SbW_LONG" = "саут-тен-уест"; + +/* South by west, short */ +"COMPASS_SbW_SHORT" = "SbW"; + +/* Southeast, long */ +"COMPASS_SE_LONG" = "югоизток"; + +/* Southeast, short */ +"COMPASS_SE_SHORT" = "ЮИ"; + +/* Southeast by east, long */ +"COMPASS_SEbE_LONG" = "саутийст-тен-ийст"; + +/* Southeast by east, short */ +"COMPASS_SEbE_SHORT" = "SEbE"; + +/* Southeast by south, long */ +"COMPASS_SEbS_LONG" = "саутийст-тен-саут"; + +/* Southeast by south, short */ +"COMPASS_SEbS_SHORT" = "SEbS"; + +/* South-southeast, long */ +"COMPASS_SSE_LONG" = "юг-югоизток"; + +/* South-southeast, short */ +"COMPASS_SSE_SHORT" = "ЮЮИ"; + +/* South-southwest, long */ +"COMPASS_SSW_LONG" = "юг-югозапад"; + +/* South-southwest, short */ +"COMPASS_SSW_SHORT" = "ЮЮЗ"; + +/* Southwest, long */ +"COMPASS_SW_LONG" = "югозапад"; + +/* Southwest, short */ +"COMPASS_SW_SHORT" = "ЮЗ"; + +/* Southwest by south, long */ +"COMPASS_SWbS_LONG" = "саутуест-тен-саут"; + +/* Southwest by south, short */ +"COMPASS_SWbS_SHORT" = "SWbS"; + +/* Southwest by west, long */ +"COMPASS_SWbW_LONG" = "саутуест-тен-уест"; + +/* Southwest by west, short */ +"COMPASS_SWbW_SHORT" = "SWbW"; + +/* West, long */ +"COMPASS_W_LONG" = "запад"; + +/* West, short */ +"COMPASS_W_SHORT" = "З"; + +/* West by north, long */ +"COMPASS_WbN_LONG" = "уест-тен-норд"; + +/* West by north, short */ +"COMPASS_WbN_SHORT" = "WbN"; + +/* West by south, long */ +"COMPASS_WbS_LONG" = "уест-тен-саут"; + +/* West by south, short */ +"COMPASS_WbS_SHORT" = "WbS"; + +/* West-northwest, long */ +"COMPASS_WNW_LONG" = "запад-северозапад"; + +/* West-northwest, short */ +"COMPASS_WNW_SHORT" = "ЗСЗ"; + +/* West-southwest, long */ +"COMPASS_WSW_LONG" = "запад-югозапад"; + +/* West-southwest, short */ +"COMPASS_WSW_SHORT" = "ЗСЗ"; + +/* Degrees format, long */ +"COORD_DEG_LONG" = "%d градус(а)"; + +/* Degrees format, medium: {degrees} */ +"COORD_DEG_MEDIUM" = "%d°"; + +/* Degrees format, short: {degrees} */ +"COORD_DEG_SHORT" = "%d°"; + +/* Coordinate format, long: {degrees}{minutes} */ +"COORD_DM_LONG" = "%1$@ и %2$@"; + +/* Coordinate format, medium: {degrees}{minutes} */ +"COORD_DM_MEDIUM" = "%1$@%2$@"; + +/* Coordinate format, short: {degrees}{minutes} */ +"COORD_DM_SHORT" = "%1$@%2$@"; + +/* Coordinate format, long: {degrees}{minutes}{seconds} */ +"COORD_DMS_LONG" = "%1$@, %2$@ и %3$@"; + +/* Coordinate format, medium: {degrees}{minutes}{seconds} */ +"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@"; + +/* Coordinate format, short: {degrees}{minutes}{seconds} */ +"COORD_DMS_SHORT" = "%1$@%2$@%3$@"; + +/* East longitude format, long: {longitude} */ +"COORD_E_LONG" = "%@ изток"; + +/* East longitude format, medium: {longitude} */ +"COORD_E_MEDIUM" = "%@ изток"; + +/* East longitude format, short: {longitude} */ +"COORD_E_SHORT" = "%@И"; + +/* Coordinate pair format, long: {latitude}, {longitude} */ +"COORD_FMT_LONG" = "%1$@ на %2$@"; + +/* Coordinate pair format, medium: {latitude}, {longitude} */ +"COORD_FMT_MEDIUM" = "%1$@, %2$@"; + +/* Coordinate pair format, short: {latitude}, {longitude} */ +"COORD_FMT_SHORT" = "%1$@, %2$@"; + +/* Minutes format, long */ +"COORD_MIN_LONG" = "%d минута(и)"; + +/* Minutes format, medium: {minutes} */ +"COORD_MIN_MEDIUM" = "%d′"; + +/* Minutes format, short: {minutes} */ +"COORD_MIN_SHORT" = "%d′"; + +/* North latitude format, long: {latitude} */ +"COORD_N_LONG" = "%@ север"; + +/* North latitude format, medium: {latitude} */ +"COORD_N_MEDIUM" = "%@ север"; + +/* North latitude format, short: {latitude} */ +"COORD_N_SHORT" = "%@С"; + +/* South latitude format, long: {latitude} */ +"COORD_S_LONG" = "%@ юг"; + +/* South latitude format, medium: {latitude} */ +"COORD_S_MEDIUM" = "%@ юг"; + +/* South latitude format, short: {latitude} */ +"COORD_S_SHORT" = "%@Ю"; + +/* Seconds format, long */ +"COORD_SEC_LONG" = "%d секунда(и)"; + +/* Seconds format, medium: {seconds} */ +"COORD_SEC_MEDIUM" = "%d″"; + +/* Seconds format, short: {seconds} */ +"COORD_SEC_SHORT" = "%d″"; + +/* West longitude format, long: {longitude} */ +"COORD_W_LONG" = "%@ запад"; + +/* West longitude format, medium: {longitude} */ +"COORD_W_MEDIUM" = "%@ запад"; + +/* West longitude format, short: {longitude} */ +"COORD_W_SHORT" = "%@З"; + diff --git a/platform/darwin/resources/bg.lproj/Foundation.stringsdict b/platform/darwin/resources/bg.lproj/Foundation.stringsdict new file mode 100644 index 0000000000..fcaf0a48c1 --- /dev/null +++ b/platform/darwin/resources/bg.lproj/Foundation.stringsdict @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>COORD_DEG_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@degrees@</string> + <key>degrees</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d градус</string> + <key>other</key> + <string>%d градуса</string> + </dict> + </dict> + <key>COORD_MIN_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@minutes@</string> + <key>minutes</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d минута</string> + <key>other</key> + <string>%d минути</string> + </dict> + </dict> + <key>COORD_SEC_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@seconds@</string> + <key>seconds</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d секунда</string> + <key>other</key> + <string>%d секунди</string> + </dict> + </dict> +</dict> +</plist> diff --git a/platform/darwin/resources/hu.lproj/Foundation.stringsdict b/platform/darwin/resources/hu.lproj/Foundation.stringsdict new file mode 100644 index 0000000000..a594100046 --- /dev/null +++ b/platform/darwin/resources/hu.lproj/Foundation.stringsdict @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>COORD_DEG_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@degrees@</string> + <key>degrees</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d fok</string> + <key>other</key> + <string>%d fok</string> + </dict> + </dict> + <key>COORD_MIN_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@minutes@</string> + <key>minutes</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d perc</string> + <key>other</key> + <string>%d perc</string> + </dict> + </dict> + <key>COORD_SEC_LONG</key> + <dict> + <key>NSStringLocalizedFormatKey</key> + <string>%#@seconds@</string> + <key>seconds</key> + <dict> + <key>NSStringFormatSpecTypeKey</key> + <string>NSStringPluralRuleType</string> + <key>NSStringFormatValueTypeKey</key> + <string>d</string> + <key>one</key> + <string>%d másodperc</string> + <key>other</key> + <string>%d másodperc</string> + </dict> + </dict> +</dict> +</plist> diff --git a/platform/darwin/resources/pt-BR.lproj/Foundation.strings b/platform/darwin/resources/pt-BR.lproj/Foundation.strings new file mode 100644 index 0000000000..71a7f7e4a5 --- /dev/null +++ b/platform/darwin/resources/pt-BR.lproj/Foundation.strings @@ -0,0 +1,291 @@ +/* Clock position format, long: {hours} o’clock */ +"CLOCK_FMT_LONG" = "São %@ horas"; + +/* Clock position format, medium: {hours} o’clock */ +"CLOCK_FMT_MEDIUM" = "São %@ horas"; + +/* Clock position format, short: {hours}:00 */ +"CLOCK_FMT_SHORT" = "%@:00"; + +/* East, long */ +"COMPASS_E_LONG" = "leste"; + +/* East, short */ +"COMPASS_E_SHORT" = "L"; + +/* East by north, long */ +"COMPASS_EbN_LONG" = "lest pelo norte"; + +/* East by north, short */ +"COMPASS_EbN_SHORT" = "LpN"; + +/* East by south, long */ +"COMPASS_EbS_LONG" = "leste pelo sul"; + +/* East by south, short */ +"COMPASS_EbS_SHORT" = "LpS"; + +/* East-northeast, long */ +"COMPASS_ENE_LONG" = "lés-nordeste"; + +/* East-northeast, short */ +"COMPASS_ENE_SHORT" = "ENE"; + +/* East-southeast, long */ +"COMPASS_ESE_LONG" = "lés-sudeste"; + +/* East-southeast, short */ +"COMPASS_ESE_SHORT" = "ESE"; + +/* North, long */ +"COMPASS_N_LONG" = "norte"; + +/* North, short */ +"COMPASS_N_SHORT" = "N"; + +/* North by east, long */ +"COMPASS_NbE_LONG" = "norte pelo leste"; + +/* North by east, short */ +"COMPASS_NbE_SHORT" = "NpL"; + +/* North by west, long */ +"COMPASS_NbW_LONG" = "norte pelo oeste"; + +/* North by west, short */ +"COMPASS_NbW_SHORT" = "NpO"; + +/* Northeast, long */ +"COMPASS_NE_LONG" = "nordeste"; + +/* Northeast, short */ +"COMPASS_NE_SHORT" = "NE"; + +/* Northeast by east, long */ +"COMPASS_NEbE_LONG" = "nordeste pelo leste"; + +/* Northeast by east, short */ +"COMPASS_NEbE_SHORT" = "NEpL"; + +/* Northeast by north, long */ +"COMPASS_NEbN_LONG" = "nordeste pelo norte"; + +/* Northeast by north, short */ +"COMPASS_NEbN_SHORT" = "NEpN"; + +/* North-northeast, long */ +"COMPASS_NNE_LONG" = "nor-nordeste"; + +/* North-northeast, short */ +"COMPASS_NNE_SHORT" = "NNE"; + +/* North-northwest, long */ +"COMPASS_NNW_LONG" = "nor-noroeste"; + +/* North-northwest, short */ +"COMPASS_NNW_SHORT" = "NNO"; + +/* Northwest, long */ +"COMPASS_NW_LONG" = "noroeste"; + +/* Northwest, short */ +"COMPASS_NW_SHORT" = "NO"; + +/* Northwest by north, long */ +"COMPASS_NWbN_LONG" = "noroeste pelo norte"; + +/* Northwest by north, short */ +"COMPASS_NWbN_SHORT" = "NOpN"; + +/* Northwest by west, long */ +"COMPASS_NWbW_LONG" = "noroeste pelo oeste"; + +/* Northwest by west, short */ +"COMPASS_NWbW_SHORT" = "NOpO"; + +/* South, long */ +"COMPASS_S_LONG" = "sul"; + +/* South, short */ +"COMPASS_S_SHORT" = "S"; + +/* South by east, long */ +"COMPASS_SbE_LONG" = "sul pelo leste"; + +/* South by east, short */ +"COMPASS_SbE_SHORT" = "SpL"; + +/* South by west, long */ +"COMPASS_SbW_LONG" = "sul pelo oeste"; + +/* South by west, short */ +"COMPASS_SbW_SHORT" = "SbO"; + +/* Southeast, long */ +"COMPASS_SE_LONG" = "sudeste"; + +/* Southeast, short */ +"COMPASS_SE_SHORT" = "SE"; + +/* Southeast by east, long */ +"COMPASS_SEbE_LONG" = "sudeste pelo leste"; + +/* Southeast by east, short */ +"COMPASS_SEbE_SHORT" = "SEpL"; + +/* Southeast by south, long */ +"COMPASS_SEbS_LONG" = "sudeste pelo sul"; + +/* Southeast by south, short */ +"COMPASS_SEbS_SHORT" = "SEpS"; + +/* South-southeast, long */ +"COMPASS_SSE_LONG" = "sul-sudeste"; + +/* South-southeast, short */ +"COMPASS_SSE_SHORT" = "SSE"; + +/* South-southwest, long */ +"COMPASS_SSW_LONG" = "su-sudoeste"; + +/* South-southwest, short */ +"COMPASS_SSW_SHORT" = "SSO"; + +/* Southwest, long */ +"COMPASS_SW_LONG" = "sudoeste"; + +/* Southwest, short */ +"COMPASS_SW_SHORT" = "SO"; + +/* Southwest by south, long */ +"COMPASS_SWbS_LONG" = "sudoeste pelo sul"; + +/* Southwest by south, short */ +"COMPASS_SWbS_SHORT" = "SOpS"; + +/* Southwest by west, long */ +"COMPASS_SWbW_LONG" = "sudoeste pelo oeste"; + +/* Southwest by west, short */ +"COMPASS_SWbW_SHORT" = "SOpO"; + +/* West, long */ +"COMPASS_W_LONG" = "oeste"; + +/* West, short */ +"COMPASS_W_SHORT" = "O"; + +/* West by north, long */ +"COMPASS_WbN_LONG" = "oeste pelo norte"; + +/* West by north, short */ +"COMPASS_WbN_SHORT" = "OpN"; + +/* West by south, long */ +"COMPASS_WbS_LONG" = "oeste pelo sul"; + +/* West by south, short */ +"COMPASS_WbS_SHORT" = "OpS"; + +/* West-northwest, long */ +"COMPASS_WNW_LONG" = "oés-noroeste"; + +/* West-northwest, short */ +"COMPASS_WNW_SHORT" = "ONO"; + +/* West-southwest, long */ +"COMPASS_WSW_LONG" = "oés-sudoeste"; + +/* West-southwest, short */ +"COMPASS_WSW_SHORT" = "OSO"; + +/* Degrees format, long */ +"COORD_DEG_LONG" = "%d grau(s)"; + +/* Degrees format, medium: {degrees} */ +"COORD_DEG_MEDIUM" = "%d°"; + +/* Degrees format, short: {degrees} */ +"COORD_DEG_SHORT" = "%d°"; + +/* Coordinate format, long: {degrees}{minutes} */ +"COORD_DM_LONG" = "%1$@ e %2$@"; + +/* Coordinate format, medium: {degrees}{minutes} */ +"COORD_DM_MEDIUM" = "%1$@%2$@"; + +/* Coordinate format, short: {degrees}{minutes} */ +"COORD_DM_SHORT" = "%1$@%2$@"; + +/* Coordinate format, long: {degrees}{minutes}{seconds} */ +"COORD_DMS_LONG" = "%1$@, %2$@, e %3$@"; + +/* Coordinate format, medium: {degrees}{minutes}{seconds} */ +"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@"; + +/* Coordinate format, short: {degrees}{minutes}{seconds} */ +"COORD_DMS_SHORT" = "%1$@%2$@%3$@"; + +/* East longitude format, long: {longitude} */ +"COORD_E_LONG" = "%@ leste"; + +/* East longitude format, medium: {longitude} */ +"COORD_E_MEDIUM" = "%@ leste"; + +/* East longitude format, short: {longitude} */ +"COORD_E_SHORT" = "%@L"; + +/* Coordinate pair format, long: {latitude}, {longitude} */ +"COORD_FMT_LONG" = "%1$@ por %2$@"; + +/* Coordinate pair format, medium: {latitude}, {longitude} */ +"COORD_FMT_MEDIUM" = "%1$@, %2$@"; + +/* Coordinate pair format, short: {latitude}, {longitude} */ +"COORD_FMT_SHORT" = "%1$@, %2$@"; + +/* Minutes format, long */ +"COORD_MIN_LONG" = "%d minuto(s)"; + +/* Minutes format, medium: {minutes} */ +"COORD_MIN_MEDIUM" = "%d′"; + +/* Minutes format, short: {minutes} */ +"COORD_MIN_SHORT" = "%d′"; + +/* North latitude format, long: {latitude} */ +"COORD_N_LONG" = "%@ norte"; + +/* North latitude format, medium: {latitude} */ +"COORD_N_MEDIUM" = "%@ norte"; + +/* North latitude format, short: {latitude} */ +"COORD_N_SHORT" = "%@N"; + +/* South latitude format, long: {latitude} */ +"COORD_S_LONG" = "%@ sul"; + +/* South latitude format, medium: {latitude} */ +"COORD_S_MEDIUM" = "%@ sul"; + +/* South latitude format, short: {latitude} */ +"COORD_S_SHORT" = "%@S"; + +/* Seconds format, long */ +"COORD_SEC_LONG" = "%d segundo(s)"; + +/* Seconds format, medium: {seconds} */ +"COORD_SEC_MEDIUM" = "%d″"; + +/* Seconds format, short: {seconds} */ +"COORD_SEC_SHORT" = "%d″"; + +/* West longitude format, long: {longitude} */ +"COORD_W_LONG" = "%@ oeste"; + +/* West longitude format, medium: {longitude} */ +"COORD_W_MEDIUM" = "%@ oeste"; + +/* West longitude format, short: {longitude} */ +"COORD_W_SHORT" = "%@O"; + diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm index 1540a3a741..715a70f0b8 100644 --- a/platform/darwin/src/MGLGeometry.mm +++ b/platform/darwin/src/MGLGeometry.mm @@ -4,6 +4,10 @@ #import <mbgl/util/projection.hpp> +#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR +#import <Cocoa/Cocoa.h> +#endif + /** Vertical field of view, measured in degrees, for determining the altitude of the viewpoint. @@ -57,3 +61,48 @@ double MGLZoomLevelForAltitude(CLLocationDistance altitude, CGFloat pitch, CLLoc CGFloat mapPixelWidthAtZoom = std::cos(MGLRadiansFromDegrees(latitude)) * mbgl::util::M2PI * mbgl::util::EARTH_RADIUS_M / metersPerPixel; return ::log2(mapPixelWidthAtZoom / mbgl::util::tileSize); } + +MGLRadianDistance MGLDistanceBetweenRadianCoordinates(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to) { + double a = pow(sin((to.latitude - from.latitude) / 2), 2) + + pow(sin((to.longitude - from.longitude) / 2), 2) * cos(from.latitude) * cos(to.latitude); + + return 2 * atan2(sqrt(a), sqrt(1 - a)); +} + +MGLRadianDirection MGLRadianCoordinatesDirection(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to) { + double a = sin(to.longitude - from.longitude) * cos(to.latitude); + double b = cos(from.latitude) * sin(to.latitude) + - sin(from.latitude) * cos(to.latitude) * cos(to.longitude - from.longitude); + return atan2(a, b); +} + +MGLRadianCoordinate2D MGLRadianCoordinateAtDistanceFacingDirection(MGLRadianCoordinate2D coordinate, + MGLRadianDistance distance, + MGLRadianDirection direction) { + double otherLatitude = asin(sin(coordinate.latitude) * cos(distance) + + cos(coordinate.latitude) * sin(distance) * cos(direction)); + double otherLongitude = coordinate.longitude + atan2(sin(direction) * sin(distance) * cos(coordinate.latitude), + cos(distance) - sin(coordinate.latitude) * sin(otherLatitude)); + return MGLRadianCoordinate2DMake(otherLatitude, otherLongitude); +} + +CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstCoordinate, CLLocationCoordinate2D secondCoordinate) { + // Ported from https://github.com/mapbox/turf-swift/blob/857e2e8060678ef4a7a9169d4971b0788fdffc37/Turf/Turf.swift#L23-L31 + MGLRadianCoordinate2D firstRadianCoordinate = MGLRadianCoordinateFromLocationCoordinate(firstCoordinate); + MGLRadianCoordinate2D secondRadianCoordinate = MGLRadianCoordinateFromLocationCoordinate(secondCoordinate); + + CGFloat a = sin(secondRadianCoordinate.longitude - firstRadianCoordinate.longitude) * cos(secondRadianCoordinate.latitude); + CGFloat b = (cos(firstRadianCoordinate.latitude) * sin(secondRadianCoordinate.latitude) + - sin(firstRadianCoordinate.latitude) * cos(secondRadianCoordinate.latitude) * cos(secondRadianCoordinate.longitude - firstRadianCoordinate.longitude)); + MGLRadianDirection radianDirection = atan2(a, b); + return radianDirection * 180 / M_PI; +} + +CGPoint MGLPointRounded(CGPoint point) { +#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR + CGFloat scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [UIScreen mainScreen].nativeScale : [UIScreen mainScreen].scale; +#elif TARGET_OS_MAC + CGFloat scaleFactor = [NSScreen mainScreen].backingScaleFactor; +#endif + return CGPointMake(round(point.x * scaleFactor) / scaleFactor, round(point.y * scaleFactor) / scaleFactor); +} diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h index 88fcf5b576..8b9c6c2327 100644 --- a/platform/darwin/src/MGLGeometry_Private.h +++ b/platform/darwin/src/MGLGeometry_Private.h @@ -105,36 +105,26 @@ NS_INLINE MGLRadianCoordinate2D MGLRadianCoordinateFromLocationCoordinate(CLLoca MGLRadiansFromDegrees(locationCoordinate.longitude)); } -/* +/** Returns the distance in radians given two coordinates. */ -NS_INLINE MGLRadianDistance MGLDistanceBetweenRadianCoordinates(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to) -{ - double a = pow(sin((to.latitude - from.latitude) / 2), 2) - + pow(sin((to.longitude - from.longitude) / 2), 2) * cos(from.latitude) * cos(to.latitude); - - return 2 * atan2(sqrt(a), sqrt(1 - a)); -} +MGLRadianDistance MGLDistanceBetweenRadianCoordinates(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to); -/* +/** Returns direction in radians given two coordinates. */ -NS_INLINE MGLRadianDirection MGLRadianCoordinatesDirection(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to) { - double a = sin(to.longitude - from.longitude) * cos(to.latitude); - double b = cos(from.latitude) * sin(to.latitude) - - sin(from.latitude) * cos(to.latitude) * cos(to.longitude - from.longitude); - return atan2(a, b); -} +MGLRadianDirection MGLRadianCoordinatesDirection(MGLRadianCoordinate2D from, MGLRadianCoordinate2D to); + +/** + Returns a coordinate at a given distance and direction away from coordinate. + */ +MGLRadianCoordinate2D MGLRadianCoordinateAtDistanceFacingDirection(MGLRadianCoordinate2D coordinate, + MGLRadianDistance distance, + MGLRadianDirection direction); -/* - Returns coordinate at a given distance and direction away from coordinate. +/** + Returns the direction from one coordinate to another. */ -NS_INLINE MGLRadianCoordinate2D MGLRadianCoordinateAtDistanceFacingDirection(MGLRadianCoordinate2D coordinate, - MGLRadianDistance distance, - MGLRadianDirection direction) { - double otherLatitude = asin(sin(coordinate.latitude) * cos(distance) - + cos(coordinate.latitude) * sin(distance) * cos(direction)); - double otherLongitude = coordinate.longitude + atan2(sin(direction) * sin(distance) * cos(coordinate.latitude), - cos(distance) - sin(coordinate.latitude) * sin(otherLatitude)); - return MGLRadianCoordinate2DMake(otherLatitude, otherLongitude); -} +CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstCoordinate, CLLocationCoordinate2D secondCoordinate); + +CGPoint MGLPointRounded(CGPoint point); diff --git a/platform/darwin/src/MGLImageSource.h b/platform/darwin/src/MGLImageSource.h index 21487d9739..5088f6bac0 100644 --- a/platform/darwin/src/MGLImageSource.h +++ b/platform/darwin/src/MGLImageSource.h @@ -38,8 +38,11 @@ MGL_EXPORT bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425), bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516), topRight: CLLocationCoordinate2D(latitude: 46.437, longitude: -71.516)) - let source = MGLImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/radar.gif")!) + let source = MGLImageSource(identifier: "radar-source", coordinateQuad: coordinates, url: URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/radar.gif")!) mapView.style?.addSource(source) + + let layer = MGLRasterStyleLayer(identifier: "radar-layer", source: source) + style.addLayer(layer) ``` */ MGL_EXPORT diff --git a/platform/darwin/src/MGLMapSnapshotter.h b/platform/darwin/src/MGLMapSnapshotter.h index 9cf032f5d1..541bc68b93 100644 --- a/platform/darwin/src/MGLMapSnapshotter.h +++ b/platform/darwin/src/MGLMapSnapshotter.h @@ -5,10 +5,10 @@ NS_ASSUME_NONNULL_BEGIN -MGL_EXPORT /** - The options to use when creating images with the `MGLMapsnapshotter`. + The options to use when creating images with the `MGLMapSnapshotter`. */ +MGL_EXPORT @interface MGLMapSnapshotOptions : NSObject /** @@ -63,7 +63,8 @@ MGL_EXPORT /** The scale of the output image. Defaults to the main screen scale. - Minimum is 1. + + The minimum scale is 1. */ @property (nonatomic) CGFloat scale; @@ -196,7 +197,7 @@ MGL_EXPORT @property (nonatomic) CGSize size; /** - Indicates whether as snapshot is currently being generated. + Indicates whether a snapshot is currently being generated. */ @property (nonatomic, readonly, getter=isLoading) BOOL loading; diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index a00521a87a..dea93eba34 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -14,11 +14,14 @@ #import "MGLGeometry_Private.h" #import "NSBundle+MGLAdditions.h" #import "MGLStyle.h" +#import "MGLAttributionInfo_Private.h" #if TARGET_OS_IPHONE #import "UIImage+MGLAdditions.h" #else #import "NSImage+MGLAdditions.h" +#import <CoreGraphics/CoreGraphics.h> +#import <QuartzCore/QuartzCore.h> #endif const CGPoint MGLLogoImagePosition = CGPointMake(8, 8); @@ -146,6 +149,33 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; dispatch_async(queue, ^{ _snapshotCallback = std::make_unique<mbgl::Actor<mbgl::MapSnapshotter::Callback>>(*mbgl::Scheduler::GetCurrent(), [=](std::exception_ptr mbglError, mbgl::PremultipliedImage image, mbgl::MapSnapshotter::Attributions attributions, mbgl::MapSnapshotter::PointForFn pointForFn) { _loading = false; + + NSMutableArray *infos = [NSMutableArray array]; + +#if TARGET_OS_IPHONE + CGFloat fontSize = [UIFont smallSystemFontSize]; + UIColor *attributeFontColor = [UIColor blackColor]; +#else + CGFloat fontSize = [NSFont systemFontSizeForControlSize:NSMiniControlSize]; + NSColor *attributeFontColor = [NSColor blackColor]; +#endif + for (auto attribution = attributions.begin(); attribution != attributions.end(); ++attribution) { + NSString *attributionHTMLString = @(attribution->c_str()); + NSArray *tileSetInfos = [MGLAttributionInfo attributionInfosFromHTMLString:attributionHTMLString + fontSize:fontSize + linkColor:attributeFontColor]; + [infos growArrayByAddingAttributionInfosFromArray:tileSetInfos]; + } + + CGSize attributionBackgroundSize = CGSizeMake(10, 0); + for (MGLAttributionInfo *info in infos) { + if (info.isFeedbackLink) { + continue; + } + attributionBackgroundSize.width += [info.title size].width + 10; + attributionBackgroundSize.height = MAX([info.title size].height, attributionBackgroundSize.height); + } + if (mbglError) { NSString *description = @(mbgl::util::toString(mbglError).c_str()); NSDictionary *userInfo = @{NSLocalizedDescriptionKey: description}; @@ -170,10 +200,39 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; #if TARGET_OS_IPHONE UIImage *logoImage = [UIImage imageNamed:@"mapbox" inBundle:[NSBundle mgl_frameworkBundle] compatibleWithTraitCollection:nil]; + CGRect logoImageRect = CGRectMake(MGLLogoImagePosition.x, mglImage.size.height - (MGLLogoImagePosition.y + logoImage.size.height), logoImage.size.width, logoImage.size.height); + CGRect attributionBackgroundFrame = CGRectMake(mglImage.size.width - 10 - attributionBackgroundSize.width, + logoImageRect.origin.y + (logoImageRect.size.height / 2) - (attributionBackgroundSize.height / 2) + 1, + attributionBackgroundSize.width, + attributionBackgroundSize.height); + CGPoint attributionTextPosition = CGPointMake(attributionBackgroundFrame.origin.x + 10, + attributionBackgroundFrame.origin.y - 1); + + CGRect cropRect = CGRectMake(attributionBackgroundFrame.origin.x * mglImage.scale, + attributionBackgroundFrame.origin.y * mglImage.scale, + attributionBackgroundSize.width * mglImage.scale, + attributionBackgroundSize.height * mglImage.scale); + + UIGraphicsBeginImageContextWithOptions(mglImage.size, NO, self.options.scale); [mglImage drawInRect:CGRectMake(0, 0, mglImage.size.width, mglImage.size.height)]; - [logoImage drawInRect:CGRectMake(MGLLogoImagePosition.x, mglImage.size.height - (MGLLogoImagePosition.y + logoImage.size.height), logoImage.size.width,logoImage.size.height)]; + + [logoImage drawInRect:logoImageRect]; + + UIImage *currentImage = UIGraphicsGetImageFromCurrentImageContext(); + CGImageRef attributionImageRef = CGImageCreateWithImageInRect([currentImage CGImage], cropRect); + UIImage *attributionImage = [UIImage imageWithCGImage:attributionImageRef]; + CGImageRelease(attributionImageRef); + + CIImage *ciAttributionImage = [[CIImage alloc] initWithCGImage:attributionImage.CGImage]; + + UIImage *blurredAttributionBackground = [self blurredAttributionBackground:ciAttributionImage]; + + [blurredAttributionBackground drawInRect:attributionBackgroundFrame]; + + [self drawAttributionText:infos origin:attributionTextPosition]; + UIImage *compositedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); @@ -183,6 +242,15 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; NSSize targetSize = NSMakeSize(self.options.size.width, self.options.size.height); NSRect targetFrame = NSMakeRect(0, 0, targetSize.width, targetSize.height); + CGRect logoImageRect = CGRectMake(MGLLogoImagePosition.x, MGLLogoImagePosition.y, logoImage.size.width, logoImage.size.height); + CGRect attributionBackgroundFrame = CGRectMake(targetFrame.size.width - 10 - attributionBackgroundSize.width, + MGLLogoImagePosition.y + 1, + attributionBackgroundSize.width, + attributionBackgroundSize.height); + CGPoint attributionTextPosition = CGPointMake(attributionBackgroundFrame.origin.x + 10, + logoImageRect.origin.y + (logoImageRect.size.height / 2) - (attributionBackgroundSize.height / 2)); + + NSImage *compositedImage = nil; NSImageRep *sourceImageRep = [sourceImage bestRepresentationForRect:targetFrame context:nil @@ -190,10 +258,24 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; compositedImage = [[NSImage alloc] initWithSize:targetSize]; [compositedImage lockFocus]; + [sourceImageRep drawInRect: targetFrame]; - [logoImage drawInRect:CGRectMake(MGLLogoImagePosition.x, MGLLogoImagePosition.y, logoImage.size.width,logoImage.size.height)]; + + [logoImage drawInRect:logoImageRect]; + + NSBitmapImageRep *attributionBackground = [[NSBitmapImageRep alloc] initWithFocusedViewRect:attributionBackgroundFrame]; + + CIImage *attributionBackgroundImage = [[CIImage alloc] initWithCGImage:[attributionBackground CGImage]]; + + NSImage *blurredAttributionBackground = [self blurredAttributionBackground:attributionBackgroundImage]; + + [blurredAttributionBackground drawInRect:attributionBackgroundFrame]; + + [self drawAttributionText:infos origin:attributionTextPosition]; + [compositedImage unlockFocus]; + #endif // Dispatch result to origin queue @@ -208,6 +290,47 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; }); } +- (void)drawAttributionText:(NSArray *)attributionInfo origin:(CGPoint)origin +{ + for (MGLAttributionInfo *info in attributionInfo) { + if (info.isFeedbackLink) { + continue; + } + [info.title drawAtPoint:origin]; + + origin.x += [info.title size].width + 10; + } +} + +- (MGLImage *)blurredAttributionBackground:(CIImage *)backgroundImage +{ + CGAffineTransform transform = CGAffineTransformIdentity; + CIFilter *clamp = [CIFilter filterWithName:@"CIAffineClamp"]; + [clamp setValue:backgroundImage forKey:kCIInputImageKey]; + [clamp setValue:[NSValue valueWithBytes:&transform objCType:@encode(CGAffineTransform)] forKey:@"inputTransform"]; + + CIFilter *attributionBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"]; + [attributionBlurFilter setValue:[clamp outputImage] forKey:kCIInputImageKey]; + [attributionBlurFilter setValue:@10 forKey:kCIInputRadiusKey]; + + CIFilter *attributionColorFilter = [CIFilter filterWithName:@"CIColorControls"]; + [attributionColorFilter setValue:[attributionBlurFilter outputImage] forKey:kCIInputImageKey]; + [attributionColorFilter setValue:@(0.1) forKey:kCIInputBrightnessKey]; + + CIImage *blurredImage = attributionColorFilter.outputImage; + + CIContext *ctx = [CIContext contextWithOptions:nil]; + CGImageRef cgimg = [ctx createCGImage:blurredImage fromRect:[backgroundImage extent]]; + +#if TARGET_OS_IPHONE + + return [UIImage imageWithCGImage:cgimg]; +#else + + return [[NSImage alloc] initWithCGImage:cgimg size:[backgroundImage extent].size]; +#endif +} + - (void)cancel { _snapshotCallback.reset(); diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h index d0097f748e..7460c83f50 100644 --- a/platform/darwin/src/MGLShapeSource.h +++ b/platform/darwin/src/MGLShapeSource.h @@ -85,7 +85,8 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationT or they may be defined by local or external <a href="http://geojson.org/">GeoJSON</a> code. A shape source is added to an `MGLStyle` object along with an `MGLVectorStyleLayer` object. The vector style - layer defines the appearance of any content supplied by the shape source. + layer defines the appearance of any content supplied by the shape source. You + can update a shape source by setting its `shape` or `URL` property. Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson"><code>geojson</code></a> diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 52efc7a85a..244fb94ef9 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -638,7 +638,7 @@ static NSURL *MGLStyleURL_trafficNight; self.URL ? [NSString stringWithFormat:@"\"%@\"", self.URL] : self.URL]; } -#pragma mark Style language preferences +#pragma mark Mapbox Streets source introspection - (void)setLocalizesLabels:(BOOL)localizesLabels { @@ -749,4 +749,29 @@ static NSURL *MGLStyleURL_trafficNight; } } +- (NS_SET_OF(MGLVectorSource *) *)mapboxStreetsSources { + return [self.sources objectsPassingTest:^BOOL (__kindof MGLVectorSource * _Nonnull source, BOOL * _Nonnull stop) { + return [source isKindOfClass:[MGLVectorSource class]] && source.mapboxStreets; + }]; +} + +- (NS_ARRAY_OF(MGLStyleLayer *) *)placeStyleLayers { + NSSet *streetsSourceIdentifiers = [self.mapboxStreetsSources valueForKey:@"identifier"]; + + NSSet *placeSourceLayerIdentifiers = [NSSet setWithObjects:@"marine_label", @"country_label", @"state_label", @"place_label", @"water_label", @"poi_label", @"rail_station_label", @"mountain_peak_label", nil]; + NSPredicate *isPlacePredicate = [NSPredicate predicateWithBlock:^BOOL (MGLVectorStyleLayer * _Nullable layer, NSDictionary<NSString *, id> * _Nullable bindings) { + return [layer isKindOfClass:[MGLVectorStyleLayer class]] && [streetsSourceIdentifiers containsObject:layer.sourceIdentifier] && [placeSourceLayerIdentifiers containsObject:layer.sourceLayerIdentifier]; + }]; + return [self.layers filteredArrayUsingPredicate:isPlacePredicate]; +} + +- (NS_ARRAY_OF(MGLStyleLayer *) *)roadStyleLayers { + NSSet *streetsSourceIdentifiers = [self.mapboxStreetsSources valueForKey:@"identifier"]; + + NSPredicate *isPlacePredicate = [NSPredicate predicateWithBlock:^BOOL (MGLVectorStyleLayer * _Nullable layer, NSDictionary<NSString *, id> * _Nullable bindings) { + return [layer isKindOfClass:[MGLVectorStyleLayer class]] && [streetsSourceIdentifiers containsObject:layer.sourceIdentifier] && [layer.sourceLayerIdentifier isEqualToString:@"road_label"]; + }]; + return [self.layers filteredArrayUsingPredicate:isPlacePredicate]; +} + @end diff --git a/platform/darwin/src/MGLStyle_Private.h b/platform/darwin/src/MGLStyle_Private.h index 92b08e844b..e5bd79dc02 100644 --- a/platform/darwin/src/MGLStyle_Private.h +++ b/platform/darwin/src/MGLStyle_Private.h @@ -14,6 +14,8 @@ namespace mbgl { @class MGLAttributionInfo; @class MGLMapView; @class MGLOpenGLStyleLayer; +@class MGLVectorSource; +@class MGLVectorStyleLayer; @interface MGLStyle (Private) @@ -30,4 +32,11 @@ namespace mbgl { @end +@interface MGLStyle (MGLStreetsAdditions) + +@property (nonatomic, readonly, copy) NS_ARRAY_OF(MGLVectorStyleLayer *) *placeStyleLayers; +@property (nonatomic, readonly, copy) NS_ARRAY_OF(MGLVectorStyleLayer *) *roadStyleLayers; + +@end + NS_ASSUME_NONNULL_END |