Example usage for com.google.gwt.canvas.dom.client Context2d setLineWidth

List of usage examples for com.google.gwt.canvas.dom.client Context2d setLineWidth

Introduction

In this page you can find the example usage for com.google.gwt.canvas.dom.client Context2d setLineWidth.

Prototype

public final native void setLineWidth(double lineWidth) ;

Source Link

Document

Sets the line-width.

Usage

From source file:com.kk_electronic.kkportal.debug.modules.UsageGraph.java

License:Open Source License

@Inject
public UsageGraph(CpuUsage model) {
    Context2d context = canvas.getContext2d();
    model.addDisplay(this);
    context.setLineWidth(1);
    context.setStrokeStyle("black");
    canvas.getElement().getStyle().setBorderWidth(borderSize, Unit.PX);
    canvas.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
    canvas.getElement().getStyle().setBorderColor(borderColor);

    context.beginPath();//from ww  w.  j a va2s. co  m
    context.moveTo(1, 1);
    context.lineTo(1, 50);
    context.lineTo(100, 50);
    context.lineTo(50, 1);
    context.closePath();
    context.stroke();
    timer.scheduleRepeating(100);
}

From source file:com.mecatran.otp.gwt.client.view.ItineraryDetailsWidget.java

License:Open Source License

/**
 * Build the background image for the widget, according to the mode. Draw
 * the mode image and a solid line below it with the route color (if in
 * transit mode) or a dotted line (if in road mode). Set the
 * background-image to the generated image for the given widget.
 *///from w  w  w .  j av  a  2 s  .  com
public static void styleComponentWithMode(final Widget widget, TransportMode mode, String color) {
    PlannerResources resources = PlannerResources.INSTANCE;
    ImageResource baseImage = null;
    boolean road = false;
    switch (mode) {
    case WALK:
        road = true;
        color = "#666666";
        baseImage = resources.modeWalkPng();
        break;
    case BICYCLE:
        road = true;
        color = "#23C30B";
        baseImage = resources.modeBicyclePng();
        break;
    case BICYCLE_RENTAL:
        road = true;
        color = "#23C30B";
        baseImage = resources.modeBikeRentalPng();
        break;
    case CAR:
        road = true;
        color = "#333333";
        baseImage = resources.modeCarPng();
        break;
    default:
    case BUS:
        baseImage = resources.modeBusPng();
        break;
    case TRAM:
        baseImage = resources.modeTramPng();
        break;
    case FERRY:
        baseImage = resources.modeFerryPng();
        break;
    case GONDOLA:
        baseImage = resources.modeGondolaPng();
        break;
    case PLANE:
        baseImage = resources.modePlanePng();
        break;
    case RAIL:
        baseImage = resources.modeRailPng();
        break;
    case SUBWAY:
        baseImage = resources.modeSubwayPng();
        break;
    case TROLLEY:
        baseImage = resources.modeTrolleyPng();
        break;
    }
    final String url = baseImage.getSafeUri().asString();
    final Canvas canvas = Canvas.createIfSupported();
    if (canvas != null) {
        int width = baseImage.getWidth();
        int height = 1000;
        canvas.setCoordinateSpaceWidth(width);
        canvas.setCoordinateSpaceHeight(height);
        final Context2d context = canvas.getContext2d();
        context.setLineCap(LineCap.BUTT);
        if (road) {
            context.setStrokeStyle(CssColor.make(color));
            context.setLineWidth(4);
            for (int y = baseImage.getHeight(); y < 1000; y += 7) {
                context.moveTo(width / 2, y);
                context.lineTo(width / 2, y + 5);
            }
            context.stroke();
        } else {
            context.setStrokeStyle(CssColor.make("#000000"));
            context.setLineWidth(5);
            context.moveTo(width / 2, 0);
            context.lineTo(width / 2, height - 1);
            context.stroke();
            context.setStrokeStyle(CssColor.make(color));
            context.setLineWidth(4);
            context.moveTo(width / 2, 0);
            context.lineTo(width / 2, height - 1);
            context.stroke();
        }
        /*
         * HACK ALERT! Image.onLoad event does not fire up when using
         * internal resources (URL is internal data), but using the image
         * immediately does not work (image does not seems to be ready). We
         * defer the processing of the image rendering to a timer delayed a
         * bit.
         */
        Timer timer = new Timer() {
            @Override
            public void run() {
                Image image = new Image(url);
                ImageElement e = ImageElement.as(image.getElement());
                context.drawImage(e, 0, 0);
                String url2 = canvas.toDataUrl("image/png");
                widget.getElement().getStyle().setBackgroundImage("url('" + url2 + "')");
            }
        };
        timer.schedule(500);
    } else {
        widget.getElement().getStyle().setBackgroundImage("url('" + url + "')");
    }
}

