crdnlpwr

Map layers not drawing on refresh

Discussion created by crdnlpwr on Oct 5, 2011
Latest reply on Oct 6, 2011 by crdnlpwr
Hello,

I've created an Add-In that will zoom to a location in a user's map based off a selection from a layer in an AGS map service.  Once the user inputs their criteria, ArcMap will zoom to that location, but it will not redraw the existing layers in their map.  Any suggestions to get the existing map layers to draw would be greatly appreciated!


IGISServerConnection pGISServCon = new GISServerConnection();
            pGISServCon.Connect("myserver");
            IServerObjectManager pSOM = pGISServCon.ServerObjectManager;
            IServerContext pServerContext = pSOM.CreateServerContext("ZoomTools", "MapServer");
            IMapServer pMapServer = pServerContext.ServerObject as IMapServer;

            IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
            IMap pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);

            ILayer pFLayer = pMap.get_Layer(zoomMapServID) as ILayer;

            IFeatureLayer pFeatlayer = pFLayer as IFeatureLayer;
            IFeatureClass pFeatureClass = pFeatlayer.FeatureClass;

            IQueryFilter pQfilt = new QueryFilterClass();
            //pQfilt.WhereClause = "QS_NUMBER = '23-55'";
            pQfilt.WhereClause = zoomColumn + " = '" + textBox1.Text + "'";      


            IEnvelope pEnv = new EnvelopeClass();
            //Set envelope to the geometry collection from the method below
            pEnv = GeometryBag_Example(pFeatureClass, pQfilt).Envelope;
                     
            IMxDocument pMxd = ArcMap.Document;
           
            // Get the focus map
            IMap map = pMxd.FocusMap;

            // Cast from IMap to IActiveView
            IActiveView pActiveview = (IActiveView)map;             
            
            pActiveview.FullExtent = pEnv.Envelope;

            //zooms to the right area on the map, but will not draw existing layers in the mxd.
            pActiveview.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            

Outcomes