Пример #1
0
        private void axMap_OnViewRefreshed(object sender, IMapControlEvents2_OnViewRefreshedEvent e)
        {
            try
            {
                if (mFeatures != null)
                {
                    for (int i = 0; i < mStoryTips.Count && i < mFeatures.Count; i++)
                    {
                        MyTip storyTip = mStoryTips[i];
                        storyTip.Location = MapManager.getCurrentCoord(mFeatures[i], axMap, this, mStoryTips[i]);

                        if (isCanTipShow(storyTip))
                        {
                            storyTip.Show();
                        }
                        else
                        {
                            storyTip.Hide();
                        }
                    }
                }
            }
            catch
            {
            }
        }
Пример #2
0
        private void btnBufferAnalysis_Click(object sender, EventArgs e)
        {
            if (!isBuffering)
            {
                isBuffering = true;

                btnBufferAnalysis.Text = "停止寻找";
            }
            else
            {
                isBuffering = false;
                for (int i = 0; i < mStoryTips.Count; i++)
                {
                    MyTip tip = mStoryTips[i];
                    tip.Close();
                }
                mStoryTips.Clear();

                MapManager.deleteAllFeature("invisibleLayer", axMap);

                (axMap.Map as IGraphicsContainer).DeleteAllElements();
                axMap.ActiveView.Refresh();



                btnBufferAnalysis.Text = "附近人消息";
            }
        }
Пример #3
0
        private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
            if (axMap.MousePointer == esriControlsMousePointer.esriPointerPan)
            {
                axMap.Pan();
            }

            if (e.button == 4)
            {
                //     axMap.MousePointer = esriControlsMousePointer.esriPointerPan;
                axMap.Pan();
            }

            if (isBuffering && e.button == 1)
            {
                //选择要素
                selectFeatrue(e.x, e.y);

                if (mFeatures != null)
                {
                    mFeatures.Clear();
                }

                ////获取缓冲区的要素
                mFeatures = MapManager.createBuffer(axMap, bufferSize, "story", false);

                //删除以前生成的缓冲区要素
                for (int i = 0; i < mStoryTips.Count; i++)
                {
                    MyTip tip = mStoryTips[i];
                    tip.Close();
                }
                mStoryTips.Clear();

                List <String> ids = new List <string>();
                for (int i = 0; i < mFeatures.Count; i++)
                {
                    IFeature feature = mFeatures[i];
                    if (feature != null)
                    {
                        String id = (string)MapManager.getFieldByName(feature, "story_id");

                        MyTip storyTip = new MyTip(id);

                        storyTip.TopMost  = true;
                        storyTip.Location = MapManager.getCurrentCoord(feature, axMap, this, storyTip);

                        if (isCanTipShow(storyTip))
                        {
                            storyTip.Show();
                        }



                        mStoryTips.Add(storyTip);
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 判断提示是否可显示
        /// </summary>
        /// <param name="tip"></param>
        /// <returns></returns>
        private bool isCanTipShow(MyTip tip)
        {
            if (tip.Location.X < Location.X + axMap.Location.X - tip.Width)
            {
                return(false);
            }
            else if (tip.Location.X > Location.X + axMap.Location.X + axMap.Width)
            {
                return(false);
            }
            else if (tip.Location.Y < Location.Y + axMap.Location.Y - tip.Height)
            {
                return(false);
            }
            else if (tip.Location.Y > Location.Y + axMap.Location.Y + axMap.Height)
            {
                return(false);
            }


            return(true);
        }