コード例 #1
0
    public static void addRenderInformation(RenderLayoutPlugin rPlugin)
    {
        if (rPlugin == null)
        {
            Console.WriteLine("could not add render information!");
            Environment.Exit(4);
        }

        LocalRenderInformation rInfo = rPlugin.createLocalRenderInformation();

        rInfo.setId("info");
        rInfo.setName("Example Render Information");
        rInfo.setProgramName("RenderInformation Examples");
        rInfo.setProgramVersion("1.0");

        // add some colors
        ColorDefinition color = rInfo.createColorDefinition();

        color.setId("black");
        color.setColorValue("#000000");

        color = rInfo.createColorDefinition();
        color.setId("silver");
        color.setColorValue("#c0c0c0");

        color = rInfo.createColorDefinition();
        color.setId("white");
        color.setColorValue("#FFFFFF");

        // add a linear gradient from black to white to silver
        LinearGradient gradient = rInfo.createLinearGradientDefinition();

        gradient.setId("simpleGradient");
        gradient.setPoint1(new RelAbsVector(), new RelAbsVector());
        gradient.setPoint2(new RelAbsVector(0, 100), new RelAbsVector(0, 100));

        GradientStop stop = gradient.createGradientStop();

        stop.setOffset(new RelAbsVector());
        stop.setStopColor("white");

        stop = gradient.createGradientStop();
        stop.setOffset(new RelAbsVector(0, 100));
        stop.setStopColor("silver");

        // add a species style that represents them as ellipses with the gradient above
        Style style = rInfo.createStyle("ellipseStyle");

        style.getGroup().setFillColor("simpleGradient");
        style.getGroup().setStroke("black");
        style.getGroup().setStrokeWidth(2.0);
        style.addType("SPECIESGLYPH");

        Ellipse ellipse = style.getGroup().createEllipse();

        ellipse.setCenter2D(new RelAbsVector(0, 50), new RelAbsVector(0, 50));
        ellipse.setRadii(new RelAbsVector(0, 50), new RelAbsVector(0, 50));
    }