mirror of
https://github.com/ethan-zf/cesium-plot-js.git
synced 2025-06-24 03:27:29 +00:00
update style
This commit is contained in:
parent
81b09a958d
commit
f944d2e68e
@ -55,10 +55,10 @@ buttonGroup.onclick = (evt) => {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'drawSquadCombat':
|
case 'drawSquadCombat':
|
||||||
new CesiumPlot.SquadCombat(Cesium, viewer, {});
|
new CesiumPlot.SquadCombat(Cesium, viewer);
|
||||||
break;
|
break;
|
||||||
case 'drawSwallowtailSquadCombat':
|
case 'drawSwallowtailSquadCombat':
|
||||||
new CesiumPlot.SwallowtailSquadCombat(Cesium, viewer, {});
|
new CesiumPlot.SwallowtailSquadCombat(Cesium, viewer);
|
||||||
break;
|
break;
|
||||||
case 'drawStraightArrow':
|
case 'drawStraightArrow':
|
||||||
new CesiumPlot.StraightArrow(Cesium, viewer, {
|
new CesiumPlot.StraightArrow(Cesium, viewer, {
|
||||||
@ -66,7 +66,7 @@ buttonGroup.onclick = (evt) => {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'drawAssaultDirection':
|
case 'drawAssaultDirection':
|
||||||
new CesiumPlot.AssaultDirection(Cesium, viewer, {});
|
new CesiumPlot.AssaultDirection(Cesium, viewer);
|
||||||
break;
|
break;
|
||||||
case 'drawCurvedArrow':
|
case 'drawCurvedArrow':
|
||||||
new CesiumPlot.CurvedArrow(Cesium, viewer, {
|
new CesiumPlot.CurvedArrow(Cesium, viewer, {
|
||||||
@ -79,10 +79,10 @@ buttonGroup.onclick = (evt) => {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'drawFreehandLine':
|
case 'drawFreehandLine':
|
||||||
new CesiumPlot.FreehandLine(Cesium, viewer, {});
|
new CesiumPlot.FreehandLine(Cesium, viewer);
|
||||||
break;
|
break;
|
||||||
case 'drawFreehandPolygon':
|
case 'drawFreehandPolygon':
|
||||||
new CesiumPlot.FreehandPolygon(Cesium, viewer, {});
|
new CesiumPlot.FreehandPolygon(Cesium, viewer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -13,12 +13,10 @@ export default class AssaultDirection extends FineArrow {
|
|||||||
headWidthFactor: number;
|
headWidthFactor: number;
|
||||||
headAngle: number;
|
headAngle: number;
|
||||||
neckAngle: number;
|
neckAngle: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.tailWidthFactor = 0.08;
|
this.tailWidthFactor = 0.08;
|
||||||
this.neckWidthFactor = 0.1;
|
this.neckWidthFactor = 0.1;
|
||||||
this.headWidthFactor = 0.13;
|
this.headWidthFactor = 0.13;
|
||||||
|
@ -11,12 +11,10 @@ export default class AttackArrow extends Base {
|
|||||||
neckHeightFactor: number;
|
neckHeightFactor: number;
|
||||||
neckWidthFactor: number;
|
neckWidthFactor: number;
|
||||||
headTailFactor: number;
|
headTailFactor: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.headHeightFactor = 0.18;
|
this.headHeightFactor = 0.18;
|
||||||
this.headWidthFactor = 0.3;
|
this.headWidthFactor = 0.3;
|
||||||
this.neckHeightFactor = 0.85;
|
this.neckHeightFactor = 0.85;
|
||||||
@ -26,6 +24,10 @@ export default class AttackArrow extends Base {
|
|||||||
this.onDoubleClick();
|
this.onDoubleClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'polygon';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
@ -2,24 +2,26 @@ import * as Utils from '../utils';
|
|||||||
import Base from '../base';
|
import Base from '../base';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Cartesian3 } from '@examples/cesium';
|
import { Cartesian3 } from '@examples/cesium';
|
||||||
import { PolygonStyle } from '../interface';
|
import { LineStyle } from '../interface';
|
||||||
|
|
||||||
export default class CurvedArrow extends Base {
|
export default class CurvedArrow extends Base {
|
||||||
points: Cartesian3[] = [];
|
points: Cartesian3[] = [];
|
||||||
arrowLengthScale: number = 5;
|
arrowLengthScale: number = 5;
|
||||||
maxArrowLength: number = 3000000;
|
maxArrowLength: number = 3000000;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
t: number;
|
t: number;
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: LineStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'line';
|
|
||||||
this.t = 0.3;
|
this.t = 0.3;
|
||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
this.onDoubleClick();
|
this.onDoubleClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'line';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
@ -45,13 +47,13 @@ export default class CurvedArrow extends Base {
|
|||||||
geometryPoints = this.createLine(tempPoints);
|
geometryPoints = this.createLine(tempPoints);
|
||||||
}
|
}
|
||||||
this.setGeometryPoints(geometryPoints);
|
this.setGeometryPoints(geometryPoints);
|
||||||
this.drawLine();
|
this.drawLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
createStraightArrow(positions: Cartesian3[]) {
|
createStraightArrow(positions: Cartesian3[]) {
|
||||||
const [pnt1, pnt2] = positions.map(this.cartesianToLnglat);
|
const [pnt1, pnt2] = positions.map(this.cartesianToLnglat);
|
||||||
let len = 1.5;
|
let len = 1.5;
|
||||||
|
|
||||||
len = len > this.maxArrowLength ? this.maxArrowLength : len;
|
len = len > this.maxArrowLength ? this.maxArrowLength : len;
|
||||||
const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, false);
|
const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, false);
|
||||||
const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, true);
|
const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, true);
|
||||||
|
@ -11,16 +11,14 @@ export default class DoubleArrow extends Base {
|
|||||||
maxArrowLength: number = 2;
|
maxArrowLength: number = 2;
|
||||||
neckWidthFactor: number;
|
neckWidthFactor: number;
|
||||||
headWidthFactor: number;
|
headWidthFactor: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
headHeightFactor: number;
|
headHeightFactor: number;
|
||||||
neckHeightFactor: number;
|
neckHeightFactor: number;
|
||||||
connPoint: Position;
|
connPoint: Position;
|
||||||
tempPoint4: Position;
|
tempPoint4: Position;
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.headHeightFactor = 0.25;
|
this.headHeightFactor = 0.25;
|
||||||
this.headWidthFactor = 0.3;
|
this.headWidthFactor = 0.3;
|
||||||
this.neckHeightFactor = 0.85;
|
this.neckHeightFactor = 0.85;
|
||||||
@ -30,6 +28,10 @@ export default class DoubleArrow extends Base {
|
|||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'polygon';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
@ -13,12 +13,10 @@ export default class FineArrow extends Base {
|
|||||||
headWidthFactor: number;
|
headWidthFactor: number;
|
||||||
headAngle: number;
|
headAngle: number;
|
||||||
neckAngle: number;
|
neckAngle: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.tailWidthFactor = 0.1;
|
this.tailWidthFactor = 0.1;
|
||||||
this.neckWidthFactor = 0.2;
|
this.neckWidthFactor = 0.2;
|
||||||
this.headWidthFactor = 0.25;
|
this.headWidthFactor = 0.25;
|
||||||
@ -27,6 +25,10 @@ export default class FineArrow extends Base {
|
|||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'polygon';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
@ -11,12 +11,10 @@ export default class SquadCombat extends AttackArrow {
|
|||||||
neckHeightFactor: number;
|
neckHeightFactor: number;
|
||||||
neckWidthFactor: number;
|
neckWidthFactor: number;
|
||||||
tailWidthFactor: number;
|
tailWidthFactor: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.headHeightFactor = 0.18;
|
this.headHeightFactor = 0.18;
|
||||||
this.headWidthFactor = 0.3;
|
this.headWidthFactor = 0.3;
|
||||||
this.neckHeightFactor = 0.85;
|
this.neckHeightFactor = 0.85;
|
||||||
|
@ -8,15 +8,17 @@ export default class StraightArrow extends Base {
|
|||||||
points: Cartesian3[] = [];
|
points: Cartesian3[] = [];
|
||||||
arrowLengthScale: number = 5;
|
arrowLengthScale: number = 5;
|
||||||
maxArrowLength: number = 3000000;
|
maxArrowLength: number = 3000000;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: LineStyle) {
|
constructor(cesium: any, viewer: any, style?: LineStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'line';
|
|
||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'line';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
@ -14,13 +14,10 @@ export default class SwallowtailAttackArrow extends AttackArrow {
|
|||||||
tailWidthFactor: number;
|
tailWidthFactor: number;
|
||||||
swallowTailFactor: number;
|
swallowTailFactor: number;
|
||||||
swallowTailPnt: [number, number];
|
swallowTailPnt: [number, number];
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
|
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.headHeightFactor = 0.18;
|
this.headHeightFactor = 0.18;
|
||||||
this.headWidthFactor = 0.3;
|
this.headWidthFactor = 0.3;
|
||||||
this.neckHeightFactor = 0.85;
|
this.neckHeightFactor = 0.85;
|
||||||
|
@ -12,13 +12,11 @@ export default class SwallowtailSquadCombat extends SquadCombat {
|
|||||||
neckWidthFactor: number;
|
neckWidthFactor: number;
|
||||||
tailWidthFactor: number;
|
tailWidthFactor: number;
|
||||||
swallowTailFactor: number;
|
swallowTailFactor: number;
|
||||||
type: 'polygon' | 'line';
|
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
|
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.headHeightFactor = 0.18;
|
this.headHeightFactor = 0.18;
|
||||||
this.headWidthFactor = 0.3;
|
this.headWidthFactor = 0.3;
|
||||||
this.neckHeightFactor = 0.85;
|
this.neckHeightFactor = 0.85;
|
||||||
|
63
src/base.ts
63
src/base.ts
@ -14,18 +14,40 @@ export default class Base {
|
|||||||
lineEntity: CesiumTypeOnly.Entity;
|
lineEntity: CesiumTypeOnly.Entity;
|
||||||
type!: 'polygon' | 'line';
|
type!: 'polygon' | 'line';
|
||||||
freehand!: boolean;
|
freehand!: boolean;
|
||||||
style: GeometryStyle;
|
style: GeometryStyle | undefined;
|
||||||
outlineEntity: CesiumTypeOnly.Entity;
|
outlineEntity: CesiumTypeOnly.Entity;
|
||||||
|
|
||||||
constructor(cesium: CesiumTypeOnly, viewer: CesiumTypeOnly.Viewer, style: GeometryStyle) {
|
constructor(cesium: CesiumTypeOnly, viewer: CesiumTypeOnly.Viewer, style?: GeometryStyle) {
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.viewer = viewer;
|
this.viewer = viewer;
|
||||||
this.style = style;
|
this.type = this.getType();
|
||||||
|
this.mergeStyle(style);
|
||||||
this.cartesianToLnglat = this.cartesianToLnglat.bind(this);
|
this.cartesianToLnglat = this.cartesianToLnglat.bind(this);
|
||||||
this.pixelToCartesian = this.pixelToCartesian.bind(this);
|
this.pixelToCartesian = this.pixelToCartesian.bind(this);
|
||||||
this.onClick();
|
this.onClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mergeStyle(style: GeometryStyle | undefined) {
|
||||||
|
if (this.type === 'polygon') {
|
||||||
|
this.style = Object.assign(
|
||||||
|
{
|
||||||
|
fillColor: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.2)'),
|
||||||
|
outlineColor: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
||||||
|
outlineWidth: 2,
|
||||||
|
},
|
||||||
|
style,
|
||||||
|
);
|
||||||
|
} else if (this.type === 'line') {
|
||||||
|
this.style = Object.assign(
|
||||||
|
{
|
||||||
|
lineColor: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
||||||
|
lineWidth: 2,
|
||||||
|
},
|
||||||
|
style,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class provides a method to change the state, and different logic is implemented based on the state.
|
* The base class provides a method to change the state, and different logic is implemented based on the state.
|
||||||
* The state is controlled by individual sub-components according to the actual situation.
|
* The state is controlled by individual sub-components according to the actual situation.
|
||||||
@ -147,9 +169,7 @@ export default class Base {
|
|||||||
polygon: new this.cesium.PolygonGraphics({
|
polygon: new this.cesium.PolygonGraphics({
|
||||||
hierarchy: new this.cesium.CallbackProperty(callback, false),
|
hierarchy: new this.cesium.CallbackProperty(callback, false),
|
||||||
show: true,
|
show: true,
|
||||||
// fill: true,
|
material: style.fillColor, // || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.2)'),
|
||||||
// material: this.cesium.Color.LIGHTSKYBLUE.withAlpha(0.8),
|
|
||||||
material: style.fillColor || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.2)'),
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -159,8 +179,8 @@ export default class Base {
|
|||||||
positions: new this.cesium.CallbackProperty(() => {
|
positions: new this.cesium.CallbackProperty(() => {
|
||||||
return [...this.geometryPoints, this.geometryPoints[0]];
|
return [...this.geometryPoints, this.geometryPoints[0]];
|
||||||
}, false),
|
}, false),
|
||||||
width: style.outlineWidth || 2,
|
width: style.outlineWidth, // || 2,
|
||||||
material: style.outlineColor || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
material: style.outlineColor, // || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -190,8 +210,8 @@ export default class Base {
|
|||||||
const entity = this.viewer.entities.add({
|
const entity = this.viewer.entities.add({
|
||||||
polyline: {
|
polyline: {
|
||||||
positions: new this.cesium.CallbackProperty(() => this.geometryPoints, false),
|
positions: new this.cesium.CallbackProperty(() => this.geometryPoints, false),
|
||||||
width: style.lineWidth || 2,
|
width: style.lineWidth, // || 2,
|
||||||
material: style.lineColor || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
material: style.lineColor, // || this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'),
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -286,6 +306,24 @@ export default class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (this.type === 'polygon') {
|
||||||
|
this.polygonEntity.show = true;
|
||||||
|
this.outlineEntity.show = true;
|
||||||
|
} else if (this.type === 'line') {
|
||||||
|
this.lineEntity.show = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
if (this.type === 'polygon') {
|
||||||
|
this.polygonEntity.show = false;
|
||||||
|
this.outlineEntity.show = false;
|
||||||
|
} else if (this.type === 'line') {
|
||||||
|
this.lineEntity.show = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addPoint(cartesian: CesiumTypeOnly.Cartesian3) {
|
addPoint(cartesian: CesiumTypeOnly.Cartesian3) {
|
||||||
//Abstract method that must be implemented by subclasses.
|
//Abstract method that must be implemented by subclasses.
|
||||||
}
|
}
|
||||||
@ -302,4 +340,9 @@ export default class Base {
|
|||||||
updateDraggingPoint(cartesian: CesiumTypeOnly.Cartesian3, index: number) {
|
updateDraggingPoint(cartesian: CesiumTypeOnly.Cartesian3, index: number) {
|
||||||
//Abstract method that must be implemented by subclasses.
|
//Abstract method that must be implemented by subclasses.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'polygon';
|
||||||
|
//Abstract method that must be implemented by subclasses.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,19 @@ import { PolygonStyle } from '../interface';
|
|||||||
|
|
||||||
export default class FreehandLine extends Base {
|
export default class FreehandLine extends Base {
|
||||||
points: Cartesian3[] = [];
|
points: Cartesian3[] = [];
|
||||||
type: 'polygon' | 'line';
|
|
||||||
freehand: boolean;
|
freehand: boolean;
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'line';
|
|
||||||
this.freehand = true;
|
this.freehand = true;
|
||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'line';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
@ -5,17 +5,19 @@ import { PolygonStyle } from '../interface';
|
|||||||
|
|
||||||
export default class FreehandPolygon extends Base {
|
export default class FreehandPolygon extends Base {
|
||||||
points: Cartesian3[] = [];
|
points: Cartesian3[] = [];
|
||||||
type: 'polygon' | 'line';
|
|
||||||
freehand: boolean;
|
freehand: boolean;
|
||||||
|
|
||||||
constructor(cesium: any, viewer: any, style: PolygonStyle) {
|
constructor(cesium: any, viewer: any, style?: PolygonStyle) {
|
||||||
super(cesium, viewer, style);
|
super(cesium, viewer, style);
|
||||||
this.cesium = cesium;
|
this.cesium = cesium;
|
||||||
this.type = 'polygon';
|
|
||||||
this.freehand = true;
|
this.freehand = true;
|
||||||
this.setState('drawing');
|
this.setState('drawing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getType(): 'polygon' | 'line' {
|
||||||
|
return 'polygon';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add points only on click events
|
* Add points only on click events
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user