org.locationtech.jts.geom.CoordinateSequenceFactory Java Examples

The following examples show how to use org.locationtech.jts.geom.CoordinateSequenceFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GMLConfiguration.java    From GeoTriples with Apache License 2.0 6 votes vote down vote up
/**
 * Configures the gml3 context.
 * <p>
 * The following factories are registered:
 * <ul>
 * <li>{@link CoordinateArraySequenceFactory} under {@link CoordinateSequenceFactory}
 * <li>{@link GeometryFactory}
 * </ul>
 * </p>
 */
public void configureContext(MutablePicoContainer container) {
    super.configureContext(container);

    container.registerComponentInstance(new FeatureTypeCache());
    container.registerComponentInstance(new XSDIdRegistry());

    //factories
    container.registerComponentInstance(CoordinateSequenceFactory.class,
        CoordinateArraySequenceFactory.instance());
    container.registerComponentImplementation(GeometryFactory.class);
    
    container.registerComponentInstance(new GML3EncodingUtils());
    
    if (isExtendedArcSurfaceSupport()) {
        container.registerComponentInstance(new ArcParameters());
    }

    container.registerComponentInstance(srsSyntax);
}
 
Example #2
Source File: GeoTiffReaderExample.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public LinearRing createLinearRing(CoordinateSequence cs) {
	if (cs.getCoordinate(0).equals(cs.getCoordinate(cs.size() - 1)))
		return super.createLinearRing(cs);

	// add a new coordinate to close the ring
	CoordinateSequenceFactory csFact = getCoordinateSequenceFactory();
	CoordinateSequence csNew = csFact.create(cs.size() + 1,
			cs.getDimension());
	CoordinateSequences.copy(cs, 0, csNew, 0, cs.size());
	CoordinateSequences.copyCoord(csNew, 0, csNew, csNew.size() - 1);
	return super.createLinearRing(csNew);
}
 
Example #3
Source File: KMLManagement.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public LinearRing createLinearRing(CoordinateSequence cs) {
	if (cs.getCoordinate(0).equals(cs.getCoordinate(cs.size() - 1)))
		return super.createLinearRing(cs);

	// add a new coordinate to close the ring
	CoordinateSequenceFactory csFact = getCoordinateSequenceFactory();
	CoordinateSequence csNew = csFact.create(cs.size() + 1,
			cs.getDimension());
	CoordinateSequences.copy(cs, 0, csNew, 0, cs.size());
	CoordinateSequences.copyCoord(csNew, 0, csNew, csNew.size() - 1);
	return super.createLinearRing(csNew);
}
 
Example #4
Source File: GeoPkgGeomReader.java    From hortonmachine with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a {@link CoordinateSequence} using the provided factory confirming the provided size
 * and dimension are respected.
 *
 * <p>If the requested dimension is larger than the CoordinateSequence implementation can
 * provide, then a sequence of maximum possible dimension should be created. An error should not
 * be thrown.
 *
 * <p>This method is functionally identical to calling csFactory.create(size,dim) - it contains
 * additional logic to work around a limitation on the commonly used
 * CoordinateArraySequenceFactory.
 *
 * @param size the number of coordinates in the sequence
 * @param dimension the dimension of the coordinates in the sequence
 */
public static CoordinateSequence createCS( CoordinateSequenceFactory csFactory, int size, int dimension ) {
    // the coordinates don't have measures
    return createCS(csFactory, size, dimension, 0);
}