コード例 #1
0
ファイル: XmlFrameElement.cs プロジェクト: jaquadro/Amphibian
 public XmlFrameElement(IFrameElement frameElement)
 {
     if (frameElement != null) {
         Sprite = frameElement.Sprite;
         Duration = frameElement.Duration;
     }
 }
コード例 #2
0
        public override string Execute(IList <string> parameters)
        {
            int    elementId;
            int    loadCaseNumber;
            double loadAtStart;
            double loadAtEnd;
            double loadStartsAt;
            double loadEndsAt;

            try
            {
                elementId      = int.Parse(parameters[0]);
                loadCaseNumber = int.Parse(parameters[1]);
                loadAtStart    = double.Parse(parameters[2]);
                loadAtEnd      = double.Parse(parameters[3]);
                loadStartsAt   = double.Parse(parameters[4]);
                loadEndsAt     = double.Parse(parameters[5]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignDistributedLoadGlobalXDirection command parameters.");
            }

            IFrameElement frameElement  = base.dbctx.FrameElements[elementId];
            ILoadCase     loadCase      = base.dbctx.LoadCases[loadCaseNumber];
            double        gCoefficientY = (frameElement.MaterialProp.EModule * frameElement.SectionProp.MomentOfInertiaZ * frameElement.SectionProp.Mju)
                                          / (frameElement.SectionProp.Area * frameElement.MaterialProp.GModule);

            double gCoefficientZ = (frameElement.MaterialProp.EModule * frameElement.SectionProp.MomentOfInertiaY * frameElement.SectionProp.Mju)
                                   / (frameElement.SectionProp.Area * frameElement.MaterialProp.GModule);

            Vector <double> startPointEntryLoad = Vector <double> .Build.SparseOfArray(new double[] { loadAtStart, 0, 0 });

            Vector <double> endPointEntryLoad = Vector <double> .Build.SparseOfArray(new double[] { loadAtEnd, 0, 0 });

            Vector <double> startPointLoadVector = FrameService.InclinedLoadVector(frameElement, startPointEntryLoad);
            Vector <double> endPointLoadVector   = FrameService.InclinedLoadVector(frameElement, endPointEntryLoad);

            IFrameLoad frameLoadLocalX = this.factory.CreateDistributedNormalLoad(loadCase, frameElement.ElementLength, 0.0,
                                                                                  startPointLoadVector[0], endPointLoadVector[0], loadStartsAt, loadEndsAt);

            IFrameLoad frameLoadLocalY = this.factory.CreateDistributedShearLoadXYPlane(loadCase, frameElement.ElementLength, gCoefficientY,
                                                                                        startPointLoadVector[1], endPointLoadVector[1], loadStartsAt, loadEndsAt);

            IFrameLoad frameLoadLocalZ = this.factory.CreateDistributedShearLoadXZPlane(loadCase, frameElement.ElementLength, gCoefficientZ,
                                                                                        startPointLoadVector[2], endPointLoadVector[2], loadStartsAt, loadEndsAt);

            FrameService.AddLoad(frameElement, frameLoadLocalX);
            FrameService.AddLoad(frameElement, frameLoadLocalY);
            FrameService.AddLoad(frameElement, frameLoadLocalZ);

            return($"Distributed frame load in global X direction with intensities {loadAtStart} and {loadAtEnd} and Load Case Numeber {loadCaseNumber} has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #3
0
        public void CreateGrid(IActiveView activeView, IPageLayout pageLayout)
        {
            IMapGrid mapGrid = new GraticuleClass();

            mapGrid.Name = "Map Grid";
            IColor color = new RgbColorClass(); color.RGB = 0XBBBBBB;

            ICartographicLineSymbol cartographicLineSymbol = new CartographicLineSymbolClass();

            cartographicLineSymbol.Cap   = esriLineCapStyle.esriLCSButt;
            cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 2;
            mapGrid.LineSymbol           = (ILineSymbol)cartographicLineSymbol;
            mapGrid.Border     = null;
            mapGrid.TickLength = 15;

            cartographicLineSymbol       = new CartographicLineSymbolClass();
            cartographicLineSymbol.Cap   = esriLineCapStyle.esriLCSButt;
            cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 1;
            mapGrid.TickLineSymbol       = (ILineSymbol)cartographicLineSymbol;
            mapGrid.TickMarkSymbol       = null; mapGrid.SubTickCount = 5; mapGrid.SubTickLength = 10;

            cartographicLineSymbol       = new CartographicLineSymbolClass();
            cartographicLineSymbol.Cap   = esriLineCapStyle.esriLCSButt;
            cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 0.2;
            mapGrid.SubTickLineSymbol    = (ILineSymbol)cartographicLineSymbol;

            IGridLabel gridLabel = mapGrid.LabelFormat;

            gridLabel.LabelOffset = 15;
            mapGrid.SetTickVisibility(true, true, true, true);
            mapGrid.SetSubTickVisibility(true, true, true, true);
            mapGrid.SetLabelVisibility(true, true, true, true);
            mapGrid.Visible = true;
            IMeasuredGrid measuredGrid = mapGrid as IMeasuredGrid;

            measuredGrid.FixedOrigin   = true;
            measuredGrid.XIntervalSize = 10;
            measuredGrid.XOrigin       = 5;  //Shift grid 5
            measuredGrid.YIntervalSize = 10; //Parallel interval.
            measuredGrid.YOrigin       = 5;  //Shift grid 5

            IMap map = activeView.FocusMap;
            IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
            IFrameElement      frameElement      = graphicsContainer.FindFrame(map);
            IMapFrame          mapFrame          = frameElement as IMapFrame;
            IMapGrids          mapGrids          = null;

            mapGrids = mapFrame as IMapGrids;
            mapGrids.AddMapGrid(mapGrid);

            activeView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
        }
コード例 #4
0
        //创建要素的轮廓线
        private void CreateSelectElementFrame()
        {
            IFrameElement    pFrameElement    = Element as IFrameElement;
            IFrameProperties pFrameProperties = pFrameElement as IFrameProperties;

            //边框的间距和圆角
            if (SymbolBorder != null)
            {
                if (this.txtBorderGap.Text != null)
                {
                    SymbolBorder.Gap = double.Parse(this.txtBorderGap.Text);
                }
                if (this.txtBorderAngle.Text != null)
                {
                    SymbolBorder.CornerRounding = short.Parse(this.txtBorderAngle.Text);
                }
            }
            if (SymbolBackground != null)
            {
                if (txtBackgroundGap.Text != null)
                {
                    SymbolBackground.Gap = double.Parse(this.txtBackgroundGap.Text);
                }
                if (txtBackgroundAngle.Text != null)
                {
                    SymbolBackground.CornerRounding = short.Parse(this.txtBackgroundAngle.Text);
                }
            }
            if (SymbolShadow != null)
            {
                if (txtShadowX.Text != null)
                {
                    SymbolShadow.HorizontalSpacing = double.Parse(this.txtShadowX.Text);
                }
                if (txtShadowY.Text != null)
                {
                    SymbolShadow.VerticalSpacing = double.Parse(this.txtShadowY.Text);
                }
                if (txtShadowAngle.Text != null)
                {
                    SymbolShadow.CornerRounding = short.Parse(this.txtShadowAngle.Text);
                }
            }
            //边框
            pFrameProperties.Border = SymbolBorder;
            //背景
            pFrameProperties.Background = SymbolBackground;
            //阴影
            pFrameProperties.Shadow = SymbolShadow;
        }
コード例 #5
0
        //取消按钮
        private void btCancel_Click(object sender, EventArgs e)
        {
            IFrameElement    pFrameElement    = Element as IFrameElement;
            IFrameProperties pFrameProperties = pFrameElement as IFrameProperties;

            //边框
            pFrameProperties.Border = pSymbolBorder;
            //背景
            pFrameProperties.Background = pSymbolBackground;
            //阴影
            pFrameProperties.Shadow = pSymbolShadow;

            this.Close();
        }
コード例 #6
0
ファイル: Repository.cs プロジェクト: Osipchik/XamarinApp
 public static void ContentCreate(Realm realm, Question owner, IFrameElement item)
 {
     realm.Write(() =>
     {
         owner.Contents.Add(new QuestionContent
         {
             Id       = item.Id,
             Owner    = owner,
             MainText = item.MainText,
             Text     = item.Text,
             IsRight  = item.IsRight,
         });
     });
 }
コード例 #7
0
ファイル: MyMapGridClass.cs プロジェクト: Mengzuozhu/AeHelper
        /// <summary>
        /// 获取地图格网
        /// </summary>
        /// <param name="layoutControl">布局视图</param>
        /// <returns></returns>
        public static IMapGrids GetMapGrids(AxPageLayoutControl layoutControl)
        {
            IGraphicsContainer graphicsContainer = layoutControl.PageLayout as IGraphicsContainer;

            if (graphicsContainer == null)
            {
                return(null);
            }
            IMap          pMap         = layoutControl.ActiveView.FocusMap;
            IFrameElement frameElement = graphicsContainer.FindFrame(pMap);
            IMapFrame     mapFrame     = frameElement as IMapFrame;
            IMapGrids     pMapGrids    = mapFrame as IMapGrids;

            return(pMapGrids);
        }
コード例 #8
0
        public static void AddLoad(IFrameElement element, IFrameLoad load)
        {
            Guard.WhenArgument(element, "element").IsNull().Throw();
            Guard.WhenArgument(load, "load").IsNull().Throw();
            element.Loads.Add(load);

            if (!element.GeneratedLocalLoadVectors.ContainsKey(load.LoadCase.Number))
            {
                element.GeneratedLocalLoadVectors.Add(load.LoadCase.Number, load.GenerateLoad());
            }

            else
            {
                element.GeneratedLocalLoadVectors[load.LoadCase.Number] += load.GenerateLoad();
            }
        }
コード例 #9
0
 public void SetObjects(object object_0)
 {
     this.iframeElement_0 = object_0 as IFrameElement;
     if (this.iframeElement_0.Border != null)
     {
         this.iborder_0 = (this.iframeElement_0.Border as IClone).Clone() as IBorder;
     }
     if (this.iframeElement_0.Background != null)
     {
         this.ibackground_0 = (this.iframeElement_0.Background as IClone).Clone() as IBackground;
     }
     if ((this.iframeElement_0 as IFrameProperties).Shadow != null)
     {
         this.ishadow_0 = ((this.iframeElement_0 as IFrameProperties).Shadow as IClone).Clone() as IShadow;
     }
 }
        public override string Execute(IList <string> parameters)
        {
            int    elementId;
            int    loadCaseNumber;
            double loadValue;
            double loadPosition;

            try
            {
                elementId      = int.Parse(parameters[0]);
                loadCaseNumber = int.Parse(parameters[1]);
                loadValue      = double.Parse(parameters[2]);
                loadPosition   = double.Parse(parameters[3]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignConcentratedLoadGlobalYDirection command parameters.");
            }

            IFrameElement frameElement  = base.dbctx.FrameElements[elementId];
            ILoadCase     loadCase      = base.dbctx.LoadCases[loadCaseNumber];
            double        gCoefficientY = (frameElement.MaterialProp.EModule * frameElement.SectionProp.MomentOfInertiaZ * frameElement.SectionProp.Mju)
                                          / (frameElement.SectionProp.Area * frameElement.MaterialProp.GModule);

            double gCoefficientZ = (frameElement.MaterialProp.EModule * frameElement.SectionProp.MomentOfInertiaY * frameElement.SectionProp.Mju)
                                   / (frameElement.SectionProp.Area * frameElement.MaterialProp.GModule);

            Vector <double> EntryLoad = Vector <double> .Build.SparseOfArray(new double[] { 0, loadValue, 0 });

            Vector <double> LoadVector = FrameService.InclinedLoadVector(frameElement, EntryLoad);

            IFrameLoad frameLoadLocalX = this.factory.CreateConcentratedNormalLoad(loadCase, frameElement.ElementLength, 0.0,
                                                                                   LoadVector[0], loadPosition);

            IFrameLoad frameLoadLocalY = this.factory.CreateConcentratedShearLoadXYPlane(loadCase, frameElement.ElementLength, gCoefficientY,
                                                                                         LoadVector[1], loadPosition);

            IFrameLoad frameLoadLocalZ = this.factory.CreateConcentratedShearLoadXZPlane(loadCase, frameElement.ElementLength, gCoefficientZ,
                                                                                         LoadVector[2], loadPosition);

            FrameService.AddLoad(frameElement, frameLoadLocalX);
            FrameService.AddLoad(frameElement, frameLoadLocalY);
            FrameService.AddLoad(frameElement, frameLoadLocalZ);

            return($"Concentrated frame load in global Y direction with intensity {loadValue} and Load Case Numeber {loadCaseNumber} has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #11
0
        public override string Execute(IList <string> parameters)
        {
            int frameId;

            try
            {
                frameId = int.Parse(parameters[0]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse ShowFrameElement command parameters.");
            }

            IFrameElement frameElement = base.dbctx.FrameElements[frameId];
            string        result       = FrameService.AsString(frameElement);

            return(result);
        }
コード例 #12
0
        public override string Execute(IList <string> parameters)
        {
            int elementId;

            try
            {
                elementId = int.Parse(parameters[0]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignShearZReleaseNode2 command parameters.");
            }

            IFrameElement frameElement = base.dbctx.FrameElements[elementId];

            frameElement.ShearZReleaseNode2 = true;
            return($"Shear in Z direction release at node 2 has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #13
0
        public override string Execute(IList <string> parameters)
        {
            int elementId;

            try
            {
                elementId = int.Parse(parameters[0]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignMomentAroundYReleaseNode1 command parameters.");
            }

            IFrameElement frameElement = base.dbctx.FrameElements[elementId];

            frameElement.MomentAroundYReleaseNode1 = true;
            return($"Moment around Y release at node 1 has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: YNatsu/ArcEngine
//        指北针

        public void AddNorthArrow(AxPageLayoutControl axPageLayout)
        {
            //删除已经存在的指北针

            IElement pElement = axPageLayout.FindElementByName("NorthArrows");

            if (pElement != null)
            {
                axPageLayout.ActiveView.GraphicsContainer.DeleteElement(pElement);
            }


            IGraphicsContainer container  = axPageLayout.PageLayout as IGraphicsContainer;
            IActiveView        activeView = axPageLayout.PageLayout as IActiveView;
            // 获得MapFrame
            IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
            IMapFrame     mapFrame     = frameElement as IMapFrame;
            //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
            UID uid = new UIDClass();

            uid.Value = "esriCarto.MarkerNorthArrow";
            IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
            //设置MapSurroundFrame中指北针的点符号
            IMapSurround      mapSurround      = mapSurroundFrame.MapSurround;
            IMarkerNorthArrow markerNorthArrow = mapSurround as IMarkerNorthArrow;
            IMarkerSymbol     markerSymbol     = markerNorthArrow.MarkerSymbol;

            markerSymbol.Size             = 48;
            markerNorthArrow.MarkerSymbol = markerSymbol;

            //QI,确定mapSurroundFrame的位置
            IElement  element  = mapSurroundFrame as IElement;
            IEnvelope envelope = new EnvelopeClass();

            double x = 15;
            double y = 22;

            envelope.PutCoords(x, y, x + 5, y + 5);
            element.Geometry = envelope;
            //使用IGraphicsContainer接口添加显示
            container.AddElement(element, 0);
            activeView.Refresh();
        }
コード例 #15
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            if (this.iframeHolder != null)
            {
                IFrameElement ifr = (IFrameElement)Document.CreateElement("IFRAME");
                ifr.Style.Width     = "95vh";
                ifr.Style.MaxWidth  = "700px";
                ifr.Style.OverflowX = "hidden";
                ifr.Style.OverflowY = "hidden";
                ifr.Style.Height    = "440px";
                ifr.Style.Border    = "0px";
                ifr.FrameBorder     = "0";

                ifr.Src = "https://qualla.com/qseafawaa/embed";


                iframeHolder.AppendChild(ifr);
            }
        }
コード例 #16
0
        public void AddNorthArrow(IPageLayout pageLayout, IMap map, double posX, double posY, double division)
        {
            try
            {
                if (pageLayout == null || map == null)
                {
                    return;
                }

                IEnvelope envelope = new EnvelopeClass();
                envelope.PutCoords(posX - division, posY - division, posX, posY); //  Specify the location and size of the north arrow

                ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
                uid.Value = "esriCarto.MarkerNorthArrow";

                // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
                // Activate it and add it to the PageLayout's graphics container
                IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;                                      // Dynamic Cast
                IActiveView        activeView        = pageLayout as IActiveView;                                             // Dynamic Cast
                IFrameElement      frameElement      = graphicsContainer.FindFrame(map);
                IMapFrame          mapFrame          = frameElement as IMapFrame;                                             // Dynamic Cast
                IMapSurroundFrame  mapSurroundFrame  = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast
                IElement           element           = mapSurroundFrame as IElement;                                          // Dynamic Cast
                element.Geometry = envelope;
                element.Activate(activeView.ScreenDisplay);
                graphicsContainer.AddElement(element, 0);
                IMapSurround mapSurround = mapSurroundFrame.MapSurround;

                // Change out the default north arrow
                IMarkerNorthArrow      markerNorthArrow      = mapSurround as IMarkerNorthArrow;       // Dynamic Cast
                IMarkerSymbol          markerSymbol          = markerNorthArrow.MarkerSymbol;
                ICharacterMarkerSymbol characterMarkerSymbol = markerSymbol as ICharacterMarkerSymbol; // Dynamic Cast
                characterMarkerSymbol.CharacterIndex = 174;                                            // change the symbol for the North Arrow
                markerNorthArrow.MarkerSymbol        = characterMarkerSymbol;
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
コード例 #17
0
        public override string Execute(IList <string> parameters)
        {
            int sectionId;
            int elementId;

            try
            {
                sectionId = int.Parse(parameters[0]);
                elementId = int.Parse(parameters[1]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignFrameSection command parameters.");
            }

            IFrameElement frameElement = base.dbctx.FrameElements[elementId];
            IFrameSection frameSection = base.dbctx.FrameSections[sectionId];

            frameElement.SectionProp = frameSection;
            return($"Section with ID {frameSection.Number} has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #18
0
        public override string Execute(IList <string> parameters)
        {
            int materialId;
            int elementId;

            try
            {
                materialId = int.Parse(parameters[0]);
                elementId  = int.Parse(parameters[1]);
            }
            catch
            {
                throw new ArgumentException("Failed to parse AssignMaterialToFrameElement command parameters.");
            }

            IFrameElement frameElement  = base.dbctx.FrameElements[elementId];
            IMaterial     frameMaterial = base.dbctx.Materials[materialId];

            frameElement.MaterialProp = frameMaterial;
            return($"Material with ID {frameMaterial.Number} has been assigned to element with ID {frameElement.Number}.");
        }
コード例 #19
0
ファイル: Form1.cs プロジェクト: YNatsu/ArcEngine
//        比例尺

        public void AddScalebar(AxPageLayoutControl axPageLayout)
        {
            //删除已经存在的比例尺

            IElement pelement = axPageLayout.FindElementByName("AlternatingScaleBar");


            if (pelement != null)
            {
                axPageLayout.ActiveView.GraphicsContainer.DeleteElement(pelement);
            }

            IGraphicsContainer container  = axPageLayout.PageLayout as IGraphicsContainer;
            IActiveView        activeView = axPageLayout.PageLayout as IActiveView;
            // 获得MapFrame
            IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
            IMapFrame     mapFrame     = frameElement as IMapFrame;
            //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
            UID uid = new UIDClass();

            uid.Value = "esriCarto.AlternatingScaleBar";
            IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
            //设置MapSurroundFrame中比例尺的样式
            IMapSurround mapSurround    = mapSurroundFrame.MapSurround;
            IScaleBar    markerScaleBar = ((IScaleBar)mapSurround);

            markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
            markerScaleBar.UseMapSettings();
            //QI,确定mapSurroundFrame的位置
            IElement  element  = mapSurroundFrame as IElement;
            IEnvelope envelope = new EnvelopeClass();
            double    x        = 12;
            double    y        = 5;

            envelope.PutCoords(x, y, x + 1, y + 1);
            element.Geometry = envelope;
            //使用IGraphicsContainer接口添加显示
            container.AddElement(element, 0);
            activeView.Refresh();
        }
コード例 #20
0
        public static void AddScalebar(AxPageLayoutControl pageLayoutControl, IEnvelope envelope)
        {
            IUID uid = new UIDClass()
            {
                Value = "esriCarto.AlternatingScaleBar"
            };

            IFrameElement frameElement = (pageLayoutControl.PageLayout as IGraphicsContainer)
                                         .FindFrame(pageLayoutControl.ActiveView.FocusMap);
            IMapFrame         mapFrame         = frameElement as IMapFrame;
            IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as UID, null); // Dynamic Cast
            IElement          element          = mapSurroundFrame as IElement;                   // Dynamic Cast

            element.Geometry = envelope;
            element.Activate(pageLayoutControl.ActiveView.ScreenDisplay);
            (pageLayoutControl.PageLayout as IGraphicsContainer).AddElement(element, 0);
            IMapSurround mapSurround = mapSurroundFrame.MapSurround;

            IScaleBar markerScaleBar = (IScaleBar)(mapSurround);

            markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
            markerScaleBar.UseMapSettings();
        }
コード例 #21
0
ファイル: MyMapGridClass.cs プロジェクト: Mengzuozhu/AeHelper
        /// <summary>
        /// 删除已存在格网
        /// </summary>
        /// <param name="pActiveView"></param>
        public static void DeleteExistMapGrid(IActiveView pActiveView)
        {
            IGraphicsContainer graphicsContainer = pActiveView as IGraphicsContainer;

            if (graphicsContainer == null)
            {
                return;
            }
            IMap          pMap         = pActiveView.FocusMap;
            IFrameElement frameElement = graphicsContainer.FindFrame(pMap);
            IMapFrame     mapFrame     = frameElement as IMapFrame;
            IMapGrids     mapGrids     = mapFrame as IMapGrids;

            if (mapGrids == null)
            {
                return;
            }
            if (mapGrids.MapGridCount > 0)
            {
                IMapGrid pMapGrid = mapGrids.MapGrid[0];
                mapGrids.DeleteMapGrid(pMapGrid);
            }
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
        }
コード例 #22
0
ファイル: FrmNeatLine.cs プロジェクト: eglrp/TESTPROJECT-1
        //创建选择要素的轮廓线
        private void CreateSelectElementFrame()
        {
            IGraphicsContainer       pGraphicsContainer       = m_hookHelper.ActiveView.GraphicsContainer;
            IGraphicsContainerSelect pGraphicsContainerSelect = pGraphicsContainer as IGraphicsContainerSelect;
            int          SelectElementCount = pGraphicsContainerSelect.ElementSelectionCount;
            IEnumElement pEnumElement       = pGraphicsContainerSelect.SelectedElements;

            pEnumElement.Reset();
            IElement pElement = pEnumElement.Next();

            for (int i = 0; i < SelectElementCount; i++)
            {
                IElementProperties pElementProperties = pElement as IElementProperties;
                IFrameElement      pFrameElement      = pElement as IFrameElement;
                IFrameProperties   pFrameProperties   = pFrameElement as IFrameProperties;
                //边框的间距和圆角
                if (SymbolBorder != null)
                {
                    if (this.txtBorderGap.Text != null)
                    {
                        SymbolBorder.Gap = double.Parse(this.txtBorderGap.Text);
                    }
                    if (this.txtBorderAngle.Text != null)
                    {
                        SymbolBorder.CornerRounding = short.Parse(this.txtBorderAngle.Text);
                    }
                }
                if (SymbolBackground != null)
                {
                    if (txtBackgroundGap.Text != null)
                    {
                        SymbolBackground.Gap = double.Parse(this.txtBackgroundGap.Text);
                    }
                    if (txtBackgroundAngle.Text != null)
                    {
                        SymbolBackground.CornerRounding = short.Parse(this.txtBackgroundAngle.Text);
                    }
                }
                if (SymbolShadow != null)
                {
                    if (txtShadowX.Text != null)
                    {
                        SymbolShadow.HorizontalSpacing = double.Parse(this.txtShadowX.Text);
                    }
                    if (txtShadowY.Text != null)
                    {
                        SymbolShadow.VerticalSpacing = double.Parse(this.txtShadowY.Text);
                    }
                    if (txtShadowAngle.Text != null)
                    {
                        SymbolShadow.CornerRounding = short.Parse(this.txtShadowAngle.Text);
                    }
                }
                //边框
                pFrameProperties.Border = SymbolBorder;
                //背景
                pFrameProperties.Background = SymbolBackground;
                //阴影
                pFrameProperties.Shadow = SymbolShadow;

                pElement = pEnumElement.Next();
            }
        }
コード例 #23
0
        /// <summary>
        /// If overriding don't forget to call base.Load() or make sure to
        /// assign the WrappedElement.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NoSuchElementException"></exception>
        public override ILoadableComponent Load()
        {
            base.Load();

            WaitForInitalization();

            var script = new JavaScript
            {
                Arguments = new[] { new JavaScriptValue(WrappedElement) },
                IsAsync   = false,
                Script    = JavaScript.Clean(
                    JavaScript.RemoveComments(
                        AddTinyMCEUtilities() +
                        "var el = arguments[0];" +
                        "var editor = tinyMCEUtilities.getEditor(el);" +
                        "return editor == null ? null : editor.getContainer();"))
            };

            TinyMCEContainerElement = script.Execute(
                WrappedDriver.JavaScriptExecutor())
                                      .ToWebElement();

            if (TinyMCEContainerElement == null)
            {
                throw new NoSuchElementException();
            }

            UpdateIntegrationMode();

            if (IntegrationMode == IntegrationMode.Classic)
            {
                iframeElement = new IFrameElement(
                    TinyMCEContainerElement
                    .FindElement(By.TagName("iframe"))
                    .UnWrapEventFiringWebElement(),
                    WrappedDriver);
            }

            // Menu.
            if (TinyMCEContainerElement.FindElements(menuComponentSelector).Any())
            {
                Menu = pageObjectFactory.PrepareComponent(
                    new MenuComponent(menuComponentSelector,
                                      pageObjectFactory,
                                      WrappedDriver));
            }
            else
            {
                Menu = null;
            }

            // Toolbar.
            if (TinyMCEContainerElement.FindElements(toolbarComponentSelector).Any())
            {
                Toolbar = pageObjectFactory.PrepareComponent(
                    new ToolbarComponent(
                        toolbarComponentSelector,
                        pageObjectFactory,
                        WrappedDriver));
            }
            else
            {
                Toolbar = null;
            }

            // Status bar.
            if (TinyMCEContainerElement.FindElements(statusbarComponentSelector).Any())
            {
                Statusbar = pageObjectFactory.PrepareComponent(
                    new StatusbarComponent(statusbarComponentSelector,
                                           pageObjectFactory,
                                           WrappedDriver));
            }
            else
            {
                Statusbar = null;
            }

            return(this);
        }
コード例 #24
0
        public static Matrix <double> GenerateLocalMatrix(IFrameElement element)
        {
            Guard.WhenArgument(element, "element").IsNull().Throw();

            IMaterial     materialProp = element.MaterialProp;
            IFrameSection sectionProp  = element.SectionProp;

            Guard.WhenArgument(materialProp, "materialProp").IsNull().Throw();
            Guard.WhenArgument(sectionProp, "sectionProp").IsNull().Throw();

            double eModule  = materialProp.EModule;
            double gModule  = materialProp.GModule;
            double area     = sectionProp.Area;
            double momentY  = sectionProp.MomentOfInertiaY;
            double momentZ  = sectionProp.MomentOfInertiaZ;
            double torsionX = sectionProp.TorsionalConstantX;
            double mju      = sectionProp.Mju;

            double elementLength = element.ElementLength;

            double Alfa       = element.Alfa;
            double cosineAlfa = Math.Cos(Alfa);
            double sineAlfa   = Math.Sin(Alfa);

            double index11, index17, index22, index26, index28, index212, index33, index35, index39, index311,
                   index44, index410, index55, index59, index511, index66, index68, index612, index77, index88,
                   index812, index99, index911, index1010, index1111, index1212;

            //Check for invalid releases
            if ((element.ShearYReleaseNode1 == true && element.ShearYReleaseNode2 == true) ||
                (element.ShearZReleaseNode1 == true && element.ShearZReleaseNode2 == true))
            {
                throw new ArgumentException("Invalid releases - you can not have shear releases at both ends in the same plane, the element is not stable.");
            }

            if ((element.MomentAroundZReleaseNode1 == true && element.MomentAroundZReleaseNode2 == true && (element.ShearYReleaseNode1 == true || element.ShearYReleaseNode2 == true)) ||
                (element.MomentAroundYReleaseNode1 == true && element.MomentAroundYReleaseNode2 == true && (element.ShearZReleaseNode1 == true || element.ShearZReleaseNode2 == true)))
            {
                throw new ArgumentException("Invalid releases - you can not have moment releases at both ends and a shear release at either end (in the same plane), the element is not stable.");
            }

            if (element.NormalReleaseNode1 == true && element.NormalReleaseNode2 == true)
            {
                throw new ArgumentException("Invalid releases - you can not have normal force releases at both ends, the element is not stable.");
            }

            if (element.TorsionReleaseNode1 == true && element.TorsionReleaseNode2 == true)
            {
                throw new ArgumentException("Invalid releases - you can not have torsion releases at both ends, the element is not stable.");
            }

            //Releases XY plane
            if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == false &&
                element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == false)
            {
                index22  = (12.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentZ);
                index26  = (6.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentZ);
                index28  = (12.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentZ);
                index212 = (6.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentZ);

                index66 = ((4.0 * elementLength * eModule * momentZ * gModule * area) / (elementLength * elementLength * gModule * area + mju * 12.0 * eModule * momentZ))
                          + ((12.0 * mju * eModule * eModule * momentZ * momentZ) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentZ));
                index68  = (6.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentZ);
                index612 = ((2.0 * elementLength * eModule * momentZ * gModule * area) / (elementLength * elementLength * gModule * area + 12.0 * mju * eModule * momentZ))
                           - ((12.0 * mju * eModule * eModule * momentZ * momentZ) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentZ));

                index88  = (12.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentZ);
                index812 = (6.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentZ);

                index1212 = ((4.0 * elementLength * eModule * momentZ * gModule * area) / (elementLength * elementLength * gModule * area + mju * 12.0 * eModule * momentZ))
                            + ((12.0 * mju * eModule * eModule * momentZ * momentZ) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentZ));
            }

            else if (element.MomentAroundZReleaseNode1 == true && element.MomentAroundZReleaseNode2 == true &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == false)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == true && element.MomentAroundZReleaseNode2 == false &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == false)
            {
                index22  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index26  = 0.0;
                index28  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index212 = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index812 = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);

                index1212 = (3.0 * eModule * momentZ * gModule * area * elementLength) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);
            }

            else if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == true &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == false)
            {
                index22  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index26  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);
                index28  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index212 = 0.0;

                index66  = (3.0 * eModule * momentZ * gModule * area * elementLength) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);
                index68  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentZ);
                index612 = 0.0;

                index88  = (3.0 * eModule * momentZ * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentZ);
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == true && element.MomentAroundZReleaseNode2 == false &&
                     element.ShearYReleaseNode1 == true && element.ShearYReleaseNode2 == false)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == true &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == true)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == true && element.MomentAroundZReleaseNode2 == false &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == true)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == true &&
                     element.ShearYReleaseNode1 == true && element.ShearYReleaseNode2 == false)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = double.Epsilon;
                index68  = 0.0;
                index612 = 0.0;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = double.Epsilon;
            }

            else if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == false &&
                     element.ShearYReleaseNode1 == true && element.ShearYReleaseNode2 == false)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = (eModule * momentZ) / elementLength;
                index68  = 0.0;
                index612 = (-1) * (eModule * momentZ) / elementLength;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = (eModule * momentZ) / elementLength;
            }

            else if (element.MomentAroundZReleaseNode1 == false && element.MomentAroundZReleaseNode2 == false &&
                     element.ShearYReleaseNode1 == false && element.ShearYReleaseNode2 == true)
            {
                index22  = double.Epsilon;
                index26  = 0.0;
                index28  = 0.0;
                index212 = 0.0;

                index66  = (eModule * momentZ) / elementLength;
                index68  = 0.0;
                index612 = (-1) * (eModule * momentZ) / elementLength;

                index88  = double.Epsilon;
                index812 = 0.0;

                index1212 = (eModule * momentZ) / elementLength;
            }

            else
            {
                index22  = double.NaN;
                index26  = double.NaN;
                index28  = double.NaN;
                index212 = double.NaN;

                index66  = double.NaN;
                index68  = double.NaN;
                index612 = double.NaN;

                index88  = double.NaN;
                index812 = double.NaN;

                index1212 = double.NaN;
            }

            //Releases XZ plane
            if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == false &&
                element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == false)
            {
                index33  = (12.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentY);
                index35  = (6.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentY);
                index39  = (12.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentY);
                index311 = (6.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentY);

                index55 = ((4.0 * elementLength * eModule * momentY * gModule * area) / (elementLength * elementLength * gModule * area + mju * 12.0 * eModule * momentY))
                          + ((12.0 * mju * eModule * eModule * momentY * momentY) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentY));
                index59  = (6.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentY);
                index511 = ((2.0 * elementLength * eModule * momentY * gModule * area) / (elementLength * elementLength * gModule * area + 12.0 * mju * eModule * momentY))
                           - ((12.0 * mju * eModule * eModule * momentY * momentY) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentY));

                index99  = (12.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 12.0 * eModule * momentY);
                index911 = (6.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 12.0 * eModule * momentY);

                index1111 = ((4.0 * elementLength * eModule * momentY * gModule * area) / (elementLength * elementLength * gModule * area + mju * 12.0 * eModule * momentY))
                            + ((12.0 * mju * eModule * eModule * momentY * momentY) / (elementLength * elementLength * elementLength * gModule * area + 12.0 * elementLength * mju * eModule * momentY));
            }

            else if (element.MomentAroundYReleaseNode1 == true && element.MomentAroundYReleaseNode2 == true &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == false)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == true && element.MomentAroundYReleaseNode2 == false &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == false)
            {
                index33  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index35  = 0.0;
                index39  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index311 = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index911 = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);

                index1111 = (3.0 * eModule * momentY * gModule * area * elementLength) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);
            }

            else if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == true &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == false)
            {
                index33  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index35  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);
                index39  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index311 = 0.0;

                index55  = (3.0 * eModule * momentY * gModule * area * elementLength) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);
                index59  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength + mju * 3.0 * eModule * momentY);
                index511 = 0.0;

                index99  = (3.0 * eModule * momentY * gModule * area) / (gModule * area * elementLength * elementLength * elementLength + mju * elementLength * 3.0 * eModule * momentY);
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == true && element.MomentAroundYReleaseNode2 == false &&
                     element.ShearZReleaseNode1 == true && element.ShearZReleaseNode2 == false)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == true &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == true)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == true && element.MomentAroundYReleaseNode2 == false &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == true)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == true &&
                     element.ShearZReleaseNode1 == true && element.ShearZReleaseNode2 == false)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = double.Epsilon;
                index59  = 0.0;
                index511 = 0.0;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = double.Epsilon;
            }

            else if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == false &&
                     element.ShearZReleaseNode1 == true && element.ShearZReleaseNode2 == false)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = (eModule * momentY) / elementLength;
                index59  = 0.0;
                index511 = (-1) * (eModule * momentY) / elementLength;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = (eModule * momentY) / elementLength;
            }

            else if (element.MomentAroundYReleaseNode1 == false && element.MomentAroundYReleaseNode2 == false &&
                     element.ShearZReleaseNode1 == false && element.ShearZReleaseNode2 == true)
            {
                index33  = double.Epsilon;
                index35  = 0.0;
                index39  = 0.0;
                index311 = 0.0;

                index55  = (eModule * momentY) / elementLength;
                index59  = 0.0;
                index511 = (-1) * (eModule * momentY) / elementLength;

                index99  = double.Epsilon;
                index911 = 0.0;

                index1111 = (eModule * momentY) / elementLength;
            }

            else
            {
                index33  = double.NaN;
                index35  = double.NaN;
                index39  = double.NaN;
                index311 = double.NaN;

                index55  = double.NaN;
                index59  = double.NaN;
                index511 = double.NaN;

                index99  = double.NaN;
                index911 = double.NaN;

                index1111 = double.NaN;
            }

            //Normal Releases
            if (element.NormalReleaseNode1 == false && element.NormalReleaseNode2 == false)
            {
                index11 = (eModule * area) / elementLength;
                index17 = (eModule * area) / elementLength;

                index77 = (eModule * area) / elementLength;
            }

            else if ((element.NormalReleaseNode1 == true && element.NormalReleaseNode2 == false) ||
                     (element.NormalReleaseNode1 == false && element.NormalReleaseNode2 == true))
            {
                index11 = double.Epsilon;
                index17 = 0.0;

                index77 = double.Epsilon;
            }

            else
            {
                index11 = double.NaN;
                index17 = double.NaN;

                index77 = double.NaN;
            }

            //Torsional Releases
            if (element.TorsionReleaseNode1 == false && element.TorsionReleaseNode2 == false)
            {
                index44  = (gModule * torsionX) / elementLength;
                index410 = (gModule * torsionX) / elementLength;

                index1010 = (gModule * torsionX) / elementLength;
            }

            else if ((element.TorsionReleaseNode1 == true && element.TorsionReleaseNode2 == false) ||
                     (element.TorsionReleaseNode1 == false && element.TorsionReleaseNode2 == true))
            {
                index44  = double.Epsilon;
                index410 = 0.0;

                index1010 = double.Epsilon;
            }

            else
            {
                index44  = double.NaN;
                index410 = double.NaN;

                index1010 = double.NaN;
            }

            Matrix <double> localMatrix = SparseMatrix.OfArray(new double[, ]
            {
                //First row
                { index11, 0.0, 0.0, 0.0, 0.0, 0.0, (-1) * index17, 0.0, 0.0, 0.0, 0.0, 0.0 },
                //Second row
                { 0.0, index22, 0.0, 0.0, 0.0, index26, 0.0, (-1) * index28, 0.0, 0.0, 0.0, index212 },
                //Third row
                { 0.0, 0.0, index33, 0.0, (-1) * index35, 0.0, 0.0, 0.0, (-1) * index39, 0.0, (-1) * index311, 0.0 },
                //Fourth row
                { 0.0, 0.0, 0.0, index44, 0.0, 0.0, 0.0, 0.0, 0.0, (-1) * index410, 0.0, 0.0 },
                //Fifth row
                { 0.0, 0.0, (-1) * index35, 0.0, index55, 0.0, 0.0, 0.0, index59, 0.0, index511, 0.0 },
                //Sixth row
                { 0.0, index26, 0.0, 0.0, 0.0, index66, 0.0, (-1) * index68, 0.0, 0.0, 0.0, index612 },
                //Seventh row
                { (-1) * index17, 0.0, 0.0, 0.0, 0.0, 0.0, index77, 0.0, 0.0, 0.0, 0.0, 0.0 },
                //Eighth row
                { 0.0, (-1) * index28, 0.0, 0.0, 0.0, (-1) * index68, 0.0, index88, 0.0, 0.0, 0.0, (-1) * index812 },
                //Ninth row
                { 0.0, 0.0, (-1) * index39, 0.0, index59, 0.0, 0.0, 0.0, index99, 0.0, index911, 0.0 },
                //Tenth row
                { 0.0, 0.0, 0.0, (-1) * index410, 0.0, 0.0, 0.0, 0.0, 0.0, index1010, 0.0, 0.0 },
                //Eleventh row
                { 0.0, 0.0, (-1) * index311, 0.0, index511, 0.0, 0.0, 0.0, index911, 0.0, index1111, 0.0 },
                //Twelfth row
                { 0.0, index212, 0.0, 0.0, 0.0, index612, 0.0, (-1) * index812, 0.0, 0.0, 0.0, index1212 }
            });

            return(localMatrix);
        }
