0

いくつかの異なるカスタム テンプレートを使用して PDF ファイルを生成するアプリケーションが必要です。

入力地理形状、ラベル、座標を定義する kmz ファイルがあります。

出力は、8 1/2" x 11" の普通紙、または 32" x 36" プロッター用である必要があります。

私のアプリケーションでは、SQLServer 空間関数にアクセスできる C# .net スタックと Web サービスを使用しています。

Web Silverlight アプリケーションの一部として実装したいのですが、別のデスクトップ アプリケーションが必要な場合はそれを使用します。

すぐに解決策が必要で、上司がその費用を負担してくれるので、商用ライブラリで問題ありません。

私の Silverlight アプリケーションはhttp://MyDistrictBuilder.FloridaRedistricting.orgにあります。

KMZ ファイルの例は、 http: //censusvalidator.blob.core.windows.net/mydistrictbuilderdata/Public%20Redistricting%20Plan%20Submissions/HPUBC0005_Kelly_Henry_KMZ.kmz にあります。

出力 PDF ファイルの例は、 http://censusvalidator.blob.core.windows.net/mydistrictbuilderdata/Public%20Redistricting%20Plan%20Submissions/HPUBC0005_Kelly_Henry_8x11.pdfにあります。

更新:
Silverlight アプリで ComponentOne C1pdf ライブラリを使用できると考えています。

  1. データベースから緯度/経度ポイントを使用して形状を取得する
  2. それらをx / y座標に変換します(これについてはよくわかりませんが、ここの他の投稿が役立つ場合があります)(適切な用紙サイズの取得についても不明です)
  3. C1pdf ドキュメントを開く
  4. C1pdf を使用してドキュメントに図形を描画します。

ComponentOne の使用経験はありますか?

4

1 に答える 1

0

私は自分自身の質問に答えるのが嫌いですが、いくつかのフィードバックを十分に待っていたので、ここに私がやったことがあります:

Component One Silverlight Studio を使用しました。1200 ドルで、少し急ですが、うまく機能します。C1pdfDocument と C1pdfViewer を使用して、PDF ソリューションを Web ベースの Silverlight アプリに統合しました。ユーザーがボタンをクリックすると、pdf がメモリ ストリームに生成され、ビューアーに読み込まれます。

学んだ教訓:

  1. C1pdfDocument が 1.0 の不透明度しかとらず、それ以外はまったく色が表示されないことに気付くまで、色付きのポリゴンの描画に少し問題がありました。

  2. 経度/緯度ポイントを 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;

        }
    }
于 2011-08-12T21:56:13.623 に答える