Package org.geotools.styling

Examples of org.geotools.styling.Mark


                break;

            case POINT:
                fill = sf.createFill(ff.literal(fillColor), ff.literal(OPACITY));

                Mark mark = sf.getCircleMark();
                mark.setFill(fill);
                mark.setStroke(stroke);

                Graphic graphic = sf.createDefaultGraphic();
                graphic.graphicalSymbols().clear();
                graphic.graphicalSymbols().add(mark);
                graphic.setSize(ff.literal(POINT_SIZE));
View Full Code Here


     * and cyan fill
     */
    private Style createPointStyle() {
        Graphic gr = styleFactory.createDefaultGraphic();

        Mark mark = styleFactory.getCircleMark();

        mark.setStroke(styleFactory.createStroke(
                filterFactory.literal(Color.BLUE), filterFactory.literal(1)));

        mark.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN)));

        gr.graphicalSymbols().clear();
        gr.graphicalSymbols().add(mark);
        gr.setSize(filterFactory.literal(5));

View Full Code Here

    /**
     * Test of createPointStyle method, of class org.geotools.renderer.style.SLDStyleFactory.
     */
    public void testCreateCompletePointStyle() {
        PointSymbolizer symb;
        Mark myMark;
        //full symbolizer
        symb = sf.createPointSymbolizer();
        myMark = sf.createMark();
       
        myMark.setFill(sf.createFill(ff.literal("#ffff00")));
        symb.getGraphic().setSize(ff.literal(10));
        symb.getGraphic().addMark(myMark);
        symb.getGraphic().setOpacity(ff.literal(1));
        symb.getGraphic().setRotation(ff.literal(0));
        sld.createPointStyle(null, symb,range);
View Full Code Here

       
    }
   
    public void testCreateIncompletePointStyle() {
        PointSymbolizer symb;
        Mark myMark;
        //full symbolizer
        symb = sf.createPointSymbolizer();
        myMark = sf.createMark();
       
        symb.getGraphic().addMark(myMark);
View Full Code Here

        sld.createPointStyle(null, symb,range);
    }
   
    public void testCreateDynamicMark() throws Exception {
        PointSymbolizer symb = sf.createPointSymbolizer();
        Mark myMark = sf.createMark();
        final String ttfUrl = "ttf://Serif#${symb}";
        myMark.setWellKnownName(ff.literal(ttfUrl));
        symb.getGraphic().addMark(myMark);
       
        MarkStyle2D ms = (MarkStyle2D) sld.createStyle(feature, symb, range);
        assertNotNull(ms.getShape());
        // make sure the style has been recognized as dynamic
View Full Code Here

        assertEquals(20, paint.getImage().getWidth());
    }
   
    public void testDefaultSizeMark() throws Exception {
        PointSymbolizer symb = sf.createPointSymbolizer();
        Mark myMark = sf.createMark();
        myMark.setWellKnownName(ff.literal("square"));
        symb.getGraphic().addMark(myMark);
       
        MarkStyle2D ms = (MarkStyle2D) sld.createPointStyle(feature, symb, range);
        assertEquals(16.0, ms.getSize());
    }
View Full Code Here

        assertNotNull( s2.getStroke() );
    }
   
    public void testTexturePaintNoSize() throws Exception {
        PolygonSymbolizer symb = sf.createPolygonSymbolizer();
        Mark myMark = sf.createMark();
        myMark.setWellKnownName(ff.literal("square"));
        org.geotools.styling.Fill fill = sf.createFill(null);
        fill.setGraphicFill(sf.createGraphic(null, new Mark[] {myMark}, null, null, null, null));
        symb.setFill(fill);
       
        PolygonStyle2D ps = (PolygonStyle2D) sld.createPolygonStyle(feature, symb, range);
View Full Code Here

   
    public void testMarkSizeCalculation() throws Exception {
        assertFalse(MarkStyle2D.isMaxMarkSizeEnabled());
       
         PointSymbolizer symb = sf.createPointSymbolizer();
         Mark myMark = sf.createMark();
         myMark.setWellKnownName(ff.literal("square"));
         symb.getGraphic().graphicalSymbols().add(myMark);
         MarkStyle2D ms = (MarkStyle2D) sld.createPointStyle(feature, symb, range);
         assertFalse(MarkStyle2D.isMaxMarkSizeEnabled());
       
         MarkStyle2D.setMaxMarkSizeEnabled(true);
View Full Code Here

                            }
                            return;
                        }
                    }
                } else if(gs instanceof Mark) {
                    Mark mark = (Mark) gs;
                    int markSize;
                    if(isSizeConstant) {
                        markSize = imageSize;
                    } else {
                        markSize = SLDStyleFactory.DEFAULT_MARK_SIZE;
                    }
                    if(mark.getStroke() != null) {
                        int strokeWidth = getPositiveValue(mark.getStroke().getWidth());
                        if(strokeWidth < 0) {
                            estimateAccurate = false;
                        } else {
                            markSize += strokeWidth;
                        }
View Full Code Here

    BufferedImage img = null;
    double dsize;
    AffineTransform scaleTx;
    AffineTransformOp ato;
    BufferedImage scaledImage;
    Mark mark;
    Shape shape;
    MarkStyle2D ms2d;
    for (GraphicalSymbol symbol : symbols) {
      if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("trying to render symbol " + symbol);
      }
      // try loading external graphic and creating a GraphicsStyle2D
      if (symbol instanceof ExternalGraphic) {
        if (LOGGER.isLoggable(Level.FINER)) {
          LOGGER.finer("rendering External graphic");
        }
        eg = (ExternalGraphic) symbol;

        // if the icon size becomes too big we switch to vector
        // rendering too, since
        // pre-rasterizing and caching the result will use too much
        // memory
        if (vectorRenderingEnabled || forceVector || size > MAX_RASTERIZATION_SIZE) {
          Icon icon = getIcon(eg, feature, -1);
          if (icon == null) {
            // no icon -> no image either, there is no raster
            // fallback
            continue;
          } else if(icon instanceof ImageIcon) {
              // when the icon is an image better use the graphic style, we have
              // better rendering code for it
              GraphicStyle2D g2d = getGraphicStyle(eg, (Feature) feature, size, 1);
                      if (g2d == null) {
                          continue;
                      } else {
                          g2d.setRotation(rotation);
                          g2d.setOpacity(opacity);
                          retval = g2d;
                          break;
                      }
          } else {
            if (icon.getIconHeight() != size && size != 0) {
              double scale = ((double) size)
                  / icon.getIconHeight();
              icon = new RescaledIcon(icon, scale);
            }
            retval = new IconStyle2D(icon, feature, displacementX,
                displacementY, rotation, composite);
            break;
          }
        } else {
          GraphicStyle2D g2d = getGraphicStyle(eg, (Feature) feature, size, 1);
          if (g2d != null) {
            g2d.setRotation(rotation);
            g2d.setOpacity(opacity);
            retval = g2d;
            break;
          }
        }
      }
      if (symbol instanceof Mark) {
        if (LOGGER.isLoggable(Level.FINER)) {
          LOGGER.finer("rendering mark @ PointRenderer "
              + symbol.toString());
        }
        retval = createMarkStyle((Mark) symbol, feature, symbolizer, size, rotation);
        break;
      }
    }

    if (retval != null) {
      setScaleRange(retval, scaleRange);
    } else {
            // from SLD spec:
            // The default if neither an ExternalGraphic nor a Mark is specified is to use the default
            // mark of a "square" with a 50%-gray fill and a black outline, with a size of 6 pixels,
            // unless an explicit Size is specified
            StyleFactory sf = CommonFactoryFinder.getStyleFactory();
            Mark defaultMark = sf.mark(ff.literal("square"),
                    sf.fill(null, ff.literal("#808080"), null),
                    sf.createStroke(ff.literal("#000000"), ff.literal(1))
            );
            if (size <= 0) {
                size = 6;
View Full Code Here

TOP

Related Classes of org.geotools.styling.Mark

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.