public MDGTechnology(String id, String name, String version, int modelVersion, String description = "", IEnumerable <Diagram> diagrams = null, IEnumerable <ModelTemplate> modelTemplates = null) { ID = id; Name = name; Version = version; ModelVersion = modelVersion; Description = description; Diagrams = diagrams ?? new Diagram[] { }; ModelTemplates = modelTemplates ?? new ModelTemplate[] { }; ModelId = new ModelId(ID, ModelVersion); ModelIdTag = new TaggedValueDefinition("XModelId", TaggedValueTypes.Const(ModelId.ToString())); }
internal override XElement ToXml(TaggedValueDefinition versionTag) { return(new XElement("Stereotype", new XAttribute("name", Name), new XAttribute("metatype", DisplayName), new XAttribute("instanceType", InstanceType.Select(it => it.Name).GetOrElse("")), new XAttribute("bgcolor", BackgroundColor.Select(bg => ToEaColor(bg)).GetOrElse("")), new XAttribute("cx", Width.Select(w => w.ToString()).GetOrElse("")), new XAttribute("cy", Height.Select(h => h.ToString()).GetOrElse("")), Icon.Select <Icon, XNode>(i => i.ToXml()).GetOrElse(new XComment("no custom icon")), ShapeScript.Select <String, XNode>(s => new ShapeScript(s).ToXml()).GetOrElse(new XComment("no custom shape")), new XElement("AppliesTo", new XElement("Apply", new XAttribute("type", Type.ToString()))), new XElement("TaggedValues", from tv in TaggedValues.Concat(new[] { versionTag }) select tv.ToXml()))); }
internal override XElement ToXml(TaggedValueDefinition versionTag) { var taggedValues = LineStyle.Select(ls => TaggedValues.Concat(new[] { new TaggedValueDefinition(name: "_lineStyle", type: TaggedValueTypes.String.WithDefaultValue(ls.ToString())) })).GetOrElse(TaggedValues); return(new XElement("Stereotype", new XAttribute("name", Name), new XAttribute("metatype", DisplayName), Icon.Select <Icon, XNode>(i => i.ToXml()).GetOrElse(new XComment("no custom icon")), ShapeScript.Select <String, XNode>(s => new ShapeScript(s).ToXml()).GetOrElse(new XComment("no custom shape")), new XElement("AppliesTo", new XElement("Apply", new XAttribute("type", Type.ToString()), new XElement("Property", new XAttribute("name", "direction"), new XAttribute("value", Direction.Select(d => d.Name).GetOrElse(""))), new XElement("Property", new XAttribute("name", "compositionKind"), new XAttribute("value", CompositionKind.Select(c => c.Name).GetOrElse(""))))), new XElement("TaggedValues", from tv in taggedValues.Concat(new[] { versionTag }) select tv.ToXml()))); }
internal abstract XElement ToXml(TaggedValueDefinition versionTag);