Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string shpFileName = ArcTimUtilities.CreateNewTimShapefile(comboBox1.SelectedItem.ToString(), this.textBox1.Text.ToString());

            ArcTimUtilities.addNewShapefile(m_app, shpFileName);
            this.Hide();
        }
Exemple #2
0
 private void button_OK_Click(object sender, EventArgs e)
 {
     ModflowToTimML.TimBoundaryGenerator.Generate(textBox_TimBoundary.Text, textBox_gridFile.Text, textBox_output.Text);
     if (ArcTimData.StaticClass.infoTable.Rows[0]["ShapefilePath"] == null)
     {
         ArcTimData.StaticClass.infoTable.Rows[0]["ShapefilePath"] = System.IO.Path.GetDirectoryName(textBox_TimBoundary.Text);
     }
     ArcTimUtilities.addNewShapefile(m_application, textBox_output.Text);
     this.Hide();
 }
        public void loadCBox(IApplication m_app)
        {
            ILayer pLyr;
            IMap   map = ArcTimUtilities.GetMap(m_app);

            if (map != null)
            {
                int iLyrCount = map.LayerCount;
                for (int i = 0; i < iLyrCount; i++)
                {
                    pLyr = map.get_Layer(i);
                    if (pLyr is IFeatureLayer)
                    {
                        this.comboBox_esf.Items.Add(pLyr.Name);
                    }
                }
            }
        }
