Как определить что Element - выбран?

ArcGIS 8.x,9.x,10.x (Arcview, ArcEditor, Arcinfo).
Ответить
Tereha
Завсегдатай
Сообщения: 423
Зарегистрирован: 15 май 2010, 06:13
Репутация: 7

Как определить что Element - выбран?

Сообщение Tereha »

Уважаемые gurus!
(argis engine 2010 .Net)
На Map имеется несколько графических элементов (circleElement), один из них выбран. Как определить - какой?
В справке пока не нашел, думал есть свойство типа isSelected...
Использую для теста такой тест

Код: Выделить всё

        public void CountGraphicElements(IMap map)
        {
            //The page layout is a graphics container, so it can be enumerated.
            IGraphicsContainer graphicsContainer = map as IGraphicsContainer;

            //Reset the container to start from the beginning.
            graphicsContainer.Reset();
            Int32 int32_Counter = 0;
            IElement element = graphicsContainer.Next();

            //Loop through the container until the end, denoted by a null value.
            while (element != null)
            {
                //Test the element to see if it's a certain type. This can be ITextElement, IPolygonElement, etc.
                if (element is ICircleElement)
                {
                    //If a match is found, increment the counter.
                    if (element.SelectionTracker.ShowHandles == true)
                    {
                        element.SelectionTracker.Deactivate();
                        string s = element.SelectionTracker.ShowHandles.ToString();
                        string s1 = element.SelectionTracker.Locked.ToString();
                        int32_Counter = int32_Counter + 1;
                        MessageBox.Show("Нашли X = " + element.Geometry.Envelope.XMin.ToString()+
                            " s = "+s+ " locked = "+ s1);
                    }
                }

                //Step to the next element in the container.
                element = graphicsContainer.Next();
            }

            //Display the results of the count.
            MessageBox.Show("The pagelayout contains " + int32_Counter +
                " CircleElement(s)");
Спасибо in advance!
Tereha
Завсегдатай
Сообщения: 423
Зарегистрирован: 15 май 2010, 06:13
Репутация: 7

Re: Как определить что Element - выбран?

Сообщение Tereha »

Нашел решение:

Код: Выделить всё

((IGraphicsContainerSelect)map).ElementSelected(element) == true
Спасибо!
Ответить

Вернуться в «ArcGIS»

Кто сейчас на конференции

Сейчас этот форум просматривают: Ahrefs [Bot] и 6 гостей