private Bitmap getSymbol(Symbol2D symbol2D) { if (symbol2D == null) { return(null); } SymbolLookupKey key = new SymbolLookupKey(symbol2D.GetHashCode()); Bitmap symbol; _symbolCache.TryGetValue(key, out symbol); if (symbol == null) { MemoryStream data = new MemoryStream(); symbol2D.SymbolData.Position = 0; using (BinaryReader reader = new BinaryReader(new NondisposingStream(symbol2D.SymbolData))) { data.Write(reader.ReadBytes((Int32)symbol2D.SymbolData.Length), 0, (Int32)symbol2D.SymbolData.Length); } symbol = new Bitmap(data); _symbolCache[key] = symbol; } return(symbol); }
public override IEnumerable <GeoJsonRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, RenderState renderState) { yield break; //TODO: }
public override IEnumerable <GdiRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbol, Symbol2D highlightSymbol, Symbol2D selectSymbol, RenderState renderState) { if (renderState == RenderState.Selected) { symbol = selectSymbol; } if (renderState == RenderState.Highlighted) { symbol = highlightSymbol; } foreach (Point2D location in locations) { Bitmap bitmapSymbol = getSymbol(symbol); if (bitmapSymbol.PixelFormat != PixelFormat.Undefined) { System.Drawing.Drawing2D.Matrix transform = ViewConverter.Convert(symbol.AffineTransform); System.Drawing.Imaging.ColorMatrix colorTransform = ViewConverter.Convert(symbol.ColorTransform); RectangleF bounds = new RectangleF(ViewConverter.Convert(location), bitmapSymbol.Size); GdiRenderObject holder = new GdiRenderObject(bitmapSymbol, bounds, transform, colorTransform); holder.State = renderState; yield return(holder); } else { Debug.WriteLine("Unkbown pixel format"); } } }
public override IEnumerable <GeoJsonRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, ColorMatrix highlight, ColorMatrix select, RenderState renderState) { yield break; //TODO: }
public override IEnumerable <RenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, Symbol2D highlightSymbolData, Symbol2D selectSymbolData, RenderState renderState) { foreach (Point2D point in locations) { RenderObject ro = new RenderObject(); ro.RenderedPaths = new Double[][] { new Double[] { point.X, point.Y } }; yield return(ro); } }
public override IEnumerable <GdiRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, StyleColorMatrix highlight, StyleColorMatrix select, RenderState renderState) { Symbol2D highlightSymbol = (Symbol2D)symbolData.Clone(); highlightSymbol.ColorTransform = highlight; Symbol2D selectSymbol = (Symbol2D)symbolData.Clone(); selectSymbol.ColorTransform = select; return(RenderSymbols(locations, symbolData, highlightSymbol, selectSymbol, renderState)); }
public override IEnumerable <String> RenderSymbols(IEnumerable <Point2D> location, Symbol2D symbolData, Symbol2D highlightSymbolData, Symbol2D selectSymbolData, RenderState renderState) { if (symbolData == null) { throw new ArgumentNullException("symbolData"); } yield return(location.ToString() + symbolData == null ? String.Empty : symbolData.ToString() + highlightSymbolData == null ? String.Empty : highlightSymbolData.ToString() + selectSymbolData == null ? String.Empty : selectSymbolData.ToString()); }
private Bitmap getSymbol(Symbol2D symbol2D) { if (symbol2D == null) { return null; } SymbolLookupKey key = new SymbolLookupKey(symbol2D.GetHashCode()); Bitmap symbol; _symbolCache.TryGetValue(key, out symbol); if (symbol == null) { lock (symbol2D) { MemoryStream data = new MemoryStream(); symbol2D.SymbolData.Position = 0; using (BinaryReader reader = new BinaryReader(new NondisposingStream(symbol2D.SymbolData))) { data.Write(reader.ReadBytes((Int32) symbol2D.SymbolData.Length), 0, (Int32) symbol2D.SymbolData.Length); } symbol = new Bitmap(data); if (symbol.PixelFormat != PixelFormat.Undefined) { _symbolCache[key] = symbol; } else { symbol = null; } } } return symbol ?? getSymbol(symbol2D); }
public override IEnumerable<GdiRenderObject> RenderSymbols(IEnumerable<Point2D> locations, Symbol2D symbol, Symbol2D highlightSymbol, Symbol2D selectSymbol, RenderState renderState) { if (renderState == RenderState.Selected) symbol = selectSymbol; if (renderState == RenderState.Highlighted) symbol = highlightSymbol; foreach (Point2D location in locations) { Bitmap bitmapSymbol = getSymbol(symbol); if (bitmapSymbol.PixelFormat != PixelFormat.Undefined) { System.Drawing.Drawing2D.Matrix transform = ViewConverter.Convert(symbol.AffineTransform); System.Drawing.Imaging.ColorMatrix colorTransform = ViewConverter.Convert(symbol.ColorTransform); RectangleF bounds = new RectangleF(ViewConverter.Convert(location), bitmapSymbol.Size); GdiRenderObject holder = new GdiRenderObject(bitmapSymbol, bounds, transform, colorTransform); holder.State = renderState; yield return holder; } else Debug.WriteLine("Unkbown pixel format"); } }
private void registerSymbols() { _symbolTable["Notices"] = new Symbol2D(getStreamFromImage(Resources.Chat), new Size2D(Resources.Chat.Height, Resources.Chat.Width)); _symbolTable["Radioactive Fuel Rods"] = new Symbol2D(getStreamFromImage(Resources.DATABASE), new Size2D(Resources.DATABASE.Height, Resources.DATABASE.Width)); _symbolTable["Bases"] = new Symbol2D(getStreamFromImage(Resources.Flag), new Size2D(Resources.Flag.Height, Resources.Flag.Width)); _symbolTable["Houses"] = new Symbol2D(getStreamFromImage(Resources.Home), new Size2D(Resources.Home.Height, Resources.Home.Width)); _symbolTable["Measures"] = new Symbol2D(getStreamFromImage(Resources.PIE_DIAGRAM), new Size2D(Resources.PIE_DIAGRAM.Height, Resources.PIE_DIAGRAM.Width)); _symbolTable["Contacts"] = new Symbol2D(getStreamFromImage(Resources.Women), new Size2D(Resources.Women.Height, Resources.Women.Width)); _symbolTable["Prospects"] = new Symbol2D(getStreamFromImage(Resources.Women_1), new Size2D(Resources.Women_1.Height, Resources.Women_1.Width)); }
public override IEnumerable <GdiRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbol, Symbol2D highlightSymbol, Symbol2D selectSymbol, RenderState renderState) { if (renderState == RenderState.Selected) { symbol = selectSymbol; } if (renderState == RenderState.Highlighted) { symbol = highlightSymbol; } foreach (Point2D location in locations) { Bitmap bitmapSymbol = getSymbol(symbol); GdiMatrix transform = ViewConverter.Convert(symbol.AffineTransform); GdiColorMatrix colorTransform = ViewConverter.Convert(symbol.ColorTransform); RectangleF bounds = new RectangleF(ViewConverter.Convert(location), bitmapSymbol.Size); GdiRenderObject holder = new GdiRenderObject(bitmapSymbol, bounds, transform, colorTransform); holder.State = renderState; yield return(holder); } }
public override IEnumerable <Object> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, ColorMatrix highlight, ColorMatrix select, RenderState renderState) { throw new NotImplementedException(); }
public void SizeTest() { Symbol2D s1 = new Symbol2D(new Size2D(16, 16)); Assert.Equal(new Size2D(16, 16), s1.Size); }
public override IEnumerable <GdiRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, RenderState renderState) { return(RenderSymbols(locations, symbolData, symbolData, symbolData, renderState)); }
public override IEnumerable <DependencyObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData, Symbol2D highlightSymbolData, Symbol2D selectSymbolData, RenderState renderState) { throw new NotImplementedException(); }
public override IEnumerable <Object> RenderSymbols(IEnumerable <Point2D> locatiosn, Symbol2D symbolData, RenderState renderState) { throw new NotImplementedException(); }