private void PrepareLegend(IEnumerable <Vertex> vertices) { m_LegendForType.Clear(); foreach (Vertex v in vertices) { if (v.node == null) { continue; } //string nodeType = v.node.GetContentTypeName(); string nodeType = v.node.GetDetailedTypeInfo(); if (m_LegendForType.ContainsKey(nodeType)) { continue; } m_LegendForType[nodeType] = new NodeTypeLegend { label = v.node.GetContentTypeShortName(), color = v.node.GetColor(), detailedLabel = v.node.GetDetailedLabel() }; } }
// Draw a node an return true if it has been clicked private void DrawNode(Rect nodeRect, Node node, bool selected) { string nodeType = node.GetContentTypeName(); NodeTypeLegend nodeTypeLegend = m_LegendForType[nodeType]; string formattedLabel = Regex.Replace(nodeTypeLegend.label, "((?<![A-Z])\\B[A-Z])", "\n$1"); // Split into multi-lines DrawRect(nodeRect, nodeTypeLegend.color, formattedLabel, node.active, selected); }