Esempio n. 1
0
        public void AddEdge(ScriptableEdgeMapData scriptableEdge)
        {
            EdgeMapData objEdge = ScriptableMapper.GetEdge(scriptableEdge);

            GraphComponents graphComponents = GraphManager.Instance.DefaultGraphComponentsInstance;

            MappingExtensions.AddEdge(graphComponents, CreationType.Live, objEdge);
        }
Esempio n. 2
0
        public static EdgeMapData GetEdge(ScriptableEdgeMapData scriptableEdge)
        {
            EdgeMapData edge = new EdgeMapData(scriptableEdge.Source, scriptableEdge.Target);

            // Properties
            edge.Type                  = (EdgeType)Enum.Parse(typeof(EdgeType), scriptableEdge.Type, false);
            edge.Thickness             = scriptableEdge.Thickness;
            edge.Color                 = GetColor(scriptableEdge.Color);
            edge.Label                 = scriptableEdge.Label;
            edge.IsLabelTextUnderlined = scriptableEdge.IsLabelTextUnderlined;
            edge.LabelBackgroundColor  = GetColor(scriptableEdge.LabelBackgroundColor);
            edge.LabelForegroundColor  = GetColor(scriptableEdge.LabelForegroundColor);
            edge.LabelFontStyle        = GetFontStyle(scriptableEdge.LabelFontStyle);
            edge.LabelFontWeight       = GetFontWeight(scriptableEdge.LabelFontWeight);
            if (!String.IsNullOrEmpty(scriptableEdge.LabelFont))
            {
                FontFamily fontFamily = new FontFamily(scriptableEdge.LabelFont);
                edge.LabelFont = fontFamily;
            }
            edge.Weight = scriptableEdge.Weight;

            // Attributes
            foreach (KeyValuePair <string, ScriptableAttributeMapData> kvp in scriptableEdge.Attributes)
            {
                ScriptableAttributeMapData scriptableAttribute = kvp.Value;

                AttributeMapData attribute = new AttributeMapData(scriptableAttribute.Name, scriptableAttribute.Value);
                attribute.SemanticType      = (SemanticType)scriptableAttribute.SemanticType;
                attribute.SimilarityMeasure = scriptableAttribute.SimilarityMeasure;
                attribute.IsHidden          = scriptableAttribute.IsHidden;

                edge.Attributes.Add(kvp.Key, attribute);
            }

            return(edge);
        }