// Constructor
        public MainPage()
        {
            InitializeComponent();
            MyMap.ViewBounds = new Rectangle2D(11285095.6059184, 2296202.73281782, 13634177.6371684, 5702371.67813032);
            _layer = MyMap.Layers["CLayer"] as CloudLayer;
            _layer.LocalStorage = new OfflineStorage("CloudMap");
            _layer.Progress += _layer_Progress;
            _fLayer = MyMap.Layers["FLayer"] as FeaturesLayer;
            _eLayer = MyMap.Layers["ELayer"] as ElementsLayer;
            _pushpinLayer = MyMap.Layers["PushpinLayer"] as ElementsLayer;
            _queue = new Queue<Point2D>();

            Random randomX = new Random(1);
            Random ramdomY = new Random(2);
            double baseX = 101.95;
            double baseY = 29.3;
            for (int i = 0; i < 10; i++)
            {
                double x = baseX + randomX.NextDouble() * 2;
                double y = baseY + ramdomY.NextDouble() * 2;
                _queue.Enqueue(MercatorUtility.LatLonToMeters(new Point2D(x, y)));
            }

            MyMap.Tap += MyMap_Tap;
            MyMap.DoubleTap += MyMap_DoubleTap;
            MyMap.Hold += MyMap_Hold;
        }
        private void Activate()
        {
            if (Map == null || Map.Layers == null)
            {
                return;
            }

            polygon = new PolygonElement();
            #region 所有风格的控制
            polygon.Stroke = Stroke;
            polygon.StrokeThickness = StrokeThickness;
            polygon.StrokeMiterLimit = StrokeMiterLimit;
            polygon.StrokeDashOffset = StrokeDashOffset;
            polygon.StrokeDashArray = StrokeDashArray;
            polygon.StrokeDashCap = StrokeDashCap;
            polygon.StrokeEndLineCap = StrokeEndLineCap;
            polygon.StrokeLineJoin = StrokeLineJoin;
            polygon.StrokeStartLineCap = StrokeStartLineCap;
            polygon.Opacity = Opacity;
            polygon.Fill = Fill;
            polygon.FillRule = FillRule;
            #endregion
            points = new Point2DCollection();
            polygon.Point2Ds = points;
            points.Add(startPt);

            DrawLayer = new ElementsLayer();

            Map.Layers.Add(DrawLayer);
            DrawLayer.Children.Add(polygon);

            isActivated = true;
            isDrawing = true;
        }
        private void Activate(Point2D firstPoint)
        {
            if (Map == null || Map.Layers == null)
            {
                return;
            }

            polyline = new PolylineElement();
            polyline.Stroke = Stroke;
            polyline.StrokeThickness = StrokeThickness;
            polyline.Opacity = Opacity;
            polyline.StrokeMiterLimit = StrokeMiterLimit;
            polyline.StrokeDashOffset = StrokeDashOffset;
            polyline.StrokeDashArray = StrokeDashArray;
            polyline.StrokeDashCap = StrokeDashCap;
            polyline.StrokeEndLineCap = StrokeEndLineCap;
            polyline.StrokeLineJoin = StrokeLineJoin;
            polyline.StrokeStartLineCap = StrokeStartLineCap;
            polyline.Fill = Fill;
            polyline.FillRule = FillRule;

            points = new Point2DCollection();
            polyline.Point2Ds = points;
            points.Add(firstPoint);

            DrawLayer = new ElementsLayer();

            Map.Layers.Add(DrawLayer);
            DrawLayer.Children.Add(polyline);

            isActivated = true;
            isDrawing = true;
        }
        private void Activate(Point2D item)
        {
            if (Map == null || Map.Layers == null)
            {
                return;
            }
            DrawLayer = new ElementsLayer();
            Map.Layers.Add(DrawLayer);
            rectangle = new Rectangle();
            rectangle.Stroke = this.Stroke;
            rectangle.StrokeThickness = this.StrokeThickness;
            rectangle.StrokeMiterLimit = this.StrokeMiterLimit;
            rectangle.StrokeDashOffset = this.StrokeDashOffset;
            rectangle.StrokeDashArray = this.StrokeDashArray;
            rectangle.StrokeDashCap = this.StrokeDashCap;
            rectangle.StrokeEndLineCap = this.StrokeEndLineCap;
            rectangle.StrokeLineJoin = this.StrokeLineJoin;
            rectangle.StrokeStartLineCap = this.StrokeStartLineCap;
            rectangle.Opacity = this.Opacity;
            rectangle.Fill = this.Fill;

            rectangle.SetValue(ElementsLayer.BBoxProperty , new Rectangle2D(item , item));
            DrawLayer.Children.Add(rectangle);

            isActivated = true;
            isDrawing = true;
        }
