/*
    Antenna House PDF Tool API V8.0
    Java Interface sample program

    概要：各種注釈の作成

    Copyright 2025 Antenna House, Inc.
*/

package Sample;

import jp.co.antenna.ptl.PtlAnnot;
import jp.co.antenna.ptl.PtlAnnotCircle;
import jp.co.antenna.ptl.PtlAnnotFreeText;
import jp.co.antenna.ptl.PtlAnnotLine;
import jp.co.antenna.ptl.PtlAnnotPolyLine;
import jp.co.antenna.ptl.PtlAnnotPolygon;
import jp.co.antenna.ptl.PtlAnnotSquare;
import jp.co.antenna.ptl.PtlAnnots;
import jp.co.antenna.ptl.PtlColorDeviceRGB;
import jp.co.antenna.ptl.PtlDate;
import jp.co.antenna.ptl.PtlException;
import jp.co.antenna.ptl.PtlPDFDocument;
import jp.co.antenna.ptl.PtlPage;
import jp.co.antenna.ptl.PtlPages;
import jp.co.antenna.ptl.PtlParamFontAnnot;
import jp.co.antenna.ptl.PtlParamInput;
import jp.co.antenna.ptl.PtlParamOutput;
import jp.co.antenna.ptl.PtlParamTextBoxAnnot;
import jp.co.antenna.ptl.PtlPoint;
import jp.co.antenna.ptl.PtlPoints;
import jp.co.antenna.ptl.PtlRect;
import jp.co.antenna.ptl.PtlTextBoxAnnot;

public class AppendAnnotShapes {

    /**
     * @param args the command line arguments
     */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

        if (args.length < 3)
        {
			System.out.println("usage: AppendAnnotShapes.exe in-pdf-file out-pdf-file 規格");
			System.out.println("規格");
			System.out.println("1 : FreeText注釈（引き出し線あり）  2 : FreeText（引き出し線なし）注釈  3 : 円注釈");
			System.out.println("4 : 矩形注釈  5 : ライン注釈  6 : 折れ線注釈  7 : 多角形注釈");
            return;
        }

