• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: toPolyline

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Convert a {@link LineString} to a {@link PolylineOptions}
 *
 * @param lineString
 * @return
 */
public PolylineOptions toPolyline(LineString lineString) {

    PolylineOptions polylineOptions = new PolylineOptions();
    Double z = null;

    // Try to simplify the number of points in the line string
    List<Point> points = simplifyPoints(lineString.getPoints());

    for (Point point : points) {
        LatLng latLng = toLatLng(point);
        polylineOptions.add(latLng);
        if (point.hasZ()) {
            z = (z == null) ? point.getZ() : Math.max(z, point.getZ());
        }
    }

    if (lineString.hasZ() && z != null) {
        polylineOptions.zIndex(z.floatValue());
    }

    return polylineOptions;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:29,代码来源:GoogleMapShapeConverter.java


示例2: simplifyPoints

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * When the simplify tolerance is set, simplify the points to a similar
 * curve with fewer points.
 *
 * @param points ordered points
 * @return simplified points
 */
private List<Point> simplifyPoints(List<Point> points) {

    List<Point> simplifiedPoints = null;
    if (simplifyTolerance != null) {

        // Reproject to web mercator if not in meters
        if (projection != null && projection.getUnit() != Units.METRES) {
            points = toWebMercator.transform(points);
        }

        // Simplify the points
        simplifiedPoints = GeometryUtils.simplifyPoints(points,
                simplifyTolerance);

        // Reproject back to the original projection
        if (projection != null && projection.getUnit() != Units.METRES) {
            simplifiedPoints = fromWebMercator.transform(simplifiedPoints);
        }
    } else {
        simplifiedPoints = points;
    }

    return simplifiedPoints;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:32,代码来源:GoogleMapShapeConverter.java


示例3: createPoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Create a random point
 *
 * @param hasZ
 * @param hasM
 * @return
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

    double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
    double y = Math.random() * 90.0 * (Math.random() < .5 ? 1 : -1);

    Point point = new Point(hasZ, hasM, x, y);

    if (hasZ) {
        double z = Math.random() * 1000.0;
        point.setZ(z);
    }

    if (hasM) {
        double m = Math.random() * 1000.0;
        point.setM(m);
    }

    return point;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:27,代码来源:TestUtils.java


示例4: addLineString

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Add the linestring to the path
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param lineString
 */
private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) {

    List<Point> points = lineString.getPoints();

    if (points.size() >= 2) {

        // Try to simplify the number of points in the LineString
        points = simplifyPoints(simplifyTolerance, points);

        for (int i = 0; i < points.size(); i++) {
            Point point = points.get(i);
            Point webMercatorPoint = getPoint(transform, point);
            float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
                    webMercatorPoint.getX());
            float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
                    webMercatorPoint.getY());
            if (i == 0) {
                path.moveTo(x, y);
            } else {
                path.lineTo(x, y);
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:34,代码来源:DefaultFeatureTiles.java


示例5: addPolygon

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Add the polygon on the canvas
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param polygon
 */
private void addPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, Polygon polygon) {
    List<LineString> rings = polygon.getRings();
    if (!rings.isEmpty()) {

        // Add the polygon points
        LineString polygonLineString = rings.get(0);
        List<Point> polygonPoints = polygonLineString.getPoints();
        if (polygonPoints.size() >= 2) {
            addRing(simplifyTolerance, boundingBox, transform, path, polygonPoints);

            // Add the holes
            for (int i = 1; i < rings.size(); i++) {
                LineString holeLineString = rings.get(i);
                List<Point> holePoints = holeLineString.getPoints();
                if (holePoints.size() >= 2) {
                    addRing(simplifyTolerance, boundingBox, transform, path, holePoints);
                }
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:31,代码来源:DefaultFeatureTiles.java


示例6: addRing

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Add a ring
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param points
 */
private void addRing(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, List<Point> points) {

    // Try to simplify the number of points in the LineString
    points = simplifyPoints(simplifyTolerance, points);

    for (int i = 0; i < points.size(); i++) {
        Point point = points.get(i);
        Point webMercatorPoint = getPoint(transform, point);
        float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
                webMercatorPoint.getX());
        float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
                webMercatorPoint.getY());
        if (i == 0) {
            path.moveTo(x, y);
        } else {
            path.lineTo(x, y);
        }
    }
    path.close();
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:DefaultFeatureTiles.java


示例7: drawPoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Draw the point on the canvas
 *
 * @param boundingBox
 * @param transform
 * @param canvas
 * @param paint
 * @param point
 */
private void drawPoint(BoundingBox boundingBox, ProjectionTransform transform, Canvas canvas, Paint paint, Point point) {

    Point webMercatorPoint = getPoint(transform, point);
    float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
            webMercatorPoint.getX());
    float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
            webMercatorPoint.getY());

    if (pointIcon != null) {
        if (x >= 0 - pointIcon.getWidth() && x <= tileWidth + pointIcon.getWidth() && y >= 0 - pointIcon.getHeight() && y <= tileHeight + pointIcon.getHeight()) {
            canvas.drawBitmap(pointIcon.getIcon(), x - pointIcon.getXOffset(), y - pointIcon.getYOffset(), paint);
        }
    } else {
        if (x >= 0 - pointRadius && x <= tileWidth + pointRadius && y >= 0 - pointRadius && y <= tileHeight + pointRadius) {
            canvas.drawCircle(x, y, pointRadius, paint);
        }
    }

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:29,代码来源:DefaultFeatureTiles.java


示例8: validatePoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Validate Point
 * 
 * @param topGeometry
 * @param point
 */
private static void validatePoint(Geometry topGeometry, Point point) {

	TestCase.assertEquals(GeometryType.POINT, point.getGeometryType());

	validateZAndM(topGeometry, point);

	if (topGeometry.hasZ()) {
		TestCase.assertNotNull(point.getZ());
	} else {
		TestCase.assertNull(point.getZ());
	}

	if (topGeometry.hasM()) {
		TestCase.assertNotNull(point.getM());
	} else {
		TestCase.assertNull(point.getM());
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:25,代码来源:FeatureUtils.java


示例9: createPoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Create a random point
 *
 * @param hasZ
 * @param hasM
 * @return
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

	double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
	double y = Math.random() * 90.0 * (Math.random() < .5 ? 1 : -1);

	Point point = new Point(hasZ, hasM, x, y);

	if (hasZ) {
		double z = Math.random() * 1000.0;
		point.setZ(z);
	}

	if (hasM) {
		double m = Math.random() * 1000.0;
		point.setM(m);
	}

	return point;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:27,代码来源:TestUtils.java


示例10: comparePoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Compare the two points for equality
 *
 * @param expected
 * @param actual
 */
private static void comparePoint(Point expected, Point actual, double delta) {

	compareBaseGeometryAttributes(expected, actual);
	TestCase.assertEquals(expected.getX(), actual.getX(), delta);
	TestCase.assertEquals(expected.getY(), actual.getY(), delta);
	if (expected.getZ() == null) {
		TestCase.assertEquals(expected.getZ(), actual.getZ());
	} else {
		TestCase.assertEquals(expected.getZ(), actual.getZ(), delta);
	}
	if (expected.getM() == null) {
		TestCase.assertEquals(expected.getM(), actual.getM());
	} else {
		TestCase.assertEquals(expected.getM(), actual.getM(), delta);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:23,代码来源:GeoPackageGeometryDataUtils.java


示例11: doInBackground

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
@Override
protected Void doInBackground(Observation... observations) {
    for (Observation o : observations) {
        boolean passesFilter = true;
        for (Filter filter : filters) {
            passesFilter = filter.passesFilter(o);
            if (!passesFilter) {
                break;
            }
        }

        if (passesFilter) {
            Geometry geometry = o.getGeometry();
            Point centroid = GeometryUtils.getCentroid(geometry);
            MarkerOptions options = new MarkerOptions().position(new LatLng(centroid.getY(), centroid.getX())).icon(ObservationBitmapFactory.bitmapDescriptor(context, o));
            publishProgress(new Pair<>(options, o));
        }
    }

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


示例12: doInBackground

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params ) {
    CloseableIterator<Observation> iterator = null;
    try {
        iterator = iterator();
        while (iterator.hasNext() && !isCancelled()) {
            Observation o = iterator.current();
            Geometry geometry = o.getGeometry();
            Point centroid = GeometryUtils.getCentroid(geometry);
            MarkerOptions options = new MarkerOptions().position(new LatLng(centroid.getY(), centroid.getX())).icon(ObservationBitmapFactory.bitmapDescriptor(context, o));

            publishProgress(new Pair<>(options, o));
        }

    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        if (iterator != null) {
            iterator.closeQuietly();
        }
    }

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


示例13: 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


示例14: 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


示例15: createPoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Create a random point
 * 
 * @param hasZ
 * @param hasM
 * @return
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

	double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
	double y = Math.random() * 90.0 * (Math.random() < .5 ? 1 : -1);

	Point point = new Point(hasZ, hasM, x, y);

	if (hasZ) {
		double z = Math.random() * 1000.0;
		point.setZ(z);
	}

	if (hasM) {
		double m = Math.random() * 1000.0;
		point.setM(m);
	}

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


示例16: createPoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Create a random point
 * 
 * @param hasZ
 * @param hasM
 * @return point
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

	double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
	double y = Math.random() * 90.0 * (Math.random() < .5 ? 1 : -1);

	Point point = new Point(hasZ, hasM, x, y);

	if (hasZ) {
		double z = Math.random() * 1000.0;
		point.setZ(z);
	}

	if (hasM) {
		double m = Math.random() * 1000.0;
		point.setM(m);
	}

	return point;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:27,代码来源:TestUtils.java


示例17: comparePoint

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Compare the two points for equality
 * 
 * @param expected
 * @param actual
 */
private static void comparePoint(Point expected, Point actual, double delta) {

	compareBaseGeometryAttributes(expected, actual);
	TestCase.assertEquals(expected.getX(), actual.getX(), delta);
	TestCase.assertEquals(expected.getY(), actual.getY(), delta);
	if (expected.getZ() == null) {
		TestCase.assertEquals(expected.getZ(), actual.getZ());
	} else {
		TestCase.assertEquals(expected.getZ(), actual.getZ(), delta);
	}
	if (expected.getM() == null) {
		TestCase.assertEquals(expected.getM(), actual.getM());
	} else {
		TestCase.assertEquals(expected.getM(), actual.getM(), delta);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:23,代码来源:GeoPackageGeometryDataUtils.java


示例18: testGenerateTilesRandom

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Test generating tiles with random bounds and zoomss
 * 
 * @param geoPackage
 * @throws SQLException
 * @throws IOException
 */
public static void testGenerateTilesRandom(GeoPackage geoPackage)
		throws SQLException, IOException {

	for (int i = 0; i < 10; i++) {

		int minZoom = (int) (Math.random() * 3.0);
		int maxZoom = minZoom + ((int) (Math.random() * 3.0));
		Point point1 = TestUtils.createPoint(false, false);
		Point point2 = TestUtils.createPoint(false, false);
		BoundingBox boundingBox = new BoundingBox(Math.min(point1.getX(),
				point2.getX()), Math.min(point1.getY(), point2.getY()),
				Math.max(point1.getX(), point2.getX()), Math.max(
						point1.getY(), point2.getY()));
		UrlTileGenerator tileGenerator = new UrlTileGenerator(geoPackage,
				TABLE_NAME + i, URL, minZoom, maxZoom, boundingBox,
				getProjection());

		testGenerateTiles(tileGenerator);
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:28,代码来源:UrlTileGeneratorUtils.java


示例19: geometryCentroidTester

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Test the geometry centroid
 * 
 * @param geometry
 * @throws IOException
 */
private Point geometryCentroidTester(Geometry geometry) throws IOException {

	Point point = GeometryUtils.getCentroid(geometry);

	GeometryEnvelope envelope = GeometryEnvelopeBuilder
			.buildEnvelope(geometry);

	if (geometry.getGeometryType() == GeometryType.POINT) {
		TestCase.assertEquals(envelope.getMinX(), point.getX());
		TestCase.assertEquals(envelope.getMaxX(), point.getX());
		TestCase.assertEquals(envelope.getMinY(), point.getY());
		TestCase.assertEquals(envelope.getMaxY(), point.getY());
	}

	TestCase.assertTrue(point.getX() >= envelope.getMinX());
	TestCase.assertTrue(point.getX() <= envelope.getMaxX());
	TestCase.assertTrue(point.getY() >= envelope.getMinY());
	TestCase.assertTrue(point.getY() <= envelope.getMaxY());

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


示例20: getCentroid

import mil.nga.wkb.geom.Point; //导入依赖的package包/类
/**
 * Get the centroid point of the Geometry
 * 
 * @param geometry
 *            geometry object
 * @return centroid point
 */
public static Point getCentroid(Geometry geometry) {
	Point centroid = null;
	int dimension = getDimension(geometry);
	switch (dimension) {
	case 0:
		CentroidPoint point = new CentroidPoint(geometry);
		centroid = point.getCentroid();
		break;
	case 1:
		CentroidCurve curve = new CentroidCurve(geometry);
		centroid = curve.getCentroid();
		break;
	case 2:
		CentroidSurface surface = new CentroidSurface(geometry);
		centroid = surface.getCentroid();
		break;
	}
	return centroid;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:27,代码来源:GeometryUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnErrorFailedException类代码示例发布时间:2022-05-22
下一篇:
Java HighPerformanceLineVertexBufferObject类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap