Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

javascript - WEBGL Globe:从列表中选择一个国家来旋转地球,然后打开一个弹出窗口(WEBGL Globe: rotate the globe by choosing a country from a list and let a popup open)

I know that a topic like this has been already opened ( WebGL globe: how to get data from db and show popup over globe when click globe spot ), but I didn't understand the solution.

(我知道已经打开了一个这样的主题( WebGL globe:如何从db获取数据,以及单击click globe spot时如何在globe上显示弹出窗口 ),但是我不理解该解决方案。)

screen of the interface

(界面画面)

For my project of thesis I choose to use the webGL globe, but not being an expert (honestly, I'm really a beginner), I'm having some issues that I don't know ho to fix.

(对于我的论文项目,我选择使用webGL globe,但不是专家(老实说,我确实是一个初学者),我遇到了一些我不知道要解决的问题。)

I need to insert the possibility to click a country from a list and to have the globe rotating and zooming on the coordinates of that country.

(我需要插入一种可能性,从列表中单击一个国家,并使地球旋转并缩放该国家的坐标。)

I tried to do this using a list of the countries like this:

(我尝试使用类似以下国家/地区的列表来执行此操作:)

    <li onclick="selectedCountry(33.93911,67.709953)" style="cursor:pointer">Afghanistan</li>

  function selectedCountry(lt, lg) {
    console.log(lt, lg)

    var phi = (90 - lt) * Math.PI / 180;
    var theta = (180 - lg) * Math.PI / 180;

    //don't know how to proceed
  }

but being this part of code in the index page, I can't modify the camera/scene setting (it can't find the variable), but moving the function on the globe.js, it doesn't find the two variables lt and lg.

(但是作为索引页面中代码的这一部分,我无法修改相机/场景设置(找不到变量),但是在globe.js上移动函数时,它找不到两个变量lt和lg。)

How can I resolve this problem?

(我该如何解决这个问题?)

I'm sure that it's easy, but I don't know how to move forward.

(我敢肯定这很容易,但是我不知道该如何前进。)

Furthermore, I would need to open a popup displaying some more informations about that country, and I don't need a JSON (it's really a few informations for a few of countries).

(此外,我需要打开一个弹出窗口来显示有关该国家/地区的更多信息,并且不需要JSON(实际上是一些国家/地区的一些信息)。)

Thank you in advance.

(先感谢您。)

  ask by orteiporinof translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...