/// <summary> /// Draws selected bounds on map /// </summary> /// <param name="ext">Bounding box to search CS</param> public void DrawSelectedBounds(MapWinGIS.Extents ext) { this.RemoveLayer(m_handleBounds); MapWinGIS.Shapefile sf = new MapWinGIS.Shapefile(); if (sf.CreateNew("", MapWinGIS.ShpfileType.SHP_POLYGON)) { MapWinGIS.Shape shp = new MapWinGIS.Shape(); shp.Create(MapWinGIS.ShpfileType.SHP_POLYGON); this.InsertPart(shp, ext.xMin, ext.xMax, ext.yMin, ext.yMax); int index = 0; sf.EditInsertShape(shp, ref index); m_handleBounds = this.AddLayer(sf, true); MapWinGIS.ShapeDrawingOptions options = sf.DefaultDrawingOptions; MapWinGIS.Utils ut = new MapWinGIS.Utils(); options.FillColor = ut.ColorByName(MapWinGIS.tkMapColor.Orange); options.LineColor = ut.ColorByName(MapWinGIS.tkMapColor.Orange); options.LineWidth = 3; options.LineStipple = MapWinGIS.tkDashStyle.dsDash; options.FillTransparency = 100; } else { System.Diagnostics.Debug.Print("Failed to create in-memory shapefile"); } }
private void PointSymbolControl_OnDrawItem(System.Drawing.Graphics graphics, System.Drawing.RectangleF rect, int itemIndex, bool selected) { IntPtr ptr = graphics.GetHdc(); MapWinGIS.ShapeDrawingOptions sdo = _icons[itemIndex]; sdo.DrawPoint(ptr, rect.X + 1.0f, rect.Y + 1.0f, (int)rect.Width - 2, (int)rect.Height - 2, Colors.ColorToUInteger(this.BackColor)); graphics.ReleaseHdc(); }
/// <summary> /// Displaying selected layer on the map /// </summary> private void AddShapefile(MapWinGIS.Shapefile sf) { if (sf != null) { m_layerHandle = projectionMap1.AddLayer(sf, true); MapWinGIS.Utils utils = new MapWinGIS.Utils(); MapWinGIS.ShapeDrawingOptions options = sf.DefaultDrawingOptions; options.FillColor = utils.ColorByName(MapWinGIS.tkMapColor.Orange); options.FillTransparency = 110; options.LineColor = utils.ColorByName(MapWinGIS.tkMapColor.Orange); projectionMap1.ZoomToLayer(m_layerHandle); } }
public SymbolControl() { InitializeComponent(); this.ItemCount = 17; this.CellWidth = 24; this.CellHeight = 24; for (int i = 0; i < this.ItemCount; i++) { MapWinGIS.ShapeDrawingOptions sdo = new MapWinGIS.ShapeDrawingOptions(); sdo.SetDefaultPointSymbol((MapWinGIS.tkDefaultPointSymbol)i); sdo.PointSize = 0.8f * this.CellWidth; sdo.FillColor = Colors.ColorToUInteger(Color.Orange); _icons.Add(sdo); } this.OnDrawItem += new OnDrawItemDelegate(PointSymbolControl_OnDrawItem); }