Skip to content

Instantly share code, notes, and snippets.

@mousebird
Created June 13, 2013 17:55
Show Gist options
  • Save mousebird/5775825 to your computer and use it in GitHub Desktop.
Save mousebird/5775825 to your computer and use it in GitHub Desktop.
// Add an admin0 (country, basically) outline and label
- (void)addCountry:(MaplyVectorObject *)vecs
{
if (!vecs)
return;
// Add the the vectors to the globe with a line width a color and other parameters
[globeViewC addVectors:@[vecs] desc:
@{kMaplyColor: [UIColor whiteColor],kMaplyVecWidth: @(5.0),kMaplyDrawOffset: @(4.0),kMaplyFade: @(1.0)}];
// But hey, what about a label? Let's figure out where it should go.
MaplyCoordinate center = [vecs center];
NSString *name = vecs.attributes[@"sovereignt"];
if (name)
{
// We'll create a 2D (screen) label at that point and the layout engine will control it
MaplyScreenLabel *admin0Label = [[MaplyScreenLabel alloc] init];
admin0Label.text = name;
admin0Label.loc = center;
admin0Label.selectable = NO;
admin0Label.layoutImportance = 1.0;
[globeViewC addScreenLabels:@[admin0Label] desc:
@{kMaplyColor: [UIColor whiteColor],kMaplyFont: [UIFont boldSystemFontOfSize:20.0],kMaplyShadowColor: [UIColor blackColor], kMaplyShadowSize: @(1.0), kMaplyFade: @(1.0)}];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment