Hi all,
I want to create an ellipse at the clicked location but it’s not creating the same location.
I’ve read already created supports and there are many solutions for terrain on but I want it without terrain on. If it is possible please sent me the solution.
Thanks
Here’s an example that gets the ellipsoid position to use as the center of an ellipse.
Hope that helps.
var viewer = new Cesium.Viewer("cesiumContainer", {
selectionIndicator: false,
infoBox: false,
});
var scene = viewer.scene;
if (!scene.pickPositionSupported) {
window.alert("This browser does not support pickPosition.");
}
var handler;
var lastPosition;
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function (movement) {
var cartesian = viewer.camera.pickEllipsoid(
movement.endPosition,
scene.globe.ellipsoid
);
if (cartesian) {
lastPosition = cartesian;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
handler.setInputAction(function(left_double_click) {
if (lastPosition !== undefined) {
var entity = viewer.entities.add({
position: lastPosition,
ellipse: {
semiMajorAxis: 400.0,
semiMinorAxis: 200.0,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
height: 0.0,
fill: false,
outline: true,
outlineColor: Cesium.Color.RED,
outlineWidth: 3.0
}
});
viewer.zoomTo(entity);
}
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
1 Like