Ejemplo n.º 1
0
        /// <summary>
        /// Проверка входа провода
        /// </summary>
        /// <param name="build">Идентификатор зданий</param>
        /// <param name="networkWires">Группа проводов</param>
        public void CheckIW(int build, GroupOfNW networkWires)
        {
            int i = 0;

            foreach (var iw in Buildings[build].InputWires.InputWires.Circles)
            {
                Point point  = iw.MainCenterPoint;
                Point _point = iw.LocalCenterPoint;
                networkWires.CheckNW(point.X, point.Y, i, true, build, iw.MainDL);
                networkWires.CheckNW(_point.X, _point.Y, i, true, build, iw.LocalDL);
                i++;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Перемещение элемента
        /// </summary>
        /// <param name="difx">Разница по Х</param>
        /// <param name="dify">Разница по У</param>
        /// <param name="networkWires">Группа проводов</param>
        /// <param name="build">Идентификатор здания</param>
        public void MoveElem(int difx, int dify, ref GroupOfNW networkWires, int build)
        {
            int i = 0;

            foreach (var cir in InputWires.Circles)
            {
                if (cir.MainDL.Level == -1)
                {
                    cir.MainCenterPoint = new Point(cir.MainCenterPoint.X + difx, cir.MainCenterPoint.Y + dify);
                    Point point  = cir.MainCenterPoint;
                    Point _point = cir.LocalCenterPoint;
                    networkWires.CheckNW(point.X, point.Y, i, true, build, cir.MainDL);
                    networkWires.CheckNW(_point.X, _point.Y, i, true, build, cir.LocalDL);
                }
                i++;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Перемещение входа провода
        /// </summary>
        /// <param name="x">Координата Х</param>
        /// <param name="y">Координата У</param>
        /// <param name="id">Идентификатор элемента</param>
        /// <param name="build">Идентификатор здания</param>
        /// <param name="networkWires">Список проводов</param>
        internal void MoveIW(int x, int y, int id, int build, GroupOfNW networkWires)
        {
            var iw = InputWires.InputWires.Circles[id];

            if (iw.MainDL.Level == -1 & MainForm.drawLevel.Level == -1)
            {
                this.id  = id;
                isMoveIW = true;
                InputWires.InputWires.TempCircle = new Circle
                {
                    MainCenterPoint = MainForm.GenZoomPoint(iw.MainCenterPoint),
                    delete          = false,
                    koef            = iw.koef,
                    side            = iw.side
                };
                InputWires.InputWires.Circles[id].delete = true;
                MoveIW(x, y);
                InputWires.InputWires.TempCircle.LocalCenterPoint = CalcLocalPoint(MainForm._GenZoomPoint(InputWires.InputWires.TempCircle.MainCenterPoint));
                Point point  = MainForm._GenZoomPoint(InputWires.InputWires.TempCircle.MainCenterPoint);
                Point _point = InputWires.InputWires.TempCircle.LocalCenterPoint;
                networkWires.CheckNW(point.X, point.Y, id, true, build, iw.MainDL);
                networkWires.CheckNW(_point.X, _point.Y, id, true, build, iw.LocalDL);
            }
            else if (iw.MainDL.Level != -1 & MainForm.drawLevel.Level != -1)
            {
                this.id   = id;
                isMoveIW  = true;
                isInBuild = true;
                InputWires.InputWires.TempCircle = new Circle
                {
                    MainCenterPoint  = MainForm.GenZoomPoint(iw.MainCenterPoint),
                    LocalCenterPoint = MainForm.GenZoomPoint(iw.LocalCenterPoint),
                    delete           = false,
                    koef             = iw.koef,
                    side             = iw.side
                };
                InputWires.InputWires.Circles[id].delete = true;
                MoveIWInBuild(x, y);
                Point point  = MainForm._GenZoomPoint(InputWires.InputWires.TempCircle.MainCenterPoint);
                Point _point = MainForm._GenZoomPoint(InputWires.InputWires.TempCircle.LocalCenterPoint);
                networkWires.CheckNW(point.X, point.Y, id, true, MainForm.drawLevel.Level, InputWires.InputWires.TempCircle.MainDL);
                networkWires.CheckNW(_point.X, _point.Y, id, true, MainForm.drawLevel.Level, InputWires.InputWires.TempCircle.LocalDL);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Редактирование элемента
        /// </summary>
        /// <param name="x">Координата Х</param>
        /// <param name="y">Координата У</param>
        /// <param name="id">Идентификатор</param>
        /// <param name="networkWires">Группа проводов</param>
        internal void SetPoint(int x, int y, int id, GroupOfNW networkWires)
        {
            texture.width = (int)((Math.Abs(texture.location.X - x) + Math.Abs(texture.location.Y - y)));
            networkWires.CheckNW(texture.location.X + (int)((double)texture.width / 2 / MainForm.zoom), texture.location.Y + (int)((double)texture.width / 2 / MainForm.zoom), id, false, -1, DL);
            string text = Options.Name + Environment.NewLine;

            text += "/" + Options.HostName;
            Font  font = new Font(FontFamily.GenericSansSerif, texture.width / 5);
            Point CP   = new Point(texture.location.X + (int)(texture.width / 2), texture.location.Y - (int)(texture.width / 2.5f));
            Size  size = TextRenderer.MeasureText(text, font);

            MT.__MoveElem(CP.X - (size.Width / 2), CP.Y + (size.Height / 2));
            MT.size = size;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Перемещение элемента
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="id"></param>
        /// <param name="networkWires"></param>
        internal void MoveElem(int x, int y, int id, GroupOfNW networkWires)
        {
            int difx = texture.location.X;
            int dify = texture.location.Y;

            texture.location = MainForm._GenZoomPoint(new Point(x, y));
            difx             = texture.location.X - difx;
            dify             = texture.location.Y - dify;
            //CalcCenterPoint();
            networkWires.CheckNW(texture.location.X + (int)((double)texture.width / 2), texture.location.Y + (int)((double)texture.width / 2), id, false, -1, DL);
            string text = Options.Name + Environment.NewLine;

            text += "/" + Options.HostName;
            Font  font = new Font(FontFamily.GenericSansSerif, texture.width / 5);
            Point CP   = new Point(texture.location.X + (int)(texture.width / 2), texture.location.Y - (int)(texture.width / 2.5f));
            Size  size = TextRenderer.MeasureText(text, font);

            MT.location = new Point(MT.location.X + difx, MT.location.Y + dify);
            MT.size     = size;
        }