|
|
@@ -199,38 +199,30 @@ viewer.imageryLayers.add(redMapLayer);
|
|
|
|
|
|
yellowMapLayer.show=false;
|
|
|
redMapLayer.show=false;
|
|
|
- Cesium.GeoJsonDataSource.load("./china1.json").then(ds=>{
|
|
|
- viewer.dataSources.add(ds);
|
|
|
- chinaLineResource=ds;
|
|
|
- ds.entities.values.map(entity => {
|
|
|
- entity.polyline.material=new Cesium.Color(205/255, 205/255,205/255,0.1);
|
|
|
- entity.polyline.width=1;
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- type: 'GET',
|
|
|
- url: "./data.json",
|
|
|
- dataType: "json",
|
|
|
- async: false,
|
|
|
- success: function(result){
|
|
|
- for(let i=0;i<result.length;i++){
|
|
|
- let bool=true;
|
|
|
- viewer.entities.values.map(e=>{
|
|
|
- if(e.label&&e.label.text==result[i].place){
|
|
|
- bool=false;
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
+$.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: "./data.json",
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ success: function(result){
|
|
|
+ for(let i=0;i<result.length;i++){
|
|
|
+ let bool=true;
|
|
|
+ viewer.entities.values.map(e=>{
|
|
|
+ if(e.label&&e.label.text==result[i].place){
|
|
|
+ bool=false;
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ if(result[i].place!="北京"){
|
|
|
bool&&viewer.entities.add(new Cesium.Entity({
|
|
|
position:Cesium.Cartesian3.fromDegrees(result[i].position[0],result[i].position[1],500),
|
|
|
label:{
|
|
|
text:result[i].place,
|
|
|
- font:'20px sans-serif',
|
|
|
+ font:'15px sans-serif',
|
|
|
scale:0.7,
|
|
|
- pixelOffset:new Cesium.Cartesian2(0,20),
|
|
|
+ pixelOffset:result[i].place=="洛阳"?new Cesium.Cartesian2(-10,15):new Cesium.Cartesian2(0,15),
|
|
|
fillColor:new Cesium.Color(255/255,255/255,255/255),
|
|
|
- style:Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
+ // style:Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
outlineColor:new Cesium.Color(255/255,255/255,255/255),
|
|
|
},
|
|
|
point:{
|
|
|
@@ -241,21 +233,40 @@ redMapLayer.show=false;
|
|
|
|
|
|
}
|
|
|
}));
|
|
|
- if(result[i].place=="北京"){
|
|
|
- viewer.entities.add(new Cesium.Entity({
|
|
|
- position:Cesium.Cartesian3.fromDegrees(result[i].position[0],result[i].position[1],500),
|
|
|
- billboard:{
|
|
|
- image:"./pentagram.png",
|
|
|
- pixelOffset:new Cesium.Cartesian2(0,-20)
|
|
|
- }
|
|
|
- }));
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- error: function(XMLHttpRequest, errorMsg, object){
|
|
|
- console.log(errorMsg);
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ viewer.entities.add(new Cesium.Entity({
|
|
|
+ position:Cesium.Cartesian3.fromDegrees(result[i].position[0],result[i].position[1],500),
|
|
|
+ billboard:{
|
|
|
+ image:"./pentagram.png",
|
|
|
+ // pixelOffset:new Cesium.Cartesian2(0,-20)
|
|
|
+ },
|
|
|
+ label:{
|
|
|
+ text:result[i].place,
|
|
|
+ font:'15px sans-serif',
|
|
|
+ scale:0.7,
|
|
|
+ pixelOffset:result[i].place=="洛阳"?new Cesium.Cartesian2(-10,15):new Cesium.Cartesian2(0,15),
|
|
|
+ fillColor:new Cesium.Color(255/255,255/255,255/255),
|
|
|
+ // style:Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
+ outlineColor:new Cesium.Color(255/255,255/255,255/255),
|
|
|
+ },
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(XMLHttpRequest, errorMsg, object){
|
|
|
+ console.log(errorMsg);
|
|
|
+ }
|
|
|
+});
|
|
|
+ Cesium.GeoJsonDataSource.load("./china1.json").then(ds=>{
|
|
|
+ viewer.dataSources.add(ds);
|
|
|
+ chinaLineResource=ds;
|
|
|
+ ds.entities.values.map(entity => {
|
|
|
+ entity.polyline.material=new Cesium.Color(205/255, 205/255,205/255,0.5);
|
|
|
+ entity.polyline.width=0.1;
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
function clearMap(){
|
|
|
polygonSource.entities.removeAll();
|
|
|
@@ -375,18 +386,21 @@ function changeStyle(type){
|
|
|
yellowMapLayer.show=false;
|
|
|
chinaLineResource&&chinaLineResource.entities.values.map(entity => {
|
|
|
entity.polyline.material=new Cesium.Color(255/255,0,0,0.8);
|
|
|
+ entity.polyline.width=0.8;
|
|
|
});
|
|
|
}else if(type==YELLOW){
|
|
|
yellowMapLayer.show=true;
|
|
|
redMapLayer.show=false;
|
|
|
chinaLineResource&&chinaLineResource.entities.values.map(entity => {
|
|
|
- entity.polyline.material=new Cesium.Color(200/255, 169/255,145/255);
|
|
|
+ entity.polyline.material=new Cesium.Color(250/255, 169/255,145/255);
|
|
|
+ entity.polyline.width=0.8;
|
|
|
});
|
|
|
}else {
|
|
|
yellowMapLayer.show=false;
|
|
|
redMapLayer.show=false;
|
|
|
chinaLineResource&&chinaLineResource.entities.values.map(entity => {
|
|
|
- entity.polyline.material=new Cesium.Color(205/255, 205/255,205/255,0.7);
|
|
|
+ entity.polyline.material=new Cesium.Color(205/255, 205/255,205/255,0.8);
|
|
|
+ entity.polyline.width=0.8;
|
|
|
});
|
|
|
}
|
|
|
}
|