Exemple #1
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            //Distance used in calculating the new point location
            double dMaxDistance = m_MapControl.Extent.Width / 20;

            //Loop through the elements in the GraphicContainer and get the IElement interface
            m_GraphicsContainer.Reset();
            IElement element = m_GraphicsContainer.Next();

            Random r = new Random();

            while (element != null)
            {
                //QI for IElementProperties interface from IElement interface
                IElementProperties elementProperties = (IElementProperties)element;
                //If agent has not been located
                if (elementProperties.Name == false.ToString())
                {
                    //Get hold of the IPoint interface from the elements geometry
                    IPoint point = (IPoint)element.Geometry;
                    //Create new random point coordinates based upon current location

                    point.X = point.X - (dMaxDistance * (r.NextDouble() - 0.5));
                    point.Y = point.Y - (dMaxDistance * (r.NextDouble() - 0.5));
                    //Set the point onto the GeographicCoordinateSystem - WHERE the point came FROM
                    point.Project(m_GeographicCoordinateSystem);
                    if (point.IsEmpty == false)
                    {
                        //Ensure that the point is within the horizon of the coordinate system. Mollweide
                        //has a generic rectangular horizon with the following limits:
                        //-179.999988540844, -90.000000000000, 179.999988540844, 90.000000000000
                        if (point.X > 179.999988540844)
                        {
                            point.X = point.X - 359.999977081688;
                        }
                        else if (point.X < -179.999988540844)
                        {
                            point.X = point.X + 359.999977081688;
                        }
                        if (point.Y > 89.891975)   //fudge value to clip near poles
                        {
                            point.Y = point.Y - 179.78395;
                        }
                        else if (point.Y < -89.891975)  //fudge value to clip near poles
                        {
                            point.Y = point.Y + 179.78395;
                        }
                        //Project the point onto the displays current spatial reference
                        //WHERE the point is going TO
                        point.Project(m_ProjectedCoordinateSystem);
                        element.Geometry = point;
                    }
                }
                element = m_GraphicsContainer.Next();
            }

            //Refresh the graphics
            m_MapControl.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, Type.Missing);
        }
Exemple #2
0
 public BeamNL2D(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, false, false, false, true };
     ElementFreedomSignature[2] = new bool[] { true, true, false, false, false, true };
     DisplacementVector         = new double[6];
 }
Exemple #3
0
 public static void DeleteAllElementsByName(object object_0, string string_0)
 {
     if (object_0 is IScenePlugin)
     {
         IGraphicsContainer3D graphicsContainer3D = (object_0 as IScenePlugin).Scene.BasicGraphicsLayer as IGraphicsContainer3D;
         graphicsContainer3D.Reset();
         for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
         {
             if (elementProperties.Name.ToLower() == string_0.ToLower())
             {
                 graphicsContainer3D.DeleteElement(elementProperties as IElement);
                 graphicsContainer3D.Reset();
             }
         }
         if (graphicsContainer3D.ElementCount > 0)
         {
             if (string_0 == "")
             {
                 graphicsContainer3D.DeleteAllElements();
             }
             else
             {
                 graphicsContainer3D.Reset();
                 for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
                 {
                     if (elementProperties.Name.ToLower() == string_0.ToLower())
                     {
                         graphicsContainer3D.DeleteElement(elementProperties as IElement);
                         graphicsContainer3D.Reset();
                     }
                 }
             }
         }
     }
     else if (object_0 is IGraphicsContainer3D)
     {
         IGraphicsContainer3D graphicsContainer3D = object_0 as IGraphicsContainer3D;
         if (graphicsContainer3D.ElementCount > 0)
         {
             if (string_0 == "")
             {
                 graphicsContainer3D.DeleteAllElements();
             }
             else
             {
                 graphicsContainer3D.Reset();
                 for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
                 {
                     if (elementProperties.Name.ToLower() == string_0.ToLower())
                     {
                         graphicsContainer3D.DeleteElement(elementProperties as IElement);
                         graphicsContainer3D.Reset();
                     }
                 }
             }
         }
     }
 }
