コード例 #1
0
ファイル: FormMain.Map.cs プロジェクト: yfyf510/GPS
        //查询所在区域
        private String FindMapInRegion(double x, double y, String tableName, String colName)
        {
            String ret = "";

            try
            {
                MapInfo.Data.MIConnection connection = new MapInfo.Data.MIConnection();
                connection.Open();
                MapInfo.Data.MICommand command = connection.CreateCommand();
                command.CommandText = "Select * from " + tableName + " where MI_Point(@x, @y, @cs) within obj";
                command.Parameters.Add("@x", x);
                command.Parameters.Add("@y", y);
                command.Parameters.Add("@cs", this.mapControl.Map.GetDisplayCoordSys());
                command.Prepare();
                MapInfo.Data.IResultSetFeatureCollection irfc = command.ExecuteFeatureCollection();
                if (irfc.Count > 0)
                {
                    ret = irfc[0][colName].ToString();
                }
                command.Dispose();
                connection.Close();
            }
            catch { }
            return(ret);

            /*
             * Feature ftr1 = new Feature(tableTemp.TableInfo.Columns);
             * ftr1.Geometry = new MapInfo.Geometry.Point(mapControl.Map.GetDisplayCoordSys(), new DPoint(113.70, 23.04)) as FeatureGeometry;
             * MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWithinFeature(ftr1, ContainsType.Geometry);
             * si.QueryDefinition.Columns = null;
             * MapInfo.Data.IResultSetFeatureCollection irfc = MapInfo.Engine.Session.Current.Catalog.Search("chinagl_guide", si);
             * if(irfc.Count > 0)
             *  MessageBox.Show(irfc[0]["Name"].ToString());
             * else MessageBox.Show("null");*/
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: rupeshkumar399/seemapcell
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            UpdateNavigationButtons();
            this.components = new System.ComponentModel.Container();

            //
            // Create a command object to hold parameters and last command executed
            //
            this.miConnection = new MIConnection();
            miConnection.Open();
            this.miCommand = miConnection.CreateCommand();
        }
コード例 #3
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            UpdateNavigationButtons();
            this.components = new System.ComponentModel.Container();

            //
            // Create a command object to hold parameters and last command executed
            //
            this.miConnection = new MIConnection();
            miConnection.Open();
            this.miCommand = miConnection.CreateCommand();
        }