private void DrawSymbolsInOrder(IFeatureCursor Cursor, esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
		{
			// this sub draws either markers or line symbols from large small so that the smallest symbols will be drawn on top

			// in graduated symbol case, a cursor is built and parsed n times for n size classes
			// in proportional symbol case, symbols are sorted and drawn from largest to smallest

			int iSizeIndex = 0;
			int iCurrentDrawableSymbolIndex = 0;
			IFeatureCursor pMyCursor = null;
			IFeature pFeat = null;
			IFeatureDraw pFeatDraw = null;
			bool bContinue = true;
			ISymbol pSizeSym = null;
			ISymbol pDrawSym = null;
			IFeatureCursor pSortedCursor = null;

			if (m_pSizeRend is IProportionalSymbolRenderer)
			{
				// sort 
				pSortedCursor = SortData(Cursor, trackCancel);

				// draw
				pFeat = pSortedCursor.NextFeature();
				while (pFeat != null)
				{
					pDrawSym = GetFeatureSymbol(pFeat);
					// draw the feature
					pFeatDraw = pFeat as IFeatureDraw;
					Display.SetSymbol(pDrawSym);

          //implementation of IExportSupport
          BeginFeature(pFeat, Display);
          					
					pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);

          //implementation of IExportSupport
          GenerateExportInfo(pFeat, Display);
          EndFeature(Display);
					
					// get next feature
					pFeat = pSortedCursor.NextFeature();
					if (trackCancel != null)
							bContinue = trackCancel.Continue();
				}

			}
			else
			{
				IClassBreaksRenderer pSizeCBRend = null;
                pSizeCBRend = m_pSizeRend as IClassBreaksRenderer;
				pMyCursor = Cursor;
				for (iCurrentDrawableSymbolIndex = (pSizeCBRend.BreakCount - 1); iCurrentDrawableSymbolIndex >= 0; iCurrentDrawableSymbolIndex--)
				{
					// do not build a cursor the 1st time because we already have one
					if (iCurrentDrawableSymbolIndex < (pSizeCBRend.BreakCount - 1))
					{
						// build pMyCursor
						pMyCursor = m_pFeatureClass.Search(m_pQueryFilter, true);
					}
					pFeat = pMyCursor.NextFeature();
					while (pFeat != null)
					{
						// check to see if we will draw in this pass
						pSizeSym = m_pSizeRend.get_SymbolByFeature(pFeat);
						iSizeIndex = GetSymbolIndex(pSizeSym, pSizeCBRend);
						if (iSizeIndex == iCurrentDrawableSymbolIndex)
						{
							// go ahead and draw the symbol
							// get symbol to draw
							pDrawSym = GetFeatureSymbol(pFeat);

							// draw the feature
							pFeatDraw = pFeat as IFeatureDraw;
							Display.SetSymbol(pDrawSym);

              //implementation of IExportSupport
              BeginFeature(pFeat, Display);
							
							pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);

              //implementation of IExportSupport
              GenerateExportInfo(pFeat, Display);
              EndFeature(Display);
              
							if (trackCancel != null)
									bContinue = trackCancel.Continue();
						}

						pFeat = pMyCursor.NextFeature();
					}

				} // increment DOWN to next symbol size

			}

		}
Exemplo n.º 2
0
 public override void Draw(esriDrawPhase drawPhase, IDisplay display, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
 {
     //var png = @"D:\\aaa\\0.png";
     //var ul = new PointClass { X = -20037508.342789, Y = 20037508.342789 };
     //var lr = new PointClass { X = 20037508.342789, Y = -20037508.342789 };
     //ImageDrawer.Draw(display, png,ul,lr);
 }
		private void DrawSymbols(IFeatureCursor Cursor, esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
		{

			IFeature pFeat = null;
			IFeatureDraw pFeatDraw = null;
			bool bContinue = true;
			ISymbol pDrawSym = null;

			pFeat = Cursor.NextFeature();
			bContinue = true;
			// while there are still more features and drawing has not been cancelled
			while ((pFeat != null) & (bContinue == true))
			{
				// get symbol to draw
				pDrawSym = GetFeatureSymbol(pFeat);
				// draw the feature
				pFeatDraw = pFeat as IFeatureDraw;
				Display.SetSymbol(pDrawSym);

        //implementation of IExportSupport
        BeginFeature(pFeat, Display);
        
				pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);

        //implementation of IExportSupport
        GenerateExportInfo(pFeat, Display);
        EndFeature(Display);
        
				// get next feature
				pFeat = Cursor.NextFeature();
				if (trackCancel != null)
						bContinue = trackCancel.Continue();
			}

		}
Exemplo n.º 4
0
        public override void Draw(esriDrawPhase drawPhase, IDisplay display, ITrackCancel trackCancel)
        {
            if (drawPhase == esriDrawPhase.esriDPGeography)
            {
                if (Visible)
                {
                    var mxdoc         = (IMxDocument)_application.Document;
                    var map           = mxdoc.FocusMap;
                    var activeView    = map as IActiveView;
                    var tileInfosMeta = TileCalculator.GetTiles(activeView, _tileSource);
                    tileInfos = tileInfosMeta.Tiles;
                    tiles     = new Dictionary <TileInfo, List <VectorTileLayer> >();

                    Logger.Debug("Mapbox vector tile, number of tiles: " + tileInfos.Count);
                    Logger.Debug("Mapbox vector tile, start downloading...");

                    var downloadFinished = new ManualResetEvent(false);
                    var t = new Thread(DownloadTiles);
                    t.Start(downloadFinished);
                    downloadFinished.WaitOne();
                    Logger.Debug("Mapbox vector tile, downloading finished.");
                    Logger.Debug("Mapbox vector tile, start drawing ...");

                    foreach (var tile in tiles)
                    {
                        DrawVectorTile(display, tile);
                    }
                    Logger.Debug("Mapbox vector tile, drawing finished.");
                }
            }
        }
Exemplo n.º 5
0
 bool IFeatureRenderer.get_RenderPhase(esriDrawPhase DrawPhase)
 {
     if (DrawPhase != esriDrawPhase.esriDPAnnotation)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 6
0
        void IFeatureRenderer.Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
        {
            Display.SetSymbol(sym);
            IFeature f = cursor.NextFeature();

            while (f != null)
            {
                IFeatureDraw fd = f as IFeatureDraw;
                fd.Draw(DrawPhase, Display, sym, true, f.Shape, esriDrawStyle.esriDSNormal);
                f = cursor.NextFeature();
            }
        }
Exemplo n.º 7
0
        //Draw Symbols by features
        public void Draw(IFeatureCursor pFCursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
        {
            IFeatureCursor pOriCursor = pFCursor;

            IFeature pFeat = null;

            // do not draw features if no display
            if (Display == null)
            {
                return;
            }

            ILineFillSymbol pLineFillSym = new LineFillSymbolClass();

            pFeat = pFCursor.NextFeature();
            double dblInstantSep = (dblFromSep - dblToSep) / Convert.ToDouble(intUncernBreakCount - 2);

            int i = 0;

            //Start Loop
            while (pFeat != null)
            {
                IFeatureDraw pFeatDraw = (IFeatureDraw)pFeat;
                pLineFillSym                  = new LineFillSymbolClass();
                pLineFillSym.Angle            = dblAngle;
                pLineFillSym.Color            = pLineColor;
                pLineFillSym.LineSymbol.Width = dblLinewidth;

                if (Math.Round(arrRobustness[i], intRoundingDigits) == 1)
                {
                    pLineFillSym.Separation = double.MaxValue;
                }
                else
                {
                    for (int j = 0; j < intUncernBreakCount - 1; j++)
                    {
                        if (arrRobustness[i] >= arrRobustBrks[j] && arrRobustness[i] <= arrRobustBrks[j + 1])
                        {
                            pLineFillSym.Separation = dblToSep + (dblInstantSep * Convert.ToDouble(j));
                        }
                    }
                }


                Display.SetSymbol((ISymbol)pLineFillSym);
                pFeatDraw.Draw(esriDrawPhase.esriDPGeography, Display, (ISymbol)pLineFillSym, true,
                               null, esriDrawStyle.esriDSNormal);
                i++;
                pFeat = pFCursor.NextFeature();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Draw feture (Paolo, march 2007)
        /// </summary>
        /// <param name="drawPhase"></param>
        /// <param name="Display"></param>
        /// <param name="Symbol"></param>
        /// <param name="symbolInstalled"></param>
        /// <param name="Geometry"></param>
        /// <param name="DrawStyle"></param>
        public void Draw(esriDrawPhase drawPhase, IDisplay Display, ISymbol Symbol, bool symbolInstalled, IGeometry Geometry, esriDrawStyle DrawStyle)
        {
            // This if-statement might not be necessary.  The proper
            // filtering may have already occurred before this.

            //Paolo : remove this filter, without it selection should work

            /*
             * if (!(drawPhase == esriDrawPhase.esriDPGeography && DrawStyle == esriDrawStyle.esriDSNormal)) return;
             */

            if (Shape == null)
            {
                return;
            }

            Display.SetSymbol(Symbol);
            postGisFeatureClass.layerHelper.draw(Display, Shape);
        }
Exemplo n.º 9
0
        public override void Draw(esriDrawPhase drawPhase, IDisplay display, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
        {
            var file = @"D:\aaa\strava_issue\2016_1350.png";

            var rl = new RasterLayerClass();

            rl.CreateFromFilePath(file);
            var props = (IRasterProps)rl.Raster;

            props.SpatialReference = new SpatialReferences().GetSpatialReference("urn: ogc:def: crs:EPSG: 6.18.3:3857");
            IRasterGeometryProc3 rasterGeometryProc = new RasterGeometryProcClass();
            var missing = Type.Missing;
            var layerSpatialReference = sp;

            rasterGeometryProc.ProjectFast(layerSpatialReference, rstResamplingTypes.RSP_NearestNeighbor, ref missing, rl.Raster);

            // fix 9/10/2015: with projected tiles color changes and transparency is ignored.
            var image = new Bitmap(file, true);
            // image.MakeTransparent(Color.White);
            //image.Save(@"D:\aaa\strava_issue\2018_1350.png");
            var format = image.PixelFormat;

            if (format == PixelFormat.Format24bppRgb | format == PixelFormat.Format32bppArgb)
            {
                var rasterRgbRenderer = new RasterRGBRendererClass();
                ((IRasterStretch2)rasterRgbRenderer).StretchType = esriRasterStretchTypesEnum.esriRasterStretch_NONE;
                // ((IRasterStretch3)rasterRgbRenderer).UseGamma = true;
                ((IRasterStretch2)rasterRgbRenderer).Background = true;
                ((IRasterStretch3)rasterRgbRenderer).UseGamma   = true;
                var r = new RgbColorClass();
                r.Red   = 49;
                r.Green = 0;
                r.Blue  = 38;
                ((IRasterStretch2)rasterRgbRenderer).BackgroundColor = r;
                //((IRasterStretch2)rasterRgbRenderer).BackgroundColor = r;

                rl.Renderer = rasterRgbRenderer;
            }
            // end fix 9/10/2015: with projected tiles color changes and transparency is ignored.

            rl.Draw(esriDrawPhase.esriDPGeography, display, null);
        }
Exemplo n.º 10
0
        public override void Draw(esriDrawPhase drawPhase, IDisplay display, ITrackCancel trackCancel)
        {
            switch (drawPhase)
            {
            case esriDrawPhase.esriDPGeography:
                if (Valid)
                {
                    if (Visible)
                    {
                        Logger.Debug("Draw event Layer name: " + Name);
                        var activeView   = (IActiveView)_map;
                        var clipEnvelope = display.ClipEnvelope;
                        Logger.Debug("Layer spatial reference: " + SpatialReference.FactoryCode);
                        Logger.Debug("Map spatial reference: " + _map.SpatialReference.FactoryCode);
                        var mapWidth   = activeView.ExportFrame.right;
                        var resolution = clipEnvelope.GetMapResolution(mapWidth);
                        var ext        = new Extent(clipEnvelope.XMin, clipEnvelope.YMin, clipEnvelope.XMax, clipEnvelope.YMax);
                        //_fetcher.ViewChanged(ext, resolution);
                        //_simplefilefetcher.Fetch(ext,resolution);
                        var level     = Utilities.GetNearestLevel(_tileSource.Schema.Resolutions, resolution);
                        var tileInfos = _tileSource.Schema.GetTilesInView(ext, level);
                        // tileInfos = SortByPriority(tileInfos, ext.CenterX, ext.CenterY);

                        foreach (var tileInfo in tileInfos)
                        {
                            var tile = _fileCache.Find(tileInfo.Index);
                            if (tile != null)
                            {
                                var filename = _fileCache.GetFileName(tileInfo.Index);
                                DrawRaster(filename, display);
                            }
                        }
                    }
                }
                break;

            case esriDrawPhase.esriDPAnnotation:
                break;
            }
        }
Exemplo n.º 11
0
        //Draw Symbols by features
        public void Draw(IFeatureCursor pFCursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
        {
            pFCursor = m_pFeatureClass.Search(m_pQueryFilter, true);
            clsSnippet pSnippet = new clsSnippet();

            IFeature pFeature = pFCursor.NextFeature();

            double dblValue    = 0;
            double dblUncern   = 0;
            double dblInterval = 0;

            IStackedChartSymbol barChartSymbol;
            IChartSymbol        chartSymbol;

            while (pFeature != null)
            {
                IFeatureDraw pFeatDraw = (IFeatureDraw)pFeature;

                dblValue  = Convert.ToDouble(pFeature.get_Value(intValueFldIdx));
                dblUncern = Convert.ToDouble(pFeature.get_Value(intUncerFldIdx));

                dblInterval = dblError * dblUncern;


                barChartSymbol = new StackedChartSymbolClass();

                barChartSymbol.Width = 10;

                if (bln3Dfeature)
                {
                    I3DChartSymbol p3DChartSymbol = barChartSymbol as I3DChartSymbol;
                    p3DChartSymbol.Display3D = true;
                    p3DChartSymbol.Thickness = 3;
                }

                //IMarkerSymbol markerSymbol = barChartSymbol as IMarkerSymbol;
                //markerSymbol.Size = 50;
                chartSymbol          = barChartSymbol as IChartSymbol;
                chartSymbol.MaxValue = dblMaxValue;


                ISymbolArray symbolArray = barChartSymbol as ISymbolArray;
                //Upper Error Symbol
                IFillSymbol fillSymbol = new SimpleFillSymbolClass();
                fillSymbol.Color         = pSnippet.getRGB(0, 0, 255);
                fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
                symbolArray.AddSymbol(fillSymbol as ISymbol);
                chartSymbol.set_Value(0, dblInterval);

                //Lower Error
                fillSymbol               = new SimpleFillSymbolClass();
                fillSymbol.Color         = pSnippet.getRGB(255, 0, 0);
                fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
                symbolArray.AddSymbol(fillSymbol as ISymbol);
                chartSymbol.set_Value(1, dblInterval);

                //Value -Error to represent mean value
                fillSymbol               = new SimpleFillSymbolClass();
                fillSymbol.Color         = pSnippet.getRGB(255, 255, 255);
                fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
                symbolArray.AddSymbol(fillSymbol as ISymbol);
                chartSymbol.set_Value(2, dblValue - dblInterval);
                Display = m_pDisplay;
                Display.SetSymbol((ISymbol)chartSymbol);
                DrawPhase = esriDrawPhase.esriDPGeography;
                pFeatDraw.Draw(DrawPhase, Display, (ISymbol)chartSymbol, true,
                               null, esriDrawStyle.esriDSNormal);
                pFeature = pFCursor.NextFeature();
            }
        }
Exemplo n.º 12
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;
            }
        }
 /// <summary>
 /// Draws the layer to the specified display for the given draw phase.
 /// </summary>
 /// <param name="drawPhase"></param>
 /// <param name="Display"></param>
 /// <param name="trackCancel"></param>
 /// <remarks>This method draws the layer to the Display for the specified DrawPhase.
 /// Use the TrackCancel object to allow the drawing of the layer to be interrupted by the user.</remarks>
 public virtual void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     return;
 }
		public void Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
		{
			string ActiveErrorHandler = null;

	try
	{
			// loop through and draw each feature

			IFeature pFeat = null;
			IFeatureRenderer pRend = null;

			bool bContinue = false;

			// do not draw features if no display
			if (Display == null)
				return;

			// we can't draw without somewhere to get our base symbols from
			if (m_pMainRend == null)
				return;

			if (m_pSizeRend != null)
			{
				// size varies
				if (m_ShapeType == esriGeometryType.esriGeometryPoint | m_ShapeType == esriGeometryType.esriGeometryPolyline)
				{
					if (DrawPhase == esriDrawPhase.esriDPGeography)
					{
						// draw symbols in order from large to small
						DrawSymbolsInOrder(cursor, DrawPhase, Display, trackCancel);
					}
				}
				else if (m_ShapeType == esriGeometryType.esriGeometryPolygon)
				{
					if (DrawPhase == esriDrawPhase.esriDPAnnotation)
					{
						// draw primary symbology from large to small
						DrawSymbolsInOrder(cursor, DrawPhase, Display, trackCancel);
					}
					else if (DrawPhase == esriDrawPhase.esriDPGeography)
					{
						// draw background symbology
						pFeat = cursor.NextFeature();
						bContinue = true;

						// while there are still more features and drawing has not been cancelled
                        IFillSymbol pBackFillSym;

                        
						while ((pFeat != null) & (bContinue == true))
						{
							// draw the feature
                            IFeatureDraw pFeatDraw = pFeat as IFeatureDraw;
							if (m_pSizeRend is IClassBreaksRenderer)
							{
                                IClassBreaksRenderer pCBRend = m_pSizeRend as IClassBreaksRenderer;
								pBackFillSym = pCBRend.BackgroundSymbol;
							}
							else
							{
                                IProportionalSymbolRenderer pPropRend = m_pSizeRend as IProportionalSymbolRenderer;
								pBackFillSym = pPropRend.BackgroundSymbol;
							}
							Display.SetSymbol(pBackFillSym as ISymbol);

              //implementation of IExportSupport
              BeginFeature(pFeat, Display);
              
							pFeatDraw.Draw(DrawPhase, Display, pBackFillSym as ISymbol, true, null, esriDrawStyle.esriDSNormal);

              //implementation of IExportSupport
							GenerateExportInfo(pFeat, Display);
							EndFeature(Display);
							
							pFeat = cursor.NextFeature();
              if (trackCancel != null)
                bContinue = trackCancel.Continue();
						}
					}
					else
					{
                        Marshal.ThrowExceptionForHR(147500037); //E_FAIL
					}
				}

			}
			else
			{
				// size does not vary
				if (DrawPhase != esriDrawPhase.esriDPGeography)
				{
                    Marshal.ThrowExceptionForHR(147500037); //E_FAIL
				}
				else
					DrawSymbols(cursor, DrawPhase, Display, trackCancel);
			}

}

catch
{
}
		}
Exemplo n.º 15
0
 void IFeatureRenderer.Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     ((IFeatureRenderer)uvr).Draw(cursor, DrawPhase, Display, trackCancel);
 }
Exemplo n.º 16
0
 void IGeoFeatureLayer.Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     ((IGeoFeatureLayer)featureLayer).Draw(drawPhase, Display, trackCancel);
 }
Exemplo n.º 17
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;
            }
        }
    /// <summary>
    /// Draws the layer to the specified display for the given draw phase.
    /// </summary>
    /// <param name="drawPhase"></param>
    /// <param name="Display"></param>
    /// <param name="trackCancel"></param>
    /// <remarks>This method draws the layer to the Display for the specified DrawPhase. 
    /// Use the TrackCancel object to allow the drawing of the layer to be interrupted by the user.</remarks>
    public virtual void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
    {

      return;
    }
