Example #1
0
        private void DisplayIndexResult(IMonitoringSubProduct subProduct, string name, IPixelIndexMapper pixelIndexMapper, IRasterDataProvider dataProvider)
        {
            ICanvasViewer cv = _session.SmartWindowManager.ActiveCanvasViewer;

            if (cv == null)
            {
                return;
            }
            using (IBinaryBitmapBuilder builder = new BinaryBitmapBuilder())
            {
                Size   bmSize       = new Size(dataProvider.Width, dataProvider.Height);
                Color  productColor = GetBinaryColor(subProduct);
                Bitmap bitmap       = builder.CreateBinaryBitmap(bmSize, productColor, Color.Transparent);
                int[]  indexes      = pixelIndexMapper.Indexes.ToArray();
                builder.Fill(indexes, new Size(dataProvider.Width, dataProvider.Height), ref bitmap);
                //
                IBinaryBitampLayer layer = cv.Canvas.LayerContainer.GetByName(name) as IBinaryBitampLayer;
                if (layer == null)
                {
                    layer = new BinaryBitmapLayer(name, bitmap, GetCoordEnvelope(dataProvider), dataProvider.CoordType == enumCoordType.GeoCoord);
                    cv.Canvas.LayerContainer.Layers.Add(layer);
                }
                else
                {
                    layer.Bitmap = bitmap;
                }
                cv.Canvas.Refresh(Core.DrawEngine.enumRefreshType.All);
            }
        }
Example #2
0
        private IBinaryBitampLayer GetBinaryLayer(ICanvasViewer cv, IRasterDataProvider dataProvider, IMonitoringProduct product, IMonitoringSubProduct subProduct)
        {
            string name         = GetName(product, subProduct);
            Size   bmSize       = new Size(dataProvider.Width, dataProvider.Height);
            Color  productColor = GetBinaryColor(subProduct);

            using (IBinaryBitmapBuilder builder = new BinaryBitmapBuilder())
            {
                Bitmap             bitmap = builder.CreateBinaryBitmap(bmSize, productColor, Color.Transparent);
                IBinaryBitampLayer layer  = cv.Canvas.LayerContainer.GetByName(name) as IBinaryBitampLayer;
                if (layer != null)
                {
                    cv.Canvas.LayerContainer.Layers.Remove(layer);
                    layer.Dispose();
                }
                layer = new BinaryBitmapLayer(name, bitmap, GetCoordEnvelope(dataProvider), dataProvider.CoordType == enumCoordType.GeoCoord);
                cv.Canvas.LayerContainer.Layers.Add(layer);
                return(layer);
            }
        }