Skip to content

Commit

Permalink
Merge pull request #183 from Drangeer/measure
Browse files Browse the repository at this point in the history
fix(measure):修改量测中间点计算方式和贴地多边形坐标获取错误
  • Loading branch information
cavencj authored May 23, 2024
2 parents d3d0373 + 7821af2 commit a05eddc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/modules/math/midCartesian.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
import { Cesium } from '../../namespace'

export default function midCartesian(start, end) {
let c1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(start)
let c2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(end)
let cm = new Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5)
return Cesium.Ellipsoid.WGS84.cartographicToCartesian(cm)
return Cesium.Cartesian3.midpoint(start, end, new Cesium.Cartesian3())
}
4 changes: 3 additions & 1 deletion src/modules/measure/draw/DrawPolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class DrawPolygon extends Draw {
...this._style,
hierarchy: new Cesium.CallbackProperty(() => {
if (this._positions.length > 2) {
return new Cesium.PolygonHierarchy(this._positions)
return new Cesium.PolygonHierarchy(
this._positions.map((item) => item.clone())
)
} else {
return null
}
Expand Down
4 changes: 0 additions & 4 deletions src/modules/measure/type/DistanceSurface.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ class DistanceSurface extends MeasureBase {
*/
start(measure, options) {
this._startHook(measure, options)
this._startLabel.label.heightReference =
Cesium.HeightReference.CLAMP_TO_GROUND
this._resultLabel.label.heightReference =
Cesium.HeightReference.CLAMP_TO_GROUND
new DrawPolyline({
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6),
depthFailMaterial:
Expand Down

0 comments on commit a05eddc

Please sign in to comment.