[Feature] Progressive Loading

This is a combination of 30 commits by Wahib and alex-zen.

commit ebbde40ecc9a1c94067b77449943d0bc453267e6
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Sun Jul 7 00:01:26 2013 +0400

    [BugFix] Content item text stays on screen even after merge animation moves the content item off screen.

commit c3e5ecfdd39f040d9aa2ec3d51e6daef2b181618
Merge: 1fc04f7 6e46bd7
Author: Wahib <wahibfaizi@gmail.com>
Date:   Sat Jul 6 03:44:41 2013 -0700

    Merge pull request #3 from alex-zen/wahib

    Hotfix. Fixed browser page crash during merge animation

commit 6e46bd79182d981b7b3f042046a51e1e76d2f906
Author: alex-zen <alexz@mstlab.org>
Date:   Fri Jul 5 19:33:05 2013 +0400

    Hotfix. Fixed browser page crash during merge animation

commit 1fc04f78c0bfd9d013841fe7abcfcacb80cfc806
Merge: c65c8c6 5aaf5ae
Author: Wahib <wahibfaizi@gmail.com>
Date:   Fri Jul 5 07:52:59 2013 -0700

    Merge pull request #2 from alex-zen/wahib

    Implemented synchronization of viewport during merge animation.

commit 5aaf5ae953b40f65d1c6dd845ac315b2875509c6
Author: alex-zen <alexz@mstlab.org>
Date:   Fri Jul 5 15:51:55 2013 +0400

    Implemented synchronization of viewport during merge animation.

commit c65c8c6e0c8f2dc5fc4676d87741b4a358a6bc05
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Fri Jul 5 14:20:35 2013 +0400

    Clip ToYear dates in DB.

    -ToYear for some timelines is set to 9999 to indicate ongoing event but this confilcts with minspan calculations. Therefore we need to clip ToYear values before calculating minspan.

commit 313fc22f6b55fa21dd6c35091fd4530f0be8a986
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Fri Jul 5 01:57:10 2013 +0400

    Disable progressive loading in authoring mode.

commit 7812eda6d8e30371ece50394791a86cf243f7b5e
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Fri Jul 5 01:04:37 2013 +0400

    [Bug Fix] Wrong URL hash parsing during refresh.

commit f2970ca7faade57b82a0c848a6204ce30b9529a9
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 22:35:26 2013 +0400

    Disable progressive loading when in authoring mode.

commit 479ebc4b25bdd8c3a7ab98fb2bc9c40ff8a3cd5e
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 22:05:01 2013 +0400

    Invoke updateAxis after moveToVisible in displayRootTimeline.

commit a4b6f8181e39c494676957ad408b4ba5ef4688a5
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 17:56:56 2013 +0400

    Keep Viewport and URL in sync.

    - Clicking on a timeline, exhibit or content item updates the URL to show the path of the clicked item.
    - When no item is clicked update the URL to show the path to the LCA.
    - Properly handle URL params such @tour and @bookmark.

commit 1ec0278a24ab73196546357501188efb23182e1e
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 15:19:22 2013 +0400

    Enable progressive loading on all collections.

commit 11aeb382c40524f978e2519a28a0d33faad99aa9
Merge: 71445e9 79e9e45
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 02:38:37 2013 +0400

    Merge branch 'master' of github.com:alterm4nn/ChronoZoom into progressive-loading

commit 71445e9b8b33767df2ba03b018029f3f15dd31d9
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 02:21:39 2013 +0400

    Enable progressive loading for regimes.

commit a972728cb59f3b1c0f9a8f20148e68b8a84b9fd5
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Thu Jul 4 00:33:06 2013 +0400

    Show progress bar when loading missing data from server.
    Disable Merge during elliptical zoom animations.

commit a9ca4dc3424d63cb2a05505129dead2221c142b7
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 21:57:27 2013 +0400

    [BugFix] Leaf timelines don't have exhibits.

commit 966bf26a121e1d4eb9f5c1e89b20a178475e7cfe
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 21:21:50 2013 +0400

    Enable progressive loading for tours.

commit 1c47e8bf9c5aa9a3e7ba8da9514338ba28b1feef
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 17:42:34 2013 +0400

    Enable progressive loading for search results.

commit fac3c7b82fa1aeb682a14146ac666304f0260f16
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 16:38:35 2013 +0400

    Enable progressive loading on default collection.

