Thread: [SailfishOS] Mapbox GL Native QML plugin
View Single Post
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#56
Originally Posted by jdrescher View Post
I use a single layer. This is the place where the layer is created:
Code:
//Start new trackline here
//Create fresh temp line array
vLineArray = [];
//Write first coordinate of new track segment to line array
vLineArray.push(coordinate);
//Save that to global array
vTrackLinePoints = vLineArray;

sTrackLine = "lineTrack" + iPausePositionsIndex.toString();

//We have to create a track line here.
map.addSourceLine(sTrackLine, vTrackLinePoints)
map.addLayer("layerTrack" + iPausePositionsIndex.toString(), { "type": "line", "source": sTrackLine })
map.setLayoutProperty("layerTrack" + iPausePositionsIndex.toString(), "line-join", "round");
map.setLayoutProperty("layerTrack" + iPausePositionsIndex.toString(), "line-cap", "round");
map.setPaintProperty("layerTrack" + iPausePositionsIndex.toString(), "line-color", "red");
map.setPaintProperty("layerTrack" + iPausePositionsIndex.toString(), "line-width", 2.0);
Then every new coordinate is pushed to the array vTrackLinePoints. And then I use
Code:
updateSourceLine
to redraw the track line:
Code:
//Create temp line array and set current points array to it. Must use a JS array here necause QML arrays don't allow for push!
vLineArray = vTrackLinePoints;
//Write first coordinate to line array
vLineArray.push(coordinate);
//Save that to global array
vTrackLinePoints = vLineArray;

map.updateSourceLine(sTrackLine, vTrackLinePoints);
I do wonder how can I help with debugging it... Is there any trace available that I can try to load?

sTrackLine = "lineTrack" + iPausePositionsIndex.toString();

seems to suggest that there are several layer tracks or is iPausePositionsIndex always the same?
 

The Following User Says Thank You to rinigus For This Useful Post: