Наследование: System.Windows.Controls.Control, INotifyPropertyChanged
Пример #1
0
 /// <summary>${ui_action_MapAction_constructor_Map_D}</summary>
 /// <param name="map">${ui_action_MapAction_constructor_Map_param_map}</param>
 /// <param name="name">${ui_action_MapAction_constructor_Map_param_name}</param>
 /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
 protected MapAction(Map map, string name, Cursor cursor)
 {
     Name = name;
     Map = map;
     Map.Cursor = cursor;
     Map.Focus();
 }
        public MeasureDistance(Map map, Cursor cursor)
        {
            Name = "MeasureDistance";
            Map = map;
            Stroke = new SolidColorBrush(Colors.Red);
            StrokeThickness = 3;
            Opacity = 1;
            Map.Cursor = cursor;

            measureFinallyResult = new TextBlock();
            measureFinallyResult.FontWeight = FontWeights.ExtraBlack;
        }
        /// <summary>${controls_InfoWindow_constructor_None_D}</summary>
        public InfoWindow(Map map)
            : this()
        {
            if (map == null)
            { throw new ArgumentNullException("map", Resource.InfoWindow_MapParam); }

            this.Map = map;
            base.DefaultStyleKey = typeof(InfoWindow);
            Visibility = Visibility.Collapsed;
            this.SizeChanged += new SizeChangedEventHandler(InfoWindow_SizeChanged);
            this.Map.LayoutUpdated += new EventHandler(Map_LayoutUpdated);
        }
        public MeasureArea(Map map, Cursor cursor)
        {
            Name = "MeasureArea";
            Map = map;
            Stroke = new SolidColorBrush(Colors.Red);
            Fill = new SolidColorBrush(Color.FromArgb(0x99, 255, 255, 255));
            StrokeThickness = 3;
            Opacity = 1;
            Map.Cursor = cursor;

            lastTextBlock.FontWeight = FontWeights.ExtraBlack;
            lastTextBlock.Foreground = new SolidColorBrush(Colors.Green);
        }
 public MapLegendItemInfo(Layer iClientLayer, Map iClientMap, bool _showOnlyVisibleLayers, double height, double width, bool expanded, Action<MapLegendItemInfo> action)
     : this()
 {
     //ToDo:
     this.layer = iClientLayer;
     this.map = iClientMap;
     this.Description = iClientLayer.ID;
     this.Name = iClientLayer.ID;
     showOnlyVisibleLayers = _showOnlyVisibleLayers;
     DoUIRefresh = action;
     SwitchLayersInfo(iClientLayer.Url, iClientLayer.ID);
     sourceImageWidth = width;
     sourceImageHeight = height;
     IsExpanded = expanded;
 }
Пример #6
0
 /// <summary>${ui_action_DrawLine_constructor_Map_D}</summary>
 /// <example>
 /// 	<code lang="CS">
 /// DrawLine draw = new DrawLine(MyMap,Cursors.Stylus)
 /// </code>
 /// </example>
 /// <param name="map">${ui_action_DrawLine_constructor_Map_param_map}</param>
 /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
 public DrawLine(Map map, Cursor cursor)
     : base(map, "DrawLine", cursor)
 {
     if (map.Theme == null)
     {
         Stroke = new SolidColorBrush(Colors.Red);
         StrokeThickness = MagicNumber.ACTION_STYLE_DEFAULT_STROKETHICKNESS;
         Opacity = MagicNumber.ACTION_STYLE_DEFAULT_OPACITY;
     }
     else
     {
         this.Stroke = map.Theme.Stroke;
         this.StrokeThickness = map.Theme.StrokeThickness;
         this.Opacity = map.Theme.Opacity;
     }
 }
