Displays a diagram by placing in the page HTML, a <svg> tag. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsFlowchart::Generate | (hzChain&,hzHttpEvent*,uint32_t&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsFlowchart::Generate (hzChain& Z)hzHttpEvent* pE, uint32_t& nLine,
{
// Displays a diagram by placing in the page HTML, a <svg> tag.
//
// Arguments: 1) Z The HTML output chain
// 2) pE The HTTP event being responded to
// 3) nLine Line number tracker (controls NL printing)
//
// Returns: None
_hzfunc("hdsFlowchart::Generate") ;
hdsText TX ; // Current text
hdsGraphic* pG ; // Current shape
hdsConnector* pConn ; // Connector
hzString text ; // For diagnostics
uint32_t n ; // Shapes and connector iterator
threadLog("Shapes %d, Connects %d\n", m_nShapes, m_nConnects) ;
// Use SVG
if (m_nBoundary)
Z.Printf("<svg id=\"%s\" height=\"%d\" width=\"%d\" style=\"border:1px solid #000000; background:#%06x;\">\n", *m_Id, m_Height, m_Width, m_BgColor) ;
else
Z.Printf("<svg id=\"%s\" height=\"%d\" width=\"%d\" style=\"background:#%06x;\">\n", *m_Id, m_Height, m_Width, m_BgColor) ;
// Draw shapes
for (n = 0; n < m_nShapes ; n++)
{
pG = m_pShapes + n ;
if (!pG)
break ;
Z.AddByte(CHAR_TAB) ;
switch (pG->m_eShape)
{
case HDSGRAPH_HEXAGON: Z.Printf("<polygon points=\"%u,%u %u,%u %u,%u %u,%u, %u,%u, %u,%u\" style=\"fill:#%06x;stroke:#%06x;stroke-width:%u\"/>\n",
pG->m_Lft, pG->m_Top + (pG->m_Height/2),
pG->m_Lft + (pG->m_Height/2),pG->m_Top,
pG->m_Rht - (pG->m_Height/2),pG->m_Top,
pG->m_Rht, pG->m_Top + (pG->m_Height/2),
pG->m_Rht - (pG->m_Height/2),pG->m_Bot,
pG->m_Lft + (pG->m_Height/2),pG->m_Bot,
m_ColorTest, m_ColorLine, m_nWidthConn) ;
break ;
case HDSGRAPH_RECT: Z.Printf("<rect x=\"%u\" y=\"%u\" width=\"%u\" height=\"%u\" style=\"fill:#%06x;stroke:#%06x;stroke-width:%u;\"/>\n",
pG->m_Lft, pG->m_Top, pG->m_Width, pG->m_Height, m_ColorProc, m_ColorLine, m_nWidthConn) ;
break ;
case HDSGRAPH_STADIUM: Z.Printf("<rect x=\"%u\" y=\"%u\" rx=\"%u\" ry=\"%u\" width=\"%u\" height=\"%u\" style=\"fill:#%06x;stroke:#%06x;stroke-width:%u;\"/>\n",
pG->m_Lft, pG->m_Top, pG->m_Height/2,pG->m_Height/2,pG->m_Width, pG->m_Height, m_ColorTerm, m_ColorLine, m_nWidthConn) ;
break ;
}
if (pG->m_Text)
{
if (pG->m_nLines == 1)
Z.Printf("\t<text x=\"%u\" y=\"%u\" fill=\"#%06x\">%d:%s</text>\n", pG->lftMidptX(), pG->lftMidptY(), pG->m_ColorLine, n, *pG->m_Text) ;
else
_hds_svg_drawMLText(Z, pG->m_Text, pG->m_Lft, pG->m_Top+20,pG->m_ColorLine,n) ;
}
else
{
Z.Printf("\t<text x=\"%u\" y=\"%u\" fill=\"#%06x\">%d: No text</text>\n", pG->lftMidptX(), pG->lftMidptY(), pG->m_ColorLine, n) ;
}
}
// Draw connectors
for (n = 0; n < m_nConnects ; n++)
{
pConn = m_pConn + n ;
// if (!pConn)
// break ;
// if (pConn->m_Origin && pConn->m_Target)
// {
// pG = m_pShapes + pConn->m_Origin ;
// pT = m_pShapes + pConn->m_Target ;
_drawFlowConn(Z, this, pConn) ;
// }
}
Z << "</svg>\n" ;
}