Exemplo n.º 19
0
 bool IFeatureRenderer.get_RenderPhase(esriDrawPhase DrawPhase)
 {
     if (DrawPhase != esriDrawPhase.esriDPAnnotation)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 20
0
 void IFeatureRenderer.Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     Display.SetSymbol(sym);
     IFeature f = cursor.NextFeature();
     while (f != null)
     {
         IFeatureDraw fd = f as IFeatureDraw;
         fd.Draw(DrawPhase, Display, sym, true, f.Shape, esriDrawStyle.esriDSNormal);
         f = cursor.NextFeature();
     }
 }
Exemplo n.º 21
0
 bool IFeatureRenderer.get_RenderPhase(esriDrawPhase DrawPhase)
 {
     return ((IFeatureRenderer)uvr).get_RenderPhase(DrawPhase);
 }
 public bool get_RenderPhase(esriDrawPhase DrawPhase)
 {
     return (DrawPhase == esriDrawPhase.esriDPGeography) | (DrawPhase == esriDrawPhase.esriDPAnnotation);
 }
    /// <summary>
    /// Draws the layer to the specified display for the given draw phase. 
    /// </summary>
    /// <param name="drawPhase"></param>
    /// <param name="Display"></param>
    /// <param name="trackCancel"></param>
    /// <remarks>the draw method is set as an abstract method and therefore must be overridden</remarks>
		public override void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
		{
			if(drawPhase != esriDrawPhase.esriDPGeography) return;
			if(Display == null) return;
			if(m_table == null || m_symbolTable == null) return;

			m_display = Display;
			
			IEnvelope envelope = Display.DisplayTransformation.FittedBounds as IEnvelope;	
			
			double lat, lon;
			int iconCode;
			bool selected;
			ISymbol symbol = null;

			//loop through the rows. Draw each row that has a shape
			foreach (DataRow row in m_table.Rows)
			{
				//get the Lat/Lon of the item
				lat = Convert.ToDouble(row[3]);
				lon = Convert.ToDouble(row[4]);
				//get the icon ID
				iconCode = Convert.ToInt32(row[8]);

				//get the selection state of the item
				selected = Convert.ToBoolean(row[13]);
				
				if(lon >= envelope.XMin && lon <= envelope.XMax && lat >= envelope.YMin && lat <= envelope.YMax) 
				{	
					//search for the symbol in the symbology table
					symbol = GetSymbol(iconCode, row);
					if(null == symbol)
						continue;

          m_point.X = lon;
          m_point.Y = lat;
          m_point.SpatialReference = m_spatialRef;

					//reproject the point to the DataFrame's spatial reference
					if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
            m_point.Project(m_mapSpatialRef);

					Display.SetSymbol(symbol);
          Display.DrawPoint(m_point);

					if(selected)
					{
						Display.SetSymbol(m_selectionSymbol);
            Display.DrawPoint(m_point);
					}
				}
			}
		}
