Ejemplo n.º 1
0
        void AddCircles()
        {
            ClearOverlays();

            var mapOverlayManager = mapView.MapOverlayManager;
            var pathDataOverlay   = mapOverlayManager.NewPathDataOverlay(new NMapPathData());

            // add circle data
            var circleData1 = new NMapCircleData(1);

            circleData1.InitCircleData();
            circleData1.AddCirclePoint(127.1085, 37.3675, 50.5f);

            //// set circle style
            var circleStyle1 = new NMapCircleStyle();

            circleStyle1.SetLineType(NMapPathLineType.Dash);
            circleData1.CircleStyle = circleStyle1;
            circleData1.EndCircleData();

            pathDataOverlay.AddCircleData(circleData1);

            // add circle data
            var circleData2 = new NMapCircleData(1);

            circleData2.InitCircleData();
            circleData2.AddCirclePoint(127.1065, 37.3685, 27.0f);
            circleData2.EndCircleData();

            // set circle style
            var circleStyle2 = new NMapCircleStyle();

            circleStyle2.SetLineType(NMapPathLineType.Solid);
            circleStyle2.FillColor  = UIColor.Green;
            circleData2.CircleStyle = circleStyle2;

            pathDataOverlay.AddCircleData(circleData2);

            // add circle data
            var circleData3 = new NMapCircleData(1);

            circleData3.InitCircleData();
            circleData3.AddCirclePoint(127.1085, 37.3685, 35.0f);
            circleData3.EndCircleData();

            // set circle style
            var circleStyle3 = new NMapCircleStyle();

            circleStyle3.SetLineType(NMapPathLineType.Solid);
            circleStyle3.FillColor  = UIColor.Gray;
            circleData3.CircleStyle = circleStyle3;

            pathDataOverlay.AddCircleData(circleData3);
            // show all POI data
            pathDataOverlay.ShowAllPathData();
        }
Ejemplo n.º 2
0
        private void TestPathDataOverlay()
        {
            // set path data points
            NMapPathData pathData = new NMapPathData(9);

            pathData.InitPathData();
            pathData.AddPathPoint(127.108099, 37.366034, NMapPathLineStyle.TypeSolid);
            pathData.AddPathPoint(127.108088, 37.366043, 0);
            pathData.AddPathPoint(127.108079, 37.365619, 0);
            pathData.AddPathPoint(127.107458, 37.365608, 0);
            pathData.AddPathPoint(127.107232, 37.365608, 0);
            pathData.AddPathPoint(127.106904, 37.365624, 0);
            pathData.AddPathPoint(127.105933, 37.365621, NMapPathLineStyle.TypeDash);
            pathData.AddPathPoint(127.105929, 37.366378, 0);
            pathData.AddPathPoint(127.106279, 37.366380, 0);
            pathData.EndPathData();

            NMapPathDataOverlay pathDataOverlay = mOverlayManager.CreatePathDataOverlay(pathData);

            if (pathDataOverlay != null)
            {
                // add path data with polygon type
                NMapPathData pathData2 = new NMapPathData(4);
                pathData2.InitPathData();
                pathData2.AddPathPoint(127.106, 37.367, NMapPathLineStyle.TypeSolid);
                pathData2.AddPathPoint(127.107, 37.367, 0);
                pathData2.AddPathPoint(127.107, 37.368, 0);
                pathData2.AddPathPoint(127.106, 37.368, 0);
                pathData2.EndPathData();
                pathDataOverlay.AddPathData(pathData2);
                // set path line style
                NMapPathLineStyle pathLineStyle = new NMapPathLineStyle(mMapView.Context);
                pathLineStyle.PataDataType = NMapPathLineStyle.DataTypePolygon;
                pathLineStyle.SetLineColor(0xA04DD2, 0xff);
                pathLineStyle.SetFillColor(0xFFFFFF, 0x00);
                pathData2.PathLineStyle = pathLineStyle;

                // add circle data
                NMapCircleData circleData = new NMapCircleData(1);
                circleData.InitCircleData();
                circleData.AddCirclePoint(127.1075, 37.3675, 50.0F);
                circleData.EndCircleData();
                pathDataOverlay.AddCircleData(circleData);
                // set circle style
                NMapCircleStyle circleStyle = new NMapCircleStyle(mMapView.Context);
                circleStyle.SetLineType(NMapPathLineStyle.TypeDash);
                circleStyle.SetFillColor(0x000000, 0x00);
                circleData.CircleStyle = circleStyle;

                // show all path data
                pathDataOverlay.ShowAllPathData(0);
            }
        }