Modify the default material.

This commit is contained in:
ethan 2024-03-23 20:30:27 +08:00
parent 6d45edd800
commit d7ee304f48
3 changed files with 10 additions and 10 deletions

View File

@ -49,8 +49,8 @@ export default class CurvedArrow extends Base {
const distance = Utils.MathDistance(pnt1, pnt2); const distance = Utils.MathDistance(pnt1, pnt2);
let len = distance / this.arrowLengthScale; let len = distance / this.arrowLengthScale;
len = len > this.maxArrowLength ? this.maxArrowLength : len; len = len > this.maxArrowLength ? this.maxArrowLength : len;
const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false);
const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true);
const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt]; const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt];
const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points);
return cartesianPoints; return cartesianPoints;
@ -86,8 +86,8 @@ export default class CurvedArrow extends Base {
const distance = Utils.wholeDistance(lnglatPoints); const distance = Utils.wholeDistance(lnglatPoints);
let len = distance / this.arrowLengthScale; let len = distance / this.arrowLengthScale;
len = len > this.maxArrowLength ? this.maxArrowLength : len; len = len > this.maxArrowLength ? this.maxArrowLength : len;
const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false);
const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true);
const temp = [].concat(...curvePoints); const temp = [].concat(...curvePoints);
const points = [...temp, ...leftPnt, ...pnt2, ...rightPnt]; const points = [...temp, ...leftPnt, ...pnt2, ...rightPnt];
const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points);

View File

@ -65,8 +65,8 @@ export default class StraightArrow extends Base {
const distance = Utils.MathDistance(pnt1, pnt2); const distance = Utils.MathDistance(pnt1, pnt2);
let len = distance / this.arrowLengthScale; let len = distance / this.arrowLengthScale;
len = len > this.maxArrowLength ? this.maxArrowLength : len; len = len > this.maxArrowLength ? this.maxArrowLength : len;
const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false);
const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true);
const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt]; const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt];
const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points);
return cartesianPoints; return cartesianPoints;

View File

@ -57,8 +57,8 @@ export default class Base {
if (this.type === 'polygon') { if (this.type === 'polygon') {
this.style = Object.assign( this.style = Object.assign(
{ {
material: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.2)'), material: new this.cesium.Color(),
outlineMaterial: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'), outlineMaterial: new this.cesium.Color(),
outlineWidth: 2, outlineWidth: 2,
}, },
style, style,
@ -66,7 +66,7 @@ export default class Base {
} else if (this.type === 'line') { } else if (this.type === 'line') {
this.style = Object.assign( this.style = Object.assign(
{ {
material: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'), material: new this.cesium.Color(),
lineWidth: 2, lineWidth: 2,
}, },
style, style,
@ -702,7 +702,7 @@ export default class Base {
} }
let endPoint = points[movingPointIndex]; let endPoint = points[movingPointIndex];
// To dynamically add points between the startPoint and endPoint, consistent with the initial drawing logic, // To dynamically add points between the startPoint and endPoint, consistent with the initial drawing logic,
// update the point at index movingPointIndex in the points array with the newPosition, // update the point at index movingPointIndex in the points array with the newPosition,
// generate the arrow, and execute the animation. // generate the arrow, and execute the animation.
const t = (elapsedTime - currentSegment * segmentDuration) / segmentDuration; const t = (elapsedTime - currentSegment * segmentDuration) / segmentDuration;
const newPosition = this.cesium.Cartesian3.lerp(startPoint, endPoint, t, new this.cesium.Cartesian3()); const newPosition = this.cesium.Cartesian3.lerp(startPoint, endPoint, t, new this.cesium.Cartesian3());