Package org.geomajas.configuration

Examples of org.geomajas.configuration.ImageInfo


      gr.setColor(toColor(fsi.getStrokeColor(), fsi.getStrokeOpacity()));
      gr.setStroke(stroke);
      gr.drawRect(x, y, w, h);

    } else if (null != fsi.getSymbol().getImage()) {
      ImageInfo info = fsi.getSymbol().getImage();
      try {
        BufferedImage img = getImage(info.getHref());
        if (null == img) {
          throw new AdvancedviewsException(AdvancedviewsException.FAILED_CREATING_IMAGEICON, info.getHref());
        }

        AffineTransform trans;
        if (img.getHeight() > iconSize || img.getWidth() > iconSize) {
          double sx = 1d / img.getWidth() * iconSize;
          double sy = 1d / img.getHeight() * iconSize;
          double smallest = (sx < sy ? sx : sy);
          trans = AffineTransform.getScaleInstance(smallest, smallest);
          double width = smallest * img.getWidth();
          double height = smallest * img.getHeight();
          double tx = (width < iconSize ? (0d + iconSize - width) / 2 : 0d);
          double ty = (height < iconSize ? (0d + iconSize - height) / 2 : 0d);
          trans.concatenate(AffineTransform.getTranslateInstance(tx, ty));
        } else {
          double tx = (img.getWidth() < iconSize ? (0d + iconSize - img.getWidth()) / 2 : 0d);
          double ty = (img.getHeight() < iconSize ? (0d + iconSize - img.getHeight()) / 2 : 0d);
          trans = AffineTransform.getTranslateInstance(tx, ty);
        }
        gr.transform(trans);
        gr.drawImage(img, null, 0, 0);
      } catch (IOException e) {
        log.warn("Failed creating Legend Icon from image: " + e.getMessage());
        throw new AdvancedviewsException(AdvancedviewsException.FAILED_CREATING_IMAGEICON, info.getHref());
      }
    } else {
      throw new AdvancedviewsException(AdvancedviewsException.REQUIRED_PARAMETER_MISSING, "Symbol StyleInfo");
    }

View Full Code Here


    mapInfo.getLayers().add(clientVectorLayerInfo);
    new MapAssert(mapInfo).assertEqualImage(fileName, writeImages, DELTA);
  }

  private ImageInfo createImage(int height) {
    ImageInfo info = new ImageInfo();
    info.setHeight(height);
    // width is not important
    info.setWidth(height);
    info.setHref("org/geomajas/plugin/rasterizing/images/imageservice/vectortile/point.png");
    return info;
  }
View Full Code Here

    if (graphic.getChoiceList().size() > 0) {
      ChoiceInfo choice = graphic.getChoiceList().get(0);
      if (choice.ifExternalGraphic()) {
        ExternalGraphicInfo externalGraphic = choice.getExternalGraphic();
        String href = externalGraphic.getOnlineResource().getHref().getHref();
        ImageInfo image = new ImageInfo();
        image.setHref(href);
        // SLD has no selection concept + no default: what to do ?
        image.setSelectionHref(href);
        image.setHeight((int) Float.parseFloat(getParameterValue(graphic.getSize())));
        symbol.setImage(image);
      } else if (choice.ifMark()) {
        MarkInfo mark = choice.getMark();
        String name = mark.getWellKnownName().getWellKnownName();
        if (name.equalsIgnoreCase("square")) {
View Full Code Here

      }
      symbolDefs.put(id, new SymbolDefinition(symbol, style));
      if (symbol.getImage() != null) {
        // When it's an image symbol, add an extra definition for it's selection:
        SymbolInfo selected = new SymbolInfo();
        ImageInfo selectedImage = new ImageInfo();
        selectedImage.setHref(symbol.getImage().getSelectionHref());
        selectedImage.setWidth(symbol.getImage().getWidth());
        selectedImage.setHeight(symbol.getImage().getHeight());
        selected.setImage(selectedImage);
        symbolDefs.put(id + "-selection", new SymbolDefinition(selected, null));
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.configuration.ImageInfo

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.