コード例 #25
0
 public static Matrix <double> GenerateGlobalMatrix(IFrameElement element)
 {
     Guard.WhenArgument(element, "element").IsNull().Throw();
     return(element.TransformationMatrix.Transpose() * element.LocalMatrix * element.TransformationMatrix);
 }
コード例 #26
0
        private void method_1(IFrameElement iframeElement_1)
        {
            IBorder           border     = iframeElement_1.Border;
            IBackground       background = iframeElement_1.Background;
            IShadow           shadow     = (iframeElement_1 as IFrameProperties).Shadow;
            IStyleGalleryItem oO         = null;
            IFrameDecoration  decoration = null;

            if (border == null)
            {
                oO = null;
            }
            else
            {
                oO = new MyStyleGalleryItem
                {
                    Name = "<定制>",
                    Item = border
                };
                decoration         = border as IFrameDecoration;
                this.txtGap.Text   = decoration.HorizontalSpacing.ToString("0.##");
                this.txtRound.Text = decoration.CornerRounding.ToString("0.##");
            }
            this.cboBorder.SelectStyleGalleryItem(oO);
            if (background == null)
            {
                oO = null;
            }
            else
            {
                oO = new MyStyleGalleryItem
                {
                    Name = "<定制>",
                    Item = background
                };
                if (decoration == null)
                {
                    decoration         = background as IFrameDecoration;
                    this.txtGap.Text   = decoration.HorizontalSpacing.ToString("0.##");
                    this.txtRound.Text = decoration.CornerRounding.ToString("0.##");
                }
            }
            this.cboBackground.SelectStyleGalleryItem(oO);
            if (shadow == null)
            {
                oO = null;
            }
            else
            {
                oO = new MyStyleGalleryItem
                {
                    Name = "<定制>",
                    Item = shadow
                };
                if (decoration == null)
                {
                    decoration         = shadow as IFrameDecoration;
                    this.txtGap.Text   = decoration.HorizontalSpacing.ToString("0.##");
                    this.txtRound.Text = decoration.CornerRounding.ToString("0.##");
                }
            }
            this.cboShadow.SelectStyleGalleryItem(oO);
        }
