Home > front end >  Cesium pop-up box with earth to do
Cesium pop-up box with earth to do

Time:09-29

Dear bosses, front small white just contact cesium, when the bubble cesium pop-up window produces the following questions, hope to answer, I have no brain
How to follow the earth zoom window pop-up bubbles, here is the transformation of screen coordinates or world coordinates?
How in the mouse to click cancel JSON selected effect when a null value?


The source code below

 var geoDataSource=null; 
Var handler=new Cesium. ScreenSpaceEventHandler (scene. Canvas);
Var ellipsoid=scene. Globe. Ellipsoid;
Handler. SetInputAction (function (movement) {
Var cartesian=viewer. Scene. PickPosition (movement. The position);//viewer. Scene. Globe. Pick (viewer. Camera. GetPickRay (movement. The position), and the scene).//viewer. Camera. PickEllipsoid (ellipsoid);//the movement endPosition
//var pm_position=Cesium. SceneTransforms. Wgs84ToWindowCoordinates (cartographic);
//the console. The log (" position: "+ position);
If (cartesian) {
//convert the cartesian coordinates to geographic coordinates
Var cartographic=Cesium. Cartographic. FromCartesian (cartesian);
//get the mouse to click position of longitude and latitude
Var longitudeString=Cesium. Math. ToDegrees (cartographic. Longitude);
Var latitudeString=Cesium. Math. ToDegrees (cartographic. Latitude);
.//var height=cartographic hegiht
The console. The log (" click on the location coordinates: "+ +", "+ longitudeString latitudeString);
The console. The log (" movement: "+ movement. The position. X +", "+ movement. The position, y);

//according to click on the coordinates of the point for point's surface
Var polygon=getPolygonByPoint (turf. Point ([longitudeString latitudeString]));
If (polygon) {
Attribute information of the console. The log (" : "+ JSON. The stringify (polygon. The properties));
//load obtained
If (geoDataSource) {
Viewer. DataSources. Remove (geoDataSource);
}
Var pGeoJsonDataSource=Cesium. GeoJsonDataSource. Load (polygon, {
ClampToGround: true,
//set the color
The fill: Cesium. Color. RED. WithAlpha (0.5)
});

PGeoJsonDataSource. Then (function (dataSource) {
GeoDataSource=dataSource;
//load the dataSource
Viewer. DataSources. Add (dataSource);
Var entities=dataSource. Entities. Values, entityCount=entities. Length;
for(var i=0; IEntities [I] description=
"& lt; Div>" +
//"& lt; Td>" + entities [I]. Polygon. The properties. The name + "& lt;/td>" +//why points to. Only if the name properties out all but the name didn't?
"& lt;/div>"
;//here for cesium infobox content
Viewer. TrackedEntity=entities [I]
}
});

Var content="& lt; Div id='infowin style=' border - bottom: 1 px solid # C6CBCE; '& gt;" +
"& lt; Span style="margin - left: 5 px; '& gt; Property sheet & lt;/span>" +
"& lt; Div id='infoClose3D' class='closeButton' style='margin - right: 4 px; '& gt;