- more work on generic pools
- generic inlist
This commit is contained in:
@@ -16,10 +16,11 @@ package org.oscim.renderer.layer;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
/**
|
||||
* @authorHannes Janetzek
|
||||
*/
|
||||
public abstract class Layer {
|
||||
public abstract class Layer extends Inlist<Layer>{
|
||||
public final static byte LINE = 0;
|
||||
public final static byte POLYGON = 1;
|
||||
public final static byte TEXLINE = 2;
|
||||
@@ -31,8 +32,6 @@ public abstract class Layer {
|
||||
|
||||
public byte type = -1;
|
||||
|
||||
public Layer next;
|
||||
|
||||
// drawing order from bottom to top
|
||||
int level;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ public class TextItem extends Inlist<TextItem> {
|
||||
|
||||
TextItem ti = pool.get();
|
||||
|
||||
ti.next = null;
|
||||
|
||||
ti.x = orig.x;
|
||||
ti.y = orig.y;
|
||||
|
||||
@@ -56,6 +54,22 @@ public class TextItem extends Inlist<TextItem> {
|
||||
return ti;
|
||||
}
|
||||
|
||||
public static boolean shareText(TextItem ti1, TextItem ti2){
|
||||
if (ti1.text != ti2.text)
|
||||
return false;
|
||||
|
||||
if (ti1.string == ti2.string)
|
||||
return true;
|
||||
|
||||
if (ti1.string.equals(ti2.string)){
|
||||
// make strings unique, should be done only once..
|
||||
ti1.string = ti2.string;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public TextItem set(float x, float y, String string, Text text) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
Reference in New Issue
Block a user