예제 #1
0
파일: Form1.cs 프로젝트: cwtok123/ArcEngine
        void qryTool_LabelEvent(string cityName, IFeature pFeatCity)
        {
            ZoomtoProvince(cityName);

            label1.Text = pFeatCity.get_Value(8).ToString();
            label2.Text = "面积有:" + pFeatCity.get_Value(2).ToString();

            //标注天气
            TomorrowWeatherInfo wInfo = new TomorrowWeatherInfo(cityName);

            Labels lbs = new Labels();
            IPoint pt = Utilities.GetFeatureCenterPoint(pFeatCity);// 标签的位置
            string lblString = cityName + "\r" + wInfo.Weather + "\r" + wInfo.Temperature + "\r" + wInfo.Wind;
            lbs.LabelQueryInfo(cityName, lblString, pt, axMapControl1.Map, _isRemoveLabels);

            ShowWeatherInfo(wInfo);
        }
예제 #2
0
파일: Form1.cs 프로젝트: cwtok123/ArcEngine
        private void button1_Click(object sender, EventArgs e)
        {
            IFeature pFeatCity = ZoomtoProvince(textBox1.Text.Trim());
            string city = textBox1.Text.Trim();
            if (pFeatCity == null)
            {
                return;
            }

            label1.Text = pFeatCity.get_Value(8).ToString();
            label2.Text = "面积有:" + pFeatCity.get_Value(2).ToString();

            //在下面增加弹出标签的测试代码,或者说是调用代码
            //思考一下,如果要创建一个标签,我们需要提供什么函数呢?...
            //标注
            TomorrowWeatherInfo wInfo = new TomorrowWeatherInfo(city);
            ShowWeatherInfo(wInfo);

            Labels lbs = new Labels();
            IPoint pt = Utilities.GetFeatureCenterPoint(pFeatCity);// 标签的位置
            string lblString = city + "\r" + wInfo.Weather + "\r" + wInfo.Temperature + "\r" + wInfo.Wind;

            Labels myLbl = new Labels();
            ILabelsStyle myLblStyle = lbs as ILabelsStyle;
            myLblStyle.FontSize = 22;
            myLblStyle.style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
            myLblStyle.fColor = 1;
            myLblStyle.tColor = 255;

            lbs.LabelQueryInfo(city, lblString, pt, axMapControl1.Map, _isRemoveLabels);
        }
예제 #3
0
파일: Form1.cs 프로젝트: cwtok123/ArcEngine
        private void InitialWeather()
        {
            string fileName = Application.StartupPath + "\\" + _initialCityFile;
            if (!System.IO.File.Exists(fileName)) return;

            System.IO.StreamReader sr = System.IO.File.OpenText(fileName);
            string city = sr.ReadLine();
            sr.Close();

            if (city == null) return;
            TomorrowWeatherInfo info = new TomorrowWeatherInfo(city);
            if (info.Result != TomorrowWeatherInfo.ResultInfo.Success)
            {
                ShowError(info.Result.ToString(), city);
                return;
            }

            ShowWeatherInfo(info);

            IFeature pFeat = ZoomtoProvince(city);

            Labels lbs = new Labels();
            IPoint pt = Utilities.GetFeatureCenterPoint(pFeat);
            string lblString = city + "\r" + info.Weather + "\r" + info.Temperature + "\r" + info.Wind;
            lbs.LabelQueryInfo(city, lblString, pt, axMapControl1.Map, _isRemoveLabels);

            TomorrowWeatherInfo wInfo = new TomorrowWeatherInfo(city);
            ShowWeatherInfo(wInfo);
        }