Displays a diagram by placing in the page HTML, a <svg> tag. This has to refer to a JavaScript which must appear earlier in the HTML Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsDiagram::Generate | (hzChain&,hzHttpEvent*,uint32_t&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsDiagram::Generate (hzChain& C)hzHttpEvent* pE, uint32_t& nLine,
{
// Displays a diagram by placing in the page HTML, a <svg> tag. This has to refer to a JavaScript which must appear earlier in the HTML
//
// 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("hdsDiagram::Generate") ;
hzList<hdsGraphic>::Iter gI ; // Graphic object iterator
hzList<hdsLine>::Iter lI ; // List iterator for lines
hzList<hdsText>::Iter tI ; // List iterator for texts
hzChain Z ; // This part of chain
hdsText TX ; // Current text
hdsLine LN ; // Current line
hdsGraphic gObj ; // Current graphic object
// Calculate total width and height of svg image
for (gI = m_Shapes ; gI.Valid() ; gI++)
{
gObj = gI.Element() ;
}
// Generate the svg tag
Z.Printf("<svg id=\"%s\" height=\"%d\" width=\"%d\" style=\"border:1px solid #000000; background:#%06x;\">", *m_Id, m_Height, m_Width, m_BgColor) ;
for (gI = m_Shapes ; gI.Valid() ; gI++)
{
gObj = gI.Element() ;
gObj.Draw(Z) ;
}
// Handle lines last as a special case
for (lI = m_Lines ; lI.Valid() ; lI++)
{
LN = lI.Element() ;
_hds_svg_drawLine(Z, LN) ;
}
for (tI = m_Texts ; tI.Valid() ; tI++)
{
TX = tI.Element() ;
Z.Printf("<text x=\"%u\" y=\"%u\" fill=\"#%06x\">%s</text>\n", TX.V(), TX.H(), TX.Color(), TX.Text()) ;
}
Z << "</svg>\n" ;
C << Z ;
// "document.getElementById('articlecontent').addEventListener('DOMCharacterDataModified',paintJob" << m_Id << ");\n"
}