Beispiel #1
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            GEMSSingle currentSingle = context.Instance as GEMSSingle;

            if (currentSingle != null)
            {
                MaterialListForm from = new MaterialListForm(currentSingle);

                if (from.ShowDialog( ) == System.Windows.Forms.DialogResult.OK)
                {
                    value = currentSingle.SingleMaterial;

                    if (currentSingle.CurrentEO != null)
                    {
                        currentSingle.CurrentEO = null;
                        currentSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                    }
                }
                from.Dispose( );
            }

            return(value);
        }
Beispiel #2
0
        public override SingleEO Clone(GEMSSingle parentSingle)
        {
            CurrentOutput co = new CurrentOutput(parentSingle);

            co.Positive = this.Positive;

            return(co);
        }
 public VoltageExcitation(XPathNavigator navigator, GEMSSingle single)
     : base(navigator, single)
 {
     //Excitation Value information
     navigator.MoveToChild("Voltage", string.Empty);
     excitationVoltage = new Voltage(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
     navigator.MoveToParent();
 }
Beispiel #4
0
        public override SingleEO Clone(GEMSSingle parentSingle)
        {
            VoltageOutput vo = new VoltageOutput(parentSingle);

            vo.Positive = this.Positive;

            return(vo);
        }
Beispiel #5
0
        public PointOutput(XPathNavigator navigator, GEMSSingle single)
            : base(single)
        {
            //Basic information
            navigator.MoveToChild("TimeDomain", String.Empty);
            uint fieldEnableFlag = uint.Parse(navigator.GetAttribute("tdEnabled", string.Empty));

            RetrieveEachDirectionFieldEnableFlag(fieldEnableFlag);
        }
        public override SingleEO Clone(GEMSSingle parentSingle)
        {
            VoltageExcitation ve = new VoltageExcitation(parentSingle);

            ve.TimeDelay         = new Time(this.TimeDelay.Value, this.TimeDelay.Unit);
            ve.Positive          = this.Positive;
            ve.PhaseFrequency    = new Frequency(this.PhaseFrequency.Value, this.PhaseFrequency.Unit);
            ve.PhaseDelay        = this.PhaseDelay;
            ve.ExcitationVoltage = new Voltage(this.ExcitationVoltage.Value, this.ExcitationVoltage.Unit);

            return(ve);
        }
        public override SingleEO Clone(GEMSSingle parentSingle)
        {
            CurrentExcitation ce = new CurrentExcitation(parentSingle);

            ce.TimeDelay         = new Time(this.TimeDelay.Value, this.TimeDelay.Unit);
            ce.Positive          = this.Positive;
            ce.PhaseFrequency    = new Frequency(this.PhaseFrequency.Value, this.PhaseFrequency.Unit);
            ce.PhaseDelay        = this.PhaseDelay;
            ce.ExcitationCurrent = new Current(this.ExcitationCurrent.Value, this.ExcitationCurrent.Unit);

            return(ce);
        }
Beispiel #8
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            GEMSSingle single = e.Context.Instance as GEMSSingle;

            if (single != null)
            {
                SolidBrush brush = new SolidBrush(single.SingleColor);

                e.Graphics.FillRectangle(brush, e.Bounds);

                brush.Dispose( );
            }
            else
            {
                base.PaintValue(e);
            }
        }
Beispiel #9
0
        public static SingleEO Load(XPathNavigator navigator, GEMSSingle parent)
        {
            SingleEO singleEO = null;

            switch (parent.CreateOperation.Name)
            {
            case GeometryOperation.GeometryOperationType.CreateLine:          //Voltage Excitation or Output
                if (navigator.MoveToChild("VoltageExcitation", string.Empty))
                {
                    singleEO = new VoltageExcitation(navigator, parent);
                }
                else if (navigator.MoveToChild("VoltageOutput", string.Empty))
                {
                    singleEO = new VoltageOutput(navigator, parent);
                }

                break;

            case GeometryOperation.GeometryOperationType.CreatePoint:         //FieldPointOutPut
                if (navigator.MoveToChild("FieldOnPointOutput", string.Empty))
                {
                    //((Point)operations[0]).BFieldOutput = true;
                    singleEO = new PointOutput(navigator, parent);
                }
                break;

            case GeometryOperation.GeometryOperationType.CreateRectangle:  //Current Excitation or Output
            case GeometryOperation.GeometryOperationType.CreateRound:      //Current Excitation or Output
                if (navigator.MoveToChild("CurrentExcitation", string.Empty))
                {
                    singleEO = new CurrentExcitation(navigator, parent);
                }
                else if (navigator.MoveToChild("CurrentOutput", string.Empty))
                {
                    singleEO = new CurrentOutput(navigator, parent);
                }
                break;

            default:
                break;
            }

            return(singleEO);
        }