From source file:com.philbeaudoin.quebec.client.scene.Arrow.java

License:Apache License

@Override
public void drawUntransformed(double time, Context2d context) {
    context.beginPath();/*from w w w .  ja va  2 s  . com*/
    context.moveTo(from.getX(), from.getY());
    context.bezierCurveTo(p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY());
    context.lineTo(p4.getX(), p4.getY());
    context.lineTo(to.getX(), to.getY());
    context.lineTo(p5.getX(), p5.getY());
    context.lineTo(p6.getX(), p6.getY());
    context.bezierCurveTo(p2.getX(), p2.getY(), p1.getX(), p1.getY(), from.getX(), from.getY());
    context.setLineWidth(0.0045);
    context.setStrokeStyle("#aaa");
    context.stroke();
    context.setLineWidth(0.001);
    context.setStrokeStyle("#000");
    context.stroke();
    context.fill();
}

From source file:com.philbeaudoin.quebec.client.scene.Callout.java

License:Apache License

@Override
public void drawUntransformed(double time, Context2d context) {
    context.beginPath();//ww  w.  ja va  2  s  .c om
    context.moveTo(p1.getX(), p1.getY());
    context.lineTo(to.getX(), to.getY());
    context.lineTo(p3.getX(), p3.getY());
    context.lineTo(p1.getX(), p1.getY());
    context.setLineWidth(0.002);
    context.setStrokeStyle("#000");
    context.stroke();
    context.setFillStyle("#aaa");
    context.fill();
}

From source file:com.philbeaudoin.quebec.client.scene.Rectangle.java

License:Apache License

@Override
public void drawUntransformed(double time, Context2d context) {
    CanvasGradient gradient = context.createLinearGradient(x0, y0, x0, y1);
    gradient.addColorStop(0, color0);//from  www  .jav a2 s .  c om
    gradient.addColorStop(1, color1);
    context.setFillStyle(gradient);
    context.fillRect(x0, y0, w, h);
    if (strokeColor != null && strokeWidth > 0) {
        context.setStrokeStyle(strokeColor);
        context.setLineWidth(strokeWidth);
        context.strokeRect(ox0, oy0, ow, oh);
    }
}

From source file:com.sencha.gxt.chart.client.draw.engine.Canvas2d.java

License:sencha.com license

/**
 * In the Canvas2d class, this method does more or less what renderSprite does in SVG and VML - it
 * actually renders the sprite to the dom.
 * @param sprite the sprite to draw/* ww w  .  jav  a2  s. co  m*/
 */
