fix: Use geonames for auxiliaries

Otherwise sometimes they will convert points into vectors (ugh!)
  Also adds debugging output.
This commit is contained in:
Glen Whitney 2024-01-18 19:50:56 -08:00
parent f8c95860b8
commit 753311268e

View File

@ -326,7 +326,9 @@ function jToG(
deep := ['circle', 'polygon', 'sector'] deep := ['circle', 'polygon', 'sector']
filling := deep.includes(klass) ? 0.7 : 0.2 filling := deep.includes(klass) ? 0.7 : 0.2
for each face of parts[2] for each face of parts[2]
console.log 'Coloring face', face, 'to', colors[3] if traceC if traceC
console.log 'Coloring face', face, 'to',
colors[3], '=', faceRGB
api.setVisible face, true api.setVisible face, true
api.setFilling face, filling api.setFilling face, filling
api.setColor face, ...faceRGB api.setColor face, ...faceRGB
@ -339,6 +341,8 @@ function jToG(
api.setVisible line, false api.setVisible line, false
else else
lineRGB := joyce2rgb(colors[2] or 'black', cdata.bg) lineRGB := joyce2rgb(colors[2] or 'black', cdata.bg)
if traceC
console.log 'Need to color lines', parts[1], 'with', lineRGB
for each line of parts[1] for each line of parts[1]
console.log 'Coloring line', line, 'to', colors[2] if traceC console.log 'Coloring line', line, 'to', colors[2] if traceC
api.setVisible line, true api.setVisible line, true
@ -869,7 +873,7 @@ classHandler: Record<JoyceClass, ClassHandler> :=
return := freshCommander() return := freshCommander()
{commands, callbacks, parts, auxiliaries} := return.value {commands, callbacks, parts, auxiliaries} := return.value
parts[2].push name parts[2].push name
aux := name + 'aUx' aux := geoname name + 'aUx', cdata.elements, 'point'
switch method switch method
/equilateralTriangle|square|regularPolygon/ /equilateralTriangle|square|regularPolygon/
pt := args.subpoints pt := args.subpoints
@ -933,8 +937,11 @@ classHandler: Record<JoyceClass, ClassHandler> :=
commands.push '' commands.push ''
parts[0].push ...pt parts[0].push ...pt
callbacks.push (api: AppletObject, moreParts: DimParts) => callbacks.push (api: AppletObject, moreParts: DimParts) =>
made := api.evalCommandGetLabels command := `Polygon(${pt.join ','})`
`${name} = Polygon(${pt.join ','})` made := api.evalCommandGetLabels `${name} = ${command}`
if adapParams.config?.commands
console.log 'Finished constructing', name, 'with', command,
'producing', made
if not made return if not made return
for each obj of made.split ',' for each obj of made.split ','
if obj is name continue if obj is name continue