Beispiel #10
0
        /// <summary>
        /// Create an single object with same information of original single
        /// </summary>
        public GEMSSingle Clone(int newId)
        {
            //Create a new single with information copyed from the specified single
            GEMSSingle newSingle = new GEMSSingle(newId, this.parent);

            //Basic information
            newSingle.name        = this.Name + "_" + newId.ToString( );
            newSingle.pec         = this.PEC;
            newSingle.singleColor = this.BaseSingleColor;

            //Material
            newSingle.material = this.material;

            //Excitation or Output
            if (currentEO != null)
            {
                newSingle.currentEO = this.currentEO.Clone(newSingle);
            }

            //Operation
            newSingle.operations = new List <GeometryOperation> ( );

            //Copy each operation mementoes
            foreach (GeometryOperation operation in this.operations)
            {
                GeometryOperation newOperation = operation.Clone(parent.CreateNewOperationId( ), newSingle);
                newSingle.operations.Add(newOperation);

                if (newOperation is GeometryCreateOperation)
                {
                    newSingle.createOperation = newOperation as GeometryCreateOperation;
                }

                //Add the operation to the list of GEMS Project
                Parent.AddOperation(newOperation);
            }

            //Create the model for new single
            newSingle.UpdatePrimaryModel( );
            newSingle.UpdateSingleEOSymbolModel( );

            return(newSingle);
        }
Beispiel #11
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            GEMSSingle single = context.Instance as GEMSSingle;

            if (single != null)
            {
                TransparentSettingForm form = new TransparentSettingForm(single.SingleColor);

                if (form.ShowDialog( ) == System.Windows.Forms.DialogResult.OK)
                {
                    value = form.Transparency;
                }
                form.Dispose( );
            }
            return(value);
        }
Beispiel #12
0
        public SingleExcitation(XPathNavigator navigator, GEMSSingle single)
            : base(single)
        {
            //Basic information
            positive = int.Parse(navigator.GetAttribute("positive", string.Empty));

            //TimeDelay information
            navigator.MoveToChild("TimeDelay", string.Empty);
            timeDelay = new Time(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            navigator.MoveToParent();

            //PhaseDelay information
            navigator.MoveToChild("PhaseDelay", string.Empty);
            phaseDelay = float.Parse(navigator.GetAttribute("value", string.Empty));

            //Frequency information
            navigator.MoveToFirstChild();
            phaseFrequency = new Frequency(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            navigator.MoveToParent();
            navigator.MoveToParent();
        }
Beispiel #13
0
 public SingleOutput(XPathNavigator navigator, GEMSSingle single)
     : base(single)
 {
 }
Beispiel #14
0
 public VoltageOutput(XPathNavigator navigator, GEMSSingle single)
     : base(single)
 {
     //Basic information
     positive = int.Parse(navigator.GetAttribute("positive", string.Empty));
 }
Beispiel #15
0
 public VoltageOutput(GEMSSingle single)
     : base(single)
 {
 }
 public CurrentExcitation(GEMSSingle single)
     : base(single)
 {
 }
Beispiel #17
0
        public override SingleEO Clone(GEMSSingle parentSingle)
        {
            PointOutput po = new PointOutput(parentSingle);

            return(po);
        }
Beispiel #18
0
 public SingleEO(GEMSSingle single)
 {
     this.parent = single;
 }
Beispiel #19
0
 public PointOutput(GEMSSingle single)
     : base(single)
 {
 }
 public VoltageExcitation(GEMSSingle single)
     : base(single)
 {
 }
Beispiel #21
0
 public abstract SingleEO Clone(GEMSSingle parentSignal);
Beispiel #22
0
 public CurrentOutput(GEMSSingle single)
     : base(single)
 {
 }
Beispiel #23
0
 public SingleExcitation(GEMSSingle signal)
     : base(signal)
 {
 }
Beispiel #24
0
 public SingleOutput(GEMSSingle single)
     : base(single)
 {
 }