protected void append(Sprite sprite) {
    if (sprite.isHidden() || sprite.getOpacity() == 0) {
        return;
    }
    Context2d ctx = getContext();
    ctx.save();
    //set global stuff, fill, stroke, clip, etc

    //clip - deal with translation or normal rectangle
    if (sprite.getClipRectangle() != null) {
        PreciseRectangle clip = sprite.getClipRectangle();
        if (sprite.getScaling() != null || sprite.getTranslation() != null || sprite.getRotation() != null) {
            PathSprite transPath = new PathSprite(new RectangleSprite(clip));
            transPath = transPath.map(sprite.transformMatrix());
            appendPath(ctx, transPath);
        } else {
            ctx.beginPath();
            ctx.rect(clip.getX(), clip.getY(), clip.getWidth(), clip.getHeight());
            ctx.closePath();
        }
        ctx.clip();
    }

    if (sprite.getScaling() != null || sprite.getTranslation() != null || sprite.getRotation() != null
            || (component.isViewBox() && viewbox != null)) {
        Matrix matrix = sprite.transformMatrix();
        if (matrix != null) {
            //TODO consider replacing this transform call with three distinct calls to translate/scale/rotate if cheaper
            ctx.transform(matrix.get(0, 0), matrix.get(1, 0), matrix.get(0, 1), matrix.get(1, 1),
                    matrix.get(0, 2), matrix.get(1, 2));
        }
        if (component.isViewBox() && viewbox != null) {
            double size = Math.min(getWidth() / viewbox.getWidth(), getHeight() / viewbox.getHeight());

            ctx.scale(size, size);
            ctx.translate(-viewbox.getX(), -viewbox.getY());
        }
    }

    //TODO see about caching colors via the dirty flag? If we don't use a color/gradient for a pass or three, dump it
    double opacity = Double.isNaN(sprite.getOpacity()) ? 1.0 : sprite.getOpacity();
    PreciseRectangle untransformedBbox = sprite.getPathSprite().dimensions();
    if (sprite.getStroke() != null && sprite.getStroke() != Color.NONE && sprite.getStrokeWidth() != 0) {
        ctx.setLineWidth(Double.isNaN(sprite.getStrokeWidth()) ? 1.0 : sprite.getStrokeWidth());
        ctx.setStrokeStyle(getColor(sprite.getStroke(), untransformedBbox));//TODO read bbox from cache
    }
    if (sprite.getFill() != null && sprite.getFill() != Color.NONE) {
        ctx.setFillStyle(getColor(sprite.getFill(), untransformedBbox));//TODO read bbox from cache
    }

    if (sprite instanceof PathSprite) {
        appendPath(ctx, (PathSprite) sprite);
    } else if (sprite instanceof TextSprite) {
        TextSprite text = (TextSprite) sprite;
        //TODO style and weight
        ctx.setFont(text.getFontSize() + "px " + text.getFont());
        ctx.setTextAlign(getTextAlign(text.getTextAnchor()));
        ctx.setTextBaseline(getTextBaseline(text.getTextBaseline()));
        ctx.fillText(text.getText(), text.getX(), text.getY());
    } else if (sprite instanceof RectangleSprite) {
        RectangleSprite rect = (RectangleSprite) sprite;
        if (Double.isNaN(rect.getRadius()) || rect.getRadius() == 0) {
            if (sprite.getFill() != null && sprite.getFill() != Color.NONE) {
                ctx.setGlobalAlpha(
                        Double.isNaN(sprite.getFillOpacity()) ? opacity : opacity * sprite.getFillOpacity());
                ctx.fillRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
            }
            if (sprite.getStroke() != null && sprite.getStroke() != Color.NONE
                    && sprite.getStrokeWidth() != 0) {
                ctx.setGlobalAlpha(Double.isNaN(sprite.getStrokeOpacity()) ? opacity
                        : opacity * sprite.getStrokeOpacity());
                ctx.strokeRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
            }
        } else {
            appendPath(ctx, rect.getPathSprite());
        }
    } else if (sprite instanceof CircleSprite) {
        CircleSprite circle = (CircleSprite) sprite;
        ctx.beginPath();
        ctx.arc(circle.getCenterX(), circle.getCenterY(), circle.getRadius(), 0, 2 * Math.PI);
        ctx.closePath();
        if (sprite.getFill() != null && sprite.getFill() != Color.NONE) {
            ctx.setGlobalAlpha(
                    Double.isNaN(sprite.getFillOpacity()) ? opacity : opacity * sprite.getFillOpacity());
            ctx.fill();
        }
        if (sprite.getStroke() != null && sprite.getStroke() != Color.NONE && sprite.getStrokeWidth() != 0) {
            ctx.setGlobalAlpha(
                    Double.isNaN(sprite.getStrokeOpacity()) ? opacity : opacity * sprite.getStrokeOpacity());
            ctx.stroke();
        }
    } else if (sprite instanceof EllipseSprite) {
        appendPath(ctx, sprite.getPathSprite());
    } else if (sprite instanceof ImageSprite) {
        ImageSprite image = (ImageSprite) sprite;
        ImageElement elt = Document.get().createImageElement();
        elt.setSrc(image.getResource().getSafeUri().asString());
        ctx.drawImage(elt, image.getX(), image.getY(), image.getWidth(), image.getHeight());
    }

    ctx.restore();

    if (!REDRAW_ALL) {
        renderedBbox.put(sprite, getBBox(sprite));
    }

    sprite.clearDirtyFlags();
}

