示例#1
0
文件: Map.cs 项目: jonc/carto
        // Draw a particular color layer. If curColor is null, draw the image layer.
        private void DrawColor(GraphicsTarget g, SymColor curColor, RectangleF rect, bool clipRegionIsRectangle, RenderOptions renderOpts)
        {
            foreach (SymDef symdef in symdefs) {
                if (IsSymdefVisible(symdef) && symdef.HasColor(curColor)) {
                    foreach (Symbol curSym in symdef.symbols) {
                        // Only draw the symbol if it may intersect. Check
                        // the bounding box first as it's faster exclusion than MayIntersectRect.
                        RectangleF bounds = curSym.BoundingBox;
                        if (bounds.IntersectsWith(rect) &&
            #if true
                            (clipRegionIsRectangle || g.Graphics.IsVisible(Util.InflateRect(bounds, renderOpts.minResolution))) &&
            #endif
                            curSym.MayIntersectRect(rect))
                        {
                            curSym.Draw(g, curColor, renderOpts);

                            if (renderOpts.showSymbolBounds)
                                g.DrawRectangle(boundsPen, bounds);
                        }
                    }
                }
            }

            //TraceLine("Drawing color {0}: drew {1} of {2} symbols.", curColor, cDrawn, cSymbols);
        }