Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Point


 
  public void testUpdatePointMarker() throws Exception{
    PointMarker pm = geomMarkerDao.getPointMarker(m1.getId());
    pm.setMarkerIconId(10);
    pm.setNotes("newnotes");
    Point p3 = factory.createPoint(new Coordinate(30,30));
    pm.setPoint(p3);
    assertTrue(geomMarkerDao.updatePointMarker(pm));
    pm = geomMarkerDao.getPointMarker(m1.getId());
    assertEquals(m1.getId(),pm.getId());
    assertEquals(10,pm.getMarkerIconId());
View Full Code Here


    if(toType == PointMarker.class){
      PointMarker pm = new PointMarker();  
      pm.setNotes(jsonObj.getString("notes"));
      pm.setId(jsonObj.getInt("id"));
      pm.setMarkerIconId(jsonObj.getInt("iconId"));
      Point pt = parsePoint(jsonObj.getString("point"));
      if(pt != null){
        pm.setPoint(pt);
      }         
      return pm;
    }
View Full Code Here

    pm.setId(rs.getInt(PointMarkerSchema.ID));
    pm.setNotes(rs.getString(PointMarkerSchema.NOTES));
    pm.setMarkerIconId(rs.getInt(PointMarkerSchema.ICON_ID));
   
    byte[] buf = rs.getBytes(PointMarkerSchema.GEOM_WKB);
    Point pt = (Point)wkbReader.read(buf);   
    pm.setPoint(pt);       
    return pm;
  }
View Full Code Here

   * @param asChild create child element if true.
   * @throws RenderException
   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("vml:shape", asChild);
    Point p = (Point) o;
    String adj = document.getFormatter().format(p.getX()) + ","
        + document.getFormatter().format(p.getY());
    document.writeAttribute("adj", adj);
  }
View Full Code Here

  // -------------------------------------------------------------------------

  @Test
  public void dtoPointToJts() throws GeomajasException {
    // Test DTO Point to JTS:
    Point point = (Point) converter.toInternal(createDtoPoint());
    Assert.assertEquals(dtoC1.getX(), point.getX());
  }
View Full Code Here

    document.writeElement("g", asChild);
    document.writeId("labels." + tile.getCode().toString());
    for (InternalFeature feature : tile.getFeatures()) {
      Coordinate pos = geoService.calcDefaultLabelPosition(feature);
      if (null != pos) {
        Point p = factory.createPoint(pos);
        Point labelPos;
        try {
          String labelString = feature.getLabel();
          if (null != labelString && labelString.length() > 0) {
            labelPos = (Point) transformer.transform(p);
            boolean createChild = true;

            Rectangle2D textBox = textService.getStringBounds(labelString, labelStyle.getFontStyle());
            document.writeElement("rect", createChild);
            document.writeAttribute("id", feature.getId() + ".lblBG");
            document.writeAttribute("x", labelPos.getX() - Math.round(textBox.getWidth() / 2));
            document.writeAttribute("y", labelPos.getY() - Math.round(textBox.getHeight()));
            document.writeAttribute("width", Math.round(textBox.getWidth()));
            document.writeAttribute("height", Math.round(textBox.getHeight()));
            document.writeAttribute("style", getCssStyle(bgStyle));
            createChild = false;

            // Text:
            document.writeElement("text", createChild);
            document.writeAttribute("id", feature.getId() + ".lblTXT");
            document.writeAttribute("x", labelPos.getX());
            // pull up baseline position to accommodate for descent
            document.writeAttribute("y", labelPos.getY() - Math.round(textBox.getMaxY()));
            // TODO: config option, center label
            document.writeAttribute("text-anchor", "middle");
            document.writeAttribute("style", getCssStyle(labelStyle.getFontStyle()));
            document.writeTextNode(labelString);
          }
View Full Code Here

  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    MultiPoint mp = (MultiPoint) o;
    for (int i = 0; i < mp.getNumGeometries(); i++) {
      document.writeElement("use", i == 0 && asChild);
      Point p = (Point) mp.getGeometryN(i);
      document.writeAttribute("x", p.getX());
      document.writeAttribute("y", p.getY());
    }
  }
View Full Code Here

*/
public class PointWriter implements GraphicsWriter {

  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("use", asChild);
    Point p = (Point) o;
    document.writeAttribute("x", p.getX());
    document.writeAttribute("y", p.getY());
  }
View Full Code Here

  @Test
  public void create() throws ParseException, LayerException {
    Object created = null;
    WKTReader wktReader = new WKTReader();
    Point geometry = null;
    geometry = (Point) wktReader.read("POINT (0 0)");

    Object feature = (SimpleFeature)layer.getFeatureModel().newInstance("500");
    Map<String, Attribute> map = new HashMap<String, Attribute>();
    map.put("NAME", new StringAttribute("Tsjakamaka"));
View Full Code Here

  }

  @Test
  public void setGeometry() throws Exception {
    WKTReader wktReader = new WKTReader();
    Point pt = (Point) wktReader.read("POINT (5 5)");
    featureModel.setGeometry(feature, pt);
    Assert.assertEquals(5, featureModel.getGeometry(feature).getCoordinate().x, 0.00001);
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.