示例#1
0
        private void convertColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IColor pColor = GetRGB(Color.Black);

            if (colorDlg.ShowDialog() == DialogResult.OK)
            {
                pColor = GetRGB(colorDlg.Color);
            }

            IMap        mmap        = axMapControl1.Map;
            IActiveView pActiveView = mmap as IActiveView;

            IGeometry pLine = axMapControl1.TrackLine();

            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();

            pLineSymbol.Color = pColor;
            pLineSymbol.Width = 2;
            pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;

            IElement element = new LineElementClass();

            element.Geometry = pLine;
            ILineElement pLineElement = element as ILineElement;

            pLineElement.Symbol = pLineSymbol;

            IGraphicsContainer ppGraphicsContainer = mmap as IGraphicsContainer;

            ppGraphicsContainer.AddElement(pLineElement as IElement, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#2
0
        private IElement CreateVLine(IPoint pt)
        {
            IPoint pointClass = new Point()
            {
                X = pt.X,
                Y = pt.Y
            };
            IPoint point       = pointClass;
            IPoint pointClass1 = new Point()
            {
                X = pt.X,
                Y = pt.Y + this.Height
            };
            IPoint    point1        = pointClass1;
            IPolyline polylineClass = new Polyline() as IPolyline;
            object    value         = Missing.Value;

            (polylineClass as IPointCollection).AddPoint(point, ref value, ref value);
            (polylineClass as IPointCollection).AddPoint(point1, ref value, ref value);
            ILineElement element = new LineElement() as ILineElement;

            ((IElement)element).Geometry = polylineClass;
            element.Symbol = this.LineSymbol;
            ILineElement lineElementClass = element as ILineElement;

            return(lineElementClass as IElement);
        }
示例#3
0
        private void iRandomColorRampToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IMap        mmap        = axMapControl1.Map;
            IActiveView pActiveView = mmap as IActiveView;

            IGeometry pLine = axMapControl1.TrackLine();

            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();

            IEnumColors pEnumColors = CreateRdmColorRamp(140, 220, 35, 100, 32, 80, 12, 7);
            IColor      pColor      = pEnumColors.Next();

            pLineSymbol.Color = pColor;
            pLineSymbol.Width = 2;
            pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;

            IElement element = new LineElementClass();

            element.Geometry = pLine;
            ILineElement pLineElement = element as ILineElement;

            pLineElement.Symbol = pLineSymbol;

            IGraphicsContainer ppGraphicsContainer = mmap as IGraphicsContainer;

            ppGraphicsContainer.AddElement(pLineElement as IElement, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#4
0
        /// <summary>
        /// 在三维场景中由两点生成线的绘制   20110609
        /// </summary>
        /// <param name="Point1">前一个点要素</param>
        /// <param name="Point2">后一点要素</param>
        /// <param name="r"></param>
        /// <param name="g"></param>
        /// <param name="b"></param>
        /// <param name="Width">线符号宽</param>
        /// <returns></returns>
        public static IElement PointToPolyline(IPoint Point1, IPoint Point2, int r, int g, int b, double Width)
        {
            ILine line = new LineClass();

            line.PutCoords(Point1, Point2);
            object             missing = Type.Missing;
            ISegmentCollection segColl = new PolylineClass();

            segColl.AddSegment(line as ISegment, ref missing, ref missing);
            IPolyline pPolyline = new PolylineClass();

            pPolyline = segColl as IPolyline;
            IZAware pZAware = new PolylineClass();

            pZAware = pPolyline as IZAware;

            pZAware.ZAware = true;

            IElement            lineElement         = new LineElementClass();
            ISimpleLine3DSymbol pSimpleLine3DSymbol = new SimpleLine3DSymbolClass();

            pSimpleLine3DSymbol.Style             = esriSimple3DLineStyle.esriS3DLSWall;
            pSimpleLine3DSymbol.ResolutionQuality = 1;
            ILineSymbol pLineSymbol = pSimpleLine3DSymbol as ILineSymbol;

            pLineSymbol.Color    = getRGB(r, g, b);
            pLineSymbol.Width    = Width;
            lineElement.Geometry = pZAware as IGeometry;
            ILineElement lineElement2 = lineElement as ILineElement;

            lineElement2.Symbol = pLineSymbol;
            return(lineElement);
        }
        private void SetDefaultSymbol(ILineElement elem)
        {
            ILineSymbol          defaultLineSym = null;
            String               esriStylePath;
            IStyleGallery        styleGallery = new StyleGalleryClass();
            IStyleGalleryStorage styleStor    = (IStyleGalleryStorage)styleGallery;

            esriStylePath = styleStor.DefaultStylePath + "ESRI.style";

            IEnumStyleGalleryItem styleItems = styleGallery.get_Items("Line Symbols", esriStylePath, "Dashed");

            styleItems.Reset();
            IStyleGalleryItem styleGalleryItem = styleItems.Next();

            while (!(styleGalleryItem == null))
            {
                if (styleGalleryItem.Name == "Dashed 4:4")
                {
                    defaultLineSym       = (ILineSymbol)styleGalleryItem.Item;
                    defaultLineSym.Width = 1.50;
                    IRgbColor rgbColor = new RgbColorClass();
                    rgbColor.Red          = 255;
                    rgbColor.Blue         = 0;
                    rgbColor.Green        = 0;
                    rgbColor.Transparency = 50;
                    defaultLineSym.Color  = rgbColor;
                    break;
                }
                else
                {
                    styleGalleryItem = styleItems.Next();
                }
            }
            elem.Symbol = defaultLineSym;
        }
 public frmCreateGraphicTrackOptions()
 {
     InitializeComponent();
     createTrackOptions = new CreateGraphicTrackOptions();
     lineFeature = null;
     lineGraphic = null;
     pointGraphic = null;
 }
 public frmCreateGraphicTrackOptions()
 {
     InitializeComponent();
     createTrackOptions = new CreateGraphicTrackOptions();
     lineFeature        = null;
     lineGraphic        = null;
     pointGraphic       = null;
 }
示例#8
0
        /// <summary>
        /// 根据输入的要素在SceneControl中绘制元素     张琪   20110621
        /// </summary>
        /// <param name="pSceneControl"></param>
        /// <param name="pGeom">几何要素</param>
        /// <param name="pSym"></param>
        public void AddGraphic(ISceneControl pSceneControl, IGeometry pGeom, ISymbol pSym)
        {
            if (pGeom == null)
            {
                return;
            }
            IElement pElement = null;

            switch (pGeom.GeometryType.ToString())
            {
            case "esriGeometryPoint":    //点要素
                pElement = new MarkerElementClass();
                IMarkerElement pPointElement = pElement as IMarkerElement;
                if (pSym != null)
                {
                    IMarkerSymbol pMarker3DSymbol = pSym as IMarkerSymbol;
                    pPointElement.Symbol = pMarker3DSymbol as IMarkerSymbol;
                }
                break;

            case "esriGeometryPolyline":    //线要素
                pElement = new LineElementClass();
                ILineElement pLineElement = pElement as ILineElement;
                if (pSym != null)
                {
                    ILineSymbol pLineSymbol = pSym as ILineSymbol;
                    pLineElement.Symbol = pLineSymbol;
                }
                break;

            case "esriGeometryPolygon":    //面要素
                pElement = new PolygonElementClass();
                IFillShapeElement pFillElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pFillElement.Symbol = pFillSymbol;
                }
                break;

            case "esriGeometryMultiPatch":    //多面体要素
                pElement = new MultiPatchElementClass();
                IFillShapeElement pMultiPatchElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pMultiPatchElement.Symbol = pFillSymbol as IFillSymbol;
                }
                break;
            }
            pElement.Geometry = pGeom;
            IGraphicsContainer3D pGCon3D = pSceneControl.Scene.BasicGraphicsLayer as IGraphicsContainer3D;

            pGCon3D.AddElement(pElement);//在SceneControl中绘制要素
            IGraphicsSelection pGS = pGCon3D as IGraphicsSelection;

            pSceneControl.Scene.SceneGraph.RefreshViewers();
        }
