Package org.geomajas.configuration

Examples of org.geomajas.configuration.CircleInfo


    super(mapWidget, parent);
    factory = new GeometryFactory(mapWidget.getMapModel().getSrid(), mapWidget.getMapModel().getPrecision());
    geometry = factory.createPoint(new Coordinate());
    drawStyle = new ShapeStyle("#FF7F00", 0.3f, "#FF7F00", 1, 2);
    symbolStyle = new SymbolInfo();
    CircleInfo c = new CircleInfo();
    symbolStyle.setCircle(c);
    c.setR(8);
  }
View Full Code Here


    Stroke stroke = new BasicStroke(fsi.getStrokeWidth(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f,
        paniponidash, 0.0f);
    gr.setColor(toColor(fsi.getFillColor(), fsi.getFillOpacity()));

    if (null != fsi.getSymbol().getCircle()) {
      CircleInfo info = fsi.getSymbol().getCircle();
      w = Math.round(info.getR() * 2);
      h = w;
      if (w > max) {
        w = max;
        h = max;
        addSize = (int) info.getR();
      }
      int linewidth = fsi.getStrokeWidth();
      int halfLinewidth = linewidth / 2; // cut int value !!
      if (w + linewidth > max) {
        w = max - halfLinewidth * 2;
        x = halfLinewidth;
        addSize = (int) info.getR();
      } else {
        x = Math.round((0f + max - w) / 2f);
      }
      if (h + linewidth > max) {
        h = max - halfLinewidth * 2;
        y = halfLinewidth;
        addSize = (int) info.getR();
      } else {
        y = Math.round((0f + max - h) / 2f);
      }

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

    } else if (null != fsi.getSymbol().getRect()) {
      RectInfo info = fsi.getSymbol().getRect();
      w = Math.round(info.getW());
      h = Math.round(info.getH());
      int realSize = (w + h) / 2;
      if (w > max) {
        w = max;
        addSize = realSize;
      }
      if (h > max) {
        h = max;
        addSize = realSize;
      }
      int linewidth = fsi.getStrokeWidth();
      int halfLinewidth = linewidth / 2; // cut int value !!
      if (w + linewidth > max) {
        w = max - halfLinewidth * 2;
        x = halfLinewidth;
        addSize = realSize;
      } else {
        x = Math.round((0f + max - w) / 2f);
      }
      if (h + linewidth > max) {
        h = max - halfLinewidth * 2;
        y = halfLinewidth;
        addSize = realSize;
      } else {
        y = Math.round((0f + max - h) / 2f);
      }

      gr.fillRect(x, y, w, h);
      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

    worldGeometry.setStyle(new ShapeStyle("#FF0000", 0.5f, "#FF0000", 1.0f, 2));
    worldGeometry.setGeometry(mp);

    final GfxGeometry worldGeometry2 = new GfxGeometry("MultiPointInWorldSpace");
    SymbolInfo si = new SymbolInfo();
    CircleInfo ci = new CircleInfo();
    ci.setR(8.0f);
    si.setCircle(ci);
    Point pt1 = gf.createPoint(new Coordinate(6000000, -5000000));
    Point pt2 = gf.createPoint(new Coordinate(8000000, -5000000));
    Point pt3 = gf.createPoint(new Coordinate(7000000, -7000000));
    worldGeometry2.setStyle(new ShapeStyle("#0000FF", 0.3f, "#0000FF", 1.0f, 2));
View Full Code Here

  @Test
  public void testPointStyle() throws Exception {
    // default
    checkPoint("point_default.png", false, true);
    // save circle state
    CircleInfo tmp = getPointStyle().getSymbol().getCircle();
    getPointStyle().getSymbol().setCircle(null);
    // symbol rect
    getPointStyle().getSymbol().setRect(createRect());
    checkPoint("point_rect.png", false, true);
    getPointStyle().getSymbol().setRect(null);
View Full Code Here

          rect.setH(Float.parseFloat(getParameterValue(graphic.getSize())));
          rect.setW(Float.parseFloat(getParameterValue(graphic.getSize())));
          symbol.setRect(rect);
        } else {
          // should treat everything else as circle ?!
          CircleInfo circle = new CircleInfo();
          circle.setR(0.5F * Float.parseFloat(getParameterValue(graphic.getSize())));
          symbol.setCircle(circle);
        }
        convertFill(featureStyleInfo, mark.getFill());
        convertStroke(featureStyleInfo, mark.getStroke());
      }
View Full Code Here

TOP

Related Classes of org.geomajas.configuration.CircleInfo

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.