Examples of VectorLayer


Examples of org.geomajas.layer.VectorLayer

  @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

Examples of org.geomajas.layer.VectorLayer

  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

Examples of org.geomajas.layer.VectorLayer

    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

Examples of org.geomajas.layer.VectorLayer

      // 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

Examples of org.geomajas.layer.VectorLayer

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

  public void execute(PipelineContext context, GetFeaturesContainer response) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    int featureIncludes = context.get(PipelineCode.FEATURE_INCLUDES_KEY, Integer.class);
    NamedStyleInfo style = context.getOptional(PipelineCode.STYLE_KEY, NamedStyleInfo.class);

    List<StyleFilter> styleFilters = null;
    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());
    }
    context.put(PipelineCode.STYLE_KEY, style);

    if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_STYLE) != 0) {
      if (style == null) {
View Full Code Here

Examples of org.geomajas.layer.VectorLayer

    } else {
      throw new IllegalArgumentException("You must provide a feature or location search request.");
    }

    if (features != null) {
      VectorLayer layer = configurationService.getVectorLayer(request.getLayerId());
      String fileName = (request.getFilename() == null || "".equals(request.getFilename()) ? request.getLayerId()
          + EXTENSION : request.getFilename());
      if (!fileName.endsWith(EXTENSION) && !fileName.endsWith(".CSV")) {
        fileName += EXTENSION;
      }
View Full Code Here

Examples of org.geomajas.layer.VectorLayer

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    InternalFeature oldFeature = context.getOptional(PipelineCode.OLD_FEATURE_KEY, InternalFeature.class);
    InternalFeature newFeature = context.get(PipelineCode.FEATURE_KEY, InternalFeature.class);
    if (null != oldFeature) {
      String layerId = context.get(PipelineCode.LAYER_ID_KEY, String.class);
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      if (securityContext.isFeatureUpdateAuthorized(layerId, oldFeature, newFeature)) {
        if (null == context.getOptional(PipelineCode.FEATURE_DATA_OBJECT_KEY)) {
          context.put(PipelineCode.FEATURE_DATA_OBJECT_KEY, layer.read(newFeature.getId()));
        }
      } else {
        throw new GeomajasSecurityException(ExceptionCode.FEATURE_UPDATE_PROHIBITED,
            oldFeature.getId(), securityContext.getUserId());
      }
View Full Code Here

Examples of org.geomajas.layer.VectorLayer

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    InternalFeature newFeature = context.getOptional(PipelineCode.FEATURE_KEY, InternalFeature.class);
    Object feature = context.get(PipelineCode.FEATURE_DATA_OBJECT_KEY);
    String layerId = context.get(PipelineCode.LAYER_ID_KEY, String.class);
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    FeatureModel featureModel = layer.getFeatureModel();
    Boolean isCreateObject = context.getOptional(PipelineCode.IS_CREATE_KEY, Boolean.class);
    boolean isCreate  = false;
    if (null != isCreateObject && isCreateObject) {
      isCreate = true;
    }

    // Assure only writable attributes are set
    Map<String, Attribute> requestAttributes = newFeature.getAttributes();
    Map<String, Attribute> filteredAttributes = new HashMap<String, Attribute>();
    if (null != requestAttributes) {
      for (Map.Entry<String, Attribute> entry : requestAttributes.entrySet()) {
        String key = entry.getKey();
        if (securityContext.isAttributeWritable(layerId, newFeature, key)) {
          filteredAttributes.put(key, entry.getValue());
        }
      }
    }
    featureModel.setAttributes(feature, filteredAttributes);

    if (newFeature.getGeometry() != null) {
      featureModel.setGeometry(feature, newFeature.getGeometry());
    }

    Filter securityFilter;
    if (isCreate) {
      securityFilter = getSecurityFilter(layer, securityContext.getCreateAuthorizedArea(layerId));
    } else {
      securityFilter = getSecurityFilter(layer, securityContext.getUpdateAuthorizedArea(layerId));
    }
    if (securityFilter.evaluate(feature)) {
      context.put(PipelineCode.FEATURE_DATA_OBJECT_KEY, layer.saveOrUpdate(feature));
      if (isCreate) {
        newFeature.setId(featureModel.getId(feature));
      }
    } else {
      if (isCreate) {
View Full Code Here

Examples of org.geomajas.layer.VectorLayer

  }

  public void execute(PipelineContext context, GetBoundsContainer response)
      throws GeomajasException {
    if (null == response.getEnvelope()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      CrsTransform crsTransform = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      Envelope bounds = layer.getBounds(filter);
      bounds = geoService.transform(bounds, crsTransform);
      response.setEnvelope(bounds);
    }
  }
View Full Code Here

Examples of org.geomajas.layer.VectorLayer

  @RequestMapping(value = "/rasterizing/layer/{layerId}/{key}.png", method = RequestMethod.GET)
  public void getImage(@PathVariable String layerId, @PathVariable String key, HttpServletResponse response)
      throws Exception {

    try {
      VectorLayer layer = configurationService.getVectorLayer(layerId);
      RasterizingContainer rasterizeContainer = cacheManagerService.get(layer, CacheCategory.RASTER, key,
          RasterizingContainer.class);
      // if not in cache, try the rebuild cache and invoke the pipeline directly
      if (rasterizeContainer == null) {
        GetTileContainer tileContainer = new GetTileContainer();
        PipelineContext context = pipelineService.createContext();
        context.put(RasterizingPipelineCode.IMAGE_ID_KEY, key);
        context.put(PipelineCode.LAYER_ID_KEY, layerId);
        context.put(PipelineCode.LAYER_KEY, layer);

        // get data from rebuild cache
        RebuildCacheContainer rebuildCacheContainer = cacheManagerService.get(layer, CacheCategory.REBUILD, key,
            RebuildCacheContainer.class);
        if (null == rebuildCacheContainer) {
          log.error("Data to rebuild the raster image is no longer available for key " + key);
          response.sendError(HttpServletResponse.SC_NO_CONTENT);
          return;
        }
        recorder.record(CacheCategory.REBUILD, "Got rebuild info from cache");
        TileMetadata tileMetadata = rebuildCacheContainer.getMetadata();
        context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata);
        Crs crs = geoService.getCrs2(tileMetadata.getCrs());
        context.put(PipelineCode.CRS_KEY, crs);
        CrsTransform layerToMap = geoService.getCrsTransform(layer.getCrs(), crs);
        context.put(PipelineCode.CRS_TRANSFORM_KEY, layerToMap);
        Envelope layerExtent = dtoConverterService.toInternal(layer.getLayerInfo().getMaxExtent());
        Envelope tileExtent = geoService.transform(layerExtent, layerToMap);
        context.put(PipelineCode.TILE_MAX_EXTENT_KEY, tileExtent);
        // can't stop here, we have only prepared the context, not built the tile !
        InternalTile tile = new InternalTileImpl(tileMetadata.getCode(), tileExtent, tileMetadata.getScale());
        tileContainer.setTile(tile);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.