示例#9
0
        private void DrawLineOnActiveView(List <int> lstIndices, double[][] arrValue, IActiveView pActiveView)
        {
            try
            {
                int intLstCnt = lstIndices.Count;

                IGraphicsContainer pGraphicContainer = pActiveView.GraphicsContainer;
                pGraphicContainer.DeleteAllElements();

                IRgbColor pRgbColor = m_pSnippet.getRGB(0, 255, 255);
                //IRgbColor pRgbColor = new RgbColorClass();
                //pRgbColor.Red = 0;
                //pRgbColor.Green = 255;
                //pRgbColor.Blue = 255;
                //pRgbColor.Transparency = 255;


                ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                pSimpleLineSymbol.Width = 2;
                pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                pSimpleLineSymbol.Color = pRgbColor;



                for (int i = 0; i < intLstCnt; i++)
                {
                    int      intIdx      = lstIndices[i];
                    double[] arrSelValue = arrValue[intIdx];
                    //drawing a polyline
                    IPoint FromP = new PointClass();
                    FromP.X = arrSelValue[0]; FromP.Y = arrSelValue[1];

                    IPoint ToP = new PointClass();
                    ToP.X = arrSelValue[2]; ToP.Y = arrSelValue[3];

                    IPolyline        polyline  = new PolylineClass();
                    IPointCollection pointColl = polyline as IPointCollection;
                    pointColl.AddPoint(FromP);
                    pointColl.AddPoint(ToP);

                    IElement     pElement     = new LineElementClass();
                    ILineElement pLineElement = (ILineElement)pElement;
                    pLineElement.Symbol = pSimpleLineSymbol;
                    pElement.Geometry   = polyline;

                    pGraphicContainer.AddElement(pElement, 0);
                }

                pActiveView.Refresh();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
示例#10
0
        private IElement LineElementRenderer(IGeometry geo, IRgbColor color)
        {
            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbol();

            pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            pLineSymbol.Width = 5;
            pLineSymbol.Color = color;
            IElement element = new LineElement();

            element.Geometry = geo;
            ILineElement pLineElement = element as ILineElement;

            pLineElement.Symbol = pLineSymbol;
            return(element);
        }
示例#11
0
        private void DrawLineOnActiveView(int intFromLinkID, List <int> arrToLinks, double[,] arrXYCoord, IActiveView pActiveView)
        {
            try
            {
                IGraphicsContainer pGraphicContainer = pActiveView.GraphicsContainer;
                //pGraphicContainer.DeleteAllElements();

                IRgbColor pRgbColor = m_pSnippet.getRGB(0, 255, 255);

                ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                pSimpleLineSymbol.Width = 2;
                pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                pSimpleLineSymbol.Color = pRgbColor;
                int intFromIdx = intFromLinkID;
                ESRI.ArcGIS.Geometry.IPoint FromP = new PointClass();
                FromP.X = arrXYCoord[intFromIdx, 0]; FromP.Y = arrXYCoord[intFromIdx, 1];

                int intArrLengthCnt = arrToLinks.Count;
                for (int i = 0; i < intArrLengthCnt; i++)
                {
                    int intToIdx = arrToLinks[i] - 1;

                    ESRI.ArcGIS.Geometry.IPoint ToP = new PointClass();
                    ToP.X = arrXYCoord[intToIdx, 0]; ToP.Y = arrXYCoord[intToIdx, 1];

                    IPolyline        polyline  = new PolylineClass();
                    IPointCollection pointColl = polyline as IPointCollection;
                    pointColl.AddPoint(FromP);
                    pointColl.AddPoint(ToP);

                    IElement     pElement     = new LineElementClass();
                    ILineElement pLineElement = (ILineElement)pElement;
                    pLineElement.Symbol = pSimpleLineSymbol;
                    pElement.Geometry   = polyline;

                    pGraphicContainer.AddElement(pElement, 0);
                }

                pActiveView.Refresh();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
示例#12
0
        public override void DrawInsideFrame()
        {
            IElement            item       = new LineElementClass();
            IElementProperties2 properties = null;
            ILineElement        element2   = null;
            ILineSymbol         symbol     = null;
            IPolyline           polyline   = new PolylineClass();
            IPointCollection    points     = polyline as IPointCollection;
            object missing = System.Type.Missing;

            try
            {
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    points.AddPoint(base.LeftUp, ref missing, ref missing);
                }
                if (!((base.LeftLow == null) || base.LeftLow.IsEmpty))
                {
                    points.AddPoint(base.LeftLow, ref missing, ref missing);
                }
                if (!((base.RightLow == null) || base.RightLow.IsEmpty))
                {
                    points.AddPoint(base.RightLow, ref missing, ref missing);
                }
                if (!((base.RightUp == null) || base.RightUp.IsEmpty))
                {
                    points.AddPoint(base.RightUp, ref missing, ref missing);
                }
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    points.AddPoint(base.LeftUp, ref missing, ref missing);
                }
                item.Geometry   = polyline;
                properties      = item as IElementProperties2;
                properties.Type = "内框";
                symbol          = this.method_5(1);
                element2        = item as ILineElement;
                element2.Symbol = symbol;
                this.ilist_0.Add(item);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
示例#13
0
        public void DisplaySymbol()
        {
            IGraphicsLayer layer;

            if (this.axSceneControl1.SceneGraph.Scene.LayerCount == 0)
            {
                layer = new GraphicsLayer3DClass();
                this.axSceneControl1.SceneGraph.Scene.AddLayer(layer as ILayer, false);
            }
            else
            {
                layer = this.axSceneControl1.SceneGraph.Scene.get_Layer(0) as IGraphicsLayer;
            }
            IGraphicsContainer3D containerd = layer as IGraphicsContainer3D;

            containerd.DeleteAllElements();
            if (this.m_pSimpleLine3DSymbol != null)
            {
                IPoint           inPoint = new PointClass();
                IPointCollection points  = new PolylineClass();
                (points as IZAware).ZAware = true;
                IZAware aware = inPoint as IZAware;
                aware.ZAware = true;
                inPoint.X    = 0.0;
                inPoint.Y    = 0.0;
                inPoint.Z    = 0.0;
                object before = Missing.Value;
                points.AddPoint(inPoint, ref before, ref before);
                inPoint      = new PointClass();
                aware        = inPoint as IZAware;
                aware.ZAware = true;
                inPoint.X    = 1.0;
                inPoint.Y    = 0.0;
                inPoint.Z    = 0.0;
                points.AddPoint(inPoint, ref before, ref before);
                IElement     element  = new LineElementClass();
                ILineElement element2 = element as ILineElement;
                element2.Symbol  = this.m_pSimpleLine3DSymbol as ILineSymbol;
                element.Geometry = points as IGeometry;
                containerd.AddElement(element);
            }
            this.axSceneControl1.SceneGraph.RefreshViewers();
        }
示例#14
0
        //The function is under reviewing.
        private void DrawLineOnActiveView(double dblFromLink, double[] arrToLinks, double[,] arrXYCoord, IActiveView pActiveView)
        {
            IGraphicsContainer pGraphicContainer = pActiveView.GraphicsContainer;

            pGraphicContainer.DeleteAllElements();

            IRgbColor pRgbColor = m_pSnippet.getRGB(0, 255, 255);

            ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();

            pSimpleLineSymbol.Width = 2;
            pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            pSimpleLineSymbol.Color = pRgbColor;
            int    intFromIdx = Convert.ToInt32(dblFromLink) - 1;
            IPoint FromP      = new PointClass();

            FromP.X = arrXYCoord[intFromIdx, 0]; FromP.Y = arrXYCoord[intFromIdx, 1];

            int intArrLengthCnt = arrToLinks.Length;

            for (int i = 0; i < intArrLengthCnt; i++)
            {
                int intToIdx = Convert.ToInt32(arrToLinks[i]) - 1;

                IPoint ToP = new PointClass();
                ToP.X = arrXYCoord[intToIdx, 0]; ToP.Y = arrXYCoord[intToIdx, 1];

                IPolyline        polyline  = new PolylineClass();
                IPointCollection pointColl = polyline as IPointCollection;
                pointColl.AddPoint(FromP);
                pointColl.AddPoint(ToP);

                IElement     pElement     = new LineElementClass();
                ILineElement pLineElement = (ILineElement)pElement;
                pLineElement.Symbol = pSimpleLineSymbol;
                pElement.Geometry   = polyline;

                pGraphicContainer.AddElement(pElement, 0);
            }

            pActiveView.Refresh();
        }
示例#15
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            IMxDocument pmxdoc    = ArcMap.Application.Document as IMxDocument;
            IRubberBand pRubber   = new RubberLine();
            IPolyline   pPolyline = pRubber.TrackNew(pmxdoc.ActiveView.ScreenDisplay, null) as IPolyline;

            IElement     pElement     = new LineElement();
            ILineElement pLineElement = pElement as ILineElement;

            pLineElement.Symbol = new SimpleLineSymbol();
            pElement.Geometry   = pPolyline;

            IElementProperties pElementProp = pElement as IElementProperties;

            pElementProp.Name = "Hussein Element " + ++i;

            IGraphicsContainer pgc = pmxdoc.ActiveView.GraphicsContainer;

            pgc.AddElement(pElement, 0);
            pmxdoc.ActiveView.Refresh();
        }
示例#16
0
        private void axSceneControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ISceneControlEvents_OnMouseDownEvent e)
        {
            IPoint pPoint    = null;
            object objOwner  = null;
            object objObject = null;

            axSceneControl1.SceneGraph.Locate(axSceneControl1.SceneViewer, e.x, e.y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out objOwner, out objObject);


            ITextElement pTextElement = new TextElementClass();

            pTextElement.Text = "dddddd";

            IGraphicsContainer3D pGCon3D       = axSceneControl1.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
            IElement             pElement      = new MarkerElementClass();
            IMarkerElement       pPointElement = pElement as MarkerElementClass;
            ILineElement         pLineElement  = pElement as ILineElement;
            ISimpleLineSymbol    pLSymbol      = new SimpleLineSymbolClass();
            ISimpleMarkerSymbol  pMSym         = new SimpleMarkerSymbolClass();
            IColor    pFromColor = new RgbColorClass();
            IRgbColor pRgbColor  = pFromColor as IRgbColor;

            pRgbColor.Red        = 255;
            pRgbColor.Green      = 0;
            pRgbColor.Blue       = 0;
            pMSym.Size           = 10;
            pMSym.Color          = pFromColor;
            pMSym.Style          = esriSimpleMarkerStyle.esriSMSDiamond;
            pPointElement.Symbol = pMSym;
            pLSymbol.Style       = esriSimpleLineStyle.esriSLSSolid;
            pElement.Geometry    = pPoint;


            pGCon3D.AddElement(pElement as IElement);
            axSceneControl1.Scene.SceneGraph.RefreshViewers();
            IDisplay3D pIDisplay3D = axSceneControl1.Scene.SceneGraph as IDisplay3D;

            pIDisplay3D.FlashLocation(pPoint);
        }
		// Sets line color, width and style
		private void SetLineProperties(IElement objElement)
		{
			SimpleLineSymbol objSymbol = null;
			objSymbol = new SimpleLineSymbolClass();

			// Set Symbol style and width
			objSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
			objSymbol.Width = 10;

			// Set symbol color
			RgbColor objColor = null;
			objColor = new RgbColorClass();
			objColor.Red = 0;
			objColor.Green = 255;
			objColor.Blue = 0;

			objSymbol.Color = objColor;

			// set line symbol
			ILineElement objLineElement = objElement as ILineElement;
			objLineElement.Symbol = objSymbol as ILineSymbol;
		}
示例#18
0
        private static IElement CreateLineElement(IActiveView pActiveView, IGeometry pGeo)
        {
            IRgbColor color = new RgbColorClass();

            color.Blue  = 0xff;
            color.Green = 0;
            color.Red   = 0xc5;
            IColor            color2 = color;
            ISimpleLineSymbol symbol = new SimpleLineSymbolClass();

            symbol.Style = esriSimpleLineStyle.esriSLSSolid;
            symbol.Color = color2;
            symbol.Width = 2.0;
            pGeo         = ErrManager.ConvertPoject(pGeo, pActiveView.FocusMap.SpatialReference);
            IElement element = new LineElementClass();

            element.Geometry = pGeo;
            ILineElement element2 = element as ILineElement;

            element2.Symbol = symbol;
            return(element);
        }
示例#19
0
        /// <summary>
        /// 三维场景中绘制线要素  20110609
        /// </summary>
        /// <param name="pGeometry">线要素</param>
        /// <param name="r"></param>
        /// <param name="g"></param>
        /// <param name="b"></param>
        /// <param name="Width">线符号宽</param>
        /// <returns></returns>
        public static IElement DrawPolylineZ(IGeometry pGeometry, int r, int g, int b, double Width)
        {
            IPolyline pPolyline = (IPolyline)pGeometry;
            IZAware   pZAware   = new PolylineClass();

            pZAware = pPolyline as IZAware;
            //ISimpleLine3DSymbol pSimpleLine3DSymbol = new SimpleLine3DSymbolClass();
            pZAware.ZAware = true;
            IElement            lineElement         = new LineElementClass();
            ISimpleLine3DSymbol pSimpleLine3DSymbol = new SimpleLine3DSymbolClass();

            pSimpleLine3DSymbol.Style             = esriSimple3DLineStyle.esriS3DLSWall;
            pSimpleLine3DSymbol.ResolutionQuality = 1;
            ILineSymbol pLineSymbol = pSimpleLine3DSymbol as ILineSymbol;

            pLineSymbol.Color    = getRGB(r, g, b);
            pLineSymbol.Width    = Width;
            lineElement.Geometry = pZAware as IGeometry;
            ILineElement lineElement2 = lineElement as ILineElement;

            lineElement2.Symbol = pLineSymbol;
            return(lineElement);
        }
示例#20
0
        private void CreateResultElements()
        {
            IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection;

            for (int i = 0; i < this._networkInfo.arrayList_1.Count; i++)
            {
                object   missing = Type.Missing;
                IFeature feature = (IFeature)this._networkInfo.arrayList_1[i];
                geometryCollection.AddGeometry(feature.ShapeCopy, ref missing, ref missing);
            }
            if (this._networkInfo.arrayList_1.Count > 0)
            {
                IRgbColor rgbColor = new RgbColor();
                rgbColor.Red   = (255);
                rgbColor.Green = (0);
                rgbColor.Blue  = (255);
                IGraphicsContainer graphicsContainer = (IGraphicsContainer)m_iApp.ActiveView;
                for (int j = 0; j < geometryCollection.GeometryCount; j++)
                {
                    ILineElement lineElement = new LineElement() as ILineElement;
                    IElement     element     = (IElement)lineElement;
                    element.Geometry = (geometryCollection.get_Geometry(j));
                    ILineElement      arg_F5_0 = lineElement;
                    ISimpleLineSymbol simpleLineSymbolClass = new SimpleLineSymbol();
                    simpleLineSymbolClass.Color = (rgbColor);
                    simpleLineSymbolClass.Width = (10.0);
                    simpleLineSymbolClass.Style = (0);
                    arg_F5_0.Symbol             = (simpleLineSymbolClass);
                    graphicsContainer.AddElement(element, 0);
                }
                IEnvelope envelope = ((IGeometry)geometryCollection).Envelope;
                envelope.Expand(1.2, 1.2, true);
                m_iApp.ActiveView.Extent = (envelope);
                m_iApp.ActiveView.Refresh();
            }
        }
        private void TracePath(IElement elem, IPoint new_pos, IAGAnimationContainer pContainer, IAGAnimationTrack pTrack, IAGKeyframe pKeyframe)
        {
            IAGAnimationTrackExtensions trackExtensions = (IAGAnimationTrackExtensions)(pTrack);
            IMapGraphicTrackExtension   graphicTrackExtension;

            if (trackExtensions.ExtensionCount == 0) //if there is no extension, add one
            {
                graphicTrackExtension = new MapGraphicTrackExtension();
                trackExtensions.AddExtension(graphicTrackExtension);
            }
            else
            {
                graphicTrackExtension = (IMapGraphicTrackExtension)trackExtensions.get_Extension(0);
            }

            ILineElement path = graphicTrackExtension.TraceElement;

            bool showTrace = graphicTrackExtension.ShowTrace;

            if (!showTrace)
            {
                if (CheckGraphicExistance((IElement)path, pContainer))
                {
                    RemoveGraphicFromDisplay((IElement)path, pContainer);
                }
                return;
            }

            //Add the path to the graphic container
            if (!CheckGraphicExistance((IElement)path, pContainer))
            {
                AddGraphicToDisplay((IElement)path, pContainer);
            }

            RecreateLineGeometry((IElement)path, pTrack, pKeyframe, new_pos);
        }
示例#22
0
        public void AddGraphic(IScene iscene_0, IGeometry igeometry_0, ISymbol isymbol_0, bool bool_1, bool bool_2, string string_0)
        {
            if (!igeometry_0.IsEmpty)
            {
                IGraphicsLayer   basicGraphicsLayer = iscene_0.BasicGraphicsLayer;
                IElement         element            = null;
                esriGeometryType geometryType       = igeometry_0.GeometryType;
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                {
                    element = new MarkerElement();
                    IMarkerElement markerElement = element as IMarkerElement;
                    if (isymbol_0 != null)
                    {
                        markerElement.Symbol = (isymbol_0 as IMarkerSymbol);
                    }
                    else
                    {
                        markerElement.Symbol = new SimpleMarkerSymbol();
                    }
                    break;
                }

                case esriGeometryType.esriGeometryMultipoint:
                    break;

                case esriGeometryType.esriGeometryPolyline:
                {
                    element = new LineElement();
                    ILineElement lineElement = element as ILineElement;
                    if (isymbol_0 != null)
                    {
                        lineElement.Symbol = (isymbol_0 as ILineSymbol);
                    }
                    else
                    {
                        lineElement.Symbol = new SimpleLineSymbol();
                    }
                    break;
                }

                case esriGeometryType.esriGeometryPolygon:
                {
                    element = new PolygonElement();
                    IFillShapeElement fillShapeElement = element as IFillShapeElement;
                    if (isymbol_0 != null)
                    {
                        fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                    }
                    else
                    {
                        fillShapeElement.Symbol = new SimpleFillSymbol();
                    }
                    break;
                }

                default:
                    if (geometryType == esriGeometryType.esriGeometryMultiPatch)
                    {
                        element = new MultiPatchElement();
                        IFillShapeElement fillShapeElement = element as IFillShapeElement;
                        if (isymbol_0 != null)
                        {
                            fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                        }
                        else
                        {
                            fillShapeElement.Symbol = new SimpleFillSymbol();
                        }
                    }
                    break;
                }
                if (element != null)
                {
                    element.Geometry = igeometry_0;
                    if (string_0.Length > 0)
                    {
                        IElementProperties elementProperties = element as IElementProperties;
                        elementProperties.Name = string_0;
                    }
                    IGraphicsContainer3D graphicsContainer3D = basicGraphicsLayer as IGraphicsContainer3D;
                    graphicsContainer3D.AddElement(element);
                    IGraphicsSelection graphicsSelection = graphicsContainer3D as IGraphicsSelection;
                    if (bool_2)
                    {
                        if (!bool_1)
                        {
                            graphicsSelection.UnselectAllElements();
                        }
                        graphicsSelection.SelectElement(element);
                    }
                    iscene_0.SceneGraph.RefreshViewers();
                }
            }
        }
示例#23
0
 public void SetObjects(object object_0)
 {
     this.ilineElement_0 = object_0 as ILineElement;
 }
示例#24
0
文件: GisUtil.cs 项目: Leooonard/CGXM
 public static void RestorePolylineElementColor(ILineElement lineElement, AxMapControl mapControl)
 {
     ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
     IRgbColor rgbColor = new RgbColorClass();
     rgbColor.Red = 255;
     rgbColor.Green = 0;
     rgbColor.Blue = 0;
     simpleLineSymbol.Color = rgbColor;
     simpleLineSymbol.Width = 1;
     simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
     lineElement.Symbol = simpleLineSymbol;
     IMap map = mapControl.Map;
     IActiveView activeView = mapControl.ActiveView;
     IGraphicsContainer graphicsContainer = map as IGraphicsContainer;
     graphicsContainer.UpdateElement((IElement)lineElement);
     activeView.Refresh();
 }
示例#25
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app = DF2DApplication.Application;

            m_ActiveView = app.Current2DMapControl.ActiveView;
            IGraphicsContainer pGC = m_ActiveView.GraphicsContainer;

            if (this.m_ActiveView.FocusMap.FeatureSelection != null)
            {
                this.m_ActiveView.FocusMap.ClearSelection();
            }
            bool ready = false;

            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            IGeometry pGeo = null;

            try
            {
                if (button == 1)
                {
                    PointClass searchPoint = new PointClass();
                    searchPoint.PutCoords(mapX, mapY);
                    pGeo = PublicFunction.DoBuffer(searchPoint,
                                                   PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                    if (pGeo == null)
                    {
                        return;
                    }
                    ready = true;
                    if (ready)
                    {
                        bool haveone = false;

                        foreach (LogicGroup lg in LogicDataStructureManage2D.Instance.RootLogicGroups)
                        {
                            foreach (MajorClass mc in lg.MajorClasses)
                            {
                                string[] arrFc2DId = mc.Fc2D.Split(';');
                                if (arrFc2DId == null)
                                {
                                    continue;
                                }
                                IFeatureCursor pFeatureCursor = null;
                                IFeature       pFeature       = null;

                                foreach (string fc2DId in arrFc2DId)
                                {
                                    DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                                    if (dffc == null)
                                    {
                                        continue;
                                    }
                                    IFeatureClass fc   = dffc.GetFeatureClass();
                                    FacilityClass facc = dffc.GetFacilityClass();
                                    if (facc.Name != "PipeNode")
                                    {
                                        continue;
                                    }
                                    IFeatureLayer fl = dffc.GetFeatureLayer();
                                    if (fc == null || pGeo == null || fl == null)
                                    {
                                        continue;
                                    }
                                    if (!fl.Visible)
                                    {
                                        continue;
                                    }

                                    ISpatialFilter pSpatialFilter = new SpatialFilter();
                                    pSpatialFilter.Geometry   = pGeo;
                                    pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                                    pFeatureCursor            = fc.Search(pSpatialFilter, false);
                                    if (pFeatureCursor == null)
                                    {
                                        continue;
                                    }
                                    pFeature = pFeatureCursor.NextFeature();
                                    if (pFeature == null)
                                    {
                                        continue;
                                    }
                                    haveone = true;

                                    IGeometry pGeometry = pFeature.Shape as IGeometry;
                                    if (pGeometry.GeometryType == esriGeometryType.esriGeometryPoint)
                                    {
                                        IPoint pPoint = pGeometry as IPoint;
                                        if (this._bFinished)
                                        {
                                            this._bFinished = false;
                                            this._startFCID = fc.FeatureClassID.ToString();
                                            this._startOid  = pFeature.OID;
                                            AddCallout(pPoint, "起点");
                                            app.Current2DMapControl.ActiveView.Refresh();
                                        }
                                        else
                                        {
                                            if (this._startFCID == fc.FeatureClassID.ToString() && this._startOid == pFeature.OID)
                                            {
                                                XtraMessageBox.Show("您选中的是同一个管点设施。", "提示");
                                                return;
                                            }
                                            this._bFinished = true;
                                            AddCallout(pPoint, "终点");
                                            app.Current2DMapControl.ActiveView.Refresh();
                                            if (this._startFCID != fc.FeatureClassID.ToString())
                                            {
                                                XtraMessageBox.Show("您选中的不是同一类管点设施。", "提示");
                                                return;
                                            }
                                            else
                                            {
                                                WaitForm.Start("正在分析...", "请稍后");
                                                TopoClass2D tc = FacilityInfoService2D.GetTopoClassByFeatureClassID(fc.FeatureClassID.ToString());
                                                if (tc == null)
                                                {
                                                    return;
                                                }
                                                TopoNetwork net = tc.GetNetwork();
                                                if (net == null)
                                                {
                                                    WaitForm.Stop();
                                                    XtraMessageBox.Show("构建拓扑网络失败!", "提示");
                                                    return;
                                                }
                                                else
                                                {
                                                    string        startId = this._startFCID + "_" + this._startOid.ToString();
                                                    string        endId   = fc.FeatureClassID.ToString() + "_" + pFeature.OID.ToString();
                                                    List <string> path;
                                                    double        shortestLength = net.SPFA(startId, endId, out path);
                                                    if ((shortestLength > 0.0 && shortestLength != double.MaxValue) || (path != null && path.Count > 0))
                                                    {
                                                        List <IPoint>    listPt   = new List <IPoint>();
                                                        IPointCollection pointCol = new PolylineClass();
                                                        foreach (string nodeId in path)
                                                        {
                                                            int              index    = nodeId.LastIndexOf("_");
                                                            string           fcID     = nodeId.Substring(0, index);
                                                            string           oid      = nodeId.Substring(index + 1, nodeId.Length - index - 1);
                                                            DF2DFeatureClass dffcTemp = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fcID);
                                                            if (dffcTemp == null || dffcTemp.GetFeatureClass() == null)
                                                            {
                                                                continue;
                                                            }
                                                            if (dffcTemp.GetFacilityClassName() != "PipeNode")
                                                            {
                                                                continue;
                                                            }
                                                            IQueryFilter filter = new QueryFilter();
                                                            filter.WhereClause = "OBJECTID =" + oid;
                                                            filter.SubFields   = "OBJECTID ,SHAPE";
                                                            IFeature       feature = null;
                                                            IFeatureCursor cursor  = null;
                                                            try
                                                            {
                                                                cursor = dffcTemp.GetFeatureClass().Search(filter, false);
                                                                while ((feature = cursor.NextFeature()) != null)
                                                                {
                                                                    if (feature.Shape != null && feature.Shape is IGeometry)
                                                                    {
                                                                        IGeometry geo = feature.Shape as IGeometry;
                                                                        switch (geo.GeometryType)
                                                                        {
                                                                        case esriGeometryType.esriGeometryPoint:
                                                                            IPoint pt = geo as IPoint;
                                                                            //pt.Z = pt.Z + 1;
                                                                            listPt.Add(pt);
                                                                            pointCol.AddPoint(pt);
                                                                            break;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            catch (System.Exception ex)
                                                            {
                                                            }
                                                            finally
                                                            {
                                                                if (cursor != null)
                                                                {
                                                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                                                                    cursor = null;
                                                                }
                                                                if (feature != null)
                                                                {
                                                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(feature);
                                                                    feature = null;
                                                                }
                                                            }
                                                        }
                                                        if (listPt.Count > 0)
                                                        {
                                                            IPolyline         polyline    = pointCol as IPolyline;
                                                            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbol();
                                                            pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                                                            pLineSymbol.Width = 5;
                                                            pLineSymbol.Color = GetRGBColor(0, 230, 240);
                                                            IElement elementL = new LineElement();
                                                            elementL.Geometry = polyline;
                                                            ILineElement pLineElement = elementL as ILineElement;
                                                            pLineElement.Symbol = pLineSymbol;
                                                            pGC.AddElement(elementL, 0);

                                                            ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol();
                                                            simpleMarkerSymbol.Color   = GetRGBColor(255, 0, 0);
                                                            simpleMarkerSymbol.Outline = false;
                                                            simpleMarkerSymbol.Size    = 5;
                                                            simpleMarkerSymbol.Style   = esriSimpleMarkerStyle.esriSMSCircle;

                                                            foreach (IPoint pt in listPt)
                                                            {
                                                                try
                                                                {
                                                                    IMarkerElement pMarkerElement = new MarkerElementClass();
                                                                    pMarkerElement.Symbol = simpleMarkerSymbol;
                                                                    IElement pElement = pMarkerElement as IElement;
                                                                    pElement.Geometry = pt;
                                                                    pGC.AddElement(pElement, 0);
                                                                }
                                                                catch (System.Exception ex)
                                                                {
                                                                    continue;
                                                                }
                                                            }
                                                        }

                                                        app.Current2DMapControl.ActiveView.Refresh();
                                                    }
                                                    else
                                                    {
                                                        WaitForm.Stop();
                                                        XtraMessageBox.Show("两点不连通!", "提示");
                                                        pGC.DeleteAllElements();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (haveone)
                                {
                                    break;
                                }
                            }
                            if (haveone)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraMessageBox.Show("分析出错!", "提示");
            }
            finally
            {
                WaitForm.Stop();
            }
        }
示例#26
0
        /// <summary>
        /// 绘制对象 张琪  20110628
        /// </summary>
        /// <param name="pGeometry">对象</param>
        /// <param name="pColor">颜色</param>
        /// <param name="lSize">绘制的大小</param>
        /// <param name="sName">名称</param>
        /// <param name="pScene"></param>
        /// <param name="pGroup"></param>
        public static void AddSimpleGraphic(IGeometry pGeometry, IRgbColor pColor, int lSize, string sName, IMap pMap, IGroupElement pGroup)
        {
            if (pGeometry == null)
            {
                return;
            }
            IElement pElement = null;

            //ISymbol pSym;
            //根据绘制的对象类型对IElement进行不同的定义
            switch (pGeometry.GeometryType.ToString())
            {
            case "esriGeometryPoint":
                pElement = new MarkerElementClass();
                IMarkerElement      pPointElement = pElement as IMarkerElement;
                ISimpleMarkerSymbol pMSym         = new SimpleMarkerSymbolClass();
                pMSym.Color = pColor;
                pMSym.Size  = lSize;
                pMSym.Style = esriSimpleMarkerStyle.esriSMSCircle;
                IMarkerSymbol pMarkerSymbol = pMSym as IMarkerSymbol;
                pPointElement.Symbol = pMarkerSymbol;
                break;

            case "esriGeometryPolyline":
                pElement = new LineElementClass();
                ILineElement      pLineElement = pElement as ILineElement;
                ISimpleLineSymbol pLSym        = new SimpleLineSymbolClass();
                pLSym.Width = lSize;
                pLSym.Style = esriSimpleLineStyle.esriSLSSolid;
                pLSym.Color = pColor;
                ILineSymbol pLineSymbol = pLSym as ILineSymbol;
                pLineElement.Symbol = pLineSymbol;
                break;

            case "esriGeometryPolygon":
                ISimpleLineSymbol pOutlineSym = new SimpleLineSymbolClass();
                pOutlineSym.Color = pColor;
                pOutlineSym.Width = lSize;
                pOutlineSym.Style = esriSimpleLineStyle.esriSLSSolid;
                if (sName == "_ReferancePlane_")
                {
                    pColor.Transparency = Convert.ToByte(Convert.ToInt32(255 / 2));
                }
                pElement = new PolygonElementClass();
                IFillShapeElement pPolygonElement = pElement as IFillShapeElement;
                IFillSymbol       pFSym           = new SimpleFillSymbolClass();
                pFSym.Color = pColor;
                ILineSymbol pLineSymbol1 = pOutlineSym as ILineSymbol;
                pFSym.Outline          = pLineSymbol1;
                pPolygonElement.Symbol = pFSym;
                break;

            default:
                break;
            }
            pElement.Geometry = pGeometry;
            IElementProperties pElemProps = pElement as IElementProperties;

            pElemProps.Name = sName;
            if (pGroup == null)
            {
                IGraphicsContainer pGCon = pMap.BasicGraphicsLayer as IGraphicsContainer;
                pGCon.AddElement(pElement, 0);
            }
            else
            {
                pGroup.AddElement(pElement);
            }
        }
示例#27
0
        /// <summary>
        /// 添加图元
        /// </summary>
        /// <param name="pGeometry"></param>
        /// <param name="pActiveView"></param>
        /// <param name="pSymbol"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public IElement AddElement(IGeometry pGeometry, ISymbol pSymbol, string key)
        {
            try
            {
                IActiveView        pActiveView        = mapControl.ActiveView;
                IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
                IElement           pElement           = null;
                ILineElement       pLineElement       = null;
                IFillShapeElement  pFillShapeElement  = null;
                IMarkerElement     pMarkerElement     = null;
                ICircleElement     pCircleElement     = null;
                IElementProperties pElmentProperties  = null;
                switch (pGeometry.GeometryType)
                {
                case esriGeometryType.esriGeometryEnvelope:
                {
                    pElement                 = new RectangleElement();
                    pElement.Geometry        = pGeometry;
                    pFillShapeElement        = (IFillShapeElement)pElement;
                    pFillShapeElement.Symbol = (IFillSymbol)pSymbol;
                    break;
                }

                case esriGeometryType.esriGeometryPolyline:
                {
                    pElement            = new LineElement();
                    pElement.Geometry   = pGeometry;
                    pLineElement        = (ILineElement)pElement;
                    pLineElement.Symbol = (ILineSymbol)pSymbol;
                    break;
                }

                case esriGeometryType.esriGeometryLine:
                {
                    pElement          = new LineElement();
                    pElement.Geometry = pGeometry;

                    pLineElement        = (ILineElement)pElement;
                    pLineElement.Symbol = (ILineSymbol)pSymbol;
                    break;
                }

                case esriGeometryType.esriGeometryPolygon:
                {
                    pElement          = new PolygonElement();
                    pElement.Geometry = pGeometry;
                    pFillShapeElement = (IFillShapeElement)pElement;

                    pFillShapeElement.Symbol = (IFillSymbol)pSymbol;
                    break;
                }

                case esriGeometryType.esriGeometryMultipoint:
                case esriGeometryType.esriGeometryPoint:
                {
                    pElement          = new MarkerElement();
                    pElement.Geometry = pGeometry;

                    pMarkerElement = (IMarkerElement)pElement;

                    pMarkerElement.Symbol = (IMarkerSymbol)pSymbol;
                    break;
                }

                case esriGeometryType.esriGeometryCircularArc:
                {
                    pElement          = new CircleElement();
                    pElement.Geometry = pGeometry;

                    pCircleElement = (ICircleElement)pElement;
                    break;
                }

                default:
                    pElement = null;
                    break;
                }

                if (pElement != null)
                {
                    pElmentProperties      = pElement as IElementProperties;
                    pElmentProperties.Name = key;
                    pGraphicsContainer.AddElement(pElement, 0);
                    pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, pGeometry.Envelope);
                    return(pElement);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#28
0
        private void method_0(IPoint ipoint_4, double double_5, double double_6, double double_7, double double_8)
        {
            object           missing   = System.Type.Missing;
            IPolyline        polyline  = new PolylineClass();
            IPolyline        polyline2 = new PolylineClass();
            IPolyline        polyline3 = new PolylineClass();
            IElement         item      = new LineElementClass();
            IElement         element2  = new LineElementClass();
            IElement         element3  = new LineElementClass();
            ILineElement     element4  = null;
            IPoint           inPoint   = new PointClass();
            IPoint           point2    = new PointClass();
            IPointCollection points    = polyline as IPointCollection;
            IPoint           point3    = new PointClass();
            IPoint           point4    = new PointClass();
            IPoint           point5    = new PointClass();
            IPoint           point6    = new PointClass();
            IPoint           point7    = new PointClass();
            IPoint           point8    = new PointClass();
            IElement         element5  = new TextElementClass();

            switch (this.int_0)
            {
            case 0:
                inPoint.PutCoords(ipoint_4.X, base.RightUp.Y);
                point2.PutCoords(base.RightUp.X, base.RightUp.Y - double_6);
                point3.PutCoords(ipoint_4.X - double_7, base.RightUp.Y);
                point4.PutCoords(ipoint_4.X - double_7, ipoint_4.Y - double_7);
                point5.PutCoords(base.RightUp.X, (base.RightUp.Y - double_6) - double_7);
                point6.PutCoords(base.RightUp.X, base.RightUp.Y - double_8);
                point7.PutCoords(base.RightUp.X - double_5, base.RightUp.Y - double_8);
                point8.PutCoords(base.RightUp.X - (double_5 / 2.0), base.RightUp.Y - (double_8 / 2.0));
                break;

            case 1:
                inPoint.PutCoords(ipoint_4.X, base.RightLow.Y);
                point2.PutCoords(base.RightLow.X, base.RightLow.Y + double_6);
                point3.PutCoords(ipoint_4.X - double_7, base.RightLow.Y);
                point4.PutCoords(ipoint_4.X - double_7, ipoint_4.Y + double_7);
                point5.PutCoords(base.RightLow.X, (base.RightLow.Y + double_6) + double_7);
                point6.PutCoords(base.RightLow.X, (base.RightLow.Y + double_6) - double_8);
                point7.PutCoords(base.RightLow.X - double_5, (base.RightLow.Y + double_6) - double_8);
                point8.PutCoords(base.RightLow.X - (double_5 / 2.0), (base.RightLow.Y + double_6) - (double_8 / 2.0));
                break;

            case 2:
                inPoint.PutCoords(ipoint_4.X, base.LeftLow.Y);
                point2.PutCoords(base.LeftLow.X, base.LeftLow.Y + double_6);
                point3.PutCoords(ipoint_4.X + double_7, base.LeftLow.Y);
                point4.PutCoords(ipoint_4.X + double_7, ipoint_4.Y + double_7);
                point5.PutCoords(base.LeftLow.X, (base.LeftLow.Y + double_6) + double_7);
                point6.PutCoords(base.LeftLow.X, (base.LeftLow.Y + double_6) - double_8);
                point7.PutCoords(base.LeftLow.X + double_5, (base.LeftLow.Y + double_6) - double_8);
                point8.PutCoords(base.LeftLow.X + (double_5 / 2.0), (base.LeftLow.Y + double_6) - (double_8 / 2.0));
                break;

            case 3:
                inPoint.PutCoords(ipoint_4.X, base.LeftUp.Y);
                point2.PutCoords(base.LeftUp.X, base.LeftUp.Y - double_6);
                point3.PutCoords(ipoint_4.X + double_7, base.LeftUp.Y);
                point4.PutCoords(ipoint_4.X + double_7, ipoint_4.Y - double_7);
                point5.PutCoords(base.LeftUp.X, (base.LeftUp.Y - double_6) - double_7);
                point6.PutCoords(base.LeftUp.X, base.RightUp.Y - double_8);
                point7.PutCoords(base.LeftUp.X + double_5, base.LeftUp.Y - double_8);
                point8.PutCoords(base.LeftUp.X + (double_5 / 2.0), base.LeftUp.Y - (double_8 / 2.0));
                break;
            }
            points.AddPoint(inPoint, ref missing, ref missing);
            points.AddPoint(ipoint_4, ref missing, ref missing);
            points.AddPoint(point2, ref missing, ref missing);
            item.Geometry   = polyline;
            element4        = item as ILineElement;
            element4.Symbol = this.method_5(1);
            this.ilist_0.Add(item);
            points = polyline2 as IPointCollection;
            points.AddPoint(point3, ref missing, ref missing);
            points.AddPoint(point4, ref missing, ref missing);
            points.AddPoint(point5, ref missing, ref missing);
            element2.Geometry = polyline2;
            element4          = element2 as ILineElement;
            element4.Symbol   = this.method_5(2);
            this.ilist_0.Add(element2);
            points = polyline3 as IPointCollection;
            points.AddPoint(point6, ref missing, ref missing);
            points.AddPoint(point7, ref missing, ref missing);
            element3.Geometry = polyline3;
            element4          = element3 as ILineElement;
            element4.Symbol   = this.method_5(1);
            this.ilist_0.Add(element3);
            element5.Geometry = point8;
            ITextElement element6 = element5 as ITextElement;

            element6.Text   = "图  例";
            element6.Symbol = base.FontStyle(20.0, esriTextHorizontalAlignment.esriTHACenter,
                                             esriTextVerticalAlignment.esriTVACenter);
            this.ilist_0.Add(element5);
        }
示例#29
0
文件: GisUtil.cs 项目: Leooonard/CGXM
 public static void DrawPolylineElement(ILineElement lineElement, AxMapControl mapControl)
 {
     ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
     simpleLineSymbol.Color = GetDefaultRgbColor();
     simpleLineSymbol.Width = 1;
     simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
     lineElement.Symbol = simpleLineSymbol;
     IMap pMap = mapControl.Map;
     IActiveView pActiveView = mapControl.ActiveView;
     IGraphicsContainer pGraphicsContainer = pMap as IGraphicsContainer;
     pGraphicsContainer.AddElement((IElement)lineElement, 0);
     pActiveView.Refresh();
 }
示例#30
0
文件: GisUtil.cs 项目: Leooonard/CGXM
 public static List<Point> getPointListFromILineElement(ILineElement lineElement)
 {
     IPolyline polyline = (lineElement as IElement).Geometry as IPolyline;
     IPointCollection pointCollection = polyline as IPointCollection;
     List<Point> pointList = new List<Point>();
     for (int i = 0; i < pointCollection.PointCount; i++)
     {
         IPoint point = pointCollection.get_Point(i);
         Point pt = new Point();
         pt.x = point.X;
         pt.y = point.Y;
         pointList.Add(pt);
     }
     return pointList;
 }
示例#31
0
 public void initBySqlDataReader(SqlDataReader reader)
 {
     reader.Read();
     mrID = Int32.Parse(reader[0].ToString());
     prID = Int32.Parse(reader[1].ToString());
     mrName = reader[2].ToString();
     mrPath = reader[3].ToString();
     List<Point> pointList = MainRoad.ConvertStringToPointList(mrPath);
     lineElement = GisUtil.getILineElementFromPointList(pointList);
 }
示例#32
0
        public static void AddFlyByGraphic(ISceneGraph isceneGraph_0, IGeometry igeometry_0, FlyByUtils.FlyByElementType flyByElementType_0, System.Drawing.Color color_0, System.Drawing.Color color_1, System.Drawing.Color color_2, System.Drawing.Color color_3, bool bool_0)
        {
            if (!igeometry_0.IsEmpty)
            {
                IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
                if (!FlyByUtils.LayerIsExist(isceneGraph_0.Scene, graphicsContainer3D as ILayer))
                {
                    isceneGraph_0.Scene.AddLayer(graphicsContainer3D as ILayer, true);
                }
                switch (flyByElementType_0)
                {
                case FlyByUtils.FlyByElementType.FLYBY_PATH:
                    if (FlyByUtils.pPathElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem);
                    }
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_OBSERVER:
                    if (FlyByUtils.pObserverElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem);
                    }
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_TARGET:
                    if (FlyByUtils.pTargetElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem);
                    }
                    break;
                }
                ISymbol  flyBySymbol = FlyByUtils.GetFlyBySymbol(color_0, color_1, color_2, color_3, flyByElementType_0);
                IElement element;
                switch (igeometry_0.GeometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                {
                    element = new MarkerElement();
                    IMarkerElement markerElement = element as IMarkerElement;
                    markerElement.Symbol = (flyBySymbol as IMarkerSymbol);
                    break;
                }

                case esriGeometryType.esriGeometryMultipoint:
                    return;

                case esriGeometryType.esriGeometryPolyline:
                {
                    element = new LineElement();
                    ILineElement lineElement = element as ILineElement;
                    lineElement.Symbol = (flyBySymbol as ILineSymbol);
                    break;
                }

                default:
                    return;
                }
                switch (flyByElementType_0)
                {
                case FlyByUtils.FlyByElementType.FLYBY_ANCHORS:
                {
                    IElementProperties elementProperties = element as IElementProperties;
                    elementProperties.Name = "SceneFlyBy.AnchorPoint";
                    break;
                }

                case FlyByUtils.FlyByElementType.FLYBY_PATH:
                    FlyByUtils.pPathElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_OBSERVER:
                    FlyByUtils.pObserverElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_TARGET:
                    FlyByUtils.pTargetElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_STATIC:
                {
                    IElementProperties elementProperties = element as IElementProperties;
                    elementProperties.Name = "SceneFlyBy.StaticLoc";
                    break;
                }
                }
                element.Geometry = igeometry_0;
                graphicsContainer3D.AddElement(element);
                if (bool_0)
                {
                    isceneGraph_0.RefreshViewers();
                }
            }
        }
示例#33
0
 private void initBySqlDataReader(SqlDataReader reader)
 {
     reader.Read();
     irID = Int32.Parse(reader[0].ToString());
     prID = Int32.Parse(reader[1].ToString());
     vID = Int32.Parse(reader[2].ToString());
     irName = reader[3].ToString();
     irPath = reader[4].ToString();
     if (irPath != "")
     {
         List<Point> pointList = InnerRoad.ConvertStringToPointList(irPath);
         lineElement = GisUtil.getILineElementFromPointList(pointList);
     }
 }
示例#34
0
文件: GisUtil.cs 项目: Leooonard/CGXM
 public static IGeometry ConvertILineElementToIPolyline(ILineElement lineElement)
 {
     IElement element = lineElement as IElement;
     return element.Geometry;
 }
示例#35
0
文件: GisUtil.cs 项目: Leooonard/CGXM
 public static void ErasePolylineElement(ILineElement targetLineElement,  AxMapControl mapControl)
 {
     IMap map = mapControl.Map;
     IActiveView activeView = mapControl.ActiveView;
     IGraphicsContainer graphicsContainer = map as IGraphicsContainer;
     graphicsContainer.DeleteElement((IElement)targetLineElement);
     activeView.Refresh();
 }
示例#36
0
        public void DrawGrid()
        {
            string              str        = "";
            string              str2       = "";
            ITextElement        element    = null;
            ITextElement        element2   = null;
            ITextElement        element3   = null;
            ITextElement        element4   = null;
            double              num        = 40.0;
            double              num2       = 20.0;
            double              num3       = 10.0;
            int                 num4       = 13;
            int                 num5       = 10;
            IPoint              point      = null;
            IElement            item       = null;
            ITextSymbol         symbol     = new TextSymbolClass();
            ITextSymbol         symbol2    = new TextSymbolClass();
            ITextSymbol         symbol3    = new TextSymbolClass();
            ITextSymbol         symbol4    = new TextSymbolClass();
            ITextSymbol         symbol5    = new TextSymbolClass();
            ITextSymbol         symbol6    = new TextSymbolClass();
            int                 num6       = 0;
            int                 num7       = 0;
            int                 num8       = 1000;
            double              x          = 0.0;
            double              y          = 0.0;
            IPoint              point2     = new PointClass();
            object              missing    = System.Type.Missing;
            IElementProperties2 properties = null;
            IMarkerElement      element6   = null;
            ISymbol             symbol7    = new SimpleMarkerSymbolClass();
            ISimpleMarkerSymbol symbol8    = symbol7 as ISimpleMarkerSymbol;
            IRgbColor           color      = new RgbColorClass
            {
                Red   = 0,
                Blue  = 0,
                Green = 0
            };

            symbol8.Size  = 10.0;
            symbol8.Style = esriSimpleMarkerStyle.esriSMSCross;
            symbol8.Color = color;
            double num11 = 0.0;
            double num12 = 0.0;
            double num13 = 0.0;
            double num14 = 0.0;
            int    num15 = 0;
            int    num16 = 0;
            int    num17 = 0;
            int    num18 = 0;
            int    num19 = 0;
            double num20 = 0.0;
            double num21 = 0.0;
            double num22 = 0.0;
            double num23 = 0.0;

            try
            {
                symbol = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHARight,
                                        esriTextVerticalAlignment.esriTVABottom);
                symbol2 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVABottom);
                symbol3 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHARight,
                                         esriTextVerticalAlignment.esriTVATop);
                symbol4 = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVATop);
                symbol5 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHARight,
                                         esriTextVerticalAlignment.esriTVABottom);
                symbol6 = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVABottom);
                if (base.LeftUp.Y < base.RightUp.Y)
                {
                    y     = Math.Truncate(base.LeftUp.Y);
                    num23 = (base.RightUp.Y + base.InOutDist) + 1.0;
                }
                else
                {
                    y     = Math.Truncate(base.RightUp.Y);
                    num23 = (base.LeftUp.Y + base.InOutDist) + 1.0;
                }
                num15 = (int)(y % ((double)num8));
                if (num15 != 0)
                {
                    num12 = y - num15;
                }
                else
                {
                    num12 = y;
                }
                if (base.LeftUp.X > base.LeftLow.X)
                {
                    x     = Math.Truncate((double)(base.LeftUp.X + 1.0));
                    num20 = (base.LeftLow.X - base.InOutDist) - 1.0;
                }
                else
                {
                    x     = Math.Truncate((double)(base.LeftLow.X + 1.0));
                    num20 = (base.LeftUp.X - base.InOutDist) - 1.0;
                }
                num15 = (int)(x % ((double)num8));
                if (num15 != 0)
                {
                    num11 = x + (num8 - num15);
                }
                else
                {
                    num11 = x;
                }
                if (base.LeftLow.Y < base.RightLow.Y)
                {
                    y     = Math.Truncate(base.LeftLow.Y);
                    num21 = (base.LeftLow.Y - base.InOutDist) - 1.0;
                }
                else
                {
                    y     = Math.Truncate(base.RightLow.Y);
                    num21 = (base.RightLow.Y - base.InOutDist) - 1.0;
                }
                num15 = (int)(y % ((double)num8));
                if (num15 != 0)
                {
                    num14 = y + (num8 - num15);
                }
                else
                {
                    num14 = y;
                }
                if (base.RightUp.X > base.RightLow.X)
                {
                    x     = Math.Truncate(base.RightLow.X);
                    num22 = (base.RightUp.X + base.InOutDist) + 1.0;
                }
                else
                {
                    x     = Math.Truncate(base.RightUp.X);
                    num22 = (base.RightLow.X + base.InOutDist) + 1.0;
                }
                num15 = (int)(x % ((double)num8));
                if (num15 != 0)
                {
                    num13 = x - num15;
                }
                else
                {
                    num13 = x;
                }
                num16 = ((int)(num12 - num14)) / num8;
                num17 = ((int)(num13 - num11)) / num8;
                for (num18 = 0; num18 <= num16; num18++)
                {
                    y = num12 - (num18 * num8);
                    for (num19 = 0; num19 <= num17; num19++)
                    {
                        x = num11 + (num19 * num8);
                        point2.PutCoords(x, y);
                        item = new MarkerElementClass
                        {
                            Geometry = point2
                        };
                        element6        = item as IMarkerElement;
                        element6.Symbol = symbol8;
                        properties      = item as IElementProperties2;
                        properties.Type = "公里网";
                        this.ilist_0.Add(item);
                    }
                }
                IPolygon polygon = new PolygonClass();
                new PolygonElementClass();
                polygon = this.method_3();
                double           num1      = base.LeftUp.X - base.InOutDist;
                double           num24     = base.LeftUp.X;
                double           num25     = base.RightUp.X;
                double           num26     = base.RightUp.X + base.InOutDist;
                IPoint           inPoint   = null;
                IPoint           point4    = null;
                IPoint           point5    = null;
                IPoint           point6    = null;
                IPolyline        polyline  = new PolylineClass();
                IPolyline        polyline2 = new PolylineClass();
                IPolyline        polyline3 = new PolylineClass();
                IPoint           point7    = null;
                IPoint           point8    = null;
                IPointCollection points    = null;
                IPointCollection points2   = null;
                IElement         element7  = null;
                IElement         element8  = null;
                ILineElement     element9  = null;
                ILineSymbol      symbol9   = this.method_5(1);
                for (num18 = 0; num18 <= num16; num18++)
                {
                    y      = num12 - (num18 * num8);
                    point7 = new PointClass();
                    point8 = new PointClass();
                    point7.PutCoords(num20, y);
                    point8.PutCoords(num22, y);
                    points = polyline3 as IPointCollection;
                    if (points.PointCount >= 1)
                    {
                        points.RemovePoints(0, points.PointCount);
                    }
                    points.AddPoint(point7, ref missing, ref missing);
                    points.AddPoint(point8, ref missing, ref missing);
                    points          = this.method_4(polyline3, polygon);
                    inPoint         = points.get_Point(0);
                    point4          = points.get_Point(1);
                    point5          = points.get_Point(2);
                    point6          = points.get_Point(3);
                    element7        = new LineElementClass();
                    element9        = element7 as ILineElement;
                    element9.Symbol = symbol9;
                    points2         = polyline as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(inPoint, ref missing, ref missing);
                    points2.AddPoint(point4, ref missing, ref missing);
                    element7.Geometry = polyline;
                    element8          = new LineElementClass();
                    element9          = element8 as ILineElement;
                    element9.Symbol   = symbol9;
                    points2           = polyline2 as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(point5, ref missing, ref missing);
                    points2.AddPoint(point6, ref missing, ref missing);
                    element8.Geometry = polyline2;
                    this.ilist_0.Add(element7);
                    this.ilist_0.Add(element8);
                    element  = new TextElementClass();
                    element2 = new TextElementClass();
                    element3 = new TextElementClass();
                    element4 = new TextElementClass();
                    num6     = (int)Math.Truncate((double)(y / 100000.0));
                    str      = num6.ToString();
                    num7     = (int)Math.Truncate((double)((y - (num6 * 100000)) / 1000.0));
                    str2     = num7.ToString();
                    if (str2.Length < 2)
                    {
                        str2 = "0" + str2;
                    }
                    element.Text  = str2;
                    element2.Text = str;
                    element3.Text = str2;
                    element4.Text = str;
                    point         = new PointClass();
                    point.PutCoords(inPoint.X, inPoint.Y + num2);
                    item           = element as IElement;
                    item.Geometry  = point;
                    element.Symbol = symbol;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num16))
                    {
                        point = new PointClass();
                        point.PutCoords(point4.X, point4.Y + num);
                        item            = element2 as IElement;
                        item.Geometry   = point;
                        element2.Symbol = symbol2;
                        this.ilist_0.Add(item);
                    }
                    point = new PointClass();
                    point.PutCoords(point5.X, point5.Y + num2);
                    item            = element3 as IElement;
                    item.Geometry   = point;
                    element3.Symbol = symbol;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num16))
                    {
                        point = new PointClass();
                        point.PutCoords(point6.X, point6.Y + num);
                        item            = element4 as IElement;
                        item.Geometry   = point;
                        element4.Symbol = symbol2;
                        this.ilist_0.Add(item);
                    }
                }
                for (num18 = 0; num18 <= num17; num18++)
                {
                    x      = num11 + (num18 * num8);
                    point7 = new PointClass();
                    point8 = new PointClass();
                    point7.PutCoords(x, num23);
                    point8.PutCoords(x, num21);
                    points = polyline3 as IPointCollection;
                    if (points.PointCount >= 1)
                    {
                        points.RemovePoints(0, points.PointCount);
                    }
                    points.AddPoint(point7, ref missing, ref missing);
                    points.AddPoint(point8, ref missing, ref missing);
                    points          = this.method_4(polyline3, polygon);
                    inPoint         = points.get_Point(0);
                    point4          = points.get_Point(1);
                    point5          = points.get_Point(2);
                    point6          = points.get_Point(3);
                    element7        = new LineElementClass();
                    element9        = element7 as ILineElement;
                    element9.Symbol = symbol9;
                    points2         = polyline as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(inPoint, ref missing, ref missing);
                    points2.AddPoint(point4, ref missing, ref missing);
                    element7.Geometry = polyline;
                    element8          = new LineElementClass();
                    element9          = element8 as ILineElement;
                    element9.Symbol   = symbol9;
                    points2           = polyline2 as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(point5, ref missing, ref missing);
                    points2.AddPoint(point6, ref missing, ref missing);
                    element8.Geometry = polyline2;
                    this.ilist_0.Add(element7);
                    this.ilist_0.Add(element8);
                    element  = new TextElementClass();
                    element2 = new TextElementClass();
                    element3 = new TextElementClass();
                    element4 = new TextElementClass();
                    num6     = (int)Math.Truncate((double)(x / 100000.0));
                    str      = num6.ToString();
                    str2     = ((int)Math.Truncate((double)((x - (num6 * 100000)) / 1000.0))).ToString();
                    if (str2.Length < 2)
                    {
                        str2 = "0" + str2;
                    }
                    element.Text  = str2;
                    element2.Text = str;
                    element3.Text = str2;
                    element4.Text = str;
                    point         = new PointClass();
                    point.PutCoords(inPoint.X, inPoint.Y - num3);
                    item           = element as IElement;
                    item.Geometry  = point;
                    element.Symbol = symbol4;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num17))
                    {
                        point = new PointClass();
                        point.PutCoords(inPoint.X, inPoint.Y - num3);
                        item            = element2 as IElement;
                        item.Geometry   = point;
                        element2.Symbol = symbol3;
                        this.ilist_0.Add(item);
                    }
                    point = new PointClass();
                    point.PutCoords(point6.X, point6.Y + num3);
                    item            = element3 as IElement;
                    item.Geometry   = point;
                    element3.Symbol = symbol6;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num17))
                    {
                        point = new PointClass();
                        point.PutCoords(point6.X, point6.Y + num3);
                        item            = element4 as IElement;
                        item.Geometry   = point;
                        element4.Symbol = symbol5;
                        this.ilist_0.Add(item);
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
示例#37
0
        public static IElement AddGraphic(IGeometry igeometry_0, ISymbol isymbol_0, string string_0, IGraphicsContainer3D igraphicsContainer3D_0)
        {
            IElement element = null;
            IElement result;

            try
            {
                if (igeometry_0.IsEmpty)
                {
                    result = element;
                    return(result);
                }
                if (modFacades.g_pGCon == null)
                {
                    result = element;
                    return(result);
                }
                IElement         element2     = null;
                esriGeometryType geometryType = igeometry_0.GeometryType;
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                    element2 = new MarkerElement();
                    if (isymbol_0 != null)
                    {
                        IMarkerElement markerElement = element2 as IMarkerElement;
                        markerElement.Symbol = (isymbol_0 as IMarkerSymbol);
                    }
                    break;

                case esriGeometryType.esriGeometryMultipoint:
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    element2 = new LineElement();
                    if (isymbol_0 != null)
                    {
                        ILineElement lineElement = element2 as ILineElement;
                        lineElement.Symbol = (isymbol_0 as ILineSymbol);
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    element2 = new PolygonElement();
                    if (isymbol_0 != null)
                    {
                        IFillShapeElement fillShapeElement = element2 as IFillShapeElement;
                        fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                    }
                    break;

                default:
                    if (geometryType == esriGeometryType.esriGeometryMultiPatch)
                    {
                        element2 = new MultiPatchElement();
                        if (isymbol_0 != null)
                        {
                            IFillShapeElement fillShapeElement = element2 as IFillShapeElement;
                            fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                        }
                    }
                    break;
                }
                if (string_0.Length > 0)
                {
                    IElementProperties elementProperties = element2 as IElementProperties;
                    elementProperties.Name = string_0;
                }
                element2.Geometry = igeometry_0;
                if (igraphicsContainer3D_0 != null)
                {
                    igraphicsContainer3D_0.AddElement(element2);
                }
                element = element2;
                result  = element;
                return(result);
            }
            catch
            {
            }
            result = element;
            return(result);
        }
        private void SetDefaultSymbol(ILineElement elem)
        {
            ILineSymbol defaultLineSym = null;
            String esriStylePath;
            IStyleGallery styleGallery = new StyleGalleryClass();
            IStyleGalleryStorage styleStor = (IStyleGalleryStorage)styleGallery;
            esriStylePath = styleStor.DefaultStylePath + "ESRI.style";

            IEnumStyleGalleryItem styleItems = styleGallery.get_Items("Line Symbols",esriStylePath,"Dashed");
            styleItems.Reset();
            IStyleGalleryItem styleGalleryItem = styleItems.Next();
            while (!(styleGalleryItem == null))
            {
                if (styleGalleryItem.Name == "Dashed 4:4")
                {
                    defaultLineSym = (ILineSymbol)styleGalleryItem.Item;
                    defaultLineSym.Width = 1.50;
                    IRgbColor rgbColor = new RgbColorClass();
                    rgbColor.Red = 255;
                    rgbColor.Blue = 0;
                    rgbColor.Green = 0;
                    rgbColor.Transparency = 50;
                    defaultLineSym.Color = rgbColor;
                    break;
                }
                else
                {
                    styleGalleryItem = styleItems.Next();
                }
            }
            elem.Symbol = defaultLineSym;
        }
示例#39
0
        public IElement CreateBaseElementByGeometry(IGeometry pGeometry, ISymbol pSymbol)
        {
            IElement element7;

            try
            {
                IElement element;
                if (pGeometry != null)
                {
                    if (pGeometry.IsEmpty)
                    {
                        return(null);
                    }
                    IGeometry geometry = null;
                    geometry = GISFunFactory.SystemFun.CloneObejct(pGeometry as IClone) as IGeometry;
                    element  = null;
                    switch (geometry.GeometryType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        element = new MarkerElementClass {
                            Geometry = geometry
                        };
                        if ((pSymbol != null) && (pSymbol is IMarkerSymbol))
                        {
                            IMarkerElement element2 = element as IMarkerElement;
                            element2.Symbol = pSymbol as IMarkerSymbol;
                        }
                        goto Label_0166;

                    case esriGeometryType.esriGeometryPolyline:
                        element = new LineElementClass {
                            Geometry = geometry
                        };
                        if ((pSymbol != null) && (pSymbol is ILineSymbol))
                        {
                            ILineElement element4 = element as ILineElement;
                            element4.Symbol = pSymbol as ILineSymbol;
                        }
                        goto Label_0166;

                    case esriGeometryType.esriGeometryPolygon:
                        element = new PolygonElementClass {
                            Geometry = geometry
                        };
                        if ((pSymbol != null) && (pSymbol is IFillSymbol))
                        {
                            IFillShapeElement element5 = element as IFillShapeElement;
                            element5.Symbol = pSymbol as IFillSymbol;
                        }
                        goto Label_0166;

                    case esriGeometryType.esriGeometryEnvelope:
                        element = new RectangleElementClass {
                            Geometry = geometry
                        };
                        if ((pSymbol != null) && (pSymbol is IFillSymbol))
                        {
                            IFillShapeElement element6 = element as IFillShapeElement;
                            element6.Symbol = pSymbol as IFillSymbol;
                        }
                        goto Label_0166;

                    case esriGeometryType.esriGeometryLine:
                        element = new LineElementClass {
                            Geometry = geometry
                        };
                        if ((pSymbol != null) && (pSymbol is ILineSymbol))
                        {
                            ILineElement element3 = element as ILineElement;
                            element3.Symbol = pSymbol as ILineSymbol;
                        }
                        goto Label_0166;
                    }
                }
                return(null);

Label_0166:
                element7 = element;
            }
            catch (Exception exception)
            {
                this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "CreateBaseElementByGeometry", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
                element7 = null;
            }
            return(element7);
        }