void axMap1_SelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { if (axMap1.CursorMode == tkCursorMode.cmSelection) { MessageHelper.Info("No shapefile layer is selected."); } }
// <summary> // Performs selection, updates charts // </summary> void AxMap1SelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { // it's assumed here that the layer we want to edit is the first 1 (with 0 index) int layerHandle = axMap1.get_LayerHandle(0); Shapefile sf = axMap1.get_Shapefile(layerHandle); if (sf != null) { double left = 0.0; double top = 0.0; double bottom = 0.0; double right = 0.0; axMap1.PixelToProj(e.left, e.top, ref left, ref top); axMap1.PixelToProj(e.right, e.bottom, ref right, ref bottom); object result = null; var ext = new Extents(); ext.SetBounds(left, bottom, 0.0, right, top, 0.0); sf.SelectNone(); if (sf.SelectShapes(ext, 0.0, SelectMode.INTERSECTION, ref result)) { int[] shapes = result as int[]; if (shapes == null) { return; } for (int i = 0; i < shapes.Length; i++) { sf.set_ShapeSelected(shapes[i], true); } } axMap1.Redraw(); } }
// <summary> // Handles select box final event. Select the label that are within the rectangular specified by user // </summary> void AxMap1SelectBoxFinal2(object sender, _DMapEvents_SelectBoxFinalEvent e) { Shapefile sf = axMap1.get_Shapefile(m_layerHandle); if (sf != null) { object labels = null; object parts = null; var ext = new Extents(); ext.SetBounds(e.left, e.bottom, 0.0, e.right, e.top, 0.0); if (sf.Labels.Select(ext, 0, SelectMode.INTERSECTION, ref labels, ref parts)) { int[] labelIndices = labels as int[]; int[] partIndices = parts as int[]; for (int i = 0; i < labelIndices.Count(); i++) { Label label = sf.Labels.Label[labelIndices[i], partIndices[i]]; if (label.Category == -1) // selection will be appliedonly to the labels without category, so that hidden { label.Category = CATEGORY_SELECTED; //labels preserve their state } } axMap1.Redraw(); } } }
private void MapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { double x, y, x2, y2; PixelToProj(e.left, e.top, out x, out y); PixelToProj(e.right, e.bottom, out x2, out y2); var box = new Envelope(x, x2, y, y2); var r = new Rectangle(e.left, e.top, e.right - e.left, e.bottom - e.top); Invoke(sender, SelectBoxFinal, new SelectBoxFinalEventArgs(r, box, _selectionModeClientId)); }
/// <summary> /// processes selection made using a mouse drag selection box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnMapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { if (EnableMapInteraction && _axMap.CursorMode == tkCursorMode.cmSelection) { var extL = 0D; var extR = 0D; var extT = 0D; var extB = 0D; Extents selectionBoxExtent = new Extents(); _axMap.PixelToProj(e.left, e.top, ref extL, ref extT); _axMap.PixelToProj(e.right, e.bottom, ref extR, ref extB); selectionBoxExtent.SetBounds(extL, extB, 0, extR, extT, 0); Select(selectionBoxExtent, selectionFromSelectBox: true); } }
/// <summary> /// define the extent of the template shapedfile and pass the extent to the function /// that will create the individual tiles (polygon shapes) comprising the template /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnMapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { if (_axMap.CursorMode == tkCursorMode.cmSelection && _axMap.UDCursorHandle == _hCursorDefineLayout) { var extL = 0D; var extR = 0D; var extT = 0D; var extB = 0D; _axMap.PixelToProj(e.left, e.top, ref extL, ref extT); _axMap.PixelToProj(e.right, e.bottom, ref extR, ref extB); _layoutExtents = new Extents(); _layoutExtents.SetBounds( (int)(extL / 2000) * 2000, (int)(extB / 2000) * 2000, 0, (int)(extR / 2000) * 2000, (int)(extT / 2000) * 2000, 0); //modify layout extents using the function called _layoutExtents = IntersectSelectionBoxWithMajorGridSelection(); if (_layoutExtents != null && LayerCreated != null) { Grid25LayoutHelperEventArgs lhe = new Grid25LayoutHelperEventArgs(_layoutExtents); LayerCreated(this, lhe); SetupLayout(lhe.Rows, lhe.Columns, lhe.Overlap); } else if (_layoutExtents == null) { if (LayerCreated != null) { Grid25LayoutHelperEventArgs gle = new Grid25LayoutHelperEventArgs(nullLayout: true); LayerCreated(this, gle); } } LayoutTemplateFromFile = false; } }
private void OnMapSelectBoxFinal(object sender, _DMapEvents_SelectBoxFinalEvent e) { _legendExtents = new Extents(); _legendExtents.SetBounds(e.left, e.bottom, 0, e.right, e.top, 0); }