예제 #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);
 }