コード例 #1
0
  private string GetQuery(FeatureType featureType, Configuration.LayerRow layerRow, CommonLayer layer, bool inSet)
  {
    StringCollection ids = GetIds(featureType);

    if (ids.Count == 0)
    {
      return null;
    }

    CommonField keyField = layer.FindField(layerRow.KeyField);
    string joinedIds = keyField.IsNumeric ? ids.Join(",") : String.Format("'{0}'", ids.Join("','"));
    return String.Format("{0} {1} ({2})", keyField.Name, inSet ? "in" : "not in", joinedIds);
  }
コード例 #2
0
    private string CoordinatesToString(List <Coordinate> points)
    {
        StringCollection coords = new StringCollection();

        for (int i = 0; i < points.Count; ++i)
        {
            coords.Add(points[i].X.ToString() + "," + points[i].Y.ToString());
        }

        return(coords.Join(Separator2.ToString()));
    }
コード例 #3
0
ファイル: Status.aspx.cs プロジェクト: andrewgbuck/GPV
    protected void Page_Load(object sender, EventArgs e)
    {
        Configuration config = AppContext.GetConfiguration();

        if (Request.QueryString["check"] != null)
        {
            string status = "unknown";

            switch (Request.QueryString["check"].ToLower())
            {
            case "app":
                status = AppSettings.AppIsAvailable ? "up" : "down";
                break;

            case "appmessage":
                status = AppSettings.AppStatusMessage;
                break;

            case "mapservices":
                StringCollection serviceStatus = new StringCollection();

                foreach (Configuration.MapTabRow mapTab in config.MapTab)
                {
                    bool isAvailable = AppContext.GetDataFrame(mapTab.MapTabID).Service.IsAvailable;
                    serviceStatus.Add(mapTab.MapTabID + ": " + (isAvailable ? "up" : "down"));
                }

                status = serviceStatus.Join("; ");
                break;
            }

            Response.Write(status);
            Response.End();
        }

        labMessage.Text = AppSettings.AppStatusMessage;

        if (AppSettings.AppIsAvailable)
        {
            DataTable table = config.MapTab.Copy();
            table.Columns.Add("Status", typeof(string));

            foreach (DataRow row in table.Rows)
            {
                CommonDataFrame dataFrame = AppContext.GetDataFrame(row["MapTabID"].ToString());
                row["Status"] = dataFrame.Service.IsAvailable ? "up" : "down";
            }

            grdMapServices.DataSource = table;
            grdMapServices.DataBind();
            grdMapServices.Visible = true;
        }
    }
コード例 #4
0
ファイル: Status.aspx.cs プロジェクト: ClaireBrill/GPV
  protected void Page_Load(object sender, EventArgs e)
  {
    Configuration config = AppContext.GetConfiguration();

    if (Request.QueryString["check"] != null)
    {
      string status = "unknown";

      switch (Request.QueryString["check"].ToLower())
      {
        case "app":
          status = AppSettings.AppIsAvailable ? "up" : "down";
          break;

        case "appmessage":
          status = AppSettings.AppStatusMessage;
          break;

        case "mapservices":
          StringCollection serviceStatus = new StringCollection();

          foreach (Configuration.MapTabRow mapTab in config.MapTab)
          {
            bool isAvailable = AppContext.GetDataFrame(mapTab.MapTabID).Service.IsAvailable;
            serviceStatus.Add(mapTab.MapTabID + ": " + (isAvailable ? "up" : "down"));
          }

          status = serviceStatus.Join("; ");
          break;
      }

      Response.Write(status);
      Response.End();
    }

    labMessage.Text = AppSettings.AppStatusMessage;

    if (AppSettings.AppIsAvailable)
    {
      DataTable table = config.MapTab.Copy();
      table.Columns.Add("Status", typeof(string));

      foreach (DataRow row in table.Rows)
      {
        CommonDataFrame dataFrame = AppContext.GetDataFrame(row["MapTabID"].ToString());
        row["Status"] = dataFrame.Service.IsAvailable ? "up" : "down";
      }

      grdMapServices.DataSource = table;
      grdMapServices.DataBind();
      grdMapServices.Visible = true;
    }
  }
コード例 #5
0
    private string LayersToString(Dictionary <String, StringCollection> dict)
    {
        StringCollection layers = new StringCollection();

        foreach (string key in dict.Keys)
        {
            string s = key;

            if (VisibleLayers[key].Count > 0)
            {
                s += Separator3.ToString() + VisibleLayers[key].Join(Separator3.ToString());
            }

            layers.Add(s);
        }

        return(layers.Join(Separator2.ToString()));
    }
