Esempio n. 1
0
        /// <summary>
        /// method to do the real server side process for info tool.
        /// </summary>
        public override void Process()
        {
            //get pixel tolerance from url of client side.
            int pixelTolerance = System.Convert.ToInt32(HttpContext.Current.Request[PixelToleranceKey]);

            MapControlModel model = MapControlModel.GetModelFromSession();

            model.SetMapSize(MapAlias, MapWidth, MapHeight);

            //extract points from url of client side.
            System.Drawing.Point[] points = ExtractPoints(DataString);

            //do searching and get results back
            MultiResultSetFeatureCollection mrfc = RetrieveInfo(points, pixelTolerance);

            IEnumerator resultEnum = mrfc.GetEnumerator();

            //retrieve the selected feature from collection
            while (resultEnum.MoveNext())
            {
                IResultSetFeatureCollection irfc    = (IResultSetFeatureCollection)resultEnum.Current;
                IFeatureEnumerator          ftrEnum = irfc.GetFeatureEnumerator();

                while (ftrEnum.MoveNext())
                {
                    Feature ftr = (Feature)ftrEnum.Current;
                    //create a html table to display feature info and stream back to client side.
                    CreateInfoTable(ftr);
                    irfc.Close();
                    mrfc.Clear();
                    break;
                }
                break;
            }
        }
Esempio n. 2
0
        private void ReNewData()
        {
            FeatureLayer lyrTemp = (FeatureLayer)mapControl1.Map.Layers["JKINFO"];

            if (lyrTemp != null)
            {
                IFeatureEnumerator fen = (lyrTemp.Table as IFeatureCollection).GetFeatureEnumerator();
                while (fen.MoveNext())
                {
                    Feature ftemp = fen.Current;
                    try
                    {
                        Int32 iNDH = -1;
                        if (ftemp["NDH"] == null)
                        {
                            continue;
                        }
                        try
                        {
                            iNDH = Convert.ToInt32(ftemp["NDH"]);
                            foreach (DataRow dr in dtAllRow.Rows)
                            {
                                try
                                {
                                    if (iNDH == Convert.ToInt32(dr["NDH"]))
                                    {
                                        ftemp["SJ"] = dr["SJ"];
                                        ftemp["DW"] = dr["DW"];
                                        ftemp.Table.UpdateFeature(ftemp);
                                        break;
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        catch
                        {
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("更新中发生错误:" + ex.Message);
                    }
                }
            }
        }