Package org.geomajas.layer

Examples of org.geomajas.layer.VectorLayer


  /** {@inheritDoc} */
  public void putContainer(PipelineContext pipelineContext, CachingSupportServiceContextAdder contextAdder,
      CacheCategory category, String[] keys, String keyKey, String contextKey, CacheContainer cacheContainer,
      Envelope envelope) {
    try {
      VectorLayer layer = pipelineContext.getOptional(PipelineCode.LAYER_KEY, VectorLayer.class);
      CacheContext cacheContext = pipelineContext.getOptional(contextKey, CacheContext.class);
      if (null == cacheContext) {
        cacheContext = cacheKeyService.getCacheContext(pipelineContext, keys);
        if (null != contextAdder) {
          contextAdder.addMoreContext(cacheContext); // add more data...
View Full Code Here


  }

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    Object feature = context.get(PipelineCode.FEATURE_DATA_OBJECT_KEY);
    InternalFeature newFeature = context.get(PipelineCode.FEATURE_KEY, InternalFeature.class);
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);

//    // Not needed for existing features, but no problem to re-set feature id
//    String id = featureModel.getId(feature);
//    newFeature.setId(id);
View Full Code Here

  public void setId(String id) {
    this.id = id;
  }

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    TileMetadata metadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);

    // Get the features:
    List<InternalFeature> features = layerService
        .getFeatures(metadata.getLayerId(), layer.getCrs(), filter, metadata.getStyleInfo(),
            VectorLayerService.FEATURE_INCLUDE_ALL);
    // Put them all in the tile to make them available to the next step
    response.getTile().setFeatures(features);
  }
