Wednesday, August 1, 2012

WhirlyGlobe Component: Announcement

I'm pleased to announce the WhirlyGlobe Component, an easy to use wrapper on top of WhirlyGlobe.

For users who may not be familiar with WhirlyGlobe, here's the summary.
WhirlyGlobe is a 3D globe rendering toolkit for iPad and iPhone.  It lets you put labels, markers, and vectors on top of a 3D interactive globe with a base layer of pageable image data.





Who It's For & What It Is

The Component is for people who wanted to use WhirlyGlobe, but had trouble compiling it, getting it to run, or dealing with the threading.  You know, most everyone.

WhirlyGlobe Component is most of the interesting functionality without all the stuff that drove people crazy.  It's all Objective C, there are no weird template headers to include, and you can safely ignore threading issues.  Don't get me wrong, all that's still in there, I'm just hiding it.

Where To Get It

I'm putting the WhirlyGlobe Component into beta right now.  You can get the latest version off WhirlyGlobe's github download section.

There are two main pieces in that download:

  • WhirlyGlobeComponent.framework
  • WhirlyGlobeComponentTester

The Tester is my test app.  It's self documenting (Ha!  I kill me).  Just load it up and check out TestViewController.m.  All the important logic is in there.

Using The Framework

It's much easier to include the WhirlyGlobe Component framework in your own project.  That's the whole point.

When setting up a new project, here's all you have to do.
  • Drag WhirlyGlobeComponent.framework into your project view.
  • Add the following standard Apple frameworks that WhirlyGlobe needs.
    • OpenGLES
    • QuartzCore
    • libsqlite3
    • libstdc++
  • Point the Header Search Paths at the WhirlyGlobeComponent.framework/Headers directory.
  • Add -all_load to the Other Linker Flags.  You'll get a missing selector without this.

To actually create a WhirlyGlobeViewController and use it, look at TestViewController.m in the WhirlyGlobeComponentTester app.

Future

At the moment I'm supporting a variety of base image layers, both remote and local, paged and not.  I'm also supporting markers and labels in both 2D and 3D modes.  Selection is working, as is UIView overlay.

The only big feature missing is vector data.  I'm contemplating how best to include that in an intuitive way.  Barring a little testing, that's the last feature before release.  In the mean time, it works great, give it a try.

