zoukankan      html  css  js  c++  java
  • 给要素渲染不同的显示色彩

    在城市规划中,用色彩强调感兴趣的房屋十分重要。

    var map = new WebMap({

      portalItem:{id:"03a9607d96244883af64c7f8c7e5de1b"}

    });

    var view = new SceneView({

      container:"viewDiv",

      map:map

    });

    var layer = new SceneLayer({

      portalItem:{id:"5ecba5273b2d41ff9f6f1eb33f238d18"}

    });

    map.add(layer);

    ==============================================

    function setSymbol(){

      return {

        type:"unique-value",

        field:"usage",

        defaultSymbol:{

          type:"mesh-3d",

          symbol:{

            type:"fill",

            material:{

              color:[230, 230, 230, 0.7],

              colorMixMode:"replace"

            }

          }

        },

        uniqueValueInfos:[{

          value:"general or commerial",

          label:"commerial building",

          symbol:{

            type:"mesh-3d",

            symbolLayers:[{

              type:"fill",

              material:{

                color:color,

                colorMixMode:colorMixMode

              }

            }]

          }

        }]

      }

    }

    function setRenderer(type){

      if(type === "origin"){

        layer.renderer = null;

      }

      else if (type === "select"){

        layer.renderer = setSymbol(null,null);

      }

      else if(type === "emphasize"){

        layer.renderer = setSymbol("skyblue","tint");

      }

      else{

        var colorMixMode = (type === "desaturate")?"tint":"replace";

        layer.renderer = {

          type:"simple",

          symbol:{

            type:"mesh-3d",

            symbolLayers:{

              type:"fill",

              material:{color:"white",colorMixMode:colorMixMode}

            }

          }

        }

      }

    }

    document.getElementById("colorMixMode").addEventListener("change",function(event){

       setRenderer(event.target.id);

    });

  • 相关阅读:
    点云数据的存储格式
    模块编写流程
    特征描述子
    指针和引用的差别
    内联函数和宏定义的差别
    哪些函数不能为virtual函数
    如何定义一个只能在堆上(栈上)生成对象的类
    对象深拷贝问题
    Warning: Failed prop type: Invalid prop `value` supplied to `Picker`.报错问题
    解决多层数组、对象深拷贝问题
  • 原文地址:https://www.cnblogs.com/GIS-Yangol/p/10419107.html
Copyright © 2011-2022 走看看