CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
182 stars 65 forks source link

line-join not working with dash array #353

Closed farfromrefug closed 4 years ago

farfromrefug commented 4 years ago

i use this:

dash/line-width: 7;
dash/line-color: black;
dash/line-join: round;
dash/line-dasharray: 7,13;

As you can see the line join is not working tns-NativeScriptActivity-04072020112206

mtehver commented 4 years ago

It is true that 'line-join' is ignored for this sample. In fact, SDK only uses 'miter' line join type for normal lines and 'no join' for dashed/patterned lines. The CartoCSS parameter is simply ignored without warning. There are a few technical and performance reasons for this.

In the screenshot - is this about the black dash element being cut? If that is the case, then this is not really about line joins but about tiling. SDK does not try to align dash patterns between consecutive tiles. In some cases it is possible to do this, I tried to get this working but there were some issues and there are currently artifacts at tile boundaries.

farfromrefug commented 4 years ago

No the error is about the dot being squared and not round. So as you say it is because it is simply not implemented . is that because you actually render dash lines as bitmap?

farfromrefug commented 4 years ago

@mtehver couldn't we just draw a rounded rect here?

mtehver commented 4 years ago

I think you mean line-cap property, not line-join? You are correct, this is not currently implemented. I will take a look into this later this week.

farfromrefug commented 4 years ago

@mtehver just tried your latest changes and it crashes. I would guess it is happening while drawing dash array.

