Draw() public method

public Draw ( IStepProgressor stepProgressor, IActiveView activeView, FileCache fileCache, ITrackCancel trackCancel, ISpatialReference layerSpatialReference, string &currentLevel, ITileSource tileSource, IDisplay display ) : void
stepProgressor IStepProgressor
activeView IActiveView
fileCache FileCache
trackCancel ITrackCancel
layerSpatialReference ISpatialReference
currentLevel string
tileSource ITileSource
display IDisplay
return void
Ejemplo n.º 1
0
        public void Draw(esriDrawPhase drawPhase, IDisplay display, ITrackCancel trackCancel)
        {
            switch (drawPhase)
            {
            case esriDrawPhase.esriDPGeography:
                if (Valid)
                {
                    if (Visible)
                    {
                        try
                        {
                            var clipEnvelope = display.ClipEnvelope;

                            // when loading from a file the active map doesn't exist yet
                            // so just deal with it here.
                            if (_map == null)
                            {
                                var mxdoc = (IMxDocument)_application.Document;
                                _map = mxdoc.FocusMap;
                            }

                            Debug.WriteLine("Draw event");
                            var activeView = _map as IActiveView;
                            Logger.Debug("Layer name: " + Name);

                            if (activeView != null)
                            {
                                //_envelope = activeView.Extent;
                                //_envelope = clipEnvelope;

                                Logger.Debug("Draw extent: xmin:" + clipEnvelope.XMin +
                                             ", ymin:" + clipEnvelope.YMin +
                                             ", xmax:" + clipEnvelope.XMax +
                                             ", ymax:" + clipEnvelope.YMax
                                             );
                                if (SpatialReference != null)
                                {
                                    Logger.Debug("Layer spatial reference: " + SpatialReference.FactoryCode);
                                }
                                if (_map.SpatialReference != null)
                                {
                                    Logger.Debug("Map spatial reference: " + _map.SpatialReference.FactoryCode);
                                }

                                var bruTileHelper = new BruTileHelper(_tileTimeOut);
                                _displayFilter.Transparency = (short)(255 - ((_transparency * 255) / 100));
                                if (display.Filter == null)
                                {
                                    display.Filter = _displayFilter;
                                }

                                FileCache fileCache;

                                if (_config != null)
                                {
                                    fileCache = CacheDirectory.GetFileCache(_cacheDir, _config, _enumBruTileLayer);
                                }
                                else
                                {
                                    fileCache = CacheDirectory.GetFileCache(_cacheDir, _tileSource, _enumBruTileLayer);
                                }

                                if (_enumBruTileLayer == EnumBruTileLayer.Giscloud &&
                                    _config.CreateTileSource().Schema.Format == "jpg")
                                {
                                    // potential black borders: need to add a check for clip....
                                    bruTileHelper.ClipTilesEnvelope = _envelope;
                                }
                                bruTileHelper.Draw(_application.StatusBar.ProgressBar, activeView, fileCache, trackCancel, SpatialReference, ref _currentLevel, _tileSource, display, _auth);
                            }
                        }
                        catch (Exception ex)
                        {
                            var mbox = new ExceptionMessageBox(ex);
                            mbox.Show(null);
                        }
                    }  // isVisible
                }      // isValid
                break;

            case esriDrawPhase.esriDPAnnotation:
                break;
            }
        }
Ejemplo n.º 2
0
        public void Draw(esriDrawPhase drawPhase, IDisplay display, ITrackCancel trackCancel)
        {
            switch (drawPhase)
            {
                case esriDrawPhase.esriDPGeography:
                    if (Valid)
                    {
                        if (Visible)
                        {
                            try
                            {
                                var clipEnvelope = display.ClipEnvelope;

                                // when loading from a file the active map doesn't exist yet
                                // so just deal with it here.
                                if (_map == null)
                                {
                                    var mxdoc = (IMxDocument)_application.Document;
                                    _map = mxdoc.FocusMap;
                                }

                                Debug.WriteLine("Draw event");
                                var activeView = _map as IActiveView;
                                Logger.Debug("Layer name: " + Name);

                                if (activeView != null)
                                {
                                    //_envelope = activeView.Extent;
                                    _envelope = clipEnvelope;

                                    Logger.Debug("Draw extent: xmin:" + _envelope.XMin +
                                                 ", ymin:" + _envelope.YMin +
                                                 ", xmax:" + _envelope.XMax +
                                                 ", ymax:" + _envelope.YMax
                                        );
                                    if (SpatialReference != null)
                                    {
                                        Logger.Debug("Layer spatial reference: " + SpatialReference.FactoryCode);
                                    }
                                    if (_map.SpatialReference != null)
                                    {
                                        Logger.Debug("Map spatial reference: " + _map.SpatialReference.FactoryCode);
                                    }

                                    var bruTileHelper = new BruTileHelper(_tileTimeOut);
                                    //_displayFilter.Transparency = (short)(255 - ((_transparency * 255) / 100));
                                    //if (display.Filter == null)
                                    //{
                                    //    display.Filter = _displayFilter;
                                    //}
                                    var fileCache = CacheDirectory.GetFileCache(_cacheDir,_config,_enumBruTileLayer);
                                    bruTileHelper.Draw(_application.StatusBar.ProgressBar, activeView, fileCache, trackCancel, SpatialReference, ref _currentLevel, _tileSource, display);
                                }
                            }
                            catch (Exception ex)
                            {
                                var mbox = new ExceptionMessageBox(ex);
                                mbox.Show(null);
                            }
                        } // isVisible
                    }  // isValid
                    break;
                case esriDrawPhase.esriDPAnnotation:
                    break;
            }
        }