Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Texture as label in WhirlyGlobe
    primarykey
    data
    text
    <p><a href="http://code.google.com/p/whirlyglobe/" rel="nofollow">WhirlyGlobe</a> is a very useful framework and I would like to display Country Flags instead of names for each countries. When looking at LabelLayer.h it seems possible to overwrite the icontexture generated from Text label by a picture:</p> <pre><code>@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 } </code></pre> <p>But I didn't find any way to use label for picture display.<br> Can someone please help me understand how to replace Text label by Picture label? </p> <p>Following @Mousebird first answer here is what I"ve implemented:</p> <pre><code>// 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-&gt;setUsesMipmaps(true); texLabel.text = @""; texLabel.iconTexture = theTex-&gt;getId(); theScene-&gt;addChangeRequest(new AddTextureReq(theTex)); [texLabel setLoc:GeoCoord::CoordFromDegrees(5, -3)]; [labels addObject:texLabel]; [self.labelLayer addLabels:labels desc:labelDesc]; </code></pre> <p>Still a problem, the texture is loaded in memory but didn't appear. Putting a string as a text create a Blank square on the first character of the label </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload