首页 / 浏览问题 / 组件GIS / 问题详情
怎么我照着API的获取没有加载场景
54EXP 2017年03月21日
怎么我照着API的获取并加载场景服务敲的代码没有出图

1个回答

你好,麻烦把你写的代码贴出来看一下
5,985EXP 2017年03月21日

报的这个错

代码和API上的一样的 SuperMap iClient for Plugin

你稍等一下,我找支持SuperMap iClient for Plugin的工程师给你回复一下

您这个问题是浏览器没加载我们插件客户端的插件。然后乱码了,应该是编码不对,用utf-8哈。

另外咱们的插件客户端不支持火狐的,谷歌浏览器支持44以下的版本。

建议使用谷歌44以下版本(需要开启NPAPI)或者IE内核的浏览器。
加个QQ吧我现在在做你们这个,遇到点问题可以吗

怎么你们的API第二部获取加载场景服务做完这个没有出来下拉框没有数据

下拉框准备放什么数据呢?

就是这样的

场景名称?那您得看看你获取的场景名称有没有获取到。
没有场景名称
难道还奥下插件吗?

要加载一个三维服务才会有场景名称的。

您可能是只初始化了一个三维球,但是并没有加载某个服务?

比如这个三维服务页面:

http://support.supermap.com.cn:8090/iserver/services/3D-sample/rest/realspace

点scenes可看见好几个场景,您可以发请求返回这些场景的名字,添加到下拉列表内,然后打开即可。

支持的请求,点scenes页面的右下角列出来了,比如:

http://support.supermap.com.cn:8090/iserver/services/3D-sample/rest/realspace/scenes.json

打开某个场景:

var sceneUrl =http://support.supermap.com.cn:8090/iserver/services/3D-sample/rest/realspace;

scene = sceneControl.get_scene();
scene.open(sceneUrl, "scene");

这个写在页面还是写在你们的js里面
您的页面。打开场景要引用我们js,然后调用接口哈。

发请求的,您随便找个发请求的就可以了(比如jQuery的ajax),返回的是字符串。

http://localhost:8090/iserver/services/realspace-sample/rest/realspace

找个要您启动了我们iserver才有呀。

这样了 这是什么意思

只有左边没有那个scene了

什么意思?

怎么不对

这样吧,您再仔细看看我们的手册。

http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iClient8CSP1/iClient3D/Help.htm

找个页面,搜索关键字“所有场景”,结果里面第一个。

有demo吗发哥给我 邮箱791424397@qq.com

不用发哈,直接跟您参考在线demo。

http://support.supermap.com.cn:8090/iserver/iClient/for3D/plugin/samplecode/default.html

您看一下,功能列表然后点运行代码。

要看代码查看源代码看,别参考上面页面给出的,因为在线页面看见的代码可能有没更新的,以在线范例的源代码为准。

这个scenelist怎么没有值

不太明白您说的。
示范场景是这样的,打开就这样的。您是想看见什么呢?
哦 我不太懂这个 但是API里面的SceneList 里面是有值的啊
SceneList是通过代码把场景添加进去了的,您要是获取不到,请确认您的服务地址是否写正确。
这是示范:
sceneAddress = document.getElementById("ServerAddress").value;
    var sceneServicesList = sceneControl.get_sceneServicesList();
    //从输入框中获取到服务器地址,并加载服务器上的场景列表
    var bLoad = sceneServicesList.load(sceneAddress);
    //如果场景服务加载成功,则获取每个场景的名字                        
    if (bLoad)
    {
         var sceneList = document.getElementById("SceneList");
         if (sceneList.length > 0)
         {
              sceneList.length = 0;
         }
         //获取场景列表中有多少条记录,即服务器提供了多少个场景服务
         var count = sceneServicesList.get_count();
         //在场景服务列表的下拉框中罗列出服务器提供的所有场景服务
         for(var i=0; i<count; i++)
         {
              var oPtion = document.createElement("option");
              oPtion.value = sceneServicesList.get_item(i).get_name();
              oPtion.text = oPtion.value;
              //默认选中第一个场景服务
              if (i == 0)
              {
                   oPtion.selected = true;
              }
              sceneList.options.add(oPtion);
         }
    }
var scene = null;
var sceneControl = null;
var htmlUrl = document.location.host;
 var sceneAddress = null;
        var sceneName = null;

