BIGEMAP卫星地图_高清卫星地图_北斗高清地图_地图软件_矢量地图数据_专题地图

顯示源代碼
高程-等高線
 開發文檔
            <!DOCTYPE html>

<html>
<head>
    <meta charset='UTF-8'/>
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
    <link  rel='stylesheet'/>
    <script src='http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script>
    
    <script type="text/javascript" src="http://www.cnhrsm.com/Public/common/js/jquery.min.js"></script>
    <style>
        body {
            margin: 0;
            padding: 0;
        }
        #container {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
        .toolbar{
            position: absolute;
            left:20px;
            top:15px;
            z-index: 99;
            color: #222;
            background-color: rgba(220,220,220,0.8);
            padding: 0 10px;
        }
        .bmgl-widget-credits{display:none}
    </style>
    <title>part_test</title>
</head>
<body>
<div id='container'></div>
<div class="toolbar">
    <p>
        <label>
            <input type="radio"  name="type" value="">影像
        </label>
        <label>
            <input type="radio" checked name="type" value="elevation">高程
        </label>
        <label>
            <input type="radio" name="type" value="aspect">方位
        </label>
    </p>
    <p>
        <label><input type="checkbox" value="line" checked name="line">等高線</label>
    </p>
</div>
<script>
    bmgl.Config.HTTP_URL = 'http://ua.bigemap.com:30081/bmsdk/';
    var viewer = new bmgl.Viewer('container', {
        terrainId: 'bigemap.dc-terrain',
        mapId: 'bigemap.dc-satellite'
    });
    $('input').on('click',function () {
        var v=$(this).val();
        if (v==='line'){
            viewModel.enableContour=$(this).prop('checked');
        }else{
            viewModel.selectedShading=v;
        }
        updateMaterial();
    });
    viewer.camera.setView({
        destination:new bmgl.Cartesian3(-1233524.2528105492,5342784.449529671,3266300.735257586),
        orientation:{
            heading:5.737109377827798,
            roll:6.281571490802099,
            pitch:-0.3089655832119651,
        }
    })
    viewer.scene.globe.enableLighting = true;

    function getElevationContourMaterial() {
        return new bmgl.Material({
            fabric: {
                type: 'ElevationColorContour',
                materials: {
                    contourMaterial: {
                        type: 'ElevationContour'
                    },
                    elevationRampMaterial: {
                        type: 'ElevationRamp'
                    }
                },
                components: {
                    diffuse: 'contourMaterial.alpha == 0.0 ? elevationRampMaterial.diffuse : contourMaterial.diffuse',
                    alpha: 'max(contourMaterial.alpha, elevationRampMaterial.alpha)'
                }
            },
            translucent: false
        });
    }

    function getSlopeContourMaterial() {
        return new bmgl.Material({
            fabric: {
                type: 'SlopeColorContour',
                materials: {
                    contourMaterial: {
                        type: 'ElevationContour'
                    },
                    slopeRampMaterial: {
                        type: 'SlopeRamp'
                    }
                },
                components: {
                    diffuse: 'contourMaterial.alpha == 0.0 ? slopeRampMaterial.diffuse : contourMaterial.diffuse',
                    alpha: 'max(contourMaterial.alpha, slopeRampMaterial.alpha)'
                }
            },
            translucent: false
        });
    }

    function getAspectContourMaterial() {
        return new bmgl.Material({
            fabric: {
                type: 'AspectColorContour',
                materials: {
                    contourMaterial: {
                        type: 'ElevationContour'
                    },
                    aspectRampMaterial: {
                        type: 'AspectRamp'
                    }
                },
                components: {
                    diffuse: 'contourMaterial.alpha == 0.0 ? aspectRampMaterial.diffuse : contourMaterial.diffuse',
                    alpha: 'max(contourMaterial.alpha, aspectRampMaterial.alpha)'
                }
            },
            translucent: false
        });
    }

    var elevationRamp = [0.0, 0.045, 0.1, 0.15, 0.37, 0.54, 1.0];
    var slopeRamp = [0.0, 0.29, 0.5, Math.sqrt(2)/2, 0.87, 0.91, 1.0];
    var aspectRamp = [0.0, 0.2, 0.4, 0.6, 0.8, 0.9, 1.0];
    function getColorRamp(selectedShading) {
        var ramp = document.createElement('canvas');
        ramp.width = 100;
        ramp.height = 1;
        var ctx = ramp.getContext('2d');
        var values;
        if (selectedShading === 'elevation') {
            values = elevationRamp;
        } else if (selectedShading === 'slope') {
            values = slopeRamp;
        } else if (selectedShading === 'aspect') {
            values = aspectRamp;
        }

        var grd = ctx.createLinearGradient(0, 0, 100, 0);
        if (values){
            grd.addColorStop(values[0], '#000000'); //black
            grd.addColorStop(values[1], '#2747E0'); //blue
            grd.addColorStop(values[2], '#D33B7D'); //pink
            grd.addColorStop(values[3], '#D33038'); //red
            grd.addColorStop(values[4], '#FF9742'); //orange
            grd.addColorStop(values[5], '#ffd700'); //yellow
            grd.addColorStop(values[6], '#ffffff'); //white
        }
        ctx.fillStyle = grd;
        ctx.fillRect(0, 0, 100, 1);

        return ramp;
    }

    var minHeight = -414.0;
    var maxHeight = 8777.0;
    var contourColor = bmgl.Color.RED.clone();
    var contourUniforms = {};
    var shadingUniforms = {};
    var viewModel = {
        enableContour: true,
        contourSpacing: 150.0,
        contourWidth: 2.0,
        selectedShading: 'elevation',
        changeColor: function() {
            contourUniforms.color = bmgl.Color.fromRandom({alpha: 1.0}, contourColor);
        }
    };
    function updateMaterial() {
        var hasContour = viewModel.enableContour;
        var selectedShading = viewModel.selectedShading;
        var globe = viewer.scene.globe;
        var material;
        if (hasContour) {
            if (selectedShading === 'elevation') {
                material = getElevationContourMaterial();
                shadingUniforms = material.materials.elevationRampMaterial.uniforms;
                shadingUniforms.minimumHeight = minHeight;
                shadingUniforms.maximumHeight = maxHeight;
                contourUniforms = material.materials.contourMaterial.uniforms;
            } else if (selectedShading === 'slope') {
                material = getSlopeContourMaterial();
                shadingUniforms = material.materials.slopeRampMaterial.uniforms;
                contourUniforms = material.materials.contourMaterial.uniforms;
            } else if (selectedShading === 'aspect') {
                material = getAspectContourMaterial();
                shadingUniforms = material.materials.aspectRampMaterial.uniforms;
                contourUniforms = material.materials.contourMaterial.uniforms;
            } else {
                material = bmgl.Material.fromType('ElevationContour');
                contourUniforms = material.uniforms;
            }
            contourUniforms.width = viewModel.contourWidth;
            contourUniforms.spacing = viewModel.contourSpacing;
            contourUniforms.color = contourColor;
        } else if (selectedShading === 'elevation') {
            material = bmgl.Material.fromType('ElevationRamp');
            shadingUniforms = material.uniforms;
            shadingUniforms.minimumHeight = minHeight;
            shadingUniforms.maximumHeight = maxHeight;
        } else if (selectedShading === 'slope') {
            material = bmgl.Material.fromType('SlopeRamp');
            shadingUniforms = material.uniforms;
        } else if (selectedShading === 'aspect') {
            material = bmgl.Material.fromType('AspectRamp');
            shadingUniforms = material.uniforms;
        }
        if (selectedShading !== 'none') {
            shadingUniforms.image = getColorRamp(selectedShading);
        }
        globe.material = material;
    }
    updateMaterial();