View Full Code Here

    List<InternalFeature> features = response.getFeatures();
    log.debug("Get features, was {}", features);
    if (null == features) {
      features = new ArrayList<InternalFeature>();
      response.setFeatures(features);
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      int offset = context.get(PipelineCode.OFFSET_KEY, Integer.class);
      int maxResultSize = context.get(PipelineCode.MAX_RESULT_SIZE_KEY, Integer.class);
      int featureIncludes = context.get(PipelineCode.FEATURE_INCLUDES_KEY, Integer.class);
      NamedStyleInfo style = context.get(PipelineCode.STYLE_KEY, NamedStyleInfo.class);
      CrsTransform transformation = context.getOptional(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      List<StyleFilter> styleFilters = context.getOptional(GetFeaturesStyleStep.STYLE_FILTERS_KEY, List.class);

      if (log.isDebugEnabled()) {
        log.debug("getElements " + filter + ", offset = " + offset + ", maxResultSize= " + maxResultSize);
      }
      Envelope bounds = null;
      Iterator<?> it = layer.getElements(filter, 0, 0); // do not limit result here, security needs to be applied

      int count = 0;
      while (it.hasNext()) {
        log.debug("process feature");
        Object featureObj = it.next();
        Geometry geometry = layer.getFeatureModel().getGeometry(featureObj);
        InternalFeature feature = convertFeature(featureObj, geometry, layer, transformation,
            styleFilters, style.getLabelStyle(), featureIncludes);
        if (null != feature) {
          count++;
          if (count > offset) {
            features.add(feature);

            if (null != geometry) {
              Envelope envelope = geometry.getEnvelopeInternal();
              if (null == bounds) {
                bounds = new Envelope();
              }
              bounds.expandToInclude(envelope);
            }

            if (features.size() == maxResultSize) {
              break;
            }
          }
        } else {
          if (log.isDebugEnabled()) {
            log.debug("feature not visible {}", layer.getFeatureModel().getId(featureObj));
          }
        }
      }
      response.setBounds(bounds);
    }
View Full Code Here

  }

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    InternalTile tile = response.getTile();
    if (null == tile.getFeatureContent()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      TileMetadata metadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);

      tile.setContentType(VectorTile.VectorTileContentType.STRING_CONTENT);
      Coordinate panOrigin = new Coordinate(metadata.getPanOrigin().getX(), metadata.getPanOrigin().getY());
      TilePainter tilePainter = new StringContentTilePainter(layer, metadata.getStyleInfo(), metadata
View Full Code Here

  public void setId(String id) {
    this.id = id;
  }

  public void execute(PipelineContext context, GetTileContainer tileContainer) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    TileMetadata tileMetadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    // put the image in a raster container
    RasterizingContainer rasterizingContainer = new RasterizingContainer();
    NamedStyleInfo style = tileMetadata.getStyleInfo();
    if (style == null) {
      // no style specified, take the first
      style = layer.getLayerInfo().getNamedStyleInfos().get(0);
    } else if (style.getFeatureStyles().isEmpty()) {
      // only name specified, find it
      style = layer.getLayerInfo().getNamedStyleInfo(style.getName());
    }
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(converterService.toDto(tileContainer.getTile().getBounds()));
    mapInfo.setCrs(tileMetadata.getCrs());
View Full Code Here

  @Autowired
  private FilterService filterService;

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    Filter filter = context.getOptional(PipelineCode.FILTER_KEY, Filter.class);
    String layerId = layer.getId();

    // apply generic security filter
    Filter layerFeatureFilter = securityContext.getFeatureFilter(layerId);
    if (null != layerFeatureFilter) {
      filter = and(filter, layerFeatureFilter);
    }

    // apply default filter
    String defaultFilter = layer.getLayerInfo().getFilter();
    if (null != defaultFilter) {
      filter = and(filter, filterService.parseFilter(defaultFilter));
    }

    // apply visible area filter
    Geometry visibleArea = securityContext.getVisibleArea(layerId);
    if (null != visibleArea) {
      String geometryName = layer.getLayerInfo().getFeatureInfo().getGeometryType().getName();
      if (securityContext.isPartlyVisibleSufficient(layerId)) {
        filter = and(filter, filterService.createIntersectsFilter(visibleArea, geometryName));
      } else {
        filter = and(filter, filterService.createWithinFilter(visibleArea, geometryName));
      }
View Full Code Here

  public void execute(PipelineContext context, GetAttributesContainer response) throws GeomajasException {
    List<Attribute<?>> attributes = response.getAttributes();
    if (null == attributes) {
      attributes = new ArrayList<Attribute<?>>();
      response.setAttributes(attributes);
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      String attributeName = context.get(PipelineCode.ATTRIBUTE_NAME_KEY, String.class);
      if (layer instanceof VectorLayerAssociationSupport) {
        List<Attribute<?>> list = ((VectorLayerAssociationSupport) layer).getAttributes(attributeName, filter);
        attributes.addAll(list);
View Full Code Here

    InternalFeature oldFeature = context.getOptional(PipelineCode.OLD_FEATURE_KEY, InternalFeature.class);
    InternalFeature newFeature = context.get(PipelineCode.FEATURE_KEY, InternalFeature.class);
    if (null == oldFeature) {
      // create new feature
      String layerId = context.get(PipelineCode.LAYER_ID_KEY, String.class);
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      FeatureModel featureModel = layer.getFeatureModel();
      if (securityContext.isFeatureCreateAuthorized(layerId, newFeature)) {
        Object feature;
        if (newFeature.getId() == null) {
          feature = featureModel.newInstance();
        } else {
View Full Code Here

      // delete ?
      InternalFeature oldFeature = context.getOptional(PipelineCode.OLD_FEATURE_KEY, InternalFeature.class);
      if (null != oldFeature) {
        String layerId = context.get(PipelineCode.LAYER_ID_KEY, String.class);
        if (securityContext.isFeatureDeleteAuthorized(layerId, oldFeature)) {
          VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
          Object featureObj = layer.read(oldFeature.getId());
          if (null != featureObj) {
            Filter securityFilter = getSecurityFilter(layer,
                securityContext.getDeleteAuthorizedArea(layerId));
            if (securityFilter.evaluate(featureObj)) {
              layer.delete(oldFeature.getId());
            } else {
              throw new GeomajasSecurityException(ExceptionCode.FEATURE_DELETE_PROHIBITED,
                  oldFeature.getId(), securityContext.getUserId());
            }
          }
View Full Code Here

TOP

Related Classes of org.geomajas.layer.VectorLayer

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.