//判断网页的打开方式是本地打开还是通过网络打开
//不同的打开方式url赋值不同
if(htmlUrl == "")
{       
        htmlUrl = "http://localhost:8090";
}
else
{
        htmlUrl = "http://" + htmlUrl;
}
function onPageLoad()
{
    try
    {
                //获取 html 页面中名为 sceneControlDiv 的 div 对象作为场景控件
        sceneControl = new SuperMap.Web.UI.Controls.SceneControl($get("sceneControlDiv"), initCallback, failedCallback);
        }
        catch(e)
        {
                //若没有安装插件,则抛出该异常。
          if (e.name == SuperMap.Web.Realspace.ExceptionName.PlugInNotInstalled)
                {
                        var url = htmlUrl + "/SuperMapRealspace/SuperMap iClient 6R for Realspace.exe";
                        document.write("<a href='"+url+"'>请点击下载SuperMap iClient3D for Plugin插件进行安装</a>");
                        return;
                }
                //若使用暂不支持的浏览器,则抛出该异常
          else if (e.name == SuperMap.Web.Realspace.ExceptionName.BrowserNotSupport)
                {
                        document.write("<p>SuperMap iClient3D for Plugin目前不支持此浏览器。</p>");
                        return;
                }
                //抛出其他异常
                else
                {
                        alert(e.message);
                }
        }       
}
//控件初始化完成后的回调函数,初始化完成之后才能进行数据加载                         
function initCallback()
{
    //获取 Realspace 控件的场景,控件和场景是一对一关系
    var sceneUrl =" http://support.supermap.com.cn:8090/iserver/services/3D-sample/rest/realspace";
    scene = sceneControl.get_scene();
    scene.open(sceneUrl, "scene");
  sceneAddress = htmlUrl + "/iserver/services/realspace-sample/rest/realspace";
 
    var sceneServicesList = sceneControl.get_sceneServicesList();
    //从输入框中获取到服务器地址,并加载服务器上的场景列表
    var bLoad = sceneServicesList.load(sceneAddress);
    //如果场景服务加载成功,则获取每个场景的名字                        
    if (bLoad)
    {
         var sceneList = document.getElementById("SceneList");
         if (sceneList.length > 0)
         {
              sceneList.length = 0;
         }
         //获取场景列表中有多少条记录,即服务器提供了多少个场景服务
         var count = sceneServicesList.get_count();
         //在场景服务列表的下拉框中罗列出服务器提供的所有场景服务
         for(var i=0; i<count; i++)
         {
              var oPtion = document.createElement("option");
              oPtion.value = sceneServicesList.get_item(i).get_name();
              oPtion.text = oPtion.value;
              //默认选中第一个场景服务
              if (i == 0)
              {
                   oPtion.selected = true;
              }
              sceneList.options.add(oPtion);
         }
    }

}
帮我看看应该没有错是吧
您看一下您前台代码,HTML里面有SceneList这个元素吗?

您最好是调试代码,有问题或者保存一下就看出来了。
<!DOCTYPE >
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
<meta http-equiv="Content-Type" content="text/html; utf-8"/>
<title>SuperMap iClient3D for Plugin GettingStarted</title>
<!--引用 SuperMap.Include.js,实现将 SuperMap.Include.js 中的库文件在该 html 中引用-->
<script type="text/javascript" src="scripts/SuperMap.include.js"></script>
<!--引用 GettingStarted.js,系统具体功能在该脚本中实现-->
<script type="text/javascript" src="scripts/GettingStarted.js"></script>

<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
    //首先利用 MicrosoftAjax 框架扩展 SceneAction,扩展类名为 MyAction。
SuperMap.Web.UI.Action3Ds.MyAction = function(sceneControl)
{
    SuperMap.Web.UI.Action3Ds.MyAction.initializeBase(this);
    this._name = "myAction";
    this._sceneControl = sceneControl;
    this._type = SuperMap.Web.UI.Action3Ds.SceneActionType.PAN;
};
SuperMap.Web.UI.Action3Ds.MyAction.prototype ={
    dispose:function()
    {
        this._sceneControl = null;
    },
    //鼠标左键按下后弹出当前鼠标所在的经纬度、高度以及相机高度的提示。其中参数 e 就是 EventObject 类型。
    onMouseDown:function(e)
    {
        alert("经度:"+e.get_longitude()+ "\n" +"纬度:"+e.get_latitude()+"\n"
              +"高度:"+e.get_altitude()+"\n" +"相机高度:"+e.get_cameraAltitude()
              +"\n" +"键值:"+e.get_flagType());
    }
};
SuperMap.Web.UI.Action3Ds.MyAction.registerClass('SuperMap.Web.UI.Action3Ds.MyAction',SuperMap.Web.UI.Action3Ds.SceneAction,Sys.IDisposable);
           function getInfo(){
    sceneControl = new SuperMap.Web.UI.Controls.SceneControl(document.getElementById("sceneControlDiv"));  
    var myAction = new SuperMap.Web.UI.Action3Ds.MyAction(sceneControl);
    sceneControl.set_sceneAction(myAction());
}                           
</script>
</head>
<body onload="onPageLoad()">
<!--场景控件-->
 <div id="sceneControlDiv" style="position:absolute;left:5px;top:35px;bottom:5px;right:5px; width: 78%; float: right;">
    </div>     
    <!--信息窗-->
<div id="infoWindow" style=" left:0px; top:0px; width: 20%; visibility: visible; display: block; float: right;
clear: both; cursor: auto; overflow: auto; position: relative; height: 100%; background-color:#B6D6EF;
font-family: 仿宋_GB2312;">
<!--服务器地址输入框-->
<p><label for="input">ServerAddress: </label></p>
<!--在本行中value后面的值是请求的服务器地址,这个值需要用户根据实际的服务进行修改-->
<p>
<input id="ServerAddress" name="ServerAddress" type="text"
               value="http://localhost:8090/iserver/services/realspace-sample/rest/realspace" />
