Skip to content

Commit

Permalink
* New automatic marker scaling feature for better support of iPhone 6…
Browse files Browse the repository at this point in the history
… and iPhone 6 plus.

* New MEMapView delegate callbacks to notify applications of device scale changes.
* New test: Core/Scale Test that allows you to test different content scales.

Technical explanation:
http://wiki.ba3.us/index.php/September_26,_2014_-_iOS_Release_v1.9-1-g67bad06

API documentation:
http://dev1.ba3.us/ios/doc/Classes/MEMapViewController.html#//api/name/autoScaleMarkerImages

Relevant code samples:
AltusDemo/AltusDemo/Tests/Core/ScaleTest.m

Apple's recently introduced the iPhone 6 and iPhone 6 Plus. We have updated Altus to account for some changes introduced by these devices. At a high level:
* These are the first iOS devices where the physical resolution of render target the GPU is drawing to is by default different than the physical resolution of the screen.
* With these devices, Apple has introduced a Zoom mode that allows the change the scale and thus affect how things appear. The intent of Zoom mode is to make things appear a bit larger to the user.
* On iPhone 6 and iPhone 6 Plus, scaling is done for apps that don't have @3x resolution image assets.
* Even when an application does have appropriately scaled assets (@3x resolution images, etc.), by default, there is still a scaling (downscaling on iPhone 6 Plus, upscaling on iPhone 6) step to the physical screen because the screen's physical resolution is different the the GPU render target resolution.

The bottom line is that on iPhone 6 and iPhone 6 Plus scaling operations are occurring in some form, by default, in most cases. The type of and the amount of scaling can vary depending on a variety of factors.

== What Does This Mean For Your Application? ==

=== It May Not Be An Issue  ===
If you are using any version prior to Altus 1.9, and you are only targeting the iPad or up to iPhone 5s, then this will not affect you as long as:
* On non-Retina (@1x) devices you always supply marker images that are @1x resolution
* On Retina devices (@2x) you always supply marker images that are @2x resolution.

=== It May Be An Issue ===
If you are targeting iPhone 6 or iPhone 6 Plus and you have @2x marker assets you could see issues with marker image size and locations.

If you are using Altus prior to version 1.9 you may see these issues. There are 2 issues:

* Altus 1.8 and older, on iOS, assumes the render target will always be 1x or 2x. It also assumes marker images may be scaled based on the UIImage scale value. The marker anchoring and hit test logic won't work when the render target is between 2x and 3x.

* The iPhone 6 and 6 Plus use variable scale factors depending on a variety of factors. In other words scale can be anything.

== What You Can Do ==

In the ideal scenario, you upgrade to Altus 1.9 or later and make sure that your raster assets for markers have the same scale as the MEMapView content scale. In this way you will have the most ideal representation of your map assets.

If this is not practical for you, you can use the Altus 1.9 to automatically scale marker images to the right resolution for you.

=== Altus 1.9 Automatic Marker Scaling ===

This is new feature introduced in Altus 1.9 that is enabled by default. With this feature, Altus disregards the scale of UIImages used for markers and scales them up or down based on the content scale factor of the map view.

== In Summary ==
There are 3 possible "native" scales for just the iPhone 6 plus, if you include the simulator so marker assets must be scaled in some way to appear at the correct relative size.

The ideal scenario would be to provide assets at the exact same scale at the default MEMapView, so use @2x assets on when the scale factor is 2.0. But unless you are dynamically generating raster assets (with something like PaintCode) it may not be feasible to do this.

In that case, if the assets are higher (@3x) than the native scale, Altus 1.9 will scale them appropriately.

If the assets are lower (@1x or @2x) than the native scale, Altus 1.9 will scale them up. The upscale filtering may be noticeable, but there will be no extra performance hit for rendering them.
  • Loading branch information
