com.vividsolutions.jts.geom.Point.setUserData()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中com.vividsolutions.jts.geom.Point.setUserData()方法的一些代码示例,展示了Point.setUserData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.setUserData()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Point
类名称:Point
方法名:setUserData

Point.setUserData介绍

暂无

代码示例

代码示例来源:origin: org.geotools/gt-render

public void setUserData(Object userData) {
  point.setUserData(userData);
}

代码示例来源:origin: org.geotools/gt-app-schema

/**
 * 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: org.datasyslab/geospark

@Override
  public Iterator<Point> call(Geometry spatialObject)
      throws Exception
  {
    List<Point> result = new ArrayList<Point>();
    if (spatialObject instanceof MultiPoint) {
      MultiPoint multiObjects = (MultiPoint) spatialObject;
      for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
        Point oneObject = (Point) multiObjects.getGeometryN(i);
        oneObject.setUserData(multiObjects.getUserData());
        result.add(oneObject);
      }
    }
    else if (spatialObject instanceof Point) {
      result.add((Point) spatialObject);
    }
    else {
      throw new Exception("[ShapefileRDD][getPointRDD] the object type is not Point or MultiPoint type. It is " + spatialObject.getGeometryType());
    }
    return result.iterator();
  }
})

代码示例来源:origin: org.datasyslab/geospark

@Override
  public Iterator<Point> call(Geometry spatialObject)
      throws Exception
  {
    List<Point> result = new ArrayList<Point>();
    if (spatialObject instanceof MultiPoint) {
      MultiPoint multiObjects = (MultiPoint) spatialObject;
      for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
        Point oneObject = (Point) multiObjects.getGeometryN(i);
        oneObject.setUserData(multiObjects.getUserData());
        result.add(oneObject);
      }
    }
    else if (spatialObject instanceof Point) {
      result.add((Point) spatialObject);
    }
    else {
      throw new Exception("[ShapefileRDD][getPointRDD] the object type is not Point or MultiPoint type. It is " + spatialObject.getGeometryType());
    }
    return result.iterator();
  }
});

代码示例来源:origin: kiselev-dv/gazetteer

private void handleIndexedWay(Way line) {
  int w2rIndex = way2relation.find(line.id, w2rLineAccessor, IndexLineAccessMode.UNLINKED);
  
  int i = node2way.find(line.id, n2wLineAccessor, IndexLineAccessMode.UNLINKED);
  if (i >= 0 || w2rIndex >= 0) {
    List<ByteBuffer> wayPoints = getWayPoints(line.id);
    List<Point> coords = new ArrayList<>();
    for(ByteBuffer bb : wayPoints) {
      double lon = bb.getDouble(8 + 8 + 2);
      double lat = bb.getDouble(8 + 8 + 2 + 8);
      
      Point p = geometryFactory.createPoint(new Coordinate(lon, lat));
      p.setUserData(bb.getLong(0));
      coords.add(p);
    }
    if (i >= 0) {
      this.handler.handleWay(line, coords);
    }
    // Parts and buildings will be writen anyway
    else if (!line.tags.containsKey("building") 
        && !line.tags.containsKey("building:part") ) {
      this.handler.saveRelationWay(line, coords);
    }
  }
}

代码示例来源:origin: org.geotools/gt-main

/**
   * 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: org.geotools/gt2-main

/**
   * 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: DataSystemsLab/GeoSpark

@Override
  public Iterator<Point> call(Geometry spatialObject)
      throws Exception
  {
    List<Point> result = new ArrayList<Point>();
    if (spatialObject instanceof MultiPoint) {
      MultiPoint multiObjects = (MultiPoint) spatialObject;
      for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
        Point oneObject = (Point) multiObjects.getGeometryN(i);
        oneObject.setUserData(multiObjects.getUserData());
        result.add(oneObject);
      }
    }
    else if (spatialObject instanceof Point) {
      result.add((Point) spatialObject);
    }
    else {
      throw new Exception("[ShapefileRDD][getPointRDD] the object type is not Point or MultiPoint type. It is " + spatialObject.getGeometryType());
    }
    return result.iterator();
  }
})

代码示例来源:origin: DataSystemsLab/GeoSpark

@Override
  public Iterator<Point> call(Geometry spatialObject)
      throws Exception
  {
    List<Point> result = new ArrayList<Point>();
    if (spatialObject instanceof MultiPoint) {
      MultiPoint multiObjects = (MultiPoint) spatialObject;
      for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
        Point oneObject = (Point) multiObjects.getGeometryN(i);
        oneObject.setUserData(multiObjects.getUserData());
        result.add(oneObject);
      }
    }
    else if (spatialObject instanceof Point) {
      result.add((Point) spatialObject);
    }
    else {
      throw new Exception("[ShapefileRDD][getPointRDD] the object type is not Point or MultiPoint type. It is " + spatialObject.getGeometryType());
    }
    return result.iterator();
  }
});

代码示例来源:origin: kiselev-dv/gazetteer

double lat = bb.getDouble(8 + 8 + 8);
Point p = geometryFactory.createPoint(new Coordinate(lon, lat));
p.setUserData(bb.getLong(0));
relationPoints.add(p);
  p.setUserData(bb.getLong(0));
  coords.add(p);

代码示例来源:origin: org.geotools/gt-wfs

private Point parsePoint(int dimension, CoordinateReferenceSystem crs)
    throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
    FactoryException {
  parser.require(XmlPullParser.START_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
  Point geom;
  parser.nextTag();
  parser.require(XmlPullParser.START_TAG, GML.NAMESPACE, GML.pos.getLocalPart());
  crs = crs(crs);
  Coordinate[] coords = parseCoordList(dimension, crs);
  geom = geomFac.createPoint(coords[0]);
  geom.setUserData(crs);
  parser.nextTag();
  parser.require(XmlPullParser.END_TAG, GML.NAMESPACE, GML.Point.getLocalPart());
  return geom;
}

代码示例来源:origin: org.datasyslab/geospark

observation.setUserData(userData);
hdfData.add(observation);

代码示例来源:origin: DataSystemsLab/GeoSpark

observation.setUserData(userData);
hdfData.add(observation);

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

public SimpleFeature next() throws NoSuchElementException {
    SimpleFeature sourceFeature = delegate.next();
    SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID());
    // transfer attributes
    transferAttribute(sourceFeature, nextFeature);
    // calculate xy coordinates
    Geometry g = (Geometry) sourceFeature.getDefaultGeometry();
    Point center = useInside ? g.getInteriorPoint() : g.getCentroid();
    if (transformer != null) {
      try {
        center.setUserData(sourceFeature.getFeatureType()
            .getCoordinateReferenceSystem());
        center = (Point) transformer.transform(center);
      } catch (TransformException e) {
        String msg = "Error occured transforming " + center.toString();
        LOGGER.log(Level.WARNING, msg);
      }
    }
    nextFeature.setAttribute(xField, center.getX());
    nextFeature.setAttribute(yField, center.getY());
    return nextFeature;
  }
}

相关文章