Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SvgUtils

Hierarchy

  • SvgUtils

Index

Methods

Static calcHeightFromMat

  • calcHeightFromMat(height: number, alignMatrix: ArrayFixed<number, 16>): number
  • Parameters

    • height: number
    • alignMatrix: ArrayFixed<number, 16>

    Returns number

Static get3DPositionsFrom2D

  • get3DPositionsFrom2D(__namedParameters: [number, number], m: ArrayFixed<number, 16>): object
  • Parameters

    • __namedParameters: [number, number]
    • m: ArrayFixed<number, 16>

    Returns object

    • x: number
    • y: number

Static getRotateRadiusToNorth

  • getRotateRadiusToNorth(m: ArrayFixed<number, 16>): number
  • 获取对齐矩阵指向北方转动的弧度

    Parameters

    Returns number

Static parseSVG

  • parseSVG(url: string, alignMatrix: ArrayFixed<number, 16>): Promise<Shape[]>
  • deprecated

    将SVG文件解析为Owlly map-kit可用的格式

    example
    // 将svg解析为Shape对象数组
    const shapes = await SvgUtils.parseSVG(
      <svg url>,
      [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
    );

    Parameters

    • url: string

      svg地址

    • alignMatrix: ArrayFixed<number, 16>

      对齐数组

    Returns Promise<Shape[]>

Static parseSVGString

  • parseSVGString(svgStr: string, alignMatrix: ArrayFixed<number, 16>): Promise<Shape[]>
  • Parameters

    • svgStr: string
    • alignMatrix: ArrayFixed<number, 16>

    Returns Promise<Shape[]>

Static parseSvgToShapes

  • parseSvgToShapes(url: string, alignMatrix: ArrayFixed<number, 16>, coefficient?: number): Promise<Shape[]>
  • 将svg解析为Shape对象数组

    example
    // 将svg解析为Shape对象数组
    const shapes = await SvgUtils.parseSvgToShapes(
      <svg url>,
      [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
    );

    Parameters

    • url: string

      SVG文件url

    • alignMatrix: ArrayFixed<number, 16>

      对齐矩阵数组

    • Default value coefficient: number = 1

      shape高度调整系数

    Returns Promise<Shape[]>