You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLAbstractShapeSource is an unfortunate name for an Objective-C class. The word “abstract” recalls Java’s kingdom of nouns. Until iOS SDK v4.0.0 goes out the door, we have an opportunity to rename classes to avoid this mess.
#10410 proposes unifying MGLShapeSource and MGLComputedShapeSource to obviate MGLAbstractShapeSource. That would be the ideal solution, though @asheemmamoowala would have a better idea how feasible it is.
If #10410 doesn’t make v4.0.0, the least we can do is to rename MGLShapeSource to MGLPredefinedShapeSource or somesuch, allowing MGLAbstractShapeSource to take its place as the new MGLShapeSource. This approach would be suboptimal, because the current MGLShapeSource is such a commonly used class that the developer might unknowingly reach for the abstract MGLShapeSource.
MGLAbstractShapeSource is an empty class. It doesn't add any interface or shared methods. The header (and corresponding implementation) defines the shared MGLShapeSourceOption and the conversion methods to the corresponding native structs.
You could get rid of the class and move the options to a new header/impl file.
That achieves the objectives of this ticket and the first bullet of #10410.
You could get rid of the class and move the options to a new header/impl file.
That sounds reasonable. It opens a small can of worms, though:
Remove MGLAbstractShapeSource.
Make MGLComputedShapeSource inherit directly from MGLSource. If MGLComputedShapeSource doesn’t inherit from MGLShapeSource, we need to get “shape” out of the name to avoid confusion. On the other hand, we may eventually need to make a distinction between computed sources that produce vector tiles versus those that produce raster tiles: Programmatically generated raster sources #7471.
Rename MGLComputedShapeSource to MGLComputedVectorSource? That would be confusing because it doesn’t inherit from MGLVectorSource.
Rename MGLRasterSource and MGLVectorSource to MGLRasterTileSource and MGLVectorTileSource, respectively? Then we could have both MGLVectorComputedSource alongside MGLVectorTileSource, with the possibility of an MGLRasterComputedSource in the future.
Move MGLShapeSourceOptionWrapsCoordinates and MGLShapeSourceOptionClipsCoordinates to MGLComputedShapeSource.h – but keep it the same MGLShapeSourceOption type? Would that be confusing? Would it also be confusing that MGLComputedVectorSource accepts MGLShapeSourceOptions but MGLVectorSource does not?
Rename MGLShapeSourceOption to MGLShapeProvidingOption, in reference to a theoretical MGLShapeProviding protocol that we don’t have to define just yet.
it makes the hierarchy resistant to extension by a new source type that doesn't want to accept an option that all sources have heretofore accepted
We could combine MGLShapeSourceOption and MGLTileSourceOption into a single MGLSourceOption extensible enumeration and have each source class’s initializer accept a dictionary with MGLSourceOptions as keys, ignoring the ones it doesn’t support. There’s plenty of precedent for that in Cocoa Touch, particularly in NSNotification userInfo dictionaries. The downside is that there’s less compile-time checking to prevent the use of options that get ignored, but documentation can mitigate that issue to some extent.
Note that, with #11224, MGLRasterDEMSource will accept one option that MGLRasterSource, its concrete superclass, does not.
Activity
asheemmamoowala commentedon Jan 8, 2018
MGLAbstractShapeSourceis an empty class. It doesn't add any interface or shared methods. The header (and corresponding implementation) defines the sharedMGLShapeSourceOptionand the conversion methods to the corresponding native structs.You could get rid of the class and move the options to a new header/impl file.
That achieves the objectives of this ticket and the first bullet of #10410.
1ec5 commentedon Feb 14, 2018
That sounds reasonable. It opens a small can of worms, though:
MGLShapeSourceOptionWrapsCoordinatesandMGLShapeSourceOptionClipsCoordinatesto MGLComputedShapeSource.h – but keep it the sameMGLShapeSourceOptiontype? Would that be confusing? Would it also be confusing that MGLComputedVectorSource acceptsMGLShapeSourceOptions but MGLVectorSource does not?MGLShapeSourceOptiontoMGLShapeProvidingOption, in reference to a theoreticalMGLShapeProvidingprotocol that we don’t have to define just yet./cc @mapbox/maps-ios
jfirebaugh commentedon Feb 21, 2018
MGLSourceMGLTiledSourceMGLTiledRasterSourceMGLTiledVectorSourceMGLComputedVectorSourceMGLShape[Vector]SourceMGLImage[Raster]Source(Unclear to me whether it's worth renaming the latter two.)
1ec5 commentedon Feb 21, 2018
We could combine
MGLShapeSourceOptionandMGLTileSourceOptioninto a singleMGLSourceOptionextensible enumeration and have each source class’s initializer accept a dictionary withMGLSourceOptions as keys, ignoring the ones it doesn’t support. There’s plenty of precedent for that in Cocoa Touch, particularly in NSNotificationuserInfodictionaries. The downside is that there’s less compile-time checking to prevent the use of options that get ignored, but documentation can mitigate that issue to some extent.Note that, with #11224, MGLRasterDEMSource will accept one option that MGLRasterSource, its concrete superclass, does not.
1ec5 commentedon Apr 2, 2018
Fixed in #11568 on the release-boba branch, which will become iOS map SDK v4.0.0 and macOS map SDK v0.7.0.