Package org.geotools.measure

Examples of org.geotools.measure.Measure.doubleValue()


            if (crs instanceof AbstractCRS) try {
                final Measure distance;
                distance = ((AbstractCRS)crs).distance(position1.getCoordinate(),
                                                       position2.getCoordinate());
                table.setAlignment(TableWriter.ALIGN_RIGHT);
                table.write(numberFormat.format(distance.doubleValue()));
                table.write("  ");
                table.nextColumn();
                table.write(String.valueOf(distance.getUnit()));
                table.setAlignment(TableWriter.ALIGN_LEFT);
                return;
View Full Code Here


                    crsTransform.transform(co0, 0, geo0, 0, 1);
                    crsTransform.transform(co1, 0, geo1, 0, 1);

                    // get distance
                    Measure m = DefaultGeographicCRS.WGS84.distance(geo0, geo1);
                    if (m.doubleValue() > nearestDistance)
                        continue;
                    nearestFeature = f;
                    nearestDistance = m.doubleValue();
                    nearestBearing = calcBearing(co);
                    nearestPoint[0] = geo1[0];
View Full Code Here

                    // get distance
                    Measure m = DefaultGeographicCRS.WGS84.distance(geo0, geo1);
                    if (m.doubleValue() > nearestDistance)
                        continue;
                    nearestFeature = f;
                    nearestDistance = m.doubleValue();
                    nearestBearing = calcBearing(co);
                    nearestPoint[0] = geo1[0];
                    nearestPoint[1] = geo1[1];
                }
            } finally {
View Full Code Here

                    crsTransform.transform(co0, 0, geo0, 0, 1);
                    crsTransform.transform(co1, 0, geo1, 0, 1);

                    // get distance
                    Measure m = DefaultGeographicCRS.WGS84.distance(geo0, geo1);
                    if (m.doubleValue() > nearestDistance)
                        continue;
                    nearestFeature = f;
                    nearestDistance = m.doubleValue();
                    nearestBearing = calcBearing(co);
                }
View Full Code Here

                    // get distance
                    Measure m = DefaultGeographicCRS.WGS84.distance(geo0, geo1);
                    if (m.doubleValue() > nearestDistance)
                        continue;
                    nearestFeature = f;
                    nearestDistance = m.doubleValue();
                    nearestBearing = calcBearing(co);
                }
            } finally {
                if (featureIterator != null)
                    featureCollection.close(featureIterator);
View Full Code Here

      return null;
    }
   
    // if the user did not specify a unit of measure, we use it as an absolute value
    if(mt.getUnit() == null) {
      return mt.doubleValue();
    }
   
    // should not happen, but let's cover all our bases
    CoordinateReferenceSystem crs = info.getCRS();
    if(crs == null) {
View Full Code Here

    }
   
    // should not happen, but let's cover all our bases
    CoordinateReferenceSystem crs = info.getCRS();
    if(crs == null) {
      return mt.doubleValue();
    }
   
    // let's get the target unit
    SingleCRS horizontalCRS = CRS.getHorizontalCRS(crs);
    Unit targetUnit;
View Full Code Here

    if((targetUnit != null && targetUnit == NonSI.DEGREE_ANGLE) || horizontalCRS instanceof GeographicCRS || crs instanceof GeographicCRS) {
      // assume we're working against a type of geographic crs, must estimate the degrees equivalent
      // to the measure, we are going to use a very rough estimate (cylindrical earth model)
      // TODO: maybe look at the layer bbox and get a better estimate computed at the center of the bbox
      UnitConverter converter = mt.getUnit().getConverterTo(SI.METER);
      double tolMeters = converter.convert(mt.doubleValue());
      return tolMeters * OGC_METERS_TO_DEGREES;
    } else if(targetUnit != null && targetUnit.isCompatible(SI.METER)) {
      // ok, we assume the target is not a geographic one, but we might
      // have to convert between meters and feet maybe
      UnitConverter converter = mt.getUnit().getConverterTo(targetUnit);
View Full Code Here

      return tolMeters * OGC_METERS_TO_DEGREES;
    } else if(targetUnit != null && targetUnit.isCompatible(SI.METER)) {
      // ok, we assume the target is not a geographic one, but we might
      // have to convert between meters and feet maybe
      UnitConverter converter = mt.getUnit().getConverterTo(targetUnit);
      return converter.convert(mt.doubleValue());
    } else {
      return mt.doubleValue();
    }
   
  }
View Full Code Here

      // ok, we assume the target is not a geographic one, but we might
      // have to convert between meters and feet maybe
      UnitConverter converter = mt.getUnit().getConverterTo(targetUnit);
      return converter.convert(mt.doubleValue());
    } else {
      return mt.doubleValue();
    }
   
  }

  private Unit<?> getFirstAxisUnit(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.