コード例 #27
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         bool flag = false;
         if (this.chkNewFrameElement.Checked)
         {
             IGraphicsContainerSelect select;
             IEnumElement             selectedElements;
             IGraphicsContainer       container;
             flag = true;
             IFrameElement element         = new FrameElementClass();
             IEnvelope     printableBounds = null;
             IElement      element2        = null;
             if (this.rdoPlaceSelectElement.Checked)
             {
                 select           = this.ipageLayout_0 as IGraphicsContainerSelect;
                 selectedElements = select.SelectedElements;
                 selectedElements.Reset();
                 element2 = selectedElements.Next();
                 if (element2 == null)
                 {
                     return;
                 }
                 printableBounds = element2.Geometry.Envelope;
                 for (element2 = selectedElements.Next(); element2 != null; element2 = selectedElements.Next())
                 {
                     printableBounds.Union(element2.Geometry.Envelope);
                 }
             }
             else if (this.rdoPlaceAllElement.Checked)
             {
                 container = this.ipageLayout_0 as IGraphicsContainer;
                 container.Reset();
                 element2 = container.Next();
                 if (element2 == null)
                 {
                     return;
                 }
                 printableBounds = element2.Geometry.Envelope;
                 for (element2 = container.Next(); element2 != null; element2 = container.Next())
                 {
                     printableBounds.Union(element2.Geometry.Envelope);
                 }
             }
             else
             {
                 printableBounds = this.ipageLayout_0.Page.PrintableBounds;
             }
             printableBounds.Expand(0.5, 0.5, false);
             (element as IElement).Geometry = printableBounds;
             if (this.chkGroup.Checked)
             {
                 IGroupElement group = new GroupElementClass();
                 container = this.ipageLayout_0 as IGraphicsContainer;
                 container.MoveElementToGroup(element as IElement, group);
                 select           = this.ipageLayout_0 as IGraphicsContainerSelect;
                 selectedElements = null;
                 if (this.rdoPlaceAllElement.Checked)
                 {
                     select.SelectAllElements();
                 }
                 selectedElements = select.SelectedElements;
                 selectedElements.Reset();
                 for (element2 = selectedElements.Next(); element2 != null; element2 = selectedElements.Next())
                 {
                     container.MoveElementToGroup(element2, group);
                 }
                 this.iframeElement_0 = group as IFrameElement;
             }
             else
             {
                 this.iframeElement_0 = element;
             }
         }
         IStyleGalleryItem selectStyleGalleryItem = null;
         selectStyleGalleryItem = this.cboBorder.GetSelectStyleGalleryItem();
         IBorder item = null;
         if (selectStyleGalleryItem != null)
         {
             item = selectStyleGalleryItem.Item as IBorder;
             (item as IFrameDecoration).HorizontalSpacing = (double)this.txtGap.Value;
             (item as IFrameDecoration).VerticalSpacing   = (double)this.txtGap.Value;
             (item as IFrameDecoration).CornerRounding    = (short)this.txtRound.Value;
         }
         IBackground background = null;
         selectStyleGalleryItem = this.cboBackground.GetSelectStyleGalleryItem();
         if (selectStyleGalleryItem != null)
         {
             background = selectStyleGalleryItem.Item as IBackground;
             (background as IFrameDecoration).HorizontalSpacing = (double)this.txtGap.Value;
             (background as IFrameDecoration).VerticalSpacing   = (double)this.txtGap.Value;
             (background as IFrameDecoration).CornerRounding    = (short)this.txtRound.Value;
         }
         IShadow shadow = null;
         selectStyleGalleryItem = this.cboShadow.GetSelectStyleGalleryItem();
         if (selectStyleGalleryItem != null)
         {
             shadow = selectStyleGalleryItem.Item as IShadow;
             (shadow as IFrameDecoration).HorizontalSpacing = (double)this.txtGap.Value;
             (shadow as IFrameDecoration).VerticalSpacing   = (double)this.txtGap.Value;
             (shadow as IFrameDecoration).CornerRounding    = (short)this.txtRound.Value;
         }
         this.iframeElement_0.Border     = item;
         this.iframeElement_0.Background = background;
         (this.iframeElement_0 as IFrameProperties).Shadow = shadow;
         if (flag)
         {
             (this.ipageLayout_0 as IGraphicsContainer).AddElement(this.iframeElement_0 as IElement, 0);
             ElementOperator.FocusOneElement(this.ipageLayout_0 as IActiveView, this.iframeElement_0 as IElement);
         }
     }
     catch (Exception exception)
     {
         Logger.Current.Error("", exception, "");
     }
 }
