|
| 1 | +#TimeSlider |
| 2 | + |
| 3 | +The Time Slider provides controls that allow you to visualize temporal data for time enabled layers in a map or scene. |
| 4 | + |
| 5 | +###Features of the Time Slider |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +* Tap the **Play** button to play a time animation that steps through your data sequentially. Playback interval, direction and whether to repeat or reverse can be configured from the time slider properties. While playing, the **Pause** button displays in its place. |
| 10 | +* Tap the **Forward** button to step forward to the next time stamp. |
| 11 | +* Tap the **Back** button to step back to the previous time stamp. |
| 12 | +* Drag the **Lower Thumb** (Current Extent Start Time) or **Upper Thumb** (Current Extent End Time) to the right or left to step through your temporal data interactively. |
| 13 | + |
| 14 | +#### Slider Thumbs |
| 15 | + |
| 16 | +How the Time Slider's thumbs are presented will vary depending on whether the current time extent represents a time window or instant and whether the start or end time is pinned. |
| 17 | + |
| 18 | +* **Time Window**: If the current time extent represents a non-instantaneous duration of time, and neither the start nor end time is pinned, then two thumbs will be shown on the slider, as shown below. Both thumbs can be manipulated by end users. |
| 19 | + |
| 20 | +  |
| 21 | + |
| 22 | +* **Time Window - Start or End Time Pinned:** If the start or end time is pinned using the `isStartTimePinned` or `isEndTimePinned`, then the corresponding slider thumb is replaced with a bar to visually indicate that the start or end time cannot be manipulated. This allows user to cumulatively view all data from the pinned thumb until the specified position of other thumb. |
| 23 | + |
| 24 | +  |
| 25 | + |
| 26 | +  |
| 27 | + |
| 28 | +* **Time Instant:** When the Time Slider's current time extent is specified as a time instant (i.e. `AGSTimeExtent.startTime` equals `AGSTimeExtent.endTime`), then one slider thumb is shown to represent the specified instant. |
| 29 | + |
| 30 | +  |
| 31 | + |
| 32 | +#### Labels |
| 33 | + |
| 34 | +The labels are shown on slider to help user understand the time filtering options slider offers. |
| 35 | + |
| 36 | +* **Full Extent Labels:** Use `fullExtentLabelsVisible` to control the visibility of full extent labels. |
| 37 | + |
| 38 | +* **Current Extent Labels:** Use `LabelMode.thumbs`to display the labels for the current extent start and end time. |
| 39 | + |
| 40 | +  |
| 41 | + |
| 42 | +* **Time Step Interval Labels:** Use `LabelMode.ticks` to display the labels for the time step intervals instead of for the current time extent. |
| 43 | + |
| 44 | +  |
| 45 | + |
| 46 | +#### Display Components |
| 47 | + |
| 48 | +User can control whether to show `Slider` and/or `Playback Buttons` using `isSliderVisible` and `playbackButtonsVisible`. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +### Usage |
| 55 | + |
| 56 | +Initialize TimeSlider and add constraints to position it. |
| 57 | + |
| 58 | +```swift |
| 59 | + // Configure time slider |
| 60 | + let timeSlider = TimeSlider() |
| 61 | + timeSlider.labelMode = .ticks |
| 62 | + timeSlider.addTarget(self, action: #selector(TimeSliderExample.timeSliderValueChanged(timeSlider:)), for: .valueChanged) |
| 63 | + view.addSubview(timeSlider) |
| 64 | + |
| 65 | + // Add constraints to position the slider |
| 66 | + let margin: CGFloat = 10.0 |
| 67 | + timeSlider.translatesAutoresizingMaskIntoConstraints = false |
| 68 | + timeSlider.bottomAnchor.constraint(equalTo: mapView.attributionTopAnchor, constant: -margin).isActive = true |
| 69 | + |
| 70 | + if #available(iOS 11.0, *) { |
| 71 | + timeSlider.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: margin).isActive = true |
| 72 | + timeSlider.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -margin).isActive = true |
| 73 | + } |
| 74 | + else { |
| 75 | + timeSlider.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: margin).isActive = true |
| 76 | + timeSlider.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -margin).isActive = true |
| 77 | + } |
| 78 | +``` |
| 79 | + |
| 80 | +Use one of three initialize helper function to setup properties of the Time Slider. |
| 81 | + |
| 82 | +```swift |
| 83 | + public func initializeTimeProperties(geoView: AGSGeoView, observeGeoView: Bool, completion: @escaping (Error?)->Void) |
| 84 | + public func initializeTimeProperties(timeAwareLayer: AGSTimeAware, completion: @escaping (Error?)->Void) |
| 85 | + public func initializeTimeSteps(timeStepCount: Int, fullExtent: AGSTimeExtent, completion: @escaping (Error?)->Void) |
| 86 | +``` |
| 87 | + |
| 88 | +To see it in action, try out the [Examples](../../Examples) and refer to [TimeSliderExample.swift](../../Examples/ArcGISToolkitExamples/TimeSliderExample.swift) in the project. |
| 89 | + |
| 90 | +### Themes |
| 91 | + |
| 92 | +| Theme | Example | |
| 93 | +|:-----------: |:------: | |
| 94 | +|`Black` | | |
| 95 | +|`Blue` | | |
| 96 | +|`Ocean Blue` | | |
| 97 | + |
| 98 | +### Customization |
| 99 | + |
| 100 | +You can customize many visual elements of the TimeSlider such as - |
| 101 | + |
| 102 | +* `currentExtentFillColor` |
| 103 | +* `currentExtentLabelColor` |
| 104 | +* `currentExtentLabelFont` |
| 105 | +* `currentExtentLabelDateStyle` |
| 106 | +* `fullExtentBorderColor` |
| 107 | +* `fullExtentBorderWidth` |
| 108 | +* `fullExtentFillColor` |
| 109 | +* `fullExtentLabelColor` |
| 110 | +* `fullExtentLabelFont` |
| 111 | +* `fullExtentLabelDateStyle` |
| 112 | +* `timeStepIntervalLabelDateStyle` |
| 113 | +* `timeStepIntervalLabelColor` |
| 114 | +* `timeStepIntervalLabelFont` |
| 115 | +* `timeStepIntervalTickColor` |
| 116 | +* `thumbFillColor` |
| 117 | +* `thumbBorderColor` |
| 118 | +* `thumbBorderWidth` |
| 119 | +* `thumbSize` |
| 120 | +* `thumbCornerRadius` |
| 121 | +* `playbackButtonsFillColor` |
| 122 | +* `layerExtentFillColor` |
| 123 | +* `trackHeight` |
| 124 | +* `theme` |
| 125 | + |
| 126 | + |
0 commit comments