Esempio n. 1
0
        public static async Task DisplayNorthArrowAsync(Layout layout, string mapFrameName)
        {
            var arcgis_2d = Project.Current.GetItems <StyleProjectItem>().First(si => si.Name == "ArcGIS 2D");

            await QueuedTask.Run(() =>
            {
                if (arcgis_2d != null)
                {
                    var northArrowItems = arcgis_2d.SearchNorthArrows("ESRI North 1");
                    if (northArrowItems == null || northArrowItems.Count == 0)
                    {
                        return;
                    }
                    NorthArrowStyleItem northArrowStyleItem = northArrowItems[0];

                    //Reference the map frame and define the location
                    MapFrame mapFrame   = layout.FindElement(mapFrameName) as MapFrame;
                    Coordinate2D nArrow = new Coordinate2D(7.7906, 0.8906);

                    //Construct the north arrow
                    NorthArrow northArrow = LayoutElementFactory.Instance.CreateNorthArrow(layout, nArrow, mapFrame, northArrowStyleItem);
                    northArrow.SetHeight(0.7037);
                }
            });
        }
Esempio n. 2
0
        public static async Task DisplayScaleBarAsync(Layout layout, string mapFrameName)
        {
            var arcgis_2d = Project.Current.GetItems <StyleProjectItem>().First(si => si.Name == "ArcGIS 2D");

            await QueuedTask.Run(() =>
            {
                if (arcgis_2d != null)
                {
                    var scaleBars = arcgis_2d.SearchScaleBars("Alternating Scale Bar");
                    if (scaleBars == null || scaleBars.Count == 0)
                    {
                        return;
                    }
                    ScaleBarStyleItem scaleBarStyleItem = scaleBars[0];

                    //Reference the map frame and define the location
                    MapFrame mapFrame     = layout.FindElement(mapFrameName) as MapFrame;
                    Coordinate2D location = new Coordinate2D(3.8, 0.3);

                    //Construct the scale bar
                    ScaleBar scaleBar               = LayoutElementFactory.Instance.CreateScaleBar(layout, location, mapFrame, scaleBarStyleItem);
                    CIMScaleBar cimScaleBar         = (CIMScaleBar)scaleBar.GetDefinition();
                    cimScaleBar.Divisions           = 2;
                    cimScaleBar.Subdivisions        = 4;
                    cimScaleBar.DivisionsBeforeZero = 1;
                    cimScaleBar.MarkFrequency       = ScaleBarFrequency.Divisions;
                    cimScaleBar.MarkPosition        = ScaleBarVerticalPosition.Above;
                    cimScaleBar.UnitLabelPosition   = ScaleBarLabelPosition.AfterLabels;
                    scaleBar.SetDefinition(cimScaleBar);
                }
            });
        }
        public JsonResult SearchThisArea(string latTopRight, string lonTopRight, string latBotLeft, string lonBotLeft)         // (MapFrame mapFrame) //
        {
            MapFrame mapFrame = new MapFrame
            {
                latTopRight = latTopRight,
                lonTopRight = lonTopRight,
                latBotLeft  = latBotLeft,
                lonBotLeft  = lonBotLeft
            };



            var users = _userRepo.GetLocalsInFrame(mapFrame);
            //var users = _manager.Users.Where(x => (x.InRange(mapFrame) && x.showMeOnMap)).ToList();
            var result = new List <LocaleeModel>();

            foreach (var u in users)
            {
                result.Add(new LocaleeModel
                {
                    Id                   = u.Id,
                    UserNameStr          = u.UserNameStr,
                    lat                  = u.lat,
                    lon                  = u.lon,
                    Avatar               = (u.Avatar == null ? "Avatar_Default1.jpg" : u.Avatar),
                    ReceivedRatingsCount = u.ReceivedRatings.Count,
                    OverallRating        = Math.Round((u.ReceivedRatings.Count != 0? u.ReceivedRatings.Average(r => r.RatingValue):0), 2)
                });
            }
            return(Json(result.OrderByDescending(x => x.OverallRating).ThenByDescending(i => i.ReceivedRatingsCount)));
        }
        private void HandleTileReceived(object sender, TileReceivedEventArgs e)
        {
            var i = e.TileInfo.Index;

            if (i.Level != _level)
            {
                return;
            }

            //System.Diagnostics.Debug.WriteLine("Tile received (Index({0}, {1}, {2}))", i.Level, i.Row, i.Col);
// some timed refreshes if the server becomes slooow...
            if (_stopwatch.Elapsed.Milliseconds > 250 && !_tileFetcher.Ready())
            {
                _stopwatch.Reset();
                MapFrame.Invalidate();
                _stopwatch.Restart();
                return;
            }

            var ext = ToBrutileExtent(MapFrame.ViewExtents);

            if (ext.Intersects(e.TileInfo.Extent))
            {
                MapFrame.Invalidate(FromBruTileExtent(e.TileInfo.Extent));
            }
        }
