/// <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"); } }
void LoaderForm_Shown(object sender, EventArgs e) { using (var form = new MainForm()) { form.ShowDialog(this); } GC.Collect(); GC.WaitForPendingFinalizers(); var utils = new MapWinGIS.Utils(); Debug.WriteLine(utils.ComUsageReport[true]); this.Close(); }
/// <summary> /// Adds default patterns to the list /// </summary> private void AddDefaultPatterns() { _patterns.Clear(); MapWinGIS.LinePattern pattern = new MapWinGIS.LinePattern(); MapWinGIS.Utils utils = new MapWinGIS.Utils(); pattern.AddLine(utils.ColorByName(MapWinGIS.tkMapColor.Red), 1, MapWinGIS.tkDashStyle.dsSolid); _patterns.Add(pattern); // TODO: mode patterns can be added this.ItemCount = _patterns.Count; }
/// <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); } }
/// <summary> /// Draws coordinate system at map /// </summary> /// <param name="cs">The territory (coordinate system or country) to draw</param> public void DrawCoordinateSystem(Territory cs) { this.RemoveLayer(m_handleCS); MapWinGIS.Shapefile sf = new MapWinGIS.Shapefile(); sf.CreateNew("", MapWinGIS.ShpfileType.SHP_POLYGON); MapWinGIS.Shape shp = new MapWinGIS.Shape(); shp.Create(MapWinGIS.ShpfileType.SHP_POLYGON); double xMax = cs.Right; double xMin = cs.Left; double yMin = cs.Bottom; double yMax = cs.Top; if (xMax < xMin) { InsertPart(shp, -180, xMax, yMin, yMax); InsertPart(shp, xMin, 180, yMin, yMax); System.Diagnostics.Debug.Print(shp.NumParts.ToString()); } else { InsertPart(shp, xMin, xMax, yMin, yMax); } int shpIndex = sf.NumShapes; sf.EditInsertShape(shp, ref shpIndex); m_handleCS = this.AddLayer(sf, true); MapWinGIS.Utils utils = new MapWinGIS.Utils(); sf.DefaultDrawingOptions.FillColor = utils.ColorByName(MapWinGIS.tkMapColor.LightBlue); sf.DefaultDrawingOptions.FillTransparency = 120; sf.DefaultDrawingOptions.LineColor = utils.ColorByName(MapWinGIS.tkMapColor.Blue); sf.DefaultDrawingOptions.LineStipple = MapWinGIS.tkDashStyle.dsDash; sf.DefaultDrawingOptions.LineWidth = 2; this.Redraw(); }