bruceba3 committed Sep 27, 2014
1 parent fe868dd commit 7580f21
Show file tree
Hide file tree
Showing 70 changed files with 1,255 additions and 968 deletions.
42 changes: 36 additions & 6 deletions AltusDemo/AltusDemo.xcodeproj/project.pbxproj
Expand Up @@ -93,7 +93,6 @@
324E3BA4191AD3F300B1961A /* blueplane.png in Resources */ = {isa = PBXBuildFile; fileRef = 324E3B98191AD3F300B1961A /* blueplane.png */; };
324E3BA5191AD3F300B1961A /* blueplane@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 324E3B99191AD3F300B1961A /* blueplane@2x.png */; };
324E777618FF66BE00630F18 /* CustomClustering.m in Sources */ = {isa = PBXBuildFile; fileRef = 324E777518FF66BE00630F18 /* CustomClustering.m */; };
3250914419CFE69D00B9B312 /* GLKViewInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3250914219CFE69D00B9B312 /* GLKViewInfo.m */; };
32587CFF19121062008B9C0C /* TerrainInRadiusTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32587CF519121062008B9C0C /* TerrainInRadiusTests.m */; };
32587D0019121062008B9C0C /* TerrainMapFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = 32587CF719121062008B9C0C /* TerrainMapFinder.m */; };
32587D0119121062008B9C0C /* TerrainProfileTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32587CF919121062008B9C0C /* TerrainProfileTests.m */; };
Expand Down Expand Up @@ -155,6 +154,14 @@
32C20CA6197D9D64006DCE84 /* DynamicPolygons.m in Sources */ = {isa = PBXBuildFile; fileRef = 32C20CA5197D9D64006DCE84 /* DynamicPolygons.m */; };
32C5159419296053000ECFFE /* MultiViewControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 32C5159319296053000ECFFE /* MultiViewControl.m */; };
32C97F0019CE9FCC004D7179 /* reticle.png in Resources */ = {isa = PBXBuildFile; fileRef = 32C97EFF19CE9FCC004D7179 /* reticle.png */; };
32CD0B7319D6B2430040B043 /* ScaleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CD0B6C19D6B2430040B043 /* ScaleTest.m */; };
32CD0B7419D6B2430040B043 /* ScaleTest.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B6D19D6B2430040B043 /* ScaleTest.png */; };
32CD0B7519D6B2430040B043 /* ScaleTest@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B6E19D6B2430040B043 /* ScaleTest@2x.png */; };
32CD0B7619D6B2430040B043 /* ScaleTest@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B6F19D6B2430040B043 /* ScaleTest@3x.png */; };
32CD0B7719D6B2430040B043 /* ScaleTestCircle.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B7019D6B2430040B043 /* ScaleTestCircle.png */; };
32CD0B7819D6B2430040B043 /* ScaleTestCircle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B7119D6B2430040B043 /* ScaleTestCircle@2x.png */; };
32CD0B7919D6B2430040B043 /* ScaleTestCircle@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32CD0B7219D6B2430040B043 /* ScaleTestCircle@3x.png */; };
32CD0B7C19D6B2D40040B043 /* METestView.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CD0B7B19D6B2D40040B043 /* METestView.m */; };
32D7CF681924B67200F1125C /* MapFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D7CF671924B67200F1125C /* MapFactory.m */; };
32E0B83B19513F90009F37A3 /* Fractals.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E0B83A19513F90009F37A3 /* Fractals.m */; };
32E0B84019515991009F37A3 /* ContentLoading.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E0B83F19515991009F37A3 /* ContentLoading.m */; };
Expand Down Expand Up @@ -292,8 +299,6 @@
324E3B99191AD3F300B1961A /* blueplane@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blueplane@2x.png"; sourceTree = "<group>"; };
324E777418FF66BE00630F18 /* CustomClustering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomClustering.h; sourceTree = "<group>"; };
324E777518FF66BE00630F18 /* CustomClustering.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomClustering.m; sourceTree = "<group>"; };
3250914219CFE69D00B9B312 /* GLKViewInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLKViewInfo.m; sourceTree = "<group>"; };
3250914319CFE69D00B9B312 /* GLKViewInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLKViewInfo.h; sourceTree = "<group>"; };
32587CF419121062008B9C0C /* TerrainInRadiusTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerrainInRadiusTests.h; sourceTree = "<group>"; };
32587CF519121062008B9C0C /* TerrainInRadiusTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TerrainInRadiusTests.m; sourceTree = "<group>"; };
32587CF619121062008B9C0C /* TerrainMapFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerrainMapFinder.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -402,6 +407,16 @@
32C5159219296053000ECFFE /* MultiViewControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiViewControl.h; sourceTree = "<group>"; };
32C5159319296053000ECFFE /* MultiViewControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultiViewControl.m; sourceTree = "<group>"; };
32C97EFF19CE9FCC004D7179 /* reticle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = reticle.png; sourceTree = "<group>"; };
32CD0B6B19D6B2430040B043 /* ScaleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScaleTest.h; sourceTree = "<group>"; };
32CD0B6C19D6B2430040B043 /* ScaleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScaleTest.m; sourceTree = "<group>"; };
32CD0B6D19D6B2430040B043 /* ScaleTest.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ScaleTest.png; sourceTree = "<group>"; };
32CD0B6E19D6B2430040B043 /* ScaleTest@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ScaleTest@2x.png"; sourceTree = "<group>"; };
32CD0B6F19D6B2430040B043 /* ScaleTest@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ScaleTest@3x.png"; sourceTree = "<group>"; };
32CD0B7019D6B2430040B043 /* ScaleTestCircle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ScaleTestCircle.png; sourceTree = "<group>"; };
32CD0B7119D6B2430040B043 /* ScaleTestCircle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ScaleTestCircle@2x.png"; sourceTree = "<group>"; };
32CD0B7219D6B2430040B043 /* ScaleTestCircle@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ScaleTestCircle@3x.png"; sourceTree = "<group>"; };
32CD0B7A19D6B2D40040B043 /* METestView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = METestView.h; sourceTree = "<group>"; };
32CD0B7B19D6B2D40040B043 /* METestView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = METestView.m; sourceTree = "<group>"; };
32D7CF661924B67200F1125C /* MapFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapFactory.h; sourceTree = "<group>"; };
32D7CF671924B67200F1125C /* MapFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapFactory.m; sourceTree = "<group>"; };
32E0B83919513F90009F37A3 /* Fractals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fractals.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -718,6 +733,8 @@
321E0D0018B67DFD0011218A /* Weather */,
327E334218ADA52000FBBB90 /* METest.h */,
327E334318ADA52000FBBB90 /* METest.m */,
32CD0B7A19D6B2D40040B043 /* METestView.h */,
32CD0B7B19D6B2D40040B043 /* METestView.m */,
327E334418ADA52000FBBB90 /* METestCategory.h */,
327E334518ADA52000FBBB90 /* METestCategory.m */,
327E334618ADA52000FBBB90 /* METestConsts.h */,
Expand Down Expand Up @@ -931,10 +948,16 @@
isa = PBXGroup;
children = (
32FB97D6193E6372004A9371 /* Core.h */,
3250914319CFE69D00B9B312 /* GLKViewInfo.h */,
3250914219CFE69D00B9B312 /* GLKViewInfo.m */,
32FB97D7193E6372004A9371 /* Stats.h */,
32FB97D3193E6350004A9371 /* Stats.m */,
32CD0B6B19D6B2430040B043 /* ScaleTest.h */,
32CD0B6C19D6B2430040B043 /* ScaleTest.m */,
32CD0B6D19D6B2430040B043 /* ScaleTest.png */,
32CD0B6E19D6B2430040B043 /* ScaleTest@2x.png */,
32CD0B6F19D6B2430040B043 /* ScaleTest@3x.png */,
32CD0B7019D6B2430040B043 /* ScaleTestCircle.png */,
32CD0B7119D6B2430040B043 /* ScaleTestCircle@2x.png */,
32CD0B7219D6B2430040B043 /* ScaleTestCircle@3x.png */,
326928B71954E9BE007108B3 /* MapLoadingStats.h */,
326928B81954E9BE007108B3 /* MapLoadingStats.m */,
);
Expand Down Expand Up @@ -1058,6 +1081,8 @@
3247FD0618D827BE00F2A449 /* knots25@2x.png in Resources */,
324ACC2818AEB00600833819 /* apple_golf@2x.png in Resources */,
3247FD0918D827BE00F2A449 /* knots35.png in Resources */,
32CD0B7919D6B2430040B043 /* ScaleTestCircle@3x.png in Resources */,
32CD0B7619D6B2430040B043 /* ScaleTest@3x.png in Resources */,
324E3B9E191AD3F300B1961A /* redplane.png in Resources */,
3247FD0118D827BE00F2A449 /* knots15.png in Resources */,
3247FD0B18D827BE00F2A449 /* knots40.png in Resources */,
Expand All @@ -1069,6 +1094,7 @@
32BAC4DC18AF3F9E00DE8583 /* Places.sqlite in Resources */,
324E3B9D191AD3F300B1961A /* purpleplane@2x.png in Resources */,
3247FD0A18D827BE00F2A449 /* knots35@2x.png in Resources */,
32CD0B7719D6B2430040B043 /* ScaleTestCircle.png in Resources */,
3247FCFE18D827BE00F2A449 /* knots5@2x.png in Resources */,
324ACC3818AEB01400833819 /* HoustonStreets.sqlite in Resources */,
3247FCFC18D827BE00F2A449 /* knots0@2x.png in Resources */,
Expand All @@ -1092,6 +1118,8 @@
3219133E18C90ADD008B2143 /* Tower.png in Resources */,
3202DAFC197473A400691332 /* whitecircle_solid.png in Resources */,
327E335E18ADE27000FBBB90 /* Earthquakes.mbtiles in Resources */,
32CD0B7419D6B2430040B043 /* ScaleTest.png in Resources */,
32CD0B7519D6B2430040B043 /* ScaleTest@2x.png in Resources */,
3247FD0218D827BE00F2A449 /* knots15@2x.png in Resources */,
3200E99F192B7FF900D59E55 /* Asteroid@2x.png in Resources */,
3219134118C90ECE008B2143 /* Towers.sqlite in Resources */,
Expand All @@ -1105,6 +1133,7 @@
3247FD0318D827BE00F2A449 /* knots20.png in Resources */,
32BAC4C018AF261400DE8583 /* Acadia.map in Resources */,
328192281977C68A0006DB63 /* bluecircle_semitransparent.png in Resources */,
32CD0B7819D6B2430040B043 /* ScaleTestCircle@2x.png in Resources */,
3247FD0718D827BE00F2A449 /* knots30.png in Resources */,
324ACC3218AEB00600833819 /* park@2x.png in Resources */,
324ACC3318AEB00600833819 /* waterTexture.png in Resources */,
Expand Down Expand Up @@ -1191,11 +1220,11 @@
32E0B84019515991009F37A3 /* ContentLoading.m in Sources */,
324E3B8C191AD25200B1961A /* AirTrafficScenario.m in Sources */,
32FB97D4193E6350004A9371 /* Stats.m in Sources */,
32CD0B7C19D6B2D40040B043 /* METestView.m in Sources */,
32D7CF681924B67200F1125C /* MapFactory.m in Sources */,
32BAC4DB18AF3F9E00DE8583 /* Places.m in Sources */,
32F0A1F21945825400E82C6E /* RoutePlotting.m in Sources */,
B9A983FD1986B2B700B73F37 /* PolygonStyle.m in Sources */,
3250914419CFE69D00B9B312 /* GLKViewInfo.m in Sources */,
32587CFF19121062008B9C0C /* TerrainInRadiusTests.m in Sources */,
B9A984021986B53300B73F37 /* AnimatedVectorCircle.m in Sources */,
327D106F192FA82E00EF84D8 /* MovingObject2D.m in Sources */,
Expand All @@ -1209,6 +1238,7 @@
B941659E18F880700061DEEB /* DynamicColorBar.m in Sources */,
327E337018AE010F00FBBB90 /* MapQuestAerial.m in Sources */,
327E335C18ADE1CD00FBBB90 /* MBTilesNative.m in Sources */,
32CD0B7319D6B2430040B043 /* ScaleTest.m in Sources */,
327E334C18ADA52000FBBB90 /* METestCategory.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion AltusDemo/AltusDemo/Tests/Core/Core.h
Expand Up @@ -2,4 +2,4 @@
#pragma once
#import "Stats.h"
#import "MapLoadingStats.h"
#import "GLKViewInfo.h"
#import "ScaleTest.h"
13 changes: 0 additions & 13 deletions AltusDemo/AltusDemo/Tests/Core/GLKViewInfo.h

This file was deleted.

39 changes: 0 additions & 39 deletions AltusDemo/AltusDemo/Tests/Core/GLKViewInfo.m

This file was deleted.

26 changes: 26 additions & 0 deletions AltusDemo/AltusDemo/Tests/Core/ScaleTest.h
@@ -0,0 +1,26 @@
//
// ScaleTest.h
// AltusDemo
//
// Created by Bruce Shankle on 9/23/14.
// Copyright (c) 2014 BA3, LLC. All rights reserved.
//
#pragma once
#import "../METest.h"

@interface ScaleTest : METest <MEMarkerMapDelegate, MEDynamicMarkerMapDelegate, MEMapViewDelegate, MEVectorMapDelegate>
@property (nonatomic, retain) UISwitch* markerAutoScaleSwitch;
@property (nonatomic, retain) UISlider* scaleSlider;
@property (retain) UILabel* lblStats;
@property (retain) UILabel* lblScaleSlider;
@property (retain) UISegmentedControl* imageType;
@property (retain) UISegmentedControl* tileSize;
@property (assign) int markerId;
@property (assign) NSString* rasterMapName;
@property (assign) NSString* dynamicMarkerMapName;
@property (assign) NSString* clusteredMarkerMapName;
@property (assign) NSString* vectorMapName;
@property (assign) NSString* vectorCircleName;
@property (assign) NSString* mapUrlTemplate;
@property (assign) CGPoint blueCircleAnchor;
@end

0 comments on commit 7580f21

Please sign in to comment.