/** * Returns a SIS datum implementation with the same values than the given arbitrary implementation. * If the given object is {@code null}, then this method returns {@code null}. * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultEngineeringDatum castOrCopy(final EngineeringDatum object) { return (object == null) || (object instanceof DefaultEngineeringDatum) ? (DefaultEngineeringDatum) object : new DefaultEngineeringDatum(object); }
/** * Returns a SIS datum implementation with the same values than the given arbitrary implementation. * If the given object is {@code null}, then this method returns {@code null}. * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultEngineeringDatum castOrCopy(final EngineeringDatum object) { return (object == null) || (object instanceof DefaultEngineeringDatum) ? (DefaultEngineeringDatum) object : new DefaultEngineeringDatum(object); }
/** * Creates an engineering CRS using a two-dimensional Cartesian coordinate system. */ private static DefaultEngineeringCRS createCartesian() { return new DefaultEngineeringCRS(Collections.singletonMap(DefaultEngineeringCRS.NAME_KEY, "A construction site CRS"), new DefaultEngineeringDatum(Collections.singletonMap(DefaultEngineeringDatum.NAME_KEY, "P1")), HardCodedCS.CARTESIAN_2D); }
/** * Creates an engineering CRS using a three-dimensional Spherical coordinate system. */ private static DefaultEngineeringCRS createSpherical() { return new DefaultEngineeringCRS(Collections.singletonMap(DefaultEngineeringCRS.NAME_KEY, "A spherical CRS"), new DefaultEngineeringDatum(Collections.singletonMap(DefaultEngineeringDatum.NAME_KEY, "Centre")), HardCodedCS.SPHERICAL); }
/** * Creates an engineering datum. * The default implementation creates a {@link DefaultEngineeringDatum} instance. * * @param properties name and other properties to give to the new object. * @throws FactoryException if the object creation failed. * * @see DefaultEngineeringDatum#DefaultEngineeringDatum(Map) * @see GeodeticAuthorityFactory#createEngineeringDatum(String) */ @Override public EngineeringDatum createEngineeringDatum(final Map<String,?> properties) throws FactoryException { final DefaultEngineeringDatum datum; try { datum = new DefaultEngineeringDatum(complete(properties)); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception); } return unique("createEngineeringDatum", datum); }
/** * Creates an engineering datum. * The default implementation creates a {@link DefaultEngineeringDatum} instance. * * @param properties name and other properties to give to the new object. * @throws FactoryException if the object creation failed. * * @see DefaultEngineeringDatum#DefaultEngineeringDatum(Map) * @see GeodeticAuthorityFactory#createEngineeringDatum(String) */ @Override public EngineeringDatum createEngineeringDatum(final Map<String,?> properties) throws FactoryException { final DefaultEngineeringDatum datum; try { datum = new DefaultEngineeringDatum(complete(properties)); } catch (IllegalArgumentException exception) { throw new InvalidGeodeticParameterException(exception); } return unique("createEngineeringDatum", datum); }