fixing lwjgl stuff
This commit is contained in:
@@ -600,10 +600,17 @@ class TextRenderLayer extends BasicRenderLayer {
|
||||
return true;
|
||||
}
|
||||
|
||||
long lastDraw = 0;
|
||||
|
||||
@Override
|
||||
public synchronized void update(MapPosition pos, boolean changed,
|
||||
Matrices matrices) {
|
||||
|
||||
if (System.currentTimeMillis() - lastDraw > 1000){
|
||||
updateLabels();
|
||||
lastDraw = System.currentTimeMillis();
|
||||
|
||||
}
|
||||
if (mNextLayer.ready) {
|
||||
// exchange current with next layers
|
||||
TextureLayers tmp = mCurLayer;
|
||||
@@ -626,6 +633,7 @@ class TextRenderLayer extends BasicRenderLayer {
|
||||
this.newData = true;
|
||||
}
|
||||
|
||||
|
||||
//if (!mHolding)
|
||||
// postLabelTask((mLastRun + MAX_RELABEL_DELAY) - System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@@ -1,271 +0,0 @@
|
||||
///*
|
||||
// * Copyright 2010, 2011, 2012 mapsforge.org
|
||||
// * Copyright 2013 Hannes Janetzek
|
||||
// *
|
||||
// * 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.overlay;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import org.oscim.core.MapPosition;
|
||||
//import org.oscim.core.MercatorProjection;
|
||||
//import org.oscim.layers.Layer;
|
||||
//import org.oscim.renderer.layers.BitmapRenderLayer;
|
||||
//import org.oscim.view.MapView;
|
||||
//
|
||||
//import android.graphics.Bitmap;
|
||||
//import android.graphics.Canvas;
|
||||
//import android.graphics.Color;
|
||||
//import android.graphics.Paint;
|
||||
//import android.graphics.Typeface;
|
||||
//
|
||||
///**
|
||||
// * A MapScaleBar displays the ratio of a distance on the map to the
|
||||
// * corresponding distance on the ground.
|
||||
// */
|
||||
//public class MapScaleBar extends Layer {
|
||||
//
|
||||
// private static final int BITMAP_HEIGHT = 64;
|
||||
// private static final int BITMAP_WIDTH = 128;
|
||||
// private static final double LATITUDE_REDRAW_THRESHOLD = 0.2;
|
||||
// // private static final int MARGIN_BOTTOM = 5;
|
||||
// // private static final int MARGIN_LEFT = 5;
|
||||
//
|
||||
// private static final double METER_FOOT_RATIO = 0.3048;
|
||||
// private static final int ONE_KILOMETER = 1000;
|
||||
// private static final int ONE_MILE = 5280;
|
||||
//
|
||||
// private static final Paint SCALE_BAR = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
// private static final Paint SCALE_BAR_STROKE = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
// private static final Paint SCALE_TEXT = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
// private static final Paint SCALE_TEXT_STROKE = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
//
|
||||
// private static final int[] SCALE_BAR_VALUES_IMPERIAL = {
|
||||
// 26400000, 10560000, 5280000,
|
||||
// 2640000, 1056000, 528000,
|
||||
// 264000, 105600, 52800, 26400,
|
||||
// 10560, 5280, 2000, 1000, 500,
|
||||
// 200, 100, 50, 20,
|
||||
// 10, 5, 2, 1 };
|
||||
// private static final int[] SCALE_BAR_VALUES_METRIC = {
|
||||
// 10000000, 5000000, 2000000, 1000000,
|
||||
// 500000, 200000, 100000, 50000,
|
||||
// 20000, 10000, 5000, 2000, 1000,
|
||||
// 500, 200, 100, 50, 20, 10, 5, 2, 1 };
|
||||
//
|
||||
// private boolean mImperialUnits;
|
||||
// private final Canvas mMapScaleCanvas;
|
||||
// private boolean mRedrawNeeded;
|
||||
// private double mPrevLatitude = -1;
|
||||
// private final double mPrevScale = -1;
|
||||
// private final Map<TextField, String> mTextFields;
|
||||
//
|
||||
// private final Bitmap mMapScaleBitmap;
|
||||
// private final BitmapRenderLayer mBitmapLayer;
|
||||
//
|
||||
// public MapScaleBar(MapView mapView) {
|
||||
// super(mapView);
|
||||
//
|
||||
// mMapScaleBitmap = Bitmap.createBitmap(
|
||||
// BITMAP_WIDTH, BITMAP_HEIGHT,
|
||||
// Bitmap.Config.ARGB_8888);
|
||||
//
|
||||
// mMapScaleCanvas = new Canvas(mMapScaleBitmap);
|
||||
// mTextFields = new HashMap<TextField, String>();
|
||||
//
|
||||
// setDefaultTexts();
|
||||
// configurePaints();
|
||||
//
|
||||
// mRedrawNeeded = true;
|
||||
// mLayer = mBitmapLayer = new BitmapRenderLayer(mapView);
|
||||
// mBitmapLayer.setBitmap(mMapScaleBitmap, 0, 0,
|
||||
// (int)(BITMAP_WIDTH * 1.2f),
|
||||
// (int)(BITMAP_HEIGHT * 1.2f));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onUpdate(MapPosition mapPosition, boolean changed, boolean clear) {
|
||||
// double latitude = MercatorProjection.toLatitude(mapPosition.y);
|
||||
//
|
||||
// if (!mRedrawNeeded) {
|
||||
// double scaleDiff = mPrevScale / mapPosition.scale;
|
||||
// if (scaleDiff < 1.1 && scaleDiff > 0.9) {
|
||||
// double latitudeDiff = Math.abs(mPrevLatitude - latitude);
|
||||
// if (latitudeDiff < LATITUDE_REDRAW_THRESHOLD)
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// mPrevLatitude = latitude;
|
||||
//
|
||||
// double groundResolution = MercatorProjection.calculateGroundResolution(
|
||||
// latitude, mapPosition.scale);
|
||||
//
|
||||
// int[] scaleBarValues;
|
||||
// if (mImperialUnits) {
|
||||
// groundResolution = groundResolution / METER_FOOT_RATIO;
|
||||
// scaleBarValues = SCALE_BAR_VALUES_IMPERIAL;
|
||||
// } else {
|
||||
// scaleBarValues = SCALE_BAR_VALUES_METRIC;
|
||||
// }
|
||||
//
|
||||
// float scaleBarLength = 0;
|
||||
// int mapScaleValue = 0;
|
||||
//
|
||||
// for (int i = 0; i < scaleBarValues.length; ++i) {
|
||||
// mapScaleValue = scaleBarValues[i];
|
||||
// scaleBarLength = mapScaleValue / (float) groundResolution;
|
||||
// if (scaleBarLength < (BITMAP_WIDTH - 10)) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// synchronized (mMapScaleBitmap) {
|
||||
// redrawMapScaleBitmap(scaleBarLength, mapScaleValue);
|
||||
// }
|
||||
//
|
||||
// mBitmapLayer.updateBitmap();
|
||||
//
|
||||
// mRedrawNeeded = false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return true if imperial units are used, false otherwise.
|
||||
// */
|
||||
// public boolean isImperialUnits() {
|
||||
// return mImperialUnits;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param imperialUnits
|
||||
// * true if imperial units should be used rather than metric
|
||||
// * units.
|
||||
// */
|
||||
// public void setImperialUnits(boolean imperialUnits) {
|
||||
// mImperialUnits = imperialUnits;
|
||||
// mRedrawNeeded = true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Overrides the specified text field with the given string.
|
||||
// *
|
||||
// * @param textField
|
||||
// * the text field to override.
|
||||
// * @param value
|
||||
// * the new value of the text field.
|
||||
// */
|
||||
// public void setText(TextField textField, String value) {
|
||||
// mTextFields.put(textField, value);
|
||||
// mRedrawNeeded = true;
|
||||
// }
|
||||
//
|
||||
// private void drawScaleBar(float scaleBarLength, Paint paint) {
|
||||
// mMapScaleCanvas.drawLine(7, 25, scaleBarLength + 3, 25, paint);
|
||||
// mMapScaleCanvas.drawLine(5, 10, 5, 40, paint);
|
||||
// mMapScaleCanvas.drawLine(scaleBarLength + 5, 10, scaleBarLength + 5, 40, paint);
|
||||
// }
|
||||
//
|
||||
// private void drawScaleText(int scaleValue, String unitSymbol, Paint paint) {
|
||||
// mMapScaleCanvas.drawText(scaleValue + unitSymbol, 12, 18, paint);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Redraws the map scale bitmap with the given parameters.
|
||||
// *
|
||||
// * @param scaleBarLength
|
||||
// * the length of the map scale bar in pixels.
|
||||
// * @param mapScaleValue
|
||||
// * the map scale value in meters.
|
||||
// */
|
||||
// private void redrawMapScaleBitmap(float scaleBarLength, int mapScaleValue) {
|
||||
// mMapScaleBitmap.eraseColor(Color.TRANSPARENT);
|
||||
//
|
||||
// // draw the scale bar
|
||||
// drawScaleBar(scaleBarLength, SCALE_BAR_STROKE);
|
||||
// drawScaleBar(scaleBarLength, SCALE_BAR);
|
||||
//
|
||||
// int scaleValue;
|
||||
// String unitSymbol;
|
||||
// if (mImperialUnits) {
|
||||
// if (mapScaleValue < ONE_MILE) {
|
||||
// scaleValue = mapScaleValue;
|
||||
// unitSymbol = mTextFields.get(TextField.FOOT);
|
||||
// } else {
|
||||
// scaleValue = mapScaleValue / ONE_MILE;
|
||||
// unitSymbol = mTextFields.get(TextField.MILE);
|
||||
// }
|
||||
// } else {
|
||||
// if (mapScaleValue < ONE_KILOMETER) {
|
||||
// scaleValue = mapScaleValue;
|
||||
// unitSymbol = mTextFields.get(TextField.METER);
|
||||
// } else {
|
||||
// scaleValue = mapScaleValue / ONE_KILOMETER;
|
||||
// unitSymbol = mTextFields.get(TextField.KILOMETER);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // draw the scale text
|
||||
// drawScaleText(scaleValue, unitSymbol, SCALE_TEXT_STROKE);
|
||||
// drawScaleText(scaleValue, unitSymbol, SCALE_TEXT);
|
||||
// }
|
||||
//
|
||||
// private void setDefaultTexts() {
|
||||
// mTextFields.put(TextField.FOOT, " ft");
|
||||
// mTextFields.put(TextField.MILE, " mi");
|
||||
//
|
||||
// mTextFields.put(TextField.METER, " m");
|
||||
// mTextFields.put(TextField.KILOMETER, " km");
|
||||
// }
|
||||
//
|
||||
// private static void configurePaints() {
|
||||
// SCALE_BAR.setStrokeWidth(2);
|
||||
// SCALE_BAR.setStrokeCap(Paint.Cap.SQUARE);
|
||||
// SCALE_BAR.setColor(Color.BLACK);
|
||||
// SCALE_BAR_STROKE.setStrokeWidth(5);
|
||||
// SCALE_BAR_STROKE.setStrokeCap(Paint.Cap.SQUARE);
|
||||
// SCALE_BAR_STROKE.setColor(Color.WHITE);
|
||||
//
|
||||
// SCALE_TEXT.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
// SCALE_TEXT.setTextSize(17);
|
||||
// SCALE_TEXT.setColor(Color.BLACK);
|
||||
// SCALE_TEXT_STROKE.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
// SCALE_TEXT_STROKE.setStyle(Paint.Style.STROKE);
|
||||
// SCALE_TEXT_STROKE.setColor(Color.WHITE);
|
||||
// SCALE_TEXT_STROKE.setStrokeWidth(2);
|
||||
// SCALE_TEXT_STROKE.setTextSize(17);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Enumeration of all text fields.
|
||||
// */
|
||||
// public enum TextField {
|
||||
// /**
|
||||
// * Unit symbol for one foot.
|
||||
// */
|
||||
// FOOT,
|
||||
//
|
||||
// /**
|
||||
// * Unit symbol for one kilometer.
|
||||
// */
|
||||
// KILOMETER,
|
||||
//
|
||||
// /**
|
||||
// * Unit symbol for one meter.
|
||||
// */
|
||||
// METER,
|
||||
//
|
||||
// /**
|
||||
// * Unit symbol for one mile.
|
||||
// */
|
||||
// MILE;
|
||||
// }
|
||||
//}
|
||||
@@ -66,7 +66,8 @@ public class TileRenderer {
|
||||
mProjMatrix.setValue(14, 0);
|
||||
mProjMatrix.multiplyRhs(m.view);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
|
||||
//GL.glDepthMask(true);
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
GL.glDepthFunc(GL20.GL_LESS);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class GridRenderLayer extends BasicRenderLayer {
|
||||
|
||||
mTextLayer = layers.addTextLayer(new TextLayer());
|
||||
mLineLayer = layers.addLineLayer(0,
|
||||
new Line(Color.BLUE, 1.5f, Cap.BUTT));
|
||||
new Line(Color.BLUE, 1.5f, Cap.BUTT));
|
||||
}
|
||||
|
||||
private void addLabels(int x, int y, int z) {
|
||||
@@ -83,11 +83,14 @@ public class GridRenderLayer extends BasicRenderLayer {
|
||||
for (int yy = -2; yy < 2; yy++) {
|
||||
for (int xx = -2; xx < 2; xx++) {
|
||||
|
||||
String label = String.format(
|
||||
Locale.ROOT, TILE_FORMAT,
|
||||
Integer.valueOf(x + xx),
|
||||
Integer.valueOf(y + yy),
|
||||
Integer.valueOf(z));
|
||||
// String label = String.format(
|
||||
// Locale.ROOT, TILE_FORMAT,
|
||||
// Integer.valueOf(x + xx),
|
||||
// Integer.valueOf(y + yy),
|
||||
// Integer.valueOf(z));
|
||||
String label = Integer.valueOf(x + xx) + "/" +
|
||||
Integer.valueOf(y + yy) + "/" +
|
||||
Integer.valueOf(z);
|
||||
|
||||
TextItem ti = TextItem.pool.get();
|
||||
ti.set(s * xx + s / 2, s * yy + s / 2, label, mText);
|
||||
|
||||
@@ -88,15 +88,16 @@ public final class LineRenderer {
|
||||
GL20.GL_NEAREST, GL20.GL_NEAREST,
|
||||
GL20.GL_MIRRORED_REPEAT, GL20.GL_MIRRORED_REPEAT);
|
||||
|
||||
Log.d(TAG, "Line Texture >>>>>>>>> " + mTexID);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void beginLines() {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, mTexID);
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, mTexID);
|
||||
}
|
||||
|
||||
public static void endLines() {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
public static Layer draw(Layers layers, Layer curLayer, MapPosition pos,
|
||||
@@ -280,8 +281,10 @@ public final class LineRenderer {
|
||||
//+ " len = abs(v_st.s);"
|
||||
//+ " else"
|
||||
//+ " len = texture2D(tex, v_st).a;"
|
||||
//+ " len = u_mode * length(v_st);"
|
||||
// this avoids branching, need to check performance
|
||||
+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);"
|
||||
//+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);"
|
||||
+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * length(v_st));"
|
||||
// interpolate alpha between: 0.0 < 1.0 - len < u_wscale
|
||||
// where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2)
|
||||
//+ " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);"
|
||||
@@ -304,8 +307,8 @@ public final class LineRenderer {
|
||||
+ " len = abs(v_st.s);"
|
||||
+ " fuzz = fwidth(v_st.s);"
|
||||
+ " } else {"
|
||||
+ " len = texture2D(tex, v_st).a;"
|
||||
//+ " len = length(v_st);"
|
||||
//+ " len = texture2D(tex, v_st).a;"
|
||||
+ " len = length(v_st);"
|
||||
+ " vec2 st_width = fwidth(v_st);"
|
||||
+ " fuzz = max(st_width.s, st_width.t);"
|
||||
+ " }"
|
||||
|
||||
@@ -129,9 +129,9 @@ public final class TextLayer extends TextureLayer {
|
||||
yy = y + height - it.text.fontDescent; // - mFontPadY;
|
||||
|
||||
if (it.text.stroke != null)
|
||||
mCanvas.drawText(it.string, x + it.width / 2, yy, it.text.stroke);
|
||||
mCanvas.drawText(it.string, x, yy, it.text.stroke);
|
||||
|
||||
mCanvas.drawText(it.string, x + it.width / 2, yy, it.text.paint);
|
||||
mCanvas.drawText(it.string, x, yy, it.text.paint);
|
||||
|
||||
// FIXME !!!
|
||||
if (width > TEXTURE_WIDTH)
|
||||
|
||||
@@ -81,6 +81,7 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
*/
|
||||
public synchronized static TextureItem get(boolean initBitmap) {
|
||||
TextureItem ti = pool.get();
|
||||
Log.d(TAG, "get texture item " + ti.id);
|
||||
if (initBitmap) {
|
||||
ti.bitmap = getBitmap();
|
||||
ti.bitmap.eraseColor(Color.TRANSPARENT);
|
||||
@@ -171,8 +172,11 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
int[] tmp = new int[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
tmp[i] = mTextures.get(i).intValue();
|
||||
|
||||
mTextures.clear();
|
||||
GlUtils.glDeleteTextures(size, tmp);
|
||||
|
||||
mTexCnt -= size;
|
||||
}
|
||||
|
||||
if (to.id < 0) {
|
||||
@@ -180,9 +184,9 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
int[] textureIds = GlUtils.glGenTextures(1);
|
||||
to.id = textureIds[0];
|
||||
initTexture(to.id);
|
||||
if (TextureRenderer.debug)
|
||||
Log.d(TAG, pool.getCount() + " " + pool.getFill()
|
||||
+ " " + mTexCnt + " new texture " + to.id);
|
||||
//if (TextureRenderer.debug)
|
||||
Log.d(TAG, "poolCnt:" + pool.getCount() + " poolFill:" + pool.getFill()
|
||||
+ " texCnt:" + mTexCnt + " new texture " + to.id);
|
||||
}
|
||||
|
||||
uploadTexture(to, to.bitmap, mBitmapFormat, mBitmapType,
|
||||
@@ -203,8 +207,9 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
Log.d(TAG, "no texture!");
|
||||
return;
|
||||
}
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, to.id);
|
||||
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, to.id);
|
||||
Log.d(TAG, "upload " + to.id);
|
||||
if (to.ownBitmap) {
|
||||
bitmap.uploadToTexture(false);
|
||||
//GLUtils.texImage2D(GL20.GL_TEXTURE_2D, 0, bitmap, 0);
|
||||
|
||||
@@ -82,6 +82,7 @@ public final class TextureRenderer {
|
||||
for (TextureItem ti = tl.textures; ti != null; ti = ti.next) {
|
||||
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, ti.id);
|
||||
|
||||
int maxVertices = GLRenderer.maxQuads * INDICES_PER_SPRITE;
|
||||
|
||||
GL.glUniform2f(hTextureSize,
|
||||
@@ -110,6 +111,8 @@ public final class TextureRenderer {
|
||||
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
|
||||
return layer.next;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
*/
|
||||
package org.oscim.theme.renderinstruction;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.theme.IRenderCallback;
|
||||
@@ -27,7 +24,7 @@ import org.xml.sax.Attributes;
|
||||
* Represents a polyline on the map.
|
||||
*/
|
||||
public final class Line extends RenderInstruction {
|
||||
private static final Pattern SPLIT_PATTERN = Pattern.compile(",");
|
||||
//private static final Pattern SPLIT_PATTERN = Pattern.compile(",");
|
||||
|
||||
/**
|
||||
* @param line
|
||||
@@ -92,7 +89,7 @@ public final class Line extends RenderInstruction {
|
||||
} else if ("width".equals(name)) {
|
||||
width = Float.parseFloat(value);
|
||||
} else if ("cap".equals(name)) {
|
||||
cap = Cap.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
cap = Cap.valueOf(value.toUpperCase());
|
||||
} else if ("fix".equals(name)) {
|
||||
fixed = Boolean.parseBoolean(value);
|
||||
} else if ("stipple".equals(name)) {
|
||||
@@ -136,14 +133,14 @@ public final class Line extends RenderInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
static float[] parseFloatArray(String dashString) {
|
||||
String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
float[] dashIntervals = new float[dashEntries.length];
|
||||
for (int i = 0; i < dashEntries.length; ++i) {
|
||||
dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
}
|
||||
return dashIntervals;
|
||||
}
|
||||
// static float[] parseFloatArray(String dashString) {
|
||||
// String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
// float[] dashIntervals = new float[dashEntries.length];
|
||||
// for (int i = 0; i < dashEntries.length; ++i) {
|
||||
// dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
// }
|
||||
// return dashIntervals;
|
||||
// }
|
||||
|
||||
private final int level;
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ public final class Text extends RenderInstruction {
|
||||
else if ("k".equals(name)) {
|
||||
textKey = value.intern();
|
||||
} else if ("font-family".equals(name)) {
|
||||
fontFamily = FontFamily.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
fontFamily = FontFamily.valueOf(value.toUpperCase());
|
||||
} else if ("font-style".equals(name)) {
|
||||
fontStyle = FontStyle.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
fontStyle = FontStyle.valueOf(value.toUpperCase());
|
||||
} else if ("font-size".equals(name)) {
|
||||
fontSize = Float.parseFloat(value);
|
||||
} else if ("fill".equals(name)) {
|
||||
|
||||
@@ -18,10 +18,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.theme.RenderThemeHandler;
|
||||
@@ -31,7 +29,7 @@ import org.xml.sax.Attributes;
|
||||
public abstract class Rule {
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_KEY = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_VALUE = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|");
|
||||
//private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|");
|
||||
private static final String STRING_NEGATION = "~";
|
||||
private static final String STRING_EXCLUSIVE = "-";
|
||||
private static final String STRING_WILDCARD = "*";
|
||||
@@ -52,7 +50,8 @@ public abstract class Rule {
|
||||
if (values == null) {
|
||||
valueMatcher = AnyMatcher.getInstance();
|
||||
} else {
|
||||
valueList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(values)));
|
||||
//valueList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(values)));
|
||||
valueList = new ArrayList<String>(Arrays.asList(values.split("\\|")));
|
||||
if (valueList.remove(STRING_NEGATION))
|
||||
negativeRule = true;
|
||||
else if (valueList.remove(STRING_EXCLUSIVE))
|
||||
@@ -69,7 +68,8 @@ public abstract class Rule {
|
||||
}
|
||||
keyMatcher = AnyMatcher.getInstance();
|
||||
} else {
|
||||
keyList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(keys)));
|
||||
//keyList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(keys)));
|
||||
keyList = new ArrayList<String>(Arrays.asList(keys.split("\\|")));
|
||||
keyMatcher = getKeyMatcher(keyList);
|
||||
|
||||
if ((keyMatcher instanceof AnyMatcher) && (negativeRule || exclusionRule)) {
|
||||
@@ -150,7 +150,7 @@ public abstract class Rule {
|
||||
String value = attributes.getValue(i);
|
||||
|
||||
if ("e".equals(name)) {
|
||||
String val = value.toUpperCase(Locale.ENGLISH);
|
||||
String val = value.toUpperCase();
|
||||
if ("WAY".equals(val))
|
||||
element = Element.WAY;
|
||||
else if ("NODE".equals(val))
|
||||
@@ -160,7 +160,7 @@ public abstract class Rule {
|
||||
} else if ("v".equals(name)) {
|
||||
values = value;
|
||||
} else if ("closed".equals(name)) {
|
||||
String val = value.toUpperCase(Locale.ENGLISH);
|
||||
String val = value.toUpperCase();
|
||||
if ("YES".equals(val))
|
||||
closed = Closed.YES;
|
||||
else if ("NO".equals(val))
|
||||
|
||||
@@ -326,6 +326,8 @@ public class GlUtils {
|
||||
|
||||
public static int[] glGenBuffers(int num) {
|
||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
GL.glGenBuffers(num, buf);
|
||||
int[] ret = new int[num];
|
||||
buf.position(0);
|
||||
@@ -343,6 +345,8 @@ public class GlUtils {
|
||||
|
||||
public static int[] glGenTextures(int num) {
|
||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
GL.glGenTextures(num, buf);
|
||||
int[] ret = new int[num];
|
||||
buf.position(0);
|
||||
|
||||
Reference in New Issue
Block a user