Closed carlos-mg89 closed 5 years ago
@carlos-mg89 Thanks for reporting this. Any chance you could make a small testcase demonstrating this? So we could reproduce it locally?
The code is exactly the same as in https://github.com/CartoDB/mobile-sdk/issues/267
I'm trying to isolate where the issue is.
Definitely, there's an issue with drawing a Line
over the MapView
. I've added only 5 MapPos
objects to the MapPosVector
and the crash still happens. I've commented the code, to make sure the problem is over there (in the displayTrackSegments()
method) and not somewhere in my code and can confirm it.
Drawing a Point
or a Marker
over the map doesn't cause any issues. But drawing a Line
does.
@carlos-mg89 Thanks for the info. I think I have identified the cause - it is related to geometry simplifier. I will fix this in the next RC. Meanwhile, as a workaround you could remote the DouglasPeuckerGeometrySimplifier
from your datasource or use kd-tree index with your datasource (for example, new LocalVectorDataSource(projection, LocalSpatialIndexType.LOCAL_SPATIAL_INDEX_TYPE_KDTREE)
)
That worked perfectly fine :) No issues now, and I believe the results are even better than with the GeometrySimplifier
.
I'll keep it with the LOCAL_SPATIAL_INDEX_TYPE_KDTREE for the moment, however I'd like to ask, what's supposed to have a better performance, the DouglasPeuckerGeometrySimplifier or the kd-tree?
You could use both. GeometrySimplifier helps when you have a long linestring and want to visualize it at low zoom level. kd-tree is useful if you have lots of linestrings, but only few of them are visible at once. Note that RC1 should be fine if you use simplifier with kd-tree. It crashes when you use simplifier without spatial index (which is the default behaviour).
Thanks for the info, will use both then!
SDK4.2.0RC2 is now out and fixes the issue, so I am closing it.
@mtehver I can confirm it works like super great! Thanks for the quick fix :)
When I use LineGeometry, I must use Douglas PeuckerGeometrySimplifier to sequentially extract points to improve performance, otherwise as more and more points are added, the rendering will gradually lag.
When I use PolygonGeometry, if I use Douglas PeuckerGeometrySimplifier and dynamically modify PolygonGeometry, the trajectory will flicker, and the aforementioned flicker will also occur.
Does this mean that PolygonGeometry needs to cooperate with LOCAL SPATIAL INDEX TYPE KDTREE to improve performance;
In addition, if using LineGeometry and then using LOCAL SPATIAL INDEX TYPE Can KDTREE also improve performance?
@mtehver
I've received this crash right after trying to load a Line of 7km on an Android API 28 emulator. I'm not sure if it's related or not with this https://github.com/CartoDB/mobile-sdk/issues/267 issue.
This is the error log: