Subversion Repositories hibernate-spatial

Rev

Blame | Last modification | View Log | RSS feed

package org.hibernatespatial.wkb;

/**
 * @author Karel Maesen, Geovise BVBA
 *         creation-date: Nov 11, 2010
 */
public enum WKBGeometryType {

    POINT((byte)1),
    LINESTRING((byte)2);

    byte code;

    private WKBGeometryType(byte code){
        this.code = code;
    }

    public static WKBGeometryType valueOf(int code){
        //drop the higher-order bits
        byte codeByte = (byte)code;
        for (WKBGeometryType type : values()){
            if (type.code == codeByte) return type;
        }
        throw new IllegalArgumentException("Numeric code " + code + " not known");

    }


    public long getTypeCode() {
        return this.code;
    }
}