Exemple #1
0
 /**
  * This function updates the canvas of style of canvas
  *
  * @public
  * @function
  * @param {HTMLCanvasElement} canvas - canvas of style
  * @api stable
  */
 updateCanvas(canvas) {
   const canvasSize = Style.getCanvasSize();
   const vectorContext = toContextRender(canvas.getContext('2d'), {
     size: canvasSize,
   });
   vectorContext.setStyle(this.olStyleFn_()[0]);
   this.drawGeometryToCanvas(vectorContext);
 }
Exemple #2
0
  /**
   * This function updates the canvas of style of canvas
   *
   * @public
   * @function
   * @param {HTMLCanvasElement} canvas - canvas of style
   * @api stable
   */
  updateCanvas(canvas) {
    this.updateFacadeOptions(this.options_);
    const canvasSize = Polygon.getCanvasSize();
    const vectorContext = toContextRender(canvas.getContext('2d'), {
      size: canvasSize,
    });
    const applyStyle = this.olStyleFn_()[0];
    if (!isNullOrEmpty(applyStyle.getText())) {
      applyStyle.setText(null);
    }
    const stroke = applyStyle.getStroke();
    if (!isNullOrEmpty(stroke) && !isNullOrEmpty(stroke.getWidth())) {
      if (stroke.getWidth() > Polygon.DEFAULT_WIDTH_POLYGON) {
        applyStyle.getStroke().setWidth(Polygon.DEFAULT_WIDTH_POLYGON);
      }
    }

    vectorContext.setStyle(applyStyle);
    this.drawGeometryToCanvas(vectorContext);
  }
Exemple #3
0
 /**
  * TODO
  *
  * @public
  * @function
  * @api stable
  */
 updateCanvas(canvas) {
   this.updateFacadeOptions(this.options_);
   const canvasSize = Line.getCanvasSize();
   const vectorContext = toContextRender(canvas.getContext('2d'), {
     size: canvasSize,
   });
   let optionsStyle;
   const style = this.olStyleFn_()[1];
   if (!isNullOrEmpty(style) && !isNullOrEmpty(style.getStroke())) {
     optionsStyle = {
       color: style.getStroke().getColor(),
       width: 1,
     };
   }
   const applyStyle = this.olStyleFn_()[0];
   if (!isNullOrEmpty(applyStyle.getText())) {
     applyStyle.setText(null);
   }
   const stroke = applyStyle.getStroke();
   let width;
   if (!isNullOrEmpty(stroke)) {
     if (!isNullOrEmpty(stroke.getWidth())) {
       width = stroke.getWidth();
       if (stroke.getWidth() > Line.DEFAULT_WIDTH_LINE) {
         width = Line.DEFAULT_WIDTH_LINE;
       }
     } else {
       width = 1;
     }
     optionsStyle = {
       color: applyStyle.getStroke().getColor(),
       width,
     };
     applyStyle.getStroke().setWidth(width);
     vectorContext.setStyle(applyStyle);
   }
   this.drawGeometryToCanvas(vectorContext, canvas, optionsStyle, width);
 }