protected void Render(KAOSTools.Core.EntityAttribute attribute)
        {
            if (!shapes.ContainsKey(attribute.EntityIdentifier))
            {
                return;
            }

            foreach (var entity in shapes[attribute.EntityIdentifier].Cast <Group>())
            {
                var text = @"";

                if ((entity.Graphics[1] as ShapedGraphic).Text.Text.Length > 4)
                {
                    text += @"\ql\par ";
                }

                text += GetRtfUnicodeEscapedString((attribute.Derived ? "/ " : "- "));
                text += GetRtfUnicodeEscapedString(attribute.FriendlyName);

                if (!string.IsNullOrEmpty(attribute.TypeIdentifier))
                {
                    text += " : " + attribute.Type().FriendlyName;
                }

                (entity.Graphics[1] as ShapedGraphic).Text.Text += text;
            }
        }
Ejemplo n.º 2
0
 KAOSTools.Core.EntityAttribute GetOrCreateAttribute(ParsedAttributeReferenceExpression pref,
                                                     Entity entity,
                                                     GivenType type)
 {
     if (entity != null)
     {
         if (pref.AttributeSignature is NameExpression)
         {
             var attribute = entity.Attributes().SingleOrDefault(x => x.Name == pref.AttributeSignature.Value);
             if (attribute == null)
             {
                 attribute = new KAOSTools.Core.EntityAttribute(model)
                 {
                     Name           = pref.AttributeSignature.Value,
                     TypeIdentifier = type?.Identifier,
                     Implicit       = true
                 };
                 attribute.SetEntity(entity);
                 model.Add(attribute);
             }
             else
             {
             }
             return(attribute);
         }
         else if (pref.AttributeSignature is IdentifierExpression)
         {
             var attribute = entity.model.Attributes().SingleOrDefault(x => x.Identifier == pref.AttributeSignature.Value &&
                                                                       x.EntityIdentifier == entity.Identifier);
             if (attribute == null)
             {
                 attribute = new KAOSTools.Core.EntityAttribute(model)
                 {
                     Identifier     = pref.AttributeSignature.Value,
                     TypeIdentifier = type?.Identifier,
                     Implicit       = true
                 };
                 attribute.SetEntity(entity);
                 model.Add(attribute);
             }
             return(attribute);
         }
         else
         {
             throw new NotImplementedException(pref.AttributeSignature.GetType() + " is not yet supported");
         }
     }
     else
     {
         throw new Exception(string.Format("Entity '{0}' not found", entity.Identifier));
     }
 }