当前位置: 首页>>代码示例>>Java>>正文


Java Point.getY方法代码示例

本文整理汇总了Java中mil.nga.wkb.geom.Point.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Point.getY方法的具体用法?Java Point.getY怎么用?Java Point.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mil.nga.wkb.geom.Point的用法示例。


在下文中一共展示了Point.getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkIfRectangleAndFindSide

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Check if the points form a rectangle and return if the side one has the same x
 *
 * @param points points
 * @return null if not a rectangle, true if same x side 1, false if same y side 1
 */
public static Boolean checkIfRectangleAndFindSide(List<Point> points) {
    Boolean sameXSide1 = null;
    int size = points.size();
    if (size == 4 || size == 5) {
        Point point1 = points.get(0);
        Point lastPoint = points.get(points.size() - 1);
        boolean closed = point1.getX() == lastPoint.getX() && point1.getY() == lastPoint.getY();
        if ((closed && size == 5) || (!closed && size == 4)) {
            Point point2 = points.get(1);
            Point point3 = points.get(2);
            Point point4 = points.get(3);
            if (point1.getX() == point2.getX() && point2.getY() == point3.getY()) {
                if (point1.getY() == point4.getY() && point3.getX() == point4.getX()) {
                    sameXSide1 = true;
                }
            } else if (point1.getY() == point2.getY() && point2.getX() == point3.getX()) {
                if (point1.getX() == point4.getX() && point3.getY() == point4.getY()) {
                    sameXSide1 = false;
                }
            }
        }
    }
    return sameXSide1;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:31,代码来源:ObservationLocation.java

示例2: updateIfRectangle

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Check if the points form a rectangle and update
 *
 * @param points points
 */
private void updateIfRectangle(List<Point> points) {
    int size = points.size();
    if (size == 4 || size == 5) {
        Point point1 = points.get(0);
        Point lastPoint = points.get(points.size() - 1);
        boolean closed = point1.getX() == lastPoint.getX() && point1.getY() == lastPoint.getY();
        if ((closed && size == 5) || (!closed && size == 4)) {
            Point point2 = points.get(1);
            Point point3 = points.get(2);
            Point point4 = points.get(3);
            if (point1.getX() == point2.getX() && point2.getY() == point3.getY()) {
                if (point1.getY() == point4.getY() && point3.getX() == point4.getX()) {
                    isRectangle = true;
                    rectangleSameXSide1 = true;
                }
            } else if (point1.getY() == point2.getY() && point2.getX() == point3.getX()) {
                if (point1.getX() == point4.getX() && point3.getY() == point4.getY()) {
                    isRectangle = true;
                    rectangleSameXSide1 = false;
                }
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:30,代码来源:LocationEditActivity.java

示例3: add

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Add or subtract a line string to or from the centroid total
 * 
 * @param positive
 *            true if an addition, false if a subtraction
 * @param lineString
 *            line string
 */
private void add(boolean positive, LineString lineString) {
	List<Point> points = lineString.getPoints();
	Point firstPoint = points.get(0);
	if (base == null) {
		base = firstPoint;
	}
	for (int i = 0; i < points.size() - 1; i++) {
		Point point = points.get(i);
		Point nextPoint = points.get(i + 1);
		addTriangle(positive, base, point, nextPoint);
	}
	Point lastPoint = points.get(points.size() - 1);
	if (firstPoint.getX() != lastPoint.getX()
			|| firstPoint.getY() != lastPoint.getY()) {
		addTriangle(positive, base, lastPoint, firstPoint);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:26,代码来源:CentroidSurface.java

示例4: doInBackground

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
	CloseableIterator<Location> iterator = null;
	try {
		iterator = iterator();
		while (iterator.hasNext() && !isCancelled()) {
			Location location = iterator.current();
			User user = location.getUser();
			if (user == null) {
				continue;
			}

			Point point = GeometryUtils.getCentroid(location.getGeometry());
			LatLng latLng = new LatLng(point.getY(), point.getX());
			MarkerOptions options = new MarkerOptions().position(latLng).icon(LocationBitmapFactory.bitmapDescriptor(context, location, user));

			publishProgress(new Pair<>(options, new Pair<>(location, user)));
		}
	} catch (SQLException e) {
		e.printStackTrace();
	} finally {
		if (iterator != null) {
			iterator.closeQuietly();
		}
	}

	return null;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:29,代码来源:LocationLoadTask.java

示例5: polygonHasKinks

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
public static boolean polygonHasKinks(Polygon polygon) {
    for (LineString line1 : polygon.getRings()) {
        Point lastPoint = line1.getPoints().get(line1.numPoints() - 1);
        for (LineString line2 : polygon.getRings()) {
            for (int i = 0; i < line1.numPoints() - 1; i++) {
                Point point1 = line1.getPoints().get(i);
                Point nextPoint1 = line1.getPoints().get(i + 1);
                for (int k = i; k < line2.numPoints() - 1; k++) {
                    Point point2 = line2.getPoints().get(k);
                    Point nextPoint2 = line2.getPoints().get(k + 1);
                    if (line1 != line2) {
                        continue;
                    }

                    if (Math.abs(i - k) == 1) {
                        continue;
                    }

                    if (i == 0 && k == line1.numPoints() - 2 && point1.getX() == lastPoint.getX() && point1.getY() == lastPoint.getY()) {
                        continue;
                    }

                    boolean intersects = intersects(point1, nextPoint1, point2, nextPoint2);

                    if (intersects) {
                        return true;
                    }
                }
            }
        }
    }

    return false;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:35,代码来源:MapUtils.java

示例6: intersects

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
private static boolean intersects(Point point1Start, Point point1End, Point point2Start, Point point2End) {
    double q =
            //Distance between the lines' starting rows times line2's horizontal length
            (point1Start.getY() - point2Start.getY()) * (point2End.getX() - point2Start.getX())
                    //Distance between the lines' starting columns times line2's vertical length
                    - (point1Start.getX() - point2Start.getX()) * (point2End.getY() - point2Start.getY());
    double d =
        //Line 1's horizontal length times line 2's vertical length
        (point1End.getX() - point1Start.getX()) * (point2End.getY() - point2Start.getY())
                //Line 1's vertical length times line 2's horizontal length
                - (point1End.getY() - point1Start.getY()) * (point2End.getX() - point2Start.getX());

    if (d == 0) {
        return false;
    }

    double r = q / d;

    q =
        //Distance between the lines' starting rows times line 1's horizontal length
        (point1Start.getY() - point2Start.getY()) * (point1End.getX() - point1Start.getX())
                //Distance between the lines' starting columns times line 1's vertical length
                - (point1Start.getX() - point2Start.getX()) * (point1End.getY() - point1Start.getY());

    double s = q / d;

    if( r < 0 || r > 1 || s < 0 || s > 1 ) {
        return false;
    }

    return true;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:33,代码来源:MapUtils.java

示例7: onMarkerClick

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
	Pair<Location, User> pair = markerIdToPair.get(marker.getId());
	if (pair == null) {
		return false;
	}

	Location location = pair.first;
	User user = pair.second;

	final Geometry g = location.getGeometry();
	if (g != null) {
		Point point = GeometryUtils.getCentroid(g);
		LatLng latLng = new LatLng(point.getY(), point.getX());
		LocationProperty accuracyProperty = location.getPropertiesMap().get("accuracy");
		if (accuracyProperty != null && !accuracyProperty.getValue().toString().trim().isEmpty()) {
			try {
				Float accuracy = Float.valueOf(accuracyProperty.getValue().toString());
				if (clickedAccuracyCircle != null) {
					clickedAccuracyCircle.remove();
				}
				clickedAccuracyCircle = map.addCircle(new CircleOptions().center(latLng).radius(accuracy).fillColor(0x1D43b0ff).strokeColor(0x620069cc).strokeWidth(1.0f));
				clickedAccuracyCircleUserId = user.getId();
			} catch (NumberFormatException nfe) {
				Log.e(LOG_NAME, "Problem adding accuracy circle to the map.", nfe);
			}
		}
	}

	map.setInfoWindowAdapter(infoWindowAdapter);
	// make sure to set the Anchor after this call as well, because the size of the icon might have changed
	marker.setIcon(LocationBitmapFactory.bitmapDescriptor(context, location, user));
	marker.setAnchor(0.5f, 1.0f);
	marker.showInfoWindow();
	return true;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:37,代码来源:LocationMarkerCollection.java

示例8: doInBackground

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Location... locations) {        
	for (Location location : locations) {
        User user = location.getUser();
        if (user == null) {
            continue;
        }

        boolean passesFilter = true;
        for (Filter filter : filters) {
            passesFilter = filter.passesFilter(location);
            if (!passesFilter) {
                break;
            }
        }

        if (passesFilter) {
            Point point = GeometryUtils.getCentroid(location.getGeometry());
            LatLng latLng = new LatLng(point.getY(), point.getX());
            MarkerOptions options = new MarkerOptions().position(latLng).icon(LocationBitmapFactory.bitmapDescriptor(context, location, user));

            publishProgress(new Pair<>(options, new Pair<>(location, user)));
        }
    }
    
    return null;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:28,代码来源:LocationTask.java

示例9: onMapReady

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
@Override
public void onMapReady(final GoogleMap map) {
    ObservationLocation location = getIntent().getParcelableExtra(ObservationEditActivity.LOCATION);
    Point centroid = location.getCentroid();
    LatLng latLng = new LatLng(centroid.getY(), centroid.getX());

    float zoom = getIntent().getFloatExtra(ObservationEditActivity.INITIAL_ZOOM, 0);

    map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom));

}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:12,代码来源:ObservationFormPickerActivity.java

示例10: add

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Add points to the centroid total
 * 
 * @param points
 *            points
 */
private void add(List<Point> points) {
	for (int i = 0; i < points.size() - 1; i++) {
		Point point = points.get(i);
		Point nextPoint = points.get(i + 1);

		double length = GeometryUtils.distance(point, nextPoint);
		totalLength += length;

		double midX = (point.getX() + nextPoint.getX()) / 2;
		sum.setX(sum.getX() + (length * midX));
		double midY = (point.getY() + nextPoint.getY()) / 2;
		sum.setY(sum.getY() + (length * midY));
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:21,代码来源:CentroidCurve.java

示例11: perpendicularDistance

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Calculate the perpendicular distance between the point and the line
 * represented by the start and end points. Points should be in a meters
 * unit type projection.
 *
 * @param point
 *            point
 * @param lineStart
 *            point representing the line start
 * @param lineEnd
 *            point representing the line end
 * @return distance in meters
 * @since 1.0.4
 */
public static double perpendicularDistance(Point point, Point lineStart,
		Point lineEnd) {

	double x = point.getX();
	double y = point.getY();
	double startX = lineStart.getX();
	double startY = lineStart.getY();
	double endX = lineEnd.getX();
	double endY = lineEnd.getY();

	double vX = endX - startX;
	double vY = endY - startY;
	double wX = x - startX;
	double wY = y - startY;
	double c1 = wX * vX + wY * vY;
	double c2 = vX * vX + vY * vY;

	double x2;
	double y2;
	if (c1 <= 0) {
		x2 = startX;
		y2 = startY;
	} else if (c2 <= c1) {
		x2 = endX;
		y2 = endY;
	} else {
		double b = c1 / c2;
		x2 = startX + b * vX;
		y2 = startY + b * vY;
	}

	double distance = Math.sqrt(Math.pow(x2 - x, 2) + Math.pow(y2 - y, 2));

	return distance;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:50,代码来源:GeometryUtils.java

示例12: getPosition

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
@Override
public LatLng getPosition() {
    Point point = GeometryUtils.getCentroid(observation.getGeometry());
    return new LatLng(point.getY(), point.getX());
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:6,代码来源:ObservationClusterCollection.java

示例13: getFirstLatLng

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Get the first point from the geometry as a {@link LatLng}
 *
 * @return lat lng
 */
public LatLng getFirstLatLng() {
    Point point = getFirstPoint();
    LatLng latLng = new LatLng(point.getY(), point.getX());
    return latLng;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:11,代码来源:ObservationLocation.java

示例14: getCentroidLatLng

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Get the geometry centroid as a LatLng
 *
 * @return centroid point lat lng
 */
public LatLng getCentroidLatLng() {
    Point point = GeometryUtils.getCentroid(geometry);
    LatLng latLng = new LatLng(point.getY(), point.getX());
    return latLng;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:11,代码来源:ObservationLocation.java

示例15: addPointMessage

import mil.nga.wkb.geom.Point; //导入方法依赖的package包/类
/**
 * Add Point
 * 
 * @param envelope
 * @param point
 */
private static void addPointMessage(GeometryEnvelope envelope, Point point) {

	updateHasZandM(envelope, point);

	double x = point.getX();
	double y = point.getY();
	if (x < envelope.getMinX()) {
		envelope.setMinX(x);
	}
	if (x > envelope.getMaxX()) {
		envelope.setMaxX(x);
	}
	if (y < envelope.getMinY()) {
		envelope.setMinY(y);
	}
	if (y > envelope.getMaxY()) {
		envelope.setMaxY(y);
	}
	if (point.hasZ()) {
		Double z = point.getZ();
		if (z != null) {
			if (envelope.getMinZ() == null || z < envelope.getMinZ()) {
				envelope.setMinZ(z);
			}
			if (envelope.getMaxZ() == null || z > envelope.getMaxZ()) {
				envelope.setMaxZ(z);
			}
		}
	}
	if (point.hasM()) {
		Double m = point.getM();
		if (m != null) {
			if (envelope.getMinM() == null || m < envelope.getMinM()) {
				envelope.setMinM(m);
			}
			if (envelope.getMaxM() == null || m > envelope.getMaxM()) {
				envelope.setMaxM(m);
			}
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:48,代码来源:GeometryEnvelopeBuilder.java


注:本文中的mil.nga.wkb.geom.Point.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。