我不想回答我自己的问题,但我已经等了足够长的时间来获得一些反馈,所以这就是我最终要做的事情:
我选择了组件一 Silverlight Studio。1200 美元,有点贵,但效果很好。我使用 C1pdfDocument 和 C1pdfViewer 将 pdf 解决方案直接集成到我的基于 web 的 silverlight 应用程序中。用户单击一个按钮,我将 pdf 生成到内存流中并将其加载到查看器中。
得到教训:
我在绘制彩色多边形时确实遇到了一些麻烦,直到我意识到 C1pdfDocument 只需要 1.0 的不透明度,其他任何东西都显示为没有颜色。
我需要将我的 lon/lat 点转换为 x/y 坐标,并翻转垂直通道,因为我在佛罗里达(北半球)绘制形状,然后将 x/y 移动到我正在绘制的框的原点. 我花了一点时间才把它弄好,所以我想我会把它贴在这里。请注意,我没有使用很多花哨的球形或圆锥形投影,简单的转换对我的目的来说已经足够接近了。
希望这可以帮助某人。(如果是,请给我一个赞成票,嗯?)
public void AddFillPolygon(List<Point> points, Color color)
{
DrawMainPolygon(points, color, mapBorderWidth, mapBorderHeight);
}
public void AddZoomFillPolygon(List<Point> points, Color color)
{
DrawTampaPolygon(points, color);
}
private void DrawMainPolygon(List<Point> points, Color color,
double borderWidth, double borderHeight)
{
double lonMin = -87.8;
double lonMax = -79.9;
double latMin = 24.29;
double latMax = 31.11;
DrawGenericPolygon(points, color,
lonMin, lonMax,
latMin, latMax,
borderWidth, borderHeight);
}
private void DrawTampaPolygon(List<Point> points, Color color)
{
double lonMin = -82.855;
double lonMax = -82.07;
double latMin = 27.57;
double latMax = 28.175;
DrawClippedPolygon(points, color,
lonMin, lonMax,
latMin, latMax,
tampaWidth, tampaHeight, tampaCursor);
}
private void DrawGenericPolygon(List<Point> points, Color color,
double lonMin, double lonMax,
double latMin, double latMax,
double borderWidth, double borderHeight)
{
Point[] XYPoints = ConvertLatLonToXYList(points, lonMin, lonMax,
latMin, latMax, borderWidth, borderHeight, 1);
ShiftXYPointsToOrigin(XYPoints, mapBorderCursor);
pdf.FillPolygon(color, XYPoints);
pdf.DrawPolygon(new Pen(Colors.Black, 0.25), XYPoints);
}
private void DrawClippedPolygon(List<Point> points, Color color,
double lonMin, double lonMax,
double latMin, double latMax,
double borderWidth, double borderHeight,
PDFCursor clipCursor)
{
Point[] XYPoints = ConvertLatLonToXYList(points, lonMin, lonMax, latMin, latMax,
borderWidth, borderHeight, 6);
ShiftXYPointsToOrigin(XYPoints, clipCursor);
pdf.SetClipRect(new Rect(new Point(clipCursor.x, clipCursor.y),
new Size(borderWidth, borderHeight)));
pdf.FillPolygon(color, XYPoints);
pdf.DrawPolygon(new Pen(Colors.Black, 0.25), XYPoints);
pdf.ResetClipRect();
}
private static Point[] ConvertLatLonToXYList(List<Point> modifiedPoints,
double lonMinValue, double lonMaxValue,
double latMinValue, double latMaxValue,
double borderWidthX, double borderHeightY,
int roundDecimalPoints)
{
Point[] XYPoints = new Point[modifiedPoints.Count] ;
int index = 0;
foreach (var z in modifiedPoints)
{
XYPoints[index] = ConvertLatLonToXYPoint(z, lonMinValue, lonMaxValue,
latMinValue, 0.0, 0.0,
borderWidthX, borderHeightY, roundDecimalPoints);
index++;
}
return XYPoints;
}
public static Point ConvertLatLonToXYPoint(Point latlon,
double lonMinValue, double lonMaxValue, double latMinValue,
double xScaledMin, double yScaledMin,
double xScaledMax, double yScaledMax,
int roundDecimalPoints)
{
Point result = new Point();
double scale = (float)(xScaledMax - xScaledMin) / (float)(lonMaxValue - lonMinValue);
double offsetX = lonMinValue * scale - xScaledMin;
result.X = latlon.X * scale - offsetX;
// use the same scale to adjust lattitude
double offsetY = latMinValue * scale - yScaledMin;
result.Y = latlon.Y * scale - offsetY;
// The y value is inverted on the map, because lat/lon origin (for florida) is at bottom right
// x/y origin (for PDF document canvas) is at top left
// this means for y values number comes out inverted and we have to flip it
result.Y = yScaledMax * ((yScaledMax - result.Y) / yScaledMax);
return result;
//return (double)Math.Round(result, roundDecimalPoints);
}
private void ShiftXYPointsToOrigin(Point[] points, PDFCursor originCursor)
{
for (int index = 0; index < points.Length; index++)
{
points[index].X += originCursor.x;
points[index].Y += originCursor.y;
}
}