コード例 #28
0
        public static Vector <double> InclinedLoadVector(IFrameElement element, Vector <double> load)
        {
            //double l = (element.Node2.XCoord - element.Node1.XCoord) / element.ElementLength;
            //double m = (element.Node2.YCoord - element.Node1.YCoord) / element.ElementLength;
            //double n = (element.Node2.ZCoord - element.Node1.ZCoord) / element.ElementLength;
            //double d = Math.Sqrt(l * l + m * m);

            //double xP;
            //double yP;
            //double zP;

            //if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            //{
            //    xP = element.Node1.XCoord + 1.0;
            //    yP = element.Node1.YCoord;
            //    zP = element.Node1.ZCoord;
            //}

            //else
            //{
            //    xP = element.Node1.XCoord;
            //    yP = element.Node1.YCoord;
            //    zP = element.Node1.ZCoord + 1.0;
            //}

            //double pY;
            //double pZ;

            //if (l == 0 && m == 0)
            //{
            //    pY = (yP - element.Node1.YCoord);

            //    pZ = (-1) * n * (xP - element.Node1.XCoord);
            //}

            //else
            //{
            //    pY = (-1.0) * m * (xP - element.Node1.XCoord) / d + l * (yP - element.Node1.YCoord) / d;

            //    pZ = (-1.0) * l * n * (xP - element.Node1.XCoord) / d + d * (zP - element.Node1.ZCoord)
            //   - m * n * (yP - element.Node1.YCoord) / d;
            //}

            //double p = Math.Sqrt(pY * pY + pZ * pZ);

            //double alfa = element.Alfa + Math.Acos(pY / p); ;

            //double cosineAlfa = Math.Cos(alfa);
            //double sineAlfa = Math.Sin(alfa);

            //double b1 = ((-1.0) * (l * n * sineAlfa) / d - (m * cosineAlfa) / d);
            //double b2 = ((l * cosineAlfa) / d - (n * m * sineAlfa) / d);
            //double b3 = d * sineAlfa;

            //double a1 = ((-1) * (l * n * cosineAlfa) / d + (m * sineAlfa) / d);
            //double a2 = ((-1) * (l * sineAlfa) / d - (n * m * cosineAlfa) / d);
            //double a3 = d * cosineAlfa;

            //Matrix<double> t;

            //if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            //{
            //    t = SparseMatrix.OfArray(new double[,]
            //    {
            //        //First row
            //        { 0.0, 0.0, n },
            //        //Second row
            //        { (-1.0) * n * sineAlfa, cosineAlfa, 0.0 },
            //        //Third row
            //        { (-1.0) * n * cosineAlfa, (-1.0) * sineAlfa, 0.0 },
            //    });
            //}

            //else
            //{
            //    t = SparseMatrix.OfArray(new double[,]
            //    {
            //        //First row
            //        { l, m, n},
            //        //Second row
            //        { b1, b2, b3},
            //        //Third row
            //        { a1, a2, a3}
            //    });
            //}
            Guard.WhenArgument(element, "element").IsNull().Throw();
            Guard.WhenArgument(load, "load").IsNull().Throw();

            double l = (element.Node2.XCoord - element.Node1.XCoord) / element.ElementLength;
            double m = (element.Node2.YCoord - element.Node1.YCoord) / element.ElementLength;
            double n = (element.Node2.ZCoord - element.Node1.ZCoord) / element.ElementLength;
            double d = Math.Sqrt(l * l + m * m);

            double xP;
            double yP;
            double zP;

            if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            {
                xP = element.Node1.XCoord + 1.0;
                yP = element.Node1.YCoord;
                zP = element.Node1.ZCoord;
            }

            else
            {
                xP = element.Node1.XCoord;
                yP = element.Node1.YCoord;
                zP = element.Node1.ZCoord + 1.0;
            }

            double pY;
            double pZ;

            if (l == 0 && m == 0)
            {
                pY = n * (xP - element.Node1.XCoord);

                pZ = (yP - element.Node1.YCoord);
            }

            else
            {
                pY = (-1.0) * l * n * (xP - element.Node1.XCoord) / d + d * (zP - element.Node1.ZCoord)
                     - m * n * (yP - element.Node1.YCoord) / d;

                pZ = m * (xP - element.Node1.XCoord) / d - l * (yP - element.Node1.YCoord) / d;
            }

            double p = Math.Sqrt(pY * pY + pZ * pZ);

            double alfa = element.Alfa + Math.Acos(pY / p);;

            double cosineAlfa = Math.Cos(alfa);
            double sineAlfa   = Math.Sin(alfa);

            double b1 = ((-1.0) * (l * n * cosineAlfa) / d + (m * sineAlfa) / d);
            double b2 = ((-1) * (l * sineAlfa) / d - (n * m * cosineAlfa) / d);
            double b3 = d * cosineAlfa;

            double a1 = ((l * n * sineAlfa) / d + (m * cosineAlfa) / d);
            double a2 = ((-1) * (l * cosineAlfa) / d + (n * m * sineAlfa) / d);
            double a3 = (-1) * d * sineAlfa;

            Matrix <double> t;

            if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            {
                t = SparseMatrix.OfArray(new double[, ]
                {
                    //First row
                    { 0.0, 0.0, n },
                    //Second row
                    { n *cosineAlfa, sineAlfa, 0.0 },
                    //Third row
                    { (-1.0) * n * sineAlfa, cosineAlfa, 0.0 }
                });
            }

            else
            {
                t = SparseMatrix.OfArray(new double[, ]
                {
                    //First row
                    { l, m, n },
                    //Second row
                    { b1, b2, b3 },
                    //Third row
                    { a1, a2, a3 }
                });
            }

            Vector <double> result = t * load;

            return(result);
        }
