运行范例

描述

该范例展示如何进行三维设施网络分析。

了解微软脚本库的更多信息请参见微软官方帮助文档. 微软官方帮助文档.

代码 (文件格式为 UTF-8)


<!DOCTYPE>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>上游关键设施查找资源</title>
    <style type="text/css">

        body{
            font-size:12px;
            background-color:#B7CBE2;
        }

        .divClass{
            margin-left:5px;margin-top:10px;
        }

        .button{
            width:100px;
        }

        .tab_div{
            height:3%;
            padding-left:5px;
            padding-top:2px;
            border-top:1px solid #6D8CB0;
            background-color:#B5CAE1;
        }

        .click_class{
            background-color:#FFFFFF;
            border:1px solid #6D8CB0;
        }

        .willclick_class{
            background-color:#BBCEE4;
            border:1px solid #6D8CB0;
        }

        .tap_table{
            border-collapse:collapse;
            border:none;
        }

        .facility_table{
            border-collapse:collapse;
            border:none;
        }

        .right_top{
            height:97%;
            width:100%;
            border:1px solid #6D8CB0;border-bottom:0
        }

        #result1{
            background-color:white;width:98%;height:100px;border:1px solid black;overflow-y:auto;
        }

        #result2{
            background-color:white;width:98%;height:400px;margin-top:20px;border:1px solid black;overflow-y:auto;
        }

        #infoWindow{
            float:right;left:0%; top:0px; width: 20%; visibility: visible;cursor: auto; overflow: auto; position: relative; height: 875px; background-color:#F0F0F0; font-family: 仿宋_GB2312;overflow-y:hidden;overflow-x:hidden;
        }

        #sceneControlDiv{
            float: left;clear: both;position:absolute; margin: 0; padding: 0; border: 1px solid #6D8CB0; z-index:1;left: 0px; width: 79%; top: 0%; height: 100%; visibility: visible;
        }

        #facility_span{
            border-top:0;
            width:100px;
            text-align:center;
            height:20px;
            padding-top:3px;
            cursor:pointer;
        }

        #env_span{
            border-top:0;
            width:100px;
            text-align:center;
            height:20px;
            padding-top:3px;
            cursor:pointer;
        }

        #env_div{
            display:none;
        }

        #title{
            border-bottom:1px solid #6D8CB0;
            height:30px;
            padding-top:7px;
            padding-left:5px;
            background-color:#F0F0F0;
            font-weight:bold;
        }

        #tap_table tr td{
            border:solid #000 1px;
            height:20px;
        }

        #facility_table tr td{
            border:solid #000 1px;
            height:20px;
        }

        table td{
            font-size:12px;
        }

    </style>
    <!--引用 SuperMap.Include.js,实现将 SuperMap.Include.js 中的库文件在该 html 中引用-->

    <script type="text/javascript" src='SuperMap.Include.js'></script>
    <!--引用 facilityAnalyst3D.js,系统具体功能在该脚本中实现-->
    <script type="text/javascript" src='js/facilityAnalyst3D.js'></script>
    <script type="text/javascript">
        var sourceNodeIDs = [24,25,34,37,53,61,64,67,73,78,125,127,132,152,161,196,209,212,221,269,276,283,294,299,315,332,349,367,383,423,435,438,444,473,488];
        var host = document.location.toString().match(/file:\/\//)?"http://localhost:8090":'http://' + document.location.host;
        var url=host+"/iserver/services/facilityAnalyst3D-Pipe3D/rest/facilityanalyst3d/Network@Pipe3D";
        function init(){
            var parameter = new SuperMap.REST.FacilityAnalystUpstream3DParameters({
                sourceNodeIDs: sourceNodeIDs,
                edgeID: 206,
                nodeID: null,
                isUncertainDirectionValid: true
            });
            var facilityAnalystUpstream3DService = new SuperMap.REST.FacilityAnalystUpstream3DService(url, {
                eventListeners: { "processCompleted": processCompleted }
            });
            facilityAnalystUpstream3DService.processAsync(parameter);
        }

        function processCompleted(facilityAnalystUpstream3DEventArgs) {
            var result = facilityAnalystUpstream3DEventArgs.result;
            alert(JSON.stringify(result));
        }
    </script>
</head>
<body onload="onPageLoad();">
<!--场景控件-->
<div id="sceneControlDiv">
</div>
<!--信息窗-->
<div id="infoWindow">
    <div class="right_top">
        <div id="title">设施网络分析</div>
        <div id="facility_div" class="divClass">
            <div>
                <p><input type="button" value="选取爆管点" onclick="selectPoint();"/>   <input type="text" id="point_id"/></p>
            </div>
            <div>
                <p>设施查找<p>
                <p><input type="button" value="爆管下游设施追踪" onclick="facilityAnalystTracedown();"/>   <input type="button" value="最近阀门查找" onclick="facilityAnalystUpstream();"/></p>
                <p><input type="button" value="阀门下游设施追踪" onclick="display_facilityAnalystUpstream();"/>   <input type="button" value="清除" class="button" onclick="clearStyle();"/></p>
            </div>
            <div>
                <p>结果<p>
                <div id="result1"></div>
                <div id="result2"></div>
            </div>
        </div>
        <div id="env_div" class="divClass">
            <table>
                <tr>
                    <td width="40%" align="right">网络数据集:</td>
                    <td width="60%"><input type="text" value="Network_1"/></td>
                </tr>
                <tr>
                    <td align="right">正向全值字段:</td>
                    <td><input type="text" value="SMLENGTH"/></td>
                </tr>
                <tr>
                    <td align="right">反向全值字段:</td>
                    <td><input type="text" value="SMLENGTH"/></td>
                </tr>
                <tr>
                    <td align="right">结点标识字段:</td>
                    <td><input type="text" value="SMNODEID"/></td>
                </tr>
                <tr>
                    <td align="right">弧段标识字段:</td>
                    <td><input type="text" value="SMEDGEID"/></td>
                </tr>
                <tr>
                    <td align="right">起始结点标识字段:</td>
                    <td><input type="text" value="SMFNODE"/></td>
                </tr>
                <tr>
                    <td align="right">终止结点标识字段:</td>
                    <td><input type="text" value="SMTNODE"/></td>
                </tr>
                <tr>
                    <td align="right">流向字段(可选):</td>
                    <td><input type="text" value=""/></td>
                </tr>
            </table>
        </div>
    </div>
    <div class="tab_div">
        <span id="facility_span" class="click_class" onmouseover="changeFacilityClass_onmouseact();" onmouseout="changeFacilityClass_onmouseact();" onclick="changeFacilityClass_onclick();">设施网络分析</span>
        <span id="env_span" class="unclick_class" onmouseover="changeEnvClass_onmouseact();" onmouseout="changeEnvClass_onmouseact();" onclick="changeEnvClass_onclick();">环境设置</span>
    </div>
</div>
</body>
</html>