52 comments:

  1. I think you need to add "-all_load" to "Other Linker Flags" in order to not get an uncaught exception thrown. By the way, this is really cool!

    ReplyDelete
  2. Great. A beautiful piece of software, Thanks a lot for sharing.

    Regards, Bjørn Asle

    btw; the paths as distributed in your latest beta zip needs a bit of work ;)

    ReplyDelete
    Replies
    1. Thanks!

      Tell me more about the paths. I'd like to make this as simple as possible.

      Delete
    2. Hope it´s not my sligthly modified Xcode that´s causing this, but when I used

      "WhirlyGlobeComponentDistribution_0_93.zip" the header path was pointing to ../../WhirlyGlobeSrc and maps/geojson etc had to be correctly referenced as well. Basically all headers and resources.

      Not a biggie to change at all, but for the casual developer it breaks with a zillion not found messages.

      Cheers, Bjørn Asle

      Delete
    3. Great project, and I can't wait to get it working myself, but I'm having the 'casual developer' problem (not that long an Xcode programmer), and I'm seeing those zillion messages pointing to folders that don't exist. Is there a detailed explanation available of how to arrange the folders/paths to make everything work? Do I need to have both the full API setup and the Component setup on my drive? Where should they be? I feel 'so near yet so far'. Thanks, Ted

      Delete
    4. The problem is the path to resources in the project. It's pointing somewhere you don't have, even though all the files are in the distribution.

      If you click on the resources node in the project, you can edit the path and just point it to the resources directory in WhirlyGlobeComponentTester.

      You could also just delete the resources node and then drag the resources folder right into the project under WhirlyGlobeComponentTester.

      I'll also update the distribution. Doh!

      Delete
  3. does the whirlyglobe component has the same functionality as the older whirlyglobe.framework ?, i mean can i do everything i was doing with the older framework?

    ReplyDelete
    Replies
    1. It's a subset of functionality, but it's the vast majority of what most people were doing.

      If you have a working app then it probably makes less sense to switch over. I'm not going to close the API or anything.

      What does your app do?

      Delete
  4. I've been using WhirlyGlobeComponent for an internal project and I just upgraded XCode and got a "ld: file is universal (2 slices) but does not contain a(n) armv7s slice" error. I was still using the 0.93 version of the component and am downloading the 1.0 version, but I thought I'd let you know. I'm using the globe to display our market regions for a training app and the users are really enjoying playing with the maps.

    ReplyDelete
  5. You should upgrade to 1.0, I think, but that won't fix it.

    Here's a good explanation:
    http://stackoverflow.com/questions/12402092/file-is-universal-3-slices-but-does-not-contain-an-armv7s-slice-error-for-st

    You will not lose support for the iPhone5 if you follow those instructions, just a few optimizations in the instruction set.

    I will, of course, update the Component, but it may be a few days.

    ReplyDelete
    Replies
    1. Thank you for the reference to the stackoverflow question. I will upgrade the project to the 1.0 version and follow those instructions and keep an eye out for your update. Thank you for providing such a cool tool.

      Chris

      Delete
    2. Happy to and shoot me a picture or two of your app if you can.

      I never publish those without permission, but it's still fun to see what people are doing.

      Delete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. Is it possible through the use of google earth images or just other earth images to continue the zoom levels all the way down to ground level?

    ReplyDelete
    Replies
    1. You can't use Google data, but you can add your own data, make something with TileMill or use a service like MapBox.

      Delete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. how create object like MaplyMarker (the label lies on globe plane) but with zoomable (scales) like MaplyScreenLabel

    ReplyDelete
  11. There's a MaplyLabel, but that's just a 3D label like the 3d MaplyMarker. There isn't an object that changes size with the zoom and lies on the screen plane.

    ReplyDelete
  12. How to set background color with Clear color
    if I set globe.clearColor = [UIColor clearColor] i get black BG

    ReplyDelete
    Replies
    1. It's complicated. Here's an explanation:
      https://github.com/mousebird/WhirlyGlobe/issues/28

      Delete
    2. Still this issue does not explain how to set the color of the globe (and not the background behind the globe..

      Delete
    3. Yeah, the question is just about setting the background color of the OpenGL and UIView. To set the color of the globe you'd need to have a base map. You can further modify those colors with a UIColor of your own on the MaplyQuadImageTilesLayer.

      Delete
    4. How would you go about changing the color? I understand you need to edit the base map, but how or where in terms of code do you make this so?

      Delete
  13. Can you help me ho create correct pvrtc from some png Image (size 1944X1944) for map?

    ReplyDelete
    Replies
    1. That's what ImageChopper is for: https://code.google.com/p/whirlyglobe/wiki/Imagery

      Documentation's a bit out of date. Just run it to see what the options are.

      Delete
    2. Hm all good when compile (no error) but when I added to proj texture does not want load and all pvrtc file (open in xcode) shows ™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆ú¶î™™™™∆úßî™™™™∆úßî™™™™∆ú¶î™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆ú¶î™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™™∆úßî™™™ do you has any idea about it?

      Delete
  14. Xcode doesn't recognize PVRTC.

    Once you've created the tile set with ImageChopper, you need to load it with addSphericalEarthLayerWithImageSet: on the globe view controller. You give it the name of the plist like so:
    WGViewControllerLayer *layer = [globeViewC addSphericalEarthLayerWithImageSet:@"lowres_wtb_info"];

    ReplyDelete
  15. In 2.2 relesed, MaplyScreenLabel looks very blurry, and with transparent in old build all be ok, Can you help me, maybe you know where is problem.
    P.S. Set clear background color dont fixed, I still cannot set [UIColor clearColor], so I load sources and fix by my self =)

    ReplyDelete
    Replies
    1. Can you send a screen shot? And what hardware are you running on? Make sure the blurriness happens on the device and not just the simulator.

      With 2.2 I moved to font based rendering and it saves a lot of CPU and memory, but the result may be different. I could tweak this a bit if it's clear what the problem is.

      Delete
  16. iOS 6, iPhone 5, latest code from git.
    https://www.dropbox.com/s/md643qiqqc4tn1q/map.png - screen (in prev version font was be like country border lines)
    _screenLabelDesc = @{kMaplyTextColor: screenLabelColor, - white
    kMaplyBackgroundColor: screenLabelBackColor, - clear
    kMaplyFont: [UIFont systemFontOfSize:12.0]

    ReplyDelete
    Replies
    1. I'll take a look. In the mean time you can make them more distinct by giving the text an outline (say, in black).

      Delete
    2. Can you leave a comment when you fix this issue?

      Delete
    3. It might be easier to track the issue: https://github.com/mousebird/WhirlyGlobe/issues/61

      Delete
    4. There's a fix in the develop branch.

      Delete
    5. Build new developer brach but get 11 warnings like
      ld: warning: direct access in WhirlyKit::DrawableChangeRequest::execute(WhirlyKit::Scene*, WhirlyKitSceneRendererES*, WhirlyKitView*) to global weak symbol boost::detail::spinlock_pool<1>::pool_ means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
      Can you help me remove this warning?

      Delete
    6. I see that occasionally, then it'll disappear, which suggests it's the compiler being dumb.

      No idea how to get rid of it, I'm afraid.

      Also, for issues like this please go use the github page.

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Hi, I need help in one more problems, it is centered MaplyScreenLabel in country. I use
    MaplyCoordinate center;
    [wgVecObj largestLoopCenter:&center mbrLL:nil mbrUR:nil];

    MaplyScreenLabel *screenLabel = [[MaplyScreenLabel alloc] init]

    screenLabel.loc = center;
    But founded center is not good, its shows for example on Norway an Sweden
    P.S. screen https://www.dropbox.com/s/oo1f7yt29c2c11m/Map1.png

    ReplyDelete
  19. Can you ask this over on github?
    https://github.com/mousebird/WhirlyGlobe/issues

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. This is really cool. But how we can change theImage icon for the Geography class- Mapbox Tiles-Local.
    If my understanding is not wrong then you are using this code to get the map.

    [baseViewC addQuadEarthLayerWithMBTiles:@"geography-class"];

    ReplyDelete
    Replies
    1. That setup is pretty old. Take a look at WhirlyGlobe-Maply 2.2, which is just about to be formally released.
      http://mousebirdconsulting.blogspot.com/2013/11/whirlyglobe-maply-22-beta4.html

      Delete
  22. Thanks for your input. But in the old version which i was using is having the zooming problem. I didn't find any method or property to set the zooming level.

    ReplyDelete
    Replies
    1. Look for the height attribute on the WhirlyGlobeViewController. The units are height above the surface of the earth where the earth has a radius of 1.0.

      Delete
    2. This comment has been removed by the author.

      Delete
  23. can we set the color of globe?.By default map is having a unique/particular color assigned to each country. My requirement is when i load the map it should fill the color of country based on some input.

    ReplyDelete