/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnDraw(MapDrawArgs e) { if (_isDragging) { Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint); r.Width -= 1; r.Height -= 1; e.Graphics.DrawRectangle(Pens.White, r); e.Graphics.DrawRectangle(_selectionPen, r); } if (_doSelect) { foreach (IMapLayer lyr in Map.MapFrame.Layers) { IMapFeatureLayer fl = lyr as IMapFeatureLayer; if (fl == null) { continue; } IMapLabelLayer gll = fl.LabelLayer; //gll.Select(_selectionEnvelope, e); // using this form of selection can test the actual pixel rectangles if (gll != null) { gll.Invalidate(); } } _doSelect = false; _selectTimer.Start(); } base.OnDraw(e); }
/// <summary> /// Handles the Mouse Up situation /// </summary> /// <param name="e"></param> protected override void OnMouseUp(GeoMouseArgs e) { _currentPoint = e.Location; _isDragging = false; Map.Invalidate(); if (_geoStartPoint != null) { _selectionEnvelope = new Envelope(_geoStartPoint.X, e.GeographicLocation.X, _geoStartPoint.Y, e.GeographicLocation.Y); } // If they are not pressing shift, then first clear the selection before adding new members to it. if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift) == false) { foreach (IMapLayer lyr in Map.MapFrame.Layers) { IMapFeatureLayer fl = lyr as IMapFeatureLayer; if (fl == null) { continue; } IMapLabelLayer gll = fl.LabelLayer; if (gll != null) { gll.ClearSelection(); } } } _doSelect = true; e.Map.MapFrame.ResetBuffer(); e.Map.Invalidate(); base.OnMouseUp(e); }
/// <summary> /// A default method to generate a label layer. /// </summary> protected override void OnCreateLabels() { LabelLayer = new MapLabelLayer(this); }