# HG changeset patch # User kyberneticist@gmail.com # Date 1389739359 0 # Node ID b1b18eeea04e27a751720b26e629867b6ff77fa9 # Parent 8473f5d4d8172a18ebedb948127b76eb7581d4cf Edited wiki page SVGImport through web user interface. diff -r 8473f5d4d817 -r b1b18eeea04e SVGImport.wiki --- a/SVGImport.wiki Tue Jan 14 21:54:39 2014 +0000 +++ b/SVGImport.wiki Tue Jan 14 22:42:39 2014 +0000 @@ -37,8 +37,10 @@ The coordinates should now be rounded for use by the crude script in (10) unless you plan to handle that yourself in some way. Here is a vim one-liner to do it. {{{:s/[0-9][0-9.]*/\=float2nr(floor(submatch(0)*1))/g}}} -Also, it is probably a good idea to remove duplicate points. Here's a regex for that. {{{s/\(L\d\+ \d\+ \)\1/\1/g}}} - you should run that a couple of times, then {{{s/M\(\d\+ \d\+ \)L\1/M\1/g}}}. That just cuts down on a bit of redundancy. - +Also, it is probably a good idea to remove duplicate points. Here's a regex for that. {{{s/\(L\d\+ \d\+ \)\1/\1/g}}} - you should run that a couple of times, then {{{s/M\(\d\+ \d\+ \)L\1/M\1/g}}}. That just cuts down on a bit of redundancy. If these regexes match anything, you probably should rerun them. +Since this page is a mass of hacks, here's one more redundancy reducer, in bash this time. +{{{rm dupes.txt;PREVXY=(99999 99999);sed 's/\([LM]\)/\n\1/g' inputfile | while read f;do read -a XY <<< "${f:1}";if [ "${f:0:1}" != "M" ];then if((${XY[0]}-${PREVXY[0]}<3&&${XY[0]}-${PREVXY[0]}>-3&&${XY[1]}-${PREVXY[1]}<3&&${XY[1]}-${PREVXY[1]}>-3));then echo "$f" >> dupes.txt;else echo $f;fi;else echo $f;fi;PREVXY[0]=${XY[0]};PREVXY[1]=${XY[1]};done | xargs > inputfile.dedupe}}} +If dupes.txt has anything in it, you probably should run it again. Anyway, running these reduced a complex test trace from ~8800 points down to ~6500. 9) Convert the path data. Here is a crude script to do that. Note this one uses a line size of 1 (that's the 0x01 business). If you want larger lines you can pick anything between 0x00 and 0x3F. That's 6-636. See the [DrawnMapFormat] wiki page.