Codota Logo
Geometry.isRectangle
Code IndexAdd Codota to your IDE (free)

How to use
isRectangle
method
in
com.vividsolutions.jts.geom.Geometry

Best Java code snippets using com.vividsolutions.jts.geom.Geometry.isRectangle (Showing top 19 results out of 315)

  • Common ways to obtain Geometry
private void myMethod () {
Geometry g =
  • Codota IconGeometryCollection gc;gc.getGeometryN(n)
  • Codota IconSimpleFeature feature;(Geometry) feature.getDefaultGeometry()
  • Codota IconString wellKnownText;new WKTReader().read(wellKnownText)
  • Smart code suggestions by Codota
}
origin: com.vividsolutions/jts

public PreparedPolygon(Polygonal poly) {
 super((Geometry) poly);
 isRectangle = getGeometry().isRectangle();
}
origin: com.vividsolutions/jts

if (isRectangle()) {
 return RectangleIntersects.intersects((Polygon) this, g);
if (g.isRectangle()) {
 return RectangleIntersects.intersects((Polygon) g, this);
origin: com.vividsolutions/jts

 return false;
if (isRectangle()) {
origin: com.vividsolutions/jts

 return false;
if (isRectangle()) {
 return RectangleContains.contains((Polygon) this, g);
origin: org.orbisgis/h2gis-functions

  /**
   * Returns true if the given geometry is a rectangle.
   *
   * @param geometry Geometry
   * @return True if the given geometry is a rectangle
   */
  public static Boolean isRectangle(Geometry geometry) {
    if(geometry == null){
      return null;
    }
    return geometry.isRectangle();
  }
}
origin: org.orbisgis/h2gis

  /**
   * Returns true if the given geometry is a rectangle.
   *
   * @param geometry Geometry
   * @return True if the given geometry is a rectangle
   */
  public static Boolean isRectangle(Geometry geometry) {
    if(geometry == null){
      return null;
    }
    return geometry.isRectangle();
  }
}
origin: org.geotools/gt-render

public boolean isRectangle() {
  return geometry.isRectangle();
}
origin: com.vividsolutions/jts-core

public PreparedPolygon(Polygonal poly) {
 super((Geometry) poly);
 isRectangle = getGeometry().isRectangle();
}
origin: net.di2e.ecdr.libs/cdr-rest-search-commons

public static String polygonToBBox( String wkt ) throws ParseException {
  LOGGER.trace( "Trying to convert the wkt [{}] into a bounding box", wkt );
  WKTReader reader = new WKTReader();
  Geometry geo = reader.read( wkt );
  if ( !geo.isRectangle() ) {
    geo = geo.getEnvelope();
    WKTWriter writer = new WKTWriter();
    String bbox = writer.write( geo );
    LOGGER.debug( "Convert the following wkt [{}] into a bounding box wkt [{}]", wkt, bbox );
    wkt = bbox;
  }
  return wkt;
}
origin: net.di2e.ecdr.libs/cdr-rest-search-commons

@Override
public T intersects( String propertyName, String wkt ) {
  logEntry( "intersects", propertyName, wkt );
  boolean isBbox = false;
  try {
    WKTReader reader = new WKTReader();
    isBbox = reader.read( wkt ).isRectangle();
  } catch ( ParseException e ) {
    LOGGER.warn( "WKT could not be parsed into geometry object [{}]: " + e.getMessage() );
  }
  return callHandleGeoMethod( propertyName, wkt, null, isBbox ? GeospatialFilterOptions.BBOX : GeospatialFilterOptions.INTERSECTS, null );
}
origin: com.vividsolutions/jts-core

if (isRectangle()) {
 return RectangleIntersects.intersects((Polygon) this, g);
if (g.isRectangle()) {
 return RectangleIntersects.intersects((Polygon) g, this);
origin: com.vividsolutions/jts-core

 return false;
if (isRectangle()) {
origin: com.spatial4j/spatial4j

/**
 * Parses a POLYGON shape from the raw string. It might return a
 * {@link com.spatial4j.core.shape.Rectangle} if the polygon is one.
 * 
 * <pre>
 * coordinateSequenceList
 * </pre>
 */
protected Shape parsePolygonShape(WKTReader.State state) throws ParseException {
 Geometry geometry;
 if (state.nextIfEmptyAndSkipZM()) {
  GeometryFactory geometryFactory = ctx.getGeometryFactory();
  geometry =
    geometryFactory
      .createPolygon(geometryFactory.createLinearRing(new Coordinate[] {}), null);
 } else {
  geometry = polygon(state);
  if (geometry.isRectangle()) {
   return ctx.makeRectFromRectangularPoly(geometry);
  }
 }
 return ctx.makeShapeFromGeometry(geometry);
}
origin: com.vividsolutions/jts-core

 return false;
if (isRectangle()) {
 return RectangleContains.contains((Polygon) this, g);
origin: harbby/presto-connectors

/**
 * Parses a POLYGON shape from the raw string. It might return a
 * {@link com.spatial4j.core.shape.Rectangle} if the polygon is one.
 * 
 * <pre>
 * coordinateSequenceList
 * </pre>
 */
protected Shape parsePolygonShape(WKTReader.State state) throws ParseException {
 Geometry geometry;
 if (state.nextIfEmptyAndSkipZM()) {
  GeometryFactory geometryFactory = ctx.getGeometryFactory();
  geometry =
    geometryFactory
      .createPolygon(geometryFactory.createLinearRing(new Coordinate[] {}), null);
 } else {
  geometry = polygon(state);
  if (geometry.isRectangle()) {
   return ctx.makeRectFromRectangularPoly(geometry);
  }
 }
 return ctx.makeShapeFromGeometry(geometry);
}
origin: com.spatial4j/spatial4j

/**
 * Reads WKT from the {@code str} via JTS's {@link com.vividsolutions.jts.io.WKTReader}.
 * @param str
 * @param reader <pre>new WKTReader(ctx.getGeometryFactory()))</pre>
 * @return Non-Null
 */
protected Shape parseIfSupported(String str, WKTReader reader) throws ParseException {
 try {
  Geometry geom = reader.read(str);
  //Normalizes & verifies coordinates
  checkCoordinates(geom);
  if (geom instanceof com.vividsolutions.jts.geom.Point) {
   com.vividsolutions.jts.geom.Point ptGeom = (com.vividsolutions.jts.geom.Point) geom;
   if (ctx.useJtsPoint())
    return new JtsPoint(ptGeom, ctx);
   else
    return ctx.makePoint(ptGeom.getX(), ptGeom.getY());
  } else if (geom.isRectangle()) {
   return super.ctx.makeRectFromRectangularPoly(geom);
  } else {
   return super.ctx.makeShapeFromGeometry(geom);
  }
 } catch (InvalidShapeException e) {
  throw e;
 } catch (Exception e) {
  throw new InvalidShapeException("error reading WKT: "+e.toString(), e);
 }
}
origin: harbby/presto-connectors

/**
 * Reads WKT from the {@code str} via JTS's {@link com.vividsolutions.jts.io.WKTReader}.
 * @param str
 * @param reader <pre>new WKTReader(ctx.getGeometryFactory()))</pre>
 * @return Non-Null
 */
protected Shape parseIfSupported(String str, WKTReader reader) throws ParseException {
 try {
  Geometry geom = reader.read(str);
  //Normalizes & verifies coordinates
  checkCoordinates(geom);
  if (geom instanceof com.vividsolutions.jts.geom.Point) {
   com.vividsolutions.jts.geom.Point ptGeom = (com.vividsolutions.jts.geom.Point) geom;
   if (ctx.useJtsPoint())
    return new JtsPoint(ptGeom, ctx);
   else
    return ctx.makePoint(ptGeom.getX(), ptGeom.getY());
  } else if (geom.isRectangle()) {
   return super.ctx.makeRectFromRectangularPoly(geom);
  } else {
   return super.ctx.makeShapeFromGeometry(geom);
  }
 } catch (InvalidShapeException e) {
  throw e;
 } catch (Exception e) {
  throw new InvalidShapeException("error reading WKT: "+e.toString(), e);
 }
}
origin: com.spatial4j/spatial4j

 /**
  * INTERNAL: Returns a Rectangle of the JTS {@link Envelope} (bounding box) of the given {@code geom}.  This asserts
  * that {@link Geometry#isRectangle()} is true.  This method reacts to the {@link DatelineRule} setting.
  * @param geom non-null
  * @return null equivalent Rectangle.
  */
 public Rectangle makeRectFromRectangularPoly(Geometry geom) {
  // TODO although, might want to never convert if there's a semantic difference (e.g.
  //  geodetically)? Should have a setting for that.
  assert geom.isRectangle();
  Envelope env = geom.getEnvelopeInternal();
  boolean crossesDateline = false;
  if (isGeo() && getDatelineRule() != DatelineRule.none) {
   if (getDatelineRule() == DatelineRule.ccwRect) {
    // If JTS says it is clockwise, then it's actually a dateline crossing rectangle.
    crossesDateline = !CGAlgorithms.isCCW(geom.getCoordinates());
   } else {
    crossesDateline = env.getWidth() > 180;
   }
  }
  if (crossesDateline)
   return makeRectangle(env.getMaxX(), env.getMinX(), env.getMinY(), env.getMaxY());
  else
   return makeRectangle(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY());
 }
}
origin: harbby/presto-connectors

 /**
  * INTERNAL: Returns a Rectangle of the JTS {@link Envelope} (bounding box) of the given {@code geom}.  This asserts
  * that {@link Geometry#isRectangle()} is true.  This method reacts to the {@link DatelineRule} setting.
  * @param geom non-null
  * @return null equivalent Rectangle.
  */
 public Rectangle makeRectFromRectangularPoly(Geometry geom) {
  // TODO although, might want to never convert if there's a semantic difference (e.g.
  //  geodetically)? Should have a setting for that.
  assert geom.isRectangle();
  Envelope env = geom.getEnvelopeInternal();
  boolean crossesDateline = false;
  if (isGeo() && getDatelineRule() != DatelineRule.none) {
   if (getDatelineRule() == DatelineRule.ccwRect) {
    // If JTS says it is clockwise, then it's actually a dateline crossing rectangle.
    crossesDateline = !CGAlgorithms.isCCW(geom.getCoordinates());
   } else {
    crossesDateline = env.getWidth() > 180;
   }
  }
  if (crossesDateline)
   return makeRectangle(env.getMaxX(), env.getMinX(), env.getMinY(), env.getMaxY());
  else
   return makeRectangle(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY());
 }
}
com.vividsolutions.jts.geomGeometryisRectangle

Popular methods of Geometry

  • getEnvelopeInternal
    Gets an Envelope containing the minimum and maximum x and y values in this Geometry. If the geometr
  • getCoordinates
    Returns an array containing the values of all the vertices for this geometry. If the geometry is a c
  • isEmpty
    Tests whether the set of points covered by this Geometry is empty.
  • getCentroid
    Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of componen
  • getGeometryN
    Returns an element Geometry from a GeometryCollection(or this, if the geometry is not a collection).
  • toText
    Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text
  • getNumGeometries
    Returns the number of Geometrys in a GeometryCollection(or 1, if the geometry is not a collection).
  • getFactory
    Gets the factory which contains the context in which this geometry was created.
  • getGeometryType
    Returns the name of this Geometry's actual class.
  • getSRID
    Returns the ID of the Spatial Reference System used by the Geometry. JTS supports Spatial Reference
  • getCoordinate
    Returns a vertex of this Geometry (usually, but not necessarily, the first one). The returned coordi
  • intersection
    Computes a Geometry representing the point-set which is common to both this Geometry and the other
  • getCoordinate,
  • intersection,
  • buffer,
  • contains,
  • getArea,
  • getEnvelope,
  • intersects,
  • union,
  • apply,
  • getLength

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • putExtra (Intent)
  • findViewById (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now