route single app

Vasilev5 years ago

Hello,
i see that this function is used: loadReport: function (store, data) { (if i am not wrong)

is there a sample function using ajax ? not using whole framework :)
thank you !

Vasilev5 years ago

i am till here:

reportRoute = [];

         for (i = 0; i < data.length; i++) {
          var position = data[i];
          var marker = markers[position.deviceId];
          var deviceId = position.deviceId; 
          var point = new ol.geom.Point(ol.proj.fromLonLat([position.longitude, position.latitude]));
          if (i === 0 || data[i].deviceId !== data[i - 1].deviceId) {
                reportRoute.push(new ol.Feature({
                    geometry: new ol.geom.LineString([])
                }));
                reportRoute[reportRoute.length - 1].setStyle(getRouteStyle(data[i].deviceId));
                source.addFeature(reportRoute[reportRoute.length - 1]);
            }
          reportRoute[reportRoute.length - 1].getGeometry().appendCoordinate(point);

not sure if this is correct way, just saw from the app.
if you can give me hint :)

thanks