Exemple #4
0
        public ExistingShapefile2_well(string shapefileName, string featuretype, IApplication m_application)
        {
            InitializeComponent();

            m_app = m_application;
            IMap      map      = ArcTimUtilities.GetMap(m_application);
            ShapeFile shp      = new ShapeFile(ArcTimData.StaticClass.infoTable.Rows[0]["ShapefilePath"].ToString() + "\\" + shapefileName + ".shp");
            DataTable attTable = shp.AttributeTable;
            int       numCol   = attTable.Columns.Count;

            for (int i = 0; i < numCol; i++)
            {
                this.comboBox_Flow.Items.Add(attTable.Columns[i].ColumnName);
                this.comboBox_Radius.Items.Add(attTable.Columns[i].ColumnName);
                this.comboBox_Name.Items.Add(attTable.Columns[i].ColumnName);
            }
            shpFileName = shapefileName;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable newAttTable = new DataTable("NewAttTable");

            newAttTable.Columns.Add("TimFeatureName");
            newAttTable.Columns.Add("OldAttName");
            DataRow r;

            r    = newAttTable.NewRow();
            r[0] = "Head1";

            if (this.comboBox_Head.Text == null)
            {
                MessageBox.Show("Please select an attribute for Head", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.comboBox_Head.Text;
            }

            newAttTable.Rows.Add(r);
            r = newAttTable.NewRow();

            r[0] = "Name";

            if (this.comboBox_Name.Text == null)
            {
                MessageBox.Show("Please select an attribute for Name", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.comboBox_Name.Text;
            }
            newAttTable.Rows.Add(r);
            string newShapefileName = ArcTimUtilities.createTimShapefile(shpFileName, newAttTable, "hls");

            ArcTimUtilities.addNewShapefile(m_app, newShapefileName);
            this.Hide();
        }
Exemple #6
0
        public void populateOutputSettings()
        {
            DataSet outputDataSettings = new DataSet("outputSettings");

            if (File.Exists(ArcTimData.StaticClass.infoTable.Rows[0]["ModelName"].ToString() + "\\outputSettings.xml"))
            {
                outputDataSettings.ReadXml(ArcTimData.StaticClass.infoTable.Rows[0]["ModelName"].ToString() + "\\outputSettings.xml");
            }
            else
            {
                ArcTimUtilities.CreateDefaultOutputFile(m_application, m_hookHelper2);
            }

            DataTable outputData2 = outputDataSettings.Tables[0];

            textBox_xMin.Text   = outputData2.Rows[0][0].ToString();
            textBox_xMax.Text   = outputData2.Rows[0][1].ToString();
            textBox_xCells.Text = outputData2.Rows[0][2].ToString();
            textBox_yMin.Text   = outputData2.Rows[1][0].ToString();
            textBox_yMax.Text   = outputData2.Rows[1][1].ToString();
            textBox_yCells.Text = outputData2.Rows[1][2].ToString();
        }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable newAttTable = new DataTable("NewAttTable");

            newAttTable.Columns.Add("TimFeatureName");
            newAttTable.Columns.Add("OldAttName");
            DataRow r;

            r    = newAttTable.NewRow();
            r[0] = "Flow";

            if (this.comboBox_Flow.Text == null)
            {
                MessageBox.Show("Please select an attribute for Flow", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.comboBox_Flow.Text;
            }

            newAttTable.Rows.Add(r);
            r = newAttTable.NewRow();

            r[0] = "Radius";

            if (this.comboBox_Radius.Text == null)
            {
                MessageBox.Show("Please select an attribute for Radius", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.comboBox_Radius.Text;
            }
            newAttTable.Rows.Add(r);
            r = newAttTable.NewRow();

            r[0] = "Name";

            if (this.comboBox_Name.Text == null)
            {
                MessageBox.Show("Please select an attribute for Name", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.comboBox_Name.Text;
            }
            newAttTable.Rows.Add(r);
            r = newAttTable.NewRow();

            r[0] = "NumberOfLayers";

            if (this.textBox1.Text == null)
            {
                MessageBox.Show("Please enter the number of layers", "Error", MessageBoxButtons.RetryCancel);
            }
            else
            {
                r[1] = this.textBox1.Text;
            }
            newAttTable.Rows.Add(r);
            string newShapefileName = ArcTimUtilities.createTimShapefile(shpFileName, newAttTable, "well");

            ArcTimUtilities.addNewShapefile(m_app, newShapefileName);
            this.Hide();
        }
Exemple #8
0
        private void button_outputOK_Click(object sender, EventArgs e)
        {
            IMap        map        = ArcTimUtilities.GetMap(m_application);
            IActiveView ia         = m_hookHelper2.ActiveView;
            DataSet     oD         = new DataSet("OutputData");
            DataTable   outputData = new DataTable("Output");
            double      xmax       = 0;
            double      xmin       = 0;
            double      ymax       = 0;
            double      ymin       = 0;
            double      nx         = Convert.ToDouble(textBox_xCells.Text);
            double      ny         = Convert.ToDouble(textBox_yCells.Text);

            outputData.Columns.Add("MinExtents");
            outputData.Columns.Add("MaxExtents");
            outputData.Columns.Add("NumCells");
            double resx = 0;

            // getextentsData
            if (radioButton_currentExtents.Checked == true)
            {
                xmax = ia.Extent.XMax;
                xmin = ia.Extent.XMin;
                ymax = ia.Extent.YMax;
                ymin = ia.Extent.YMin;
            }
            else if (radioButton_defineExtents.Checked == true)
            {
                xmax = Convert.ToDouble(textBox_xMax.Text);
                xmin = Convert.ToDouble(textBox_xMin.Text);
                ymax = Convert.ToDouble(textBox_yMax.Text);
                ymin = Convert.ToDouble(textBox_yMin.Text);
            }
            //getResolutionData
            if (radioButton_res.Checked == true)
            {
                if (radioButton_low.Checked == true)
                {
                    resx = 0.01;
                }
                if (radioButton_med.Checked == true)
                {
                    resx = 0.008;
                }
                if (radioButton_high.Checked == true)
                {
                    resx = 0.004;
                }
                double xtemp = 0;
                double ytemp = 0;
                double delx  = 0;
                double dely  = 0;


                delx = xmax - xmin;
                //dely = ymax - ymin;

                xtemp = delx * resx;
                //ytemp = dely * resx;

                //ny = Convert.ToInt64(dely / ytemp);
                nx = Convert.ToInt64(delx / xtemp);

                //if (dely % ytemp != 0)
                //{
                //    ny = Convert.ToInt64(dely / ytemp) + 1;
                //    dely = ny * ytemp;
                //}
                if (delx % xtemp != 0)
                {
                    nx   = Convert.ToInt64(delx / xtemp) + 1;
                    delx = nx * xtemp;
                    ny   = Convert.ToInt64(delx / xtemp) + 1;
                    dely = nx * xtemp;
                }
                //if (delx < dely)
                //{
                xmax = nx * xtemp + xmin;
                ymax = nx * xtemp + ymin;
                //}
                //if (dely < delx)
                //{
                //    xmax = nx * xtemp + xmin;
                //    ymax = ny * xtemp + ymin;
                //}
            }
            DataRow rx = outputData.NewRow();
            DataRow ry = outputData.NewRow();

            rx[0] = xmin;
            ry[0] = ymin;
            rx[1] = xmax;
            ry[1] = ymax;
            rx[2] = nx;
            ry[2] = ny;
            outputData.Rows.Add(rx);
            outputData.Rows.Add(ry);
            oD.Tables.Add(outputData);
            oD.WriteXml(ArcTimData.StaticClass.infoTable.Rows[0]["ModelPath"] + "\\outputSettings.xml");
            this.Hide();
        }