src/net/fortuna/ical4j/model/property/Geo.java

branch
ICAL4J_EMBED_1
changeset 15
cc93757aeca3
parent 14
5ae3e5665a0b
child 18
6dcaece8ec41
     1.1 --- a/src/net/fortuna/ical4j/model/property/Geo.java	Thu Feb 12 18:02:00 2015 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,253 +0,0 @@
     1.4 -/**
     1.5 - * Copyright (c) 2012, Ben Fortuna
     1.6 - * All rights reserved.
     1.7 - *
     1.8 - * Redistribution and use in source and binary forms, with or without
     1.9 - * modification, are permitted provided that the following conditions
    1.10 - * are met:
    1.11 - *
    1.12 - *  o Redistributions of source code must retain the above copyright
    1.13 - * notice, this list of conditions and the following disclaimer.
    1.14 - *
    1.15 - *  o Redistributions in binary form must reproduce the above copyright
    1.16 - * notice, this list of conditions and the following disclaimer in the
    1.17 - * documentation and/or other materials provided with the distribution.
    1.18 - *
    1.19 - *  o Neither the name of Ben Fortuna nor the names of any other contributors
    1.20 - * may be used to endorse or promote products derived from this software
    1.21 - * without specific prior written permission.
    1.22 - *
    1.23 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.24 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.25 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.26 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    1.27 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.28 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.29 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.30 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.31 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.32 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.33 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.34 - */
    1.35 -package net.fortuna.ical4j.model.property;
    1.36 -
    1.37 -import java.math.BigDecimal;
    1.38 -
    1.39 -import org.apache.commons.lang3.StringUtils;
    1.40 -
    1.41 -import net.fortuna.ical4j.model.ParameterList;
    1.42 -import net.fortuna.ical4j.model.Property;
    1.43 -import net.fortuna.ical4j.model.PropertyFactoryImpl;
    1.44 -import net.fortuna.ical4j.model.ValidationException;
    1.45 -
    1.46 -/**
    1.47 - * $Id$
    1.48 - *
    1.49 - * Created: [Apr 6, 2004]
    1.50 - *
    1.51 - * Defines a GEO iCalendar component property.
    1.52 - * 
    1.53 - * <pre>
    1.54 - *      4.8.1.6 Geographic Position
    1.55 - *      
    1.56 - *         Property Name: GEO
    1.57 - *      
    1.58 - *         Purpose: This property specifies information related to the global
    1.59 - *         position for the activity specified by a calendar component.
    1.60 - *      
    1.61 - *         Value Type: FLOAT. The value MUST be two SEMICOLON separated FLOAT
    1.62 - *         values.
    1.63 - *      
    1.64 - *         Property Parameters: Non-standard property parameters can be
    1.65 - *         specified on this property.
    1.66 - *      
    1.67 - *         Conformance: This property can be specified in  &quot;VEVENT&quot; or &quot;VTODO&quot;
    1.68 - *         calendar components.
    1.69 - *      
    1.70 - *         Description: The property value specifies latitude and longitude, in
    1.71 - *         that order (i.e., &quot;LAT LON&quot; ordering). The longitude represents the
    1.72 - *         location east or west of the prime meridian as a positive or negative
    1.73 - *         real number, respectively. The longitude and latitude values MAY be
    1.74 - *         specified up to six decimal places, which will allow for accuracy to
    1.75 - *         within one meter of geographical position. Receiving applications
    1.76 - *         MUST accept values of this precision and MAY truncate values of
    1.77 - *         greater precision.
    1.78 - *      
    1.79 - *         Values for latitude and longitude shall be expressed as decimal
    1.80 - *         fractions of degrees. Whole degrees of latitude shall be represented
    1.81 - *         by a two-digit decimal number ranging from 0 through 90. Whole
    1.82 - *         degrees of longitude shall be represented by a decimal number ranging
    1.83 - *         from 0 through 180. When a decimal fraction of a degree is specified,
    1.84 - *         it shall be separated from the whole number of degrees by a decimal
    1.85 - *         point.
    1.86 - *      
    1.87 - *         Latitudes north of the equator shall be specified by a plus sign (+),
    1.88 - *         or by the absence of a minus sign (-), preceding the digits
    1.89 - *         designating degrees. Latitudes south of the Equator shall be
    1.90 - *         designated by a minus sign (-) preceding the digits designating
    1.91 - *         degrees. A point on the Equator shall be assigned to the Northern
    1.92 - *         Hemisphere.
    1.93 - *      
    1.94 - *         Longitudes east of the prime meridian shall be specified by a plus
    1.95 - *         sign (+), or by the absence of a minus sign (-), preceding the digits
    1.96 - *         designating degrees. Longitudes west of the meridian shall be
    1.97 - *         designated by minus sign (-) preceding the digits designating
    1.98 - *         degrees. A point on the prime meridian shall be assigned to the
    1.99 - *         Eastern Hemisphere. A point on the 180th meridian shall be assigned
   1.100 - *         to the Western Hemisphere. One exception to this last convention is
   1.101 - *         permitted. For the special condition of describing a band of latitude
   1.102 - *         around the earth, the East Bounding Coordinate data element shall be
   1.103 - *         assigned the value +180 (180) degrees.
   1.104 - *      
   1.105 - *         Any spatial address with a latitude of +90 (90) or -90 degrees will
   1.106 - *         specify the position at the North or South Pole, respectively. The
   1.107 - *         component for longitude may have any legal value.
   1.108 - *      
   1.109 - *         With the exception of the special condition described above, this
   1.110 - *         form is specified in Department of Commerce, 1986, Representation of
   1.111 - *         geographic point locations for information interchange (Federal
   1.112 - *         Information Processing Standard 70-1):  Washington,  Department of
   1.113 - *         Commerce, National Institute of Standards and Technology.
   1.114 - *      
   1.115 - *         The simple formula for converting degrees-minutes-seconds into
   1.116 - *         decimal degrees is:
   1.117 - *      
   1.118 - *           decimal = degrees + minutes/60 + seconds/3600.
   1.119 - *      
   1.120 - *         Format Definition: The property is defined by the following notation:
   1.121 - *      
   1.122 - *           geo        = &quot;GEO&quot; geoparam &quot;:&quot; geovalue CRLF
   1.123 - *      
   1.124 - *           geoparam   = *(&quot;;&quot; xparam)
   1.125 - *      
   1.126 - *           geovalue   = float &quot;;&quot; float
   1.127 - *           ;Latitude and Longitude components
   1.128 - *      
   1.129 - *         Example: The following is an example of this property:
   1.130 - *      
   1.131 - *           GEO:37.386013;-122.082932
   1.132 - * </pre>
   1.133 - * 
   1.134 - * @author Ben Fortuna
   1.135 - */
   1.136 -public class Geo extends Property {
   1.137 -
   1.138 -    private static final long serialVersionUID = -902100715801867636L;
   1.139 -
   1.140 -    private BigDecimal latitude;
   1.141 -
   1.142 -    private BigDecimal longitude;
   1.143 -
   1.144 -    /**
   1.145 -     * Default constructor.
   1.146 -     */
   1.147 -    public Geo() {
   1.148 -        super(GEO, PropertyFactoryImpl.getInstance());
   1.149 -        latitude = BigDecimal.valueOf(0);
   1.150 -        longitude = BigDecimal.valueOf(0);
   1.151 -    }
   1.152 -
   1.153 -    /**
   1.154 -     * Creates a new instance by parsing the specified string representation.
   1.155 -     * @param value a geo value
   1.156 -     */
   1.157 -    public Geo(final String value) {
   1.158 -        super(GEO, PropertyFactoryImpl.getInstance());
   1.159 -        setValue(value);
   1.160 -    }
   1.161 -
   1.162 -    /**
   1.163 -     * @param aList a list of parameters for this component
   1.164 -     * @param aValue a value string for this component
   1.165 -     */
   1.166 -    public Geo(final ParameterList aList, final String aValue) {
   1.167 -        super(GEO, aList, PropertyFactoryImpl.getInstance());
   1.168 -        setValue(aValue);
   1.169 -    }
   1.170 -
   1.171 -    /**
   1.172 -     * @param latitude a latitudinal value
   1.173 -     * @param longitude a longitudinal value
   1.174 -     */
   1.175 -    public Geo(final BigDecimal latitude, final BigDecimal longitude) {
   1.176 -        super(GEO, PropertyFactoryImpl.getInstance());
   1.177 -        this.latitude = latitude;
   1.178 -        this.longitude = longitude;
   1.179 -    }
   1.180 -
   1.181 -    /**
   1.182 -     * @param aList a list of parameters for this component
   1.183 -     * @param latitude a latitudinal value
   1.184 -     * @param longitude a longitudinal value
   1.185 -     */
   1.186 -    public Geo(final ParameterList aList, final BigDecimal latitude,
   1.187 -            final BigDecimal longitude) {
   1.188 -        super(GEO, aList, PropertyFactoryImpl.getInstance());
   1.189 -        this.latitude = latitude;
   1.190 -        this.longitude = longitude;
   1.191 -    }
   1.192 -
   1.193 -    /**
   1.194 -     * @return Returns the latitude.
   1.195 -     */
   1.196 -    public final BigDecimal getLatitude() {
   1.197 -        return latitude;
   1.198 -    }
   1.199 -
   1.200 -    /**
   1.201 -     * @return Returns the longitude.
   1.202 -     */
   1.203 -    public final BigDecimal getLongitude() {
   1.204 -        return longitude;
   1.205 -    }
   1.206 -
   1.207 -    /**
   1.208 -     * {@inheritDoc}
   1.209 -     */
   1.210 -    public final void setValue(final String aValue) {
   1.211 -        final String latitudeString = aValue.substring(0, aValue.indexOf(';'));
   1.212 -        if (StringUtils.isNotBlank(latitudeString)) {
   1.213 -            latitude = new BigDecimal(latitudeString);
   1.214 -        }
   1.215 -        else {
   1.216 -            latitude = BigDecimal.valueOf(0);
   1.217 -        }
   1.218 -        
   1.219 -        final String longitudeString = aValue.substring(aValue.indexOf(';') + 1);
   1.220 -        if (StringUtils.isNotBlank(longitudeString)) {
   1.221 -            longitude = new BigDecimal(longitudeString);
   1.222 -        }
   1.223 -        else {
   1.224 -            longitude = BigDecimal.valueOf(0);
   1.225 -        }
   1.226 -    }
   1.227 -
   1.228 -    /**
   1.229 -     * {@inheritDoc}
   1.230 -     */
   1.231 -    public final String getValue() {
   1.232 -        return String.valueOf(getLatitude()) + ";"
   1.233 -                + String.valueOf(getLongitude());
   1.234 -    }
   1.235 -
   1.236 -    /**
   1.237 -     * @param latitude The latitude to set.
   1.238 -     */
   1.239 -    public final void setLatitude(final BigDecimal latitude) {
   1.240 -        this.latitude = latitude;
   1.241 -    }
   1.242 -
   1.243 -    /**
   1.244 -     * @param longitude The longitude to set.
   1.245 -     */
   1.246 -    public final void setLongitude(final BigDecimal longitude) {
   1.247 -        this.longitude = longitude;
   1.248 -    }
   1.249 -
   1.250 -    /**
   1.251 -     * {@inheritDoc}
   1.252 -     */
   1.253 -    public final void validate() throws ValidationException {
   1.254 -        // TODO: Auto-generated method stub
   1.255 -    }
   1.256 -}

mercurial