Esempio n. 5
0
        private void AddTableToLayout(Layout layout, Map theMap, MapFrame mfElm, string layerName, SetPage setPage, double yOffset)
        {
            var lyrs = theMap.FindLayers(layerName, true);

            if (lyrs.Count > 0)
            {
                Layer lyr      = lyrs[0];
                var   ptSymbol = GetPointSymbolFromLayer(lyr);
                if (ptSymbol != null)
                {
                    Coordinate2D llSym = new Coordinate2D(setPage.XOffsetMapMarginalia, setPage.YOffsetSymbol + yOffset);
                    var          sym   = LayoutElementFactory.Instance.CreatePointGraphicElement(layout, llSym, ptSymbol);

                    Coordinate2D llText = new Coordinate2D(setPage.XOffsetMapMarginalia + sym.GetWidth(), setPage.YOffsetSymbol + yOffset - sym.GetHeight() / 2);
                    var          text   = LayoutElementFactory.Instance.CreatePointTextGraphicElement(layout, llText, lyr.Name);
                    text.SetAnchor(Anchor.CenterPoint);
                    text.SetHeight(text.GetHeight());
                    if (text.GetHeight() > sym.GetHeight())
                    {
                        sym.SetLockedAspectRatio(true);
                        sym.SetHeight(text.GetHeight());
                    }
                    else
                    {
                        text.SetLockedAspectRatio(true);
                        text.SetHeight(sym.GetHeight());
                    }
                }
                Coordinate2D llTab1 = new Coordinate2D(setPage.XOffsetMapMarginalia, yOffset - setPage.HeightPartsMarginalia);
                Coordinate2D urTab1 = new Coordinate2D(setPage.XOffsetMapMarginalia + setPage.XWidthMapMarginalia, yOffset);
                var          table1 = LayoutElementFactory.Instance.CreateTableFrame(layout, EnvelopeBuilder.CreateEnvelope(llTab1, urTab1), mfElm, lyr, new string[] { "No", "Type", "Description" });
            }
        }
Esempio n. 6
0
 protected void DrawSymbol(int int_3, Rectangle rectangle_0, object object_0)
 {
     if (object_0 != null)
     {
         if (object_0 is IMapGrid)
         {
             tagRECT tagRECT = default(tagRECT);
             tagRECT.left   = rectangle_0.Left;
             tagRECT.right  = rectangle_0.Right;
             tagRECT.top    = rectangle_0.Top;
             tagRECT.bottom = rectangle_0.Bottom;
             IMapFrame mapFrame = new MapFrame() as IMapFrame;
             IMap      map      = new Map();
             mapFrame.Map = map;
             (object_0 as IMapGrid).PrepareForOutput(int_3, 96, ref tagRECT, mapFrame);
         }
         else
         {
             IStyleDraw styleDraw = StyleDrawFactory.CreateStyleDraw(object_0);
             if (styleDraw != null)
             {
                 styleDraw.Draw(int_3, rectangle_0, 1.0, 1.0);
             }
         }
     }
 }
Esempio n. 7
0
        public static Task ExportMapFrameToSVGAsync(string LayoutName, string MFName, string Path)
        {
            //Reference a layoutitem in a project by name
            LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));

            if (layoutItem == null)
            {
                return(Task.FromResult <Layout>(null));
            }

            //Create SVG format with appropriate settings
            SVGFormat SVG = new SVGFormat();

            SVG.Resolution     = 300;
            SVG.OutputFileName = Path;

            return(QueuedTask.Run(() =>
            {
                //Export MapFrame
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                MapFrame mf = lyt.FindElement(MFName) as MapFrame;
                SVG.OutputFileName = Path;
                if (SVG.ValidateOutputFilePath())
                {
                    mf.Export(SVG);
                }
            }));
        }
