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); } }
private ResultObject GetResultObject(ICanvasViewer viewer, IMonitoringProduct product, IMonitoringSubProduct subProduct) { IRasterDataProvider prd = GetRasterDataProvider(viewer); IPixelIndexMapper binaryValues = GetBinaryValuesMapper(prd, product, subProduct); IBinaryBitampLayer binaryLayer = GetBinaryLayer(viewer, prd, product, subProduct); return(new ResultObject(binaryValues, binaryLayer)); }
private void UpdateLayer(ResultObject resultObject) { IPixelIndexMapper binaryValues = resultObject.BinaryValues; IBinaryBitampLayer binaryLayer = resultObject.BinaryLayer; Bitmap bitmap = binaryLayer.Bitmap; using (IBinaryBitmapBuilder builder = new BinaryBitmapBuilder()) { builder.Reset(bitmap.Size, ref bitmap); builder.Fill(binaryValues.Indexes.ToArray(), bitmap.Size, ref bitmap); } _canvasViewer.Canvas.Refresh(enumRefreshType.All); }
//闪烁判识结果 private void HandleFalsh() { string name = GetName(_currentProduct, _currentSubProduct); if (string.IsNullOrWhiteSpace(name)) { return; } IBinaryBitampLayer layer = _resultObjects[name].BinaryLayer; LayerFlashControler c = new LayerFlashControler(_canvasViewer.Canvas, layer); c.Flash(); }
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); } }
public ResultObject(IPixelIndexMapper binaryValues, IBinaryBitampLayer binaryLayer) { BinaryValues = binaryValues; BinaryLayer = binaryLayer; }