/// <summary> /// This will draw any features that intersect this region. To specify the features /// directly, use OnDrawFeatures. This will not clear existing buffer content. /// For that call Initialize instead. /// </summary> /// <param name="args">A GeoArgs clarifying the transformation from geographic to image space</param> /// <param name="regions">The geographic regions to draw</param> /// <returns>The list of rectangular areas that match the specified regions</returns> public void DrawRegions(MapArgs args, List<IEnvelope> regions) { // First determine the number of features we are talking about based on region. List<Rectangle> clipRects = args.ProjToPixel(regions); if (EditMode) { List<IFeature> drawList = new List<IFeature>(); foreach (IEnvelope region in regions) { if (region != null) { // Use union to prevent duplicates. No sense in drawing more than we have to. drawList = drawList.Union(DataSet.Select(region)).ToList(); } } DrawFeatures(args, drawList, clipRects, true); } else { List<int> drawList = new List<int>(); List<Extent> extents = new List<Extent>(); double[] verts = DataSet.Vertex; foreach (IEnvelope envelope in regions) { extents.Add(new Extent(envelope)); } if (DataSet.FeatureType == FeatureTypes.Point) { for(int shp = 0; shp < verts.Length/2; shp++) { foreach (Extent extent in extents) { if(extent.Intersects(verts[shp * 2], verts[shp * 2+ 1])) { drawList.Add(shp); } } } } else { List<ShapeRange> shapes = DataSet.ShapeIndices; for (int shp = 0; shp < shapes.Count; shp++) { foreach (IEnvelope region in regions) { if (!shapes[shp].Extent.Intersects(region)) continue; drawList.Add(shp); break; } } } DrawFeatures(args, drawList, clipRects, true); } }
/// <summary> /// This will draw any features that intersect this region. To specify the features /// directly, use OnDrawFeatures. This will not clear existing buffer content. /// For that call Initialize instead. /// </summary> /// <param name="args">A GeoArgs clarifying the transformation from geographic to image space</param> /// <param name="regions">The geographic regions to draw</param> /// <returns>The list of rectangular areas that match the specified regions</returns> public void DrawRegions(MapArgs args, List<IEnvelope> regions) { List<Rectangle> clipRects = args.ProjToPixel(regions); DrawWindows(args, regions, clipRects); }
/// <summary> /// This will draw any features that intersect this region. To specify the features /// directly, use OnDrawFeatures. This will not clear existing buffer content. /// For that call Initialize instead. /// </summary> /// <param name="args">A GeoArgs clarifying the transformation from geographic to image space</param> /// <param name="regions">The geographic regions to draw</param> /// <returns>The list of rectangular areas that match the specified regions</returns> public void DrawRegions(MapArgs args, List<IEnvelope> regions) { List<Rectangle> clipRects = args.ProjToPixel(regions); if (EditMode) { List<IFeature> drawList = new List<IFeature>(); foreach (IEnvelope region in regions) { if (region != null) { // Use union to prevent duplicates. No sense in drawing more than we have to. drawList = drawList.Union(DataSet.Select(region)).ToList(); } } DrawFeatures(args, drawList, clipRects, true); } else { List<int> drawList = new List<int>(); List<ShapeRange> shapes = DataSet.ShapeIndices; for (int shp = 0; shp < shapes.Count; shp++) { foreach (IEnvelope region in regions) { if (!shapes[shp].Extent.Intersects(region)) continue; drawList.Add(shp); break; } } DrawFeatures(args, drawList, clipRects, true); } }
/// <summary> /// This will draw any features that intersect this region. To specify the features /// directly, use OnDrawFeatures. This will not clear existing buffer content. /// For that call Initialize instead. /// </summary> /// <param name="args">A GeoArgs clarifying the transformation from geographic to image space</param> /// <param name="regions">The geographic regions to draw</param> public void DrawRegions(MapArgs args, List<IEnvelope> regions) { if (FeatureSet == null) return; if(FeatureSet.IndexMode) { // First determine the number of features we are talking about based on region. List<int> drawIndices = new List<int>(); foreach (IEnvelope region in regions) { if (region != null) { // We need to consider labels that go off the screen. figure a region // that is larger. IEnvelope sur = new Envelope(region.Copy()); sur.ExpandBy(region.Width, region.Height); Extent r = new Extent(sur); // Use union to prevent duplicates. No sense in drawing more than we have to. drawIndices = drawIndices.Union(FeatureSet.SelectIndices(r)).ToList(); } } List<Rectangle> clips = args.ProjToPixel(regions); DrawFeatures(args, drawIndices, clips, true); } else { // First determine the number of features we are talking about based on region. List<IFeature> drawList = new List<IFeature>(); foreach (IEnvelope region in regions) { if (region != null) { // We need to consider labels that go off the screen. figure a region // that is larger. IEnvelope r = region.Copy(); r.ExpandBy(region.Width, region.Height); // Use union to prevent duplicates. No sense in drawing more than we have to. drawList = drawList.Union(FeatureSet.Select(r)).ToList(); } } List<Rectangle> clipRects = args.ProjToPixel(regions); DrawFeatures(args, drawList, clipRects, true); } }
/// <summary> /// This will draw any features that intersect this region. To specify the features /// directly, use OnDrawFeatures. This will not clear existing buffer content. /// For that call Initialize instead. /// </summary> /// <param name="args">A GeoArgs clarifying the transformation from geographic to image space</param> /// <param name="regions">The geographic regions to draw</param> /// <returns>The list of rectangular areas that match the specified regions</returns> public void DrawRegions(MapArgs args, List<IEnvelope> regions) { List<Rectangle> clipRects = args.ProjToPixel(regions); for (int i = clipRects.Count-1; i >=0; i-- ) { if (clipRects[i].Width != 0 && clipRects[i].Height != 0) continue; regions.RemoveAt(i); clipRects.RemoveAt(i); } DrawWindows(args, regions, clipRects); }