From source file:edu.umb.jsPedigrees.client.Pelican.PelicanLines.java

License:Open Source License

public static Canvas drawLines(AbsolutePanel panel) {

    Canvas canvas = Canvas.createIfSupported();
    Context2d ctx = canvas.getContext2d();

    canvas.setCoordinateSpaceHeight(panel.getOffsetHeight());
    canvas.setCoordinateSpaceWidth(panel.getOffsetWidth());

    ctx.setStrokeStyle(CssColor.make("0,0,0"));
    ctx.setLineWidth(1.0f);
    ctx.setFont("12px sans-serif");

    int fontHeight = 15;
    int fontAscent = 15;

    int dropSize = Math.max(2, Math.min(PelicanPerson.symbolSize / 2,
            3 * (PelicanPerson.ySpace - PelicanPerson.symbolSize - fontHeight) / 4));
    for (int i = 0; i < panel.getWidgetCount(); i++)
        if (panel.getWidget(i) instanceof PelicanPerson) {
            // draw a line from this person to its parents
            PelicanPerson person = (PelicanPerson) panel.getWidget(i);
            if (person.father != null && person.mother != null) {
                //System.out.println("HERE "+String.valueOf(i));
                // find the mother and father
                PelicanPerson father = person.father;
                PelicanPerson mother = person.mother;
                if (father != null && mother != null) {
                    // line between parents
                    int fatherX = panel.getWidgetLeft(father)
                            + ((panel.getWidgetLeft(father) < panel.getWidgetLeft(mother))
                                    ? PelicanPerson.symbolSize
                                    : 0);
                    int motherX = panel.getWidgetLeft(mother)
                            + ((panel.getWidgetLeft(mother) < panel.getWidgetLeft(father))
                                    ? PelicanPerson.symbolSize
                                    : 0);
                    int fatherY = panel.getWidgetTop(father) + PelicanPerson.symbolSize / 2;
                    int motherY = panel.getWidgetTop(mother) + PelicanPerson.symbolSize / 2;
                    int leftX = fatherX;
                    int leftY = fatherY;
                    int rightX = motherX;
                    int rightY = motherY;
                    if (motherX < fatherX) {
                        leftX = motherX;
                        leftY = motherY;
                        rightX = fatherX;
                        rightY = fatherY;
                    }// w  w w.ja va  2  s  .c o  m
                    int gap = PelicanPerson.xSpace - PelicanPerson.symbolSize;
                    // see if any subjects lie between the father and mother
                    if (!adjacent(panel, father, mother) && father.generation == mother.generation) {
                        // draw lines which avoid other symbols

                        // g2.drawLine(leftX,leftY,leftX+gap/4,leftY);
                        ctx.beginPath();
                        ctx.moveTo(leftX, leftY);
                        ctx.lineTo(leftX + gap / 4, leftY);
                        ctx.closePath();
                        ctx.stroke();

                        // g2.drawLine(rightX,rightY,rightX-gap/2,rightY);
                        ctx.beginPath();
                        ctx.moveTo(rightX, rightY);
                        ctx.lineTo(rightX - gap / 2, rightY);
                        ctx.closePath();
                        ctx.stroke();

                        leftX += gap / 4;
                        rightX -= gap / 2;

                        // g2.drawLine(leftX,leftY,leftX,leftY-(PelicanPerson.symbolSize+dropSize)/2);
                        ctx.beginPath();
                        ctx.moveTo(leftX, leftY);
                        ctx.lineTo(leftX, leftY - (PelicanPerson.symbolSize + dropSize) / 2);
                        ctx.closePath();
                        ctx.stroke();

                        // g2.drawLine(rightX,rightY,rightX,rightY-(PelicanPerson.symbolSize+dropSize)/2);
                        ctx.beginPath();
                        ctx.moveTo(rightX, rightY);
                        ctx.lineTo(rightX, rightY - (PelicanPerson.symbolSize + dropSize) / 2);
                        ctx.closePath();
                        ctx.stroke();

                        leftY -= (PelicanPerson.symbolSize + dropSize) / 2;
                        rightY -= (PelicanPerson.symbolSize + dropSize) / 2;
                    }

                    // g2.drawLine(leftX,leftY,rightX,rightY);
                    ctx.beginPath();
                    ctx.moveTo(leftX, leftY);
                    ctx.lineTo(rightX, rightY);
                    ctx.closePath();
                    ctx.stroke();

                    // line up from child
                    // g2.drawLine(person.getX()+PelicanPerson.symbolSize/2,person.getY(),person.getX()+PelicanPerson.symbolSize/2,person.getY()-dropSize);
                    ctx.beginPath();
                    ctx.moveTo(panel.getWidgetLeft(person) + PelicanPerson.symbolSize / 2,
                            panel.getWidgetTop(person));
                    ctx.lineTo(panel.getWidgetLeft(person) + PelicanPerson.symbolSize / 2,
                            panel.getWidgetTop(person) - dropSize);
                    ctx.closePath();
                    ctx.stroke();

                    // line across from child
                    // try to attach to an orphan parent
                    int parentX = fatherX;
                    if (father.isOrphan() || mother.isOrphan()) {
                        parentX = Math.max(fatherX, motherX) - gap / 2;
                    } else {
                        // if no orphan parents, go straight up from
                        // middle laid out sib
                        int nsib = 0;
                        for (int j = 0; j < panel.getWidgetCount(); j++)
                            if (panel.getWidget(j) instanceof PelicanPerson) {
                                PelicanPerson sib = (PelicanPerson) panel.getWidget(j);
                                if (areSibs(person, sib))
                                    nsib++;
                            }
                        int sibs = 0;
                        for (int j = 0; j < panel.getWidgetCount() && sibs <= nsib / 2; j++)
                            if (panel.getWidget(j) instanceof PelicanPerson) {
                                PelicanPerson sib = (PelicanPerson) panel.getWidget(j);
                                if (areSibs(person, sib))
                                    sibs++;
                                parentX = panel.getWidgetLeft(sib) + PelicanPerson.symbolSize / 2;
                            }
                        if (nsib > 1 && nsib % 2 == 0)
                            parentX -= PelicanPerson.xSpace / 2;
                        if (parentX <= leftX)
                            parentX = leftX + PelicanPerson.symbolSize / 2;
                        if (parentX >= rightX)
                            parentX = rightX - PelicanPerson.symbolSize / 2;
                    }

                    // g2.drawLine(person.getX()+PelicanPerson.symbolSize/2,person.getY()-dropSize,parentX,person.getY()-dropSize);
                    ctx.beginPath();
                    ctx.moveTo(panel.getWidgetLeft(person) + PelicanPerson.symbolSize / 2,
                            panel.getWidgetTop(person) - dropSize);
                    ctx.lineTo(parentX, panel.getWidgetTop(person) - dropSize);
                    ctx.closePath();
                    ctx.stroke();

                    // line up to parents
                    // Draw a vertical line up to the line joining the parents
                    // if this happens to be not between the parents,
                    // change it to a line to the midpoint between the parents
                    int parentY = (rightX != leftX)
                            ? leftY + (rightY - leftY) * (parentX - leftX) / (rightX - leftX)
                            : (leftY + rightY) / 2;
                    if (rightX == leftX || parentY > Math.max(leftY, rightY)
                            || parentY < Math.min(leftY, rightY)) {
                        // g2.drawLine(parentX,person.getY()-dropSize, (leftX+rightX)/2,(leftY+rightY)/2);
                        ctx.beginPath();
                        ctx.moveTo(parentX, panel.getWidgetTop(person) - dropSize);
                        ctx.lineTo((leftX + rightX) / 2, (leftY + rightY) / 2);
                        ctx.closePath();
                        ctx.stroke();

                    } else {
                        // g2.drawLine(parentX,person.getY()-dropSize,parentX,parentY);
                        ctx.beginPath();
                        ctx.moveTo(parentX, panel.getWidgetTop(person) - dropSize);
                        ctx.lineTo(parentX, parentY);
                        ctx.closePath();
                        ctx.stroke();

                    }
                }
            }

            // write out id
            int verticalPosn = panel.getWidgetTop(person) + PelicanPerson.symbolSize + fontAscent;
            String idString = String.valueOf(person.id);
            int fontWidth = (int) ctx.measureText(idString).getWidth();
            // g2.drawString(idString, 
            //      person.getX() + PelicanPerson.symbolSize/2 - fontWidth/2,
            //      verticalPosn);
            ctx.fillText(idString, panel.getWidgetLeft(person) + PelicanPerson.symbolSize / 2 - fontWidth / 2,
                    verticalPosn);
            verticalPosn += fontAscent;
        }
    return canvas;
}