</p>
<!--场景场景服务列表-->
<p><label for="sceneList" >Scenelist:</label></p>
<p><select id="SceneList" name="SceneList" ></select></p>
<p><input id="SceneLoad" type="button" value="SceneLoad" onclick="return SceneLoad_onclick()" /></p>
<p><input  id="SceneOpen" type="button" value="SceneOpen" onclick="return SceneOpen_onclick()" /></p>
</div>
<!--工具条-->
<div id="toolSet" style="position: relative; top:0px; height: 5%; width: 100%; visibility:
      visible; display: block;">
      <!--距离量算-->
<img id="refresh" alt="量算" title="量算" src="images/measure_distance.png"
     style="position:relative; left:90px; width:32px; height:32px; z-index:11; "  
     onclick="measureDistance()"
     onmouseover="this.style.width='36px';this.style.height='36px';
                                                this.src='images/measure_distance_over.png'"
     onmouseout="this.style.width='32px';this.style.height='32px';this.src='images/measure_distance.png'" />
      <!--选择-->
<img id="select" alt="选择" title="选择" src="images/select.png"
     style="position:relative; left:80px; width:32px; z-index:11; "  
     onclick="setSelect()"
     onmouseover="this.style.width='36px';this.style.height='36px';this.src='images/select_over.png'"
     onmouseout="this.style.width='32px';this.style.height='32px';this.src='images/select.png'" />
      <!--漫游-->
<img id="pan" alt="漫游" title="漫游" src="images/pan.png"
     style="position:relative;left:70px;width:32px; height:32px; z-index:11; "
     onclick="setPan()"
     onMouseOver="this.style.width='36px';this.style.height='36px';this.src='images/pan_over.png'"
     onMouseOut="this.style.width='32px';this.style.height='32px';this.src='images/pan.png'" />
      <!--全幅显示-->
<img id="viewentire"alt="全幅显示" title="全幅显示" src="images/entire.png"
     style="position:relative; left:60px; width:32px; height:32px; z-index:11;"
     onclick="viewEntire()"
     onMouseOver="this.style.width='36px';this.style.height='36px';this.src='images/entire_over.png'"
     onMouseOut="this.style.width='32px';this.style.height='32px';this.src='images/entire.png'" />
<!--通过设定经纬度和相机高度进行飞行-->
<label style="position:relative; left: 10px; top: 10px;">经度:</label>
<input id="longitude" name="longitude" type="text" value="0" style="position:relative; left:10px;
         width:60px; z-index:11; "/>
<label style="position:relative; left: 20px;top: 10px;">纬度:</label>
<input id="latitude" name="latitude" type="text" value="0" style="position:relative; left:20px;
          width:60px; z-index:11; "/>
<label style="position:relative; left: 30px;top: 10px;">高度:</label>
<input id="altitude" name="altitude" type="text" value="500000" style="position:relative; left:30px;
             width:60px; z-index:11; "/>
<img id="fly" alt="飞行" title="飞行" src="images/fly.png"
     style="position:relative; left:50px; width:32px; z-index:11;"
     onclick="fly()"
     onmouseover="this.style.width='36px';this.style.height='36px';this.src='images/fly_over.png'"
     onmouseout="this.style.width='32px';this.style.height='32px';this.src='images/fly.png'"/>
</div>
</body>
</html>

您调试一下代码吧。
您先调试一下代码,要是发现不问题,您装一个TeamViewer

我再远程给您调试
我有teamViewer 帮我调试下
明天早上给您远程
好的谢谢
你好 !在吗能帮我远程吗
TV号发我
256 895 510
密码呢~
3416
iserver下载完之后,先启动服务,运行这个文件..\SuperMap\supermap_iserver_8.1.0_win64_zip\bin\startup.bat

最好是先打开iDesktop自动生成试用许可,再运行iserver。
这个安装完成了就可以用了是吧
iserver应该是解压就可以了

这个是什么

supermap 许可不可用怎么办
之前我都给您说了

最好是先打开iDesktop自动生成试用许可,再运行iserver。

什么情况

下午在帮我 远程下吧 谢谢!
再发一下ID密码
现在吗
256 895 510
8931
进服务器需要开启什么吗 怎么我服务器进不去了
运行了startup就可以。

默认网址:localhost:8090
你好!我要写个脚本调用你们公司的地图,然后获取你们公司的地图信息!请问能不能给我点思路
你们这个产品要跑起来的步骤是什么 比如说 先加载地球,在加载场景,在加载图层是这样的吗

可以这么理解。

只要数据做好之后,打开场景,会包含图层的。

建议您多看看我们的示范代码,还有就是培训资料。

http://support.supermap.com.cn/product/vedio.aspx?PRODUCT_TYPE=2

...