예제 #1
0
        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:
        }
예제 #3
0
        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);
                }
            }
예제 #6
0
        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));
        }
예제 #7
0
            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");
            }
        }
예제 #10
0
 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));
 }
예제 #11
0
        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);
            }
        }
예제 #12
0
 public override IEnumerable <Object> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData,
                                                    ColorMatrix highlight, ColorMatrix select,
                                                    RenderState renderState)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public void SizeTest()
 {
     Symbol2D s1 = new Symbol2D(new Size2D(16, 16));
     Assert.Equal(new Size2D(16, 16), s1.Size);
 }
예제 #14
0
        public void SizeTest()
        {
            Symbol2D s1 = new Symbol2D(new Size2D(16, 16));

            Assert.Equal(new Size2D(16, 16), s1.Size);
        }
예제 #15
0
 public override IEnumerable <GdiRenderObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData,
                                                             RenderState renderState)
 {
     return(RenderSymbols(locations, symbolData, symbolData, symbolData, renderState));
 }
예제 #16
0
 public override IEnumerable <DependencyObject> RenderSymbols(IEnumerable <Point2D> locations, Symbol2D symbolData,
                                                              Symbol2D highlightSymbolData,
                                                              Symbol2D selectSymbolData, RenderState renderState)
 {
     throw new NotImplementedException();
 }
예제 #17
0
 public override IEnumerable <Object> RenderSymbols(IEnumerable <Point2D> locatiosn, Symbol2D symbolData,
                                                    RenderState renderState)
 {
     throw new NotImplementedException();
 }
 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));
 }