From source file:edu.umb.jsPedigrees.client.Pelican.PelicanPerson.java

License:Open Source License

public void drawSymbol() {

    Context2d ctx = canvas.getContext2d();

    // clear old symbol
    ctx.clearRect(0, 0, symbolSize + 1, symbolSize + 1);

    ctx.setStrokeStyle(CssColor.make("0,0,0"));
    ctx.setLineWidth(1.0f);

    if (sex == male) {
        ctx.strokeRect(0, 0, symbolSize, symbolSize);
        if (affection == affected) {
            ctx.fillRect(0, 0, symbolSize, symbolSize);
        }// w  w w.  ja va2 s  . c o  m
    }

    if (sex == female) {
        // g2.drawArc(0,0,symbolSize,symbolSize,0,360);
        ctx.beginPath();
        ctx.arc(symbolSize / 2, symbolSize / 2, (symbolSize / 2) - 1, 0, 360);

        if (affection == affected) {
            ctx.fill();
        } else {
            ctx.stroke();
        }
    }
}

From source file:examples.geometry.AbstractExample.java

License:Open Source License

@Override
public void draw() {
    Context2d context = canvas.getContext2d();
    // reset//from  w ww  .ja  va 2  s. co  m
    context.clearRect(0, 0, canvas.getCoordinateSpaceWidth(), canvas.getCoordinateSpaceHeight());
    context.setFillStyle("black");
    context.setStrokeStyle("black");
    context.setLineWidth(1);

    for (ControllableShape shape : getControllableShapes()) {
        //         e.gc.setForeground(canvas.getDisplay().getSystemColor(shape.shapeColor));
        //         e.gc.setBackground(canvas.getDisplay().getSystemColor(shape.shapeColor));

        shape.onDraw(canvas);
    }

    for (ControllableShape shape : getControllableShapes()) {
        if (shape.isActive()) {
            FillStrokeStyle fillStyle = context.getFillStyle();

            for (ControlPoint cp : shape.controlPoints) {
                context.beginPath();
                context.arc(cp.getX(), cp.getY(), shape.controlRadius, 0, 180);
                context.setFillStyle(shape.controlColor);
                context.fill();
                context.closePath();
            }
            context.setFillStyle(fillStyle);
        }
    }
}