コード例 #6
0
ファイル: MapMaker.cs プロジェクト: ClaireBrill/GPV
    private void DrawMeasure(Graphics graphics, IGeometry geometry)
    {
        string measureUnits = AppSettings.MeasureUnits;
        bool   inFeet       = measureUnits == "feet" || measureUnits == "both";
        bool   inMeters     = measureUnits == "meters" || measureUnits == "both";

        System.Drawing.Font font = AppSettings.MeasureFont;
        font = new System.Drawing.Font(font.FontFamily, Convert.ToSingle(font.Size * _resolution), font.Style, font.Unit);
        SolidBrush brush     = new SolidBrush(Color.FromArgb(64, 64, 64));
        SolidBrush glowBrush = new SolidBrush(Color.White);

        StringFormat format = new StringFormat();

        format.Alignment     = StringAlignment.Center;
        format.LineAlignment = StringAlignment.Center;

        double           convert = 1 / (AppSettings.MapUnits == "feet" ? 1 : Constants.MetersPerFoot);
        StringCollection text    = new StringCollection();

        switch (geometry.OgcGeometryType)
        {
        case OgcGeometryType.LineString:
            ILineString lineString = (ILineString)geometry;

            double d = lineString.Length * convert;

            if (inFeet)
            {
                text.Add(d < 5280 ? d.ToString("0") + " ft" : (d / 5280).ToString("0.0") + " mi");
            }

            if (inMeters)
            {
                d *= Constants.MetersPerFoot;
                text.Add(d < 1000 ? d.ToString("0") + " m" : (d / 1000).ToString("0.0") + " km");
            }

            IPoint p;
            double angle;

            GetMidpoint(lineString, out p, out angle);

            angle = -(angle * 180 / Math.PI);
            angle = angle < -90 || 90 < angle ? angle + 180 : angle < 0 ? angle + 360 : angle;

            p = _transform.ReverseTransform(p);

            float x = Convert.ToSingle(p.Coordinate.X * _resolution);
            float y = Convert.ToSingle(p.Coordinate.Y * _resolution);

            format.LineAlignment = StringAlignment.Far;

            int[] pos = new int[] { 0, 1, 2, 3, 5, 6, 7, 8, 4 };

            for (int i = 0; i < 9; ++i)
            {
                float offsetX = (pos[i] % 3) - 1;
                float offsetY = Convert.ToSingle(Math.Floor(pos[i] / 3.0)) - 1;

                System.Drawing.Drawing2D.GraphicsState state = graphics.Save();
                graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                graphics.TranslateTransform(x, y);
                graphics.RotateTransform(Convert.ToSingle(angle));
                graphics.DrawString(text.Join("\n"), font, i < 8 ? glowBrush : brush, Convert.ToSingle(offsetX * _resolution), Convert.ToSingle(offsetY - 3 * _resolution), format);
                graphics.Restore(state);
            }
            break;

        case OgcGeometryType.Polygon:
            IPolygon polygon = (IPolygon)geometry;
            IPoint   c       = polygon.Centroid;

            if (c != null)
            {
                double a     = polygon.Area * convert * convert;
                double acres = a / Constants.SquareFeetPerAcre;

                if (inFeet)
                {
                    double squareMile = Constants.FeetPerMile * Constants.FeetPerMile;
                    text.Add(a <= squareMile ? a.ToString("0") + " sq ft" : (a / squareMile).ToString("0.00") + " sq mi");
                }

                if (inMeters)
                {
                    a *= Constants.MetersPerFoot * Constants.MetersPerFoot;
                    text.Add(a <= 100000 ? a.ToString("0") + " sq m" : (a / 1000000).ToString("0.00") + " sq km");
                }

                if (inFeet)
                {
                    text.Add(acres.ToString("0.00") + " acres");
                }

                DrawText(graphics, c, text.Join("\n"), font, brush, glowBrush, 0, 0, format);
            }
            break;
        }
    }
コード例 #7
0
ファイル: MapMaker.cs プロジェクト: ClaireBrill/GPV
    private void DrawFeatures(Graphics graphics, string layerId, StringCollection ids, Color color, double opacity, string polygonMode, int penWidth, int dotSize)
    {
        if (ids.Count == 0)
        {
            return;
        }

        bool drawPolygonOutlines = polygonMode == "outline";

        // get the layer

        Configuration config = AppContext.GetConfiguration();

        Configuration.LayerRow layerRow = config.Layer.FindByLayerID(layerId);

        CommonDataFrame dataFrame = AppContext.GetDataFrame(_appState.MapTab);
        CommonLayer     layer     = dataFrame.Layers.FirstOrDefault(lyr => String.Compare(lyr.Name, layerRow.LayerName, true) == 0);

        // build the query string and select the features

        CommonField field     = layer.FindField(layerRow.KeyField);
        string      joinedIds = field.IsNumeric ? ids.Join(",") : String.Format("'{0}'", ids.Join("','"));
        string      query     = String.Format("{0} in ({1})", field.Name, joinedIds);

        string levelQuery = layerRow.GetLevelQuery(layer, _appState.Level);

        if (!String.IsNullOrEmpty(levelQuery))
        {
            query += " and " + levelQuery;
        }

        CommonField keyField = layer.FindField(layerRow.KeyField);
        DataTable   table    = layer.GetFeatureTable(String.Format("{0},{1}", layer.GeometryField.Name, keyField.Name), query);

        if (table == null || table.Rows.Count == 0)
        {
            return;
        }

        OgcGeometryType geometryType = ((IGeometry)table.Rows[0][layer.GeometryField.Name]).OgcGeometryType;

        // prepare the temporary image for drawing transparent highlight graphics

        int width  = Convert.ToInt32(graphics.VisibleClipBounds.Width);
        int height = Convert.ToInt32(graphics.VisibleClipBounds.Height);

        Bitmap   bitMap        = new Bitmap(width, height);
        Graphics imageGraphics = Graphics.FromImage(bitMap);

        imageGraphics.Clear(Color.Transparent);

        // prepare the drawing objects

        Brush brush = new SolidBrush(color);
        Pen   pen   = new Pen(color, Convert.ToSingle(penWidth * _resolution));

        pen.EndCap   = System.Drawing.Drawing2D.LineCap.Square;
        pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
        Pen bufferPen = new Pen(color, Convert.ToSingle(5 * _resolution));

        bufferPen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
        bufferPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;

        float dot = Convert.ToSingle(dotSize * _resolution);

        // draw each shape in the table

        foreach (DataRow row in table.Rows)
        {
            switch (geometryType)
            {
            case OgcGeometryType.Point:
                IPoint point = (IPoint)row[layer.GeometryField.Name];
                DrawPoint(imageGraphics, point, brush, dot);
                break;

            case OgcGeometryType.MultiPoint:
                IMultiPoint multiPoint = (IMultiPoint)row[layer.GeometryField.Name];
                DrawPoint(imageGraphics, (IPoint)multiPoint[0], brush, dot);
                break;

            case OgcGeometryType.MultiLineString:
                DrawMultiLineString(imageGraphics, (IMultiLineString)row[layer.GeometryField.Name], pen);
                break;

            case OgcGeometryType.MultiPolygon:
                if (drawPolygonOutlines)
                {
                    DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], null, null, pen);
                }
                else
                {
                    DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], brush, bufferPen);
                }

                break;
            }
        }

        // draw the temporary image containing the highlight graphics on the output image at
        // the specified opacity

        float[][] matrixItems =
        {
            new float[] { 1, 0, 0,                         0, 0 },
            new float[] { 0, 1, 0,                         0, 0 },
            new float[] { 0, 0, 1,                         0, 0 },
            new float[] { 0, 0, 0, Convert.ToSingle(opacity), 0 },
            new float[] { 0, 0, 0,                         0, 1 }
        };

        ColorMatrix colorMatrix = new ColorMatrix(matrixItems);

        ImageAttributes imageAtts = new ImageAttributes();

        imageAtts.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);

        Rectangle drawRect = new Rectangle(0, 0, width, height);

        graphics.DrawImage(bitMap, drawRect, 0, 0, width, height, GraphicsUnit.Pixel, imageAtts);
    }
