Код: Выделить всё
function MapHelper() {
...
this.map;
this.track = null;
...
}
MapHelper.prototype.createLayers = function () {
...
this.track = new OpenLayers.Layer.PointTrack('Track', { styleFrom: OpenLayers.Layer.PointTrack.SOURCE_NODE, style: { strokeColor: '029aee', strokeWidth: 3} });
this.map.addLayer(this.track);
this.layerrequests.push('Track');
...
}
MapHelper.prototype.showTrack = function (techserial, day) {
if (techserial != undefined) {
var trackLayer = this.track;
var b = mapHelper.map.getExtent();
if (day == null || day < 0) day = 0;
var params = {
top: b.top,
right: b.right,
bottom: b.bottom,
left: b.left,
tech: techserial,
day: day,
r: Math.random()
};
ajaxWrapper({
type: "POST",
url: "Tech.spx/GetTrack",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(params),
success: function (result) {
trackLayer.removeAllFeatures();
if (typeof (result) != "undefined" && null != result.d) {
var trackpoints = [];
$(result.d.trackpoints).each(function (i, e) {
var pnt = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(e.x, e.y));
trackpoints.push(pnt);
});
trackLayer.addNodes(trackpoints);
trackLayer.redraw();
}
}
}, false);
}
}
Если я что-то сделал не так, подскажите как правильно.
PS другие слое-подложки (топография и т.д.) отображается.