Example #5
0
        private void Activate(Point2D item)
        {
            if (Map == null || Map.Layers == null)
            {
                return;
            }
            ellipse = new Ellipse();
            #region 所有风格的控制
            ellipse.Stroke = Stroke;
            ellipse.StrokeThickness = StrokeThickness;
            ellipse.Fill = Fill;
            ellipse.StrokeMiterLimit = StrokeMiterLimit;
            ellipse.StrokeDashOffset = StrokeDashOffset;
            ellipse.StrokeDashArray = StrokeDashArray;
            ellipse.StrokeDashCap = StrokeDashCap;
            ellipse.StrokeEndLineCap = StrokeEndLineCap;
            ellipse.StrokeLineJoin = StrokeLineJoin;
            ellipse.StrokeStartLineCap = StrokeStartLineCap;
            ellipse.Opacity = Opacity;
            #endregion

            DrawLayer = new ElementsLayer();
            Map.Layers.Add(DrawLayer);

            ellipse.SetValue(ElementsLayer.BBoxProperty, new Rectangle2D(item, item));
            DrawLayer.Children.Add(ellipse);

            isActivated = true;
            isDrawing = true;
        }
        public MainPage()
        {
            InitializeComponent();
            _fLayer = MyMap.Layers["MyFeatureLayer"] as FeaturesLayer;
            _eLayer = MyMap.Layers["MyElementsLayer"] as ElementsLayer;
            _DLayer = MyMap.Layers["TDRESTLayer"] as TiledDynamicRESTLayer;
            MyMap.Tap += MyMap_Tap;

        }
Example #7
0
 public MeasureDistance(Map map, ElementsLayer elementsLayer, FeaturesLayer featuresLayer)
 {
     _map = map;
     _eLayer = elementsLayer;
     _fLayer = featuresLayer;
     _isInited = false;
     _distanceList = new List<TextBlock>();
     _points = new Point2DCollection();
     _distances = new List<double>();
 }
Example #8
0
 public MeasureDistance(Map map, ElementsLayer elementsLayer, FeaturesLayer featuresLayer, bool isMeasure)
 {
     _map = map;
     _eLayer = elementsLayer;
     _fLayer = featuresLayer;
     _isInited = false;
     _distanceList = new List<Border>();
     _points = new Point2DCollection();
     _distances = new List<double>();
     _isMeasure = isMeasure;
 }
 public MainPage()
 {
     InitializeComponent();
     _fLayer = MyMap.Layers["MyFeatureLayer"] as FeaturesLayer;
     _eLayer = MyMap.Layers["MyElementsLayer"] as ElementsLayer;
     _DLayer = MyMap.Layers["TDRESTLayer"] as TiledDynamicRESTLayer;
     MyMap.MouseLeftButtonDown += MyMap_MouseLeftButtonDown;
     MyMap.MouseMove += MyMap_MouseMove;
     MyMap.MouseLeftButtonUp += MyMap_MouseLeftButtonUp;
     
 }
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            featuresLayer = MyMap.Layers["MyFeatureLayer"] as FeaturesLayer;
            tdRESTLayer = MyMap.Layers["TDLayer"] as TiledDynamicRESTLayer;
            _eLayer = MyMap.Layers["ELayer"] as ElementsLayer;
           
            MyMap.Tap+=MyMap_Tap;

            // 用于本地化 ApplicationBar 的示例代码
            //BuildLocalizedApplicationBar();
        }
 // 构造函数
 public MainPage()
 {
     InitializeComponent();
     _elementLayer = MyMap.Layers["ELayer"] as ElementsLayer;
     _feature = MyMap.Layers["MyFeatureLayer"] as FeaturesLayer;
     double[] resolutions = new double[14];
     double resolution = 0.28526148969889065;
     for (int i = 0; i < 14; i++)
     {
         resolutions[i] = resolution;
         resolution /= 2;
     }
     MyMap.Resolutions = resolutions;
     MyMap.Tap += MyMap_Tap;
 }
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            elementLayer = MyMap.Layers["ElementLayer"] as ElementsLayer;
            featuresLayer = MyMap.Layers["FeaturesLayer"] as FeaturesLayer;
           featuresLayer.Tap += featuresLayer_Tap;
          //featuresLayer.MouseEnter += featuresLayer_MouseEnter;
          // featuresLayer.MouseLeave += featuresLayer_MouseLeave;
          // featuresLayer.MouseLeftButtonDown += featuresLayer_MouseLeftButtonDown;
          //  featuresLayer.MouseLeftButtonUp += featuresLayer_MouseLeftButtonUp; 
          //  featuresLayer.MouseMove += featuresLayer_MouseMove;
            //MyMap.Tap += MyMap_Tap;
            //MyMap.MouseEnter += MyMap_MouseEnter;
           //MyMap.MouseLeave += MyMap_MouseLeave;
           //MyMap.MouseLeftButtonDown += MyMap_MouseLeftButtonDown;

        }
