2013-04-18 23:35:02 +02:00
|
|
|
package net.osmand;
|
|
|
|
|
2013-10-07 09:49:06 +02:00
|
|
|
import net.osmand.render.RenderingRuleProperty;
|
|
|
|
import net.osmand.render.RenderingRuleSearchRequest;
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
public class RenderingContext {
|
|
|
|
static enum ShadowRenderingMode {
|
|
|
|
// int shadowRenderingMode = 0; // no shadow (minumum CPU)
|
|
|
|
// int shadowRenderingMode = 1; // classic shadow (the implementaton in master)
|
|
|
|
// int shadowRenderingMode = 2; // blur shadow (most CPU, but still reasonable)
|
|
|
|
// int shadowRenderingMode = 3; solid border (CPU use like classic version or even smaller)
|
|
|
|
NO_SHADOW(0), ONE_STEP(1), BLUR_SHADOW(2), SOLID_SHADOW(3);
|
|
|
|
public final int value;
|
|
|
|
|
|
|
|
ShadowRenderingMode(int v) {
|
|
|
|
this.value = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-01 18:02:50 +01:00
|
|
|
public int renderedState = 0;
|
2013-04-18 23:35:02 +02:00
|
|
|
// FIELDS OF THAT CLASS ARE USED IN C++
|
|
|
|
public boolean interrupted = false;
|
|
|
|
public boolean nightMode = false;
|
2014-06-26 02:29:02 +02:00
|
|
|
public String preferredLocale = "";
|
2016-10-11 15:42:05 +02:00
|
|
|
public boolean transliterate = false;
|
2013-04-18 23:35:02 +02:00
|
|
|
public int defaultColor = 0xf1eee8;
|
|
|
|
|
|
|
|
public RenderingContext() {
|
|
|
|
}
|
|
|
|
|
2013-11-26 17:11:29 +01:00
|
|
|
public double leftX;
|
|
|
|
public double topY;
|
2013-04-18 23:35:02 +02:00
|
|
|
public int width;
|
|
|
|
public int height;
|
|
|
|
|
|
|
|
public int zoom;
|
2013-11-26 17:11:29 +01:00
|
|
|
public double tileDivisor;
|
2013-04-18 23:35:02 +02:00
|
|
|
public float rotate;
|
|
|
|
|
|
|
|
// debug purpose
|
|
|
|
public int pointCount = 0;
|
|
|
|
public int pointInsideCount = 0;
|
|
|
|
public int visible = 0;
|
|
|
|
public int allObjects = 0;
|
|
|
|
public int textRenderingTime = 0;
|
|
|
|
public int lastRenderedKey = 0;
|
|
|
|
|
|
|
|
// be aware field is using in C++
|
2013-10-08 00:24:26 +02:00
|
|
|
public float screenDensityRatio = 1;
|
2014-09-23 09:40:26 +02:00
|
|
|
public float textScale = 1;
|
2014-09-01 01:18:23 +02:00
|
|
|
public int shadowRenderingMode = ShadowRenderingMode.SOLID_SHADOW.value;
|
2013-04-18 23:35:02 +02:00
|
|
|
public int shadowRenderingColor = 0xff969696;
|
|
|
|
public String renderingDebugInfo;
|
2014-03-07 02:26:17 +01:00
|
|
|
public double polygonMinSizeToDisplay;
|
2016-09-06 00:43:11 +02:00
|
|
|
public long renderingContextHandle;
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
private float density = 1;
|
|
|
|
|
2013-10-06 11:59:01 +02:00
|
|
|
public void setDensityValue(float density) {
|
|
|
|
this.density = density ;
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public float getDensityValue(float val) {
|
|
|
|
return val * density;
|
|
|
|
}
|
|
|
|
|
2014-06-19 22:39:45 +02:00
|
|
|
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, int defVal) {
|
|
|
|
return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, defVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop) {
|
|
|
|
return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, 0);
|
2013-10-07 09:49:06 +02:00
|
|
|
}
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
protected byte[] getIconRawData(String data) {
|
|
|
|
return null;
|
|
|
|
}
|
2016-09-06 00:43:11 +02:00
|
|
|
|
|
|
|
protected void finalize() throws Throwable {
|
|
|
|
super.finalize();
|
|
|
|
if (renderingContextHandle != 0) {
|
|
|
|
NativeLibrary.deleteRenderingContextHandle(renderingContextHandle);
|
|
|
|
renderingContextHandle = 0;
|
|
|
|
}
|
|
|
|
}
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|