Package org.geomajas.global

Examples of org.geomajas.global.GeomajasException


      } else if (criterion instanceof OrCriterion) {
        return dtoOrCriterionToFilters((OrCriterion) criterion, mapCrs);

      } else {
        throw new GeomajasException(ExceptionCode.ATTRIBUTE_UNKNOWN, criterion.getClass().getName());
      }
    } else {
      return new LinkedHashMap<VectorLayer, Filter>();
    }
  }
View Full Code Here


      throws GeomajasException {
    Map<VectorLayer, Filter> filters = new LinkedHashMap<VectorLayer, Filter>();
    Filter f;
    VectorLayer l = configurationService.getVectorLayer(criterion.getServerLayerId());
    if (l == null) {
      throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, criterion.getServerLayerId());
    }

    String operator = criterion.getOperator();
    if ("LIKE".equals(operator.toUpperCase())) {
      f = filterService.createLikeFilter(criterion.getAttributeName(), criterion.getValue());
View Full Code Here

  }

  private Map<VectorLayer, Filter> dtoGeometryCriterionToFilters(GeometryCriterion criterion, Crs mapCrs)
      throws GeomajasException {
    if (mapCrs == null) {
      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapCrs");
    }

    Map<VectorLayer, Filter> filters = new LinkedHashMap<VectorLayer, Filter>();
    Filter f;
    Geometry mapGeom = converter.toInternal(criterion.getGeometry());

    for (String serverLayerId : criterion.getServerLayerIds()) {
      VectorLayer vl = configurationService.getVectorLayer(serverLayerId);
      if (vl == null) {
        throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, serverLayerId);
      }

      // Transform geometry to layer CRS:
      Geometry layerGeometry = geoService.transform(mapGeom, mapCrs, vectorLayerService.getCrs(vl));

      switch (criterion.getOperator()) {
        case SearchByLocationRequest.QUERY_INTERSECTS:
          f = filterService.createIntersectsFilter(layerGeometry, vl.getFeatureModel()
              .getGeometryAttributeName());
          break;
        case SearchByLocationRequest.QUERY_CONTAINS:
          f = filterService.createContainsFilter(layerGeometry, vl.getFeatureModel()
              .getGeometryAttributeName());
          break;

        case SearchByLocationRequest.QUERY_TOUCHES:
          f = filterService.createTouchesFilter(layerGeometry, vl.getFeatureModel()
              .getGeometryAttributeName());
          break;

        case SearchByLocationRequest.QUERY_WITHIN:
          f = filterService
              .createWithinFilter(layerGeometry, vl.getFeatureModel().getGeometryAttributeName());
          break;

        default:
          throw new GeomajasException(ExceptionCode.ATTRIBUTE_UNKNOWN, "QueryType");
      }

      filters.put(vl, f);
    }
    return filters;
View Full Code Here

  /** {@inheritDoc} */
  public void execute(GetLocationForStringRequest request, GetLocationForStringResponse response) throws Exception {
    String location = request.getLocation();
    if (null == location) {
      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "location");
    }
    String crsString = request.getCrs();
    if (null == crsString) {
      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
    }
    Locale locale = null;
    if (null != request.getLocale()) {
      locale = new Locale(request.getLocale());
    }
View Full Code Here

          break;
        }
        halfCrsWidth = halfCrsWidth / deltaX * width / 2;
        halfCrsHeight = halfCrsHeight / deltaY * height / 2;
      } catch (TransformException te) {
        throw new GeomajasException(te, ExceptionCode.GEOMETRY_TRANSFORMATION_FAILED, crs);
      }
    }
    return new Envelope(x - halfCrsWidth, x + halfCrsWidth, y - halfCrsHeight, y + halfCrsHeight);
  }
View Full Code Here

      JBossObjectOutputStream jbossSerializer = new JBossObjectOutputStream(null);
      Object obj = jbossSerializer.smartClone(input);
      return (VectorLayerRasterizingInfo) obj;
    } catch (IOException e) {
      // should not happen
      throw new GeomajasException(e, ExceptionCode.UNEXPECTED_PROBLEM);
    }
  }
View Full Code Here

  }

  @PostConstruct
  protected void postConstruct() throws GeomajasException {
    if (null == baseWmsUrl) {
      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "baseWmsUrl");
    }

    crs = geoService.getCrs2(getLayerInfo().getCrs());

    // calculate resolutions
View Full Code Here

        // Translate the map coordinates to layer coordinates, assumes equal x-y orientation
        layerBounds = geoService.transform(bounds, mapToLayer);
        layerScale = bounds.getWidth() * scale / layerBounds.getWidth();
      }
    } catch (MismatchedDimensionException e) {
      throw new GeomajasException(e, ExceptionCode.RENDER_DIMENSION_MISMATCH);
    }
    layerBounds = clipBounds(layerBounds);
    if (layerBounds.isNull()) {
      return new ArrayList<RasterTile>(0);
    }
View Full Code Here

      // fall back to CQL for backwards compatibility
      log.warn("Filter not parsable by ECQL, falling back to CQL", e);
      try {
        return CQL.toFilter(filter, FF);
      } catch (CQLException ce) {
        throw new GeomajasException(ce, ExceptionCode.FILTER_PARSE_PROBLEM, filter);
      }
    }
  }
View Full Code Here

      if (null != version) {
        String otherVersion = versions.get(name);
        if (null != otherVersion) {
          if (!version.startsWith(EXPR_START)) {
            if (!otherVersion.startsWith(EXPR_START) && !otherVersion.equals(version)) {
              throw new GeomajasException(ExceptionCode.DEPENDENCY_CHECK_INVALID_DUPLICATE,
                  name, version, versions.get(name));
            }
            versions.put(name, version);
          }
        } else {
          versions.put(name, version);
        }
      }
    }

    // Check dependencies
    StringBuilder message = new StringBuilder();
    String backendVersion = versions.get("Geomajas");
    for (PluginInfo plugin : declaredPlugins.values()) {
      String name = plugin.getVersion().getName();
      message.append(checkVersion(name, "Geomajas back-end", plugin.getBackendVersion(), backendVersion));
      List<PluginVersionInfo> dependencies = plugin.getDependencies();
      if (null != dependencies) {
        for (PluginVersionInfo dependency : plugin.getDependencies()) {
          String depName = dependency.getName();
          message.append(checkVersion(name, depName, dependency.getVersion(), versions.get(depName)));
        }
      }
      dependencies = plugin.getOptionalDependencies();
      if (null != dependencies) {
        for (PluginVersionInfo dependency : dependencies) {
          String depName = dependency.getName();
          String availableVersion = versions.get(depName);
          if (null != availableVersion) {
            message.append(checkVersion(name, depName, dependency.getVersion(), versions.get(depName)));
          }
        }
      }
    }
    if (message.length() > 0) {
      throw new GeomajasException(ExceptionCode.DEPENDENCY_CHECK_FAILED, message.toString());
    }

    recorder.record(GROUP, VALUE);
  }
View Full Code Here

TOP

Related Classes of org.geomajas.global.GeomajasException

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.