cesium 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +259 -0
- data/README.rdoc +90 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/Assets/Assets.profile.js +8 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
- data/app/assets/javascripts/Assets/Textures/NE2_LR_LC_SR_W_DR_2048.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/waterNormals.jpg +0 -0
- data/app/assets/javascripts/Assets/package.json +6 -0
- data/app/assets/javascripts/Cesium.js +320 -0
- data/app/assets/javascripts/Core/AnimationController.js +148 -0
- data/app/assets/javascripts/Core/AxisAlignedBoundingBox.js +243 -0
- data/app/assets/javascripts/Core/BoundingRectangle.js +364 -0
- data/app/assets/javascripts/Core/BoundingSphere.js +819 -0
- data/app/assets/javascripts/Core/BoxTessellator.js +93 -0
- data/app/assets/javascripts/Core/Cartesian2.js +762 -0
- data/app/assets/javascripts/Core/Cartesian3.js +861 -0
- data/app/assets/javascripts/Core/Cartesian4.js +762 -0
- data/app/assets/javascripts/Core/Cartographic.js +211 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +232 -0
- data/app/assets/javascripts/Core/Clock.js +195 -0
- data/app/assets/javascripts/Core/ClockRange.js +37 -0
- data/app/assets/javascripts/Core/ClockStep.js +32 -0
- data/app/assets/javascripts/Core/Color.js +1629 -0
- data/app/assets/javascripts/Core/ComponentDatatype.js +119 -0
- data/app/assets/javascripts/Core/Core.profile.js +8 -0
- data/app/assets/javascripts/Core/CubeMapEllipsoidTessellator.js +198 -0
- data/app/assets/javascripts/Core/CubicRealPolynomial.js +251 -0
- data/app/assets/javascripts/Core/DefaultProxy.js +30 -0
- data/app/assets/javascripts/Core/DeveloperError.js +60 -0
- data/app/assets/javascripts/Core/EarthOrientationParameters.js +383 -0
- data/app/assets/javascripts/Core/EarthOrientationParametersSample.js +50 -0
- data/app/assets/javascripts/Core/Ellipsoid.js +539 -0
- data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +207 -0
- data/app/assets/javascripts/Core/EllipsoidalOccluder.js +151 -0
- data/app/assets/javascripts/Core/EncodedCartesian3.js +197 -0
- data/app/assets/javascripts/Core/Enumeration.js +67 -0
- data/app/assets/javascripts/Core/Event.js +122 -0
- data/app/assets/javascripts/Core/Extent.js +383 -0
- data/app/assets/javascripts/Core/ExtentTessellator.js +384 -0
- data/app/assets/javascripts/Core/FAR.js +13 -0
- data/app/assets/javascripts/Core/FeatureDetection.js +126 -0
- data/app/assets/javascripts/Core/Fullscreen.js +235 -0
- data/app/assets/javascripts/Core/GeographicProjection.js +107 -0
- data/app/assets/javascripts/Core/HermitePolynomialApproximation.js +176 -0
- data/app/assets/javascripts/Core/HermiteSpline.js +234 -0
- data/app/assets/javascripts/Core/Iau2006XysData.js +259 -0
- data/app/assets/javascripts/Core/Iau2006XysSample.js +36 -0
- data/app/assets/javascripts/Core/IndexDatatype.js +28 -0
- data/app/assets/javascripts/Core/Intersect.js +40 -0
- data/app/assets/javascripts/Core/IntersectionTests.js +359 -0
- data/app/assets/javascripts/Core/Interval.js +27 -0
- data/app/assets/javascripts/Core/Iso8601.js +46 -0
- data/app/assets/javascripts/Core/JulianDate.js +1228 -0
- data/app/assets/javascripts/Core/KeyboardEventModifier.js +38 -0
- data/app/assets/javascripts/Core/LagrangePolynomialApproximation.js +96 -0
- data/app/assets/javascripts/Core/LeapSecond.js +158 -0
- data/app/assets/javascripts/Core/LinearApproximation.js +98 -0
- data/app/assets/javascripts/Core/Math.js +532 -0
- data/app/assets/javascripts/Core/Matrix2.js +833 -0
- data/app/assets/javascripts/Core/Matrix3.js +1099 -0
- data/app/assets/javascripts/Core/Matrix4.js +2164 -0
- data/app/assets/javascripts/Core/MeshFilters.js +568 -0
- data/app/assets/javascripts/Core/Occluder.js +474 -0
- data/app/assets/javascripts/Core/OrientationInterpolator.js +109 -0
- data/app/assets/javascripts/Core/PlaneTessellator.js +74 -0
- data/app/assets/javascripts/Core/PolygonPipeline.js +792 -0
- data/app/assets/javascripts/Core/PolylinePipeline.js +90 -0
- data/app/assets/javascripts/Core/PrimitiveType.js +80 -0
- data/app/assets/javascripts/Core/QuadraticRealPolynomial.js +146 -0
- data/app/assets/javascripts/Core/QuarticRealPolynomial.js +339 -0
- data/app/assets/javascripts/Core/Quaternion.js +947 -0
- data/app/assets/javascripts/Core/Queue.js +95 -0
- data/app/assets/javascripts/Core/Ray.js +64 -0
- data/app/assets/javascripts/Core/ReferenceFrame.js +25 -0
- data/app/assets/javascripts/Core/RequestErrorEvent.js +35 -0
- data/app/assets/javascripts/Core/RuntimeError.js +59 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventHandler.js +658 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventType.js +149 -0
- data/app/assets/javascripts/Core/Shapes.js +230 -0
- data/app/assets/javascripts/Core/Spherical.js +192 -0
- data/app/assets/javascripts/Core/TaskProcessor.js +131 -0
- data/app/assets/javascripts/Core/TimeConstants.js +85 -0
- data/app/assets/javascripts/Core/TimeInterval.js +305 -0
- data/app/assets/javascripts/Core/TimeIntervalCollection.js +543 -0
- data/app/assets/javascripts/Core/TimeStandard.js +31 -0
- data/app/assets/javascripts/Core/Tipsify.js +285 -0
- data/app/assets/javascripts/Core/Transforms.js +614 -0
- data/app/assets/javascripts/Core/TridiagonalSystemSolver.js +102 -0
- data/app/assets/javascripts/Core/Visibility.js +38 -0
- data/app/assets/javascripts/Core/WebMercatorProjection.js +154 -0
- data/app/assets/javascripts/Core/WindingOrder.js +40 -0
- data/app/assets/javascripts/Core/binarySearch.js +69 -0
- data/app/assets/javascripts/Core/buildModuleUrl.js +77 -0
- data/app/assets/javascripts/Core/clone.js +21 -0
- data/app/assets/javascripts/Core/combine.js +81 -0
- data/app/assets/javascripts/Core/computeSunPosition.js +116 -0
- data/app/assets/javascripts/Core/createGuid.js +25 -0
- data/app/assets/javascripts/Core/defaultValue.js +22 -0
- data/app/assets/javascripts/Core/destroyObject.js +61 -0
- data/app/assets/javascripts/Core/freezeObject.js +20 -0
- data/app/assets/javascripts/Core/getImagePixels.js +46 -0
- data/app/assets/javascripts/Core/isLeapYear.js +30 -0
- data/app/assets/javascripts/Core/jsonp.js +116 -0
- data/app/assets/javascripts/Core/loadArrayBuffer.js +76 -0
- data/app/assets/javascripts/Core/loadImage.js +85 -0
- data/app/assets/javascripts/Core/loadJson.js +54 -0
- data/app/assets/javascripts/Core/loadText.js +78 -0
- data/app/assets/javascripts/Core/loadXML.js +76 -0
- data/app/assets/javascripts/Core/package.json +6 -0
- data/app/assets/javascripts/Core/pointInsideTriangle2D.js +41 -0
- data/app/assets/javascripts/Core/requestAnimationFrame.js +61 -0
- data/app/assets/javascripts/Core/throttleRequestByServer.js +74 -0
- data/app/assets/javascripts/Core/writeTextToCanvas.js +92 -0
- data/app/assets/javascripts/DynamicScene/CompositeDynamicObjectCollection.js +254 -0
- data/app/assets/javascripts/DynamicScene/CzmlBoolean.js +57 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian2.js +96 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartographic.js +125 -0
- data/app/assets/javascripts/DynamicScene/CzmlColor.js +127 -0
- data/app/assets/javascripts/DynamicScene/CzmlDefaults.js +135 -0
- data/app/assets/javascripts/DynamicScene/CzmlHorizontalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlImage.js +61 -0
- data/app/assets/javascripts/DynamicScene/CzmlLabelStyle.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlNumber.js +82 -0
- data/app/assets/javascripts/DynamicScene/CzmlString.js +56 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitQuaternion.js +172 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitSpherical.js +98 -0
- data/app/assets/javascripts/DynamicScene/CzmlVerticalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +245 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +347 -0
- data/app/assets/javascripts/DynamicScene/DynamicColorMaterial.js +78 -0
- data/app/assets/javascripts/DynamicScene/DynamicCone.js +291 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizer.js +350 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +389 -0
- data/app/assets/javascripts/DynamicScene/DynamicDirectionsProperty.js +163 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoid.js +158 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoidVisualizer.js +277 -0
- data/app/assets/javascripts/DynamicScene/DynamicImageMaterial.js +136 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabel.js +286 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +341 -0
- data/app/assets/javascripts/DynamicScene/DynamicMaterialProperty.js +125 -0
- data/app/assets/javascripts/DynamicScene/DynamicObject.js +364 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectCollection.js +137 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +299 -0
- data/app/assets/javascripts/DynamicScene/DynamicPath.js +214 -0
- data/app/assets/javascripts/DynamicScene/DynamicPathVisualizer.js +402 -0
- data/app/assets/javascripts/DynamicScene/DynamicPoint.js +184 -0
- data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +323 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygon.js +138 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygonVisualizer.js +251 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +183 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +268 -0
- data/app/assets/javascripts/DynamicScene/DynamicPositionProperty.js +525 -0
- data/app/assets/javascripts/DynamicScene/DynamicProperty.js +352 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramid.js +204 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramidVisualizer.js +302 -0
- data/app/assets/javascripts/DynamicScene/DynamicScene.profile.js +8 -0
- data/app/assets/javascripts/DynamicScene/DynamicVertexPositionsProperty.js +199 -0
- data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +155 -0
- data/app/assets/javascripts/DynamicScene/VisualizerCollection.js +181 -0
- data/app/assets/javascripts/DynamicScene/package.json +6 -0
- data/app/assets/javascripts/DynamicScene/processCzml.js +77 -0
- data/app/assets/javascripts/Renderer/BlendEquation.js +52 -0
- data/app/assets/javascripts/Renderer/BlendFunction.js +158 -0
- data/app/assets/javascripts/Renderer/BlendingState.js +64 -0
- data/app/assets/javascripts/Renderer/Buffer.js +141 -0
- data/app/assets/javascripts/Renderer/BufferUsage.js +48 -0
- data/app/assets/javascripts/Renderer/ClearCommand.js +40 -0
- data/app/assets/javascripts/Renderer/CommandLists.js +42 -0
- data/app/assets/javascripts/Renderer/Context.js +2805 -0
- data/app/assets/javascripts/Renderer/CubeMap.js +358 -0
- data/app/assets/javascripts/Renderer/CubeMapFace.js +202 -0
- data/app/assets/javascripts/Renderer/CullFace.js +50 -0
- data/app/assets/javascripts/Renderer/DepthFunction.js +95 -0
- data/app/assets/javascripts/Renderer/DrawCommand.js +96 -0
- data/app/assets/javascripts/Renderer/Framebuffer.js +435 -0
- data/app/assets/javascripts/Renderer/MipmapHint.js +50 -0
- data/app/assets/javascripts/Renderer/PickFramebuffer.js +178 -0
- data/app/assets/javascripts/Renderer/PixelDatatype.js +86 -0
- data/app/assets/javascripts/Renderer/PixelFormat.js +113 -0
- data/app/assets/javascripts/Renderer/Renderbuffer.js +102 -0
- data/app/assets/javascripts/Renderer/RenderbufferFormat.js +77 -0
- data/app/assets/javascripts/Renderer/Renderer.profile.js +8 -0
- data/app/assets/javascripts/Renderer/ShaderCache.js +121 -0
- data/app/assets/javascripts/Renderer/ShaderProgram.js +2402 -0
- data/app/assets/javascripts/Renderer/StencilFunction.js +95 -0
- data/app/assets/javascripts/Renderer/StencilOperation.js +95 -0
- data/app/assets/javascripts/Renderer/Texture.js +395 -0
- data/app/assets/javascripts/Renderer/TextureAtlas.js +472 -0
- data/app/assets/javascripts/Renderer/TextureAtlasBuilder.js +133 -0
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +41 -0
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +77 -0
- data/app/assets/javascripts/Renderer/TextureWrap.js +50 -0
- data/app/assets/javascripts/Renderer/UniformDatatype.js +218 -0
- data/app/assets/javascripts/Renderer/UniformState.js +799 -0
- data/app/assets/javascripts/Renderer/VertexArray.js +365 -0
- data/app/assets/javascripts/Renderer/VertexArrayFacade.js +574 -0
- data/app/assets/javascripts/Renderer/VertexLayout.js +49 -0
- data/app/assets/javascripts/Renderer/loadCubeMap.js +92 -0
- data/app/assets/javascripts/Renderer/package.json +6 -0
- data/app/assets/javascripts/Scene/AnimationCollection.js +249 -0
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +384 -0
- data/app/assets/javascripts/Scene/Billboard.js +680 -0
- data/app/assets/javascripts/Scene/BillboardCollection.js +1209 -0
- data/app/assets/javascripts/Scene/BingMapsImageryProvider.js +460 -0
- data/app/assets/javascripts/Scene/BingMapsStyle.js +55 -0
- data/app/assets/javascripts/Scene/Camera.js +358 -0
- data/app/assets/javascripts/Scene/CameraColumbusViewMode.js +30 -0
- data/app/assets/javascripts/Scene/CameraController.js +1258 -0
- data/app/assets/javascripts/Scene/CameraEventAggregator.js +270 -0
- data/app/assets/javascripts/Scene/CameraEventType.js +53 -0
- data/app/assets/javascripts/Scene/CameraFlightPath.js +495 -0
- data/app/assets/javascripts/Scene/CentralBody.js +817 -0
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1120 -0
- data/app/assets/javascripts/Scene/CentralBodySurfaceShaderSet.js +107 -0
- data/app/assets/javascripts/Scene/ComplexConicSensorVolume.js +511 -0
- data/app/assets/javascripts/Scene/CompositePrimitive.js +454 -0
- data/app/assets/javascripts/Scene/CullingVolume.js +59 -0
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +440 -0
- data/app/assets/javascripts/Scene/DiscardMissingTileImagePolicy.js +134 -0
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +412 -0
- data/app/assets/javascripts/Scene/EllipsoidTerrainProvider.js +182 -0
- data/app/assets/javascripts/Scene/FrameState.js +86 -0
- data/app/assets/javascripts/Scene/FrustumCommands.js +32 -0
- data/app/assets/javascripts/Scene/GeographicTilingScheme.js +265 -0
- data/app/assets/javascripts/Scene/HorizontalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/Imagery.js +85 -0
- data/app/assets/javascripts/Scene/ImageryLayer.js +876 -0
- data/app/assets/javascripts/Scene/ImageryLayerCollection.js +403 -0
- data/app/assets/javascripts/Scene/ImageryProvider.js +185 -0
- data/app/assets/javascripts/Scene/ImageryProviderError.js +149 -0
- data/app/assets/javascripts/Scene/ImageryState.js +20 -0
- data/app/assets/javascripts/Scene/Label.js +706 -0
- data/app/assets/javascripts/Scene/LabelCollection.js +697 -0
- data/app/assets/javascripts/Scene/LabelStyle.js +39 -0
- data/app/assets/javascripts/Scene/Material.js +1177 -0
- data/app/assets/javascripts/Scene/NeverTileDiscardPolicy.js +38 -0
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +282 -0
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +345 -0
- data/app/assets/javascripts/Scene/PerformanceDisplay.js +183 -0
- data/app/assets/javascripts/Scene/PerspectiveFrustum.js +239 -0
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +394 -0
- data/app/assets/javascripts/Scene/Polygon.js +886 -0
- data/app/assets/javascripts/Scene/Polyline.js +441 -0
- data/app/assets/javascripts/Scene/PolylineCollection.js +1532 -0
- data/app/assets/javascripts/Scene/Projections.js +93 -0
- data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +224 -0
- data/app/assets/javascripts/Scene/Scene.js +632 -0
- data/app/assets/javascripts/Scene/Scene.profile.js +8 -0
- data/app/assets/javascripts/Scene/SceneMode.js +51 -0
- data/app/assets/javascripts/Scene/SceneTransitioner.js +776 -0
- data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1063 -0
- data/app/assets/javascripts/Scene/SensorVolumeCollection.js +192 -0
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +295 -0
- data/app/assets/javascripts/Scene/SkyAtmosphere.js +239 -0
- data/app/assets/javascripts/Scene/SkyBox.js +231 -0
- data/app/assets/javascripts/Scene/TerrainProvider.js +229 -0
- data/app/assets/javascripts/Scene/TexturePool.js +154 -0
- data/app/assets/javascripts/Scene/Tile.js +322 -0
- data/app/assets/javascripts/Scene/TileDiscardPolicy.js +42 -0
- data/app/assets/javascripts/Scene/TileImagery.js +36 -0
- data/app/assets/javascripts/Scene/TileLoadQueue.js +123 -0
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +337 -0
- data/app/assets/javascripts/Scene/TileReplacementQueue.js +139 -0
- data/app/assets/javascripts/Scene/TileState.js +19 -0
- data/app/assets/javascripts/Scene/TilingScheme.js +213 -0
- data/app/assets/javascripts/Scene/VerticalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/ViewportQuad.js +256 -0
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +374 -0
- data/app/assets/javascripts/Scene/WebMercatorTilingScheme.js +291 -0
- data/app/assets/javascripts/Scene/package.json +6 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.glsl +30 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.js +31 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +68 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +54 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.glsl +927 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.js +322 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.glsl +106 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.js +82 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.glsl +20 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.js +22 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.glsl +29 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.js +28 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.glsl +88 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.js +69 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.glsl +9 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.js +13 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.glsl +12 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.js +15 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.glsl +448 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.js +361 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.glsl +19 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.js +20 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.glsl +886 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.js +586 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.glsl +126 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.js +95 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.glsl +14 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.js +18 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +40 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.js +38 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.glsl +26 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.glsl +25 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.js +23 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.glsl +42 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.js +36 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.js +27 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.js +20 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.glsl +38 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.js +32 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.js +18 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.glsl +23 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.js +24 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.glsl +12 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.js +15 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.glsl +28 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.js +21 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.glsl +13 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.glsl +14 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.js +17 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/Water.glsl +91 -0
- data/app/assets/javascripts/Shaders/Materials/Water.js +60 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.glsl +36 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.js +31 -0
- data/app/assets/javascripts/Shaders/Noise.glsl +453 -0
- data/app/assets/javascripts/Shaders/Noise.js +242 -0
- data/app/assets/javascripts/Shaders/PolygonFS.glsl +27 -0
- data/app/assets/javascripts/Shaders/PolygonFS.js +23 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.js +11 -0
- data/app/assets/javascripts/Shaders/PolygonVS.glsl +38 -0
- data/app/assets/javascripts/Shaders/PolygonVS.js +39 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.glsl +30 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.js +32 -0
- data/app/assets/javascripts/Shaders/PolylineFS.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolylineFS.js +11 -0
- data/app/assets/javascripts/Shaders/PolylineVS.glsl +34 -0
- data/app/assets/javascripts/Shaders/PolylineVS.js +35 -0
- data/app/assets/javascripts/Shaders/Ray.glsl +532 -0
- data/app/assets/javascripts/Shaders/Ray.js +357 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.glsl +26 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.js +22 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.glsl +11 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.js +14 -0
- data/app/assets/javascripts/Shaders/SensorVolume.glsl +43 -0
- data/app/assets/javascripts/Shaders/SensorVolume.js +31 -0
- data/app/assets/javascripts/Shaders/Shaders.profile.js +8 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.glsl +70 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.js +62 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.glsl +131 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.js +115 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.js +14 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.js +14 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.glsl +16 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.js +17 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.js +14 -0
- data/app/assets/javascripts/Shaders/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/ThirdParty.profile.js +8 -0
- data/app/assets/javascripts/ThirdParty/Tween.js +678 -0
- data/app/assets/javascripts/ThirdParty/Uri.js +277 -0
- data/app/assets/javascripts/ThirdParty/measureText.js +197 -0
- data/app/assets/javascripts/ThirdParty/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/sprintf.js +319 -0
- data/app/assets/javascripts/ThirdParty/when.js +748 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.css +175 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.html +52 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.js +1237 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.html +4 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.js +349 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.css +1 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.js +47 -0
- data/app/assets/javascripts/Widgets/Dojo/checkForChromeFrame.js +71 -0
- data/app/assets/javascripts/Widgets/Images/Bing_Logo_51x19_White.png +0 -0
- data/app/assets/javascripts/Widgets/Images/Cesium_Logo_overlay.png +0 -0
- data/app/assets/javascripts/Widgets/Images/TimelineIcons.png +0 -0
- data/app/assets/javascripts/Widgets/Images/ajax-loader.gif +0 -0
- data/app/assets/javascripts/Widgets/Images/animationBar.png +0 -0
- data/app/assets/javascripts/Widgets/Images/viewControlBar.png +0 -0
- data/app/assets/javascripts/Widgets/Timeline.css +113 -0
- data/app/assets/javascripts/Widgets/Timeline.js +629 -0
- data/app/assets/javascripts/Widgets/TimelineHighlightRange.js +51 -0
- data/app/assets/javascripts/Widgets/TimelineTrack.js +54 -0
- data/app/assets/javascripts/Widgets/Widgets.profile.js +8 -0
- data/app/assets/javascripts/Widgets/package.json +6 -0
- data/app/assets/javascripts/Workers/Workers.profile.js +8 -0
- data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +2015 -0
- data/app/assets/javascripts/Workers/createTaskProcessorWorker.js +55 -0
- data/app/assets/javascripts/Workers/createVerticesFromExtent.js +24 -0
- data/app/assets/javascripts/Workers/package.json +6 -0
- data/app/assets/javascripts/copyrightHeader.js +22 -0
- data/app/assets/javascripts/main.js +10 -0
- data/app/assets/stylesheets/cesium.css +4 -0
- data/app/controllers/cesium_controller.rb +4 -0
- data/app/helpers/cesium_helper.rb +2 -0
- data/app/views/cesium/index.html.erb +3 -0
- data/config/routes.rb +3 -0
- data/lib/cesium.rb +4 -0
- data/lib/cesium/engine.rb +4 -0
- data/lib/cesium/version.rb +3 -0
- data/lib/tasks/cesium_tasks.rake +4 -0
- data/test/cesium_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/adapters/jquery-adapter.js.coffee +4 -0
- data/test/dummy/app/assets/javascripts/app.js.coffee +11 -0
- data/test/dummy/app/assets/javascripts/application.js.coffee +73 -0
- data/test/dummy/app/assets/stylesheets/application.css +12 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +21 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/requirejs.yml +10 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/functional/cesium_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/cesium_helper_test.rb +4 -0
- metadata +641 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,113 @@
|
|
1
|
+
.timelineMain {
|
2
|
+
position: relative;
|
3
|
+
left: 0;
|
4
|
+
top: 0;
|
5
|
+
overflow: hidden;
|
6
|
+
border: solid 1px #888;
|
7
|
+
}
|
8
|
+
|
9
|
+
.timelineTrackContainer {
|
10
|
+
width: 100%;
|
11
|
+
overflow: auto;
|
12
|
+
border-top: solid 1px #888;
|
13
|
+
position: relative;
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
.timelineTracks {
|
19
|
+
position: absolute;
|
20
|
+
top: 0;
|
21
|
+
left: 0;
|
22
|
+
width: 100%;
|
23
|
+
}
|
24
|
+
|
25
|
+
.timelineNeedle {
|
26
|
+
position: absolute;
|
27
|
+
left: 0;
|
28
|
+
top: 0;
|
29
|
+
width: 1px;
|
30
|
+
height: 100%;
|
31
|
+
z-index: 50;
|
32
|
+
background: #F00;
|
33
|
+
}
|
34
|
+
|
35
|
+
.timelineBar {
|
36
|
+
position: relative;
|
37
|
+
left: 0;
|
38
|
+
top: 0;
|
39
|
+
overflow: hidden;
|
40
|
+
/*border: solid 1px #888;*/
|
41
|
+
width: 100%;
|
42
|
+
height: 1.7em;
|
43
|
+
z-index: 100;
|
44
|
+
background-color: #fafafa;
|
45
|
+
background-repeat: repeat-x;
|
46
|
+
background: -webkit-linear-gradient(top, #eee, #fff, #fafafa);
|
47
|
+
background: -moz-linear-gradient(top, #eee, #fff, #fafafa);
|
48
|
+
background: -ms-linear-gradient(top, #eee, #fff, #fafafa);
|
49
|
+
background: -o-linear-gradient(top, #eee, #fff, #fafafa);
|
50
|
+
background: linear-gradient(top, #eee, #fff, #fafafa);
|
51
|
+
}
|
52
|
+
|
53
|
+
.timelineRuler {
|
54
|
+
/* NOTE: The label and the ruler must use the same font/size */
|
55
|
+
visibility: hidden;
|
56
|
+
white-space: nowrap;
|
57
|
+
font-size: 80%;
|
58
|
+
z-index: -200;
|
59
|
+
}
|
60
|
+
|
61
|
+
.timelineHighlight {
|
62
|
+
position: absolute;
|
63
|
+
bottom: 0;
|
64
|
+
left: 0;
|
65
|
+
background: #08F;
|
66
|
+
}
|
67
|
+
|
68
|
+
.timelineTicLabel {
|
69
|
+
position: absolute;
|
70
|
+
top: 0;
|
71
|
+
left: 0;
|
72
|
+
white-space: nowrap;
|
73
|
+
font-size: 80%;
|
74
|
+
color: #000;
|
75
|
+
cursor: default;
|
76
|
+
}
|
77
|
+
|
78
|
+
.timelineTicMain {
|
79
|
+
position: absolute;
|
80
|
+
bottom: 0;
|
81
|
+
left: 0;
|
82
|
+
width: 1px;
|
83
|
+
height: 50%;
|
84
|
+
background: #000;
|
85
|
+
}
|
86
|
+
|
87
|
+
.timelineTicSub {
|
88
|
+
position: absolute;
|
89
|
+
bottom: 0;
|
90
|
+
left: 0;
|
91
|
+
width: 1px;
|
92
|
+
height: 33%;
|
93
|
+
background: #444;
|
94
|
+
}
|
95
|
+
|
96
|
+
.timelineTicTiny {
|
97
|
+
position: absolute;
|
98
|
+
bottom: 0;
|
99
|
+
left: 0;
|
100
|
+
width: 1px;
|
101
|
+
height: 25%;
|
102
|
+
background: #888;
|
103
|
+
}
|
104
|
+
|
105
|
+
.timelineIcon16 {
|
106
|
+
display: block;
|
107
|
+
position: absolute;
|
108
|
+
width: 16px;
|
109
|
+
height: 16px;
|
110
|
+
background-image: url("Images/TimelineIcons.png");
|
111
|
+
background-repeat: no-repeat;
|
112
|
+
z-index: 10;
|
113
|
+
}
|
@@ -0,0 +1,629 @@
|
|
1
|
+
/*global define*/
|
2
|
+
define([
|
3
|
+
'./TimelineTrack',
|
4
|
+
'./TimelineHighlightRange',
|
5
|
+
'../Core/DeveloperError',
|
6
|
+
'../Core/Clock',
|
7
|
+
'../Core/ClockRange',
|
8
|
+
'../Core/JulianDate'
|
9
|
+
], function (
|
10
|
+
TimelineTrack,
|
11
|
+
TimelineHighlightRange,
|
12
|
+
DeveloperError,
|
13
|
+
Clock,
|
14
|
+
ClockRange,
|
15
|
+
JulianDate) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
var timelineWheelDelta = 1e12;
|
19
|
+
|
20
|
+
var timelineMouseMode = {
|
21
|
+
none : 0,
|
22
|
+
scrub : 1,
|
23
|
+
slide : 2,
|
24
|
+
zoom : 3,
|
25
|
+
touchOnly : 4
|
26
|
+
};
|
27
|
+
var timelineTouchMode = {
|
28
|
+
none : 0,
|
29
|
+
scrub : 1,
|
30
|
+
slideZoom : 2,
|
31
|
+
singleTap : 3,
|
32
|
+
ignore : 4
|
33
|
+
};
|
34
|
+
|
35
|
+
var timelineTicScales = [0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.25, 0.5, 1.0, 2.0, 5.0, 10.0, 15.0, 30.0, 60.0, // 1min
|
36
|
+
120.0, // 2min
|
37
|
+
300.0, // 5min
|
38
|
+
600.0, // 10min
|
39
|
+
900.0, // 15min
|
40
|
+
1800.0, // 30min
|
41
|
+
3600.0, // 1hr
|
42
|
+
7200.0, // 2hr
|
43
|
+
14400.0, // 4hr
|
44
|
+
21600.0, // 6hr
|
45
|
+
43200.0, // 12hr
|
46
|
+
86400.0, // 24hr
|
47
|
+
172800.0, // 2days
|
48
|
+
345600.0, // 4days
|
49
|
+
604800.0, // 7days
|
50
|
+
1296000.0, // 15days
|
51
|
+
2592000.0, // 30days
|
52
|
+
5184000.0, // 60days
|
53
|
+
7776000.0, // 90days
|
54
|
+
15552000.0, // 180days
|
55
|
+
31536000.0, // 365days
|
56
|
+
63072000.0, // 2years
|
57
|
+
126144000.0, // 4years
|
58
|
+
157680000.0, // 5years
|
59
|
+
315360000.0, // 10years
|
60
|
+
630720000.0, // 20years
|
61
|
+
1261440000.0, // 40years
|
62
|
+
1576800000.0, // 50years
|
63
|
+
3153600000.0, // 100years
|
64
|
+
6307200000.0, // 200years
|
65
|
+
12614400000.0, // 400years
|
66
|
+
15768000000.0, // 500years
|
67
|
+
31536000000.0 // 1000years
|
68
|
+
];
|
69
|
+
|
70
|
+
var timelineMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
71
|
+
|
72
|
+
function Timeline(id, clock) {
|
73
|
+
if (typeof (id) === 'string') {
|
74
|
+
this._topElement = document.getElementById(id);
|
75
|
+
} else {
|
76
|
+
this._topElement = id;
|
77
|
+
}
|
78
|
+
this._clock = clock;
|
79
|
+
this._scrubJulian = clock.currentTime;
|
80
|
+
this._mainTicSpan = -1;
|
81
|
+
this._mouseMode = timelineMouseMode.none;
|
82
|
+
this._touchMode = timelineTouchMode.none;
|
83
|
+
this._touchState = {
|
84
|
+
centerX : 0,
|
85
|
+
spanX : 0
|
86
|
+
};
|
87
|
+
this._mouseX = 0;
|
88
|
+
var widget = this;
|
89
|
+
|
90
|
+
this._topElement.className += ' timelineMain';
|
91
|
+
this._topElement.innerHTML = '<div class="timelineBar"></div><div class="timelineTrackContainer">' +
|
92
|
+
'<canvas class="timelineTracks" width="10" height="1">' +
|
93
|
+
'</canvas></div><div class="timelineNeedle"></div><span class="timelineRuler"></span>';
|
94
|
+
this._timeBarEle = this._topElement.childNodes[0];
|
95
|
+
this._trackContainer = this._topElement.childNodes[1];
|
96
|
+
this._trackListEle = this._topElement.childNodes[1].childNodes[0];
|
97
|
+
this._needleEle = this._topElement.childNodes[2];
|
98
|
+
this._rulerEle = this._topElement.childNodes[3];
|
99
|
+
this._context = this._trackListEle.getContext('2d');
|
100
|
+
|
101
|
+
this._trackList = [];
|
102
|
+
this._highlightRanges = [];
|
103
|
+
|
104
|
+
this.zoomTo(clock.startTime, clock.stopTime);
|
105
|
+
|
106
|
+
this._timeBarEle.addEventListener('mousedown', function(e) {
|
107
|
+
widget._handleMouseDown(e);
|
108
|
+
}, false);
|
109
|
+
document.addEventListener('mouseup', function(e) {
|
110
|
+
widget._handleMouseUp(e);
|
111
|
+
}, false);
|
112
|
+
document.addEventListener('mousemove', function(e) {
|
113
|
+
widget._handleMouseMove(e);
|
114
|
+
}, false);
|
115
|
+
this._timeBarEle.addEventListener('DOMMouseScroll', function(e) {
|
116
|
+
widget._handleMouseWheel(e);
|
117
|
+
}, false); // Mozilla mouse wheel
|
118
|
+
this._timeBarEle.addEventListener('mousewheel', function(e) {
|
119
|
+
widget._handleMouseWheel(e);
|
120
|
+
}, false);
|
121
|
+
this._timeBarEle.addEventListener('touchstart', function(e) {
|
122
|
+
widget._handleTouchStart(e);
|
123
|
+
}, false);
|
124
|
+
document.addEventListener('touchmove', function(e) {
|
125
|
+
widget._handleTouchMove(e);
|
126
|
+
}, false);
|
127
|
+
document.addEventListener('touchend', function(e) {
|
128
|
+
widget._handleTouchEnd(e);
|
129
|
+
}, false);
|
130
|
+
this._topElement.oncontextmenu = function() {
|
131
|
+
return false;
|
132
|
+
};
|
133
|
+
|
134
|
+
window.addEventListener('resize', function() {
|
135
|
+
widget.handleResize();
|
136
|
+
}, false);
|
137
|
+
|
138
|
+
this.addEventListener = function(type, listener, useCapture) {
|
139
|
+
widget._topElement.addEventListener(type, listener, useCapture);
|
140
|
+
};
|
141
|
+
}
|
142
|
+
|
143
|
+
Timeline.prototype.addHighlightRange = function(color, heightInPx) {
|
144
|
+
var newHighlightRange = new TimelineHighlightRange(color, heightInPx);
|
145
|
+
this._highlightRanges.push(newHighlightRange);
|
146
|
+
this.handleResize();
|
147
|
+
return newHighlightRange;
|
148
|
+
};
|
149
|
+
|
150
|
+
Timeline.prototype.addTrack = function(interval, heightInPx, color, backgroundColor) {
|
151
|
+
var newTrack = new TimelineTrack(interval, heightInPx, color, backgroundColor);
|
152
|
+
this._trackList.push(newTrack);
|
153
|
+
this.handleResize();
|
154
|
+
return newTrack;
|
155
|
+
};
|
156
|
+
|
157
|
+
Timeline.prototype.zoomTo = function(startJulianDate, endJulianDate) {
|
158
|
+
this._timeBarSecondsSpan = startJulianDate.getSecondsDifference(endJulianDate);
|
159
|
+
if (this._timeBarSecondsSpan <= 0) {
|
160
|
+
throw new DeveloperError('Start time must come before end time.');
|
161
|
+
}
|
162
|
+
this._startJulian = startJulianDate;
|
163
|
+
this._endJulian = endJulianDate;
|
164
|
+
|
165
|
+
// If clock is not unbounded, clamp timeline range to clock.
|
166
|
+
if (this._clock && (this._clock.clockRange !== ClockRange.UNBOUNDED)) {
|
167
|
+
var clockStart = this._clock.startTime;
|
168
|
+
var clockEnd = this._clock.stopTime;
|
169
|
+
var clockSpan = clockStart.getSecondsDifference(clockEnd);
|
170
|
+
var startOffset = this._startJulian.getSecondsDifference(clockStart);
|
171
|
+
var endOffset = this._endJulian.getSecondsDifference(clockEnd);
|
172
|
+
|
173
|
+
if (this._timeBarSecondsSpan >= clockSpan) {
|
174
|
+
// if new duration longer than clock range duration, clamp to full range.
|
175
|
+
this._timeBarSecondsSpan = clockSpan;
|
176
|
+
this._startJulian = this._clock.startTime;
|
177
|
+
this._endJulian = this._clock.stopTime;
|
178
|
+
} else if (startOffset > 0) {
|
179
|
+
// if timeline start is before clock start, shift right
|
180
|
+
this._endJulian = this._endJulian.addSeconds(startOffset);
|
181
|
+
this._startJulian = clockStart;
|
182
|
+
this._timeBarSecondsSpan = this._startJulian.getSecondsDifference(this._endJulian);
|
183
|
+
} else if (endOffset < 0) {
|
184
|
+
// if timeline end is after clock end, shift left
|
185
|
+
this._startJulian = this._startJulian.addSeconds(endOffset);
|
186
|
+
this._endJulian = clockEnd;
|
187
|
+
this._timeBarSecondsSpan = this._startJulian.getSecondsDifference(this._endJulian);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
this.handleResize();
|
192
|
+
|
193
|
+
var evt = document.createEvent('Event');
|
194
|
+
evt.initEvent('setzoom', true, true);
|
195
|
+
evt.startJulian = this._startJulian;
|
196
|
+
evt.endJulian = this._endJulian;
|
197
|
+
evt.epochJulian = this._epochJulian;
|
198
|
+
evt.totalSpan = this._timeBarSecondsSpan;
|
199
|
+
evt.mainTicSpan = this._mainTicSpan;
|
200
|
+
this._topElement.dispatchEvent(evt);
|
201
|
+
};
|
202
|
+
|
203
|
+
Timeline.prototype.zoomFrom = function(amount) {
|
204
|
+
var centerSec = this._startJulian.getSecondsDifference(this._scrubJulian);
|
205
|
+
if ((amount > 1) || (centerSec < 0) || (centerSec > this._timeBarSecondsSpan)) {
|
206
|
+
centerSec = this._timeBarSecondsSpan * 0.5;
|
207
|
+
} else {
|
208
|
+
centerSec += (centerSec - this._timeBarSecondsSpan * 0.5);
|
209
|
+
}
|
210
|
+
var centerSecFlip = this._timeBarSecondsSpan - centerSec;
|
211
|
+
this.zoomTo(this._startJulian.addSeconds(centerSec - (centerSec * amount)), this._endJulian.addSeconds((centerSecFlip * amount) - centerSecFlip));
|
212
|
+
};
|
213
|
+
|
214
|
+
function twoDigits(num) {
|
215
|
+
return ((num < 10) ? ('0' + num.toString()) : num.toString());
|
216
|
+
}
|
217
|
+
|
218
|
+
Timeline.prototype.makeLabel = function(julianDate) {
|
219
|
+
var gregorian = julianDate.toGregorianDate();
|
220
|
+
var hour = gregorian.hour;
|
221
|
+
var ampm = (hour < 12) ? ' AM' : ' PM';
|
222
|
+
if (hour >= 13) {
|
223
|
+
hour -= 12;
|
224
|
+
} else if (hour === 0) {
|
225
|
+
hour = 12;
|
226
|
+
}
|
227
|
+
var millisecond = gregorian.millisecond, millisecondString = '';
|
228
|
+
if ((millisecond > 0) && (this._timeBarSecondsSpan < 3600)) {
|
229
|
+
millisecondString = Math.floor(millisecond).toString();
|
230
|
+
while (millisecondString.length < 3) {
|
231
|
+
millisecondString = '0' + millisecondString;
|
232
|
+
}
|
233
|
+
millisecondString = '.' + millisecondString;
|
234
|
+
}
|
235
|
+
|
236
|
+
return timelineMonthNames[gregorian.month - 1] + ' ' + gregorian.day + ' ' + gregorian.year + ' ' + twoDigits(hour) + ':' +
|
237
|
+
twoDigits(gregorian.minute) + ':' + twoDigits(gregorian.second) + millisecondString + ampm;
|
238
|
+
};
|
239
|
+
|
240
|
+
Timeline.prototype.smallestTicInPixels = 7.0;
|
241
|
+
|
242
|
+
Timeline.prototype._makeTics = function() {
|
243
|
+
var timeBar = this._timeBarEle;
|
244
|
+
|
245
|
+
var seconds = this._startJulian.getSecondsDifference(this._scrubJulian);
|
246
|
+
var xPos = seconds * this._topElement.clientWidth / this._timeBarSecondsSpan;
|
247
|
+
var scrubX = xPos - 8, tic;
|
248
|
+
var widget = this;
|
249
|
+
|
250
|
+
this._needleEle.style.left = xPos.toString() + 'px';
|
251
|
+
|
252
|
+
var tics = '<span class="timelineIcon16" style="left:' + scrubX + 'px;bottom:0;background-position: 0px 0px;"></span>';
|
253
|
+
|
254
|
+
var minimumDuration = 0.01;
|
255
|
+
var maximumDuration = 31536000000.0; // ~1000 years
|
256
|
+
var epsilon = 1e-10;
|
257
|
+
|
258
|
+
// If time step size is known, enter it here...
|
259
|
+
var minSize = 0;
|
260
|
+
|
261
|
+
var duration = this._timeBarSecondsSpan;
|
262
|
+
if (duration < minimumDuration) {
|
263
|
+
duration = minimumDuration;
|
264
|
+
this._timeBarSecondsSpan = minimumDuration;
|
265
|
+
this._endJulian = this._startJulian.addSeconds(minimumDuration);
|
266
|
+
} else if (duration > maximumDuration) {
|
267
|
+
duration = maximumDuration;
|
268
|
+
this._timeBarSecondsSpan = maximumDuration;
|
269
|
+
this._endJulian = this._startJulian.addSeconds(maximumDuration);
|
270
|
+
}
|
271
|
+
|
272
|
+
var timeBarWidth = this._timeBarEle.clientWidth;
|
273
|
+
if (timeBarWidth < 10) {
|
274
|
+
timeBarWidth = 10;
|
275
|
+
}
|
276
|
+
var startJulian = this._startJulian;
|
277
|
+
|
278
|
+
// epsilonTime: a small fraction of one pixel width of the timeline, measured in seconds.
|
279
|
+
var epsilonTime = Math.min((duration / timeBarWidth) * 1e-5, 0.4);
|
280
|
+
|
281
|
+
// epochJulian: a nearby time to be considered "zero seconds", should be a round-ish number by human standards.
|
282
|
+
var epochJulian;
|
283
|
+
if (duration > 315360000) { // 3650+ days visible, epoch is start of the first visible century.
|
284
|
+
epochJulian = JulianDate.fromIso8601(startJulian.toDate().toISOString().substring(0, 2) + '00-01-01T00:00:00Z');
|
285
|
+
} else if (duration > 31536000) { // 365+ days visible, epoch is start of the first visible decade.
|
286
|
+
epochJulian = JulianDate.fromIso8601(startJulian.toDate().toISOString().substring(0, 3) + '0-01-01T00:00:00Z');
|
287
|
+
} else if (duration > 86400) { // 1+ day(s) visible, epoch is start of the year.
|
288
|
+
epochJulian = JulianDate.fromIso8601(startJulian.toDate().toISOString().substring(0, 4) + '-01-01T00:00:00Z');
|
289
|
+
} else { // Less than a day on timeline, epoch is midnight of the visible day.
|
290
|
+
epochJulian = JulianDate.fromIso8601(startJulian.toDate().toISOString().substring(0, 10) + 'T00:00:00Z');
|
291
|
+
}
|
292
|
+
// startTime: Seconds offset of the left side of the timeline from epochJulian.
|
293
|
+
var startTime = epochJulian.addSeconds(epsilonTime).getSecondsDifference(this._startJulian);
|
294
|
+
// endTime: Seconds offset of the right side of the timeline from epochJulian.
|
295
|
+
var endTime = startTime + duration;
|
296
|
+
this._epochJulian = epochJulian;
|
297
|
+
|
298
|
+
function getStartTic(ticScale) {
|
299
|
+
return Math.floor(startTime / ticScale) * ticScale;
|
300
|
+
}
|
301
|
+
|
302
|
+
function getNextTic(tic, ticScale) {
|
303
|
+
return Math.ceil((tic / ticScale) + 0.5) * ticScale;
|
304
|
+
}
|
305
|
+
|
306
|
+
function getAlpha(time) {
|
307
|
+
return (time - startTime) / duration;
|
308
|
+
}
|
309
|
+
|
310
|
+
function remainder(x, y) {
|
311
|
+
//return x % y;
|
312
|
+
return x - (y * Math.round(x / y));
|
313
|
+
}
|
314
|
+
|
315
|
+
// Width in pixels of a typical label, plus padding
|
316
|
+
this._rulerEle.innerHTML = this.makeLabel(this._endJulian.addSeconds(-minimumDuration));
|
317
|
+
var sampleWidth = this._rulerEle.offsetWidth + 20;
|
318
|
+
|
319
|
+
var origMinSize = minSize;
|
320
|
+
minSize -= epsilon;
|
321
|
+
|
322
|
+
var renderState = {
|
323
|
+
y : 0,
|
324
|
+
startTime : startTime,
|
325
|
+
startJulian : startJulian,
|
326
|
+
epochJulian : epochJulian,
|
327
|
+
duration : duration,
|
328
|
+
timeBarWidth : timeBarWidth,
|
329
|
+
getAlpha : getAlpha
|
330
|
+
};
|
331
|
+
this._highlightRanges.forEach(function(highlightRange) {
|
332
|
+
tics += highlightRange.render(renderState);
|
333
|
+
});
|
334
|
+
|
335
|
+
// Calculate tic mark label spacing in the TimeBar.
|
336
|
+
var mainTic = 0.0, subTic = 0.0, tinyTic = 0.0;
|
337
|
+
// Ideal labeled tic as percentage of zoom interval
|
338
|
+
var idealTic = sampleWidth / timeBarWidth;
|
339
|
+
if (idealTic > 1.0) {
|
340
|
+
// Clamp to width of window, for thin windows.
|
341
|
+
idealTic = 1.0;
|
342
|
+
}
|
343
|
+
// Ideal labeled tic size in seconds
|
344
|
+
idealTic *= this._timeBarSecondsSpan;
|
345
|
+
var ticIndex = -1, smallestIndex = -1;
|
346
|
+
|
347
|
+
var i, ticScaleLen = timelineTicScales.length;
|
348
|
+
for (i = 0; i < ticScaleLen; ++i) {
|
349
|
+
var sc = timelineTicScales[i];
|
350
|
+
++ticIndex;
|
351
|
+
mainTic = sc;
|
352
|
+
// Find acceptable main tic size not smaller than ideal size.
|
353
|
+
if ((sc > idealTic) && (sc > minSize)) {
|
354
|
+
break;
|
355
|
+
}
|
356
|
+
if ((smallestIndex < 0) && ((timeBarWidth * (sc / this._timeBarSecondsSpan)) >= this.smallestTicInPixels)) {
|
357
|
+
smallestIndex = ticIndex;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
if (ticIndex > 0) {
|
361
|
+
while (ticIndex > 0) // Compute sub-tic size that evenly divides main tic.
|
362
|
+
{
|
363
|
+
--ticIndex;
|
364
|
+
if (Math.abs(remainder(mainTic, timelineTicScales[ticIndex])) < 0.00001) {
|
365
|
+
if (timelineTicScales[ticIndex] >= minSize) {
|
366
|
+
subTic = timelineTicScales[ticIndex];
|
367
|
+
}
|
368
|
+
break;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
if (smallestIndex >= 0) {
|
373
|
+
while (smallestIndex < ticIndex) // Compute tiny tic size that evenly divides sub-tic.
|
374
|
+
{
|
375
|
+
if ((Math.abs(remainder(subTic, timelineTicScales[smallestIndex])) < 0.00001) && (timelineTicScales[smallestIndex] >= minSize)) {
|
376
|
+
tinyTic = timelineTicScales[smallestIndex];
|
377
|
+
break;
|
378
|
+
}
|
379
|
+
++smallestIndex;
|
380
|
+
}
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
minSize = origMinSize;
|
385
|
+
if ((minSize > epsilon) && (tinyTic < 0.00001) && (Math.abs(minSize - mainTic) > epsilon)) {
|
386
|
+
tinyTic = minSize;
|
387
|
+
if (minSize <= (mainTic + epsilon)) {
|
388
|
+
subTic = 0.0;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
var lastTextLeft = -999999, textWidth;
|
393
|
+
if ((timeBarWidth * (tinyTic / this._timeBarSecondsSpan)) >= 3.0) {
|
394
|
+
for (tic = getStartTic(tinyTic); tic <= endTime; tic = getNextTic(tic, tinyTic)) {
|
395
|
+
tics += '<span class="timelineTicTiny" style="left: ' + Math.round(timeBarWidth * getAlpha(tic)).toString() + 'px;"></span>';
|
396
|
+
}
|
397
|
+
}
|
398
|
+
if ((timeBarWidth * (subTic / this._timeBarSecondsSpan)) >= 3.0) {
|
399
|
+
for (tic = getStartTic(subTic); tic <= endTime; tic = getNextTic(tic, subTic)) {
|
400
|
+
tics += '<span class="timelineTicSub" style="left: ' + Math.round(timeBarWidth * getAlpha(tic)).toString() + 'px;"></span>';
|
401
|
+
}
|
402
|
+
}
|
403
|
+
if ((timeBarWidth * (mainTic / this._timeBarSecondsSpan)) >= 2.0) {
|
404
|
+
this._mainTicSpan = mainTic;
|
405
|
+
endTime += mainTic;
|
406
|
+
tic = getStartTic(mainTic);
|
407
|
+
var leapSecond = epochJulian.getTaiMinusUtc();
|
408
|
+
while (tic <= endTime) {
|
409
|
+
var ticTime = startJulian.addSeconds(tic - startTime);
|
410
|
+
if (mainTic > 2.1) {
|
411
|
+
var ticLeap = ticTime.getTaiMinusUtc();
|
412
|
+
if (Math.abs(ticLeap - leapSecond) > 0.1) {
|
413
|
+
tic += (ticLeap - leapSecond);
|
414
|
+
ticTime = startJulian.addSeconds(tic - startTime);
|
415
|
+
}
|
416
|
+
}
|
417
|
+
var ticLeft = Math.round(timeBarWidth * getAlpha(tic));
|
418
|
+
var ticLabel = this.makeLabel(ticTime);
|
419
|
+
this._rulerEle.innerHTML = ticLabel;
|
420
|
+
textWidth = this._rulerEle.offsetWidth;
|
421
|
+
var labelLeft = ticLeft - ((textWidth / 2) - 1);
|
422
|
+
if (labelLeft > lastTextLeft) {
|
423
|
+
lastTextLeft = labelLeft + textWidth + 5;
|
424
|
+
tics += '<span class="timelineTicMain" style="left: ' + ticLeft.toString() + 'px;"></span>' + '<span class="timelineTicLabel" style="left: ' + labelLeft.toString() +
|
425
|
+
'px;">' + ticLabel + '</span>';
|
426
|
+
} else {
|
427
|
+
tics += '<span class="timelineTicSub" style="left: ' + ticLeft.toString() + 'px;"></span>';
|
428
|
+
}
|
429
|
+
tic = getNextTic(tic, mainTic);
|
430
|
+
}
|
431
|
+
} else {
|
432
|
+
this._mainTicSpan = -1;
|
433
|
+
}
|
434
|
+
|
435
|
+
timeBar.innerHTML = tics;
|
436
|
+
this._scrubElement = timeBar.childNodes[0];
|
437
|
+
|
438
|
+
renderState.y = 0;
|
439
|
+
this._trackList.forEach(function(track) {
|
440
|
+
track.render(widget._context, renderState);
|
441
|
+
renderState.y += track.height;
|
442
|
+
});
|
443
|
+
};
|
444
|
+
|
445
|
+
Timeline.prototype.updateFromClock = function() {
|
446
|
+
this._scrubJulian = this._clock.currentTime;
|
447
|
+
|
448
|
+
var seconds = this._startJulian.getSecondsDifference(this._scrubJulian);
|
449
|
+
var xPos = seconds * this._topElement.clientWidth / this._timeBarSecondsSpan;
|
450
|
+
|
451
|
+
if (this._scrubElement) {
|
452
|
+
var scrubX = xPos - 8;
|
453
|
+
this._scrubElement.style.left = scrubX.toString() + 'px';
|
454
|
+
this._needleEle.style.left = xPos.toString() + 'px';
|
455
|
+
}
|
456
|
+
};
|
457
|
+
|
458
|
+
Timeline.prototype._setTimeBarTime = function(xPos, seconds) {
|
459
|
+
this._scrubJulian = this._startJulian.addSeconds(seconds);
|
460
|
+
if (this._scrubElement) {
|
461
|
+
var scrubX = xPos - 8;
|
462
|
+
this._scrubElement.style.left = scrubX.toString() + 'px';
|
463
|
+
this._needleEle.style.left = xPos.toString() + 'px';
|
464
|
+
}
|
465
|
+
|
466
|
+
var evt = document.createEvent('Event');
|
467
|
+
evt.initEvent('settime', true, true);
|
468
|
+
evt.clientX = xPos;
|
469
|
+
evt.timeSeconds = seconds;
|
470
|
+
evt.timeJulian = this._scrubJulian;
|
471
|
+
this._topElement.dispatchEvent(evt);
|
472
|
+
};
|
473
|
+
|
474
|
+
Timeline.prototype._handleMouseDown = function(e) {
|
475
|
+
if (this._mouseMode !== timelineMouseMode.touchOnly) {
|
476
|
+
if (e.button === 0) {
|
477
|
+
this._mouseMode = timelineMouseMode.scrub;
|
478
|
+
if (this._scrubElement) {
|
479
|
+
this._scrubElement.style.backgroundPosition = '-16px 0';
|
480
|
+
}
|
481
|
+
this._handleMouseMove(e);
|
482
|
+
} else {
|
483
|
+
this._mouseX = e.clientX;
|
484
|
+
if (e.button === 2) {
|
485
|
+
this._mouseMode = timelineMouseMode.zoom;
|
486
|
+
} else {
|
487
|
+
this._mouseMode = timelineMouseMode.slide;
|
488
|
+
}
|
489
|
+
}
|
490
|
+
}
|
491
|
+
e.preventDefault();
|
492
|
+
};
|
493
|
+
Timeline.prototype._handleMouseUp = function(e) {
|
494
|
+
this._mouseMode = timelineMouseMode.none;
|
495
|
+
if (this._scrubElement) {
|
496
|
+
this._scrubElement.style.backgroundPosition = '0px 0px';
|
497
|
+
}
|
498
|
+
};
|
499
|
+
Timeline.prototype._handleMouseMove = function(e) {
|
500
|
+
var dx;
|
501
|
+
if (this._mouseMode === timelineMouseMode.scrub) {
|
502
|
+
e.preventDefault();
|
503
|
+
var x = e.clientX - this._topElement.getBoundingClientRect().left;
|
504
|
+
if ((x >= 0) && (x <= this._topElement.clientWidth)) {
|
505
|
+
this._setTimeBarTime(x, x * this._timeBarSecondsSpan / this._topElement.clientWidth);
|
506
|
+
}
|
507
|
+
} else if (this._mouseMode === timelineMouseMode.slide) {
|
508
|
+
dx = this._mouseX - e.clientX;
|
509
|
+
this._mouseX = e.clientX;
|
510
|
+
if (dx !== 0) {
|
511
|
+
var dsec = dx * this._timeBarSecondsSpan / this._topElement.clientWidth;
|
512
|
+
this.zoomTo(this._startJulian.addSeconds(dsec), this._endJulian.addSeconds(dsec));
|
513
|
+
}
|
514
|
+
} else if (this._mouseMode === timelineMouseMode.zoom) {
|
515
|
+
dx = this._mouseX - e.clientX;
|
516
|
+
this._mouseX = e.clientX;
|
517
|
+
if (dx !== 0) {
|
518
|
+
this.zoomFrom(Math.pow(1.01, dx));
|
519
|
+
}
|
520
|
+
}
|
521
|
+
};
|
522
|
+
Timeline.prototype._handleMouseWheel = function(e) {
|
523
|
+
var dy = e.wheelDeltaY || e.wheelDelta || (-e.detail);
|
524
|
+
timelineWheelDelta = Math.max(Math.min(Math.abs(dy), timelineWheelDelta), 1);
|
525
|
+
dy /= timelineWheelDelta;
|
526
|
+
this.zoomFrom(Math.pow(1.05, -dy));
|
527
|
+
};
|
528
|
+
|
529
|
+
Timeline.prototype._handleTouchStart = function(e) {
|
530
|
+
var len = e.touches.length, seconds, xPos, leftX = this._topElement.getBoundingClientRect().left;
|
531
|
+
e.preventDefault();
|
532
|
+
this._mouseMode = timelineMouseMode.touchOnly;
|
533
|
+
if (len === 1) {
|
534
|
+
seconds = this._startJulian.getSecondsDifference(this._scrubJulian);
|
535
|
+
xPos = seconds * this._topElement.clientWidth / this._timeBarSecondsSpan + leftX;
|
536
|
+
if (Math.abs(e.touches[0].clientX - xPos) < 50) {
|
537
|
+
this._touchMode = timelineTouchMode.scrub;
|
538
|
+
if (this._scrubElement) {
|
539
|
+
this._scrubElement.style.backgroundPosition = (len === 1) ? '-16px 0' : '0 0';
|
540
|
+
}
|
541
|
+
} else {
|
542
|
+
this._touchMode = timelineTouchMode.singleTap;
|
543
|
+
this._touchState.centerX = e.touches[0].clientX - leftX;
|
544
|
+
}
|
545
|
+
} else if (len === 2) {
|
546
|
+
this._touchMode = timelineTouchMode.slideZoom;
|
547
|
+
this._touchState.centerX = (e.touches[0].clientX + e.touches[1].clientX) * 0.5 - leftX;
|
548
|
+
this._touchState.spanX = Math.abs(e.touches[0].clientX - e.touches[1].clientX);
|
549
|
+
} else {
|
550
|
+
this._touchMode = timelineTouchMode.ignore;
|
551
|
+
}
|
552
|
+
};
|
553
|
+
Timeline.prototype._handleTouchEnd = function(e) {
|
554
|
+
var len = e.touches.length, leftX = this._topElement.getBoundingClientRect().left;
|
555
|
+
if (this._touchMode === timelineTouchMode.singleTap) {
|
556
|
+
this._touchMode = timelineTouchMode.scrub;
|
557
|
+
this._handleTouchMove(e);
|
558
|
+
} else if (this._touchMode === timelineTouchMode.scrub) {
|
559
|
+
this._handleTouchMove(e);
|
560
|
+
}
|
561
|
+
this._mouseMode = timelineMouseMode.touchOnly;
|
562
|
+
if (len !== 1) {
|
563
|
+
this._touchMode = (len > 0) ? timelineTouchMode.ignore : timelineTouchMode.none;
|
564
|
+
} else if (this._touchMode === timelineTouchMode.slideZoom) {
|
565
|
+
this._touchState.centerX = e.touches[0].clientX - leftX;
|
566
|
+
}
|
567
|
+
if (this._scrubElement) {
|
568
|
+
this._scrubElement.style.backgroundPosition = '0 0';
|
569
|
+
}
|
570
|
+
};
|
571
|
+
Timeline.prototype._handleTouchMove = function(e) {
|
572
|
+
var dx, x, len, newCenter, newSpan, newStartTime, zoom = 1, leftX = this._topElement.getBoundingClientRect().left;
|
573
|
+
if (this._touchMode === timelineTouchMode.singleTap) {
|
574
|
+
this._touchMode = timelineTouchMode.slideZoom;
|
575
|
+
}
|
576
|
+
this._mouseMode = timelineMouseMode.touchOnly;
|
577
|
+
if (this._touchMode === timelineTouchMode.scrub) {
|
578
|
+
e.preventDefault();
|
579
|
+
if (e.changedTouches.length === 1) {
|
580
|
+
x = e.changedTouches[0].clientX - leftX;
|
581
|
+
if ((x >= 0) && (x <= this._topElement.clientWidth)) {
|
582
|
+
this._setTimeBarTime(x, x * this._timeBarSecondsSpan / this._topElement.clientWidth);
|
583
|
+
}
|
584
|
+
}
|
585
|
+
} else if (this._touchMode === timelineTouchMode.slideZoom) {
|
586
|
+
len = e.touches.length;
|
587
|
+
if (len === 2) {
|
588
|
+
newCenter = (e.touches[0].clientX + e.touches[1].clientX) * 0.5 - leftX;
|
589
|
+
newSpan = Math.abs(e.touches[0].clientX - e.touches[1].clientX);
|
590
|
+
} else if (len === 1) {
|
591
|
+
newCenter = e.touches[0].clientX - leftX;
|
592
|
+
newSpan = 0;
|
593
|
+
}
|
594
|
+
|
595
|
+
if (typeof newCenter !== 'undefined') {
|
596
|
+
if ((newSpan > 0) && (this._touchState.spanX > 0)) {
|
597
|
+
// Zoom and slide
|
598
|
+
zoom = (this._touchState.spanX / newSpan);
|
599
|
+
newStartTime = this._startJulian.addSeconds(((this._touchState.centerX * this._timeBarSecondsSpan) - (newCenter * this._timeBarSecondsSpan * zoom)) /
|
600
|
+
this._topElement.clientWidth);
|
601
|
+
} else {
|
602
|
+
// Slide to newCenter
|
603
|
+
dx = this._touchState.centerX - newCenter;
|
604
|
+
newStartTime = this._startJulian.addSeconds(dx * this._timeBarSecondsSpan / this._topElement.clientWidth);
|
605
|
+
}
|
606
|
+
|
607
|
+
this.zoomTo(newStartTime, newStartTime.addSeconds(this._timeBarSecondsSpan * zoom));
|
608
|
+
this._touchState.centerX = newCenter;
|
609
|
+
this._touchState.spanX = newSpan;
|
610
|
+
}
|
611
|
+
}
|
612
|
+
};
|
613
|
+
|
614
|
+
Timeline.prototype.handleResize = function() {
|
615
|
+
var containerHeight = this._topElement.getBoundingClientRect().height - this._timeBarEle.getBoundingClientRect().height - 2;
|
616
|
+
this._trackContainer.style.height = containerHeight.toString() + 'px';
|
617
|
+
|
618
|
+
var trackListHeight = 1;
|
619
|
+
this._trackList.forEach(function(track) {
|
620
|
+
trackListHeight += track.height;
|
621
|
+
});
|
622
|
+
this._trackListEle.style.height = trackListHeight.toString() + 'px';
|
623
|
+
this._trackListEle.width = this._trackListEle.clientWidth;
|
624
|
+
this._trackListEle.height = trackListHeight;
|
625
|
+
this._makeTics();
|
626
|
+
};
|
627
|
+
|
628
|
+
return Timeline;
|
629
|
+
});
|