public void WritePointShapeTest()
    {
      string File = @"..\..\..\TestData\WriteTest.Shp";

      ShapeWriter PSW = new ShapeWriter(File);

      PSW.WritePointShape(10, 20);
      PSW.WritePointShape(20, 30);
      PSW.WritePointShape(30, 40);

      DataTable DT = new DataTable();
      DT.Columns.Add("Name", typeof(string));
      DT.Rows.Add(new object[] { "point1" });
      DT.Rows.Add(new object[] { "point2" });
      DT.Rows.Add(new object[] { "point3" });

      PSW.Data.WriteDate(DT);
      PSW.Dispose();


      ShapeReader PSR = new ShapeReader(File);

      IXYPoint p;
      DataTable DTread = PSR.Data.Read();
      int i = 0;
      foreach (DataRow dr in DTread.Rows)
      {
        Console.WriteLine(dr[0].ToString());
        p = (IXYPoint)PSR.ReadNext(i);
        Console.WriteLine(p.X.ToString() + "   " + p.Y.ToString());
        i++;

      }
    }
    private void button3_Click(object sender, EventArgs e)
    {
      if (saveFileDialog1.ShowDialog() == DialogResult.OK)
      {

        IEnumerable<Plant> plants =listBoxAnlaeg.Items.Cast<Plant>();
        IEnumerable<JupiterIntake> intakes = JupiterReader.AddDataForNovanaExtraction(plants, dateTimeStartExt.Value, dateTimeEndExt.Value);
        HeadObservations.WriteShapeFromDataRow(saveFileDialog1.FileName, intakes);

        IEnumerable<Plant> PlantWithoutIntakes = plants.Where(var => var.PumpingIntakes.Count == 0);
        if (PlantWithoutIntakes.Count()>0)
          if (DialogResult.Yes == MessageBox.Show("The list contains plants with no intakes attached. Should these be written to a new shape-file?", "Plants without intakes!", MessageBoxButtons.YesNo))
          {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                NovanaTables.IndvindingerDataTable dt = JupiterReader.FillPlantData(PlantWithoutIntakes, dateTimeStartExt.Value, dateTimeEndExt.Value);
                ShapeWriter PSW = new ShapeWriter(saveFileDialog1.FileName);
                PSW.WritePointShape(dt, dt.ANLUTMXColumn.ColumnName, dt.ANLUTMYColumn.ColumnName);
                PSW.Dispose();
            }

          }
      }

    }
Exemplo n.º 3
0
      /// <summary>
      /// Writes the wells to a point shape
      /// Calculates statistics on the observations within the period from start to end
      /// </summary>
      /// <param name="FileName"></param>
      /// <param name="Wells"></param>
      /// <param name="Start"></param>
      /// <param name="End"></param>
      public static void WriteSimpleShape(string FileName, IEnumerable<IIntake> Intakes, DateTime Start, DateTime End)
      {
        ShapeWriter PSW = new ShapeWriter(FileName);
        OutputTables.PejlingerOutputDataTable PDT = new OutputTables.PejlingerOutputDataTable();

        foreach (Intake I in Intakes)
        {
          var SelectedObs = I.HeadObservations.ItemsInPeriod(Start, End);

          PSW.WritePointShape(I.well.X, I.well.Y);

          OutputTables.PejlingerOutputRow PR = PDT.NewPejlingerOutputRow();

          PR.NOVANAID = I.ToString();
          PR.LOCATION = I.well.Description;
          PR.XUTM = I.well.X;
          PR.YUTM = I.well.Y;
          PR.JUPKOTE = I.well.Terrain;

          if (I.Screens.Count > 0)
          {
            PR.INTAKETOP = I.Screens.Min(var => var.DepthToTop);
            PR.INTAKEBOT = I.Screens.Max(var => var.DepthToBottom);
          }

          PR.NUMBEROFOB = SelectedObs.Count();
          if (SelectedObs.Count() > 0)
          {
            PR.STARTDATO = SelectedObs.Min(x => x.Time);
            PR.ENDDATO = SelectedObs.Max(x => x.Time);
            PR.MAXOBS = SelectedObs.Max(num => num.Value);
            PR.MINOBS = SelectedObs.Min(num => num.Value);
            PR.MEANOBS = SelectedObs.Average(num => num.Value);
          }
          PDT.Rows.Add(PR);
        }


        PSW.Data.WriteDate(PDT);
        PSW.Dispose();
      }
Exemplo n.º 4
0
      /// <summary>
      /// Writes a point shape with entries for each intake in the list. Uses the dataRow as attributes.
      /// </summary>
      /// <param name="FileName"></param>
      /// <param name="Intakes"></param>
      /// <param name="Start"></param>
      /// <param name="End"></param>
      public static void WriteShapeFromDataRow(string FileName, IEnumerable<JupiterIntake> Intakes)
      {
        ShapeWriter PSW = new ShapeWriter(FileName);
        foreach (JupiterIntake JI in Intakes)
        {
          PSW.WritePointShape(JI.well.X, JI.well.Y);
          PSW.Data.WriteData(JI.Data);
        }
        PSW.Dispose();

      }