private bool isVillageTooBig(IPolygonElement polygonElement) { IElement element = polygonElement as IElement; IPolygon polygon = element.Geometry as IPolygon; IArea area = polygon as IArea; return area.Area > Village.VILLAGE_MAX_SIZE; }
public static List<Point> getPointListFromIPolygonElement(IPolygonElement polygonElement) { List<Point> pointList = new List<Point>(); IElement element = polygonElement as IElement; IPolygon polygon = element.Geometry as IPolygon; Ring ring = polygon as Ring; for (int i = 0; i < ring.PointCount; i++) { IPoint pt = ring.get_Point(i); Point point = new Point(); point.x = pt.X; point.y = pt.Y; pointList.Add(point); } return pointList; }
public void initBySqlDataReader(SqlDataReader reader) { reader.Read(); vID = Int32.Parse(reader[0].ToString()); prID = Int32.Parse(reader[1].ToString()); vName = reader[2].ToString(); vBoundary = reader[3].ToString(); vInUse = Boolean.Parse(reader[4].ToString()); List<Point> pointList = Village.ConvertStringToPointList(vBoundary); polygonElement = GisUtil.getIPolygonElementFromPointList(pointList); }
public static void ErasePolygonElement(IPolygonElement polygonElement, AxMapControl mapControl) { IMap map = mapControl.Map; IActiveView activeView = mapControl.ActiveView; IGraphicsContainer graphicsContainer = map as IGraphicsContainer; graphicsContainer.DeleteElement((IElement)polygonElement); activeView.Refresh(); }
public static void RestorePolygonElementOutline(IPolygonElement polygonElement, AxMapControl mapControl) { IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement; IRgbColor oldFillColor = fillShapeElement.Symbol.Color as IRgbColor; ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass(); simpleLineSymbol.Color = GetDefaultRgbColor(); simpleLineSymbol.Width = 0; simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; simpleFillSymbol.Outline = simpleLineSymbol; simpleFillSymbol.Color = oldFillColor; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; fillShapeElement.Symbol = simpleFillSymbol; IMap map = mapControl.Map; IGraphicsContainer graphicsContainer = map as IGraphicsContainer; IActiveView activeView = mapControl.ActiveView; graphicsContainer.UpdateElement(fillShapeElement as IElement); activeView.Refresh(); }
public static void UpdatePolygonElementOutline(IPolygonElement polygonElement, AxMapControl mapControl, int red, int green, int blue) { IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement; IRgbColor oldFillColor = fillShapeElement.Symbol.Color as IRgbColor; ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass(); IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = red; rgbColor.Green = green; rgbColor.Blue = blue; simpleLineSymbol.Color = rgbColor; simpleLineSymbol.Width = 3; simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; simpleFillSymbol.Outline = simpleLineSymbol; simpleFillSymbol.Color = oldFillColor; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; fillShapeElement.Symbol = simpleFillSymbol; IMap map = mapControl.Map; IGraphicsContainer graphicsContainer = map as IGraphicsContainer; IActiveView activeView = mapControl.ActiveView; graphicsContainer.UpdateElement(fillShapeElement as IElement); activeView.Refresh(); }
public static void drawPolygonElement(IPolygonElement polygonElement, AxMapControl mapControl) { ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; simpleFillSymbol.Color = GetDefaultRgbColor(); IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement; fillShapeElement.Symbol = simpleFillSymbol; IMap map = mapControl.Map; IGraphicsContainer graphicsContainer = map as IGraphicsContainer; IActiveView activeView = mapControl.ActiveView; graphicsContainer.AddElement(polygonElement as IElement, 0); activeView.Refresh(); }
public static IGeometry ConvertIPolygonElementToIPolygon(IPolygonElement polygonElement) { IElement element = polygonElement as IElement; return element.Geometry; }