示例#1
0
        /// <summary>
        /// Retire _typeInfo de <see cref="AcceptedShapes"/>,
        /// Invoque <see cref="OnRemoveShape"/>.
        /// </summary>
        public void Remove(ShapeTypeInfo _typeInfo)
        {
            int _index = AcceptedShapes.IndexOf(_typeInfo);

            if (_index != -1)
            {
                AcceptedShapes.RemoveAt(_index);
            }
            OnRemoveShape?.Invoke(this, _typeInfo);
        }
示例#2
0
 /// <summary>
 /// Retourne le type du Component que ce GraphTypeInfo réclame à _type
 /// </summary>
 public Type ClaimsComponentTo(ShapeTypeInfo _type)
 {
     foreach (ClassClaimer _claimer in ClaimersForEdit)
     {
         if (_claimer.fromType == _type.TypeName)
         {
             return(SolutionClasses.Type(_claimer.claimedType));
         }
     }
     return(null);
 }
示例#3
0
 public ShapeTypeInfo(ShapeTypeInfo _typeInfo)
 {
     foreach (Base _editableComponent in _typeInfo.EditableComponents)
     {
         EditableComponents.Add(_editableComponent);
     }
     foreach (ClassClaimer _claimer in _typeInfo.ClaimersForEdit)
     {
         ClaimersForEdit.Add(_claimer);
     }
 }
示例#4
0
        /// <summary>
        /// Retourne l'objet réclamé par une autre Shape.
        /// </summary>
        public Base GetClaimedComponentBy(ShapeTypeInfo _by)
        {
            for (int _i = 0; _i < ClaimedBy.Count; _i++)
            {
                if (ClaimedBy[_i] == _by)
                {
                    return(ClaimedComponents[_i]);
                }
            }

            Type _t = _by.ClaimsComponentTo(this);

            if (_t == null)
            {
                return(null);
            }

            Base _newcomponent = SolutionClasses.Factory(_t.Name);

            ClaimedComponents.Add(_newcomponent);
            ClaimedBy.Add(_by);
            return(_newcomponent);
        }
示例#5
0
 public void AddShape(ShapeTypeInfo _shape)
 {
     ShapeInfos.Add(_shape);
 }
示例#6
0
 public void ClaimComponentToEdit(ShapeTypeInfo _toType, Type _componentType)
 {
     ClaimersForEdit.Add(new ClassClaimer(_toType.TypeName, _componentType.Name));
 }
示例#7
0
 public void Accept(ShapeTypeInfo _toAccept)
 {
     AcceptedShapes.Add(_toAccept);
     _toAccept.AcceptedBy = this;
     OnAcceptShapeTypeInfo?.Invoke(this, _toAccept);
 }