我有一個基礎地圖圖層,添加了地圖的要素圖層。路線表由FeatureTable
生成,每當在表格或地圖上點擊路線時,路線的顏色將從綠色變爲紅色。我的問題是,如果我放大或縮小地圖,路線會變回綠色,並顯示紅色輪廓。如果我點擊路線,它會變回紅色,但我需要它保持紅色。下面顯示了我的代碼。任何幫助,將不勝感激。當地圖被縮放時,選擇符號消失
var map, stateBaseMap, geometryLayer, routeFeature, routeDataFeature, myFeatureTable,
stateBaseMapUrl, geometryLayerUrl, routeFeatureUrl, routeDataFeatureUrl, routeChange;
require([ "esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/tasks/GeometryService",
"esri/layers/FeatureLayer",
"esri/dijit/FeatureTable",
"esri/symbols/SimpleLineSymbol",
"esri/Color",
"dijit/layout/ContentPane",
"dijit/layout/BorderContainer",
"esri/geometry/Extent",
"esri/graphicsUtils",
"esri/tasks/query",
"dojo/dom",
"dojo/parser",
"dojo/ready",
"dojo/on"],
function(Map,
ArcGISDynamicMapServiceLayer,
ArcGISTiledMapServiceLayer,
GeometryService,
FeatureLayer,
FeatureTable,
SimpleLineSymbol,
Color,
ContentPane,
BorderContainer,
Extent,
graphicsUtils,
Query,
dom,
parser,
ready,
on) {
parser.parse();
ready(function(){
esri.config.defaults.io.proxyUrl = "/llr/llrproxy";
esri.config.defaults.io.alwaysUseProxy = false;
esri.config.defaults.io.corsDetection = false;
stateBaseMapUrl = document.getElementById("shipment_stateBaseMapServiceURL").value;
geometryLayerUrl = document.getElementById("shipment_geometryServiceURL").value;
routeFeatureUrl = document.getElementById("shipment_routeLayerURL").value;
map = new Map("map");
stateBaseMap = new ArcGISTiledMapServiceLayer(stateBaseMapUrl);
map.addLayer(stateBaseMap);
geometryLayer = new GeometryService(geometryLayerUrl);
map.addLayer(geometryLayer);
routeFeature = new FeatureLayer(routeFeatureUrl, {
mode : FeatureLayer.MODE_ONDEMAND,
outFields : [ "*" ],
visible:true,
id : "routeFeature"
});
var selectionSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]),6);
routeFeature.setSelectionSymbol(selectionSymbol);
map.addLayer(routeFeature);
on(routeFeature, "load", function(){
loadTable();
});
function loadTable(){
myFeatureTable = new FeatureTable({
featureLayer : routeFeature,
map : map,
editable: false,
showGridMenu:false,
gridOptions: {
selectionMode: "single"
},
editable: true,
fieldInfos: [
{
name: 'ROUTE_ID',
visible: false
},
{
name: 'ORIGIN',
alias: 'Entry State'
},
{
name: 'ROUTE_DESC',
alias: 'Route Description'
},
{
name: 'DESTNATION',
alias: 'Exit State'
}
],
menuFunctions: [
{ label: "Enter a new route.", callback: enterNewRoute }
]
}, 'myTableNode');
myFeatureTable.startup();
}
});
});
您的示例向我顯示了問題,但我不知道如何解決該問題。選擇符號首先被加載,其餘的地圖圖層被加載在它們之上。這就是我的地圖上發生的事情。紅色選擇符號在縮放後首先加載,然後將綠色路線加載到它們之上。你的例子也會發生同樣的事情。縮小並在縮放後首先顯示紅色菱形,然後顯示綠色數據。如果你縮小足夠遠的紅色鑽石被掩蓋起來。有沒有辦法扭轉顯示順序? – ponder275