public TileDownloadLayer(TileCache tileCache, MapViewPosition mapViewPosition, TileSource tileSource, IGraphicFactory graphicFactory) : base(tileCache, mapViewPosition, graphicFactory.CreateMatrix(), tileSource.HasAlpha()) { this.tileCache = tileCache; this.tileSource = tileSource; this.cacheTimeToLive = tileSource.DefaultTimeToLive; this.graphicFactory = graphicFactory; }
public TileGridLayer(IGraphicFactory graphicFactory, DisplayModel displayModel) : base() { this.displayModel = displayModel; this.paintBack = createPaintBack(graphicFactory, displayModel); this.paintFront = createPaintFront(graphicFactory, displayModel); }
public FrameBuffer(FrameBufferModel frameBufferModel, DisplayModel displayModel, IGraphicFactory graphicFactory) { this.frameBufferModel = frameBufferModel; this.displayModel = displayModel; this.graphicFactory = graphicFactory; this.matrix = graphicFactory.CreateMatrix(); }
public FpsCounter(IGraphicFactory graphicFactory, DisplayModel displayModel) { this.displayModel = displayModel; this.paintBack = CreatePaintBack(graphicFactory, displayModel); this.paintFront = CreatePaintFront(graphicFactory, displayModel); }
/// <param name="paintFill"> /// the initial {@code Paint} used to fill this polygon (may be null). </param> /// <param name="paintStroke"> /// the initial {@code Paint} used to stroke this polygon (may be null). </param> /// <param name="graphicFactory"> /// the IGraphicFactory </param> /// <param name="keepAligned"> /// if set to true it will keep the bitmap aligned with the map, /// to avoid a moving effect of a bitmap shader. </param> public Polygon(IPaint paintFill, IPaint paintStroke, IGraphicFactory graphicFactory, bool keepAligned) : base() { this.keepAligned = keepAligned; this.paintFill = paintFill; this.paintStroke = paintStroke; this.graphicFactory = graphicFactory; }
public RenderThemeFuture(IGraphicFactory graphicFactory, IXmlRenderTheme xmlRenderTheme, DisplayModel displayModel) { RenderThemeCallable callable = new RenderThemeCallable(graphicFactory, xmlRenderTheme, displayModel); task = new Task <RenderTheme>(() => { return(callable.Call()); }); task.Start(); }
internal CanvasRasterer(IGraphicFactory graphicFactory) { this.symbolMatrix = graphicFactory.CreateMatrix(); this.path = graphicFactory.CreatePath(); // TODO: Delete this.graphicFactory = graphicFactory; }
internal TileDownloadThread(TileCache tileCache, JobQueue <DownloadJob> jobQueue, Layer layer, IGraphicFactory graphicFactory, DisplayModel displayModel) : base() { this.tileCache = tileCache; this.jobQueue = jobQueue; this.layer = layer; this.graphicFactory = graphicFactory; this.displayModel = displayModel; }
private RenderThemeHandler(IGraphicFactory graphicFactory, DisplayModel displayModel, string relativePathPrefix, IXmlRenderTheme xmlRenderTheme, XmlReader reader) : base() { this.reader = reader; this.graphicFactory = graphicFactory; this.displayModel = displayModel; this.relativePathPrefix = relativePathPrefix; this.xmlRenderTheme = xmlRenderTheme; }
public LayerManager(MapView mapView, MapViewPosition mapViewPosition, IGraphicFactory graphicFactory) : base() { this.mapView = mapView; this.mapViewPosition = mapViewPosition; this.drawingCanvas = graphicFactory.CreateCanvas(); this.layers = new Layers(this, mapView.Model.displayModel); }
private static int GetColor(IGraphicFactory graphicFactory, string colorString, int alpha, int rgbStartIndex) { int red = Convert.ToInt16(colorString.Substring(rgbStartIndex, 2), 16); int green = Convert.ToInt16(colorString.Substring(rgbStartIndex + 2, (rgbStartIndex + 4) - (rgbStartIndex + 2)), 16); int blue = Convert.ToInt16(colorString.Substring(rgbStartIndex + 4, (rgbStartIndex + 6) - (rgbStartIndex + 4)), 16); return(graphicFactory.CreateColor(alpha, red, green, blue)); }
/// <summary> /// Constructs a new DatabaseRenderer that will not draw labels, instead it stores the label /// information in the labelStore for drawing by a LabelLayer. /// </summary> /// <param name="mapDatabase"> /// the MapDatabase from which the map data will be read. </param> public DatabaseRenderer(MapDataStore mapDatabase, IGraphicFactory graphicFactory, TileBasedLabelStore labelStore) { this.mapDatabase = mapDatabase; this.graphicFactory = graphicFactory; this.labelStore = labelStore; this.renderLabels = false; this.tileCache = null; this.tileDependencies = null; }
private static IPaint CreatePaintFront(IGraphicFactory graphicFactory, DisplayModel displayModel) { IPaint paint = graphicFactory.CreatePaint(); paint.Color = Color.RED; paint.SetTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.TextSize = 25 * displayModel.ScaleFactor; return(paint); }
public LineSymbol(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, string relativePathPrefix) : base(graphicFactory, displayModel) { this.display = Display.IFSPACE; this.rotate = true; this.relativePathPrefix = relativePathPrefix; this.dyScaled = new Dictionary <sbyte?, float?>(); ExtractValues(elementName, reader); }
private static IPaint createPaintFront(IGraphicFactory graphicFactory, DisplayModel displayModel) { IPaint paint = graphicFactory.CreatePaint(); paint.Color = Color.RED; paint.StrokeWidth = 2 * displayModel.ScaleFactor; paint.Style = Style.STROKE; return(paint); }
private static IPaint CreateLineBack(IGraphicFactory graphicFactory, DisplayModel displayModel) { IPaint paint = graphicFactory.CreatePaint(); paint.Color = Color.WHITE; paint.StrokeWidth = 4 * displayModel.ScaleFactor; paint.Style = Style.STROKE; return(paint); }
/// <summary> /// Constructs a new DatabaseRenderer that will draw labels onto the tiles. /// </summary> /// <param name="mapFile"> /// the MapDatabase from which the map data will be read. </param> public DatabaseRenderer(MapDataStore mapFile, IGraphicFactory graphicFactory, TileCache tileCache) { this.mapDatabase = mapFile; this.graphicFactory = graphicFactory; this.labelStore = null; this.renderLabels = true; this.tileCache = tileCache; this.tileDependencies = new TileDependencies(); }
/// <summary> /// Ctor. </summary> /// <param name="graphicFactory"> the graphic factory. </param> /// <param name="displayModel"> the display model of the map view. </param> /// <param name="spacingConfig"> a map containing the spacing for every zoom level. </param> public Grid(IGraphicFactory graphicFactory, DisplayModel displayModel, IDictionary <sbyte?, double?> spacingConfig) : base() { this.displayModel = displayModel; this.spacingConfig = spacingConfig; this.lineBack = CreateLineBack(graphicFactory, displayModel); this.lineFront = CreateLineFront(graphicFactory, displayModel); this.textBack = CreateTextBack(graphicFactory, displayModel); this.textFront = CreateTextFront(graphicFactory, displayModel); }
/// <param name="rootDirectory"> /// the directory where cached tiles will be stored. </param> /// <param name="suffix"> /// the suffix for stored tiles. </param> /// <param name="graphicFactory"> /// the mapsforge graphic factory to create tile data instances. </param> /// <exception cref="IllegalArgumentException"> /// if the root directory cannot be a tile store </exception> public TileStore(IFolder rootDirectory, string suffix, IGraphicFactory graphicFactory) { if (!CheckFolder(rootDirectory)) { throw new System.ArgumentException("Root directory must be readable"); } this.rootDirectory = rootDirectory; this.graphicFactory = graphicFactory; this.suffix = suffix; }
private static IPaint CreatePaintBack(IGraphicFactory graphicFactory, DisplayModel displayModel) { IPaint paint = graphicFactory.CreatePaint(); paint.Color = Color.WHITE; paint.SetTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.TextSize = 25 * displayModel.ScaleFactor; paint.StrokeWidth = 2 * displayModel.ScaleFactor; paint.Style = Style.STROKE; return(paint); }
public static RenderTheme GetRenderTheme(IGraphicFactory graphicFactory, DisplayModel displayModel, IXmlRenderTheme xmlRenderTheme) { XmlReader reader = null; RenderThemeHandler renderThemeHandler = new RenderThemeHandler(graphicFactory, displayModel, xmlRenderTheme.RelativePathPrefix, xmlRenderTheme, reader); using (System.IO.Stream inputStream = xmlRenderTheme.RenderThemeAsStream) { reader = XmlReader.Create(inputStream); renderThemeHandler.ProcessRenderTheme(); return(renderThemeHandler.renderTheme); } }
internal TileDownloader(DownloadJob downloadJob, IGraphicFactory graphicFactory) { if (downloadJob == null) { throw new System.ArgumentException("downloadJob must not be null"); } else if (graphicFactory == null) { throw new System.ArgumentException("graphicFactory must not be null"); } this.downloadJob = downloadJob; this.graphicFactory = graphicFactory; }
public Line(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, int level, string relativePathPrefix) : base(graphicFactory, displayModel) { this.level = level; this.relativePathPrefix = relativePathPrefix; this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.BLACK; this.stroke.Style = Style.STROKE; this.stroke.StrokeCap = Cap.ROUND; this.stroke.StrokeJoin = Join.Round; this.strokes = new Dictionary <sbyte?, IPaint>(); this.dyScaled = new Dictionary <sbyte?, float?>(); ExtractValues(graphicFactory, displayModel, elementName, reader, relativePathPrefix); }
/// <summary> /// Creates a TileRendererLayer. </summary> /// <param name="tileCache"> cache where tiles are stored </param> /// <param name="mapDataStore"> the mapsforge map file </param> /// <param name="mapViewPosition"> the mapViewPosition to know which tiles to render </param> /// <param name="isTransparent"> true if the tile should have an alpha/transparency </param> /// <param name="renderLabels"> true if labels should be rendered onto tiles </param> /// <param name="graphicFactory"> the graphicFactory to carry out platform specific operations </param> public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition, bool isTransparent, bool renderLabels, IGraphicFactory graphicFactory) : base(tileCache, mapViewPosition, graphicFactory.CreateMatrix(), isTransparent) { this.graphicFactory = graphicFactory; this.mapDataStore = mapDataStore; if (renderLabels) { this.tileBasedLabelStore = null; this.databaseRenderer = new DatabaseRenderer(this.mapDataStore, graphicFactory, tileCache); } else { this.tileBasedLabelStore = new TileBasedLabelStore(tileCache.CapacityFirstLevel); this.databaseRenderer = new DatabaseRenderer(this.mapDataStore, graphicFactory, tileBasedLabelStore); } this.textScale = 1; }
public static IResourceBitmap CreateBitmap(IGraphicFactory graphicFactory, DisplayModel displayModel, string relativePathPrefix, string src, int width, int height, int percent) { if (string.ReferenceEquals(src, null) || src.Length == 0) { // no image source defined return(null); } System.IO.Stream inputStream = graphicFactory.PlatformSpecificSources(relativePathPrefix, src); if (inputStream == null) { inputStream = CreateInputStream(relativePathPrefix, src); } try { string absoluteName = GetAbsoluteName(relativePathPrefix, src); // we need to hash with the width/height included as the same symbol could be required // in a different size and must be cached with a size-specific hash int hash = (new StringBuilder()).Append(absoluteName).Append(width).Append(height).Append(percent).ToString().GetHashCode(); if (src.EndsWith(".svg", StringComparison.Ordinal)) { try { return(graphicFactory.RenderSvg(inputStream, displayModel.ScaleFactor, width, height, percent, hash)); } catch (IOException e) { throw new IOException("SVG render failed " + src, e); } } try { return(graphicFactory.CreateResourceBitmap(inputStream, absoluteName.GetHashCode())); } catch (IOException e) { throw new IOException("Reading bitmap file failed " + src, e); } } finally { inputStream = null; } }
public PathText(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader) : base(graphicFactory, displayModel) { this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.BLACK; this.fill.Style = Style.FILL; this.fill.TextAlign = Align.CENTER; this.fills = new Dictionary <sbyte?, IPaint>(); this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.BLACK; this.stroke.Style = Style.STROKE; this.stroke.TextAlign = Align.CENTER; this.strokes = new Dictionary <sbyte?, IPaint>(); this.dyScaled = new Dictionary <sbyte?, float?>(); this.display = Display.IFSPACE; ExtractValues(graphicFactory, displayModel, elementName, reader); }
public MapScaleBar(MapViewPosition mapViewPosition, MapViewDimension mapViewDimension, DisplayModel displayModel, IGraphicFactory graphicFactory, int width, int height) { this.mapViewPosition = mapViewPosition; this.mapViewDimension = mapViewDimension; this.displayModel = displayModel; this.graphicFactory = graphicFactory; this.mapScaleBitmap = graphicFactory.CreateBitmap((int)(width * this.displayModel.ScaleFactor), (int)(height * this.displayModel.ScaleFactor)); this.marginHorizontal = DEFAULT_HORIZONTAL_MARGIN; this.marginVertical = DEFAULT_VERTICAL_MARGIN; this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION; this.mapScaleCanvas = graphicFactory.CreateCanvas(); this.mapScaleCanvas.Bitmap = this.mapScaleBitmap; this.distanceUnitAdapter = MetricUnitAdapter.INSTANCE; this.visible = true; this.redrawNeeded = true; }
public Area(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, int level, string relativePathPrefix) : base(graphicFactory, displayModel) { this.level = level; this.relativePathPrefix = relativePathPrefix; this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.TRANSPARENT; this.fill.Style = Style.FILL; this.fill.StrokeCap = Cap.ROUND; this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.TRANSPARENT; this.stroke.Style = Style.STROKE; this.stroke.StrokeCap = Cap.ROUND; this.strokes = new Dictionary <sbyte?, IPaint>(); ExtractValues(elementName, reader); }
/// <summary> /// Supported formats are {@code #RRGGBB} and {@code #AARRGGBB}. /// </summary> public static int GetColor(IGraphicFactory graphicFactory, string colorString) { if (colorString.Length == 0 || colorString[0] != '#') { throw new System.ArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.Length == 7) { return(GetColor(graphicFactory, colorString, 255, 1)); } else if (colorString.Length == 9) { return(GetColor(graphicFactory, colorString, Convert.ToInt16(colorString.Substring(1, 2), 16), 3)); } else { throw new System.ArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } }
private void ExtractValues(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader) { for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute(i); string name = reader.Name; string value = reader.Value; if (RADIUS.Equals(name) || (XmlUtils.supportOlderRenderThemes && R.Equals(name))) { this.radius = Convert.ToSingle(XmlUtils.ParseNonNegativeFloat(name, value)) * displayModel.ScaleFactor; } else if (SCALE_RADIUS.Equals(name)) { this.scaleRadius = bool.Parse(value); } else if (CAT.Equals(name)) { this.category = value; } else if (FILL.Equals(name)) { this.fill.Color = (Color)XmlUtils.GetColor(graphicFactory, value); } else if (STROKE.Equals(name)) { this.stroke.Color = (Color)XmlUtils.GetColor(graphicFactory, value); } else if (STROKE_WIDTH.Equals(name)) { this.strokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor; } else { throw XmlUtils.CreateXmlReaderException(elementName, name, value, i); } } XmlUtils.CheckMandatoryAttribute(elementName, RADIUS, this.radius); }