From source file:examples.geometry.containment.PolygonCubicCurveContainment.java

License:Open Source License

@Override
protected AbstractControllableShape createControllableShape2(final Canvas canvas) {
    return new AbstractControllableShape(canvas) {
        @Override//from   w w  w .ja  v a2s  . c o m
        public void createControlPoints() {
            addControlPoint(new Point(200, 100));
            addControlPoint(new Point(190, 310));
            addControlPoint(new Point(410, 90));
            addControlPoint(new Point(400, 300));
        }

        @Override
        public CubicCurve createGeometry() {
            return new CubicCurve(getControlPoints());
        }

        @Override
        public void drawShape() {
            CubicCurve c = createGeometry();
            Path path = c.toPath();
            CanvasDrawer.strokePath(path, canvas.getContext2d());
            //            gc.drawPath(new org.eclipse.swt.graphics.Path(Display
            //                  .getCurrent(), Geometry2SWT.toSWTPathData(c.toPath())));
        }

        @Override
        public void fillShape(CssColor color) {
            //            int lineWidth = gc.getLineWidth();
            //            Color fg = gc.getForeground();
            Context2d context2d = canvas.getContext2d();
            FillStrokeStyle fillStyle = context2d.getFillStyle();
            context2d.setLineWidth(3);
            context2d.setStrokeStyle(color.value());

            //            gc.setLineWidth(3);
            //            gc.setForeground(gc.getBackground());
            drawShape();

            context2d.setLineWidth(1);
            context2d.setStrokeStyle(fillStyle);

            //            gc.setForeground(fg);
            //            gc.setLineWidth(lineWidth);
        }
    };
}