本文整理了Java中org.locationtech.jts.geom.Point.setUserData()
方法的一些代码示例,展示了Point.setUserData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.setUserData()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Point
类名称:Point
方法名:setUserData
暂无
代码示例来源:origin: geotools/geotools
public void setUserData(Object userData) {
point.setUserData(userData);
}
代码示例来源:origin: geotools/geotools
/**
* Set point attributes into its user data to be encoded in Geoserver: gml:id, srsName,
* srsDimension, axisLabels and uomLabels.
*
* @param point The point object
* @param crs Coordinate System object
* @param srsName srs name
* @param gmlId gml:id value
*/
private void setUserData(Point geom, CoordinateReferenceSystem crs, String gmlId) {
Map<Object, Object> userData = new HashMap<Object, Object>();
if (gmlId != null) {
userData.put("gml:id", gmlId);
}
if (crs != null) {
userData.put(CoordinateReferenceSystem.class, crs);
}
geom.setUserData(userData);
}
}
代码示例来源:origin: geotools/geotools
private Point parsePoint(int dimension, CoordinateReferenceSystem crs)
throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
FactoryException {
parser.require(START_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
crs = crs(crs);
Point geom;
parser.nextTag();
parser.require(START_TAG, GML.NAMESPACE, null);
Coordinate point;
if (GML.pos.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordList(dimension);
point = coords[0];
parser.nextTag();
} else if (GML.coordinates.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordinates(dimension);
point = coords[0];
parser.nextTag();
} else if (GML.coord.getLocalPart().equals(parser.getName())) {
point = parseCoord();
parser.nextTag();
} else {
throw new IllegalStateException(
"Unknown coordinate element for Point: " + parser.getName());
}
parser.require(END_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
geom = geomFac.createPoint(point);
geom.setUserData(crs);
return geom;
}
代码示例来源:origin: geotools/geotools
private Point parsePoint(int dimension, CoordinateReferenceSystem crs)
throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
FactoryException {
parser.require(START_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
crs = crs(crs);
Point geom;
parser.nextTag();
parser.require(START_TAG, GML.NAMESPACE, null);
Coordinate point;
if (GML.pos.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordList(dimension, crs);
point = coords[0];
parser.nextTag();
} else if (GML.coordinates.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordinates(dimension, crs);
point = coords[0];
parser.nextTag();
} else if (GML.coord.getLocalPart().equals(parser.getName())) {
point = parseCoord();
parser.nextTag();
} else {
throw new IllegalStateException(
"Unknown coordinate element for Point: " + parser.getName());
}
parser.require(END_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
geom = geomFac.createPoint(point);
geom.setUserData(crs);
return geom;
}
代码示例来源:origin: geotools/geotools
/**
* Generates the point.
*
* @param geometryFactory Geometry factory to be used to create the point.
* @return Created Point.
*/
public Geometry create(GeometryFactory geometryFactory) {
Point point = geometryFactory.createPoint(coordinate);
point.setUserData(getSRS());
point.setSRID(getSRID());
return point;
}
}
代码示例来源:origin: geotools/geotools
/**
* @param point
* @throws TransformException
*/
public Point transformPoint(Point point, GeometryFactory gf) throws TransformException {
// if required, init csTransformer using geometry's CSFactory
init(gf);
CoordinateSequence cs = projectCoordinateSequence(point.getCoordinateSequence());
Point transformed = gf.createPoint(cs);
transformed.setUserData(point.getUserData());
return transformed;
}
代码示例来源:origin: geotools/geotools
public static Point point() {
Point p = gf.createPoint(new Coordinate(1, 2));
p.setUserData(crs());
return p;
}
代码示例来源:origin: geotools/geotools
for (int i = 0; i < features; i++) {
Point point = gf.createPoint(new Coordinate(x + i, y + i));
point.setUserData(DefaultGeographicCRS.WGS84);
代码示例来源:origin: geotools/geotools
for (int i = 0; i < features; i++) {
Point point = gf.createPoint(new Coordinate(x + i, y + i));
point.setUserData(crs);
代码示例来源:origin: org.geotools/gt-wfs-ng
private Point parsePoint(int dimension, CoordinateReferenceSystem crs)
throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
FactoryException {
parser.require(START_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
crs = crs(crs);
Point geom;
parser.nextTag();
parser.require(START_TAG, GML.NAMESPACE, null);
Coordinate point;
if (GML.pos.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordList(dimension, crs);
point = coords[0];
parser.nextTag();
} else if (GML.coordinates.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordinates(dimension, crs);
point = coords[0];
parser.nextTag();
} else if (GML.coord.getLocalPart().equals(parser.getName())) {
point = parseCoord();
parser.nextTag();
} else {
throw new IllegalStateException(
"Unknown coordinate element for Point: " + parser.getName());
}
parser.require(END_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
geom = geomFac.createPoint(point);
geom.setUserData(crs);
return geom;
}
代码示例来源:origin: org.geotools/gt-wfs-ng
private Point parsePoint(int dimension, CoordinateReferenceSystem crs)
throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
FactoryException {
parser.require(START_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
crs = crs(crs);
Point geom;
parser.nextTag();
parser.require(START_TAG, GML.NAMESPACE, null);
Coordinate point;
if (GML.pos.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordList(dimension);
point = coords[0];
parser.nextTag();
} else if (GML.coordinates.getLocalPart().equals(parser.getName())) {
Coordinate[] coords = parseCoordinates(dimension);
point = coords[0];
parser.nextTag();
} else if (GML.coord.getLocalPart().equals(parser.getName())) {
point = parseCoord();
parser.nextTag();
} else {
throw new IllegalStateException(
"Unknown coordinate element for Point: " + parser.getName());
}
parser.require(END_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
geom = geomFac.createPoint(point);
geom.setUserData(crs);
return geom;
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* @param point
*
* @throws TransformException
*/
public Point transformPoint(final Point point, final GeometryFactory gf)
throws TransformException {
final CoordinateSequence cs = projectCoordinateSequence(point.getCoordinateSequence());
final Point transformed = gf.createPoint(cs);
transformed.setUserData( point.getUserData() );
return transformed;
}
代码示例来源:origin: Geomatys/geotoolkit
@Test
public void testCRSAccessMap() throws NoSuchAuthorityCodeException, FactoryException{
final CoordinateReferenceSystem epsg4326 = CommonCRS.WGS84.geographic();
final Point geom = GF.createPoint(new Coordinate(50, 27));
//should not raise a log
CoordinateReferenceSystem crs = JTS.findCoordinateReferenceSystem(geom);
assertNull(crs);
final Map<String,Object> map = new HashMap<String, Object>();
map.put(HintsPending.JTS_GEOMETRY_CRS, epsg4326);
geom.setUserData(map);
crs = JTS.findCoordinateReferenceSystem(geom);
assertEquals(epsg4326, crs);
}
代码示例来源:origin: Geomatys/geotoolkit
@Test
public void testCRSAccessDirect() throws FactoryException{
final CoordinateReferenceSystem epsg4326 = CommonCRS.WGS84.geographic();
final Point geom = GF.createPoint(new Coordinate(50, 27));
//should not raise a log
CoordinateReferenceSystem crs = JTS.findCoordinateReferenceSystem(geom);
assertNull(crs);
geom.setUserData(epsg4326);
crs = JTS.findCoordinateReferenceSystem(geom);
assertEquals(epsg4326, crs);
}
代码示例来源:origin: Geomatys/geotoolkit
@Test
public void testSetCRS(){
//empty user data test
final Point geom = GF.createPoint(new Coordinate(50, 27));
final CoordinateReferenceSystem crs = CommonCRS.WGS84.normalizedGeographic();
JTS.setCRS(geom, crs);
final Object userData = geom.getUserData();
assertEquals(crs, userData);
//user data contained another CRS
final Point geom2 = GF.createPoint(new Coordinate(50, 27));
geom2.setUserData(CommonCRS.SPHERE.normalizedGeographic());
JTS.setCRS(geom2, crs);
final Object userData2 = geom2.getUserData();
assertEquals(crs, userData2);
//user data contained a Map with another CRS
final Point geom3 = GF.createPoint(new Coordinate(50, 27));
Map<String,CoordinateReferenceSystem> dataMap = new HashMap<String,CoordinateReferenceSystem>();
dataMap.put(HintsPending.JTS_GEOMETRY_CRS, CommonCRS.SPHERE.normalizedGeographic());
geom3.setUserData(dataMap);
JTS.setCRS(geom3, crs);
final Object userData3 = geom3.getUserData();
Map values = (Map) userData3;
assertEquals(crs, values.get(HintsPending.JTS_GEOMETRY_CRS));
}
内容来源于网络,如有侵权,请联系作者删除!