Example #13
0
        private void Activate(Point2D item)
        {
            if (this.map == null || this.map.Layers == null)
            {
                return;
            }
            DrawLayer = new ElementsLayer();
            this.map.Layers.Add(DrawLayer);
            rectangle = new Rectangle();
            

            rectangle.SetValue(ElementsLayer.BBoxProperty , new Rectangle2D(item , item));
            DrawLayer.Children.Add(rectangle);

            isActivated = true;
            isDrawing = true;
        }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     _fLayer = MyMap.Layers["FLayer"] as FeaturesLayer;
     _eLayer = MyMap.Layers["ELayer"] as ElementsLayer;
     _layer = MyMap.Layers["CLayer"] as CloudLayer;
     _layer.LocalStorage = new OfflineStorage("CloudMap");
     MyMap.ViewBoundsChanged += MyMap_ViewBoundsChanged;
     _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
     _watcher.MovementThreshold = 20;
     _watcher.PositionChanged += _watcher_PositionChanged;
     _watcher.StatusChanged += _watcher_StatusChanged;
     _compass = Compass.GetDefault();
     if (_compass != null)
     {
         _compass.ReadingChanged += _compass_ReadingChanged;
         _compass.ReportInterval = 100;
     }
     MyMap.Tap += MyMap_Tap;
     MyMap.DoubleTap += MyMap_DoubleTap;
     MyMap.Hold += MyMap_Hold;
 }
Example #15
0
 public DrawPoint(Map map, ElementsLayer layer)
 {
     _map = map;
     _eLayer = layer;
     _pushpins = new List<Pushpin>();
 }
Example #16
0
 /// <summary>${WP_mapping_Map_method_openInfoWindow_D}</summary>
 ///  <param name="location">${WP_mapping_Map_method_openInfoWindow_param_location}</param>
 ///  <param name="offsetPixelX">${WP_mapping_Map_method_openInfoWindow_param_offsetPixelX}</param>
 ///  <param name="offsetPixelY">${WP_mapping_Map_method_openInfoWindow_param_offsetPixelY}</param>
 /// <param name="element">${WP_mapping_Map_method_openInfoWindow_param_element}</param>
 public void OpenInfoWindow(Point2D location, double offsetPixelX, double offsetPixelY, UIElement element)
 {
     if (Layers.Count == 0)
     {
         return;
     }//待补充其他异常消除
     if (windowsLayer == null)
     {
         windowsLayer = new ElementsLayer();
         Layers.Add(windowsLayer);
     }
     windowsLayer.Children.Clear();
     Point originPixel = this.MapToScreen(location);
     Point offsetPixel = new Point(originPixel.X + offsetPixelX, originPixel.Y + offsetPixelY);
     Point2D offsetLocation = this.ScreenToMap(offsetPixel);
     windowsLayer.AddChild(element, offsetLocation);
 }
Example #17
0
 /// <summary>${WP_mapping_Map_method_closeInfoWindow_D}</summary>
 public void CloseInfoWindow()
 {
     if (windowsLayer != null)
     {
         Layers.Remove(windowsLayer);
         windowsLayer = null;
     }
 }
Example #18
0
 public DrawRectangle(Map map,ElementsLayer layer )
 {
    
 }