Exemple #1
0
        /// <summary>
        /// Override for left-click selection
        /// </summary>
        /// <param name="sender">Reference to sending object.</param>
        /// <param name="e">Mouse event arguments.</param>
        private void MouseLeftButtonUp( object sender , MouseEventArgs e )
        {
            if ( canvas != null )
            {
                if ( canvas.DrawMode == DrawModes.Select
                    || canvas.DrawMode == DrawModes.PointLoad )
                {
                    // start dialog for user input
                    AddPointLoadDialog dlg = new AddPointLoadDialog( canvas , this );
                    dlg.ShowDialog();

                    // if there is no load in horizontal or vertical direction, delete the load ...
                    if ( !this.IsLoadedX && !this.IsLoadedY )
                    {
                        this.Delete();
                        canvas.MaterialBlocks.ForEach( delegate( MaterialBlock mb ) { mb.PointLoads.Remove( this ); } );

                        //MaterialBlock parent = null;
                        //foreach ( MaterialBlock mb in canvas.MaterialBlocks )
                        //{
                        //    if ( mb.PointLoads.Contains( this ) )
                        //    {
                        //        parent = mb;
                        //        break;
                        //    }
                        //}
                        //if ( parent != null ) parent.PointLoads.Remove( this );
                    }

                    // ... otherwise update its visibility and plotting location
                    else
                    {
                        this.Update();
                    }

                    if ( dlg.DialogResult == true )
                    {
                        canvas.IsSaved = false;
                        canvas.IsVerified = false;
                    }
                }
            }
            else if ( defineCanvas != null )
            {
                FactorPointLoadDialog dlg = new FactorPointLoadDialog( defineCanvas , this );
                dlg.ShowDialog();

                this.Update();
            }
        }
Exemple #2
0
        public void ApplyPointLoad( DrawingPoint p )
        {
            // check if a point load has already been defined at this point
            PointLoad load = pointLoads.Find( delegate( PointLoad pl ) { return pl.Node == p; } );

            // if undefined, create a new point load object
            if ( load == null )
            {
                load = new PointLoad( canvas , p , false , 0 , false , 0 );
                //pointLoads.Add( load );
            }

            bool prevLoadedX = load.IsLoadedX , prevLoadedY = load.IsLoadedY;

            // start dialog for user input
            AddPointLoadDialog dlg = new AddPointLoadDialog( canvas , load );
            dlg.ShowDialog();

            // if there is no load in horizontal or vertical direction, delete the load ...
            if ( !load.IsLoadedX && !load.IsLoadedY )
            {
                load.Delete();
                //pointLoads.Remove( load );
                canvas.MaterialBlocks.ForEach( delegate( MaterialBlock mb ) { mb.PointLoads.Remove( load ); } );
            }

            // ... otherwise update its visibility and plotting location
            else
            {
                load.Update();
            }

            if ( dlg.DialogResult == true )
            {
                bool newLoadedX = load.IsLoadedX;
                if ( newLoadedX != prevLoadedX )
                {
                    for ( int i = 0 ; i < load.PhaseActiveX.Count ; i++ )
                    {
                        load.PhaseActiveX[i] = newLoadedX;
                        load.PhaseFactorX[i] = newLoadedX ? 1.0 : 0.0;
                    }
                }

                bool newLoadedY = load.IsLoadedY;
                if ( newLoadedY != prevLoadedY )
                {
                    for ( int i = 0 ; i < load.PhaseActiveY.Count ; i++ )
                    {
                        load.PhaseActiveY[i] = newLoadedY;
                        load.PhaseFactorY[i] = newLoadedY ? 1.0 : 0.0;
                    }
                }

                canvas.IsSaved = false;
                canvas.IsVerified = false;
            }
        }