Exemple #1
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (null == m_weatherLayer)
            {
                return;
            }

            object owner;
            object obj;

            IPoint        hitPoint;
            IGlobeDisplay globedisplay = ((IGlobe)m_scene).GlobeDisplay;

            ISceneViewer sceneViewer = globedisplay.ActiveViewer;

            globedisplay.Locate(sceneViewer, X, Y, false, false, out hitPoint, out owner, out obj);

            if (obj != null)
            {
                if (!(obj is IPropertySet))
                {
                    return;
                }

                IPropertySet propset = obj as IPropertySet;

                if (!(owner is RSSWeatherLayer3DClass))
                {
                    return;
                }

                if (propset == null)
                {
                    return;
                }

                //get the zip code
                object o       = propset.GetProperty("ZIPCODE");
                long   zipcode = Convert.ToInt64(o);
                m_weatherLayer.Select(zipcode, Shift != 1);
            }
            else
            {
                m_weatherLayer.Select(-1L, true);
            }
        }
        private void menuSelect_Click(System.Object sender, System.EventArgs e)
        {
            if (null == m_propset)
            {
                return;
            }

            long zipCode = Convert.ToInt64(m_propset.GetProperty("ZIPCODE"));

            m_weatherLayer.Select(zipCode, true);
        }
        /// <summary>
        /// select a weather items given selected items from the listbox
        /// </summary>
        private void SelectWeatherItems()
        {
            //get the selected list from the listbox
            bool newSelection = this.chkNewSelection.Checked;

            //in case of a new selection, unselect all items first
            if (newSelection)
            {
                m_weatherLayer.UnselectAll();
            }

            IPropertySet propSet = null;
            object       o;
            long         zipCode;

            //iterate through the selected items of the listbox
            foreach (int index in lstWeatherItemNames.SelectedIndices)
            {
                //get the weatheritem properties according to the zipCode of the item in the listbox
                propSet = m_weatherLayer.GetWeatherItem(Convert.ToString(lstWeatherItemNames.Items[index]));
                if (null == propSet)
                {
                    continue;
                }

                o = propSet.GetProperty("ZIPCODE");
                if (null == o)
                {
                    continue;
                }

                zipCode = Convert.ToInt64(o);

                //select the item in the weather layer
                m_weatherLayer.Select(zipCode, false);
            }
        }