forked from geodmms/xdgnjobs

?? ?
2008-03-10 9299ee8ad709aaf4131af10afeeb2e43b374fba3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.ximple.io.dgn7;
 
//~--- non-JDK imports --------------------------------------------------------
 
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LinearRing;
 
/**
 * ShapeElement
 *
 * @author Ulysses
 * @version 0.1
 * @since 2006/5/18 下午 03:08:43
 */
public class ShapeElement extends LineStringElement implements GeometryConverter
{
    public ShapeElement(short[] raw)
    {
        super(raw);
    }
 
    public Geometry toGeometry(GeometryFactory factory)
    {
        LinearRing ring = factory.createLinearRing(this.getVertices());
 
        return ring;
 
        // return factory.createPolygon(ring, null);
    }
 
    public static class ElementHandler extends Element.ElementHandler
    {
        private static ElementHandler instance = null;
 
        public ElementHandler()
        {
            super(ElementType.SHAPE);
        }
 
        public static IElementHandler getInstance()
        {
            if (instance == null)
            {
                instance = new ElementHandler();
            }
 
            return instance;
        }
 
        protected Element createElement(short[] raw)
        {
            return new ShapeElement(raw);
        }
    }
}