Package org.geotools.util

Examples of org.geotools.util.DateRange


        final long time2 = 1000100000l;
        final Date start2 = new Date(time2);
        final Date end2 = new Date(time2 + 1000000l);

        final DateRange dr1 = new DateRange(start1, end1);
        final DateRange dr2 = new DateRange(start2, end2);
        final List<DateRange> list = new ArrayList<DateRange>();
        list.add(dr2);
        list.add(dr1);

        final DateRangeTreeSet treeSet = new DateRangeTreeSet(list);
View Full Code Here


            // Getting global Extent
            Date startTime;
            try {
                startTime = adaptee.getMinimum();
                Date endTime =  adaptee.getMaximum();
                final DateRange global = new DateRange(startTime, endTime);
                final SortedSet<DateRange> globalTemporalExtent = new DateRangeTreeSet();
                globalTemporalExtent.add(global);
                return globalTemporalExtent;
            } catch (IOException e) {
                throw new RuntimeException(e);
View Full Code Here

            if (overall) {
               
                // Getting overall Extent
                final SortedSet<DateRange> extent = new TreeSet<DateRange>(new DateRangeComparator());
                for(Date dd:adaptee.read()){
                    extent.add(new DateRange(dd,dd));
                }
                return extent;
            } else {
                return getTemporalExtent();
            }
View Full Code Here

            Class<?> type=adaptee.getType();
            if(Date.class.isAssignableFrom(type)){
                this.type=DomainType.DATE;
               
                // global domain
                globalDomainExtent.add(new DateRange(
                        (Date)adaptee.getMinimum(),
                        (Date)adaptee.getMaximum()));
            } else if(Number.class.isAssignableFrom(type)){
                this.type=DomainType.NUMBER;
View Full Code Here

        // Definition of the parameters
        CoordinateReferenceSystem crs = source.getCoordinateReferenceSystem();
        Rectangle rasterArea = new Rectangle(0, 0, 10, 10);
        Hints hints = new Hints();
        String handle = "test_handle";
        DateRange range = new DateRange(new Date(10000), new Date(20000));
        DateRangeTreeSet set = new DateRangeTreeSet();
        set.add(range);
        Filter filter = Filter.INCLUDE;
        MathTransform2D gridToWorldTransform = new AffineTransform2D(
                AffineTransform.getTranslateInstance(0, 0));
View Full Code Here

                return buildTemporalList(temporalElements);
            } else if (name.endsWith("datatype")) {
                return Date.class.getName();
            } else {
                SortedSet<? extends DateRange> temporalElements = temporalDomain.getTemporalElements(false, null);
                DateRange overall = temporalElements.iterator().next();
                // min or max requests
                if (name.endsWith("maximum")) {
                    return ConvertersHack.convert(overall.getMaxValue(), String.class);
                } else if (name.endsWith("minimum")) {
                    return ConvertersHack.convert(overall.getMinValue(), String.class);
                } else {
                    throw new IllegalArgumentException("Unsupported metadata name");
                }
            }
        } else if (domain instanceof AdditionalDomain) {
View Full Code Here

        Iterator<DateRange> iterator = (Iterator<DateRange>) temporalElements.iterator();
//        LinkedHashSet<String> result = new LinkedHashSet<String>();

        final StringBuilder buff = new StringBuilder("");
        while (iterator.hasNext()) {
            DateRange range = iterator.next();
            buff.append(ConvertersHack.convert(range.getMinValue(), String.class) + "/" + ConvertersHack.convert(range.getMaxValue(), String.class));
            if (iterator.hasNext()) {
                buff.append(",");
            }
        }
        return buff.toString();
View Full Code Here

            final List<?> dates = (List<?>) value;
            if (dates != null && !dates.isEmpty()) {
                SortedSet<DateRange> requestedTemporalSubset = new DateRangeTreeSet();
                for (Object val : dates) {
                    if (val instanceof Date) {
                        requestedTemporalSubset.add(new DateRange((Date) val, (Date) val));
                    } else if (val instanceof DateRange) {
                        requestedTemporalSubset.add((DateRange)val);
                    }
                }
               
View Full Code Here

        final Object firstValue = expr1.evaluate(feature);
        final Object secondValue = expr2.evaluate(feature);
        if (firstValue != null && secondValue != null) {
            final Date beginDate = (Date) firstValue;
            final Date endDate = (Date) secondValue;
            set.add(new DateRange(beginDate, endDate));
        }
    }
View Full Code Here

     * @return
     */
    @Override
    protected void populateRange() {
        Iterator<? extends Range> iterator = set.iterator();
        DateRange second = null;
        DateRange first;
        while (iterator.hasNext()) {
            first = second;
            second = (DateRange) iterator.next();
            if (first != null) {
                // Compact intervals with intersections
View Full Code Here

TOP

Related Classes of org.geotools.util.DateRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.