public override Shape Clone()
        {
            ControllerShape result = new ControllerShape(Type, (Template)null);

            result.CopyFrom(this);
            return(result);
        }
Ejemplo n.º 2
0
        private ControllerShape _CreateShapeFromController(IOutputDevice controller)
        {
            ControllerShape controllerShape = _MakeControllerShape(controller);

            if (controllerShape != null)
            {
                _controllerShapes.Add(controllerShape);
            }
            return(controllerShape);
        }
Ejemplo n.º 3
0
        private ControllerShape _MakeControllerShape(IOutputDevice controller)
        {
            // TODO: deal with other controller types (smart controllers)
            OutputController outputController = controller as OutputController;

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

            ControllerShape controllerShape = (ControllerShape)project.ShapeTypes["ControllerShape"].CreateInstance();

            controllerShape.Title              = controller.Name;
            controllerShape.Controller         = outputController;
            controllerShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS;
            controllerShape.FillStyle          = project.Design.FillStyles["Controller"];

            diagramDisplay.InsertShape(controllerShape);
            diagramDisplay.Diagram.Shapes.SetZOrder(controllerShape, 1);
            diagramDisplay.Diagram.AddShapeToLayers(controllerShape, _visibleLayer.Id);

            if (controllerShape.DataFlowComponent != null)
            {
                if (!_dataFlowComponentToShapes.ContainsKey(controllerShape.DataFlowComponent))
                {
                    _dataFlowComponentToShapes[controllerShape.DataFlowComponent] = new List <FilterSetupShapeBase>();
                }
                _dataFlowComponentToShapes[controllerShape.DataFlowComponent].Add(controllerShape);
            }

            if (_controllerToControllerShape.ContainsKey(outputController))
            {
                throw new Exception("controller->shape map already has an entry when it shouldn't");
            }
            _controllerToControllerShape[outputController] = controllerShape;

            for (int i = 0; i < outputController.OutputCount; i++)
            {
                CommandOutput output      = outputController.Outputs[i];
                OutputShape   outputShape = (OutputShape)project.ShapeTypes["OutputShape"].CreateInstance();
                outputShape.SetController(outputController);
                outputShape.SetOutput(output, i);
                outputShape.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_WITH_CONNECTIONS;
                outputShape.FillStyle          = project.Design.FillStyles["Output"];

                if (output.Name.Length <= 0)
                {
                    outputShape.Title = string.Format("{0} [{1}]", outputController.Name, (i + 1));
                }
                else
                {
                    outputShape.Title = output.Name;
                }

                diagramDisplay.InsertShape(outputShape);
                diagramDisplay.Diagram.Shapes.SetZOrder(outputShape, 2);
                diagramDisplay.Diagram.AddShapeToLayers(outputShape, _visibleLayer.Id);

                controllerShape.ChildFilterShapes.Add(outputShape);
            }

            return(controllerShape);
        }
 public override Shape Clone()
 {
     ControllerShape result = new ControllerShape(Type, (Template) null);
     result.CopyFrom(this);
     return result;
 }