Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var shapeConfigurationCallback = function(attributes, record) {
- var configuration = {};
- configuration.name =
- attributes.values.name ||
- attributes.values.Name ||
- attributes.values.NAME;
- // count++;
- // console.log(count);
- if (record.isPointType()) {
- configuration.name =
- attributes.values.name ||
- attributes.values.Name ||
- attributes.values.NAME;
- configuration.attributes = new WorldWind.PlacemarkAttributes(
- placemarkAttributes
- );
- if (attributes.values.pop_max) {
- var population = attributes.values.pop_max;
- configuration.attributes.imageScale = 0.01 * Math.log(population);
- }
- } else if (record.isPolygonType()) {
- // configuration.attributes = new WorldWind.ShapeAttributes(null);
- //
- // // Fill the polygon with a random pastel color.
- // configuration.attributes.interiorColor = new WorldWind.Color(
- // 0.375 + 0.5 * Math.random(),
- // 0.375 + 0.5 * Math.random(),
- // 0.375 + 0.5 * Math.random(),
- // 1.0
- // );
- //
- // // Paint the outline in a darker variant of the interior color.
- // configuration.attributes.outlineColor = new WorldWind.Color(
- // 0.5 * configuration.attributes.interiorColor.red,
- // 0.5 * configuration.attributes.interiorColor.green,
- // 0.5 * configuration.attributes.interiorColor.blue,
- // 1.0
- );
- getAqi(configuration.name).then(res => {
- console.log(res);
- configuration.attributes = new WorldWind.ShapeAttributes(null);
- switch (res) {
- case res < 50:
- configuration.attributes.interiorColor = greenColor;
- break;
- case res < 100 && res >= 50:
- configuration.attributes.interiorColor = yellowColor;
- break;
- case res < 150 && res >= 100:
- configuration.attributes.interiorColor = orangeColor;
- break;
- case res > 200:
- configuration.attributes.interiorColor = redColor;
- break;
- default:
- configuration.attributes.interiorColor = purpleColor;
- }
- });
- return configuration;
- }
- };
Add Comment
Please, Sign In to add comment