Package org.goplanit.converter
Class CrsWriterImpl<T>
- java.lang.Object
-
- org.goplanit.converter.BaseWriterImpl<T>
-
- org.goplanit.converter.CrsWriterImpl<T>
-
- All Implemented Interfaces:
ConverterEntity
,ConverterWriter<T>
- Direct Known Subclasses:
GeometryIoWriter
,MatsimWriter
,PlanitWriterImpl
public abstract class CrsWriterImpl<T> extends BaseWriterImpl<T>
-
-
Field Summary
-
Fields inherited from class org.goplanit.converter.BaseWriterImpl
idMapper
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CrsWriterImpl(IdMapperType idMapperType)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.locationtech.jts.geom.Coordinate
createTransformedCoordinate(org.locationtech.jts.geom.Coordinate coordinate)
transform the coordinate absed on the destination transformerprotected static String
extractSrsName(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Extract the srs name to use based on the available crs information on network and this writerprotected org.opengis.referencing.crs.CoordinateReferenceSystem
getDestinationCoordinateReferenceSystem()
protected org.opengis.referencing.operation.MathTransform
getDestinationCrsTransformer()
get the destination crs transformer.protected PlanitJtsCrsUtils
getGeoUtils()
geo util class based on source Crs (if any)protected org.locationtech.jts.geom.Coordinate[]
getTransformedCoordinates(org.locationtech.jts.geom.Coordinate[] coordinates)
Transform the coordinate absed on the destination transformerprotected void
prepareCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCrs, org.opengis.referencing.crs.CoordinateReferenceSystem userDefinedDestinationCrs, String destinationCountry)
prepare the Crs transformer (if any) based on the user configuration settings.-
Methods inherited from class org.goplanit.converter.BaseWriterImpl
getComponentIdMappers, getIdMapperType, getPrimaryIdMapper, setIdMapperType, setParentIdMappers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.converter.ConverterEntity
getTypeDescription, reset
-
Methods inherited from interface org.goplanit.converter.ConverterWriter
getSettings, write
-
-
-
-
Constructor Detail
-
CrsWriterImpl
protected CrsWriterImpl(IdMapperType idMapperType)
Constructor- Parameters:
idMapperType
- to use
-
-
Method Detail
-
createTransformedCoordinate
protected org.locationtech.jts.geom.Coordinate createTransformedCoordinate(org.locationtech.jts.geom.Coordinate coordinate)
transform the coordinate absed on the destination transformer- Parameters:
coordinate
- to transform- Returns:
- transformed coordinate
-
getTransformedCoordinates
protected org.locationtech.jts.geom.Coordinate[] getTransformedCoordinates(org.locationtech.jts.geom.Coordinate[] coordinates)
Transform the coordinate absed on the destination transformer- Parameters:
coordinates
- to transform- Returns:
- transformed coordinates (if no conversion is required, input is returned
-
getDestinationCoordinateReferenceSystem
protected org.opengis.referencing.crs.CoordinateReferenceSystem getDestinationCoordinateReferenceSystem()
-
extractSrsName
protected static String extractSrsName(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Extract the srs name to use based on the available crs information on network and this writer- Parameters:
crs
- to use- Returns:
- srsName to use
-
prepareCoordinateReferenceSystem
protected void prepareCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCrs, org.opengis.referencing.crs.CoordinateReferenceSystem userDefinedDestinationCrs, String destinationCountry)
prepare the Crs transformer (if any) based on the user configuration settings. To be invoked internally by deriving writer just before actual writing starts- Parameters:
sourceCrs
- the crs used for the source material of this writeruserDefinedDestinationCrs
- the user configured destination Crs (if any)destinationCountry
- the destination country for which we can construct a Crs in case no specific destination Crs is provided
-
getDestinationCrsTransformer
protected org.opengis.referencing.operation.MathTransform getDestinationCrsTransformer()
get the destination crs transformer. Note it might be null and should only be collected afterprepareCoordinateReferenceSystem(CoordinateReferenceSystem, CoordinateReferenceSystem, String)
has been invoked which determines if and which transformer should be applied- Returns:
- destination crs transformer
-
getGeoUtils
protected PlanitJtsCrsUtils getGeoUtils()
geo util class based on source Crs (if any)- Returns:
- geoUtils
-
-