Package org.geomajas.geometry

Examples of org.geomajas.geometry.Coordinate


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

  private Coordinate[] convertCoordinates(com.vividsolutions.jts.geom.Geometry geometry) {
    Coordinate[] coordinates = new Coordinate[geometry.getCoordinates().length];
    for (int i = 0; i < coordinates.length; i++) {
      coordinates[i] = new Coordinate(geometry.getCoordinates()[i].x, geometry.getCoordinates()[i].y);
    }
    return coordinates;
  }
View Full Code Here


    tmd.setCrs("EPSG:4326");
    tmd.setCode(new TileCode(1,0,0));
    tmd.setLayerId(LAYER_BEANS);
    tmd.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tmd.setScale(1.0);
    tmd.setPanOrigin(new Coordinate(0, 0));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,0,0));
    tile = vectorLayerService.getTile(tmd);
View Full Code Here

    tmd.setCrs("EPSG:4326");
    tmd.setCode(new TileCode(1,0,1));
    tmd.setLayerId(LAYER_BEANS);
    tmd.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tmd.setScale(1.0);
    tmd.setPanOrigin(new Coordinate(0, 0));

    // first run, this should put things in the cache
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
View Full Code Here

    tmd.setCrs("EPSG:4326");
    tmd.setCode(new TileCode(1,0,1));
    tmd.setLayerId(LAYER_BEANS);
    tmd.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tmd.setScale(1.0);
    tmd.setPanOrigin(new Coordinate(0, 0));

    // first run, this should put things in the cache
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
View Full Code Here

    tmd.setCrs("EPSG:900913");
    tmd.setCode(new TileCode(1,1,1));
    tmd.setLayerId(LAYER_BEANS);
    tmd.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tmd.setScale(1.0);
    tmd.setPanOrigin(new Coordinate(0, 0));

    // first run, this should put things in the cache
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
View Full Code Here

    tileMetadata.setCode(new TileCode(2, 1, 1));
    tileMetadata.setCrs(beanLayer.getLayerInfo().getCrs());
    tileMetadata.setLayerId(LAYER_ID);
    tileMetadata.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tileMetadata.setScale(1);
    tileMetadata.setPanOrigin(new Coordinate(0,0));

    login("luc");
    recorder.clear();
    tile = layerService.getTile(tileMetadata);
    Assert.assertTrue(tile.getFeatureContent().contains("path"));
View Full Code Here

      if (null == mapBounds) {
        throw new LayerException(ExceptionCode.MAP_MAX_EXTENT_MISSING);
      }
      Crs crs = geoService.getCrs2(mapCrsKey);
      GeodeticCalculator calculator = new GeodeticCalculator(crs);
      Coordinate center = new Coordinate(0.5 * (mapBounds.getX() + mapBounds.getMaxX()),
          0.5 * (mapBounds.getY() + mapBounds.getMaxY()));
      calculator.setStartingPosition(new DirectPosition2D(crs, center.getX(), center.getY()));
      calculator.setDestinationPosition(new DirectPosition2D(crs, center.getX() + 1, center.getY()));
      return calculator.getOrthodromicDistance();
    } catch (TransformException e) {
      throw new LayerException(e, ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED);
    }
  }
View Full Code Here

            if (vLayer.getLayerInfo().getLayerType() == LayerType.LINESTRING
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTILINESTRING) {
              // Lines, draw a LineString;
              Coordinate[] coordinates = new Coordinate[4];
              coordinates[0] = new Coordinate(10, y);
              coordinates[1] = new Coordinate(10 + 10, y + 5);
              coordinates[2] = new Coordinate(10 + 5, y + 10);
              coordinates[3] = new Coordinate(10 + 15, y + 15);
              LineString line = mapModel.getGeometryFactory().createLineString(coordinates);
              graphics.drawLine(parentGroup, "style" + lineCount, line, style);
            } else if (vLayer.getLayerInfo().getLayerType() == LayerType.POLYGON
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOLYGON) {
              // Polygons: draw a rectangle:
              Bbox rect = new Bbox(10, y, 16, 16);
              graphics.drawRectangle(parentGroup, "style" + lineCount, rect, style);
            } else if (vLayer.getLayerInfo().getLayerType() == LayerType.POINT
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOINT) {
              // Points: draw a symbol:
              graphics.drawSymbol(parentGroup, "style" + lineCount, new Coordinate(18, y + 8), style,
                  styleInfo.getStyleId());
            }

            // After the style, draw the style's name:
            Coordinate textPosition = new Coordinate(30, y - 2);
            graphics.drawText(parentGroup, "text" + lineCount, styleInfo.getName(), textPosition,
                fontStyle);
            y += 21;
          }
        } else if (layer instanceof RasterLayer) {
          // For raster layers; show a nice symbol:
          lineCount++;

          graphics.drawImage(parentGroup, "style" + lineCount, Geomajas.getIsomorphicDir()
              + "geomajas/osgeo/layer-raster.png", new Bbox(10, y, 16, 16), new PictureStyle(1));
          Coordinate textPosition = new Coordinate(30, y - 2);
          graphics.drawText(parentGroup, "text" + lineCount, layer.getLabel(), textPosition, fontStyle);
          y += 20;
        }
      }
    }
View Full Code Here

  }

  private Bbox getPanBounds(VectorTile tile) {
    // Bounds should have integer coordinate values after transforming
    // We shift the bbox to the next integer value point
    Coordinate panOrigin = mapView.getPanOrigin();
    double scale = mapView.getCurrentScale();
    // calculate the normal shift of the origin tile's corner and extract the fractional part
    double dx = Math.round((tile.getCache().getLayerBounds().getX() - panOrigin.getX()) * scale) / scale;
    double dy = Math.round((tile.getCache().getLayerBounds().getY() - panOrigin.getY()) * scale) / scale;
    // this gives the difference between integer positions and floating positions
    dx = dx  - (tile.getCache().getLayerBounds().getX() - panOrigin.getX());
    dy = dy  - (tile.getCache().getLayerBounds().getY() - panOrigin.getY());
    // now apply to our bounds
    Bbox  worldBounds = new Bbox(tile.getBounds());
    worldBounds.translate(-dx, -dy);
    // transform to pan space and round
    Bbox panBounds = mapView.getWorldViewTransformer().worldToPan(worldBounds);
View Full Code Here

  // Constructor
  // -------------------------------------------------------------------------

  public RemoveRingOperationTest() {
    GeometryFactory gwtFactory = new GeometryFactory(SRID, PRECISION);
    LinearRing exteriorRing = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(0.0, 0.0),
        new Coordinate(20.0, 0.0), new Coordinate(20.0, 20.0), new Coordinate(0.0, 20.0)});
    LinearRing interiorRing1 = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(12.0, 12.0),
        new Coordinate(14.0, 12.0), new Coordinate(14.0, 18.0), new Coordinate(12.0, 18.0)});
    LinearRing interiorRing2 = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(16.0, 12.0),
        new Coordinate(18.0, 12.0), new Coordinate(18.0, 18.0), new Coordinate(16.0, 18.0)});

    polygon = gwtFactory.createPolygon(exteriorRing, new LinearRing[] {interiorRing1, interiorRing2});
  }
View Full Code Here

TOP

Related Classes of org.geomajas.geometry.Coordinate

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.