Example #1
0
File: Form1.cs Project: w2bst2r/GIS
        private void Form1_Load(object sender, EventArgs e)
        {
            mi = Activator.CreateInstance(Type.GetTypeFromProgID("Mapinfo.Application")) as MapInfoApplication;

            panel1.Parent = tabPage1;
            panel2.Parent = tabPage1;
            panel3.Parent = tabPage2;
            panel4.Parent = tabPage2;
            panel5.Parent = tabPage2;
            panel6.Parent = tabPage2;

            // getting the border of each panel
            panel1_border = panel1.Handle.ToString();
            panel2_border = panel2.Handle.ToString();
            panel3_border = panel3.Handle.ToString();
            panel4_border = panel4.Handle.ToString();
            panel5_border = panel5.Handle.ToString();
            panel6_border = panel6.Handle.ToString();

            createWorkspace(panel1_border, ref windows1_id);
            createWorkspace(panel3_border, ref windows3_id);
            createWorkspace(panel4_border, ref windows4_id);

            // ----------part than handles the form---------------------------//
            int p = panel1.Handle.ToInt32();

            mi.Do("dim p as object");
            mi.Do("set map CoordSys Earth Projection 1, 28");
            mi.SetCallback(callb);

            // callback'taki info cagiriyor.   create info butotn in the background
            mi.Do("create buttonpad \"a\" as toolbutton calling OLE \"info\" id 2001");
        }
Example #2
0
        public MapInfo.MapInfoApplication connectMapInfo(string path, string panel)
        {
            if (mi == null)
            {
                mi = new MapInfoApplication();
                int p = Convert.ToInt32(panel);
                mi.Do("set next document parent " + p.ToString() + " style 1");
                mi.Do("set application window " + p.ToString());
                mi.Do("run application \"" + AppDomain.CurrentDomain.BaseDirectory + "/WinRESPRO_v1.wor" + "\"");
            }

            return(mi);
        }
Example #3
0
        public int miDo(string mido, string panel)
        {
            MapInfoApplication mi = connectMapInfo("", panel);

            mi.Do(mido);
            if (mi == null)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
Example #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            sidePanel.Height = turkey.Height;
            turkey.BackColor = selected;
            sidePanel.Top    = turkey.Top;

            searchPanel.Visible = true;

            fullSize.BackgroundImage = CBSProjeTasarimTest.Properties.Resources.switch_to_full_screen_button__1_;

            //to load all Depended tables
            try
            {
                mi = new MapInfo.MapInfoApplication();
                int p = map.Handle.ToInt32();
                mi.Do("set next document parent " + p.ToString() + "style 1");
                mi.Do("set application window " + p.ToString());
                mi.Do("run application \"" + path + "\\Resources\\Databases\\haritalar2.WOR" + "\"");

                mi.Do("Set Map  Zoom Entire Layer " + (layerSayisi - 1));
                mi.Do("Set Map  Layer " + (layerSayisi) + " Editable On");
                mi.Do("Set Map  Layer " + (layerSayisi) + " Editable On");


                mi.SetCallback(callb);

                mi.Do("create buttonpad \"a\" as toolbutton calling OLE \"info\" id 2001");


                tableProsses();
                //Display all Hashtags
                getAllHashtags();
            }
            catch (Exception)
            {
                string message = "There İs Some Problem  With MapInfo Turkey Table\n Are You Sure to Close App?";
                string caption = "Application Shut Down";
                var    result  = MessageBox.Show(message, caption,
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    CloseMapInfo();
                    Form.ActiveForm.Close();
                }
                else
                {
                    Form1_Load(sender, e);
                }
            }
        }
Example #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            foreach (System.Diagnostics.Process p in
                     System.Diagnostics.Process.GetProcesses())
            {
                if (p.ProcessName == "MapInfow" & p.MainWindowTitle == "")
                {
                    p.Kill();
                }
            }
            mi = new MapInfoApplication();
            int h = panel1.Handle.ToInt32();

            mi.Do("Set Next Document Parent " + h.ToString() + " Style 1");
            mi.Do("set application window " + h.ToString());
            string ws_path = Application.StartupPath + "\\" + "default5.wor";

            mi.Do("Run Application \"" + ws_path + "\"");
            gMainWinId = mi.Eval("windowid(0)");
            mi.Do("create buttonpad \"a\" as toolbutton calling OLE \"info\" id 2001");
            mi.Do("create buttonpad \"b\" as toolbutton calling OLE \"cizgiciz\" drawmode 33 id 2003");
            mi.Do("create buttonpad \"c\" as toolbutton calling OLE \"noktaAt\" id 2004");
            mi.Do("create buttonpad \"d\" as toolbutton calling OLE \"kapaliAlan\" drawmode 35 id 2005");

            comboboxIller.Items.Clear();
            mi.Do("select*from iller into sel noselect");
            mi.Do("fetch first from sel");
            for (int i = 0; i < Convert.ToInt16(mi.Eval("tableinfo(sel,8)")); i++)
            {
                comboboxIller.Items.Add(mi.Eval("sel.il_adi"));
                mi.Do("fetch next from sel");
            }


            mi.SetCallback(callb);
        }
