I'd like to be able to set the Pro's Time Slider up w/ some initial settings should the user not have already done so. This would be useful when a time-capable layer is added and would save the user some steps (e.g., given a data source, set an applicable "Current Time" (works), step, snapping, etc.). Other than that current time, however, everything else I set seems to be ignored using the code below. I brought up the CIM Viewer, and, funny enough, my settings seem to show up in the map's CIM xml, but aren't reflected in the slider. Changing things on the slider and refreshing the CIM Viewer does update the XML, but, when I attempt to do so the other way, the changes aren't reflected in the slider.
I'm at a loss and likely going about this wrong. I appreciated any ideas anyone might have. Thanks.
// first line works fine w/ a range created and set to applicable start/end
MapView.Active.Time = timeRange;
CIMMap cimMap = _map.GetDefinition();
CIMSliderSettings slider = cimMap.TimeSliderSettings ?? new CIMSliderSettings();
slider.InteractionMode = SliderInteractionMode.Slider;
slider.StepOption = SliderStepType.Interval;
slider.StepIntervalValue = 1;
slider.StepIntervalUnit = "days";
slider.StepUsesWindow = false;
slider.UseTimeSnapping = true;
slider.TimeSnapMode = TimeSnapMode.Single;
slider.SingleTimeSnapUnit = "days";
slider.IsMinimized = false;
cimMap.TimeSliderSettings = slider;
At this time, time slider settings are only read when the MapView is opened.
We are looking into the possibility of enhancing this so that they would be applied on the SetDefinition call and not just when the view is opened.
Thank you, Uma, for that info. That would be useful to implement down the line, at least for us.
So, I tinkered around w/ the code a little bit, given your feedback, and am creating/populating the map and configuring time without it being opened if no map is active. I then open the Map and listen for the DrawCompleteEvent on the appropriate MapView. I then zoom to an extent/time and that seems to have all the desired temporal settings in place. If the user already has a map active without time enabled, I close the pane, configure time, and re-open it. And lastly, if they already have a map open w/ time configured, I just add the time-enabled layer and the time configuration is on them.
Hopefully this is an acceptable work around until you all possibly implement that SetDefinition enhancement, but... I shall test this out more.
Thanks again, cg.