/// <summary> /// Makes footprint envelope for a metadata record /// </summary> /// <param name="record">CswRecord object</param> /// <returns>envelope polygon</returns> private AGXG.Polygon makeFootPrint(CswRecord record) { AGXG.Envelope envelope = new AGXG.Envelope(); try { envelope.XMax = record.BoundingBox.Maxx; envelope.YMax = record.BoundingBox.Maxy; envelope.XMin = record.BoundingBox.Minx; envelope.YMin = record.BoundingBox.Miny; } catch (System.ArgumentException e) { try { envelope.XMax = record.BoundingBox.Minx; envelope.YMax = record.BoundingBox.Maxy; envelope.XMin = record.BoundingBox.Maxx; envelope.YMin = record.BoundingBox.Miny; } catch (System.ArgumentException e1) { try { envelope.XMax = record.BoundingBox.Minx; envelope.YMax = record.BoundingBox.Miny; envelope.XMin = record.BoundingBox.Maxx; envelope.YMin = record.BoundingBox.Maxy; } catch (System.ArgumentException e2) { envelope.XMax = record.BoundingBox.Maxx; envelope.YMax = record.BoundingBox.Miny; envelope.XMin = record.BoundingBox.Minx; envelope.YMin = record.BoundingBox.Maxy; } } } AGXG.Point p1 = new AGXG.Point(); p1.SetCoordinates(record.BoundingBox.Maxx, record.BoundingBox.Maxy); AGXG.Point p2 = new AGXG.Point(); p2.SetCoordinates(record.BoundingBox.Maxx, record.BoundingBox.Miny); AGXG.Point p3 = new AGXG.Point(); p3.SetCoordinates(record.BoundingBox.Minx, record.BoundingBox.Miny); AGXG.Point p4 = new AGXG.Point(); p4.SetCoordinates(record.BoundingBox.Minx, record.BoundingBox.Maxy); AGXG.Polygon footPrint = new AGXG.Polygon(); footPrint.AddPoint(p1); footPrint.AddPoint(p2); footPrint.AddPoint(p3); footPrint.AddPoint(p4); footPrint.AddPoint(p1); return footPrint; }
/// <summary> /// Event handler for remove from map clicked. /// </summary> /// <param name="param1">The sender object</param> /// <param name="param1">The event arguments</param> /* private void zoomToLayerToolStripMenuItem1_Click(object sender, EventArgs e) { ZoomToLayer_Clicked(); }*/ /// <summary> /// Function to zoom to layer from map. /// </summary> private void ZoomToLayer_Clicked() { if (lstSearchResults.Items.Count == 0) { MessageBox.Show(resourceManager.GetString("layerNotAdded"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { AGXM.ServiceLayer resultLayer = (AGXM.ServiceLayer)addedLayer[lstSearchResults.SelectedItem.GetHashCode()]; if (resultLayer == null) { MessageBox.Show(resourceManager.GetString("layerNotfoundToZoom"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (resultLayer.IsConnected) { AGXG.Envelope envelope = new AGXG.Envelope(); envelope.XMin = resultLayer.Extent.XMin; envelope.YMin = resultLayer.Extent.YMin; envelope.XMax = resultLayer.Extent.XMax; envelope.YMax = resultLayer.Extent.YMax; // View3D currView = (View3D)taskUI.E2.CurrentView; // currView.DoActionOnGeometry(esriE2GeometryAction.Zoom, envelope); TODO AGXM.MapDisplay md = AGX.Application.ActiveMapDisplay; md.ZoomTo(envelope); } else { //nothing } } catch (Exception ex) { MessageBox.Show(resourceManager.GetString("layerZoomFailed"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }