示例#1
0
        private void plotRoadBorder(Canvas bitmap, iustc.map.data.Path[] paths, iustc.map.data.Rectangle rect, int level)
        {
            foreach (iustc.map.data.Path path in paths)
            {
                Tag tag = path.getTagByKey("road");
                if (tag == null)
                    continue;

                float unit = (float)(Toolkit.getMapScale(rect.clat(), rect.clon(), level) * size / Toolkit.METER_PER_INCH);
                float roadWidth = unit;
                if (tag.value.CompareTo("main") == 0)
                {
                    roadWidth = unit * ROAD_MAIN_WIDTH;
                }
                else if (tag.value.CompareTo("secondary") == 0)
                {
                    roadWidth = unit * ROAD_SECONDARY_WIDTH;
                }
                else if (tag.value.CompareTo("sideway") == 0)
                {
                    roadWidth = unit * ROAD_SIDEWAY_WIDTH;
                }
                else if (tag.value.CompareTo("street") == 0)
                {
                    roadWidth = unit * ROAD_STREET_WIDTH;
                }

                roadBorderPaint.StrokeThickness = roadWidth + ROAD_BORDER_WIDTH * 2;

                plotPath(bitmap, path, rect, roadBorderPaint, true);
            }
        }
示例#2
0
        private void plotRoad(Canvas bitmap, iustc.map.data.Path[] paths, iustc.map.data.Rectangle rect, int level)
        {
            foreach (iustc.map.data.Path path in paths)
            {
                Tag tag = path.getTagByKey("road");
                if (tag == null)
                    continue;

                float unit = (float)(Toolkit.getMapScale(rect.clat(), rect.clon(), level) * size / Toolkit.METER_PER_INCH);
                float roadWidth = unit;
                SolidColorBrush color = default(SolidColorBrush);
                if (tag.value.CompareTo("main") == 0)
                {
                    roadWidth = unit * ROAD_MAIN_WIDTH;
                    color = PlotterHelper.ROAD_MAIN_COLOR;
                }
                else if (tag.value.CompareTo("secondary") == 0)
                {
                    roadWidth = unit * ROAD_SECONDARY_WIDTH;
                    color = PlotterHelper.ROAD_SECONDARY_COLOR;
                }
                else if (tag.value.CompareTo("sideway") == 0)
                {
                    roadWidth = unit * ROAD_SIDEWAY_WIDTH;
                    color = PlotterHelper.ROAD_SIDEWAY_COLOR;
                }
                else
                {
                    continue;
                }
                roadPaint.StrokeThickness = roadWidth;
                roadPaint.Stroke = color;

                plotPath(bitmap, path, rect, roadPaint, true);
            }

            foreach (iustc.map.data.Path path in paths)
            {
                Tag tag = path.getTagByKey("road");
                if (tag == null)
                    continue;

                float unit = (float)Toolkit.getMapScale(rect.clat(), rect.clon(), level) * size / Toolkit.METER_PER_INCH;
                float roadWidth = unit;
                SolidColorBrush color = default(SolidColorBrush);
                if (tag.value.CompareTo("street") == 0)
                {
                    roadWidth = unit * ROAD_STREET_WIDTH;
                    color = PlotterHelper.ROAD_STREET_COLOR;
                }
                else
                {
                    continue;
                }
                roadPaint.StrokeThickness = roadWidth;
                roadPaint.Stroke = color;

                plotPath(bitmap, path, rect, roadPaint, true);
            }
        }