Пример #7
0
        /// <summary>${ui_action_DrawPoint_constructor_Map_D}</summary>
        /// <example>
        /// 	<code lang="CS">
        /// DrawPoint draw = new DrawPoint(MyMap,Cursors.Stylus)
        /// </code>
        /// </example>
        /// <param name="map">${ui_action_DrawPoint_constructor_Map_param_map}</param>
        /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
        public DrawPoint(Map map , Cursor cursor)
            : base(map , "DrawPoint" , cursor)
        {
            DrawLayer = new ElementsLayer();

            if (map.Theme == null)
            {
                Opacity = MagicNumber.ACTION_STYLE_DEFAULT_OPACITY;
                Size = MagicNumber.ACTION_STYLE_DEFAULT_SIZE;
                Color = new SolidColorBrush(Colors.Red);
            }
            else
            {
                this.Opacity = map.Theme.Opacity;
                this.Size = map.Theme.Size;
                this.Color = map.Theme.Color;
            }
        }
 /// <summary>${ui_action_DrawRect_constructor_Map_D}</summary>
 /// <example>
 /// 	<code lang="CS">
 /// DrawRectangle draw = new DrawRectangle(MyMap,Cursors.Stylus)
 /// </code>
 /// </example>
 /// <param name="map">${ui_action_DrawRect_constructor_Map_param_map}</param>
 /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
 public DrawRectangle(Map map , Cursor cursor)
     : base(map , "DrawRectangle" , cursor)
 {
     startPt = Point2D.Empty;
     if (map.Theme == null)
     {
         Stroke = new SolidColorBrush(Colors.Green);
         StrokeThickness = MagicNumber.ACTION_STYLE_DEFAULT_STROKETHICKNESS;
         Fill = new SolidColorBrush(Colors.Black);
         Opacity = MagicNumber.ACTION_STYLE_DEFAULT_OPACITY;
     }
     else
     {
         this.Stroke = map.Theme.Stroke;
         this.StrokeThickness = map.Theme.StrokeThickness;
         this.Fill = map.Theme.Fill;
         this.Opacity = map.Theme.Opacity;
     }
 }
Пример #9
0
        private Point2D startPoint = Point2D.Empty; //用于移动整个线-面要素

        #endregion Fields

        #region Constructors

        /// <summary>${ui_action_Edit_constructor_D}</summary>
        /// <param name="map">${ui_action_Edit_constructor_param_map}</param>
        /// <param name="layer">${ui_action_Edit_constructor_param_layer}</param>
        public Edit(Map map , FeaturesLayer layer)
        {
            if (map != null && layer != null)
            {
                Name = "Edit";
                Map = map;
                editLayer = layer;
                editLayer.MouseLeftButtonDown += editLayer_MouseLeftButtonDown;
                editLayer.MouseLeftButtonUp += editLayer_MouseLeftButtonUp;
                if (map.Theme == null)
                {
                    SetDefaultStyle();
                }
                else
                {
                    HoverVertexStyle = map.Theme.HoverVertexStyle;
                    SnapStyle = map.Theme.SnapStyle;
                    HoverCenterStyle = map.Theme.HoverCenterStyle;
                    hoverLineStyle = new PredefinedLineStyle() { Stroke = new SolidColorBrush(Colors.Transparent) , StrokeThickness = 10 };//Colors.Transparent
                }
            }
        }
Пример #10
0
 /// <summary>${ui_action_DrawCircle_constructor_Map_D}</summary>
 /// <overloads>${ui_action_DrawCircle_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_DrawCircle_constructor_Map_param_map}</param>
 public DrawCircle(Map map)
     : this(map, Cursors.Stylus)
 {
 }
Пример #11
0
 /// <summary>${ui_action_DrawLine_constructor_Map_D}</summary>
 /// <overloads>${ui_action_DrawLine_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_DrawLine_constructor_Map_param_map}</param>
 public DrawLine(Map map)
     : this(map, Cursors.Stylus)
 {
 }
