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

            result.CopyFrom(this);
            return(result);
        }
 public override void CopyFrom(Shape source)
 {
     base.CopyFrom(source);
     if (source is OutputShape)
     {
         OutputShape src = (OutputShape)source;
         _controller = src.Controller;
         _output     = src.Output;
         _CopyControlPointsFrom(src);
     }
 }
Exemple #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()
 {
     OutputShape result = new OutputShape(Type, (Template) null);
     result.CopyFrom(this);
     return result;
 }