Package org.geotools.map

Examples of org.geotools.map.MapLayer


      FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
          .getFeatureSource(typeName);
      Class<?> geometryType = featureSource.getSchema()
          .getGeometryDescriptor().getType().getBinding();
      Style style = getFeatureLayerStyle(styleSource, geometryType);
      MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
      layer = new FeatureLayer();
      layer.setMapLayer(mapLayer);
    } else if (lowFileName.endsWith(".jpg")
        || lowFileName.endsWith(".jpeg")
        || lowFileName.endsWith(".png") || lowFileName.endsWith(".gif")
        || lowFileName.endsWith(".tif")
        || lowFileName.endsWith(".tiff")) {
      // Raster
      AbstractGridCoverage2DReader reader = GridCoverage2DReaderFactory
          .getGridCoverage2DReaderFromFile(file);
      Style style = getRasterLayerStyle(styleSource, reader);
      MapLayer mapLayer = new DefaultMapLayer(reader, style);
      layer = new RasterLayer();
      layer.setMapLayer(mapLayer);
      layer.setEditable(false);
    }
View Full Code Here


    FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
        .getFeatureSource(typeName);
    Class<?> geometryType = featureSource.getSchema()
        .getGeometryDescriptor().getType().getBinding();
    Style style = getFeatureLayerStyle(styleSource, geometryType);
    MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
    Layer layer = new FeatureLayer();
    layer.setMapLayer(mapLayer);
    return layer;
  }
View Full Code Here

    FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
        .getFeatureSource(typeName);
    Class<?> geometryType = featureSource.getSchema()
        .getGeometryDescriptor().getType().getBinding();
    Style style = getFeatureLayerStyle(styleSource, geometryType);
    MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
    Layer layer = new FeatureLayer();
    layer.setMapLayer(mapLayer);
    return layer;
  }
View Full Code Here

    FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
        .getFeatureSource(typeName);
    Class<?> geometryType = featureSource.getSchema()
        .getGeometryDescriptor().getType().getBinding();
    Style style = getFeatureLayerStyle(styleSource, geometryType);
    MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
    Layer layer = new FeatureLayer();
    layer.setMapLayer(mapLayer);
    return layer;
  }
View Full Code Here

    FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
        .getFeatureSource(typeName);
    Class<?> geometryType = featureSource.getSchema()
        .getGeometryDescriptor().getType().getBinding();
    Style style = getFeatureLayerStyle(styleSource, geometryType);
    MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
    Layer layer = new FeatureLayer();
    layer.setMapLayer(mapLayer);
    return layer;
  }
View Full Code Here

    FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
        .getFeatureSource(typeName);
    Class<?> geometryType = featureSource.getSchema()
        .getGeometryDescriptor().getType().getBinding();
    Style style = getFeatureLayerStyle(styleSource, geometryType);
    MapLayer mapLayer = new FeatureSourceMapLayer(featureSource, style);
    Layer layer = new FeatureLayer();
    layer.setMapLayer(mapLayer);
    return layer;
  }
View Full Code Here

    try {
      MapService mapService = ServiceManager.getMapService(serviceName);

      if (mapService != null) {
        MapLayer mapLayer = null;
        MapServiceInstance instance = (MapServiceInstance) mapService
            .getMapServicePool().checkoutIdleInstance();
        try {
          mapLayer = instance.getMap().getLayer(layerId)
              .getMapLayer();
View Full Code Here

      if (identifyType.equals(IdentifyType.TOP)) {
        handleLayerIds = layerIds;
      } else if (identifyType.equals(IdentifyType.VISIBLE)) {
        handleLayerIds = new ArrayList<String>();
        for (int i = 0, count = map.getMapContext().getLayerCount(); i < count; i++) {
          MapLayer layer = map.getLayer(i).getMapLayer();
          if (layer.isVisible()) {
            handleLayerIds.add(String.valueOf(i));
          }
        }
      } else if (identifyType.equals(IdentifyType.ALL)) {
        handleLayerIds = new ArrayList<String>();
        for (int i = 0, count = map.getMapContext().getLayerCount(); i < count; i++) {
          handleLayerIds.add(String.valueOf(i));
        }
      }

      for (int i = 0, count = handleLayerIds.size(); i < count; i++) {
        Layer layer = map.getLayer(i);

        QueryParam queryParam = new QueryParam();
        queryParam.setGeometry(geometry);
        queryParam.setSpatialFilterType(SpatialFilterType.INTERSECTS);
        FeatureCollection<? extends FeatureType, ? extends Feature> layerFeatureCollection = layer
            .query(queryParam);
        if (layerFeatureCollection != null
            && !layerFeatureCollection.isEmpty()) {
          for (FeatureIterator<? extends Feature> itr = layerFeatureCollection
              .features(); itr.hasNext();) {
View Full Code Here

    try {
      // Handle visible layerIds
      int layerCount = map.getMapContext().getLayerCount();
      for (int i = 0; i < layerCount; i++) {
        MapLayer layer = map.getLayer(i).getMapLayer();
        layer.setVisible(false);
      }
      List<String> visibleLayerIds = renderParam.getVisibleLayerIds();
      HashMap<String, String> layerDefs = renderParam.getLayerDefs();
      if (visibleLayerIds == null) {
        visibleLayerIds = new ArrayList<String>();
        for (int i = 0; i < layerCount; i++) {
          visibleLayerIds.add(String.valueOf(i));
        }
      }
      for (int i = 0, count = visibleLayerIds.size(); i < count; i++) {
        int layerId = Integer.parseInt(visibleLayerIds.get(i));
        MapLayer layer = map.getLayer(i).getMapLayer();
        layer.setVisible(true);

        // Handle layerDefs
        String key = String.valueOf(layerId);
        if (layerDefs != null && layerDefs.containsKey(key)) {
          String def = layerDefs.get(key);
          if (def != null && !"".equals(def)) {
            try {
              Filter filter = ECQL.toFilter(def);
              DefaultQuery query = new DefaultQuery();
              query.setFilter(filter);
              layer.setQuery(query);
            } catch (Exception e) {
              StringBuilder sb = new StringBuilder();
              sb.append(ResourceBundleManager
                  .getResourceBundleMapServiceLog()
                  .getString("ERROR.LAYER_DEFS"));
              sb.append("<");
              sb.append(serviceName);
              sb.append("-");
              sb.append(String.valueOf(layerId));
              sb.append(">");
              logger.error(sb.toString(), e);
            }
          } else {
            layer.setQuery(Query.ALL);
          }
        }
      }

      MapImage mapImage = map.render(renderParam);
View Full Code Here

      MapDesc mapDesc = mapService.getMapDesc();
      boolean editable = mapDesc.getLayerInfo(layerId).isEditable();

      if (mapService != null) {
        MapLayer mapLayer = null;
        MapServiceInstance instance = (MapServiceInstance) mapService
            .getMapServicePool().checkoutIdleInstance();
        try {
          mapLayer = instance.getMap().getLayer(layerId)
              .getMapLayer();
View Full Code Here

TOP

Related Classes of org.geotools.map.MapLayer

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.