for help, to user sharpmap to draw cntour!

Sep 4, 2013 at 1:58 PM
for help, to user sharpmap to draw cntour!
I have a dll files, it can be to draw a contour line and contour area. the old version is to drawed in a pictureBox control, now I use sharpmap to draw contour, but having some trouble in the code, my problem is how to user sharpmap to draw contour in the next code
, the code as follow:

private void DrawContour_Click(object sender, EventArgs e)
    {
        Cursor = Cursors.WaitCursor;

        m_GridData = InterpolateDiscreteData(m_DiscreteData);
        TracingContourLines();
        m_ContourLines = Contour.SmoothLines(m_ContourLines);
        m_ContourLines = Contour.CutContourWithPolygon(m_ContourLines, m_CutPList);
        m_IsCutted = true;
        TracingPolygons();
        CreateLegend();

        Point[] Points = null;
        Point sPoint = default(Point);
        wContour.PointD aPoint = default(wContour.PointD);
        MapLine aMapLine = default(MapLine);
        List<PointD> newPList = new List<PointD>();
        int i = 0;
        int j = 0;
        Pen aPen = default(Pen);
        Font drawFont = new Font("Arial", 8);

        wContour.PolyLine aline = default(wContour.PolyLine);
        double aValue = 0;
        Color aColor = default(Color);
        SolidBrush aBrush = default(SolidBrush);

         if (this.CB_ColorIn.Checked)  //fill color in the polygon
   {
                    Color aBackcolor = Color.White;
                    wContour.Polygon aPolygon = default(wContour.Polygon);
            for (i = 0; i <= m_ContourPolygons.Count - 1; i++)
            {
                aPolygon = m_ContourPolygons[i];
                aline = aPolygon.OutLine;
                aValue = aPolygon.LowValue;
                aColor = m_Colors[Array.IndexOf(m_CValues, aValue) + 1];
                if (!aPolygon.IsHighCenter)
                {
                    for (j = 0; j <= m_Colors.Length - 1; j++)
                    {
                        if (aColor == m_Colors[j])
                        {
                            aColor = m_Colors[j - 1];
                        }
                    }
                }
                newPList = aline.PointList;

                for (j = 0; j <= newPList.Count - 1; j++)
                {
                    aPoint = newPList[j];
                    sPoint.X = (int)((aPoint.X - m_MinLon) * 3600 * m_scaleX);
                    sPoint.Y = (int)((m_MaxLat - aPoint.Y) * 3600 * m_scaleY);
                    Points[j] = sPoint;                        
                }
                aPen = new Pen(Color.Black);
                aPen.Color = aColor;
                aBrush = new SolidBrush(Color.Black);
                aBrush.Color = aColor;
                //to change sharpmap to draw polygon and fill color  要换成SharpMap的方法填充色
        e.Graphics.FillPolygon(aBrush, Points);


                if (this.CB_Outline.Checked)
                {
                    //to change sharpmap to draw Lines 要换成SharpMap的方法绘制等值线
           e.Graphics.DrawLines(Pens.LightGray, Points);                   
                 }

            }
        }
        else   //不填色
   {
            for (i = 0; i <= m_ContourLines.Count - 1; i++)
            {
                aline = m_ContourLines[i];
                aValue = aline.Value;
                aColor = m_Colors[Array.IndexOf(m_CValues, aValue)];
                newPList = aline.PointList;

                Points = new Point[newPList.Count];
                for (j = 0; j <= newPList.Count - 1; j++)
                {
                    aPoint = newPList[j];
                    sPoint.X = (int)((aPoint.X - m_MinLon) * 3600 * m_scaleX);
                    sPoint.Y = (int)((m_MaxLat - aPoint.Y) * 3600 * m_scaleY);
                    Points[j] = sPoint;
                }
                aPen = new Pen(Color.Black);
                aPen.Color = aColor;
                // to change sharpmap to draw line 要换成SharpMap的方法绘制等值线
        e.Graphics.DrawLines(aPen, Points);
            }
        }

        if (this.CB_Station.Checked) //绘制站点
   {
            double lon = 0;
            double lat = 0;
            double t = 0;
            for (i = 0; i <= m_DiscreteData.GetLength(1) - 1; i++)
            {
                lon = m_DiscreteData[0, i];
                lat = m_DiscreteData[1, i];
                sPoint.X = (int)((lon - m_MinLon) * 3600 * m_scaleX);
                sPoint.Y = (int)((m_MaxLat - lat) * 3600 * m_scaleY);
                t = m_DiscreteData[2, i];
                //to change sharpmap to draw 绘制小圆点 和字体
        e.Graphics.DrawEllipse(Pens.Blue, sPoint.X, sPoint.Y, 1.5f, 1.5f);
                 e.Graphics.DrawString(t.ToString("0.0"), drawFont, Brushes.Blue, sPoint.X, sPoint.Y);
            }
        }

        //---- 绘制图例板
   wContour.Legend.lPolygon aLPolygon = default(wContour.Legend.lPolygon);
        for (i = 0; i <= m_LegendPolygons.Count - 1; i++)
        {
            aLPolygon = m_LegendPolygons[i];
            aValue = aLPolygon.value;
            if (aLPolygon.isFirst)
            {
                aColor = m_Colors[0];
            }
            else
            {
                aColor = m_Colors[Array.IndexOf(m_CValues, aValue) + 1];
            }
            newPList = aLPolygon.pointList;

            Points = new Point[newPList.Count];
            for (j = 0; j <= newPList.Count - 1; j++)
            {
                aPoint = newPList[j];
                sPoint.X = (int)((aPoint.X - m_MinLon) * 3600 * m_scaleX);
                sPoint.Y = (int)((m_MaxLat - aPoint.Y) * 3600 * m_scaleY);
                Points[j] = sPoint;
            }
            aBrush = new SolidBrush(Color.Black);
            aBrush.Color = aColor;
            //  to change sharpmap to draw Polygon and fill the color  填色多边形 和 绘制
     e.Graphics.FillPolygon(aBrush, Points);
            e.Graphics.DrawPolygon(Pens.Black, Points);

            sPoint = Points[2];
            if (i < m_LegendPolygons.Count - 1)
            {
                // to change sharpmap to draw label  绘制文字 换成sharpmap 绘制
        e.Graphics.DrawString(m_CValues[i].ToString("0.0"), drawFont, Brushes.Black, sPoint.X - 10, sPoint.Y - 15);
            }
        }

        //---- Draw title
        string tStr = null;

       tStr = "Temperature of Henan province in " + m_ObsDate.ToString("yyyy-MM-dd H:00");
        sPoint.X = this.mapBox1.Width / 2 - 200;
        sPoint.Y = 20;
        drawFont = new Font("Arial", 10, FontStyle.Bold);
       // to change sharpmap to draw label
        e.Graphics.DrawString(tStr, drawFont, Brushes.Black, sPoint.X, sPoint.Y);

    }
Sep 4, 2013 at 2:00 PM
how to change sharpmap to draw contour,for help!