Exemple #4
0
 public ContactNtN2Df(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, true, false, false, false, false };
     DisplacementVector         = new double[4];
     PenaltyFactor = properties.YoungMod * 100.0;
 }
Exemple #5
0
        public string get_AnimationObjectName(IAGAnimationContainer pContainer, object pObject)
        {
            string             objectName;
            IElementProperties elemProps = (IElementProperties)pObject;

            objectName = elemProps.Name;

            return(objectName);
        }
Exemple #6
0
 public Collection GetMapFrameCollection(IPageLayout pPageLayout, string sMapClassifyName)
 {
     try
     {
         if (pPageLayout == null)
         {
             return(null);
         }
         IActiveView view = null;
         view = pPageLayout as IActiveView;
         if (view == null)
         {
             return(null);
         }
         IGraphicsContainer graphicsContainer = null;
         graphicsContainer = view.GraphicsContainer;
         if (graphicsContainer == null)
         {
             return(null);
         }
         graphicsContainer.Reset();
         Collection pMapColl = null;
         pMapColl = new Collection();
         IElement item = null;
         for (item = graphicsContainer.Next(); item != null; item = graphicsContainer.Next())
         {
             if (item is IMapFrame)
             {
                 IElementProperties properties = null;
                 properties = item as IElementProperties;
                 if (string.IsNullOrEmpty(sMapClassifyName))
                 {
                     pMapColl.Add(item, "", null, null);
                 }
                 else if (Strings.LCase(Strings.Mid(Convert.ToString(properties.CustomProperty), 4)) == Strings.LCase(sMapClassifyName))
                 {
                     pMapColl.Add(item, "", null, null);
                 }
             }
             else if (item is IGroupElement)
             {
                 this.GetMapFrameCollGroupRecursion(item as IGroupElement, sMapClassifyName, pMapColl);
             }
         }
         if (pMapColl.Count <= 0)
         {
             return(null);
         }
         return(pMapColl);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "GetMapFrameCollection", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }
Exemple #7
0
 public IMapFrame GetMapFrameOverview(IPageLayout pPageLayout, string sMapName)
 {
     try
     {
         if (pPageLayout != null)
         {
             IActiveView view = null;
             view = pPageLayout as IActiveView;
             if (view == null)
             {
                 return(null);
             }
             IGraphicsContainer graphicsContainer = null;
             graphicsContainer = view.GraphicsContainer;
             if (graphicsContainer == null)
             {
                 return(null);
             }
             graphicsContainer.Reset();
             IMapFrame frame   = null;
             IElement  element = null;
             for (element = graphicsContainer.Next(); element != null; element = graphicsContainer.Next())
             {
                 if (element is IMapFrame)
                 {
                     IElementProperties properties = null;
                     properties = element as IElementProperties;
                     if (Strings.LCase(Strings.Mid(Convert.ToString(properties.CustomProperty), 4)) == Strings.LCase("OverviewMap"))
                     {
                         frame = element as IMapFrame;
                         if (string.IsNullOrEmpty(sMapName) | (frame.Map.Name == sMapName))
                         {
                             return(frame);
                         }
                     }
                 }
                 else if (element is IGroupElement)
                 {
                     frame = this.GetMapFrameGroupRecursion(element as IGroupElement, "OverviewMap", sMapName);
                     if (frame != null)
                     {
                         return(frame);
                     }
                 }
             }
         }
         return(null);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "GetMapFrameOverview", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }
 public SecondOrderContactNtS2D(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[3] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[4] = new bool[] { true, true, false, false, false, false };
     DisplacementVector         = new double[8];
     PenaltyFactor = properties.YoungMod * 10.0;// εN / Ε is to be added to element properties
 }
Exemple #9
0
        /// <summary>
        /// 添加指定元素,并设置元素名称
        /// </summary>
        /// <param name="graphicsContainer">图形容器</param>
        /// <param name="pElement">指定元素</param>
        /// <param name="elementName">元素名称</param>
        public static void AddElementWithName(IGraphicsContainer graphicsContainer, IElement pElement,
                                              string elementName)
        {
            IElementProperties pElePro = pElement as IElementProperties;

            if (pElePro != null)
            {
                pElePro.Name = elementName;
            }

            graphicsContainer.AddElement(pElement, 0);
        }
Exemple #10
0
        //private double thickness = 1.0; //To be included in Element Properties
        //private double density = 1.0; //To be included in Element Properties

        public Quad4Th2(IElementProperties properties, Dictionary <int, INode> nodes)
        {
            Properties = properties;
            this.Nodes = nodes;
            ElementFreedomSignature[1] = new bool[] { true, false, false, false, false, false };
            ElementFreedomSignature[2] = new bool[] { true, false, false, false, false, false };
            ElementFreedomSignature[3] = new bool[] { true, false, false, false, false, false };
            ElementFreedomSignature[4] = new bool[] { true, false, false, false, false, false };
            DisplacementVector         = new double[4];
            A = properties.A;
            B = properties.B;
        }
Exemple #11
0
 public Hex8(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[3] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[4] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[5] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[6] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[7] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[8] = new bool[] { true, true, true, false, false, false };
 }
Exemple #12
0
        public ContactStS2D(IElementProperties properties, Dictionary <int, INode> nodes)
        {
            Properties = properties;
            this.Nodes = nodes;
            int amountOfNodes = Properties.SlaveSegmentPolynomialDegree + Properties.MasterSegmentPolynomialDegree + 2;

            for (int i = 1; i <= amountOfNodes; i++)
            {
                ElementFreedomSignature[i] = new bool[] { true, true, false, false, false, false };
            }
            DisplacementVector = new double[2 * amountOfNodes];
            PenaltyFactor      = properties.YoungMod * properties.PenaltyFactorRatio;
        }
Exemple #13
0
 public ContactNtN2DTh(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, false, false, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, false, false, false, false, false };
     DisplacementVector         = new double[2];
     ContactArea                = properties.SectionArea;
     ContactPressure            = properties.ContactForceValue / properties.SectionArea;
     SurfaceRoughness           = properties.SurfaceRoughness;
     ContactThermalConductivity = properties.ContactThermalConductivity;
     YieldStrength              = properties.YieldStrength;
 }
Exemple #14
0
 public ContactNtS3D(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[3] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[4] = new bool[] { true, true, true, false, false, false };
     ElementFreedomSignature[5] = new bool[] { true, true, true, false, false, false };
     DisplacementVector         = new double[15];
     PenaltyFactor = properties.YoungMod * 0.10;
     lastKsiVector = new double[2];
 }
Exemple #15
0
        //private double thickness = 1.0; //To be included in Element Properties
        //private double density = 1.0; //To be included in Element Properties

        public Quad8(IElementProperties properties, Dictionary <int, INode> nodes)
        {
            Properties = properties;
            this.Nodes = nodes;
            ElementFreedomSignature[1] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[2] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[3] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[4] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[5] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[6] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[7] = new bool[] { true, true, false, false, false, false };
            ElementFreedomSignature[8] = new bool[] { true, true, false, false, false, false };
            DisplacementVector         = new double[16];
        }
Exemple #16
0
 public ContactNtS2Df(IElementProperties properties, Dictionary <int, INode> nodes)
 {
     Properties = properties;
     this.Nodes = nodes;
     ElementFreedomSignature[1] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[2] = new bool[] { true, true, false, false, false, false };
     ElementFreedomSignature[3] = new bool[] { true, true, false, false, false, false };
     DisplacementVector         = new double[6];
     PenaltyFactor        = properties.YoungMod * 10.0;
     TangentPenaltyFactor = properties.YoungMod * 10.0;
     counter      = 1;
     mhid         = 0.2;
     FrictionCoef = 0.2;
 }
Exemple #17
0
        /// <summary>
        /// Adds a point
        /// </summary>
        /// <param name="x">The X Coordinate</param>
        /// <param name="y">The y Coordinate</param>
        /// <param name="coordinateSystem">The coordinate system.</param>
        /// <param name="description">The description.</param>
        /// <param name="minX">The extent min X.</param>
        /// <param name="minY">The extent min Y.</param>
        /// <param name="maxX">The extent max X.</param>
        /// <param name="maxY">The extent max Y.</param>
        private void AddPoint(Double x, Double y, int coordinateSystem, String description, Double minX, Double minY, Double maxX, Double maxY)
        {
            try
            {
                //get mapdocument
                IMxDocument mxDocument = ArcMap.Application.Document as IMxDocument;
                //get map
                IMap map = mxDocument.FocusMap;
                //get the active view
                IActiveView activeView = mxDocument.ActiveView;

                //get the point from the matched record
                ESRI.ArcGIS.Geometry.Point point = CreatePoint(x, y, coordinateSystem, map.SpatialReference);

                //create a simple marker and set attributes
                ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
                simpleMarkerSymbol.Size  = 10;
                simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond;
                IRgbColor color = new RgbColorClass();
                color.Red   = Color.Blue.R;
                color.Green = Color.Blue.G;
                color.Blue  = Color.Blue.B;
                simpleMarkerSymbol.Color = color;

                //Create the Grapthics Element
                IMarkerElement markerElement = new MarkerElementClass();
                markerElement.Symbol = simpleMarkerSymbol as IMarkerSymbol;
                IElement markerElementAsElement = markerElement as IElement;
                markerElementAsElement.Geometry = point;
                IElementProperties markerElementAsElementProperties = markerElement as IElementProperties;
                markerElementAsElementProperties.Name = LOCATOR_ELEMENT_NAME;

                //Add the Element to the view
                IGraphicsContainer graphicsContainer = map as IGraphicsContainer;
                graphicsContainer.AddElement(markerElementAsElement as IElement, 0);
                markerElementAsElement.Activate(activeView.ScreenDisplay);
                activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

                //Add the callout box
                AddCallout(point, description);

                //move to location
                MoveToLocation(point, map, coordinateSystem, minX, minY, maxX, maxY);
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }
Exemple #18
0
        private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
        {
            //If left mouse button then zoom in
            if (e.button == 1)
            {
                m_MapControl.Extent = m_MapControl.TrackRectangle();
            }
            else
            {
                //Create a point and get the IPoint interface
                IPoint point = new PointClass();
                //Set points coordinates
                point.PutCoords(e.mapX, e.mapY);

                //QI for ITopologicalOperator interface through IPoint interface
                ITopologicalOperator topologicalOperator = (ITopologicalOperator)point;
                //Create a polygon by buffering the point and get the IPolygon interface
                IPolygon polygon = (IPolygon)topologicalOperator.Buffer(m_MapControl.Extent.Width * 0.02);
                //QI for IRelationalOperator interface through IPolygon interface
                IRelationalOperator relationalOperator = (IRelationalOperator)polygon;

                object o = null;
                //Draw the polygon
                m_MapControl.DrawShape(polygon, ref o);

                //Loop through the elements in the GraphicContainer and get the IElement interface
                m_GraphicsContainer.Reset();
                IElement element = m_GraphicsContainer.Next();
                while (element != null)
                {
                    //If the polygon contains the point
                    if (relationalOperator.Contains(element.Geometry) == true)
                    {
                        //QI for IMarkerElement interface through IElement interface
                        IMarkerElement markerElement = (IMarkerElement)element;
                        markerElement.Symbol = GetMarkerSymbol(true);
                        //QI for the IElementProperties interface through IElement interface
                        IElementProperties elementProperties = (IElementProperties)element;
                        elementProperties.Name = true.ToString();
                    }
                    element = m_GraphicsContainer.Next();
                }
                if (chkTracking.CheckState == CheckState.Unchecked)
                {
                    //Refresh the graphics
                    m_MapControl.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, Type.Missing);
                }
            }
        }
Exemple #19
0
 private void SetMapFrameClassifyProcess(IMapFrame pMapFrame, ref IMapFrame pMapFrameMain)
 {
     try
     {
         if (pMapFrame != null)
         {
             IElementProperties properties = null;
             properties      = pMapFrame as IElementProperties;
             properties.Name = pMapFrame.Map.Name;
             if (pMapFrameMain != null)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (pMapFrame.Map.Name.IndexOf("鹰眼") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (pMapFrame.Map.Name.IndexOf("OV") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (pMapFrame.Map.Name.IndexOf("Overview") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (properties.Name.IndexOf("鹰眼") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (properties.Name.IndexOf("OV") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else if (properties.Name.IndexOf("Overview") >= 0)
             {
                 properties.CustomProperty = "00_OverviewMap";
             }
             else
             {
                 pMapFrameMain             = pMapFrame;
                 properties.CustomProperty = "00_MainMap";
             }
         }
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "SetMapFrameClassifyProcess", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
     }
 }
        private ListViewItem[] AddProperties(Dictionary <string, string> properties, ListViewGroup listViewGroup)
        {
            List <ListViewItem> items = new List <ListViewItem>();

            IElementProperties elementProperties = (IElementProperties)this.listView.Tag;

            foreach (KeyValuePair <string, string> pair in properties)
            {
                ListViewItem item = new ListViewItem(new string[] { ControlKeysManager.GetDisplayString(pair.Key, elementProperties.ControlTypeString), pair.Value }, listViewGroup);
                item.Tag = pair;
                items.Add(item);
            }

            return(items.ToArray());
        }
        public MapGraphicTrackExtension()
        {
            ILineElement traceElement = new LineElementClass();

            SetDefaultSymbol(traceElement);
            //add a tag to the trace line
            IElementProperties elemProps = (IElementProperties)traceElement;

            elemProps.Name = "{E63706E1-B13C-4184-8AB8-97F67FA052D4}";
            bool showTrace = true;

            propSet = new PropertySetClass();
            propSet.SetProperty("Line Element", traceElement);
            propSet.SetProperty("Show Trace", showTrace);
            persist = (IPersistStream)propSet;
        }
Exemple #22
0
        private bool method_8()
        {
            bool flag = false;

            try
            {
                IGraphicsContainer graphicsContainer = base.m_pActiveView.GraphicsContainer;
                graphicsContainer.Reset();
                IElement  element  = graphicsContainer.Next();
                IEnvelope envelope = null;
                while (element != null)
                {
                    IElementProperties properties = (IElementProperties)element;
                    if (properties.Name == "TK")
                    {
                        goto Label_005D;
                    }
                    if (element is IMapFrame)
                    {
                        goto Label_009D;
                    }
                    element = graphicsContainer.Next();
                }
                return(flag);

Label_005D:
                envelope      = element.Geometry.Envelope;
                base.LeftLow  = envelope.LowerLeft;
                base.LeftUp   = envelope.UpperLeft;
                base.RightLow = envelope.LowerRight;
                base.RightUp  = envelope.UpperRight;
                return(true);

Label_009D:
                envelope      = element.Geometry.Envelope;
                base.LeftLow  = envelope.LowerLeft;
                base.LeftUp   = envelope.UpperLeft;
                base.RightLow = envelope.LowerRight;
                base.RightUp  = envelope.UpperRight;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        private void AddPropertySet(IElement elem)
        {
            if (elem == null)
            {
                return;                                         //invalidate parameter
            }
            IElementProperties prop = (IElementProperties)elem; //record the old properties
            IPropertySet       propSet;

            if (prop.CustomProperty == null)
            {
                propSet = new PropertySetClass();
                propSet.SetProperty("Envelope", null);
                propSet.SetProperty("Angle", 0.0);
                prop.CustomProperty = propSet;
            }
        }
Exemple #24
0
 public void SetMapFrameMainMap(IPageLayout pPageLayout, IMap pMap, bool bClearElements)
 {
     try
     {
         if ((pPageLayout != null) && (pMap != null))
         {
             IActiveView view = null;
             view = pPageLayout as IActiveView;
             if (view != null)
             {
                 IGraphicsContainer graphicsContainer = null;
                 graphicsContainer = view.GraphicsContainer;
                 if (graphicsContainer != null)
                 {
                     graphicsContainer.Reset();
                     IMapFrame frame   = null;
                     IElement  element = null;
                     for (element = graphicsContainer.Next(); element != null; element = graphicsContainer.Next())
                     {
                         if (element is IMapFrame)
                         {
                             frame = element as IMapFrame;
                             IElementProperties properties = null;
                             properties = frame as IElementProperties;
                             if (Strings.LCase(Strings.Mid(Convert.ToString(properties.CustomProperty), 4)) == Strings.LCase("MainMap"))
                             {
                                 IMap pTargetMap = frame.Map;
                                 GISFunFactory.CoreFun.SyncMapObject(pMap, ref pTargetMap, bClearElements);
                                 frame.Map = pTargetMap;
                             }
                         }
                         else if (element is IGroupElement)
                         {
                             this.SetMapFrameMapGroupRecursion(element as IGroupElement, "MainMap", pMap, bClearElements);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "SetMapFrameMainMap", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
     }
 }
Exemple #25
0
 private IMapFrame GetMapFrameGroupRecursion(IGroupElement pGroupElement, string sMapClassifyName, string sMapName)
 {
     try
     {
         if (pGroupElement != null)
         {
             if (pGroupElement.ElementCount <= 0)
             {
                 return(null);
             }
             IEnumElement elements = null;
             elements = pGroupElement.Elements;
             elements.Reset();
             IMapFrame frame    = null;
             IElement  element2 = null;
             for (element2 = elements.Next(); element2 != null; element2 = elements.Next())
             {
                 if (element2 is IMapFrame)
                 {
                     frame = element2 as IMapFrame;
                     IElementProperties properties = null;
                     properties = frame as IElementProperties;
                     if ((Strings.LCase(Strings.Mid(Convert.ToString(properties.CustomProperty), 4)) == Strings.LCase(sMapClassifyName)) && (string.IsNullOrEmpty(sMapName) | (frame.Map.Name == sMapName)))
                     {
                         return(frame);
                     }
                 }
                 else if (element2 is IGroupElement)
                 {
                     frame = this.GetMapFrameGroupRecursion(element2 as IGroupElement, sMapClassifyName, sMapName);
                     if (frame != null)
                     {
                         return(frame);
                     }
                 }
             }
         }
         return(null);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "GetMapFrameGroupRecursion", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }
Exemple #26
0
        /// <summary>
        /// 给多边形添加注记
        /// </summary>
        /// <param name="pGeometry"></param>
        /// <param name="pTextSymbol"></param>
        /// <param name="key"></param>
        public void AddTextElement(IGeometry pGeometry, ITextElement pTextElement, string key)
        {
            IActiveView        pActiveView        = mapControl.ActiveView;
            IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
            IEnvelope          envelope           = new EnvelopeClass();

            envelope = pGeometry.Envelope;
            IPoint pPoint = new PointClass();

            pPoint.PutCoords(envelope.XMin + envelope.Width * 0.5, envelope.YMin + envelope.Height * 0.5);
            IElement pElement = pTextElement as IElement;

            pElement.Geometry = pPoint;
            IElementProperties pElmentProperties = pElement as IElementProperties;

            pElmentProperties.Name = key;
            pGraphicsContainer.AddElement(pElement, 0);
        }
Exemple #27
0
 private void DelectElementByName(IGraphicsContainer graphicsContainer, string sElementName)
 {
     try
     {
         IElementProperties pElementProperties = graphicsContainer.Next() as IElementProperties;
         while (pElementProperties != null)
         {
             if (pElementProperties.Name == sElementName)
             {
                 graphicsContainer.DeleteElement(pElementProperties as IElement);
             }
             pElementProperties = graphicsContainer.Next() as IElementProperties;
         }
     }
     catch (Exception)
     {
     }
 }
        /// <summary>
        /// return the selfCondition
        /// </summary>
        /// <param name="treeView"></param>
        /// <returns></returns>
        private TestObjectNurse GetNurseObjectsLine(TreeView treeView)
        {
            TreeNode fromNode = treeView.Nodes[0];

            IElementProperties properties = (IElementProperties)fromNode.Tag;

            TestObjectNurse topNurseNode     = properties.ToNurseObject();
            TestObjectNurse currentNurseNode = topNurseNode;

            PreGetNurseObjectsLine(properties);

            while (fromNode != null)
            {
                switch (fromNode.Nodes.Count)
                {
                case 0:
                    fromNode = null;
                    break;

                case 1:
                    fromNode = fromNode.Nodes[0];
                    break;

                default:
                    fromNode = fromNode.Nodes["self"];
                    break;
                }

                //need refactoring
                if (fromNode != null && (fromNode.Checked))
                {
                    properties = (IElementProperties)fromNode.Tag;
                    TestObjectNurse childNurseNode = properties.ToNurseObject();
                    bool            need2Add       = PreGetNurseObjectsLine((IElementProperties)fromNode.Tag);
                    if (need2Add || fromNode.IsSelected)
                    {
                        currentNurseNode.AddChild(childNurseNode);
                        currentNurseNode = childNurseNode;
                    }
                }
            }

            return(currentNurseNode);
        }
Exemple #29
0
        /// <summary>
        /// 找指定名称的Element
        /// </summary>
        /// <param name="pGC"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IElement GetElementByName(IGraphicsContainer3D pGC, string name)
        {
            IElement           result     = null;
            IElement           pElement   = null;
            IElementProperties pElemProps = null;

            pGC.Reset();
            pElement = pGC.Next();
            while (pElement != null)
            {
                pElemProps = (IElementProperties)pElement;
                if (pElemProps.Name == name)
                {
                    result = pElement;
                }
                pElement = pGC.Next();
            }
            return(result);
        }
        /// <summary>
        /// 在屏幕中添加标记元素
        /// </summary>
        /// <param name="n"></param>
        private void drawElement(ExceptionsInfo n)
        {
            IFeature     pFeature;
            IQueryFilter pQFilter = new QueryFilter();

            pQFilter.WhereClause = "\"projectName\"='" + n.ProjectID + "'";
            IFeatureLayer      pFlayer        = LayerHelper.getFeatureLayerFromMap(axMapControl1.Map, "Cities"); //获取特定图层
            IFeatureCursor     pFtCursor      = pFlayer.Search(pQFilter, true);                                  //查找对应结果的要素
            IRgbColor          pColor1        = setRGBColor(255, 0, 0, 255);
            IRgbColor          pColor2        = setRGBColor(0, 255, 0, 255);
            IElement           ele            = createElement(pColor1, pColor2);
            IElementProperties pEleProperties = (IElementProperties)ele;

            pEleProperties.Name = n.ProjectID;                                                //设置element的Name属性方便查找
            IGraphicsContainer pGContainer = axMapControl1.Map as IGraphicsContainer;
            IActiveView        pView       = pGContainer as IActiveView;

            while ((pFeature = pFtCursor.NextFeature()) != null)
            {
                IPoint       pPoint = pFeature.Shape as IPoint;
                IElement     pEleTemp;
                IEnumElement pEnumEle = queryElementOnMap(pPoint, 0);
                if (pEnumEle != null)                                           //检查地图中是否已存在此元素
                {
                    while ((pEleTemp = pEnumEle.Next()) != null)
                    {
                        IElementProperties pEleProTemp = (IElementProperties)pEleTemp;
                        if (pEleProTemp.Name == n.ProjectID)
                        {
                            return;
                        }
                        //if (!pEleProTemp.Name.Contains(n.ProjectID))
                        //{
                        //    pEleProTemp.Name += "," + n.ProjectID;
                        //    pGContainer.UpdateElement((IElement)pEleProTemp);
                        //    return;
                        //}
                    }
                }
                ele.Geometry = pPoint;
                pGContainer.AddElement(ele, 0);
            }
        }