commit 562115c894cd43bdfacc0bfa8f382c70db244018
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 15:44:39 2013 +0400

    Update Merge.

    - Update Layout.mergeTimelines. Remove assertion that both the source and destination children are in the same order.
    - Update Storage.FillTimelinesFromFlatList. Remove dependancy on property SubtreeSize as it can contain inconsistent/invalid data.
    e.g Timeline '3 Large Proterozoic Craters' has no children timelines but its SubtreeSize is 7.

commit 7cef847915da2fb5c37f4f31bd3c23a791e17f50
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 02:07:47 2013 +0400

    Update API GetTours. Add new API GetTour.

    GetTours: Returns list of available tours.
    GetTour: Returns the timelines (from root with exhibits and content items) needed to activate a tour.

commit a387906ffad8edfe2af9e62e92bddcb7291a0b7f
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Wed Jul 3 00:30:08 2013 +0400

    Update API Search.

    Modified SearchResult to include the parent timeline containing the search result.

    Including info about the parent timeline in the search result enables the client to request the server (using API GetTimelines)  for the  missing timelines needed to render the search result on the canvas.

commit dfbf4076dcc6bc2928b3825fcbaa8fe1f996f926
Merge: be9cc13 73de293
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Tue Jul 2 19:58:39 2013 +0400

    Merge branch 'progressive-loading' of github.com:Wahib/ChronoZoom into progressive-loading

commit 73de293d385afa95c527289c2a9d4ca180379c87
Merge: 53518f1 d680e67
Author: Wahib <wahibfaizi@gmail.com>
Date:   Tue Jul 2 08:57:46 2013 -0700

    Merge pull request #1 from alex-zen/wahib

    Implemented unification of elements in animatingElements. v 0.1

commit d680e67011d7aa1c0ba654d47f190cf89f9dfc04
Author: alex-zen <alexz@mstlab.org>
Date:   Tue Jul 2 19:48:47 2013 +0400

    Implemented unification of elements in animatingElements. v 0.1

commit be9cc13d20db07925a75da6c41b045316ac48fc8
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Tue Jul 2 17:32:33 2013 +0400

    Update API GetTimelines.

commit 6c84ce5c4eb80272b5313aac7efcbca2045ef4dd
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Tue Jul 2 14:16:44 2013 +0400

    Update DB migration script for procedure TimelineSubtreeQuery.

commit de7ea646a28f0d4179b006d5dff35cf89c2c7f40
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Tue Jul 2 01:53:10 2013 +0400

    Switch DB from SQL Server Compact Edition to LocalDB.

    - SQL Server Compact Edition does not support stored sql procedures.

commit 53518f1c2e9feec7cbd4bf347ab93879b1746dde
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Mon Jul 1 11:33:31 2013 +0400

    Refactor progressive loading code.

    - Rename CZ.Layout.Merge  to CZ.Layout.merge (M -> m)
    - Add onfinish callback to merge()
    - Add noAnimation parameter to merge()
    - Calculate eps in calculateForceOnChildren based on timeline width instead of height
    - Bug fix: update code to better detect intersection of elements in calculateForceOnChildren
    - Change animatingElements from a hashmap to an array to better handle multiple objects with same id
    - Use a timelines isBuffered property (instead of count of child timelines) to detect if a timeline contain all its child timelines. Once isBuffered is true it can't go back to false till the page is refreshed. This garantees that the timeline will take part in the merge only once.
    - Comment out test cases 1. assert: child content cannot exceed parent and 2. assert: child content doesnot overlap
    - Move getMissingTimelines from CZ.Common.controller to CZ.Common
    - Move the check for missing data from CZ.Common.controller.gesturesSource.Subscribe and CZ.Common.controller.moveToVisible to  CZ.Common.controller.onAnimationComplete
    As a result of this change the check for missing data is performed after the animation ends instead of at the beginning of the animation.

commit ed5d62ade0720a9baccb18ad6972758e043f35d2
Author: Wahib Faizi <wahib@mstlab.org>
Date:   Sun Jun 30 01:24:42 2013 +0400

    Remove use of goToSearchResult from clickOverBreadCrumb.

    It's better to separate the 2 components as search might have side effects that are unnecessary for breadcrumbs.
    e.g. when progressive loading is enabled, clicking on a search result can request the server for the searched item if it is not available on the client.
Merging progressive loading