コード例 #8
0
        /// <summary>
        /// Antes de enviar la petición se tiene que llamar a este método
        /// para serializar la cabecera.
        /// ** El body del mensaje lo serializa la clase HttpBody
        /// </summary>
        public void PrepareSend()
        {
            HeadStream = (Stream) new MemoryStream();

            var headWriter = new StreamWriter(HeadStream, Encoding.ASCII);

            // serializamos los valores del formulario
            if (Form.Count > 0 && Body == null)
            {
                Method = MessageTypes.POST;

                Body = new HttpBody(this);

                int x = 0;
                for (x = 0; x < Form.Count; x++)
                {
                    var strVal = HttpUtility.UrlEncode(Form.Get(x));
                    Body.AddText("{0}={1}&", Form.GetKey(x),
                                 strVal);
                }

                Body.ContentType = HttpConst.FormUrlEncoded;
            }

            headWriter.WriteLine("{0} {1} {2}",
                                 Method, Url, HttpConst.HttpVersion);

            headWriter.WriteLine("{0}: {1}", HttpConst.UserAgent, WebConfig.ServerVersion);
            headWriter.WriteLine("{0}: {1}", HttpConst.Host, Host);

            if (Accept.Count > 0)
            {
                headWriter.WriteLine("{0}: {1}", HttpConst.Accept, Accept.Join(","));
            }

            if (AcceptCharset.Count > 0)
            {
                headWriter.WriteLine("{0}: {1}", HttpConst.AcceptCharset, AcceptCharset.Join(","));
            }

            if (AcceptLanguage.Count > 0)
            {
                headWriter.WriteLine("{0}: {1}", HttpConst.AcceptLanguage, AcceptLanguage.Join(","));
            }

            if (AcceptEncoding.Count > 0)
            {
                headWriter.WriteLine("{0}: {1}", HttpConst.AcceptEncoding, AcceptEncoding.Join(","));
            }

            if (Body != null && Body.HasContent)
            {
                if (Body.ContentEncoding != ContentEncodings.NORMAL)
                {
                    string cenc = "";

                    switch (Body.ContentEncoding)
                    {
                    case ContentEncodings.GZIP:
                        cenc = "gzip";
                        break;

                    case ContentEncodings.DEFLATE:
                        cenc = "deflate";
                        break;
                    }

                    headWriter.WriteLine("Content-Encoding: {0}",
                                         cenc);
                }

                if (Body.ContentEncoding == ContentEncodings.GZIP)
                {
                    MemoryStream body = new MemoryStream();
                    GZip.Compress(Body.ContentStream, body);
                    Body.ContentStream = body;
                }

                headWriter.Write("Content-Type: {0}", Body.ContentType);

                if (Body.ContentType.StartsWith("text") && Body.CharSet.Length > 0)
                {
                    headWriter.Write("; charset={0}", Body.CharSet);
                }

                headWriter.WriteLine();

                if (Body.ContentDisposition != null && Body.ContentDisposition.Length > 0)
                {
                    headWriter.WriteLine("Content-Disposition: {0}", Body.ContentDisposition);
                }

                headWriter.WriteLine("Content-Length: {0}", Body.Length);
            }
            else
            {
                headWriter.WriteLine("Content-Length: {0}", 0);
            }

            foreach (object item in Head.Fields.Values)
            {
                var field = (HttpField)item;
                switch (field.Name)
                {
                default:
                    headWriter.WriteLine("{0}: {1}", field.Name, field.Value);
                    break;
                }
            }

            headWriter.WriteLine();
            headWriter.Flush();

            ConsoleWritePlainText();
        }
