FeatureLayer and Simplerenderer
rb7smutje opened this issue · 3 comments
Hi,
Just checked the DirectionalLineSymbol with a FeatureLayer and Simplerenderer, works fine. However there is a minor problem, after panning (draging) the map the PictureMarkerSymbol is vanishing, only the line stays visible. Only after changing the map scale (zoom), the PictureMarkerSymbol comes back.
`
var Link = new FeatureLayer("http://XXX", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
var picSymbol = new PictureMarkerSymbol();
picSymbol.setUrl("javascript/filled-arrow.png");
picSymbol.setHeight(12);
picSymbol.setWidth(12);
//add a basic polyline
var basicOptions = {
style: SimpleLineSymbol.STYLE_SOLID,
color: new Color([0, 0, 0]),
width: 2,
directionSymbol: picSymbol,
directionPixelBuffer: 40,
showStartSymbol: true
};
var basicSymbol = new DirectionalLineSymbol(basicOptions);
directionalSymbols.push(basicSymbol);
Link.setRenderer(new SimpleRenderer(basicSymbol)
);
map.addLayers([Link ]);`
Thanks for efforts!
Greets,
Gerald
Hi @rb7smutje, can you set up a plunker, jsfiddle or anything else to demonstrate the problem live? Will make it much easier to have a look!
Thanks,
Nick
Hi Nick,
there it is:
http://plnkr.co/edit/261qiMU9VYtWiCxvUWBv?p=preview
I've made a workaround, refreshing the layer after every pan.
mapV.on("pan-end", function(test,lala){
Link.refresh();
//Link.redraw();
});
Thanks,
Regrads,
Gerald
Hey @rb7smutje, have had a quick look and can see what you mean. Pretty sure you have found the fix for feature layers. Appears to be some difference on the extent-changed event handler for Feature layers and graphics layers....or a difference when using the symbol in a renderer, but I never had any issues when testing using graphics layers.
I'm going to close this as you have a solid workaround for feature layers. Thanks for figuring that out!