예제 #1
0
        private async void UpdateHighlightedGraphics()
        {
            foreach (var proGraphic in ProGraphicsList)
            {
                var aiPoint = CoordinateAddInPoints.FirstOrDefault(p => p.GUID == proGraphic.GUID);

                if (aiPoint != null)
                {
                    var s = proGraphic.SymbolRef.Symbol as CIMPointSymbol;

                    if (s == null)
                    {
                        continue;
                    }

                    if (aiPoint.IsSelected)
                    {
                        s.HaloSize = 2;
                    }
                    else
                    {
                        s.HaloSize = 0;
                    }

                    var result = await QueuedTask.Run(() =>
                    {
                        var temp = MapView.Active.UpdateOverlay(proGraphic.Disposable, proGraphic.Geometry, proGraphic.SymbolRef);
                        return(temp);
                    });
                }
            }
        }
        private void UpdateHighlightedGraphics()
        {
            var mxdoc = ArcMap.Application.Document as IMxDocument;
            var av    = mxdoc.FocusMap as IActiveView;
            var gc    = av as IGraphicsContainer;

            gc.Reset();
            var element = gc.Next();

            while (element != null)
            {
                var eProp = element as IElementProperties;

                if (eProp != null)
                {
                    var aiPoint = CoordinateAddInPoints.FirstOrDefault(p => p.GUID == eProp.Name);

                    if (aiPoint != null)
                    {
                        // highlight
                        var markerElement = element as IMarkerElement;
                        if (markerElement != null)
                        {
                            var sms = markerElement.Symbol as ISimpleMarkerSymbol;
                            if (sms != null)
                            {
                                var simpleMarkerSymbol = new SimpleMarkerSymbol() as ISimpleMarkerSymbol;

                                simpleMarkerSymbol.Color       = sms.Color;
                                simpleMarkerSymbol.Size        = sms.Size;
                                simpleMarkerSymbol.Style       = sms.Style;
                                simpleMarkerSymbol.OutlineSize = 1;

                                if (aiPoint.IsSelected)
                                {
                                    var color = new RgbColorClass()
                                    {
                                        Green = 255
                                    } as IColor;
                                    // Marker symbols
                                    simpleMarkerSymbol.Outline      = true;
                                    simpleMarkerSymbol.OutlineColor = color;
                                }
                                else
                                {
                                    simpleMarkerSymbol.Outline = false;
                                    //simpleMarkerSymbol.OutlineColor = sms.Color;
                                }

                                markerElement.Symbol = simpleMarkerSymbol;

                                gc.UpdateElement(element);
                            }
                        }
                    }
                }


                element = gc.Next();
            }

            av.Refresh();
        }
        private void UpdateHighlightedGraphics()
        {
            if ((ArcMap.Document == null) && (ArcMap.Document.FocusMap == null))
            {
                return;
            }

            var av = (IActiveView)ArcMap.Document.FocusMap;
            var gc = (IGraphicsContainer)av;

            gc.Reset();
            var element = gc.Next();

            while (element != null)
            {
                var eProp = (IElementProperties)element;

                if (eProp != null)
                {
                    var aiPoint  = CoordinateAddInPoints.FirstOrDefault(p => p.GUID == eProp.Name);
                    var doUpdate = false;
                    if (aiPoint != null)
                    {
                        // highlight
                        var markerElement = element as IMarkerElement;
                        if (markerElement != null)
                        {
                            var sms = markerElement.Symbol as ISimpleMarkerSymbol;
                            if (sms != null)
                            {
                                var simpleMarkerSymbol = (ISimpleMarkerSymbol) new SimpleMarkerSymbol();

                                simpleMarkerSymbol.Color       = sms.Color;
                                simpleMarkerSymbol.Size        = ArcMapHelpers.DefaultMarkerSize;
                                simpleMarkerSymbol.Style       = sms.Style;
                                simpleMarkerSymbol.OutlineSize = 1.7;

                                if (aiPoint.IsSelected)
                                {
                                    var color = (IColor) new RgbColorClass()
                                    {
                                        Green = 255
                                    };
                                    // Marker symbols
                                    simpleMarkerSymbol.Size         = ArcMapHelpers.DefaultMarkerSize + ArcMapHelpers.DefaultOutlineSize;
                                    simpleMarkerSymbol.Outline      = true;
                                    simpleMarkerSymbol.OutlineColor = color;
                                    doUpdate = true;
                                }
                                else if (markerElement.Symbol.Size > 0)
                                {
                                    simpleMarkerSymbol.Outline = false;
                                    doUpdate = true;
                                    //simpleMarkerSymbol.OutlineColor = sms.Color;
                                }

                                if (doUpdate)
                                {
                                    markerElement.Symbol = simpleMarkerSymbol;
                                    gc.UpdateElement(element);
                                }
                            }
                        }
                    }
                }


                element = gc.Next();
            }

            av.Refresh();
        }