Exemplo n.º 1
0
        public FactorLineLoadDialog(SlopeDefineCanvas canvas, LineLoad load)
        {
            InitializeComponent();

            this.canvas = canvas;
            this.load   = load;

            // get units dependent scaling factor and strings
            double factor;
            string coordUnits, loadUnits;

            switch (canvas.Units)
            {
            case Units.Metres: factor = 0.0254; coordUnits = "m"; loadUnits = "kN/m"; break;

            case Units.Millimetres: factor = 25.4; coordUnits = "mm"; loadUnits = "kN/m"; break;

            case Units.Feet: factor = 1.0 / 12.0; coordUnits = "ft"; loadUnits = "lbf/ft"; break;

            default: factor = 1.0; coordUnits = "in"; loadUnits = "lbf/ft"; break;
            }

            // set units labels
            node1Units.Content  = coordUnits;
            node2Units.Content  = coordUnits;
            nLoad1Units.Content = loadUnits;
            nLoad2Units.Content = loadUnits;
            tLoad1Units.Content = loadUnits;
            tLoad2Units.Content = loadUnits;

            // set node coordinates
            double xCoord, yCoord;

            xCoord          = (load.Nodes[0].Point.X - canvas.OriginOffsetX) / canvas.DpiX * factor * canvas.Scale;
            yCoord          = (canvas.ActualHeight - load.Nodes[0].Point.Y - canvas.OriginOffsetY) / canvas.DpiY * factor * canvas.Scale;
            coords1.Content = string.Format("({0}, {1})", Math.Round(xCoord, 2), Math.Round(yCoord, 2));
            xCoord          = (load.Nodes[1].Point.X - canvas.OriginOffsetX) / canvas.DpiX * factor * canvas.Scale;
            yCoord          = (canvas.ActualHeight - load.Nodes[1].Point.Y - canvas.OriginOffsetY) / canvas.DpiY * factor * canvas.Scale;
            coords2.Content = string.Format("({0}, {1})", Math.Round(xCoord, 2), Math.Round(yCoord, 2));

            // set existing load values (if present)
            MaterialBlock parent = canvas.Substructs.Find(delegate(MaterialBlock mb) { return(mb.Material.Name != "NULL" && mb.LineLoads.Contains(load)); });

            isLoadedN.IsEnabled = parent != null && load.IsLoadedN;
            isLoadedN.IsChecked = nFactor.IsEnabled = parent != null && load.IsActiveN;
            nFactor.Text        = string.Format("{0}", Math.Round(load.NFactor, 3));
            nLoad1.Text         = string.Format("{0}", Math.Round(load.NLoad1, 2));
            nLoad2.Text         = string.Format("{0}", Math.Round(load.NLoad2, 2));
            isLoadedT.IsEnabled = parent != null && load.IsLoadedT;
            isLoadedT.IsChecked = tFactor.IsEnabled = parent != null && load.IsActiveT;
            tFactor.Text        = string.Format("{0}", Math.Round(load.TFactor, 3));
            tLoad1.Text         = string.Format("{0}", Math.Round(load.TLoad1, 2));
            tLoad2.Text         = string.Format("{0}", Math.Round(load.TLoad2, 2));
        }
Exemplo n.º 2
0
        public ActivateFixityDialog(SlopeDefineCanvas canvas, LineConstraint lc)
        {
            InitializeComponent();

            this.canvas = canvas;

            this.lc = lc;

            MaterialBlock parent = canvas.Substructs.Find(delegate(MaterialBlock mb) { return(mb.Material.Name != "NULL" && mb.LineConstraints.Contains(lc)); });

            isFixedX.IsEnabled = parent != null && lc.IsFixedX;
            isFixedY.IsEnabled = parent != null && lc.IsFixedY;
            isFixedX.IsChecked = parent != null && lc.IsActiveX;
            isFixedY.IsChecked = parent != null && lc.IsActiveY;
        }
Exemplo n.º 3
0
        public ActivateFixityDialog(SlopeDefineCanvas canvas, DrawingPoint p)
        {
            InitializeComponent();

            this.canvas = canvas;

            this.p = p;

            MaterialBlock parent = canvas.Substructs.Find(delegate(MaterialBlock mb) { return(mb.Material.Name != "NULL" && mb.BoundaryPoints.Contains(p)); });

            isFixedX.IsEnabled = parent != null && p.IsFixedX;
            isFixedY.IsEnabled = parent != null && p.IsFixedY;
            isFixedX.IsChecked = parent != null && p.IsFixActiveX;
            isFixedY.IsChecked = parent != null && p.IsFixActiveY;

            List <LineConstraint> attachedLCs = new List <LineConstraint>();

            canvas.Substructs.ForEach(
                delegate(MaterialBlock mb)
            {
                attachedLCs.AddRange(mb.LineConstraints.FindAll(delegate(LineConstraint lc) { return(lc.Nodes.Contains(p)); }));
            });
            attachedLCs.ForEach(
                delegate(LineConstraint lc)
            {
                if (lc.IsActiveX)
                {
                    isFixedX.IsEnabled = false;
                }
                if (lc.IsActiveY)
                {
                    isFixedY.IsEnabled = false;
                }
            });
            attachedLCs.Clear();
        }