123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import VectorType from '../enum/VectorType.js'
- import Geometry from './Geometry'
- import { mathUtil } from '../MathUtil.js'
- import SelectState from '../enum/SelectState.js'
- import { coordinate } from '../Coordinate'
- export default class CustomImage extends Geometry {
- constructor(url,center,vectorId) {
- super()
- this.center = center
- this.url = url;
- this.image = null;
- this.width = 40;
- this.height = 30;
- this.angle = 0 //逆时针为负,顺时针为正。单位是:°
- this.scale = 1 //缩放比例
- this.geoType = VectorType.CustomImage
- this.setId(vectorId)
- }
- isContain(position) {
- if(Math.abs(position.x - this.center.x)* coordinate.res * coordinate.zoom/ 100 <this.width/2 && Math.abs(position.y - this.center.y)* coordinate.res * coordinate.zoom/ 100<this.height/2)
- {
- return SelectState.Select
- } else {
- return null
- }
- }
- setImageData(imgData){
- this.image = imgData;
- }
- setUrl(url){
- this.url = url;
- }
- setAngle(angle){
- this.angle = angle;
- }
- setScale(scale){
- this.scale = scale;
- }
- }
|