04-18 11:04:28.586 23540 23646 I carto-mobile-sdk: MBTilesTileDataSource::loadTile: Loading MapTile [x=2113, y=1470, zoom=12, frameNr=0, id=11615638]
04-18 11:04:28.839 23540 23540 W kylas.alpi.map: Accessing hidden field Landroid/view/View;->mAccessibilityDelegate:Landroid/view/View$AccessibilityDelegate; (light greylist, reflection)
04-18 11:04:29.003 23540 23619 F libc    : Fatal signal 8 (SIGFPE), code -6 (SI_TKILL) in tid 23619 (Thread-9), pid 23540 (kylas.alpi.maps)
04-18 11:04:29.028  3142  3155 I ActivityManager: Displayed akylas.alpi.maps/com.tns.NativeScriptActivity: +14s67ms
04-18 11:04:29.056  3995  3995 D com.android.launcher3.LauncherStateManager: goToState: changing state to ch.deletescape.lawnchair.states.HomeState@6a6f490
04-18 11:04:29.057  3995  3995 D com.android.launcher3.LauncherStateManager: goToState: going to state ch.deletescape.lawnchair.states.HomeState@6a6f490
04-18 11:04:29.118 23654 23654 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
04-18 11:04:29.119  3069  3069 I /system/bin/tombstoned: received crash request for pid 23619
04-18 11:04:29.120 23654 23654 I crash_dump32: performing dump of process 23540 (target tid = 23619)
04-18 11:04:29.149 23654 23654 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-18 11:04:29.149 23654 23654 F DEBUG   : LineageOS Version: '16.0-20190908-UNOFFICIAL-a3y17lte'
04-18 11:04:29.149 23654 23654 F DEBUG   : Build fingerprint: 'samsung/a3y17ltexx/a3y17lte:8.0.0/R16NW/A320FXXU3CRF2:user/release-keys'
04-18 11:04:29.150 23654 23654 F DEBUG   : Revision: '0'
04-18 11:04:29.150 23654 23654 F DEBUG   : ABI: 'arm'
04-18 11:04:29.150 23654 23654 F DEBUG   : pid: 23540, tid: 23619, name: Thread-9  >>> akylas.alpi.maps <<<
04-18 11:04:29.150 23654 23654 F DEBUG   : signal 8 (SIGFPE), code -6 (SI_TKILL), fault addr --------
04-18 11:04:29.150 23654 23654 F DEBUG   :     r0  00000000  r1  00005c43  r2  00000008  r3  00000010
04-18 11:04:29.150 23654 23654 F DEBUG   :     r4  00000010  r5  00000010  r6  00000002  r7  0000010c
04-18 11:04:29.150 23654 23654 F DEBUG   :     r8  d2400e7c  r9  00000000  r10 d5916c10  r11 d2400ec8
04-18 11:04:29.150 23654 23654 F DEBUG   :     ip  00000000  sp  d2400dd0  lr  d3c71c5f  pc  f37d6fb8
04-18 11:04:29.155 23654 23654 F DEBUG   :
04-18 11:04:29.155 23654 23654 F DEBUG   : backtrace:
04-18 11:04:29.155 23654 23654 F DEBUG   :     #00 pc 00055fb8  /system/lib/libc.so (tgkill+12)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #01 pc 0019ac5b  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #02 pc 0039c05b  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #03 pc 003d9e27  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #04 pc 002cefa7  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #05 pc 0022565d  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #06 pc 00218af9  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.155 23654 23654 F DEBUG   :     #07 pc 0019c74b  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.156 23654 23654 F DEBUG   :     #08 pc 0019c3f7  /data/app/akylas.alpi.maps-PsAPKLvr0z-LdWz10emkdQ==/lib/arm/libcarto_mobile_sdk.so (offset 0x181000)
04-18 11:04:29.156 23654 23654 F DEBUG   :     #09 pc 000646b5  /system/lib/libc.so (__pthread_start(void*)+22)
04-18 11:04:29.156 23654 23654 F DEBUG   :     #10 pc 0001dffd  /system/lib/libc.so (__start_thread+22)
04-18 11:04:29.211 23654 23654 W crash_dump32: type=1400 audit(0.0:2188): avc: denied { read } for name="system@app@LineageBlackTheme@LineageBlackTheme.apk@idmap" dev="mmcblk0p24" ino=220328 scontext=u:r:crash_dump:s0:c76,c263,c512,c768 tcontext=u:object_r:resourcecache_data_file:s0 tclass=file permissive=0
04-18 11:04:29.211 23654 23654 W crash_dump32: type=1300 audit(0.0:2188): arch=40000028 syscall=322 per=8 success=no exit=-13 a0=ffffff9c a1=f529e1e0 a2=a0000 a3=0 items=0 ppid=1 auid=4294967295 uid=11868 gid=11868 euid=11868 suid=11868 fsuid=11868 egid=11868 sgid=11868 fsgid=11868 tty=(none) ses=4294967295 exe="/system/bin/crash_dump32" subj=u:r:crash_dump:s0:c76,c263,c512,c768 key=(null)
04-18 11:04:29.211  2736  2736 W auditd  : type=1327 audit(0.0:2188): proctitle=63726173685F64756D7033320032333631390032333635310031
04-18 11:04:29.211  2736  2736 W auditd  : type=1320 audit(0.0:2188):
04-18 11:04:30.197  3069  3069 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_49
04-18 11:04:30.203  3142 23657 W ActivityManager:   Force finishing activity akylas.alpi.maps/com.tns.NativeScriptActivity
04-18 11:04:30.206  3142  3162 I BootReceiver: Copying /data/tombstones/tombstone_49 to DropBox (SYSTEM_TOMBSTONE)
04-18 11:04:30.201 23619 23619 W Thread-9: type=1701 audit(0.0:2189): auid=4294967295 uid=11868 gid=11868 ses=4294967295 subj=u:r:untrusted_app:s0:c76,c263,c512,c768 exe="/system/bin/app_process32" sig=8
04-18 11:04:30.334  3142  3455 I WindowManager: WIN DEATH: Window{f1d515 u0 akylas.alpi.maps/com.tns.NativeScriptActivity}
04-18 11:04:30.336  3142  8708 I ActivityManager: Process akylas.alpi.maps (pid 23540) has died: fore TOP

