Beispiel #1
0
 private void buttonItemClear_Click(object sender, EventArgs e)
 {
     //清空选择集和跟踪层
     this.axSuperMap1.TrackingLayer.ClearEvents();
     this.axSuperMap1.selection.RemoveAll();
     this.axSuperMap1.Refresh();
     this.searchBoundGeometry = null;
 }
Beispiel #2
0
        /// <summary>
        /// 查询统计范围
        /// </summary>
        private void searchBound()
        {
            String key = this.comboBoxQueryKey.Text.Trim();
            Double radius = this.doubleInputRadius.Value;
            if (key.Length == 0 || key == tipDistrictKey)
            {
                MessageBox.Show("请输入搜索关键字!", msgCaption);
                return;
            }

            this.listBoxPoiResult.Items.Clear();
            this.axSuperMap1.TrackingLayer.ClearEvents();

            if (!poiSearch.IsOpen)
            {
                MessageBox.Show("找不到POI索引!", msgCaption);
                return;
            }

            // poi查询
            PoiResult poiResult = poiSearch.search(key);

            if (poiResult == null || poiResult.Count == 0)
            {
                MessageBox.Show("找不到数据!", msgCaption);
            }

            soStyle style = new soStyle();
            style.PenColor = Util.ColorToUInt32(Color.Blue);
            style.SymbolSize = 30;

            //获取第一个查询结果
            PoiInfo poiInfo = poiResult.getPoiInfoAt(0);

            //坐标转换(wgs84 -> 地图坐标)
            coordSysTranslator.convert(ref poiInfo);

            // 加入跟踪层高亮显示
            soGeoPoint geoPoint = new soGeoPoint();
            geoPoint.x = poiInfo.x;
            geoPoint.y = poiInfo.y;
            this.axSuperMap1.TrackingLayer.AddEvent((soGeometry)geoPoint, style, poiInfo.name);

            //计算扩大一圈的面
            searchBoundGeometry = geoPoint.SpatialOperator.Buffer(radius, 25);

            ////将查询结果加入到选择集中,使其高亮显示
            //objSelection = this.axSuperMap1.selection;
            //objSelection.FromRecordset(objRd);

            this.axSuperMap1.TrackingLayer.RemoveEvent("SearchBound");
            style = new soStyle();
            style.PenColor = Util.ColorToUInt32(Color.Blue);
            style.BrushStyle = 1;
            this.axSuperMap1.TrackingLayer.AddEvent((soGeometry)searchBoundGeometry, style, "SearchBound");

            //刷新地图窗口
            viewBounds(searchBoundGeometry.Bounds);

            if (!this.comboBoxQueryKey.Items.Contains(key))
            {
                this.comboBoxQueryKey.Items.Add(key);
            }
        }
Beispiel #3
0
        private void axSuperMap1_Tracked(object sender, EventArgs e)
        {
            //if (e.dTotalArea > 0) this.staregionvalue.Text = e.dTotalArea.ToString();
            //if (e.dCurrentLength > 0) this.stadisvalue.Text = e.dCurrentLength.ToString();
            //if (e.dTotalLength > 0) this.statotledisvalue.Text = e.dTotalLength.ToString();
            if (this.axSuperMap1.Action == SuperMapLib.seAction.scaTrackRectangle ||
                this.axSuperMap1.Action == SuperMapLib.seAction.scaTrackCircle)
            {
                //显示绘制的统计范围
                if (this.axSuperMap1.TrackedGeometry.Type == seGeometryType.scgRect)
                {
                    this.searchBoundGeometry = ((soGeoRect)this.axSuperMap1.TrackedGeometry).ConvertToRegion();
                }
                else if (this.axSuperMap1.TrackedGeometry.Type == seGeometryType.scgCircle)
                {
                    this.searchBoundGeometry = ((soGeoCircle)this.axSuperMap1.TrackedGeometry).ConvertToRegion(72);
                }

                this.axSuperMap1.TrackingLayer.RemoveEvent("SearchBound");
                soStyle style = new soStyle();
                style.PenColor = Util.ColorToUInt32(Color.Blue);
                style.BrushStyle = 1;
                this.axSuperMap1.TrackingLayer.AddEvent((soGeometry)searchBoundGeometry, style, "SearchBound");
            }
        }