        try (PtlParamInput inputFile = new PtlParamInput(args[0]);
             PtlParamOutput outputFile = new PtlParamOutput(args[1]);
             PtlPDFDocument doc = new PtlPDFDocument())
        {
            // PDFファイルをロードします。
            doc.load(inputFile);

            try (PtlPages pages = doc.getPages()) // ページコンテナの取得
            {
                // ページコンテナが空かどうか
                if (pages.isEmpty())
                {
                    System.out.println("ページコンテナが空\n");
                    return;
                }

                try (PtlPage page = pages.get(0)) // 1ページ目の取得
                {
            		int kind = Integer.parseInt(args[2]);
            		switch (kind) {
            		case 1:
            			// FreeText注釈（引き出し線あり）の追加		
            			addAnnotFreeText(page, true);
            			break;
            		case 2:
            			// FreeText注釈（引き出し線なし）の追加		
            			addAnnotFreeText(page, false);
            			break;
            		case 3:
            			// 円注釈の追加
            			addAnnotCircle(page);
            			break;
            		case 4:
            			// 矩形注釈の追加
            			addAnnotSquare(page);
            			break;
            		case 5:
            			// ライン注釈の追加
            			addAnnotLine(page);
            			break;
            		case 6:
            			// 折れ線注釈の追加
            			addAnnotPolyLine(page);
            			break;
            		case 7:
            			// 多角形注釈の追加
            			addAnnotPolygone(page);
            			break;
            		default:
            			System.out.println("usage: AppendAnnotShapes.exe in-pdf-file out-pdf-file 規格");
            			System.out.println("規格");
            			System.out.println("1 : FreeText注釈（引き出し線あり）  2 : FreeText（引き出し線なし）注釈  3 : 円注釈");
            			System.out.println("4 : 矩形注釈  5 : ライン注釈  6 : 折れ線注釈  7 : 多角形注釈");
            			return;
            		}
                }
            }

            // ファイルに保存します。
            doc.save(outputFile);
        }
        catch (PtlException pex) {
            System.out.println("PtlException : ErrorCode = " + pex.getErrorCode() + "\n  " + pex.getErrorMessage());
        }
        catch (Exception ex) {
            System.out.println(ex.getMessage());
            ex.printStackTrace();
        }
        catch (Error ex) {
            System.out.println(ex.getMessage());
            ex.printStackTrace();
        }
        finally {
            System.out.println("-- 完了 --");
        }
	}

    public static void addAnnotFreeText(PtlPage page, boolean on) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
             PtlAnnotFreeText annotFreeText = new PtlAnnotFreeText();	// フリーテキスト注釈
             PtlRect rectAnnot = new PtlRect(50.0f, 100.0f, 95.0f, 150.0f);
             PtlTextBoxAnnot textBox = new PtlTextBoxAnnot();                   // テキストボックス
             PtlParamTextBoxAnnot paramTextBox1 = new PtlParamTextBoxAnnot();   // テキストボックスに書く文字のパラメータ1
             PtlParamTextBoxAnnot paramTextBox2 = new PtlParamTextBoxAnnot();   // テキストボックスに書く文字のパラメータ2
             PtlParamTextBoxAnnot paramTextBox3 = new PtlParamTextBoxAnnot();   // テキストボックスに書く文字のパラメータ3
             PtlParamTextBoxAnnot paramTextBox4 = new PtlParamTextBoxAnnot();   // テキストボックスに書く文字のパラメータ4
             PtlColorDeviceRGB colorRed =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f);
             PtlColorDeviceRGB colorBlue =  new PtlColorDeviceRGB(0.0f, 0.0f, 1.0f);
             PtlColorDeviceRGB colorBlack =  new PtlColorDeviceRGB(0.0f, 0.0f, 0.0f);
             PtlParamFontAnnot font1 = new PtlParamFontAnnot("ＭＳ ゴシック", 12.0f, false, false);
             PtlParamFontAnnot font2 = new PtlParamFontAnnot("ＭＳ 明朝", 20.0f, false, false);
             PtlParamFontAnnot font3 = new PtlParamFontAnnot("ＭＳ Ｐ明朝", 20.0f, true, true);
             PtlParamFontAnnot font4 = new PtlParamFontAnnot("ＭＳ 明朝", 10.0f, false, true);
                  ) 
        {
            // 矩形座標を設定 座標の単位はmmで原点(0,0)は左下
            annotFreeText.setTextBoxRect(rectAnnot);

            // 色を設定
            annotFreeText.setColor(colorRed);

            // 内部色を設定
            annotFreeText.setInteriorColor(colorBlue);

        	// 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
        	annotFreeText.setTextContents("フリーテキスト注釈サンプル");
            
            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotFreeText.setDate(date);
            }

            // ポップアップウィンドウのタイトル文字列設定
            annotFreeText.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotFreeText.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotFreeText.setMarkUpDate(date);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotFreeText.setMarkUpCA(0.8f);
 
            // テキストボックスに書く文字のパラメータ1の設定
            paramTextBox1.setFont(font1);
            paramTextBox1.setTextColor(colorRed);

            // テキストボックスに書く文字のパラメータ2の設定
            paramTextBox2.setFont(font2);
            paramTextBox2.setTextColor(colorBlack);
            paramTextBox2.setUnderline(true);

            // テキストボックスに書く文字のパラメータ3の設定
            paramTextBox3.setFont(font3);
            paramTextBox3.setTextColor(colorBlack);
            paramTextBox3.setStrikeOut(true);

            // テキストボックスに書く文字のパラメータ4の設定
            paramTextBox4.setFont(font4);
            paramTextBox4.setTextColor(colorBlack);

            // テキストボックスへテキスト書き込み
            textBox.writeStringNL("あいうえお", paramTextBox1);
            textBox.writeStringNL("かきくけこ", paramTextBox2);
            textBox.writeString("さしすせそ", paramTextBox1);
            textBox.writeString("たちつてと", paramTextBox3);
            textBox.writeStringNL("なにぬねの", paramTextBox4);

            // フリーテキスト注釈にテキストボックスを設定
            annotFreeText.setTextBox(textBox);

            if(on) {
                // 引き出し線の設定
                try (PtlPoints points = annotFreeText.getCalloutPoints())
                {
                    points.append(150.0f, 70.0f);
                    points.append(130.0f,125.0f);
                    points.append(95.0f,125.0f);
                }
                // 引き出し線の線端
                annotFreeText.setLineEndingStyle(PtlAnnotFreeText.LINE_ENDING_STYLE.STYLE_OPEN_ARROW);
            }

            // 注釈の追加
            annots.append(annotFreeText);
        }
    }


    public static void addAnnotCircle(PtlPage page) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
            PtlAnnotCircle annotCircle = new PtlAnnotCircle()) // 円形注釈
        {
            // 矩形座標を設定 座標の単位はmmで原点(0,0)は左下
            try (PtlRect rectAnnot = new PtlRect(50.0f, 100.0f, 100.0f, 150.0f))
            {
                annotCircle.setRect(rectAnnot);
            }

            // 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
            annotCircle.setTextContents("円形注釈サンプル");

            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotCircle.setDate(date);
            }

            // 注釈フラグを設定（論理和） FLAG_NOROTATE = 0x00000010, /* 注釈の外観をページにあわせて回転しません。 */
            annotCircle.setAnnotFlags(PtlAnnot.FLAG_NOROTATE);

            // 色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f))
            {
                annotCircle.setColor(color);
            }

            // 内部色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 1.0f, 0.0f))
            {
                annotCircle.setInteriorColor(color);
            }

            // 境界線スタイルを設定 BORDER_SOLID = 1, /* 実線(注釈を囲む実線の矩形) */
            annotCircle.setBorderStyle(PtlAnnot.BORDER_STYLE.BORDER_SOLID);

            // 境界線幅を設定 BORDER_WIDTH_THIN = 1, /* 細い */
            annotCircle.setBorderWidth(PtlAnnot.BORDER_LINE_WIDTH.BORDER_WIDTH_THIN);

            // ポップアップウィンドウのタイトル文字列設定
            annotCircle.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotCircle.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate dateMarkup = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotCircle.setMarkUpDate(dateMarkup);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotCircle.setMarkUpCA(0.8f);

            // 注釈の追加
            annots.append(annotCircle);
        }
    }

    
    public static void addAnnotSquare(PtlPage page) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
            PtlAnnotSquare annotSquare = new PtlAnnotSquare()) // 矩形注釈
        {
            // 矩形座標を設定 座標の単位はmmで原点(0,0)は左下
            try (PtlRect rectAnnot = new PtlRect(50.0f, 100.0f, 100.0f, 150.0f))
            {
                annotSquare.setRect(rectAnnot);
            }

            // 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
            annotSquare.setTextContents("矩形注釈サンプル");

            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotSquare.setDate(date);
            }

            // 注釈フラグを設定（論理和） FLAG_NOROTATE = 0x00000010, /* 注釈の外観をページにあわせて回転しません。 */
            annotSquare.setAnnotFlags(PtlAnnot.FLAG_NOROTATE);

            // 色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f))
            {
                annotSquare.setColor(color);
            }

            // 内部色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 1.0f, 0.0f))
            {
                annotSquare.setInteriorColor(color);
            }

            // 境界線スタイルを設定 BORDER_SOLID = 1, /* 実線(注釈を囲む実線の矩形) */
            annotSquare.setBorderStyle(PtlAnnot.BORDER_STYLE.BORDER_SOLID);

            // 境界線幅を設定 BORDER_WIDTH_THIN = 1, /* 細い */
            annotSquare.setBorderWidth(PtlAnnot.BORDER_LINE_WIDTH.BORDER_WIDTH_THIN);

            // ポップアップウィンドウのタイトル文字列設定
            annotSquare.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotSquare.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate dateMarkup = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotSquare.setMarkUpDate(dateMarkup);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotSquare.setMarkUpCA(0.8f);

            // 注釈の追加
            annots.append(annotSquare);
        }
    }
    
    
    public static void addAnnotLine(PtlPage page) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
            PtlAnnotLine annotLine = new PtlAnnotLine()) // ライン注釈
        {
            try (PtlPoint pointStart = new PtlPoint(0.0f, 100.0f);
                PtlPoint pointEnd = new PtlPoint(100.0f, 200.0f))
            {
                // 開始点の設定 座標の単位はmmで原点(0,0)は左下
                annotLine.setStartPoint(pointStart);
                // 終了点の設定 座標の単位はmmで原点(0,0)は左下
                annotLine.setEndPoint(pointEnd);
            }

            // 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
            annotLine.setTextContents("ライン注釈サンプル");

            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotLine.setDate(date);
            }

            // 注釈フラグを設定（論理和） FLAG_NOROTATE = 0x00000010, /* 注釈の外観をページにあわせて回転しません。 */
            annotLine.setAnnotFlags(PtlAnnot.FLAG_NOROTATE);

            // 色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f))
            {
                annotLine.setColor(color);
            }

            // 境界線スタイルを設定 BORDER_SOLID = 1, /* 実線(注釈を囲む実線の矩形) */
            annotLine.setBorderStyle(PtlAnnot.BORDER_STYLE.BORDER_SOLID);

            // 境界線幅を設定 BORDER_WIDTH_THIN = 1, /* 細い */
            annotLine.setBorderWidth(PtlAnnot.BORDER_LINE_WIDTH.BORDER_WIDTH_THIN);
            
            // キャプション設定
            annotLine.setCaptionPosition(PtlAnnotLine.CAPTION_POSITION.POSITION_TOP);
            annotLine.setViewCaption(true);
            annotLine.setHorizontalOffset(30.0f);
            annotLine.setVerticalOffset(10.0f);
            
            // 線端スタイル設定
            annotLine.setLineStartPointStyle(PtlAnnotLine.LINE_ENDING_STYLE.STYLE_R_OPEN_ARROW);
            annotLine.setLineEndPointStyle(PtlAnnotLine.LINE_ENDING_STYLE.STYLE_DIAMOND);

            // 引き出し線
            annotLine.setLeaderLinesLength(-20.0f);
            annotLine.setExtensionLeaderLines(50.0f);

            // 引き出し線オフセット
            annotLine.setLeaderLinesOffset(20.0f);
            
            // ポップアップウィンドウのタイトル文字列設定
            annotLine.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotLine.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate dateMarkup = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotLine.setMarkUpDate(dateMarkup);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotLine.setMarkUpCA(0.8f);

            // 注釈の追加
            annots.append(annotLine);
        }
    }
    

    public static void addAnnotPolyLine(PtlPage page) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
            PtlAnnotPolyLine annotPolyLine = new PtlAnnotPolyLine()) // 折れ線注釈
        {
            // 座標を設定 座標の単位はmmで原点(0,0)は左下
            try (PtlPoints points = annotPolyLine.getVertices();
                PtlPoint point1 = new PtlPoint(92.0f, 123.0f);
                PtlPoint point2 = new PtlPoint(96.0f, 117.0f);
                PtlPoint point3 = new PtlPoint(103.0f, 121.0f);
                PtlPoint point4 = new PtlPoint(115.0f, 119.0f);
                PtlPoint point5 = new PtlPoint(121.0f, 112.0f);
                PtlPoint point6 = new PtlPoint(130.0f, 113.0f);
                PtlPoint point7 = new PtlPoint(121.0f, 122.0f);
                PtlPoint point8 = new PtlPoint(90.0f, 126.0f);
                PtlPoint point9 = new PtlPoint(86.0f, 124.0f);
                PtlPoint point10 = new PtlPoint(89.0f, 116.0f))
            {
                points.append(point1);
                points.append(point2);
                points.append(point3);
                points.append(point4);
                points.append(point5);
                points.append(point6);
                points.append(point7);
                points.append(point8);
                points.append(point9);
                points.append(point10);
            }

            // 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
            annotPolyLine.setTextContents("折れ線注釈サンプル");

            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotPolyLine.setDate(date);
            }

            // 注釈フラグを設定（論理和） FLAG_NOROTATE = 0x00000010, /* 注釈の外観をページにあわせて回転しません。 */
            annotPolyLine.setAnnotFlags(PtlAnnot.FLAG_NOROTATE);

            // 色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f))
            {
                annotPolyLine.setColor(color);
            }

            // 境界線スタイルを設定 BORDER_SOLID = 1, /* 実線(注釈を囲む実線の矩形) */
            annotPolyLine.setBorderStyle(PtlAnnot.BORDER_STYLE.BORDER_SOLID);

            // 境界線幅を設定 BORDER_WIDTH_THIN = 1, /* 細い */
            annotPolyLine.setBorderWidth(PtlAnnot.BORDER_LINE_WIDTH.BORDER_WIDTH_THIN);

            // ポップアップウィンドウのタイトル文字列設定
            annotPolyLine.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotPolyLine.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate dateMarkup = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotPolyLine.setMarkUpDate(dateMarkup);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotPolyLine.setMarkUpCA(0.8f);

            // 注釈の追加
            annots.append(annotPolyLine);
        }
    }


    public static void addAnnotPolygone(PtlPage page) throws PtlException, Exception, Error
    {
        try (PtlAnnots annots = page.getAnnots(); // 注釈コンテナの取得
        PtlAnnotPolygon annotPolygon = new PtlAnnotPolygon()) // 折れ線注釈
        {
            // 座標を設定 座標の単位はmmで原点(0,0)は左下
            try (PtlPoints points = annotPolygon.getVertices();
                PtlPoint point1 = new PtlPoint(92.0f, 123.0f);
                PtlPoint point2 = new PtlPoint(96.0f, 117.0f);
                PtlPoint point3 = new PtlPoint(103.0f, 121.0f);
                PtlPoint point4 = new PtlPoint(115.0f, 119.0f);
                PtlPoint point5 = new PtlPoint(121.0f, 112.0f);
                PtlPoint point6 = new PtlPoint(130.0f, 113.0f);
                PtlPoint point7 = new PtlPoint(121.0f, 122.0f);
                PtlPoint point8 = new PtlPoint(90.0f, 126.0f);
                PtlPoint point9 = new PtlPoint(86.0f, 124.0f);
                PtlPoint point10 = new PtlPoint(89.0f, 116.0f))
            {
                points.append(point1);
                points.append(point2);
                points.append(point3);
                points.append(point4);
                points.append(point5);
                points.append(point6);
                points.append(point7);
                points.append(point8);
                points.append(point9);
                points.append(point10);
            }

            // 内容を設定（注釈用に表示されるテキスト・可読な形式での注釈コンテンツの代替説明）
            annotPolygon.setTextContents("多角形注釈サンプル");

            // 日時の設定(2025/01/01 00:00:00)
            try (PtlDate date = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotPolygon.setDate(date);
            }

            // 注釈フラグを設定（論理和） FLAG_NOROTATE = 0x00000010, /* 注釈の外観をページにあわせて回転しません。 */
            annotPolygon.setAnnotFlags(PtlAnnot.FLAG_NOROTATE);

            // 色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 0.0f, 0.0f))
            {
                annotPolygon.setColor(color);
            }

            // 内部色を設定
            try (PtlColorDeviceRGB color =  new PtlColorDeviceRGB(1.0f, 1.0f, 0.0f))
            {
                annotPolygon.setInteriorColor(color);
            }

            // 境界線スタイルを設定 BORDER_SOLID = 1, /* 実線(注釈を囲む実線の矩形) */
            annotPolygon.setBorderStyle(PtlAnnot.BORDER_STYLE.BORDER_SOLID);

            // 境界線幅を設定 BORDER_WIDTH_THIN = 1, /* 細い */
            annotPolygon.setBorderWidth(PtlAnnot.BORDER_LINE_WIDTH.BORDER_WIDTH_THIN);

            // ポップアップウィンドウのタイトル文字列設定
            annotPolygon.setMarkUpTitle("Antenna House");

            // サブジェクトの短い説明設定
            annotPolygon.setMarkUpSubj("サブジェクトの短い説明");

            // 注釈生成日時の設定(2025/01/01 00:00:00)
            try (PtlDate dateMarkup = new PtlDate(2025, 1, 1, 0, 0, 0))
            {
                annotPolygon.setMarkUpDate(dateMarkup);
            }

            // 不透明度を設定 0.0 ～ 1.0。0.0が透明、1.0が不透明
            annotPolygon.setMarkUpCA(0.8f);

            // 注釈の追加
            annots.append(annotPolygon);
        }
    }

}