コード例 #9
0
ファイル: MapTipHandler.cs プロジェクト: jsmeyers/GPV
    private void DefaultMethod()
    {
        string v = Request.Form["visiblelayers"];

        string[] visibleLayers = v == null ? new string[0] : v.Split('\u0001');

        string level    = Request.Form["level"];
        double x        = Convert.ToDouble(Request.Form["x"]);
        double y        = Convert.ToDouble(Request.Form["y"]);
        double distance = Convert.ToDouble(Request.Form["distance"]);
        double scale    = Convert.ToDouble(Request.Form["scale"]);

        Configuration config = AppContext.GetConfiguration();

        Configuration.MapTabRow mapTab    = config.MapTab.First(o => o.MapTabID == Request.Form["maptab"]);
        CommonDataFrame         dataFrame = AppContext.GetDataFrame(mapTab);

        Dictionary <String, Configuration.LayerRow>         layers         = new Dictionary <String, Configuration.LayerRow>();
        Dictionary <String, Configuration.LayerFunctionRow> layerFunctions = new Dictionary <String, Configuration.LayerFunctionRow>();

        foreach (Configuration.MapTabLayerRow mapTabLayer in mapTab.GetMapTabLayerRows())
        {
            bool isCandidateLayer = mapTab.IsInteractiveLegendNull() || mapTab.InteractiveLegend == 0;

            if (!isCandidateLayer)
            {
                bool shownInLegend   = !mapTabLayer.IsShowInLegendNull() && mapTabLayer.ShowInLegend == 1;
                bool checkedInLegend = mapTabLayer.IsCheckInLegendNull() || mapTabLayer.CheckInLegend < 0 || visibleLayers.Any(o => o == mapTabLayer.LayerID);
                isCandidateLayer = !shownInLegend || checkedInLegend;
            }

            if (isCandidateLayer)
            {
                Configuration.LayerRow         layer         = mapTabLayer.LayerRow;
                Configuration.LayerFunctionRow layerFunction = layer.GetLayerFunctionRows().FirstOrDefault(o => o.FunctionName.ToLower() == "maptip");

                if (layerFunction != null)
                {
                    layers.Add(layer.LayerName, layer);
                    layerFunctions.Add(layer.LayerName, layerFunction);
                }
            }
        }

        string tipText = null;

        for (int i = 0; i < dataFrame.Layers.Count - 1 && tipText == null; ++i)
        {
            CommonLayer commonLayer = dataFrame.Layers[i];
            string      id          = null;

            if (layers.ContainsKey(commonLayer.Name) && commonLayer.IsWithinScaleThresholds(scale))
            {
                if (commonLayer.Type == CommonLayerType.Feature)
                {
                    Configuration.LayerRow layer = layers[commonLayer.Name];
                    string levelQuery            = layer.GetLevelQuery(commonLayer, level);

                    CommonField keyField = commonLayer.FindField(layer.KeyField);
                    DataTable   table    = commonLayer.GetFeatureTable(keyField.Name, levelQuery, x, y, commonLayer.FeatureType == OgcGeometryType.MultiPolygon ? 0 : distance * scale);

                    if (table != null && table.Rows.Count > 0)
                    {
                        id = table.Rows[table.Rows.Count - 1][0].ToString();
                    }
                }

                if (commonLayer.Type == CommonLayerType.Image)
                {
                    id = ((AgsLayer)commonLayer).GetRasterValue(x, y);
                }
            }

            if (!String.IsNullOrEmpty(id))
            {
                Configuration.LayerFunctionRow layerFunction = layerFunctions[commonLayer.Name];

                using (OleDbCommand command = layerFunction.GetDatabaseCommand())
                {
                    command.Parameters[0].Value = id;

                    if (command.Parameters.Count > 1)
                    {
                        command.Parameters[1].Value = AppUser.GetRole();
                    }

                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            StringCollection text = new StringCollection();

                            for (int j = 0; j < reader.FieldCount; ++j)
                            {
                                if (!reader.IsDBNull(j))
                                {
                                    text.Add(reader.GetValue(j).ToString());
                                }
                            }

                            if (text.Count > 0)
                            {
                                tipText = text.Join("\n");
                            }
                        }
                    }

                    command.Connection.Close();
                }
            }
        }

        if (tipText == null)
        {
            ReturnJson(null);
        }
        else
        {
            Dictionary <String, Object> result = new Dictionary <String, Object>();
            result.Add("tipText", tipText);
            ReturnJson(result);
        }
    }
コード例 #10
0
ファイル: MapMaker.cs プロジェクト: ClaireBrill/GPV
  private void DrawMeasure(Graphics graphics, IGeometry geometry)
  {
    string measureUnits = AppSettings.MeasureUnits;
    bool inFeet = measureUnits == "feet" || measureUnits == "both";
    bool inMeters = measureUnits == "meters" || measureUnits == "both";

    System.Drawing.Font font = AppSettings.MeasureFont;
    font = new System.Drawing.Font(font.FontFamily, Convert.ToSingle(font.Size * _resolution), font.Style, font.Unit);
    SolidBrush brush = new SolidBrush(Color.FromArgb(64, 64, 64));
    SolidBrush glowBrush = new SolidBrush(Color.White);

    StringFormat format = new StringFormat();
    format.Alignment = StringAlignment.Center;
    format.LineAlignment = StringAlignment.Center;

    double convert = 1 / (AppSettings.MapUnits == "feet" ? 1 : Constants.MetersPerFoot);
    StringCollection text = new StringCollection();

    switch (geometry.OgcGeometryType)
    {
      case OgcGeometryType.LineString:
        ILineString lineString = (ILineString)geometry;

        double d = lineString.Length * convert;

        if (inFeet)
        {
          text.Add(d < 5280 ? d.ToString("0") + " ft" : (d / 5280).ToString("0.0") + " mi");
        }

        if (inMeters)
        {
          d *= Constants.MetersPerFoot;
          text.Add(d < 1000 ? d.ToString("0") + " m" : (d / 1000).ToString("0.0") + " km");
        }

        IPoint p;
        double angle;

        GetMidpoint(lineString, out p, out angle);

        angle = -(angle * 180 / Math.PI);
        angle = angle < -90 || 90 < angle ? angle + 180 : angle < 0 ? angle + 360 : angle;

        p = _transform.ReverseTransform(p);

        float x = Convert.ToSingle(p.Coordinate.X * _resolution);
        float y = Convert.ToSingle(p.Coordinate.Y * _resolution);

        format.LineAlignment = StringAlignment.Far;

        int[] pos = new int[] { 0, 1, 2, 3, 5, 6, 7, 8, 4 };

        for (int i = 0; i < 9; ++i)
        {
          float offsetX = (pos[i] % 3) - 1;
          float offsetY = Convert.ToSingle(Math.Floor(pos[i] / 3.0)) - 1;

          System.Drawing.Drawing2D.GraphicsState state = graphics.Save();
          graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
          graphics.TranslateTransform(x, y);
          graphics.RotateTransform(Convert.ToSingle(angle));
          graphics.DrawString(text.Join("\n"), font, i < 8 ? glowBrush : brush, Convert.ToSingle(offsetX * _resolution), Convert.ToSingle(offsetY - 3 * _resolution), format);
          graphics.Restore(state);
        }
        break;

      case OgcGeometryType.Polygon:
        IPolygon polygon = (IPolygon)geometry;
        IPoint c = polygon.Centroid;

        if (c != null)
        {
          double a = polygon.Area * convert * convert;
          double acres = a / Constants.SquareFeetPerAcre;

          if (inFeet)
          {
            double squareMile = Constants.FeetPerMile * Constants.FeetPerMile;
            text.Add(a <= squareMile ? a.ToString("0") + " sq ft" : (a / squareMile).ToString("0.00") + " sq mi");
          }

          if (inMeters)
          {
            a *= Constants.MetersPerFoot * Constants.MetersPerFoot;
            text.Add(a <= 100000 ? a.ToString("0") + " sq m" : (a / 1000000).ToString("0.00") + " sq km");
          }

          if (inFeet)
          {
            text.Add(acres.ToString("0.00") + " acres");
          }

          DrawText(graphics, c, text.Join("\n"), font, brush, glowBrush, 0, 0, format);
        }
        break;
    }
  }
