示例#1
0
        /// <summary>
        /// Initializes a new instance of the LayerMap class.
        /// </summary>
        /// <param name="layer">
        /// Layer details.
        /// </param>
        internal LayerMap(Layer layer)
        {
            this.LayerDetails = layer;
            this.MapType      = LayerMapType.WWT;
            this.columnsList  = ColumnExtensions.PopulateColumnList();

            // Set mapped column type based on header row data
            SetMappedColumnType();

            // For WWT layers, notification will be started immediately.
            StartNotifying();
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the LayerMap class.
 /// </summary>
 /// <param name="name">
 /// Range for which the layer.
 /// </param>
 internal LayerMap(Name name)
 {
     this.rangeName        = name;
     this.RangeDisplayName = name.Name;
     this.RangeAddress     = name.RefersTo as string;
     this.MapType          = LayerMapType.Local;
     this.columnsList      = ColumnExtensions.PopulateColumnList();
     this.SetAutoMap();
     this.LayerDetails      = new Layer();
     this.LayerDetails.Name = this.RangeDisplayName;
     this.SetLayerProperties();
 }
示例#3
0
 /// <summary>
 /// Updates the layer map properties with the layer values
 /// </summary>
 /// <param name="layerMap">Layer map value</param>
 /// <param name="layer">Layer details</param>
 /// <returns>Updated layer map</returns>
 internal static LayerMap UpdateLayerMapProperties(this LayerMap layerMap, Layer layer)
 {
     if (layerMap != null && layer != null)
     {
         lock (WorkflowController.LockObject)
         {
             layerMap.LayerDetails = layer;
             layerMap.ColumnsList  = ColumnExtensions.PopulateColumnList();
             layerMap.SetMappedColumnType();
         }
     }
     return(layerMap);
 }
示例#4
0
        internal static LayerDetailsViewModel SetLayerMap(this LayerDetailsViewModel layerDetailsModel, LayerMap selectedLayerMap)
        {
            // Set the ViewModel for Layer properties using the selected layer map from Core OM
            // This is one place from where all the View model properties are set and bound to task pane
            // This will be used when a layer is changed in the layer drop down
            if (selectedLayerMap != null)
            {
                if (selectedLayerMap.LayerDetails != null)
                {
                    LayerDetailsViewModel.IsPropertyChangedFromCode = true;

                    // Set all the user selections as well as default lists which are present only in view model
                    // Need to set properties which are in different format in View model from Model
                    layerDetailsModel.SelectedLayerName = selectedLayerMap.LayerDetails.Name;
                    layerDetailsModel.SelectedLayerText = LayerDetailsViewModel.GetLayerNameOnMapType(selectedLayerMap, selectedLayerMap.LayerDetails.Name);
                    layerDetailsModel = SetGroup(layerDetailsModel, selectedLayerMap);

                    // Binding the column data to the map columns
                    ObservableCollection <Column> columns = new ObservableCollection <Column>();
                    ColumnExtensions.PopulateColumnList().ToList().ForEach(col =>
                    {
                        columns.Add(col);
                    });

                    layerDetailsModel.ColumnsView         = new ObservableCollection <ColumnViewModel>();
                    layerDetailsModel.SizeColumnList      = new ObservableCollection <KeyValuePair <int, string> >();
                    layerDetailsModel.HoverTextColumnList = new ObservableCollection <KeyValuePair <int, string> >();

                    // Remove the columns based on the group selected.
                    layerDetailsModel.RemoveColumns(columns);

                    // Set the Mapped column type based on the group selected.
                    selectedLayerMap.UpdateMappedColumns();

                    // Validates if X,Y and Z columns are present and lat/long or RA/DEC columns are not present. If so,
                    // remove depth and alt from columns collection.
                    ValidateXYZ(selectedLayerMap, columns);

                    layerDetailsModel.PopulateColumns(selectedLayerMap, columns);

                    // Adding None to size column list
                    layerDetailsModel.SizeColumnList.Add(new KeyValuePair <int, string>(-1, Properties.Resources.NoneString));
                    layerDetailsModel.HoverTextColumnList.Add(new KeyValuePair <int, string>(-1, Properties.Resources.NoneString));

                    int index = 0;
                    foreach (string headerData in selectedLayerMap.HeaderRowData)
                    {
                        layerDetailsModel.SizeColumnList.Add(new KeyValuePair <int, string>(index, headerData));
                        layerDetailsModel.HoverTextColumnList.Add(new KeyValuePair <int, string>(index, headerData));
                        index++;
                    }

                    layerDetailsModel = SetSelectedSize(layerDetailsModel, selectedLayerMap);
                    layerDetailsModel = SetSelectedHoverText(layerDetailsModel, selectedLayerMap);

                    // Sets view in WWT visibility
                    layerDetailsModel.IsViewInWWTEnabled       = (selectedLayerMap.MapType == LayerMapType.Local || (selectedLayerMap.MapType == LayerMapType.LocalInWWT && selectedLayerMap.IsNotInSync));
                    layerDetailsModel.IsLayerInSyncInfoVisible = (selectedLayerMap.MapType == LayerMapType.WWT || selectedLayerMap.MapType == LayerMapType.LocalInWWT) && !selectedLayerMap.IsNotInSync;

                    // On click of layer dropdown the callout need not be shown, the callout visibility is set to
                    // false on the click of the dropdown.
                    if (LayerDetailsViewModel.IsCallOutRequired)
                    {
                        layerDetailsModel.IsCallOutVisible = layerDetailsModel.IsViewInWWTEnabled;

                        if (layerDetailsModel.IsLayerInSyncInfoVisible)
                        {
                            // Start the animation for the layer in sync text.
                            layerDetailsModel.StartShowHighlightAnimationTimer();
                        }
                    }
                    else
                    {
                        layerDetailsModel.IsCallOutVisible = false;
                    }

                    // Sets if the custom task pane buttons are enabled
                    layerDetailsModel.IsShowRangeEnabled     = GetButtonEnability(selectedLayerMap);
                    layerDetailsModel.IsDeleteMappingEnabled = GetButtonEnability(selectedLayerMap);
                    layerDetailsModel.IsGetLayerDataEnabled  = (selectedLayerMap.MapType == LayerMapType.WWT || (selectedLayerMap.MapType == LayerMapType.LocalInWWT && !selectedLayerMap.IsNotInSync));

                    layerDetailsModel.IsUpdateLayerEnabled    = GetButtonEnability(selectedLayerMap);
                    layerDetailsModel.IsReferenceGroupEnabled = selectedLayerMap.IsLayerCreated();
                    layerDetailsModel.IsFarSideShown          = selectedLayerMap.LayerDetails.ShowFarSide;

                    SetDistanceUnit(layerDetailsModel, selectedLayerMap);

                    // Sets RAUnit visibility
                    layerDetailsModel.SetRAUnitVisibility();

                    layerDetailsModel.SetMarkerTabVisibility();

                    layerDetailsModel.SelectedFadeType      = layerDetailsModel.FadeTypes.Where(fadetype => fadetype.Key == selectedLayerMap.LayerDetails.FadeType).FirstOrDefault();
                    layerDetailsModel.SelectedScaleRelative = layerDetailsModel.ScaleRelatives.Where(scaleRelative => scaleRelative.Key == selectedLayerMap.LayerDetails.MarkerScale).FirstOrDefault();
                    layerDetailsModel.SelectedScaleType     = layerDetailsModel.ScaleTypes.Where(scaleType => scaleType.Key == selectedLayerMap.LayerDetails.PointScaleType).FirstOrDefault();
                    layerDetailsModel.SelectedMarkerType    = layerDetailsModel.MarkerTypes.Where(markerType => markerType.Key == selectedLayerMap.LayerDetails.PlotType).FirstOrDefault();
                    layerDetailsModel.SelectedPushpinId     = layerDetailsModel.PushPinTypes.Where(pushpin => pushpin.Key == selectedLayerMap.LayerDetails.MarkerIndex).FirstOrDefault();

                    layerDetailsModel.LayerOpacity.SelectedSliderValue = selectedLayerMap.LayerDetails.Opacity * 100;
                    layerDetailsModel.TimeDecay.SelectedSliderValue    = GetSelectedTimeDecayValue(layerDetailsModel.TimeDecay, selectedLayerMap.LayerDetails.TimeDecay);
                    layerDetailsModel.ScaleFactor.SelectedSliderValue  = GetSelectedTimeDecayValue(layerDetailsModel.ScaleFactor, selectedLayerMap.LayerDetails.ScaleFactor);

                    ////Set properties directly exposed from Model
                    layerDetailsModel.BeginDate       = selectedLayerMap.LayerDetails.StartTime;
                    layerDetailsModel.EndDate         = selectedLayerMap.LayerDetails.EndTime;
                    layerDetailsModel.FadeTime        = selectedLayerMap.LayerDetails.FadeSpan.ToString();
                    layerDetailsModel.ColorBackground = LayerDetailsViewModel.ConvertToSolidColorBrush(selectedLayerMap.LayerDetails.Color);
                    LayerDetailsViewModel.IsPropertyChangedFromCode = false;
                }
            }

            return(layerDetailsModel);
        }