Esempio n. 8
0
        /// <inheritdoc />
        public override bool ClearSelection(out Envelope affectedAreas)
        {
            affectedAreas = new Envelope();
            bool changed = false;

            if (!_selectionEnabled)
            {
                return(false);
            }
            MapFrame.SuspendEvents();
            foreach (ILayer layer in GetLayers())
            {
                Envelope layerArea;
                if (layer.ClearSelection(out layerArea))
                {
                    changed = true;
                    affectedAreas.ExpandToInclude(layerArea);
                }
            }
            MapFrame.ResumeEvents();

            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.

            return(changed);
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.instance.change_title("Esquadra mais próxima");
            DatabaseHelperClass dbtemas = new DatabaseHelperClass();
            ObservableCollection <Classes.Entidade> EntList = dbtemas.ReadEntidade();

            this.EntList = EntList;
            CalcDist();
            closest_police();
            NomeEnt.Text      = closest.Nome;
            MoradaEnt.Text    = closest.Morada;
            CodPostalEnt.Text = closest.Codigo_Postal;

            TeleEnt.Text  = closest.Telefone.ToString();
            EmailEnt.Text = closest.Email;

            if (closest.Fax.ToString() == "0")
            {
                FaxEnt.Text       = "Não Disponível";
                FaxEnt.Foreground = new SolidColorBrush(Colors.Gray);
            }
            else
            {
                FaxEnt.Text = closest.Fax.ToString();
            }

            ImageEnt.Source = new BitmapImage(new Uri(ConfigData.Iconpath + closest.Anexo, UriKind.Absolute));
            MapFrame.Navigate(typeof(Pages.Contactos), closest);
            Translate();
        }
Esempio n. 10
0
        public static Task <bool> UpdateMapSurroundAsync(string LayoutName, string SBName, string MFName)
        {
            //Reference a layoutitem in a project by name
            LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));

            if (layoutItem == null)
            {
                return(Task.FromResult(false));
            }

            return(QueuedTask.Run <bool>(() =>
            {
                //Reference and load the layout associated with the layout item
                Layout lyt = layoutItem.GetLayout();

                //Reference a scale bar element by name
                MapSurround scaleBar = lyt.FindElement(SBName) as MapSurround;
                if (scaleBar == null)
                {
                    return false;
                }

                //Reference a map frame element by name
                MapFrame mf = lyt.FindElement(MFName) as MapFrame;
                if (mf == null)
                {
                    return false;
                }

                //Set the scale bar to the newly referenced map frame
                scaleBar.SetMapFrame(mf);
                return true;
            }));
        }
