我正在尝试创建一个界面,用户可以在其中使用三个简单的 HTML 单选按钮选择他们的视图。我已经设法让插件使用适当的视图进行初始化(由我选择的默认单选按钮决定),但选择不同的单选按钮仍然没有任何作用。相关代码如下:
document.getElementById('ui').innerHTML =
'<div>' +
'<h2>Select View:</h2>' +
'<input type="radio" name="view" value="valley" id="valley" onclick="ge.getView().setAbstractView(\'valleyview\');"/ checked> Full Valley<br/>' +
'<input type="radio" name="view" value="takten" id="takten" onclick="ge.getView().setAbstractView(\'taktenview\');"/> Takten Ling Monastery<br/>' +
'<input type="radio" name="view" value="stupa" id="stupa" onclick="ge.getView().setAbstractView(\'stupaview\');"/> Jonang Stupa<br/>' +
'</div>' +
'<br/>';
}
function initCallback(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
// add a navigation control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// add some layers
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, false);
ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, false);
var la = ge.createLookAt('');
if(document.getElementById('valley').checked) {
la.set(29.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
}else if(document.getElementById('takten').checked) {
la.set(30.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
}else if(document.getElementById('stupa').checked) {
la.set(31.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
}
ge.getView().setAbstractView(la);
var valleyview = ge.createLookAt('');
valleyview.set(29.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
var taktenview = ge.createLookAt('');
taktenview.set(30.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
var stupaview = ge.createLookAt('');
stupaview.set(31.36890346613675, 88.0025304326977,
25, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
180, // heading
60, // straight-down tilt
500 // range (inverse of zoom)
);
任何关于我可能做错的指针都将不胜感激。谢谢。