3
* The JTS Topology Suite is a collection of Java classes that
4
* implement the fundamental operations required to validate a given
5
* geo-spatial data set to a known topological specification.
7
* Copyright (C) 2001 Vivid Solutions
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
* For more information, contact:
27
* 2328 Government Street
32
* www.vividsolutions.com
34
package com.vividsolutions.jtsexample.geom;
36
import com.vividsolutions.jts.geom.*;
39
* Creates ExtendedCoordinateSequenceFactory internally represented
40
* as an array of {@link ExtendedCoordinate}s.
44
public class ExtendedCoordinateSequenceFactory
45
implements CoordinateSequenceFactory
47
private static ExtendedCoordinateSequenceFactory instance = new ExtendedCoordinateSequenceFactory();
49
private ExtendedCoordinateSequenceFactory() {
53
* Returns the singleton instance of ExtendedCoordinateSequenceFactory
55
public static ExtendedCoordinateSequenceFactory instance() {
60
* Returns an ExtendedCoordinateSequence based on the given array -- the array is used
61
* directly if it is an instance of ExtendedCoordinate[]; otherwise it is
64
public CoordinateSequence create(Coordinate[] coordinates) {
65
return coordinates instanceof ExtendedCoordinate[]
66
? new ExtendedCoordinateSequence((ExtendedCoordinate[]) coordinates)
67
: new ExtendedCoordinateSequence(coordinates);
70
public CoordinateSequence create(CoordinateSequence coordSeq) {
71
return coordSeq instanceof ExtendedCoordinateSequence
72
? new ExtendedCoordinateSequence((ExtendedCoordinateSequence) coordSeq)
73
: new ExtendedCoordinateSequence(coordSeq);
77
* @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(int, int)
79
public CoordinateSequence create(int size, int dimension) {
80
return new ExtendedCoordinateSequence(size);