Пример #12
0
        /// <summary>${controls_Magnifier_method_onApplyTemplate_D}</summary>
        public override void OnApplyTemplate( )
        {
            base.OnApplyTemplate();

            magnifierMap = GetTemplateChild("MagMap") as Map;
            if (magnifierMap == null)
            {
                throw new ArgumentNullException("MagMap");
            }
            //TiledCacheLayer需要
            magnifierMap.Layers.LayersInitialized += (s4 , e4) =>
            {
                ToSetMagnifierLevel();
                ToUpdateMagnifierMapCenterPosition();
            };
            if (Layer != null)
            {
                magnifierMap.Layers.Add(Layer);
            }
            magnifierMap.MinResolution = double.Epsilon;
            magnifierMap.MaxResolution = double.MaxValue;

            //使Map上的Resolutions和magMap的Resolutions保持一致;
            if (Map != null && Map.Resolutions != null)
            {
                magnifierMap.Resolutions = Map.Resolutions;
            }
            MouseLeftButtonDown += (s , e) =>
            {
                cursor = Cursor;
                Cursor = Cursors.None;
                isDragOn = true;
                beginPosition = e.GetPosition(null);
                CaptureMouse();
            };
            MouseMove += (s2 , e2) =>
            {
                if (this.isDragOn)
                {
                    currentPosition = e2.GetPosition(null);
                    Convert.ToDouble(base.GetValue(Canvas.LeftProperty));
                    Convert.ToDouble(base.GetValue(Canvas.TopProperty));
                    MoveTo(currentPosition.X - beginPosition.X , currentPosition.Y - beginPosition.Y);
                    beginPosition = currentPosition;
                    ToUpdateMagnifierMapCenterPosition();
                }
            };
            MouseLeftButtonUp += (s1 , e1) =>
            {
                if (this.isDragOn)
                {
                    ReleaseMouseCapture();
                    isDragOn = false;
                }
                Cursor = cursor;
            };

            Opacity = 1.0;
            if (( Visibility == Visibility.Visible ) && ( Map != null ))
            {
                Dispatcher.BeginInvoke(delegate
                    {
                        ToSetMagnifierLevel();
                        ToUpdateMagnifierMapCenterPosition();
                    });
            }
        }
Пример #13
0
 public OvPan(Map map, Map mapBig)
     : this(map, mapBig, Cursors.Arrow)
 {
 }
Пример #14
0
 /// <summary>${ui_action_DrawPoint_constructor_Map_D}</summary>
 /// <overloads>${ui_action_DrawPoint_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_DrawPoint_constructor_Map_param_map}</param>
 public DrawPoint(Map map)
     : this(map , Cursors.Stylus)
 {
 }
 /// <summary>${ui_action_DrawPolygon_constructor_Map_D}</summary>
 /// <overloads>${ui_action_DrawPolygon_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_DrawPolygon_constructor_Map_param_map}</param>
 public DrawPolygon(Map map)
     : this(map, Cursors.Stylus)
 {
 }
Пример #16
0
 public OvPan(Map map, Map mapBig, Cursor cursor)
     : base(map, "OvPan", cursor)
 {
     this.mapBig = mapBig;
 }
