Examples of GraphicStyle2D


Examples of org.geotools.renderer.style.GraphicStyle2D

                // g.setStroke(ViewportGraphics.LINE_SOLID, width);
                // g.setColor(Color.DARK_GRAY);
                // g.draw(shape2);
                // }
            } else if (tmp instanceof GraphicStyle2D) {
                GraphicStyle2D style = (GraphicStyle2D) tmp;

                RenderedImage image = (RenderedImage) style.getImage();
                g.drawImage(image, (int) (point[0] - ((double) image.getWidth()) / (double) 2),
                        (int) (point[1] - ((double) image.getHeight()) / (double) 2));
            }
        }
    }
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

                    g2d.setStroke(new BasicStroke(width));
                    g2d.setColor(Color.DARK_GRAY);
                    g2d.draw(shape2);
                }
            } else if (tmp instanceof GraphicStyle2D) {
                GraphicStyle2D style = (GraphicStyle2D) tmp;

                float rotation = style.getRotation();

                g2d.setTransform(AffineTransform.getRotateInstance(rotation));

                BufferedImage image = style.getImage();
                g2d.drawImage(image, (int) (point[0] - ((double) image.getWidth()) / (double) 2),
                        (int) (point[1] - ((double) image.getHeight()) / (double) 2), null);
            }
        }
    }
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

                    g.setStroke(ViewportGraphics.LINE_SOLID, width);
                    g.setColor( Color.DARK_GRAY );
                    g.draw( shape2 );
                }
             }else if( tmp instanceof GraphicStyle2D){
                 GraphicStyle2D style=(GraphicStyle2D) tmp;
                
                 float rotation = style.getRotation();
                
                 g.setTransform(AffineTransform.getRotateInstance(rotation));
                
                 RenderedImage image = (RenderedImage)style.getImage();
                 try{
                     g.drawImage(image, (int)(point[0]-((double)image.getWidth())/(double)2), (int)(point[1]-((double)image.getHeight())/(double)2));
                 }catch (Exception e) {
                     g.drawImage(image, 0,0);
                }
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

                    g.setStroke(str);
                    g.setColor( Color.DARK_GRAY );
                    g.draw( shape2 );
                }
            }else if( tmp instanceof GraphicStyle2D){
                GraphicStyle2D style=(GraphicStyle2D) tmp;
                float rotation = style.getRotation(); // in radians
                g.setTransform(AffineTransform.getRotateInstance(rotation));
                BufferedImage image = (BufferedImage)style.getImage();
               
                g.drawImage(image, (int)(point[0]-((double)image.getWidth())/(double)2), (int)(point[1]-((double)image.getHeight())/(double)2),null);
            }
        }
    }
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

        } else if (style instanceof GraphicStyle2D) {
            float[] coords = new float[2];
            PathIterator iter = getPathIterator(shape);
            iter.currentSegment(coords);

            GraphicStyle2D gs2d = (GraphicStyle2D) style;

            while (!(iter.isDone())) {
                iter.currentSegment(coords);
                renderImage(graphics, coords[0], coords[1],
                        gs2d.getImage(), gs2d.getRotation(), gs2d
                                .getOpacity(), isLabelObstacle);
                iter.next();
            }
        } else {
            if (isLabelObstacle) {
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

            graphicRotation = ((MarkStyle2D) graphicStroke).getRotation();
        } else if(graphicStroke instanceof IconStyle2D) {
            imageSize = ((IconStyle2D) graphicStroke).getIcon().getIconWidth();
            graphicRotation = ((IconStyle2D) graphicStroke).getRotation();
        } else {
            GraphicStyle2D gs = (GraphicStyle2D) graphicStroke;
            imageSize = gs.getImage().getWidth() - gs.getBorder();
            graphicRotation = ((GraphicStyle2D) graphicStroke).getRotation();
        }

        double[] first = new double[2];
        double[] previous = new double[2];
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

                        height / icon.getIconHeight());
            }
            resized.setIcon(new TransformedIcon(icon, at));
            return resized;
        } else if(graphic instanceof GraphicStyle2D) {
            GraphicStyle2D gstyle = (GraphicStyle2D) graphic;
            GraphicStyle2D resized = (GraphicStyle2D) graphic.clone();
            BufferedImage image = gstyle.getImage();
           
            AffineTransform at;
            if(mode == GraphicResize.PROPORTIONAL) {
                double factor;
                if(width > height) {
                    factor = width / image.getWidth();
                } else {
                    factor = height / image.getHeight();
                }
                at = AffineTransform.getScaleInstance(factor, factor);
            } else {
                at = AffineTransform.getScaleInstance(width / image.getWidth(),
                        height / image.getHeight());
            }
           
            AffineTransformOp ato = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
            image = ato.filter(image, null);
            resized.setImage(image);
            return resized;
        } else {
            return graphic;
        }
    }
View Full Code Here

Examples of org.geotools.renderer.style.GraphicStyle2D

            Style2D style = ssf.createStyle(null, symbolizer, INFINITE_RANGE);
            if(style instanceof IconStyle2D) {
                IconStyle2D is = (IconStyle2D) style;
                size = ff.literal(is.getIcon().getIconHeight());
            } else if(style instanceof GraphicStyle2D) {
                GraphicStyle2D gs = (GraphicStyle2D) style;
                size = ff.literal(gs.getImage().getHeight());
            } else if(style instanceof MarkStyle2D) {
                MarkStyle2D ms = (MarkStyle2D) style;
                size = ff.literal(ms.getSize());
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.