Tile grid layer scaling, closes #238

This commit is contained in:
Emux
2016-11-13 11:40:15 +02:00
parent 001dbe8447
commit 3584c4be1e
10 changed files with 50 additions and 11 deletions

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2012 Hannes Janetzek
* Copyright 2016 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.layers;
import org.oscim.backend.canvas.Paint.Cap;
@@ -12,6 +29,10 @@ public class TileGridLayer extends GenericLayer {
super(map, new GridRenderer());
}
public TileGridLayer(Map map, float scale) {
super(map, new GridRenderer(scale));
}
public TileGridLayer(Map map, int color, float width, int repeat) {
super(map, new GridRenderer(repeat, new LineStyle(color, width, Cap.BUTT), null));
}

View File

@@ -18,6 +18,7 @@
package org.oscim.renderer;
import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Paint;
import org.oscim.backend.canvas.Paint.Cap;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.Tile;
@@ -38,9 +39,14 @@ public class GridRenderer extends BucketRenderer {
private int mCurX, mCurY, mCurZ;
public GridRenderer() {
this(1, new LineStyle(Color.LTGRAY, 1.2f, Cap.BUTT),
this(1);
}
public GridRenderer(float scale) {
this(1, new LineStyle(Color.LTGRAY, 1.2f * scale, Cap.BUTT),
TextStyle.builder()
.fontSize(22)
.fontSize(12 * scale)
.fontStyle(Paint.FontStyle.BOLD)
.color(Color.RED)
.build());
}