您好,1.大厦的详细信息(建造日期,楼层数等等)是你的底图数据(后台数据),详细信息需要通过查询功能得到,标记是前端添加的,点击标记获取信息其实是获取的查询结果;
2.这个官网上有范例,http://iclient.supermap.io/examples/classic/editor.html#overlay_vectorDataEvent。
你说的这个功能我这刚好有个demo,用的是范例数据world,你可以参考下,代码如下:
<script type="text/javascript">
var map, layer, vectorLayer, infowin = null;
style = {
fillColor: "red",
strokeColor: "yellow",
pointRadius: 7
},
host = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : 'http://' + document.location.host,
url1 = host + "/iserver/services/map-world/rest/maps/World";
url2 = host + "/iserver/services/data-world/rest/data";
function init() {
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.LayerSwitcher(),
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
})]
});
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url1, { transparent: true, cacheEnabled: true }, { maxResolution: "auto" });
layer.events.on({ "layerInitialized": addLayer });
vectorLayer = new SuperMap.Layer.Vector("Vector Layer");
var callbacks = {
click: function (currentFeature) {
closeInfoWin();
var newHtml = currentFeature.data.CAPITAL;
var popup = new SuperMap.Popup.FramedCloud("popwin",
new SuperMap.LonLat(currentFeature.geometry.x, currentFeature.geometry.y),
null,
newHtml,
null,
true);
infowin = popup;
map.addPopup(popup);
}
};
var selectFeature = new SuperMap.Control.SelectFeature(vectorLayer,
{
callbacks: callbacks
});
map.addControl(selectFeature);
selectFeature.activate();
}
function addLayer() {
map.addLayers([layer, vectorLayer]);
map.setCenter(new SuperMap.LonLat(0, 0), 0);
}
function clearFeatures() {
vectorLayer.removeAllFeatures();
vectorLayer.refresh();
closeInfoWin();
}
function closeInfoWin() {
if (infowin) {
try {
infowin.hide();
infowin.destroy();
}
catch (e) { }
}
}
function getFeaturesByBounds() {
var bounds = map.getExtent();
vectorLayer.removeAllFeatures();
var GetFeaturesByBoundsParameters, getFeaturesByGeometryService;
GetFeaturesByBoundsParameters = new SuperMap.REST.GetFeaturesByBoundsParameters({
datasetNames: ["World:Capitals"],
spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
bounds: bounds,
toIndex: -1
});
getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByBoundsService(url2, {
eventListeners: {
"processCompleted": processCompleted,
"processFailed": processFailed
}
});
getFeaturesByGeometryService.processAsync(GetFeaturesByBoundsParameters);
}
function processCompleted(getFeaturesEventArgs) {
var i, len, features, result = getFeaturesEventArgs.result;
if (result && result.features) {
features = result.features;
for (i = 0, len = features.length; i < len; i++) {
feature = features[i];
feature.style = style;
vectorLayer.addFeatures(feature);
}
}
}
function processFailed(e) {
alert(e.error.errorMsg);
}
</script>