Esempio n. 1
0
        public void ConnectShapes(FilterSetupShapeBase source, int sourceOutputIndex, FilterSetupShapeBase destination,
                                  bool removeExistingSource = true)
        {
            DataFlowConnectionLine line = (DataFlowConnectionLine)project.ShapeTypes["DataFlowConnectionLine"].CreateInstance();

            diagramDisplay.InsertShape(line);
            diagramDisplay.Diagram.Shapes.SetZOrder(line, 100);
            line.EndCapStyle        = project.Design.CapStyles.ClosedArrow;
            line.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS_DELETABLE;

            if (removeExistingSource)
            {
                IEnumerable <ShapeConnectionInfo> connectionInfos =
                    destination.GetConnectionInfos(destination.GetControlPointIdForInput(0), null);
                foreach (ShapeConnectionInfo ci in connectionInfos)
                {
                    if (!ci.IsEmpty && ci.OtherShape is DataFlowConnectionLine)
                    {
                        diagramDisplay.DeleteShape(ci.OtherShape, false);
                    }
                }
            }

            line.SourceDataFlowComponentReference = new DataFlowComponentReference(source.DataFlowComponent, sourceOutputIndex);
            line.DestinationDataComponent         = destination.DataFlowComponent;
            line.Connect(ControlPointId.FirstVertex, source, source.GetControlPointIdForOutput(sourceOutputIndex));
            line.Connect(ControlPointId.LastVertex, destination, destination.GetControlPointIdForInput(0));
        }
Esempio n. 2
0
        private void _RemoveDataFlowLinksFromShapePoint(FilterSetupShapeBase shape, ControlPointId controlPoint)
        {
            foreach (ShapeConnectionInfo ci in shape.GetConnectionInfos(controlPoint, null))
            {
                if (ci.OtherShape == null)
                {
                    continue;
                }

                DataFlowConnectionLine line = ci.OtherShape as DataFlowConnectionLine;
                if (line == null)
                {
                    throw new Exception("a shape was connected to something other than a DataFlowLine!");
                }

                if (line.DestinationDataComponent == null || line.SourceDataFlowComponentReference == null)
                {
                    throw new Exception("Can't remove a link that isn't fully connected!");
                }

                // if the line is connected with the given shape as the SOURCE, remove the unknown DESTINATION's
                // source (on the other end of the line). Otherwise, it (should) be that the given shape is the
                // destination; so reset it's source. If neither of these are true, freak out.
                if (line.GetConnectionInfo(ControlPointId.FirstVertex, null).OtherShape == shape)
                {
                    VixenSystem.DataFlow.ResetComponentSource(line.DestinationDataComponent);
                }
                else if (line.GetConnectionInfo(ControlPointId.LastVertex, null).OtherShape == shape)
                {
                    VixenSystem.DataFlow.ResetComponentSource(shape.DataFlowComponent);
                }
                else
                {
                    throw new Exception("Can't reset a link that has neither the source or destination for the given shape!");
                }

                _RemoveShape(line);
            }
        }
        private void _RemoveDataFlowLinksFromShapePoint(FilterSetupShapeBase shape, ControlPointId controlPoint)
        {
            foreach (ShapeConnectionInfo ci in shape.GetConnectionInfos(controlPoint, null)) {
                if (ci.OtherShape == null)
                    continue;

                DataFlowConnectionLine line = ci.OtherShape as DataFlowConnectionLine;
                if (line == null)
                    throw new Exception("a shape was connected to something other than a DataFlowLine!");

                if (line.DestinationDataComponent == null || line.SourceDataFlowComponentReference == null)
                    throw new Exception("Can't remove a link that isn't fully connected!");

                // if the line is connected with the given shape as the SOURCE, remove the unknown DESTINATION's
                // source (on the other end of the line). Otherwise, it (should) be that the given shape is the
                // destination; so reset it's source. If neither of these are true, freak out.
                if (line.GetConnectionInfo(ControlPointId.FirstVertex, null).OtherShape == shape) {
                    VixenSystem.DataFlow.ResetComponentSource(line.DestinationDataComponent);
                } else if (line.GetConnectionInfo(ControlPointId.LastVertex, null).OtherShape == shape) {
                    VixenSystem.DataFlow.ResetComponentSource(shape.DataFlowComponent);
                } else {
                    throw new Exception("Can't reset a link that has neither the source or destination for the given shape!");
                }

                _RemoveShape(line);
            }
        }
        public void ConnectShapes(FilterSetupShapeBase source, int sourceOutputIndex, FilterSetupShapeBase destination, bool removeExistingSource = true)
        {
            DataFlowConnectionLine line = (DataFlowConnectionLine)project.ShapeTypes["DataFlowConnectionLine"].CreateInstance();
            diagramDisplay.InsertShape(line);
            diagramDisplay.Diagram.Shapes.SetZOrder(line, 100);
            line.EndCapStyle = project.Design.CapStyles.ClosedArrow;
            line.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS_DELETABLE;

            if (removeExistingSource) {
                IEnumerable<ShapeConnectionInfo> connectionInfos = destination.GetConnectionInfos(destination.GetControlPointIdForInput(0), null);
                foreach (ShapeConnectionInfo ci in connectionInfos) {
                    if (!ci.IsEmpty && ci.OtherShape is DataFlowConnectionLine) {
                        diagramDisplay.DeleteShape(ci.OtherShape, false);
                    }
                }
            }

            line.SourceDataFlowComponentReference = new DataFlowComponentReference(source.DataFlowComponent, sourceOutputIndex);
            line.DestinationDataComponent = destination.DataFlowComponent;
            line.Connect(ControlPointId.FirstVertex, source, source.GetControlPointIdForOutput(sourceOutputIndex));
            line.Connect(ControlPointId.LastVertex, destination, destination.GetControlPointIdForInput(0));
        }