Example #6
0
        public static MapInfoApplication mi;//dinamik olarak bir mi objesi tanımlıyoruz

        //mi objesini kullanarak artık tüm MapInfo uygulamalarını kullanabiliriz.
        private void Form1_Load(object sender, EventArgs e)
        {
            mi = new MapInfoApplication();   //daha önce yaratılan mi objesine burada yön //verip onun bir MapInfoApplication ı olduğunu ifade eder
            int h = panel1.Handle.ToInt32(); //

            //her panelin bir handle numarası var ve bu no Int32 formuna çevrildi
            mi.Do("Set Next Document Parent " + h.ToString() + " Style 1");
            mi.Do("set application window " + h.ToString());
            string ws_path = Application.StartupPath + "\\" + "LESSON1.wor"; //MapInfo'dan projeye olustuşturduğumuz workspace

            mi.Do("Run Application \"" + ws_path + "\"");                    //uygulamanın akitive //olmasını sağlar }
            mi.Do("select il_adi from iller where il_adi<>\"\" order by il_adi into seliller noselect");
            int count = int.Parse(mi.Eval("tableinfo(seliller,8)"));

            mi.Do("fetch first from seliller");
            for (int i = 0; i < count; i++)
            {
                comboBox1.Items.Add(mi.Eval("seliller.col1"));
                mi.Do("fetch next from seliller");
            }
        }
Example #7
0
 //mi objesini kullanarak artık tüm MapInfo uygulamalarını kullanabiliriz.
 private void Form1_Load(object sender, EventArgs e)
 {
     mi = new MapInfoApplication();//daha önce yaratılan mi objesine burada yön //verip onun bir MapInfoApplication ı olduğunu ifade eder
     int h = panel1.Handle.ToInt32();//
     //her panelin bir handle numarası var ve bu no Int32 formuna çevrildi
     mi.Do("Set Next Document Parent " + h.ToString() + " Style 1");
     mi.Do("set application window " + h.ToString());
     string ws_path = Application.StartupPath + "\\" + "LESSON1.wor";//MapInfo'dan projeye olustuşturduğumuz workspace
     mi.Do("Run Application \"" + ws_path + "\"");//uygulamanın akitive //olmasını sağlar }
     mi.Do("select il_adi from iller where il_adi<>\"\" order by il_adi into seliller noselect");
     int count = int.Parse(mi.Eval("tableinfo(seliller,8)"));
     mi.Do("fetch first from seliller");
     for (int i = 0; i < count; i++)
     {
         comboBox1.Items.Add(mi.Eval("seliller.col1"));
         mi.Do("fetch next from seliller");
     }
 }
Example #8
0
File: Form1.cs Project: w2bst2r/GIS
 // this block is used to set in which panel the workspace will work
 // take the id of the window where the workspace is running.
 // We need windows_id after to create a legend and a thematic in that window.
 public void createWorkspace(string tab_panel_border, ref string windows_id)
 {
     try
     {
         mi.Do(
             "set next document parent " + tab_panel_border
             + "style 1");      // set the document to be the child window of the panel
         mi.Do("set application window " + tab_panel_border);
         // AppDomain.CurrentDomain.BaseDirectory is ./bin/debug
         mi.Do("run application \"" + AppDomain.CurrentDomain.BaseDirectory + "/workspace1.WOR" + "\"");
         windows_id = mi.Eval("frontwindow()");
         mi.Do("Set Map Window FrontWindow() Zoom Entire Layer 1");     // zoom on the entire layer
     }
     catch (Exception e)
     {
         MessageBox.Show("Başka bir MAPINFO uygulaması açık.");
         Close();
     }
 }
Example #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     mi.Do("run menu command 1705");
 }
Example #10
0
 private void btnZoomIn_Click(object sender, EventArgs e)
 {
     mi.Do("run menu command 1705");
 }