Esempio n. 1
0
        public override bool SetSelection(ISpatialSelection newSel)
        {
            ISpatialSelection ss = (newSel == null ? new Selection() : newSel);
            bool isChanged       = base.SetSelection(ss);

            if (!isChanged)
            {
                return(false);
            }

            ISpatialObject item = ss.Item;

            if (m_Main != null)
            {
                m_Main.SetSelection(item);
            }

            // If a single item has been selected
            if (item != null)
            {
                if (item is DividerObject)
                {
                    item = (item as DividerObject).Divider.Line;
                }

                if (item is PointFeature)
                {
                    if (ArePointsDrawn)
                    {
                        PointFeature selPoint = (item as PointFeature);

                        if (m_Inverse != null)
                        {
                            m_Inverse.OnSelectPoint(selPoint);
                        }

                        if (m_Command != null)
                        {
                            m_Command.OnSelectPoint(selPoint);
                        }
                    }
                }
                else if (item is LineFeature)
                {
                    if (m_Command != null)
                    {
                        LineFeature selLine = (item as LineFeature);
                        m_Command.OnSelectLine(selLine);
                    }
                }

                // 20100709 -- Not sure about this. If the user wants to point at the
                // same point twice in succession, the fact that the point is still
                // selected means the 2nd pointing won't get passed down (we tested
                // for a change above).

                if (m_Command != null)
                {
                    // 20101005 -- Allow highlighting of polygons, since their selection
                    // should not interfere with command dialogs (and in things like the
                    // update UI, it can be useful to confirm that topology is ok).

                    if (!(item is Polygon))
                    {
                        ClearSelection();
                    }
                }
            }

            m_HasSelectionChanged = true;
            return(true);
        }