Exemple #1
0
        //internal bool SetTimeBegiEnd(DateTime timeBegin, DateTime timeEnd){}

        //если визир не установлен, используется DateTime.MinValue
        //поскольку установка визира может менять область отображения, для отмены необходимы времена начала и конца отображаемого периода
        internal bool SetVizir(DateTime vizirTime, DateTime curVizirTime, DateTime curViewMin, DateTime curViewMax,
                               DateTimeIntervalType curViewTimeIntervalType)
        {
            if (curVizirTime != vizirTime)
            {
                var cpz = new List <object> {
                    curVizirTime, curViewMin, curViewMax, curViewTimeIntervalType
                };
                var cmd = new UserCommand(EUserCommand.SetVizir, null, vizirTime, cpz);
                AddCommand(cmd);
                return(true);
            }

            return(false);
        }
Exemple #2
0
        //internal bool AxYJunction(GroupY axY, GroupY axCatcher)
        //{
        //    var pz = new List<object> { axCatcher };
        //    var cpz = new List<object> { curViewTimeBegin, curViewTimeEnd, curScaleType };

        //    var cmd = new UserCommand(EUserCommand.AxYJunction, graphic, axY, graphic.GroupY);
        //}

        //internal bool AxYChangeSizePos(GroupY axY, double newSize, double newPos){}

        //internal bool AllAxYChangeSizePos(List<GroupY> axY, List<double> newSizes, List<double> newPoses){}

        internal bool AxYSetViewY(GroupY axY, double viewYMin, double viewYMax, bool inPercent)
        {
            if ((viewYMin != axY.ViewMin) || (viewYMax != axY.ViewMax) || (inPercent != axY.IsInPercent))
            {
                var pz = new List <object> {
                    viewYMin, viewYMax, inPercent
                };
                var cpz = new List <object> {
                    axY.ViewMin, axY.ViewMax, axY.IsInPercent
                };
                var cmd = new UserCommand(EUserCommand.AxYSetViewY, axY, pz, cpz);
                //var cmd = new UserCommand(EUserCommand.AxYSetViewY, axY.UpperGraphic, pz, cpz);
                AddCommand(cmd);
                return(true);
            }
            return(false);
        }
Exemple #3
0
        internal bool AxYSizePosChanged(GroupY axY, double curSize, double curPos)
        {
            if ((axY.CurAxSize != curSize) || (axY.CurAxPos != curPos))
            {
                var pz = new List <object> {
                    axY.CurAxSize, axY.CurAxPos
                };
                var cpz = new List <object> {
                    curSize, curPos
                };
                var cmd = new UserCommand(EUserCommand.AxYChangeSizePos, axY, pz, cpz);
                AddCommand(cmd, false);
                return(true);
            }

            return(false);
        }
Exemple #4
0
        //Если viewTimeIntervalType = DateTimeIntervalType.NotSet - автоопределение _axisXIntervalType
        internal bool SetTimeView(DateTime viewTimeBegin, DateTime viewTimeEnd, DateTimeIntervalType scaleType,
                                  DateTime curViewTimeBegin, DateTime curViewTimeEnd, DateTimeIntervalType curScaleType)
        {
            if ((viewTimeBegin != curViewTimeBegin) || (viewTimeEnd != curViewTimeEnd) || (scaleType != curScaleType))
            {
                var pz = new List <object> {
                    viewTimeBegin, viewTimeEnd, scaleType
                };
                var cpz = new List <object> {
                    curViewTimeBegin, curViewTimeEnd, curScaleType
                };
                var cmd = new UserCommand(EUserCommand.SetTimeView, null, pz, cpz);
                AddCommand(cmd);
                return(true);
            }

            return(false);
        }
Exemple #5
0
        /*internal bool AxYSetViewY(List<GroupY> axYs, List<double> viewYMins, List<double> viewYMaxs, List<bool> inPercents)
         * {
         *  var cViewYMin = new List<double>();
         *  var cViewYMax = new List<double>();
         *  var cInPercents = new List<bool>();
         *  bool fg = false;
         *  int i = -1;
         *  foreach (var axY in axYs)
         *  {
         *      i++;
         *      cViewYMin.Add(axY.ViewMin);
         *      cViewYMax.Add(axY.ViewMax);
         *      cInPercents.Add(axY.IsInPercent);
         *
         *      if ((viewYMins[i] != axY.ViewMin) || (viewYMaxs[i] != axY.ViewMax) || (inPercents[i] != axY.IsInPercent))
         *          fg = true;
         *  }
         *
         *  if (fg)
         *  {
         *      var pz = new List<object> { viewYMins, viewYMaxs, inPercents };
         *      var cpz = new List<object> { cViewYMin, cViewYMax, cInPercents };
         *      var cmd = new UserCommand(EUserCommand.AxYsSetViewY, axYs, pz, cpz);
         *      AddCommand(cmd);
         *      return true;
         *  }
         *
         *  return false;
         * }*/

        //internal bool AxYJunction(GroupY catcher, GroupY pitcher)
        //{
        //    if (catcher != pitcher)
        //    {
        //        var cpz = new List<Object>();

        //        var grs = new List<AnalogGraphic>();
        //        foreach (var gr in pitcher.Graphics) grs.Add(gr);
        //        cpz.Add(grs);
        //        cpz.Add(pitcher.ViewMin);
        //        cpz.Add(pitcher.ViewMax);
        //        cpz.Add(pitcher.IsInPercent);
        //        cpz.Add(pitcher.CurAxSize);
        //        cpz.Add(pitcher.CurAxPos);

        //        var cmd = new UserCommand(EUserCommand.AxYJunction, catcher.UpperGraphic, pitcher.UpperGraphic, cpz);
        //        AddCommand(cmd);
        //        return true;
        //    }

        //    return false;
        //}

        internal bool AxYJunction(GroupY catcher, GroupY pitcher)
        {
            if (catcher != pitcher)
            {
                var cpz = new List <Object>();
                var grs = new List <AnalogGraphic>();
                foreach (var gr in pitcher.Graphics)
                {
                    grs.Add(gr);
                }
                cpz.Add(grs);
                cpz.Add(catcher.UpperGraphic);
                cpz.Add(pitcher.UpperGraphic);

                var cmd = new UserCommand(EUserCommand.AxYJunction, catcher, pitcher, cpz);
                AddCommand(cmd);
                return(true);
            }

            return(false);
        }
Exemple #6
0
        private void AddCommand(UserCommand command, bool changeParam = true)
        {
            if (command.CanUndo)
            {
                if (!_continueGroup)
                {
                    if ((_maxCommandCount > 0) && (_commands.Count == _maxCommandCount))
                    {
                        _commands.RemoveAt(0);
                    }
                    _commands.Add(command);
                    _undoCommands.Clear();

                    _formGraphic.SetUndoRedoStatus(CanUndo, CanRedo);
                }
                else
                {
                    var cmd = _commands.Last();
                    if (cmd.Command != EUserCommand.GroupOperation)
                    {
                        _commands.RemoveAt(_commands.Count - 1);
                        var grCmd = new UserCommand(EUserCommand.GroupOperation, null, cmd, null);
                        grCmd.Params.Add(command);
                        _commands.Add(grCmd);
                    }
                    else
                    {
                        cmd.Params.Add(command);
                    }
                }
            }

            command.Do(changeParam);

            _continueGroup = false;
        }