コード例 #11
0
ファイル: AppState.cs プロジェクト: ClaireBrill/GPV
  private string LayersToString(Dictionary<String, StringCollection> dict)
  {
    StringCollection layers = new StringCollection();

    foreach (string key in dict.Keys)
    {
      string s = key;

      if (VisibleLayers[key].Count > 0)
      {
        s += Separator3.ToString() + VisibleLayers[key].Join(Separator3.ToString());
      }

      layers.Add(s);
    }

    return layers.Join(Separator2.ToString());
  }
コード例 #12
0
ファイル: AppState.cs プロジェクト: ClaireBrill/GPV
  private string CoordinatesToString(List<Coordinate> points)
  {
    StringCollection coords = new StringCollection();

    for (int i = 0; i < points.Count; ++i)
    {
      coords.Add(points[i].X.ToString() + "," + points[i].Y.ToString());
    }

    return coords.Join(Separator2.ToString());
  }
コード例 #13
0
  protected void cmdDownload_Click(object sender, EventArgs e)
  {
    StringCollection query = new StringCollection();
    query.Add("a.Deleted = 0 and b.Deleted = 0");

    if (ddlMarkupCategory.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
    }

    if (ddlUserName.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.CreatedBy = '{0}'", ddlUserName.SelectedValue));
    }

    if (optDateRange.Checked)
    {
      DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
      DateTime dateTo = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
      query.Add(String.Format("'{0}' <= b.DateCreated and b.DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
    }

    if (ddlMarkupGroup.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.DisplayName = '{0}'", ddlMarkupGroup.SelectedValue));
    }

    string baseSql = @"select c.DisplayName as Category, b.DisplayName as [Group], b.CreatedBy as CreatedBy,
          b.DateCreated as DateGroup, a.DateCreated as DateMarkup, a.Color as Color, a.Glow as Glow,
          a.Text as Text, a.Shape as Shape
          from {0}Markup a 
            inner join {0}MarkupGroup b on a.GroupID = b.GroupID
            inner join {0}MarkupCategory c on b.CategoryID = c.CategoryID {1}
          order by b.DateCreated, a.DateCreated
        ";

    Response.Clear();
    Response.ContentType = "application/zip";
    Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.zip", tboFilePrefix.Text));

    ZipOutputStream zipStream = new ZipOutputStream(Response.OutputStream);

    // polygons

    string where = String.Format(" where {0} and a.Shape like 'POLYGON%'", query.Join(" and "));
    string sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    DataTable table = GetShapeTable(sql, OgcGeometryType.Polygon);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_poly");
    }

    // lines

    where = String.Format(" where {0} and a.Shape like 'LINESTRING%'", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.LineString);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_line");
    }

    // points

    where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is null", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.Point);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_point");
    }

    // text

    where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is not null", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.Point);

    if (table.Rows.Count > 0)
    {
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_text");
    }

    zipStream.Finish();
    zipStream.Close();
    Response.End();
  }
