本文整理了Java中com.vividsolutions.jts.geom.Point.getCentroid()
方法的一些代码示例,展示了Point.getCentroid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.getCentroid()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Point
类名称:Point
方法名:getCentroid
暂无
代码示例来源:origin: org.geotools/gt-render
public Point getCentroid() {
return point.getCentroid();
}
代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap
@Override
public Rectangle paint(Point point, JXMapViewer mapViewer, Graphics2D g, boolean selected) {
Rectangle bounds = null;
com.vividsolutions.jts.geom.Point centroid = point.getCentroid();
GeoPosition centroidPos = new GeoPosition(centroid.getY(), centroid.getX());
final Point2D pointOnMap = mapViewer.getTileFactory().geoToPixel(centroidPos, mapViewer.getZoom());
Rectangle viewportBounds = mapViewer.getViewportBounds();
if (viewportBounds.contains(pointOnMap)) {
final int x = (int) (pointOnMap.getX() - viewportBounds.getX());
final int y = (int) (pointOnMap.getY() - viewportBounds.getY());
g.setFont(font);
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, new Float(alpha)));
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setStroke(new BasicStroke(STROKE_WIDTH, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
Rectangle rect = new Rectangle(4, 4, 4, 4);
rect.setLocation(x, y);
g.fill(rect);
bounds = rect;
}
return bounds;
}
代码示例来源:origin: shilad/wikibrain
private void writeRow(UniversalPage c1, UniversalPage c2, List<SRResult> results) throws WikiBrainException, IOException {
Point p1 = locations.get(c1).getCentroid();
Point p2 = locations.get(c2).getCentroid();
GeodeticCalculator geoCalc = new GeodeticCalculator();
geoCalc.setStartingGeographicPoint(p1.getX(), p1.getY());
geoCalc.setDestinationGeographicPoint(p2.getX(), p2.getY());
double km = geoCalc.getOrthodromicDistance() / 1000;
Title t1 = c1.getBestEnglishTitle(lpDao, true);
Title t2 = c2.getBestEnglishTitle(lpDao, true);
synchronized (output) {
output.write(t1.getCanonicalTitle() +
"\t" + c1.getUnivId() +
"\t" + t2.getCanonicalTitle() +
"\t" + c2.getUnivId() +
"\t" + km
);
for (SRResult result : results) {
output.write("\t" + result.getScore());
}
output.write("\n");
}
}
代码示例来源:origin: org.wikibrainapi/wikibrain-spatial
private void writeRow(UniversalPage c1, UniversalPage c2, List<SRResult> results) throws WikiBrainException, IOException {
Point p1 = locations.get(c1).getCentroid();
Point p2 = locations.get(c2).getCentroid();
GeodeticCalculator geoCalc = new GeodeticCalculator();
geoCalc.setStartingGeographicPoint(p1.getX(), p1.getY());
geoCalc.setDestinationGeographicPoint(p2.getX(), p2.getY());
double km = geoCalc.getOrthodromicDistance() / 1000;
Title t1 = c1.getBestEnglishTitle(lpDao, true);
Title t2 = c2.getBestEnglishTitle(lpDao, true);
synchronized (output) {
output.write(t1.getCanonicalTitle() +
"\t" + c1.getUnivId() +
"\t" + t2.getCanonicalTitle() +
"\t" + c2.getUnivId() +
"\t" + km
);
for (SRResult result : results) {
output.write("\t" + result.getScore());
}
output.write("\n");
}
}
代码示例来源:origin: org.wikibrainapi/wikibrain-spatial
private void writeRow(UniversalPage c1, UniversalPage c2, List<SRResult> results) throws WikiBrainException, IOException {
double km;
Point p1 = locations.get(c1.getUnivId()).getCentroid();
Point p2 = locations.get(c2.getUnivId()).getCentroid();
GeodeticCalculator geoCalc = new GeodeticCalculator();
geoCalc.setStartingGeographicPoint(p1.getX(), p1.getY());
geoCalc.setDestinationGeographicPoint(p2.getX(), p2.getY());
km = geoCalc.getOrthodromicDistance() / 1000;
Title t1 = c1.getBestEnglishTitle(lpDao, true);
Title t2 = c2.getBestEnglishTitle(lpDao, true);
String[] rowEntries = new String[5 + langs.size()];
rowEntries[0] = t1.getCanonicalTitle();
rowEntries[1] = String.valueOf(c1.getUnivId());
rowEntries[2] = t2.getCanonicalTitle();
rowEntries[3] = String.valueOf(c2.getUnivId());
rowEntries[4] = String.valueOf(km);
int counter = 0;
for (SRResult result : results) {
rowEntries[5 + counter] = String.valueOf(result.getScore());
counter ++;
}
output.writeNext(rowEntries);
output.flush();
}
代码示例来源:origin: shilad/wikibrain
private void writeRow(UniversalPage c1, UniversalPage c2, List<SRResult> results) throws WikiBrainException, IOException {
double km;
Point p1 = locations.get(c1.getUnivId()).getCentroid();
Point p2 = locations.get(c2.getUnivId()).getCentroid();
GeodeticCalculator geoCalc = new GeodeticCalculator();
geoCalc.setStartingGeographicPoint(p1.getX(), p1.getY());
geoCalc.setDestinationGeographicPoint(p2.getX(), p2.getY());
km = geoCalc.getOrthodromicDistance() / 1000;
Title t1 = c1.getBestEnglishTitle(lpDao, true);
Title t2 = c2.getBestEnglishTitle(lpDao, true);
String[] rowEntries = new String[5 + langs.size()];
rowEntries[0] = t1.getCanonicalTitle();
rowEntries[1] = String.valueOf(c1.getUnivId());
rowEntries[2] = t2.getCanonicalTitle();
rowEntries[3] = String.valueOf(c2.getUnivId());
rowEntries[4] = String.valueOf(km);
int counter = 0;
for (SRResult result : results) {
rowEntries[5 + counter] = String.valueOf(result.getScore());
counter ++;
}
output.writeNext(rowEntries);
output.flush();
}
代码示例来源:origin: org.wikibrainapi/wikibrain-spatial
if((!locations.containsKey(c1.getUnivId())) || (!locations.containsKey(c2.getUnivId())))
return;
Point p1 = locations.get(c1.getUnivId()).getCentroid();
Point p2 = locations.get(c2.getUnivId()).getCentroid();
代码示例来源:origin: shilad/wikibrain
if((!locations.containsKey(c1.getUnivId())) || (!locations.containsKey(c2.getUnivId())))
return;
Point p1 = locations.get(c1.getUnivId()).getCentroid();
Point p2 = locations.get(c2.getUnivId()).getCentroid();
内容来源于网络,如有侵权,请联系作者删除!