Пример #1
0
        private void AddANewLayer()
        {
            var newLayer = new ScaleLineOrBarAdornmentLayerViewModel();

            newLayer.Name     = GenerateScaleName();
            newLayer.Location = AdornmentLocation.LowerLeft;
            ScaleLayers.Add(newLayer);
            SelectedLayer = newLayer;
        }
Пример #2
0
        private void InitLayers()
        {
            if (GisEditor.ActiveMap != null)
            {
                GisEditorWpfMap wpfMap = GisEditor.ActiveMap;

                var scaleLayers = wpfMap.FixedAdornmentOverlay.Layers.Where(tmpAdornmentLayer => (tmpAdornmentLayer is ScaleLineAdornmentLayer || tmpAdornmentLayer is ScaleBarAdornmentLayer));
                foreach (var tmpLayer in scaleLayers)
                {
                    ScaleLineOrBarAdornmentLayerViewModel newLayer = ScaleLineOrBarAdornmentLayerViewModel.CreateInstance(tmpLayer);
                    ScaleLayers.Add(newLayer);
                }

                SelectedLayer = ScaleLayers.FirstOrDefault();
            }
        }
Пример #3
0
        public static ScaleLineOrBarAdornmentLayerViewModel CreateInstance(AdornmentLayer scaleLayer)
        {
            ScaleLineOrBarAdornmentLayerViewModel newLayer = new ScaleLineOrBarAdornmentLayerViewModel();

            if (scaleLayer is ScaleBarAdornmentLayer)
            {
                newLayer.ScaleType         = ScaleType.ScaleBar;
                newLayer.NumericFormatType = ScaleNumericFormatType.None;
                string formatString = ((ScaleBarAdornmentLayer)scaleLayer).TextStyle.NumericFormat.ToUpperInvariant();
                switch (formatString)
                {
                case "C": newLayer.NumericFormatType = ScaleNumericFormatType.Currency; break;

                case "D": newLayer.NumericFormatType = ScaleNumericFormatType.Decimal; break;

                case "E": newLayer.NumericFormatType = ScaleNumericFormatType.Scientific; break;

                case "F": newLayer.NumericFormatType = ScaleNumericFormatType.FixedPoint; break;

                case "G": newLayer.NumericFormatType = ScaleNumericFormatType.General; break;

                case "N": newLayer.NumericFormatType = ScaleNumericFormatType.Number; break;

                case "P": newLayer.NumericFormatType = ScaleNumericFormatType.Percent; break;

                case "R": newLayer.NumericFormatType = ScaleNumericFormatType.RoundTrip; break;

                case "X": newLayer.NumericFormatType = ScaleNumericFormatType.Hexadecimal; break;

                default:
                    break;
                }
                newLayer.selectedScaleBarUnitSystem = ((ScaleBarAdornmentLayer)scaleLayer).UnitFamily;
            }
            else
            {
                newLayer.ScaleType = ScaleType.ScaleLine;
                newLayer.selectedScaleLineUnitSystem = ((ScaleLineAdornmentLayer)scaleLayer).UnitSystem;
            }

            newLayer.Name     = scaleLayer.Name;
            newLayer.Width    = (int)scaleLayer.Width;
            newLayer.Location = scaleLayer.Location;
            newLayer.OffsetX  = (int)scaleLayer.XOffsetInPixel;
            newLayer.OffsetY  = (int)scaleLayer.YOffsetInPixel;

            newLayer.BackMask = scaleLayer.BackgroundMask;
            newLayer.Height   = (int)scaleLayer.Height;

            if (scaleLayer is ScaleBarAdornmentLayer)
            {
                ScaleBarAdornmentLayer scaleBarLayer = (ScaleBarAdornmentLayer)scaleLayer;
                newLayer.MaximumWidth = scaleBarLayer.MaxWidth;
                newLayer.Thickness    = scaleBarLayer.Thickness;
                newLayer.ForeColor    = scaleBarLayer.BarBrush;
                newLayer.AlteColor    = scaleBarLayer.AlternateBarBrush;
                newLayer.SelectedScaleBarUnitSystem = scaleBarLayer.UnitFamily;
            }

            return(newLayer);
        }