(parent)
| 145 | } |
| 146 | |
| 147 | function parseEdges(parent) { |
| 148 | return parent ? zrUtil.map(getChildrenByTagName(parent, 'edge'), function (edgeDom) { |
| 149 | const id = getAttr(edgeDom, 'id'); |
| 150 | const label = getAttr(edgeDom, 'label'); |
| 151 | |
| 152 | const sourceId = getAttr(edgeDom, 'source'); |
| 153 | const targetId = getAttr(edgeDom, 'target'); |
| 154 | |
| 155 | const edge = { |
| 156 | id: id, |
| 157 | name: label, |
| 158 | source: sourceId, |
| 159 | target: targetId, |
| 160 | lineStyle: { |
| 161 | normal: {} |
| 162 | } |
| 163 | }; |
| 164 | |
| 165 | const lineStyle = edge.lineStyle.normal; |
| 166 | |
| 167 | const vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness'); |
| 168 | const vizColorDom = getChildByTagName(edgeDom, 'viz:color'); |
| 169 | // let vizShapeDom = getChildByTagName(edgeDom, 'viz:shape'); |
| 170 | |
| 171 | if (vizThicknessDom) { |
| 172 | lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value')); |
| 173 | } |
| 174 | if (vizColorDom) { |
| 175 | lineStyle.color = 'rgb(' + [ |
| 176 | getAttr(vizColorDom, 'r') | 0, |
| 177 | getAttr(vizColorDom, 'g') | 0, |
| 178 | getAttr(vizColorDom, 'b') | 0 |
| 179 | ].join(',') + ')'; |
| 180 | } |
| 181 | // if (vizShapeDom) { |
| 182 | // edge.shape = vizShapeDom.getAttribute('shape'); |
| 183 | // } |
| 184 | |
| 185 | return edge; |
| 186 | }) : []; |
| 187 | } |
| 188 | |
| 189 | function getAttr(el, attrName) { |
| 190 | return el.getAttribute(attrName); |
no test coverage detected
searching dependent graphs…