WhirlyGlobe - очень полезная структура, и я хотел бы отображать флаги стран вместо названий для каждой страны.
При взгляде на LabelLayer.h кажется возможным перезаписать текстовую иконку, сгенерированную из текстовой метки рисунком:
@interface SingleLabel : NSObject {
NSString *text;
WhirlyGlobe::GeoCoord loc;
NSDictionary *desc; // If set, this overrides the top level description
WhirlyGlobe::SimpleIdentity iconTexture; // If non-zero, this is the texture to use as an icon }
Но я не нашел способа использовать метку для отображения изображения.
Может кто-нибудь, пожалуйста, помогите мне понять, как заменить текстовую метку на графическую метку?
После первого ответа @Mousebird я реализовал следующее:
// This describes how our labels will look
NSDictionary *labelDesc =
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],@"enable",
[UIColor clearColor],@"backgroundColor",
[UIColor whiteColor],@"textColor",
[UIFont boldSystemFontOfSize:16.0],@"font",
[NSNumber numberWithInt:4],@"drawOffset",
[NSNumber numberWithFloat:0.08],@"height",
[NSNumber numberWithFloat:0.08],@"width",
nil];
// Build up an individual label
NSMutableArray *labels = [[[NSMutableArray alloc] init] autorelease];
SingleLabel *texLabel = [[[SingleLabel alloc] init] autorelease];
Texture *theTex = new Texture(@"icon", @"png");
theTex->setUsesMipmaps(true);
texLabel.text = @"";
texLabel.iconTexture = theTex->getId();
theScene->addChangeRequest(new AddTextureReq(theTex));
[texLabel setLoc:GeoCoord::CoordFromDegrees(5, -3)];
[labels addObject:texLabel];
[self.labelLayer addLabels:labels desc:labelDesc];
Все еще проблема, текстура загружена в память, но не появилась. Поместив строку в текст, создайте пустой квадрат на первом символе метки