コード例 #29
0
        public static Matrix <double> TransformationMatrix(IFrameElement element)
        {
            Guard.WhenArgument(element, "element").IsNull().Throw();

            double l = (element.Node2.XCoord - element.Node1.XCoord) / element.ElementLength;
            double m = (element.Node2.YCoord - element.Node1.YCoord) / element.ElementLength;
            double n = (element.Node2.ZCoord - element.Node1.ZCoord) / element.ElementLength;
            double d = Math.Sqrt(l * l + m * m);

            double xP;
            double yP;
            double zP;

            if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            {
                xP = element.Node1.XCoord + 1.0;
                yP = element.Node1.YCoord;
                zP = element.Node1.ZCoord;
            }

            else
            {
                xP = element.Node1.XCoord;
                yP = element.Node1.YCoord;
                zP = element.Node1.ZCoord + 1.0;
            }

            double pY;
            double pZ;

            if (l == 0 && m == 0)
            {
                pY = n * (xP - element.Node1.XCoord);

                pZ = (yP - element.Node1.YCoord);
            }

            else
            {
                pY = (-1.0) * l * n * (xP - element.Node1.XCoord) / d + d * (zP - element.Node1.ZCoord)
                     - m * n * (yP - element.Node1.YCoord) / d;

                pZ = m * (xP - element.Node1.XCoord) / d - l * (yP - element.Node1.YCoord) / d;
            }

            double p = Math.Sqrt(pY * pY + pZ * pZ);

            double alfa = element.Alfa + Math.Acos(pY / p);;

            double cosineAlfa = Math.Cos(alfa);
            double sineAlfa   = Math.Sin(alfa);

            double b1 = ((-1.0) * (l * n * cosineAlfa) / d + (m * sineAlfa) / d);
            double b2 = ((-1) * (l * sineAlfa) / d - (n * m * cosineAlfa) / d);
            double b3 = d * cosineAlfa;

            double a1 = ((l * n * sineAlfa) / d + (m * cosineAlfa) / d);
            double a2 = ((-1) * (l * cosineAlfa) / d + (n * m * sineAlfa) / d);
            double a3 = (-1) * d * sineAlfa;

            Matrix <double> t;

            if (element.Node2.XCoord - element.Node1.XCoord == 0 && element.Node2.YCoord - element.Node1.YCoord == 0)
            {
                t = SparseMatrix.OfArray(new double[, ]
                {
                    //First row
                    { 0.0, 0.0, n, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Second row
                    { n *cosineAlfa, sineAlfa, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Third row
                    { (-1.0) * n * sineAlfa, cosineAlfa, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Fourth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, n, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Fifth row
                    { 0.0, 0.0, 0.0, n * cosineAlfa, sineAlfa, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Sixth row
                    { 0.0, 0.0, 0.0, (-1.0) * n * sineAlfa, cosineAlfa, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Seventh row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, n, 0.0, 0.0, 0.0 },
                    //Eighth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, n * cosineAlfa, sineAlfa, 0.0, 0.0, 0.0, 0.0 },
                    //Ninth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.0) * n * sineAlfa, cosineAlfa, 0.0, 0.0, 0.0, 0.0 },
                    //Tenth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, n },
                    //Eleventh row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, n * cosineAlfa, sineAlfa, 0.0 },
                    //Twelfth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (-1.0) * n * sineAlfa, cosineAlfa, 0.0 }
                });
            }

            else
            {
                t = SparseMatrix.OfArray(new double[, ]
                {
                    //First row
                    { l, m, n, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Second row
                    { b1, b2, b3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Third row
                    { a1, a2, a3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Fourth row
                    { 0.0, 0.0, 0.0, l, m, n, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Fifth row
                    { 0.0, 0.0, 0.0, b1, b2, b3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Sixth row
                    { 0.0, 0.0, 0.0, a1, a2, a3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
                    //Seventh row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, l, m, n, 0.0, 0.0, 0.0 },
                    //Eighth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, b1, b2, b3, 0.0, 0.0, 0.0 },
                    //Ninth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, a1, a2, a3, 0.0, 0.0, 0.0 },
                    //Tenth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, l, m, n },
                    //Eleventh row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, b1, b2, b3 },
                    //Twelfth row
                    { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, a1, a2, a3 }
                });
            }

            return(t);
        }
コード例 #30
0
ファイル: WebView.cs プロジェクト: wdstest/SharpJS
 public WebView()
 {
     InternalElement = new IFrameElement();
     PerformLayout();
 }
コード例 #31
0
ファイル: CometRequest.cs プロジェクト: davelondon/dontstayin
		internal CometRequest(IFrameElement iFrame)
		{
			this.iFrame = iFrame;
		}
コード例 #32
0
        public void AddScalebar(IPageLayout pageLayout, IMap map, double posX, double posY, double division, string strMapUnits, short srtDivisions)
        {
            try
            {
                if (pageLayout == null || map == null)
                {
                    return;
                }

                IEnvelope envelope = new EnvelopeClass();
                envelope.PutCoords(posX - (division * 2), posY, posX, posY + (division * 0.5)); // Specify the location and size of the scalebar
                ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
                uid.Value = "esriCarto.AlternatingScaleBar";

                // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
                // Activate it and add it to the PageLayout's graphics container
                IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;                                      // Dynamic Cast
                IActiveView        activeView        = pageLayout as IActiveView;                                             // Dynamic Cast
                IFrameElement      frameElement      = graphicsContainer.FindFrame(map);
                IMapFrame          mapFrame          = frameElement as IMapFrame;                                             // Dynamic Cast
                IMapSurroundFrame  mapSurroundFrame  = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast
                IElement           element           = mapSurroundFrame as IElement;                                          // Dynamic Cast
                element.Geometry = envelope;
                element.Activate(activeView.ScreenDisplay);
                graphicsContainer.AddElement(element, 0);
                IMapSurround mapSurround = mapSurroundFrame.MapSurround;


                IScaleBar markerScaleBar = ((IScaleBar)(mapSurround));
                markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
                markerScaleBar.UseMapSettings();
                markerScaleBar.Divisions           = srtDivisions;
                markerScaleBar.DivisionsBeforeZero = 0;
                markerScaleBar.Subdivisions        = 0;
                markerScaleBar.LabelFrequency      = esriScaleBarFrequency.esriScaleBarMajorDivisions;

                if (strMapUnits == "Feet")
                {
                    markerScaleBar.Units = ESRI.ArcGIS.esriSystem.esriUnits.esriFeet;
                }
                //Default Settings
                else if (strMapUnits == "Miles")
                {
                    markerScaleBar.Units = ESRI.ArcGIS.esriSystem.esriUnits.esriMiles;
                }
                else if (strMapUnits == "Meters")
                {
                    markerScaleBar.Units = ESRI.ArcGIS.esriSystem.esriUnits.esriMeters;
                }
                else if (strMapUnits == "Kilometers")
                {
                    markerScaleBar.Units = ESRI.ArcGIS.esriSystem.esriUnits.esriKilometers;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }