use of org.kie.workbench.common.dmn.api.property.dimensions.Height in project kie-wb-common by kiegroup.
the class DMNMarshallerStandalone method internalAugment.
@SuppressWarnings("unchecked")
private void internalAugment(final Stream<DMNShape> drgShapeStream, final Id id, final Bound ulBound, final RectangleDimensionsSet dimensionsSet, final Bound lrBound, final StylingSet stylingSet, final DoubleConsumer decisionServiceDividerLineYSetter) {
final Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().getLocalPart().endsWith(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
final DMNShape drgShape = drgShapeOpt.get();
if (ulBound != null) {
ulBound.setX(xOfShape(drgShape));
ulBound.setY(yOfShape(drgShape));
}
dimensionsSet.setWidth(new Width(widthOfShape(drgShape)));
dimensionsSet.setHeight(new Height(heightOfShape(drgShape)));
if (lrBound != null) {
lrBound.setX(xOfShape(drgShape) + widthOfShape(drgShape));
lrBound.setY(yOfShape(drgShape) + heightOfShape(drgShape));
}
final DMNStyle dmnStyleOfDrgShape = drgShape.getStyle() instanceof DMNStyle ? (DMNStyle) drgShape.getStyle() : null;
if (dmnStyleOfDrgShape != null) {
if (null != dmnStyleOfDrgShape.getFillColor()) {
stylingSet.setBgColour(new BgColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getFillColor())));
}
if (null != dmnStyleOfDrgShape.getStrokeColor()) {
stylingSet.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getStrokeColor())));
}
}
final StylingSet fontSet = new StylingSet();
if (dmnStyleOfDrgShape != null) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN(dmnStyleOfDrgShape));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getSharedStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getSharedStyle()));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getStyle()));
}
mergeFontSet(stylingSet, fontSet);
if (drgShape.getDMNDecisionServiceDividerLine() != null) {
decisionServiceDividerLineYSetter.accept(drgShape.getDMNDecisionServiceDividerLine().getWaypoint().get(0).getY());
}
}
use of org.kie.workbench.common.dmn.api.property.dimensions.Height in project kie-wb-common by kiegroup.
the class StunnerConverter method internalAugment.
private void internalAugment(final JSIDMNShape drgShape, final Bound ulBound, final RectangleDimensionsSet dimensionsSet, final Bound lrBound, final StylingSet stylingSet, final Consumer<Double> decisionServiceDividerLineYSetter) {
if (Objects.nonNull(ulBound)) {
ulBound.setX(xOfShape(drgShape));
ulBound.setY(yOfShape(drgShape));
}
dimensionsSet.setWidth(new Width(widthOfShape(drgShape)));
dimensionsSet.setHeight(new Height(heightOfShape(drgShape)));
if (Objects.nonNull(lrBound)) {
lrBound.setX(xOfShape(drgShape) + widthOfShape(drgShape));
lrBound.setY(yOfShape(drgShape) + heightOfShape(drgShape));
}
internalAugmentStyles(drgShape, stylingSet);
if (Objects.nonNull(drgShape.getDMNDecisionServiceDividerLine())) {
final JSIDMNDecisionServiceDividerLine divider = Js.uncheckedCast(drgShape.getDMNDecisionServiceDividerLine());
final List<JSIPoint> dividerPoints = divider.getWaypoint();
final JSIPoint dividerY = Js.uncheckedCast(dividerPoints.get(0));
decisionServiceDividerLineYSetter.accept(dividerY.getY());
}
}
use of org.kie.workbench.common.dmn.api.property.dimensions.Height in project kie-wb-common by kiegroup.
the class DMNMarshaller method internalAugment.
private void internalAugment(Stream<DMNShape> drgShapeStream, Id id, Bound ul, RectangleDimensionsSet dimensionsSet, Bound lr, BackgroundSet bgset, Consumer<FontSet> fontSetSetter) {
Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().equals(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
DMNShape drgShape = drgShapeOpt.get();
((BoundImpl) ul).setX(drgShape.getBounds().getX());
((BoundImpl) ul).setY(drgShape.getBounds().getY());
dimensionsSet.setWidth(new Width(drgShape.getBounds().getWidth()));
dimensionsSet.setHeight(new Height(drgShape.getBounds().getHeight()));
((BoundImpl) lr).setX(drgShape.getBounds().getX() + drgShape.getBounds().getWidth());
((BoundImpl) lr).setY(drgShape.getBounds().getY() + drgShape.getBounds().getHeight());
if (null != drgShape.getBgColor()) {
bgset.setBgColour(new BgColour(ColorUtils.wbFromDMN(drgShape.getBgColor())));
}
if (null != drgShape.getBorderColor()) {
bgset.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(drgShape.getBorderColor())));
}
if (null != drgShape.getBorderSize()) {
bgset.setBorderSize(new BorderSize(drgShape.getBorderSize().getValue()));
}
if (null != drgShape.getFontStyle()) {
fontSetSetter.accept(FontSetPropertyConverter.wbFromDMN(drgShape.getFontStyle()));
}
}
Aggregations