コード例 #14
0
  protected void Page_PreRender(object sender, EventArgs e)
  {
    string prefix = AppSettings.ConfigurationTablePrefix;

    using (OleDbConnection connection = AppContext.GetDatabaseConnection())
    {
      StringCollection query = new StringCollection();
      query.Add("Deleted = 0");

      // category

      if (ddlMarkupCategory.SelectedValue.Length > 0)
      {
        query.Add(String.Format("CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
      }

      // user name

      string sql = String.Format("select distinct CreatedBy from {0}MarkupGroup {1} order by CreatedBy",
          prefix, String.Format(" where {0}", query.Join(" and ")));
      DataTable table = new DataTable();
      
      using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
      {
        adapter.Fill(table);
      }

      string currentUser = ddlUserName.Items.Count == 0 ? "" : ddlUserName.SelectedValue;

      ddlUserName.DataSource = table;
      ddlUserName.DataValueField = "CreatedBy";
      ddlUserName.DataBind();
      ddlUserName.Items.Insert(0, new ListItem("- all users -", ""));

      if (table.Select("CreatedBy = '" + currentUser + "'").Length > 0)
      {
        ddlUserName.SelectedValue = currentUser;
        query.Add(String.Format("CreatedBy = '{0}'", currentUser));
      }

      // date

      if (optDateRange.Checked)
      {
        DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
        DateTime dateTo = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
        query.Add(String.Format("'{0}' <= DateCreated and DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
      }

      // markup group

      sql = String.Format("select distinct DisplayName from {0}MarkupGroup {1} order by DisplayName",
          prefix, String.Format(" where {0}", query.Join(" and ")));
      table = new DataTable();

      using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
      {
        adapter.Fill(table);
      }

      string currentGroup = ddlMarkupGroup.Items.Count == 0 ? "" : ddlMarkupGroup.SelectedValue;

      ddlMarkupGroup.DataSource = table;
      ddlMarkupGroup.DataValueField = "DisplayName";
      ddlMarkupGroup.DataBind();
      ddlMarkupGroup.Items.Insert(0, new ListItem("- all groups -", ""));

      if (table.Select("DisplayName = '" + currentGroup + "'").Length > 0)
      {
        ddlMarkupGroup.SelectedValue = currentGroup;
        query.Add(String.Format("DisplayName = '{0}'", currentGroup));
      }

      // count

      string where = String.Format(" where {0}", query.Join(" and "));
      sql = String.Format("select count(*) from {0}MarkupGroup {1}", prefix, where);
      int numGroups;

      using (OleDbCommand command = new OleDbCommand(sql, connection))
      {
        numGroups = Convert.ToInt32(command.ExecuteScalar());
      }

      sql = String.Format("select count(*) from {0}Markup where GroupID in (select GroupID from {0}MarkupGroup {1})", prefix, where);
      int numMarkups;

      using (OleDbCommand command = new OleDbCommand(sql, connection))
      {
        numMarkups = Convert.ToInt32(command.ExecuteScalar());
      }

      labNumberFound.Text = String.Format("{0} {1} in {2} {3} found", numMarkups,
          numMarkups == 1 ? "markup" : "markups", numGroups, numGroups == 1 ? "group" : "groups");

      cmdDownload.Enabled = numGroups != 0 && numMarkups != 0;
    }

    if (String.IsNullOrEmpty(tboFilePrefix.Text))
    {
      tboFilePrefix.Text = GetDefaultFilePrefix();
    }
    else
    {
      char[] c = tboFilePrefix.Text.ToCharArray();

      for (int i = 0; i < c.Length; ++i)
      {
        if (!('a' <= c[i] && c[i] <= 'z') && !('A' <= c[i] && c[i] <= 'Z') && !('0' <= c[i] && c[i] <= '9'))
        {
          c[i] = '_';
        }
      }

      tboFilePrefix.Text = new String(c);
    }
  }
コード例 #15
0
ファイル: DownloadMarkup.aspx.cs プロジェクト: jsmeyers/GPV
    protected void Page_PreRender(object sender, EventArgs e)
    {
        string prefix = WebConfigSettings.ConfigurationTablePrefix;

        using (OleDbConnection connection = AppContext.GetDatabaseConnection())
        {
            StringCollection query = new StringCollection();
            query.Add("Deleted = 0");

            // category

            if (ddlMarkupCategory.SelectedValue.Length > 0)
            {
                query.Add(String.Format("CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
            }

            // user name

            string sql = String.Format("select distinct CreatedBy from {0}MarkupGroup {1} order by CreatedBy",
                                       prefix, String.Format(" where {0}", query.Join(" and ")));
            DataTable table = new DataTable();

            using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
            {
                adapter.Fill(table);
            }

            string currentUser = ddlUserName.Items.Count == 0 ? "" : ddlUserName.SelectedValue;

            ddlUserName.DataSource     = table;
            ddlUserName.DataValueField = "CreatedBy";
            ddlUserName.DataBind();
            ddlUserName.Items.Insert(0, new ListItem("- all users -", ""));

            if (table.Select("CreatedBy = '" + currentUser + "'").Length > 0)
            {
                ddlUserName.SelectedValue = currentUser;
                query.Add(String.Format("CreatedBy = '{0}'", currentUser));
            }

            // date

            if (optDateRange.Checked)
            {
                DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
                DateTime dateTo   = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
                query.Add(String.Format("'{0}' <= DateCreated and DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
            }

            // markup group

            sql = String.Format("select distinct DisplayName from {0}MarkupGroup {1} order by DisplayName",
                                prefix, String.Format(" where {0}", query.Join(" and ")));
            table = new DataTable();

            using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
            {
                adapter.Fill(table);
            }

            string currentGroup = ddlMarkupGroup.Items.Count == 0 ? "" : ddlMarkupGroup.SelectedValue;

            ddlMarkupGroup.DataSource     = table;
            ddlMarkupGroup.DataValueField = "DisplayName";
            ddlMarkupGroup.DataBind();
            ddlMarkupGroup.Items.Insert(0, new ListItem("- all groups -", ""));

            if (table.Select("DisplayName = '" + currentGroup + "'").Length > 0)
            {
                ddlMarkupGroup.SelectedValue = currentGroup;
                query.Add(String.Format("DisplayName = '{0}'", currentGroup));
            }

            // count

            string where = String.Format(" where {0}", query.Join(" and "));
            sql          = String.Format("select count(*) from {0}MarkupGroup {1}", prefix, where);
            int numGroups;

            using (OleDbCommand command = new OleDbCommand(sql, connection))
            {
                numGroups = Convert.ToInt32(command.ExecuteScalar());
            }

            sql = String.Format("select count(*) from {0}Markup where GroupID in (select GroupID from {0}MarkupGroup {1})", prefix, where);
            int numMarkups;

            using (OleDbCommand command = new OleDbCommand(sql, connection))
            {
                numMarkups = Convert.ToInt32(command.ExecuteScalar());
            }

            labNumberFound.Text = String.Format("{0} {1} in {2} {3} found", numMarkups,
                                                numMarkups == 1 ? "markup" : "markups", numGroups, numGroups == 1 ? "group" : "groups");

            cmdDownload.Enabled = numGroups != 0 && numMarkups != 0;
        }

        if (String.IsNullOrEmpty(tboFilePrefix.Text))
        {
            tboFilePrefix.Text = GetDefaultFilePrefix();
        }
        else
        {
            char[] c = tboFilePrefix.Text.ToCharArray();

            for (int i = 0; i < c.Length; ++i)
            {
                if (!('a' <= c[i] && c[i] <= 'z') && !('A' <= c[i] && c[i] <= 'Z') && !('0' <= c[i] && c[i] <= '9'))
                {
                    c[i] = '_';
                }
            }

            tboFilePrefix.Text = new String(c);
        }
    }
コード例 #16
0
ファイル: MapTipHandler.cs プロジェクト: ClaireBrill/GPV
  private void DefaultMethod()
  {
    string v = Request.Form["visiblelayers"];
    string[] visibleLayers = v == null ? new string[0] : v.Split('\u0001');

    string level = Request.Form["level"];
    double x = Convert.ToDouble(Request.Form["x"]);
    double y = Convert.ToDouble(Request.Form["y"]);
    double distance = Convert.ToDouble(Request.Form["distance"]);
    double scale = Convert.ToDouble(Request.Form["scale"]);

    Configuration config = AppContext.GetConfiguration();
    Configuration.MapTabRow mapTab = config.MapTab.First(o => o.MapTabID == Request.Form["maptab"]);
    CommonDataFrame dataFrame = AppContext.GetDataFrame(mapTab);

    Dictionary<String, Configuration.LayerRow> layers = new Dictionary<String, Configuration.LayerRow>();
    Dictionary<String, Configuration.LayerFunctionRow> layerFunctions = new Dictionary<String, Configuration.LayerFunctionRow>();

    foreach (Configuration.MapTabLayerRow mapTabLayer in mapTab.GetMapTabLayerRows())
    {
      bool isCandidateLayer = mapTab.IsInteractiveLegendNull() || mapTab.InteractiveLegend == 0;

      if (!isCandidateLayer)
      {
        bool shownInLegend = !mapTabLayer.IsShowInLegendNull() && mapTabLayer.ShowInLegend == 1;
        bool checkedInLegend = mapTabLayer.IsCheckInLegendNull() || mapTabLayer.CheckInLegend < 0 || visibleLayers.Any(o => o == mapTabLayer.LayerID);
        isCandidateLayer = !shownInLegend || checkedInLegend;
      }

      if (isCandidateLayer)
      {
        Configuration.LayerRow layer = mapTabLayer.LayerRow;
        Configuration.LayerFunctionRow layerFunction = layer.GetLayerFunctionRows().FirstOrDefault(o => o.FunctionName.ToLower() == "maptip");

        if (layerFunction != null)
        {
          layers.Add(layer.LayerName, layer);
          layerFunctions.Add(layer.LayerName, layerFunction);
        }
      }
    }

    string tipText = null;

    for (int i = 0; i < dataFrame.Layers.Count - 1 && tipText == null; ++i)
    {
      CommonLayer commonLayer = dataFrame.Layers[i];
      string id = null;

      if (layers.ContainsKey(commonLayer.Name) && commonLayer.IsWithinScaleThresholds(scale))
      {
        if (commonLayer.Type == CommonLayerType.Feature)
        {
          Configuration.LayerRow layer = layers[commonLayer.Name];
          string levelQuery = layer.GetLevelQuery(commonLayer, level);

          CommonField keyField = commonLayer.FindField(layer.KeyField);
          DataTable table = commonLayer.GetFeatureTable(keyField.Name, levelQuery, x, y, commonLayer.FeatureType == OgcGeometryType.MultiPolygon ? 0 : distance * scale);

          if (table != null && table.Rows.Count > 0)
          {
            id = table.Rows[table.Rows.Count - 1][0].ToString();
          }
        }

        if (commonLayer.Type == CommonLayerType.Image)
        {
          id = ((AgsLayer)commonLayer).GetRasterValue(x, y);
        }
      }

      if (!String.IsNullOrEmpty(id))
      {
        Configuration.LayerFunctionRow layerFunction = layerFunctions[commonLayer.Name];

        using (OleDbCommand command = layerFunction.GetDatabaseCommand())
        {
          command.Parameters[0].Value = id;

          if (command.Parameters.Count > 1)
          {
            command.Parameters[1].Value = AppUser.GetRole();
          }

          using (OleDbDataReader reader = command.ExecuteReader())
          {
            if (reader.Read())
            {
              StringCollection text = new StringCollection();

              for (int j = 0; j < reader.FieldCount; ++j)
              {
                if (!reader.IsDBNull(j))
                {
                  text.Add(reader.GetValue(j).ToString());
                }
              }

              if (text.Count > 0)
              {
                tipText = text.Join("\n");
              }
            }
          }

          command.Connection.Close();
        }
      }
    }

    if (tipText == null)
    {
      ReturnJson(null);
    }
    else
    {
      Dictionary<String, Object> result = new Dictionary<String, Object>();
      result.Add("tipText", tipText);
      ReturnJson(result);
    }
  }
コード例 #17
0
ファイル: DownloadMarkup.aspx.cs プロジェクト: jsmeyers/GPV
    protected void cmdDownload_Click(object sender, EventArgs e)
    {
        StringCollection query = new StringCollection();

        query.Add("a.Deleted = 0 and b.Deleted = 0");

        if (ddlMarkupCategory.SelectedValue.Length > 0)
        {
            query.Add(String.Format("b.CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
        }

        if (ddlUserName.SelectedValue.Length > 0)
        {
            query.Add(String.Format("b.CreatedBy = '{0}'", ddlUserName.SelectedValue));
        }

        if (optDateRange.Checked)
        {
            DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
            DateTime dateTo   = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
            query.Add(String.Format("'{0}' <= b.DateCreated and b.DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
        }

        if (ddlMarkupGroup.SelectedValue.Length > 0)
        {
            query.Add(String.Format("b.DisplayName = '{0}'", ddlMarkupGroup.SelectedValue));
        }

        string baseSql = @"select c.DisplayName as Category, b.DisplayName as [Group], b.CreatedBy as CreatedBy,
          b.DateCreated as DateGroup, a.DateCreated as DateMarkup, a.Color as Color, a.Glow as Glow,
          a.Text as Text, a.Shape as Shape
          from {0}Markup a 
            inner join {0}MarkupGroup b on a.GroupID = b.GroupID
            inner join {0}MarkupCategory c on b.CategoryID = c.CategoryID {1}
          order by b.DateCreated, a.DateCreated
        ";

        Response.Clear();
        Response.ContentType = "application/zip";
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.zip", tboFilePrefix.Text));

        ZipOutputStream zipStream = new ZipOutputStream(Response.OutputStream);

        // polygons

        string where = String.Format(" where {0} and a.Shape like 'POLYGON%'", query.Join(" and "));
        string    sql   = String.Format(baseSql, WebConfigSettings.ConfigurationTablePrefix, where);
        DataTable table = GetShapeTable(sql, OgcGeometryType.Polygon);

        if (table.Rows.Count > 0)
        {
            table.Columns.Remove("Glow");
            table.Columns.Remove("Text");
            WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_poly");
        }

        // lines

        where = String.Format(" where {0} and a.Shape like 'LINESTRING%'", query.Join(" and "));
        sql   = String.Format(baseSql, WebConfigSettings.ConfigurationTablePrefix, where);
        table = GetShapeTable(sql, OgcGeometryType.LineString);

        if (table.Rows.Count > 0)
        {
            table.Columns.Remove("Glow");
            table.Columns.Remove("Text");
            WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_line");
        }

        // points

        where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is null", query.Join(" and "));
        sql   = String.Format(baseSql, WebConfigSettings.ConfigurationTablePrefix, where);
        table = GetShapeTable(sql, OgcGeometryType.Point);

        if (table.Rows.Count > 0)
        {
            table.Columns.Remove("Glow");
            table.Columns.Remove("Text");
            WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_point");
        }

        // text

        where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is not null", query.Join(" and "));
        sql   = String.Format(baseSql, WebConfigSettings.ConfigurationTablePrefix, where);
        table = GetShapeTable(sql, OgcGeometryType.Point);

        if (table.Rows.Count > 0)
        {
            WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_text");
        }

        zipStream.Finish();
        zipStream.Close();
        Response.End();
    }
コード例 #18
0
ファイル: MapMaker.cs プロジェクト: ClaireBrill/GPV
  private void DrawFeatures(Graphics graphics, string layerId, StringCollection ids, Color color, double opacity, string polygonMode, int penWidth, int dotSize)
  {
    if (ids.Count == 0)
    {
      return;
    }

    bool drawPolygonOutlines = polygonMode == "outline";

    // get the layer

    Configuration config = AppContext.GetConfiguration();
    Configuration.LayerRow layerRow = config.Layer.FindByLayerID(layerId);

    CommonDataFrame dataFrame = AppContext.GetDataFrame(_appState.MapTab);
    CommonLayer layer = dataFrame.Layers.FirstOrDefault(lyr => String.Compare(lyr.Name, layerRow.LayerName, true) == 0);

    // build the query string and select the features

    CommonField field = layer.FindField(layerRow.KeyField);
    string joinedIds = field.IsNumeric ? ids.Join(",") : String.Format("'{0}'", ids.Join("','"));
    string query = String.Format("{0} in ({1})", field.Name, joinedIds);

    string levelQuery = layerRow.GetLevelQuery(layer, _appState.Level);

    if (!String.IsNullOrEmpty(levelQuery))
    {
      query += " and " + levelQuery;
    }

    CommonField keyField = layer.FindField(layerRow.KeyField);
    DataTable table = layer.GetFeatureTable(String.Format("{0},{1}", layer.GeometryField.Name, keyField.Name), query);

    if (table == null || table.Rows.Count == 0)
    {
      return;
    }

    OgcGeometryType geometryType = ((IGeometry)table.Rows[0][layer.GeometryField.Name]).OgcGeometryType;

    // prepare the temporary image for drawing transparent highlight graphics

    int width = Convert.ToInt32(graphics.VisibleClipBounds.Width);
    int height = Convert.ToInt32(graphics.VisibleClipBounds.Height);

    Bitmap bitMap = new Bitmap(width, height);
    Graphics imageGraphics = Graphics.FromImage(bitMap);
    imageGraphics.Clear(Color.Transparent);

    // prepare the drawing objects

    Brush brush = new SolidBrush(color);
    Pen pen = new Pen(color, Convert.ToSingle(penWidth * _resolution));
    pen.EndCap = System.Drawing.Drawing2D.LineCap.Square;
    pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
    Pen bufferPen = new Pen(color, Convert.ToSingle(5 * _resolution));
    bufferPen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
    bufferPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;

    float dot = Convert.ToSingle(dotSize * _resolution);

    // draw each shape in the table

    foreach (DataRow row in table.Rows)
    {
      switch (geometryType)
      {
        case OgcGeometryType.Point:
          IPoint point = (IPoint)row[layer.GeometryField.Name];
          DrawPoint(imageGraphics, point, brush, dot);
          break;

        case OgcGeometryType.MultiPoint:
          IMultiPoint multiPoint = (IMultiPoint)row[layer.GeometryField.Name];
          DrawPoint(imageGraphics, (IPoint)multiPoint[0], brush, dot);
          break;

        case OgcGeometryType.MultiLineString:
          DrawMultiLineString(imageGraphics, (IMultiLineString)row[layer.GeometryField.Name], pen);
          break;

        case OgcGeometryType.MultiPolygon:
          if (drawPolygonOutlines)
          {
            DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], null, null, pen);
          }
          else
          {
            DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], brush, bufferPen);
          }

          break;
      }
    }

    // draw the temporary image containing the highlight graphics on the output image at
    // the specified opacity

    float[][] matrixItems ={
      new float[] {1, 0, 0, 0, 0},
      new float[] {0, 1, 0, 0, 0},
      new float[] {0, 0, 1, 0, 0},
      new float[] {0, 0, 0, Convert.ToSingle(opacity), 0}, 
      new float[] {0, 0, 0, 0, 1}};

    ColorMatrix colorMatrix = new ColorMatrix(matrixItems);

    ImageAttributes imageAtts = new ImageAttributes();
    imageAtts.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);

    Rectangle drawRect = new Rectangle(0, 0, width, height);
    graphics.DrawImage(bitMap, drawRect, 0, 0, width, height, GraphicsUnit.Pixel, imageAtts);
  }