Пример #17
0
 /// <summary>${ui_action_Pan_constructor_Map_D}</summary>
 /// <example>
 /// 	<code lang="CS">
 /// Pan panTo = new Pan(MyMap,Cursors.Hand)
 /// </code>
 /// </example>
 /// <param name="map">${ui_action_Pan_constructor_Map_param_map}</param>
 /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
 public Pan(Map map, Cursor cursor)
     : base(map, "Pan", cursor)
 {
 }
 public MeasureDistance(Map map)
     : this(map, Cursors.Hand)
 {
 }
 public DrawStar(Map map)
     : this(map, Cursors.Hand)
 {
 }
        /// <summary>${controls_OverviewMap_method_onApplyTemplate_D}</summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            outerRect = GetTemplateChild("OuterRect") as Grid;
            outerRect.Width = base.Width;
            outerRect.Height = base.Height;

            arrowButton = GetTemplateChild("ArrowButton") as Button;
            if (arrowButton != null)
            {
                arrowButton.Click += new RoutedEventHandler(Button_Click);
            }
            arrowButtonCopy = GetTemplateChild("ArrowButtonCopy") as Button;
            arrowButtonCopy.Click += new RoutedEventHandler(Button_Click);
            ovMap = GetTemplateChild("OvMap") as Map;
            if (ovMap == null)
            {
                throw new ArgumentNullException("OvMap");
            }
            ovMap.MinResolution = double.Epsilon;
            ovMap.MaxResolution = double.MaxValue;
            ovMap.EnableDblClick = false;
            ovMap.EnableWheel = false;
            ovMap.EnableKey = false;

            if (Map != null)
            {
                ovMap.Action = new OvPan(ovMap, Map);

                //确保在Map上设置了Resolution将其传到ovMap上;
                //if (Map.Resolutions != null)
                //{
                //    ovMap.Resolutions = Map.Resolutions;
                //}
            }

            ovMap.Width = base.Width - 16;
            ovMap.Height = base.Height - 16;
            ovMap.ViewBoundsChanged += (s, e) => { UpdateOvRect(); };
            if (Layers != null && Layers.Count > 0)  //只要Layers有值就以Layers为准
            {
                ovMap.Layers.Clear();
                foreach (var item in Layers)
                {
                    ovMap.Layers.Add(item);
                }
            }
            else if (Layer != null)
            {
                ovMap.Layers.Add(Layer);
            }

            ovRect = GetTemplateChild("OvRect") as Grid;
            if (ovRect != null)
            {
                ovRect.MouseLeftButtonDown += ovRect_MouseLeftButtonDown;
            }
            UpdateOvRect();

            if (CollapsedInTheInitialization)
            {
                outerRect.Visibility = Visibility.Collapsed;
                arrowButtonCopy.Visibility = Visibility.Collapsed;
            }
            else
            {
                outerRect.Visibility = Visibility.Visible;
                arrowButton.Visibility = Visibility.Collapsed;
            }
        }
Пример #21
0
 /// <summary>${ui_action_ZoomIn_constructor_Map_D}</summary>
 /// <param name="map">${ui_action_ZoomIn_constructor_Map_param_map}</param>
 public ZoomIn(Map map)
     : base(map)
 {
 }
Пример #22
0
 /// <summary>${ui_action_ZoomOut_constructor_Map_D}</summary>
 /// <overloads>${ui_action_ZoomOut_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_ZoomOut_constructor_Map_param_map}</param>
 public ZoomOut(Map map)
     : base(map)
 {
 }
Пример #23
0
 /// <summary>${ui_action_Pan_constructor_Map_D}</summary>
 /// <overloads>${ui_action_Pan_constructor_overloads}</overloads>
 /// <param name="map">${ui_action_Pan_constructor_Map_param_map}</param>
 public Pan(Map map)
     : this(map, Cursors.Arrow)
 {
 }
        public DrawStar(Map map, Cursor cursor)
        {
            Name = "DrawStar";
            Map = map;

            Stroke = new SolidColorBrush(Colors.Red);
            StrokeThickness = 2;
            Fill = new SolidColorBrush(Colors.Red);
            FillRule = FillRule.Nonzero;
            Opacity = 1;

            Map.Cursor = cursor;
        }
Пример #25
0
 /// <summary>${ui_action_ZoomOut_constructor_Map_D}</summary>
 /// <example>
 /// 	<code lang="CS">
 /// ZoomOut zoomMap = new ZoomOut(MyMap,Cursors.Arrow)
 /// </code>
 /// </example>
 /// <param name="map">${ui_action_ZoomOut_constructor_Map_param_map}</param>
 /// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
 public ZoomOut(Map map, Cursor cursor)
     : base(map, cursor)
 {
 }
 public MeasureArea(Map map)
     : this(map, Cursors.Hand)
 {
 }
 /// <summary>${ui_action_DrawRect_constructor_Map_D}</summary>
 /// <param name="map">${ui_action_DrawRect_constructor_Map_param_map}</param>
 public DrawRectangle(Map map)
     : this(map , Cursors.Stylus)
 {
 }