예제 #1
0
        private void CreateLine(DataConnection data) //Два соединение элемент-линия-линия-элемент и элемент-элемент
        {
            var point0          = data.PointPin0;
            var point1          = data.PointPin1;
            var CheckCreateLine = (point0.IdParent != point1.IdParent) & (point0.Type != point1.Type);

            if (CheckCreateLine)
            {
                var pin0 = FindElementId(point0.IdParent).GetPinIndex(point0.Id);
                var pin1 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                //BaseElement.Connect(pin0, pin1);
                //BaseElement.Connect(pin1, pin0);
                var line = new ViewModelComponentLine(point0, point1, _surface, data.ID);
                _elements.Add(line);
                line.OnElementDelete += Delete;
                if (pin0.Type == ETypePin.TypeOut)
                {
                    pin1 = line.GetElementModel().GetPinId(0);
                    BaseElement.Connect(pin0, pin1);
                    pin0 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                    pin1 = line.GetElementModel().GetPinId(1);
                }
                else
                {
                    pin1 = line.GetElementModel().GetPinId(1);
                    BaseElement.Connect(pin0, pin1);
                    pin0 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                    pin1 = line.GetElementModel().GetPinId(0);
                }

                BaseElement.Connect(pin0, pin1);
                //BaseElement.Connect(pin1, pin0);
            }
        }
예제 #2
0
        CreateLine(PointPin point0, PointPin point1)     //Два соединение элемент-линия-линия-элемент и элемент-элемент
        {
            var CheckCreateLine = (point0.IdParent != point1.IdParent) & (point0.Type != point1.Type);

            if (CheckCreateLine)
            {
                var pin0 = FindElementId(point0.IdParent).GetPinIndex(point0.Id);
                var pin1 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                //BaseElement.Connect(pin0, pin1);
                //BaseElement.Connect(pin1, pin0);
                var line = new ViewModelComponentLine(point0, point1, _surface);
                _elements.Add(line);
                line.OnElementDelete += Delete;
                if (pin0.Type == ETypePin.TypeOut)
                {
                    //FindElementId(point1.IdParent).GroupID = FindElementId(point0.IdParent).GroupID;
                    pin1 = line.GetElementModel().GetPinId(0);
                    BaseElement.Connect(pin0, pin1);
                    pin0 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                    pin1 = line.GetElementModel().GetPinId(1);
                }
                else
                {
                    //FindElementId(point0.IdParent).GroupID = FindElementId(point1.IdParent).GroupID;
                    pin1 = line.GetElementModel().GetPinId(1);
                    BaseElement.Connect(pin0, pin1);
                    pin0 = FindElementId(point1.IdParent).GetPinIndex(point1.Id);
                    pin1 = line.GetElementModel().GetPinId(0);
                }

                BaseElement.Connect(pin0, pin1);
                //BaseElement.Connect(pin1, pin0);
            }
        }