Exemplo n.º 24
0
		/// <summary>
		/// Draw feture (Paolo, march 2007)
		/// </summary>
		/// <param name="drawPhase"></param>
		/// <param name="Display"></param>
		/// <param name="Symbol"></param>
		/// <param name="symbolInstalled"></param>
		/// <param name="Geometry"></param>
		/// <param name="DrawStyle"></param>
        public void Draw(esriDrawPhase drawPhase, IDisplay Display, ISymbol Symbol, bool symbolInstalled, IGeometry Geometry, esriDrawStyle DrawStyle)
        {
            // This if-statement might not be necessary.  The proper
            // filtering may have already occurred before this.

			//Paolo : remove this filter, without it selection should work
			/*
            if (!(drawPhase == esriDrawPhase.esriDPGeography && DrawStyle == esriDrawStyle.esriDSNormal)) return;
			*/

            if (Shape == null) return;

            Display.SetSymbol(Symbol);
            postGisFeatureClass.layerHelper.draw(Display, Shape);
        }
Exemplo n.º 25
0
 //Draw Symbols by features
 public void Draw(IFeatureCursor pFCursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     // NOT IMPL
 }
Exemplo n.º 26
0
 bool IFeatureRenderer.get_RenderPhase(esriDrawPhase DrawPhase)
 {
     return(((IFeatureRenderer)uvr).get_RenderPhase(DrawPhase));
 }