</script>
</body>
</html>
                                                                                                                                                                                            
主站蜘蛛池模板: 江寒必恋术在线阅读_江寒必恋术免费下载 - 江寒必恋术电子书 | 罗茨鼓风机维修_三叶罗茨风机维修厂家电话_山东长沙章丘鼓风机修理_章鼓高压真空泵「上门服务」 罗茨鼓风机价格_三叶罗茨鼓风机厂家-山东锦工有限公司 | 制冷设备|冷库|空调|配件【制冷通】国内领先的制冷服务平台 | 宿迁市华泰交通设施有限公司,上海第四代路名牌,天津仿罗马柱路名牌,标准路名牌,路名牌灯箱,公交站台,户外广告灯箱, 交通标志牌,社区阅报栏 | 耐磨焊条_高硬度堆焊焊条_碳化钨合金耐磨焊丝_北京耐默 | 天猫代运营_淘宝代运营_正规电商代运营公司_武汉火蝠电商 | 淮南网站制作丨淮南做网站丨淮南网络公司丨淮南哪家网络公司好丨淮南智讯网络 | 污水处理设备-污泥脱水设备-纯水净水设备-山东善丰机械科技有限公司 | 智能电地暖_电地暖安装_电地暖价格-西安秦星暖通工程有限公司 | 磐石在线-磐石市综合信息门户网www.pszx.com - Powered by Discuz! | 泊头市鸿海泵业有限公司--导热油泵,高温油泵,沥青保温泵,圆弧泵,齿轮油泵,高粘度泵,自吸离心油泵,罗茨油泵为主的专业生产厂家 | 中山电子控制板|中山工业控制板|中山市云禾电子科技有限公司 | 清洁公司| 保洁公司| 东莞清洁| 东莞保洁|壹壹清洁 | 江苏华海诚科新材料有限公司、连云港华海诚科新材料有限公司、连云港新材料 | 欢迎光临广西七三科技有限公司官网 | 鑫金牛建设工程(苏州)有限公司 | 青山套筒_直螺纹钢筋连接套筒加工_全灌浆套筒灌浆料_半灌浆套筒生产-衡水安达机械设备有限公司 | 欢迎光临广西七三科技有限公司官网| 中江网-中国江苏网·新江苏, 全国重点新闻网站 | 透明捆扎带_束带机打包带_束带机纸带_热封纸带机_上海得亿束带机包装材料有限公司 | 开水机-节能开水器-即热式开水器-上海捷水环保科技有限公司 | 圣瞳智巡_大模型工业巡检解决方案|【圣瞳科技】 | 室内儿童乐园定制_淘气堡订做_蹦床公园订制厂家-乐奇多 | 麦秸映像网络技术有限公司,河南省政府采网入驻对接,新乡网站维护建设,小程序开发,APP定制开发,钉钉开发,新乡软件开发等相关网络业务 | 整体滤板模板-S型塑料滤砖-MBBR生物悬浮球填料-微孔曝气器-大恒环保科技 | 外圆/圆管抛光机_方管抛光机/除锈机_活塞杆抛光机-不锈钢管抛光机-邢台欧邦机械 | 箱式污泥采样器-全自动旋转振荡器-恒温石墨电热板-常州亿通分析仪器制造有限公司 | 小型环境空气质量连续监测系统-烟气排放连续监测仪(碳排放)-青岛明德环保仪器有限公司 | 郑州阳光房|封阳台|钢结构【河南郑州如意阳光房门窗有限公司】 | 数据采集卡_北京科尔特兴业测控技术研究所 | 江西蔬菜配送,南昌蔬菜配送,南昌食堂承包,江西饭堂承包-江西菜篮子农产品发展有限公司 | 素时刻 - 为亿万家庭提供健康饮食 | 吉林市发布(雾凇融媒)官网| 胶球清洗-射水抽气器-磷酸盐加药装置-连云港振辉机械设备有限公司 | 河北热风机,电热暖风机,燃油暖风机,工业暖风机厂家安装,批发-河北嘉鹏冷暖风机有限公司 | 今日标准_走心机_数控走心机_车铣复合_厂家_深圳今日标准官方网站 | 清洁度检测_手动颗粒萃取设备_自动颗粒萃取设备 - 厦门迈纳光学技术有限公司 | 振动筛_直线振动筛_超声波振动筛-新乡市大汉振动机械有限公司 | 网站建设-百度SEO关键词优化与企业全网营销推广服务-启源信息 | 西安鲁班装饰 - 家庭装修,别墅装修,西安十大装修公司排名 | 荧光显微镜,倒置显微镜,显微镜相机,荧光光源——广州市明美光电技术有限公司 |