The log is not saying much. I am thus trying to build the sdk in debug. Now strangely it wont build in Debug while it does in release.

[100%] Linking CXX shared library libcarto_mobile_sdk.so
/Volumes/dev/carto/mobile-sdk/libs-carto/geocoding/src/geocoding/Geocoder.cpp:0: error: undefined reference to 'carto::geocoding::Geocoder::TOKEN_QUERY_LIMIT'
/Volumes/dev/carto/mobile-sdk/libs-carto/geocoding/src/geocoding/Geocoder.cpp:0: error: undefined reference to 'carto::geocoding::Geocoder::TOKEN_QUERY_LIMIT'
/Volumes/dev/carto/mobile-sdk/libs-carto/geocoding/src/geocoding/Geocoder.cpp:0: error: undefined reference to 'carto::geocoding::Geocoder::ENTITY_QUERY_LIMIT'
/Volumes/dev/carto/mobile-sdk/libs-carto/geocoding/src/geocoding/Geocoder.cpp:0: error: undefined reference to 'carto::geocoding::Geocoder::ENTITY_QUERY_LIMIT'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libcarto_mobile_sdk.so] Error 1
make[1]: *** [CMakeFiles/carto_mobile_sdk.dir/all] Error 2
make: *** [all] Error 2
Error while executing cmake (path /Volumes/dev/carto/mobile-sdk/build/android-armeabi-v7a):

Tried a clean build without success

mtehver commented 4 years ago

@farfromrefug Can you share your style? A crashing test app would be especially helpful.

farfromrefug commented 4 years ago

@mtehver i did not have time to create a sample app but i can say in fact that the change you made yesterday fixed it! So thank you! Now it gives the opportunity to test the line-cap and give you some feedback. It works but it behave weirdly as i zoom. Actually i think it is a issue with dash array zooming. Apr-19-2020 21-35-35 As you can see the dash seems to be stretching as i zoom between 17 and 18 for example. and it jumps back to the right drawing on each integer zoom value. Not a big deal per say except that then what i am trying to achieve, which is the render you got here for a gondola, is not possible. I think the issue is that dash pattern is stretching on only one axis if you see what i mean. In fact removing the stretching i think would fix the render

mtehver commented 4 years ago

@farfromrefug The stretching on one axis at fractional zoom levels is the intended behavior. Without stretching other artifacts would appear, especially at the tile boundaries.

farfromrefug commented 4 years ago

@mtehver ok can you point me where this is actually applied? Would like to disable it and see what it looks like. thanks!

mtehver commented 4 years ago

@farfromrefug You can try removing this line:

https://github.com/CartoDB/mobile-carto-libs/blob/master/vt/src/vt/GLTileRenderer.cpp#L1539

farfromrefug commented 4 years ago

@mtehver indeed i see now what happens and it is ugly. However i dont really get why it happens. My question is this. Even if i use a line pattern i will get the same result so it means there is no way to draw a square, a round or anything that have a shape that should not be "scaled" as a line pattern?

mtehver commented 4 years ago

@farfromrefug Correct, there is no way doing this, due to fractional scaling/tiling.

farfromrefug commented 4 years ago

@mtehver is it something that can be fixed? I mean can we imagine to be able to fix that in the future?

mtehver commented 4 years ago

@farfromrefug I do not see any option to fix this. It is about trading one form of artifacts versus other artifacts. For standard map symbology (thin dashed lines) the current implementation is more or less optimal.

farfromrefug commented 4 years ago

@mtehver couldn't we look at how Mapbox is doing it? I see they have it working https://github.com/mapbox/mapbox-gl-native/issues/15930

mtehver commented 4 years ago

@farfromrefug CARTO SDK behaves same way as MapBox Web client, as far as I could see. Perhaps we have drifted from the original issue, which should be fixed in 4.3.0. If there is anything else, perhaps it makes to sense to reformulate this under a new github issue?

farfromrefug commented 4 years ago

@mtehver sure will open a new issue