/** Returns a default common factory instance. */ public static synchronized BasicFactories getDefault() { if (DEFAULT == null) { DEFAULT = new BasicFactories(new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE)); } return DEFAULT; }
/** * Returns the {@linkplain FilterFactory filter factory} singleton. * * <p><strong>NOTE:</strong> This method is not yet supported in Geotools. The default * implementation thrown an exception in all case. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public FilterFactory getFilterFactory() throws FactoryRegistryException { throw new FactoryNotFoundException(unsupportedFactory(FilterFactory.class)); }
/** * Returns the {@linkplain FeatureTypeFactory feature type factory} singleton. * * <p><strong>NOTE:</strong> This method is not yet supported in Geotools. The default * implementation thrown an exception in all case. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. * @deprecated use {@link #getFeatureTypeFactory()}. */ public FeatureTypeFactory getTypeFactory() throws FactoryRegistryException { return getFeatureTypeFactory(); }
public static LineString createLineString(final DirectPosition[] points) { final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); return createLineString(geometryFactory, points); }
public static PolyhedralSurface createPolyhedralSurface(final DirectPosition[][] patchPoints) { // get the crs and factories final CoordinateReferenceSystem crs = patchPoints[0][0].getCoordinateReferenceSystem(); final CommonFactory commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); // create polygons from each of the arrays of directPositions final List polygons = new ArrayList(patchPoints.length); for (int i = 0; i < patchPoints.length; i++) { final Polygon polygon = createPolygon(patchPoints[i]); polygons.add(polygon); } return geometryFactory.createPolyhedralSurface(polygons); }
public static Polygon createPolygon( final DirectPosition[] exteriorRingPoints, final DirectPosition[][] interiorRingsPoints) { final CoordinateReferenceSystem crs = exteriorRingPoints[0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); final Ring exteriorRing = createRing(primitiveFactory, exteriorRingPoints); List interiorRingList = interiorRingsPoints.length == 0 ? Collections.EMPTY_LIST : new ArrayList(interiorRingsPoints.length); for (int i = 0; i < interiorRingsPoints.length; i++) { final DirectPosition[] interiorRingPoints = interiorRingsPoints[i]; interiorRingList.add(createRing(primitiveFactory,interiorRingPoints)); } final SurfaceBoundary surfaceBoundary = primitiveFactory.createSurfaceBoundary(exteriorRing, interiorRingList); return geometryFactory.createPolygon(surfaceBoundary); }
public static Curve createCurve(final DirectPosition[] points) { final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); return createCurve(primitiveFactory, points); }
/** * Attempts to find a transform from the current CRS to the new CRS and * creates a new geometry by invoking that transform on each control point * of this geometry. */ public final Geometry transform(final CoordinateReferenceSystem newCRS) throws TransformException { try { BasicFactories commonFactory = BasicFactories.getDefault(); CoordinateOperationFactory cof = commonFactory.getCoordinateOperationFactory(); CoordinateReferenceSystem oldCRS = getCoordinateReferenceSystem(); CoordinateOperation coordOp = cof.createOperation(oldCRS, newCRS); MathTransform mt = coordOp.getMathTransform(); return transform(newCRS, mt); } catch (OperationNotFoundException e) { throw new TransformException("Unable to find an operation", e); } catch (FactoryException e) { throw new TransformException("Factory exception", e); } }
private static Curve createCurve( final PrimitiveFactory primitiveFactory, final DirectPosition[] points) { final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(primitiveFactory.getCoordinateReferenceSystem()); final List curveSegmentList = Collections.singletonList(createLineString(geometryFactory, points)); final Curve curve = primitiveFactory.createCurve(curveSegmentList); return curve; }
public static SurfaceBoundary createSurfaceBoundary( final DirectPosition[] exteriorRingPoints, final DirectPosition[][] interiorRingsPoints) { final CoordinateReferenceSystem crs = exteriorRingPoints[0].getCoordinateReferenceSystem(); final CommonFactory commonFactory = BasicFactories.getDefault(); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); return createSurfaceBoundary(primitiveFactory, exteriorRingPoints, interiorRingsPoints); }
public static SurfaceBoundary createSurfaceBoundary( final DirectPosition[] exteriorRingPoints, final DirectPosition[][] interiorRingsPoints) { final CoordinateReferenceSystem crs = exteriorRingPoints[0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); return createSurfaceBoundary(primitiveFactory, exteriorRingPoints, interiorRingsPoints); }
BasicFactories commonFactory = BasicFactories.getDefault(); CoordinateOperationFactory cof = commonFactory.getCoordinateOperationFactory(); CoordinateOperation coordOp = cof.createOperation(pointCRS, myCRS); MathTransform mt = coordOp.getMathTransform();
/** * Returns the {@linkplain NameFactory name factory} singleton. * * <p><strong>NOTE:</strong> This method is not yet supported in Geotools. The default * implementation thrown an exception in all case. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public NameFactory getNameFactory() throws FactoryRegistryException { throw new FactoryNotFoundException(unsupportedFactory(NameFactory.class)); }
public static PolyhedralSurface createPolyhedralSurface(final DirectPosition[][] patchPoints) { // get the crs and factories final CoordinateReferenceSystem crs = patchPoints[0][0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); // create polygons from each of the arrays of directPositions final List polygons = new ArrayList(patchPoints.length); for (int i = 0; i < patchPoints.length; i++) { final Polygon polygon = createPolygon(patchPoints[i]); polygons.add(polygon); } return geometryFactory.createPolyhedralSurface(polygons); }
public static Curve createCurve(final DirectPosition[] points) { final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem(); final CommonFactory commonFactory = BasicFactories.getDefault(); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); return createCurve(primitiveFactory, points); }
public static Ring createRing(final DirectPosition[] points) { final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs); return createRing(primitiveFactory, points); }
/** * Returns a default common factory instance. */ public static synchronized CommonFactory getDefault() { if (DEFAULT == null) { DEFAULT = new BasicFactories(new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE)); } return DEFAULT; }
/** * Returns the {@linkplain FeatureTypeFactory feature type factory} singleton. * <p> * <strong>NOTE:</strong> This method is not yet supported in Geotools. * The default implementation thrown an exception in all case. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. * * @deprecated use {@link #getFeatureTypeFactory()}. */ public FeatureTypeFactory getTypeFactory() throws FactoryRegistryException { return getFeatureTypeFactory(); }
/** * Returns the {@linkplain CitationFactory citation factory} singleton. * * <p><strong>NOTE:</strong> This method is not yet supported in Geotools. The default * implementation thrown an exception in all case. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CitationFactory getCitationFactory() throws FactoryRegistryException { throw new FactoryNotFoundException(unsupportedFactory(CitationFactory.class)); }
public static Envelope getWholeWorld() { if (WHOLE_WORLD == null) { CoordinateReferenceSystem crs = null; try { crs = org.geotools.referencing.CRS.decode("EPSG:4326"); } catch (Exception nsace){ getLog().warn("could not get crs for EPSG:4326"); } final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); final DirectPosition lowerCorner = geometryFactory.createDirectPosition(new double[] { -90, -180 }); final DirectPosition upperCorner = geometryFactory.createDirectPosition(new double[] { 90, 180 }); WHOLE_WORLD = geometryFactory.createEnvelope(lowerCorner, upperCorner); } return WHOLE_WORLD; }