/// <summary>
        /// draw footprints on the map
        /// </summary>
        /// <param name="record">Record for which the footprint needs to be drwan</param>
        /// <param name="refreshview">Indicates if the view is refreshed or not after the element is drawn</param>
        /// <param name="deleteelements">Indicates if the element can be deleted or not</param>
        private void drawfootprint(CswRecord record, bool refreshview, bool deleteelements)
        {
            //create the triangle outline symbol
            ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
            lineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            lineSymbol.Width = 2.0;

            //create the triangle's fill symbol
             ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            simpleFillSymbol.Outline = (ILineSymbol)lineSymbol;
            simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross;

            IMxDocument mxDoc;
            mxDoc = (IMxDocument)m_application.Document;

            //the original projection system
            ISpatialReference spatialReference;
            IGeographicCoordinateSystem geographicCoordinateSystem;
            SpatialReferenceEnvironmentClass spatialReferenceEnviorment = new SpatialReferenceEnvironmentClass();
            geographicCoordinateSystem = spatialReferenceEnviorment.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
            spatialReference = (ISpatialReference)geographicCoordinateSystem;

            //set the geometry of the element
            IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
            point.SpatialReference = spatialReference;
            point.PutCoords(record.BoundingBox.Minx, record.BoundingBox.Miny);

            IPoint point1 = new ESRI.ArcGIS.Geometry.PointClass();
            point1.SpatialReference = spatialReference;
            point1.PutCoords(record.BoundingBox.Minx, record.BoundingBox.Maxy);

            IPoint point2 = new ESRI.ArcGIS.Geometry.PointClass();
            point2.SpatialReference = spatialReference;
            point2.PutCoords(record.BoundingBox.Maxx, record.BoundingBox.Maxy);

            IPoint point3 = new ESRI.ArcGIS.Geometry.PointClass();

               point3.SpatialReference = spatialReference;
               point3.PutCoords(record.BoundingBox.Maxx, record.BoundingBox.Miny);

            IPointCollection pointCollection;
            pointCollection = new ESRI.ArcGIS.Geometry.PolygonClass();

            object x = Type.Missing;
            object y = Type.Missing;

            pointCollection.AddPoint(point, ref x, ref y);
            pointCollection.AddPoint(point1, ref x, ref y);
            pointCollection.AddPoint(point2, ref x, ref y);
            pointCollection.AddPoint(point3, ref x, ref y);

            PolygonElementClass element = new PolygonElementClass();
            element.Symbol = simpleFillSymbol;
            element.SpatialReference = spatialReference;
            element.Geometry.SpatialReference = spatialReference;
            element.Geometry = (IGeometry)pointCollection;
            element.Geometry.Project(mxDoc.ActiveView.Extent.SpatialReference);

            //add the graphics element to the map
            IGraphicsContainer graphicsContainer;
            graphicsContainer = (IGraphicsContainer)mxDoc.FocusMap;
            if (deleteelements) {
                graphicsContainer.DeleteAllElements();
            }
            graphicsContainer.AddElement(element, 0);
            if (refreshview) {
                mxDoc.ActiveView.Extent = element.Geometry.Envelope;
                mxDoc.ActiveView.Refresh();
            }
        }
        /// <summary>
        /// Event handler for "Show All Footprint" button click event
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void showAllFootprint_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                IMxDocument mxDoc;
                mxDoc = (IMxDocument)m_application.Document;

                IGraphicsContainer graphicsContainer;
                graphicsContainer = (IGraphicsContainer)mxDoc.FocusMap;
                BoundingBox currentExtent = new BoundingBox();
                currentExtent.Maxx = mxDoc.ActiveView.Extent.XMax;
                currentExtent.Minx = mxDoc.ActiveView.Extent.XMin;
                currentExtent.Maxy = mxDoc.ActiveView.Extent.YMax;
                currentExtent.Miny = mxDoc.ActiveView.Extent.YMin;
                BoundingBox newExtent = currentExtent;
                if (showAll)
                {
                    showAll = false;
                    System.Windows.Forms.ToolTip toolTipForshowAll = new System.Windows.Forms.ToolTip();
                    toolTipForshowAll.SetToolTip(showAllFootprintToolStripButton, StringResources.hideAllFootprintTooltip);
                    //showAllFootprintToolStripButton = StringResources.hideAllFootprintTooltip;
                    showAllFootprintToolStripButton.Image = StringResources.hideAll;
                    foreach (Object obj in resultsListBox.Items)
                    {
                        currentExtent = newExtent;
                        CswRecord record = (CswRecord)obj;
                        if (record.BoundingBox.Maxx != NONEXSISTANTNUMBER)
                        {
                            drawfootprint(record, true, false);
                            newExtent = updatedExtent(currentExtent, record.BoundingBox);
                        }
                    }
                    IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
                    point.PutCoords(newExtent.Minx, newExtent.Maxy);

                    IPoint point1 = new ESRI.ArcGIS.Geometry.PointClass();
                    point1.PutCoords(newExtent.Maxx, newExtent.Maxy);

                    IPoint point2 = new ESRI.ArcGIS.Geometry.PointClass();
                    point2.PutCoords(newExtent.Maxx, newExtent.Miny);

                    IPoint point3 = new ESRI.ArcGIS.Geometry.PointClass();
                    point3.PutCoords(newExtent.Minx, newExtent.Miny);

                    IPointCollection pointCollection;
                    pointCollection = new ESRI.ArcGIS.Geometry.PolygonClass();

                    object x = Type.Missing;
                    object y = Type.Missing;

                    pointCollection.AddPoint(point, ref x, ref y);
                    pointCollection.AddPoint(point1, ref x, ref y);
                    pointCollection.AddPoint(point2, ref x, ref y);
                    pointCollection.AddPoint(point3, ref x, ref y);

                    PolygonElementClass element = new PolygonElementClass();
                    element.Geometry = (IGeometry)pointCollection;

                    graphicsContainer = (IGraphicsContainer)mxDoc.FocusMap;
                    mxDoc.ActiveView.Extent = element.Geometry.Envelope;
                    mxDoc.ActiveView.Refresh();
                }
                else
                {
                    showAll = true;
                    System.Windows.Forms.ToolTip toolTipForshowAll = new System.Windows.Forms.ToolTip();
                    toolTipForshowAll.SetToolTip(showAllFootprintToolStripButton, StringResources.showAllFootPrintToolTip);
                    showAllFootprintToolStripButton.Image = StringResources.showAll;
                    deleteelements();

                }
                mxDoc.ActiveView.Refresh();
            }
            catch (Exception ex)
            {

                ShowErrorMessageBox(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        /// <summary>
        /// Event handler for "Display Footprint" button click event
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>  
        private void displayFootprinttoolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                CswRecord record = (CswRecord)(resultsListBox.SelectedItem);
                drawfootprint(record, false, false);
                //add the graphics element to the map
                IMxDocument mxDoc;
                mxDoc = (IMxDocument)m_application.Document;

                IGraphicsContainer graphicsContainer;
                graphicsContainer = (IGraphicsContainer)mxDoc.FocusMap;
                BoundingBox currentExtent = new BoundingBox();
                currentExtent.Maxx = mxDoc.ActiveView.Extent.XMax;
                currentExtent.Minx = mxDoc.ActiveView.Extent.XMin;
                currentExtent.Maxy = mxDoc.ActiveView.Extent.YMax;
                currentExtent.Miny = mxDoc.ActiveView.Extent.YMin;
                BoundingBox newExtent = updatedExtent(currentExtent, record.BoundingBox);

                IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
                point.PutCoords(newExtent.Minx, newExtent.Maxy);

                IPoint point1 = new ESRI.ArcGIS.Geometry.PointClass();
                point1.PutCoords(newExtent.Maxx, newExtent.Maxy);

                IPoint point2 = new ESRI.ArcGIS.Geometry.PointClass();
                point2.PutCoords(newExtent.Maxx, newExtent.Miny);

                IPoint point3 = new ESRI.ArcGIS.Geometry.PointClass();

                point3.PutCoords(newExtent.Minx, newExtent.Miny);

                IPointCollection pointCollection;
                pointCollection = new ESRI.ArcGIS.Geometry.PolygonClass();

                object x = Type.Missing;
                object y = Type.Missing;
                pointCollection.AddPoint(point, ref x, ref y);
                pointCollection.AddPoint(point1, ref x, ref y);
                pointCollection.AddPoint(point2, ref x, ref y);
                pointCollection.AddPoint(point3, ref x, ref y);
                PolygonElementClass element = new PolygonElementClass();
                element.Geometry = (IGeometry)pointCollection;
                graphicsContainer = (IGraphicsContainer)mxDoc.FocusMap;
                mxDoc.ActiveView.Extent = element.Geometry.Envelope;
                mxDoc.ActiveView.Refresh();
            }
            catch (Exception ex)
            {

                ShowErrorMessageBox(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }