本文整理匯總了Java中com.vividsolutions.jts.geom.Envelope.getMinX方法的典型用法代碼示例。如果您正苦於以下問題:Java Envelope.getMinX方法的具體用法?Java Envelope.getMinX怎麽用?Java Envelope.getMinX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.Envelope
的用法示例。
在下文中一共展示了Envelope.getMinX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createFrame
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private void createFrame(Envelope env) {
double deltaX = env.getWidth();
double deltaY = env.getHeight();
double offset = 0.0;
if (deltaX > deltaY) {
offset = deltaX * 10.0;
} else {
offset = deltaY * 10.0;
}
this.frameVertex[0] = new Vertex((env.getMaxX() + env.getMinX()) / 2.0, env
.getMaxY()
+ offset);
this.frameVertex[1] = new Vertex(env.getMinX() - offset, env.getMinY() - offset);
this.frameVertex[2] = new Vertex(env.getMaxX() + offset, env.getMinY() - offset);
this.frameEnv = new Envelope(this.frameVertex[0].getCoordinate(), this.frameVertex[1]
.getCoordinate());
this.frameEnv.expandToInclude(this.frameVertex[2].getCoordinate());
}
示例2: applySearchBoundary
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private String applySearchBoundary(String reqParams, SearchBoundary searchBoundary)
{
if (searchBoundary != null)
{
if (searchBoundary instanceof RectSearchBoundary)
{
RectSearchBoundary rsb = (RectSearchBoundary)searchBoundary;
Envelope env = rsb.getRectangle();
reqParams += "&boundary.rect.min_lat=" + env.getMinY() + "&boundary.rect.min_lon=" + env.getMinX() + "&boundary.rect.max_lat=" + env.getMaxY() + "&boundary.rect.max_lon=" + env.getMaxX();
}
else if (searchBoundary instanceof CircleSearchBoundary)
{
CircleSearchBoundary csb = (CircleSearchBoundary)searchBoundary;
reqParams += "&boundary.circle.lat=" + csb.getLatitude() + "&boundary.circle.lon=" + csb.getLongitude() + "&boundary.circle.radius=" + csb.getRadius();
}
}
return reqParams;
}
示例3: getSubnodeIndex
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* Gets the index of the subquad that wholly contains the given envelope.
* If none does, returns -1.
*
* @return the index of the subquad that wholly contains the given envelope
* or -1 if no subquad wholly contains the envelope
*/
public static int getSubnodeIndex(Envelope env, double centrex, double centrey) {
int subnodeIndex = -1;
if (env.getMinX() >= centrex) {
if (env.getMinY() >= centrey) {
subnodeIndex = 3;
}
if (env.getMaxY() <= centrey) {
subnodeIndex = 1;
}
}
if (env.getMaxX() <= centrex) {
if (env.getMinY() >= centrey) {
subnodeIndex = 2;
}
if (env.getMaxY() <= centrey) {
subnodeIndex = 0;
}
}
return subnodeIndex;
}
示例4: ensureExtent
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* Ensure that the envelope for the inserted item has non-zero extents.
* Use the current minExtent to pad the envelope, if necessary
*/
public static Envelope ensureExtent(Envelope itemEnv, double minExtent) {
//The names "ensureExtent" and "minExtent" are misleading -- sounds like
//this method ensures that the extents are greater than minExtent.
//Perhaps we should rename them to "ensurePositiveExtent" and "defaultExtent".
//[Jon Aquino]
double minx = itemEnv.getMinX();
double maxx = itemEnv.getMaxX();
double miny = itemEnv.getMinY();
double maxy = itemEnv.getMaxY();
// has a non-zero extent
if (minx != maxx && miny != maxy) {
return itemEnv;
}
// pad one or both extents
if (minx == maxx) {
minx = minx - minExtent / 2.0;
maxx = minx + minExtent / 2.0;
}
if (miny == maxy) {
miny = miny - minExtent / 2.0;
maxy = miny + minExtent / 2.0;
}
return new Envelope(minx, maxx, miny, maxy);
}
示例5: createEllipse
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* Creates an elliptical {@link Polygon}.
* If the supplied envelope is square the
* result will be a circle.
*
* @return an ellipse or circle
*/
public Polygon createEllipse() {
Envelope env = this.dim.getEnvelope();
double xRadius = env.getWidth() / 2.0;
double yRadius = env.getHeight() / 2.0;
double centreX = env.getMinX() + xRadius;
double centreY = env.getMinY() + yRadius;
Coordinate[] pts = new Coordinate[this.nPts + 1];
int iPt = 0;
for (int i = 0; i < this.nPts; i++) {
double ang = i * (2 * Math.PI / this.nPts);
double x = xRadius * Math.cos(ang) + centreX;
double y = yRadius * Math.sin(ang) + centreY;
pts[iPt++] = this.coord(x, y);
}
pts[iPt] = new Coordinate(pts[0]);
LinearRing ring = this.geomFact.createLinearRing(pts);
Polygon poly = this.geomFact.createPolygon(ring, null);
return (Polygon) this.rotate(poly);
}
示例6: fastGetSharedAreaRatio
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* This is ten times faster than the absolutely correct
* version above, and it's only off by an average of 1%.
* Note that the first argument MUST be rectangular, or
* your results will be meaningless.
*/
public static double fastGetSharedAreaRatio (Geometry geom1, Geometry geom2) {
Envelope env1 = geom1.getEnvelopeInternal();
if ((SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMaxY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMaxY()), geom2) == Location.INTERIOR)) {
// I suppose it is possible for a valid polygon geometry
// to contain all four corners and share considerably less
// than 100% of its area with the envelope in question.
// But if you're that worried about correctness you
// shouldn't be using this method in the first place.
return 1.0;
}
double xInc = env1.getWidth() / 9.0;
double yInc = env1.getHeight() / 9.0;
double x = env1.getMinX();
double y = env1.getMinY();
double ct = 0;
for (int i = 0; i < 10; i += 1) {
y = env1.getMinY();
for (int j = 0; j < 10; j += 1) {
if (SimplePointInAreaLocator.locate(new Coordinate(x,y), geom2) == Location.INTERIOR) {
ct += 1;
}
y += yInc;
}
x += xInc;
}
return (ct / 100.0);
}
示例7: createRectangleWithSideLengthInMeters
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public static Polygon createRectangleWithSideLengthInMeters(Point p, double sideLengthMeters) {
Envelope env = createEnvelopeInMeters(p, sideLengthMeters);
Coordinate[] coords = new Coordinate[5];
coords[0] = new Coordinate(env.getMinX(), env.getMinY());
coords[1] = new Coordinate(env.getMinX(), env.getMaxY());
coords[2] = new Coordinate(env.getMaxX(), env.getMaxY());
coords[3] = new Coordinate(env.getMaxX(), env.getMinY());
coords[4] = new Coordinate(env.getMinX(), env.getMinY());
return gm.createPolygon(coords);
}
示例8: buildBboxFilter
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private String buildBboxFilter(Envelope bbox)
{
String polygon = "'POLYGON((" + bbox.getMinX() + " " + bbox.getMinY() + "," +
bbox.getMinX() + " " + bbox.getMaxY() + "," +
bbox.getMaxX() + " " + bbox.getMaxY() + "," +
bbox.getMinY() + " " + bbox.getMaxY() + "," +
bbox.getMinX() + " " + bbox.getMinY() +"))'";
return "GEOGRAPHY_INTERSECTS(" + polygon + "," + _geomColumn + ")";
}
示例9: getKey
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private SpatialKey getKey(SearchRow row) {
if (row == null) {
return null;
}
Value v = row.getValue(columnIds[0]);
if (v == ValueNull.INSTANCE) {
return null;
}
Geometry g = ((ValueGeometry) v.convertTo(Value.GEOMETRY)).getGeometryNoCopy();
Envelope env = g.getEnvelopeInternal();
return new SpatialKey(row.getKey(),
(float) env.getMinX(), (float) env.getMaxX(),
(float) env.getMinY(), (float) env.getMaxY());
}
示例10: visit
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
@Override
protected void visit(Geometry element) {
Envelope elementEnv = element.getEnvelopeInternal();
// disjoint => no intersection
if (!this.rectEnv.intersects(elementEnv)) {
return;
}
// rectangle contains target env => must intersect
if (this.rectEnv.contains(elementEnv)) {
this.intersects = true;
return;
}
/**
* Since the envelopes intersect and the test element is connected, if the
* test envelope is completely bisected by an edge of the rectangle the
* element and the rectangle must touch (This is basically an application of
* the Jordan Curve Theorem). The alternative situation is that the test
* envelope is "on a corner" of the rectangle envelope, i.e. is not
* completely bisected. In this case it is not possible to make a conclusion
* about the presence of an intersection.
*/
if (elementEnv.getMinX() >= this.rectEnv.getMinX()
&& elementEnv.getMaxX() <= this.rectEnv.getMaxX()) {
this.intersects = true;
return;
}
if (elementEnv.getMinY() >= this.rectEnv.getMinY()
&& elementEnv.getMaxY() <= this.rectEnv.getMaxY()) {
this.intersects = true;
}
}
示例11: buildIndex
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private void buildIndex() {
this.sweepLine = new SweepLineIndex();
for (Object ring1 : rings) {
LinearRing ring = (LinearRing) ring1;
Envelope env = ring.getEnvelopeInternal();
SweepLineInterval sweepInt = new SweepLineInterval(env.getMinX(), env.getMaxX(), ring);
this.sweepLine.add(sweepInt);
}
}
示例12: RectangleLineIntersector
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* Creates a new intersector for the given query rectangle,
* specified as an {@link Envelope}.
*
* @param rectEnv the query rectangle, specified as an Envelope
*/
public RectangleLineIntersector(Envelope rectEnv) {
this.rectEnv = rectEnv;
/**
* Up and Down are the diagonal orientations
* relative to the Left side of the rectangle.
* Index 0 is the left side, 1 is the right side.
*/
this.diagUp0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMinY());
this.diagUp1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMaxY());
this.diagDown0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMaxY());
this.diagDown1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMinY());
}
示例13: queryNode
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private void queryNode(KdNode currentNode, KdNode bottomNode,
Envelope queryEnv, boolean odd, List result) {
if (currentNode == bottomNode) {
return;
}
double min;
double max;
double discriminant;
if (odd) {
min = queryEnv.getMinX();
max = queryEnv.getMaxX();
discriminant = currentNode.getX();
} else {
min = queryEnv.getMinY();
max = queryEnv.getMaxY();
discriminant = currentNode.getY();
}
boolean searchLeft = min < discriminant;
boolean searchRight = discriminant <= max;
if (searchLeft) {
this.queryNode(currentNode.getLeft(), bottomNode, queryEnv, !odd, result);
}
if (queryEnv.contains(currentNode.getCoordinate())) {
result.add(currentNode);
}
if (searchRight) {
this.queryNode(currentNode.getRight(), bottomNode, queryEnv, !odd, result);
}
}
示例14: Node
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public Node(Envelope env, int level) {
//this.parent = parent;
this.env = env;
this.level = level;
this.centrex = (env.getMinX() + env.getMaxX()) / 2;
this.centrey = (env.getMinY() + env.getMaxY()) / 2;
}
示例15: createArc
import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
* Creates an elliptical arc, as a {@link LineString}.
* The arc is always created in a counter-clockwise direction.
* This can easily be reversed if required by using
* {#link LineString.reverse()}
*
* @param startAng start angle in radians
* @param angExtent size of angle in radians
* @return an elliptical arc
*/
public LineString createArc(
double startAng,
double angExtent) {
Envelope env = this.dim.getEnvelope();
double xRadius = env.getWidth() / 2.0;
double yRadius = env.getHeight() / 2.0;
double centreX = env.getMinX() + xRadius;
double centreY = env.getMinY() + yRadius;
double angSize = angExtent;
if (angSize <= 0.0 || angSize > 2 * Math.PI) {
angSize = 2 * Math.PI;
}
double angInc = angSize / (this.nPts - 1);
Coordinate[] pts = new Coordinate[this.nPts];
int iPt = 0;
for (int i = 0; i < this.nPts; i++) {
double ang = startAng + i * angInc;
double x = xRadius * Math.cos(ang) + centreX;
double y = yRadius * Math.sin(ang) + centreY;
pts[iPt++] = this.coord(x, y);
}
LineString line = this.geomFact.createLineString(pts);
return (LineString) this.rotate(line);
}