- 积分
- 6782
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-9-2
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 kmdqlb 于 2015-11-17 10:40 编辑
王老师,您好!http://bbs.06climate.com/forum.php?mod=attachment&aid=NDAzODN8MWZjMWMzYTc0OTk1OWFhMWRmOTRkMzEzZWQ0NTE1ODR8MTczMjM4MDY3NQ%3D%3D&request=yes&_f=.pngattach://40383.pnghttp://bbs.06climate.com/forum.php?mod=attachment&aid=NDAzODN8MWZjMWMzYTc0OTk1OWFhMWRmOTRkMzEzZWQ0NTE1ODR8MTczMjM4MDY3NQ%3D%3D&request=yes&_f=.pngattach://40383.png
我在使用wContour.dll 时总提示出错误!请您帮我看看是哪出错了?
以下是我的代码(c#)
Bitmap b = new Bitmap(500, 500);
Graphics g = Graphics.FromImage(b);
//g.Clear(Color.White);
////
CreateDiscreteData(20);
InterpolateData(20, 20);
double[] values = new double[] { 20, 30, 40, 50, 60, 70, 80, 90 };
SetContourValues(values);
TracingContourLines();
SmoothLines();
GetEcllipseClipping();
ClipLines();
TracingPolygons();
ClipPolygons();
SetCoordinate(-10, 50, -10, 50);
int i = 0;
int j = 0;
wContour.PolyLine aline = default(wContour.PolyLine);
List<PointD> newPList = new List<PointD>();
double aValue = 0;
Color aColor = default(Color);
Pen aPen = default(Pen);
wContour.PointD aPoint = default(wContour.PointD);
Point[] Points = null;
int sX = 0;
int sY = 0;
//Draw contour polygons
List<Polygon> drawPolygons = _contourPolygons;
drawPolygons = _clipContourPolygons;
Color aBackcolor = Color.White;
SolidBrush aBrush = default(SolidBrush);
wContour.Polygon aPolygon = default(wContour.Polygon);
//Region selRegion = new Region();
GraphicsPath selPath = new GraphicsPath();
for (i = 0; i <= drawPolygons.Count - 1; i++)
{
aPolygon = drawPolygons;
aline = aPolygon.OutLine;
aValue = aPolygon.LowValue;
aColor = _colors[Array.IndexOf(_CValues, aValue) + 1];
if (!aPolygon.IsHighCenter)
{
for (j = 0; j <= _colors.Length - 1; j++)
{
if (aColor == _colors[j])
{
aColor = _colors[j - 1];
}
}
}
newPList = aline.PointList;
//if (!Contour.IsClockwise(newPList))
// newPList.Reverse();
Points = new Point[newPList.Count];
for (j = 0; j <= newPList.Count - 1; j++)
{
aPoint = newPList[j];
ToScreen(aPoint.X, aPoint.Y, ref sX, ref sY);
Points[j] = new Point(sX, sY);
}
GraphicsPath bPath = new GraphicsPath();
GraphicsPath aPath = new GraphicsPath();
aPath.AddPolygon(Points);
bPath.AddLines(Points);
//Region aRegion = new Region(aPath);
if (aPolygon.HasHoles)
{
for (int h = 0; h < aPolygon.HoleLines.Count; h++)
{
newPList = aPolygon.HoleLines[h].PointList;
//if (Contour.IsClockwise(newPList))
// newPList.Reverse();
Points = new Point[newPList.Count];
for (j = 0; j <= newPList.Count - 1; j++)
{
aPoint = newPList[j];
ToScreen(aPoint.X, aPoint.Y, ref sX, ref sY);
Points[j] = new Point(sX, sY);
}
//aPath = new GraphicsPath();
aPath.AddPolygon(Points);
GraphicsPath cPath = new GraphicsPath();
cPath.AddLines(Points);
bPath.AddPath(cPath, false);
//aRegion.Xor(aPath);
}
}
aPen = new Pen(Color.Black);
aPen.Color = aColor;
aBrush = new SolidBrush(Color.Black);
aBrush.Color = aColor;
if (i == _highlightIdx)
selPath = aPath;
//selRegion = aRegion;
//g.FillRegion(aBrush, aRegion);
g.FillPath(aBrush, aPath);
//g.DrawPath(Pens.Gray, bPath);
g.DrawPath(Pens.Black, bPath);
//g.FillPolygon(aBrush, Points);
//g.DrawLines(Pens.Gray, Points);
}
//Draw contour lines
List<PolyLine> drawLines = _contourLines;
drawLines = _clipContourLines;
for (i = 0; i <= drawLines.Count - 1; i++)
{
aline = drawLines;
aValue = aline.Value;
aColor = _colors[Array.IndexOf(_CValues, aValue)];
newPList = aline.PointList;
Points = new Point[newPList.Count];
for (j = 0; j <= newPList.Count - 1; j++)
{
aPoint = (wContour.PointD)newPList[j];
ToScreen(aPoint.X, aPoint.Y, ref sX, ref sY);
Points[j] = new Point(sX, sY);
}
aPen = new Pen(Color.Black);
aPen.Color = aColor;
g.DrawLines(aPen, Points);
}
//Draw map lines
if (_mapLines.Count > 0)
{
for (i = 0; i < _mapLines.Count; i++)
{
newPList = _mapLines;
Points = new Point[newPList.Count];
for (j = 0; j <= newPList.Count - 1; j++)
{
aPoint = newPList[j];
ToScreen(aPoint.X, aPoint.Y, ref sX, ref sY);
Points[j] = new Point(sX, sY);
}
aPen = new Pen(Color.Black);
aPen.Color = Color.Black;
g.DrawLines(aPen, Points);
//g.DrawString("0", new Font("Arial", 8), new SolidBrush(Color.Black), Points[0]);
}
}
/////
MemoryStream ms = new MemoryStream();
b.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
|
-
|