Giter VIP home page Giter VIP logo

ailabel's Introduction

AILabel

背景

原AILabel库无源代码和在线预览文档功能,因之前commit过代码而fork过

定义

AILabel类库是一款集打点、线段、多段线、矩形、多边形、圆圈、涂抹等多标注形式于一体,附加文本(Text)、标记(Marker)、缩略图(EagleMap)、Scale(比例尺)等控件以及Util等辅助工具的在线Web端标注工具库。目前已被广泛应用于多标注项目中。

文档

源代码:https://github.com/luchuanqi/AILabel
API文档:http://ailabel.com.cn/public/ailabel/api/index.html
Demo文档:https://luchuanqi.github.io/AILabel/demo/
npm地址:https://www.npmjs.com/package/ailabel

目录结构

  • libs: AILabel源码
  • demo: AILabel-demo
  • doc: AILabel-api文档

环境安装及运行

libs

npm i
npm run dev // 启动rollup
open demo->index.html

doc

npm i
npm run build

快速开始

第一个小栗子

图片层的添加

// 声明容器
const gMap =new AILabel.Map(CONTAINER_ID, {
    center: {x: 250, y: 177},
    zoom: 800,
    mode: 'PAN' // 绘制线段
});

// 显示一张图片
const gFirstImageLayer = new AILabel.Layer.Image(
    'first-layer-image', // id
    {
        src: image.src,
        width: image.width,
        height: image.height,
        position: { // 图片左上角坐标
            x: 0,
            y: 0
        }
    }, // imageInfo
    {name: '第一个图片图层'}, // props
    {zIndex: 5} // style
);
gMap.addLayer(gFirstImageLayer);

图形绘制/编辑

多边形绘制编辑举例

// 添加矢量图层(用于展示矢量图形)
const gFirstFeatureLayer = new AILabel.Layer.Feature(
    'first-layer-feature', // id
    {name: '第一个矢量图层'}, // props
    {zIndex: 10} // style
);
gMap.addLayer(gFirstFeatureLayer);

// gMap实例添加events事件监听
gMap.events.on('drawDone', (type: EMapMode, data) => {
    if (type === 'POLYGON') {
        const polygonFeature = new AILabel.Feature.Polygon(
            `${+new Date()}`, // id
            {points: data}, // shape
            {name: '矢量图形'}, // props
            drawingStyle // style
        );
        gFirstFeatureLayer.addFeature(polygonFeature);
    }
    else if (...) {
        // 其他类型Feature绘制完成处理
    }
}

TODO

  • P0: 增加配置项支持绘制过程中右键拖拽

  • P0: 箭头直线类型支持

  • P0: Control.Scale 开发

  • P0: Control.EagleMap 开发

  • P0: ROI 开发

  • P1: Feature.Rect 支持中心展示十字丝

  • P1: Feature.Rect 旋转

  • P2: Layer.Image 旋转

  • P3: 3D 支持

  • ...

开源协议

请遵循:Apache License 开源协议

ailabel's People

Contributors

dingyang9642 avatar luchuanqi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.