diff --git a/src/org/oscim/layers/labeling/Debug.java b/src/org/oscim/layers/labeling/Debug.java index f4af5e73..a31fbc55 100644 --- a/src/org/oscim/layers/labeling/Debug.java +++ b/src/org/oscim/layers/labeling/Debug.java @@ -20,7 +20,7 @@ import org.oscim.renderer.sublayers.LineLayer; import org.oscim.renderer.sublayers.TextItem; import org.oscim.theme.renderinstruction.Line; -public class Debug { +class Debug { private final static float[] mDebugPoints = new float[4]; diff --git a/src/org/oscim/layers/labeling/TextRenderLayer.java b/src/org/oscim/layers/labeling/TextRenderLayer.java index bf101e17..dabcff09 100644 --- a/src/org/oscim/layers/labeling/TextRenderLayer.java +++ b/src/org/oscim/layers/labeling/TextRenderLayer.java @@ -40,8 +40,10 @@ import org.oscim.renderer.sublayers.Layer; import org.oscim.renderer.sublayers.Layers; import org.oscim.renderer.sublayers.LineRenderer; import org.oscim.renderer.sublayers.PolygonRenderer; +import org.oscim.renderer.sublayers.SymbolLayer; import org.oscim.renderer.sublayers.TextItem; import org.oscim.renderer.sublayers.TextLayer; +import org.oscim.renderer.sublayers.TextureLayer; import org.oscim.renderer.sublayers.TextureRenderer; import org.oscim.utils.FastMath; import org.oscim.utils.OBB2D; @@ -55,7 +57,7 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; -public class TextRenderLayer extends BasicRenderLayer { +class TextRenderLayer extends BasicRenderLayer { private final static String TAG = TextRenderLayer.class.getName(); private final static float MIN_CAPTION_DIST = 5; private final static float MIN_WAY_DIST = 3; @@ -65,14 +67,34 @@ public class TextRenderLayer extends BasicRenderLayer { private final MapViewPosition mMapViewPosition; private final TileSet mTileSet; - private MapPosition mTmpPos; - // TextLayer that is updating - private TextLayer mTmpLayer; - // TextLayer that is ready to be added to 'layers' - private TextLayer mNextLayer; + class TextureLayers { + boolean ready; - // thread local pool + final TextureLayer l; + final TextLayer textLayer; + final SymbolLayer symbolLayer; + + final MapPosition pos; + + TextureLayers() { + pos = new MapPosition(); + + symbolLayer = new SymbolLayer(); + textLayer = new TextLayer(); + + l = symbolLayer; + l.next = textLayer; + } + } + + // used by GL thread + private TextureLayers mCurLayer; + + // used by labeling thread + private TextureLayers mNextLayer; + + // thread local pool (labeling) class LabelPool extends Pool { Label releaseAndGetNext(Label l) { if (l.item != null) @@ -98,9 +120,6 @@ public class TextRenderLayer extends BasicRenderLayer { private final LabelPool mPool = new LabelPool(); - // list of previous labels - private Label mPrevLabels; - // list of current labels private Label mLabels; @@ -113,7 +132,6 @@ public class TextRenderLayer extends BasicRenderLayer { LList