• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Displaying an animated graph (= nodes and edges)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying an animated graph (= nodes and edges)


  • Subject: Displaying an animated graph (= nodes and edges)
  • From: Kaspar Fischer <email@hidden>
  • Date: Sun, 16 Aug 2009 12:43:44 +0200

Dear list,

After some hours of research I realise that I need some advice on how to tackle this: My goal is to render a graph [1] consisting of at most 100 nodes and 300 edges (most of the time the graph will be much smaller, though). I have an algorithm to position the nodes and the algorithm works in iterations so that I can use intermediate positions to animate the placement of the nodes. Ultimately, I want a scrolling view that allows the user to view the graph and pinch-zoom or double- tap zoom into it. When zooming in and when the user scrolls, it's okay if the parts that become visible are initially blurry and will get redrawn a little later. I need to be able to catch touch events on the nodes.

I have played around with a UIScrollView and an associated UIViewController<UIScrollViewDelegate>; the scroll view contains a custom view that draws the complete graph in its -(void)drawRect: (CGRect)rect method. I have two problems with this approach: On the one hand, when the user zoomed in, even though drawRect: is called again, it draws a blurry graph [2]. On the other hand, I am not sure how to animate the graph with this approach: I have no layers so I basically have to do the animation myself and I fear this does not leverage any of the iPhone's hardware capabilities (layer composition, etc).

I plan to have a background thread that runs the algorithm and at the end of each iteration tells the main (UI) thread the new positions of the nodes.

The questions I have:

1. Would you implement each graph node as a CALayer so that it can easily be animated, or will that result in too many layers for the iPhone's Core Animation framework?

2. Should I use UIScrollView? It already provides the scrollbars, the zooming and panning but I could not remove the blurriness/unsharpness.

I have also come across CATiledLayer but I am not sure whether they were intended to have sublayers (representing the nodes and edges).

Thanks in advance for any advice on any of these questions!
Kaspar

--
[1] a drawing as you can see on http://en.wikipedia.org/wiki/Graph_(mathematics)
[2] http://halmueller.wordpress.com/2008/10/08/a-very-simple-uiscrollview-demo/
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Displaying an animated graph (= nodes and edges)
      • From: Kaspar Fischer <email@hidden>
  • Prev by Date: Stymied by NSCollectionView
  • Next by Date: Re: Cleaning "garbage" in Core Data
  • Previous by thread: Stymied by NSCollectionView
  • Next by thread: Re: Displaying an animated graph (= nodes and edges)
  • Index(es):
    • Date
    • Thread