Search in sources :

Example 1 with TransformDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition in project kie-wb-common by kiegroup.

the class SVGTranslationTestAssertions method assertCircle.

public static void assertCircle(final CircleDefinition circleDefinition) {
    assertNotNull(circleDefinition);
    assertEquals("c1", circleDefinition.getId());
    assertEquals(1d, circleDefinition.getAlpha(), 0d);
    assertEquals(50d, circleDefinition.getX(), 0d);
    assertEquals(51d, circleDefinition.getY(), 0d);
    assertEquals(40d, circleDefinition.getRadius(), 0d);
    final TransformDefinition transformDefinition = circleDefinition.getTransformDefinition();
    assertTransformDef(transformDefinition, 0.85d, 0.67d, 4.5d, 2.39d);
    final StyleDefinition styleDefinition = circleDefinition.getStyleDefinition();
    assertStyleDef(styleDefinition, 1d, "#ff0000", 1d, "#ffff00", 1d, 5d);
}
Also used : TransformDefinition(org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition) StyleDefinition(org.kie.workbench.common.stunner.svg.gen.model.StyleDefinition)

Example 2 with TransformDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition in project kie-wb-common by kiegroup.

the class AbstractPrimitiveDefinitionGenerator method appendTransform.

protected void appendTransform(final StringBuffer buffer, final I input) {
    final TransformDefinition transformDefinition = input.getTransformDefinition();
    if (null != transformDefinition) {
        buffer.append(formatDouble(SCALE, transformDefinition.getScaleX(), transformDefinition.getScaleY()));
        buffer.append(formatDouble(TRANSLATE, transformDefinition.getTranslateX(), transformDefinition.getTranslateY()));
    }
}
Also used : TransformDefinition(org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition)

Example 3 with TransformDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition in project kie-wb-common by kiegroup.

the class SVGTranslationTestAssertions method assertRectangle.

public static void assertRectangle(final RectDefinition rectDefinition) {
    assertNotNull(rectDefinition);
    assertEquals("r1", rectDefinition.getId());
    assertEquals(1d, rectDefinition.getAlpha(), 0d);
    assertEquals(1d, rectDefinition.getX(), 0d);
    assertEquals(2d, rectDefinition.getY(), 0d);
    assertEquals(200d, rectDefinition.getWidth(), 0d);
    assertEquals(230d, rectDefinition.getHeight(), 0d);
    assertEquals(15d, rectDefinition.getCornerRadius(), 0d);
    final TransformDefinition transformDefinition = rectDefinition.getTransformDefinition();
    assertTransformDef(transformDefinition, 0.5d, 0.5d, 25d, 30d);
    final StyleDefinition styleDefinition = rectDefinition.getStyleDefinition();
    assertStyleDef(styleDefinition, 1d, "#0000ff", 1d, "#000000", 1d, 3d);
}
Also used : TransformDefinition(org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition) StyleDefinition(org.kie.workbench.common.stunner.svg.gen.model.StyleDefinition)

Example 4 with TransformDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition in project kie-wb-common by kiegroup.

the class SVGTranslationTestAssertions method assertPath.

public static void assertPath(final MultiPathDefinition pathDefinition) {
    assertEquals("M150 0 L75 200 L225 200 Z", pathDefinition.getPath());
    assertEquals("p1", pathDefinition.getId());
    assertEquals(1d, pathDefinition.getAlpha(), 0d);
    assertEquals(0d, pathDefinition.getX(), 0d);
    assertEquals(0d, pathDefinition.getY(), 0d);
    final TransformDefinition transformDefinition = pathDefinition.getTransformDefinition();
    assertTransformDef(transformDefinition, 0.25d, 0.25d, 10d, 10d);
    final StyleDefinition styleDefinition = pathDefinition.getStyleDefinition();
    assertStyleDef(styleDefinition, 1d, "#ff0000", 1d, "#0000ff", 1d, 2d);
}
Also used : TransformDefinition(org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition) StyleDefinition(org.kie.workbench.common.stunner.svg.gen.model.StyleDefinition)

Example 5 with TransformDefinition

use of org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition in project kie-wb-common by kiegroup.

the class AbstractSVGPrimitiveTranslator method translateTransforms.

protected TransformDefinition translateTransforms(final E element, final O def) throws TranslatorException {
    final TransformDefinition transformDefinition = SVGStyleTranslator.parseTransformDefinition(element);
    def.setTransformDefinition(transformDefinition);
    return transformDefinition;
}
Also used : TransformDefinition(org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition)

Aggregations

TransformDefinition (org.kie.workbench.common.stunner.svg.gen.model.TransformDefinition)5 StyleDefinition (org.kie.workbench.common.stunner.svg.gen.model.StyleDefinition)3