Esempio n. 11
0
        /// <inheritdoc />
        public override bool Select(Envelope tolerant, Envelope strict, SelectionMode mode, out Envelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();

            foreach (var s in GetLayers()
                     .Reverse()
                     .Where(_ => _.SelectionEnabled && _.IsVisible))
            {
                Envelope layerArea;
                if (s.Select(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                    affectedArea.ExpandToInclude(layerArea);
                }
                // removed by jany_: this selected only features of the first layer with features in the selected area, if user wanted to select features of another layer too they get ignored
                // added SelectPlugin enables user to choose the layers in which he wants to select features
                //if (somethingChanged)
                //{
                //    MapFrame.ResumeEvents();
                //    OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
                //    return somethingChanged;
                //}
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Esempio n. 12
0
        private void NavView_Navigate(NavigationViewItem item)
        {
            switch (item.Tag)
            {
            //Test Interweb
            case "network":
                MapFrame.Navigate(typeof(NetworkCheck));
                break;

            //select API or Reference
            case "API":
                MapFrame.Navigate(typeof(DrawMap));
                break;

            //select algorithm
            case "algo":
                MapFrame.Navigate(typeof(Algorithm));
                break;

            //Get Input
            case "Locations":
                MapFrame.Navigate(typeof(SelectLocations));
                break;

            //figure it out
            case "calc":
                MapFrame.Navigate(typeof(GetRoute));
                break;
            }
        }
Esempio n. 13
0
        /// <inheritdoc />
        public override bool Select(IEnvelope tolerant, IEnvelope strict, SelectionMode mode, out IEnvelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();

            foreach (var s in GetLayers()
                     .Reverse()
                     .Where(_ => _.SelectionEnabled && _.IsVisible))
            {
                IEnvelope layerArea;
                if (s.Select(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                }
                affectedArea.ExpandToInclude(layerArea);
                if (somethingChanged)
                {
                    MapFrame.ResumeEvents();
                    OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
                    return(somethingChanged);
                }
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Esempio n. 14
0
        void btn_Go_Click(object sender, EventArgs e)
        {
            MapFrame dtl = new MapFrame(this.FK_MapFrame);

            //  dtl.IntMapAttrs();
            this.Response.Redirect("MapFrameDe.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapFrame=" + this.FK_MapFrame, true);
        }
Esempio n. 15
0
        /// <inheritdoc />
        public override bool InvertSelection(Envelope tolerant, Envelope strict, SelectionMode mode, out Envelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();
            foreach (ILayer s in GetLayers())
            {
                if (s.SelectionEnabled == false)
                {
                    continue;
                }
                Envelope layerArea;
                if (s.InvertSelection(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                    affectedArea.ExpandToInclude(layerArea);
                }
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Esempio n. 16
0
        public bool AddMapFrame()
        {
            IActiveView        arg_0B_0          = this._context.ActiveView;
            IGraphicsContainer graphicsContainer = this._context.ActiveView as IGraphicsContainer;
            bool result;

            if (graphicsContainer == null)
            {
                result = false;
            }
            else
            {
                IMapFrame mapFrame = new MapFrame() as IMapFrame;
                IMap      map      = new Map();
                this.button++;
                map.Name     = string.Format("新建地图 {0}", this.button);
                mapFrame.Map = map;
                IElement  element  = mapFrame as IElement;
                IEnvelope envelope = new Envelope() as IEnvelope;
                envelope.PutCoords(0.0, 0.0, 5.0, 5.0);
                element.Geometry = envelope;
                INewElementOperation operation = new NewElementOperation
                {
                    ActiveView = this._context.ActiveView,
                    Element    = element
                };
                this._context.OperationStack.Do(operation);
                result = true;
            }
            return(result);
        }
Esempio n. 17
0
        private double LongestPageSide(MapFrame mf)
        {
            double wd = mf.GetWidth();
            double ht = mf.GetHeight();

            return(wd > ht ? wd : ht);
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Classes.Entidade ent = e.Parameter as Classes.Entidade;
            this.ent          = ent;
            NomeEnt.Text      = ent.Nome;
            MoradaEnt.Text    = ent.Morada;
            CodPostalEnt.Text = ent.Codigo_Postal;

            TeleEnt.Text  = ent.Telefone.ToString();
            EmailEnt.Text = ent.Email;

            if (ent.Fax.ToString() == "0")
            {
                FaxEnt.Text       = "Não Disponível";
                FaxEnt.Foreground = new SolidColorBrush(Colors.Gray);
            }
            else
            {
                FaxEnt.Text = ent.Fax.ToString();
            }

            ImageEnt.Source = new BitmapImage(new Uri(ConfigData.Iconpath + ent.Anexo, UriKind.Absolute));
            Translate();
            MapFrame.Navigate(typeof(Pages.Contactos), ent);
        }
Esempio n. 19
0
    async public static void CreateNew()
    {
        #region TableFrame_CreateNew
        //Create a new table frame on the active layout.

        Layout layout = LayoutView.Active.Layout;

        //Perform on the worker thread
        await QueuedTask.Run(() =>
        {
            //Build 2D envelope geometry
            Coordinate2D rec_ll = new Coordinate2D(1.0, 3.5);
            Coordinate2D rec_ur = new Coordinate2D(7.5, 4.5);
            Envelope rec_env    = EnvelopeBuilder.CreateEnvelope(rec_ll, rec_ur);

            //Reference map frame
            MapFrame mf = layout.FindElement("Map Frame") as MapFrame;

            //Reference layer
            Map m            = mf.Map;
            FeatureLayer lyr = m.FindLayers("GreatLakes").First() as FeatureLayer;

            //Build fields list
            var fields = new[] { "NAME", "Shape_Area", "Shape_Length" };

            //Construct the table frame
            TableFrame tabFrame = LayoutElementFactory.Instance.CreateTableFrame(layout, rec_env, mf, lyr, fields);
        });

        #endregion TableFrame_CreateNew
    }
Esempio n. 20
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="aLayer">a map layer</param>
        /// <param name="mf">map frame</param>
        public frmLayerProperty(MapLayer aLayer, MapFrame mf)
        {
            InitializeComponent();

            _mapLayer  = aLayer;
            _mapFrame  = mf;
            _isLoading = true;
            Initialize();
            _isLoading = false;
        }
Esempio n. 21
0
        async public static void ExportSnippets()
        {
            LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout Name"));

            Layout lyt = await QueuedTask.Run(() => layoutItem.GetLayout());

            MapFrame mf = lyt.FindElement("Map1 Map Frame") as MapFrame;

            #region BMP_Constructor
            BMPFormat BMP = new BMPFormat();
            #endregion BMP_Constructor

            #region EMF_Constructor
            EMFFormat EMF = new EMFFormat();
            #endregion EMF_Constructor

            #region EPS_Constructor
            EPSFormat EPS = new EPSFormat();
            #endregion EPS_Constructor

            #region GIF_Constructor
            GIFFormat GIF = new GIFFormat();
            #endregion GIF_Constructor

            #region JPEG_Constructor
            JPEGFormat JPEG = new JPEGFormat();
            #endregion JPEG_Constructor

            #region PNG_Constructor
            PNGFormat PNG = new PNGFormat();
            #endregion PNG_Constructor

            #region PDF_Constructor
            PDFFormat PDF = new PDFFormat();
            #endregion PDF_Constructor

            #region SVG_Constructor
            SVGFormat SVG = new SVGFormat();
            #endregion SVG_Constructor

            #region TGA_Constructor
            TGAFormat TGA = new TGAFormat();
            #endregion TGA_Constructor

            #region TIFF_Constructor
            TIFFFormat TIFF = new TIFFFormat();
            #endregion TIFF_Constructor


            PDF.OutputFileName = @"C:\Temp\output.pdf";

            #region PDF_lyt_Export
            lyt.Export(PDF);
            #endregion PDF_lyt_Export
        }
Esempio n. 22
0
        private IMapFrame MakeMapFrame(IEnvelope pEnv, IMap pMap)
        {
            IMapFrame pRetVal = new MapFrame() as IMapFrame;

            pRetVal.Map = pMap;

            IElement pElement = (IElement)pRetVal;

            pElement.Geometry = pEnv;
            return(pRetVal);
        }
Esempio n. 23
0
        public DatelineCrossingMap()
        {
            _geoSlaveMapFrame = new MapFrame(this, new Extent(0, 0, 0, 0));

            // give the slave frame something to draw.
            _geoSlaveMapFrame.Layers = MapFrame.Layers;
            // Changing layers causes a resize event to be fired. If that event reaches the slave frame after the main frame,
            // then it can get misaligned. So, re-assign the layers to the main frame, causing the main frame to re-register its event handlers so that the main frame resize happens second.
            // Note that the fact that events are fired in order is an implementation detail of C#; if that changes, we might get misaligned frames after adding layers.
            MapFrame.Layers          = MapFrame.Layers;
            _viewExtentsBeingChanged = false;
        }
Esempio n. 24
0
 protected override void Draw(Graphics g, PaintEventArgs e)
 {
     if (!MapFrame.ViewExtents.IsCrossDateline())
     {
         MapFrame.Draw(new PaintEventArgs(g, e.ClipRectangle));
     }
     else
     {
         MapFrame mf = (MapFrame)MapFrame;
         MapFrame.Draw(new PaintEventArgs(g, mf.ClipRectangle));
         _geoSlaveMapFrame.Draw(new PaintEventArgs(g, _geoSlaveMapFrame.ClipRectangle));
     }
 }
Esempio n. 25
0
        public Bitmap Draw()
        {
            Bitmap   b = new Bitmap(Size.Width, Size.Height);
            Graphics g = Graphics.FromImage(b);

            Rectangle r = new Rectangle(0, 0, Size.Width, Size.Height);

            MapFrame.View = r;

            MapFrame.Print(g, r);

            return(b);
        }
Esempio n. 26
0
        protected override void afterInsertUpdateAction()
        {
            MapFrame mapframe = new MapFrame();

            mapframe.MyPK = this.MyPK;
            mapframe.RetrieveFromDBSources();
            mapframe.Update();

            //调用frmEditAction, 完成其他的操作.
            BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData);

            base.afterInsertUpdateAction();
        }
Esempio n. 27
0
 private void Options_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
 {
     if (args.IsSettingsInvoked)
     {
         MapFrame.Navigate(typeof(Settings));
     }
     else
     {
         // find NavigationViewItem with Content that equals InvokedItem
         var item = sender.MenuItems.OfType <NavigationViewItem>().First(x => (string)x.Content == (string)args.InvokedItem);
         NavView_Navigate(item as NavigationViewItem);
     }
 }
Esempio n. 28
0
        public override void Draw(int int_0, Rectangle rectangle_0, double double_0, double double_1)
        {
            tagRECT tagRECT = default(tagRECT);

            tagRECT.left   = rectangle_0.Left;
            tagRECT.right  = rectangle_0.Right;
            tagRECT.top    = rectangle_0.Top;
            tagRECT.bottom = rectangle_0.Bottom;
            IMapFrame mapFrame = new MapFrame() as IMapFrame;
            IMap      map      = new Map();

            mapFrame.Map = map;
            (this.m_pStyle as IMapGrid).PrepareForOutput(int_0, 96, ref tagRECT, mapFrame);
        }
Esempio n. 29
0
        async public static void MapFrameSnippets()
        {
            #region MapFrame_SetName
            await QueuedTask.Run(() =>
            {
                LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout Name"));
                Layout lyt  = layoutItem.GetLayout();
                MapFrame mf = lyt.FindElement("Map1 Map Frame") as MapFrame;

                lyt.SetName("New Name");
            });

            #endregion MapFrame_SetName
        }
Esempio n. 30
0
        public static async Task addLegendToLayout(Layout layout)
        {
            await QueuedTask.Run(() =>
            {
                //Build 2D envelope geometry
                Coordinate2D leg_ll = new Coordinate2D(1, 1);
                Coordinate2D leg_ur = new Coordinate2D(7.5, 3);
                Envelope leg_env    = EnvelopeBuilder.CreateEnvelope(leg_ll, leg_ur);

                //Reference MF, create legend and add to layout
                MapFrame mf      = layout.FindElement("My New Map Frame") as MapFrame;
                Legend legendElm = LayoutElementFactory.Instance.CreateLegend(layout, leg_env, mf);
                legendElm.SetName("New Legend");
            });
        }
Esempio n. 31
0
        public void GetAllGroupsTest()
        {
            var map = new MapFrame();
            var group = new MapGroup();
            map.Layers.Add(group);
            group.Layers.Add(new MapPolygonLayer());
            group.Layers.Add(new MapLineLayer());
            group.Layers.Add(new MapPointLayer());

            //add a nested group
            var group2 = new MapGroup();
            group.Layers.Add(group2);
            group2.Layers.Add(new MapPointLayer());
            group2.Layers.Add(new MapLineLayer());
            group2.Layers.Add(new MapPolygonLayer());

            List<IMapGroup> groupList = map.GetAllGroups();
            Assert.AreEqual(groupList.Count, 2);
        }
Esempio n. 32
0
    protected void generateFrame(int frameIndex, String directory)
    {
        //MapFunctionality mapFunctionality = (MapFunctionality)Map1.GetFunctionality(0);
        //mapDescription = mapFunctionality.MapDescription;

        ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDescription = getMapDescription();
        ESRI.ArcGIS.ADF.ArcGISServer.ImageDescription imageDescription = getImageDescription();
        ESRI.ArcGIS.ADF.ArcGISServer.Envelope exportedExtent = null;
        //Set the current map extent

        mapDescription.MapArea.Extent = (exportedExtent != null)
        ? exportedExtent :
        ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfEnvelope(Map1.Extent);
        //MapResourceBase mapResource = (MapResourceBase)mapFunctionality.Resource;
        //ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy mapServerProxy = mapResource.MapServerProxy;
        ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy mapServerProxy = getMapServerProxy();
        MapFrame frame = new MapFrame(mapDescription, mapServerProxy, imageDescription);
        //frame.exportImage();
        ESRI.ArcGIS.ADF.ArcGISServer.MapImage mapImage = frame.exportImage();

        frame.saveImage(mapImage, directory, frameIndex);
    }
Esempio n. 33
0
        private void Configure()
        {
            MapFrame = new MapFrame(this, new Envelope(-180, 180, -90, 90));

            _resizing = false;

            _mapFunctions = new Dictionary<string, IMapFunction>
                                  {
                                      {"Pan", new PanFunction(this)},
                                      {"Zoom", new ZoomFunction(this)}
                                  };
            SelectFunction s = new SelectFunction(this);
            _mapFunctions.Add("Select", s);
            _mapFunctions.Add("ClickZoom", new ClickZoomFunction(this));
            _mapFunctions.Add("ZoomOut", new ZoomOutFunction(this));
            _mapFunctions.Add("LabelSelect", new LabelSelectFunction(this));
            _mapFunctions.Add("Info", new IdentifyFunction(this));
            _mapFunctions.Add("Measure", new MeasureFunction(this));
            _collisionDetection = false;

            //changed by Jiri Kadlec - default function mode is none
            FunctionMode = FunctionModes.None;
           
            

        }