Exemplo n.º 27
0
        public override void Draw(esriDrawPhase drawPhase, IDisplay display, ITrackCancel trackCancel)
        {
            switch (drawPhase)
            {
                case esriDrawPhase.esriDPGeography:
                    if (Valid)
                    {
                        if (Visible)
                        {
                                Logger.Debug("Draw event Layer name: " + Name);
                                var activeView = (IActiveView)_map;
                                var clipEnvelope = display.ClipEnvelope;
                                Logger.Debug("Layer spatial reference: " + SpatialReference.FactoryCode);
                                Logger.Debug("Map spatial reference: " + _map.SpatialReference.FactoryCode);
                                var mapWidth = activeView.ExportFrame.right;
                                var resolution = clipEnvelope.GetMapResolution(mapWidth);
                                var ext = new Extent(clipEnvelope.XMin, clipEnvelope.YMin, clipEnvelope.XMax, clipEnvelope.YMax);
                                //_fetcher.ViewChanged(ext, resolution);
                                _simplefilefetcher.Fetch(ext,resolution);
                                var level = Utilities.GetNearestLevel(_tileSource.Schema.Resolutions, resolution);
                                var tileInfos = _tileSource.Schema.GetTilesInView(ext, level);
                                tileInfos = SortByPriority(tileInfos, ext.CenterX, ext.CenterY);

                                foreach (var tileInfo in tileInfos)
                                {
                                    var tile = _fileCache.Find(tileInfo.Index);
                                    if (tile != null)
                                    {
                                        var filename = _fileCache.GetFileName(tileInfo.Index);
                                        DrawRaster(filename, display);
                                    }
                                }

                        }
                    }
                    break;
                case esriDrawPhase.esriDPAnnotation:
                    break;
            }
        }
Exemplo n.º 28
0
 void IFeatureRenderer.Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
 {
     ((IFeatureRenderer)uvr).Draw(cursor, DrawPhase, Display, trackCancel);
 }