if row.title ~= "" then table.insert(result," title=\""..row.title.."\" ") end
local ty,bry,linkoffset = 0,0,0
local compy=0
local lh=tonumber(string.match(shape.textLH or '120',"%d+"))/100
if dotItem==1 or (dotItem==2 and row.posType~='n-line') then -- if there is a dotTag in the middle of the shape then use the tag settings
ty=tonumber(string.match(shape.tagSize,"%d+")) or 0
table.insert(result,"style=\"position:absolute; line-height: 120%; top: "..tostring(row.gridy-ty*0.62))
table.insert(result,"px; : "..tostring(row.gridx).."px; width: fit-content; ")
table.insert(result,"text-align: ; color: "..getColor(shape.tagColor).."; background-color: transparent;")
local trf=""
if shape.tagAngle ~="0deg" then trf=" rotate("..shape.tagAngle..")" end
table.insert(result, "transform: translateX(-50%)"..trf.."; font-size: "..shape.tagSize..";")
if shape.tagSpacer~='' then table.insert(result, "letter-spacing:"..shape.tagSpacer..";") end
else -- or add tfx settings for , or align, colors, backgrounds, -outline
table.insert(result,'%d+"))
table.insert(result,'font-size: '..shape.tagSize..'; padding: ;line-height: 85%; top: '..tostring(row.dy+row.gridy-ty*0.52))
else -- it is labelText, so use textLH or 120%
ty=tonumber(string.match(shape.textSZ or '11',"%d+"))
if row.labelPos=='northwest' or row.labelPos=='northeast' then compy=-ty
elseif row.labelPos=='southeast' or row.labelPos=='southwest' then compy=ty/2 end
if row.labelPos and not (row.labelPos== 'auto' or row.labelPos=='') then
bry=(select(2, string.gsub(row.labelText,"
", ""))*lh) -- is it a multiline text? expand by line-height /120%?
if row.posType == 'with-line' then bry=0 end
if row.labelPos=='bottom' or row.labelPos == 'south' then bry = 0 -- and shift by , all or half
elseif row.labelPos=='top' or row.labelPos == 'north' then
if shape.shape=='image:' then bry= 1 + math.min(w/2-10,0)-bry*ty
else bry= -bry*ty+2
end
else bry=-bry*(ty/2 * lh)
end
end
if row.posType == 'photo-panel' then bry=bry+3 end
table.insert(result,'font-size: '..shape.textSZ..'; padding: ;line-height: '..shape.textLH..'; ')
table.insert(result,'top: '..tostring(row.dy+row.gridy+compy+bry-ty*lh/2))
end
table.insert(result,"px; : "..tostring(row.dx+row.gridx).."px; color: "..getColor(shape.textCL).."; ")
table.insert(result,"width: max-content; ")
local trf=""
if shape.textNG ~="0deg" then trf="rotate("..shape.textNG..")" end
if shape.textOL~="" then
table.insert(result,"background-color: "..getColor(shape.textBG).."; ")
table.insert(result,": "..shape.textOL.." solid "..getColor(shape.textCL).."; -radius:;")
else table.insert(result,"background-color: transparent;")
end
if row.labelPos=="" or string.find(row.labelPos,'east') then
table.insert(result,"text-align: ; ")
linkoffset=w
if shape.textNG ~="" then table.insert(result,"transform-origin: ; transform: rotate("..shape.textNG.."); ") end
elseif row.labelPos=="" or string.find(row.labelPos,'west') then
if shape.textNG ~="" then table.insert(result,"transform-origin: ;") end
linkoffset=-w
table.insert(result,"text-align: ; transform: translateX(-100%) "..trf.."; ")
else
table.insert(result,"text-align: ; transform: translateX(-50%) "..trf.."; ")
end
table.insert(result,'font-weight: normal; line-height: '..shape.textLH..'; letter-spacing:'..shape.textSP..'; vertical-align: bottom;')
end
if string.find(shape.textAT or '','bold') then textItem='<b>'..textItem..'</b>' end
if string.find(shape.textAT or '','italic') then textItem='<i>'..textItem..'</i>' end
if shape.textOL=='' and shape.textBG~='transparent' and dotItem==0 then
table.insert(result,'\"><span style=\"background-color: '..getColor(shape.textBG)..'; color:inherit;\">'..textItem..'</span></div>')
else
table.insert(result,"\">"..textItem.."</div>")
end
if tlink~='' and not string.match(row.param1 or "","nolink") then
table.insert(result,makeLinkBox(row.gridx+row.dx+linkoffset, row.gridy+row.dy+bry, 16, row.dotTag..' '..row.title,tlink))
end
end  
local function getshapetable(row,shape) -- Construct CSS divs for a dot from shape and map data
local result={}
local w,h,r=getsize(shape.shapeSize)
local tshape,tlink=checkfortooltip(row.title,row.dx,row.dy,row.dotTag,row.dlink,string.match(row.param1 or "","nolink") )
local align=row.labelPos or ''
local offsetx,offsety=0,0
local ty=tonumber(string.match((shape.tagSize or 9),"%d+" ))
if row.labelText and row.labelText~='' then ty=tonumber(string.match((shape.textSZ or 11),"%d+" ))
else end -- it is just for dotTag, so justify
-- identify align value and extend offsets
local widthzone,heightzone = w/2+4,h/2+4
local theta,r = math.deg( math.atan2(row.dy, row.dx)) , math.sqrt(row.dx^2 + row.dy^2)
if align=='auto' or align=='' then
if (theta < -112 or theta > 112) and math.abs(row.dx)>=w/2 and math.abs(row.dy)<w/1.4 then offsetx=1
elseif (theta > -68 and theta < 68) and math.abs(row.dx)>=w/2 and math.abs(row.dy)<w/1.4 then offsetx=-1
elseif theta <0 then offsety=ty/2-1 -- bottom
else offsety=0-ty/2+1 -- top
end
elseif align=='' or string.find(align,'west') then
row.dx=row.dx - w/2 widthzone=4 offsetx=-1
elseif align=='' or string.find(align,'east') then
row.dx=row.dx + w/2 widthzone=4 offsetx=1 offsety=-ty/2 +1
elseif align=='top' or align=='north' then
if string.find(shape.shape,'curve') then
row.dy=row.dy-(h/2)-12 heightzone=4 offsety=ty/2-1
else
row.dy=row.dy - h-2 heightzone=4 offsety=ty/2-1
end
elseif align=='bottom' or align=='south' then
if string.find(shape.shape,'curve') then
row.dy=row.dy+(h/2) heightzone=4 offsety=ty/2-1
else
row.dy=row.dy + h+2 heightzone=4 offsety=0-ty/2-1
end
end
if r > widthzone and shape.textEW ~= "" and not string.match(row.param1 or "","noline") then
makeLineTo(result, row.gridx+1, row.gridy-1, row.gridx+row.dx+offsetx, row.gridy+row.dy+offsety, shape.textEW, shape.textES,shape.textEC,1)
end
if row.posType and row.posType=='mark-line' then
if row.gridx2 and row.gridy2 then
makeLineTo(result, row.gridx, row.gridy, row.gridx2, row.gridy2, tostring(row.mlWidth)..'px', row.mlStyle, getColor(shape.textEC),row.mlGap)
-- debugmsg('makeLineTo line drawn from '..row.code..' with width '..tostring(row.mlWidth)..'px '..row.mlStyle..' and color '..getColor(shape.textEC))
end
end
if w ~= 0 then
if shape.shape=='itriangle' then shape.shape='triangle' shape.shapeSize=tostring(w)..'px'..tostring(w/2)..'px' end
if shape.shape=="triangle" then
if shape.outlineWidth ~= "" then
makeTriangle(result,row,shape,true,false) -- larger triangle to give the outline, if required
end
makeTriangle(result,row,shape,false,tshape) -- smaller triangle to fit over the top
elseif shape.shape=="square" or shape.shape=="box" or shape.shape=='panel' then
makeSquare(result,row,shape,tshape)
elseif shape.shape=="circle" or shape.shape=="ellipse" then
makeCircle(result,row,shape,tshape)
elseif string.find(shape.shape,'image:')==1 then
makeImage(result,row,shape)
elseif shape.shape=="rulea" or shape.shape=='rule' then
makeRuleA(result,row,shape)
elseif shape.shape=="curvea" or shape.shape=="curvec" then
makeCurveA(result,row,shape)
else -- use a pathshape clipPath
if shape.outlineWidth ~= "" then
makeClipPath(result,row,shape,true,false) -- larger path-shape to give the outline, if required
end
makeClipPath(result,row,shape,false,tshape)
end
end
if row.ppwidth and row.ppwidth>0 then makePhotoPanel(result,row,shape) end
if shape.shape=='panel' and row.labelText then makePanelText(result, row, shape)
else
if row.dotTag and row.dotTag ~= "" then -- there is a dotTag
if (row.dx==0 and row.dy==0) and w>0 then -- it is on the dot so if dotsize is not 0 any label is ignored
makeTextItem(result, row, shape, align, tlink, '<b>'..row.dotTag..'</b>', 1)
else
if row.labelText and row.labelText~='' then -- tag and label both used
makeTextItem(result, row, shape, align, '', '<b>'..row.dotTag..'</b>', 1)
makeTextItem(result, row, shape, align, tlink, row.labelText, 0)
else
makeTextItem(result, row, shape, align, '', '<b>'..row.dotTag..'</b>', 1)