Larry,

If I understand this correctly, you did this with a beanshell script?
(http://www.beanshell.org/)

The Sunburned Surveyor

On 8/28/07, Larry Becker <[EMAIL PROTECTED]> wrote:
> I have created a BeanTool script to demonstrate the power of JUMP
> Styles.  The script loads a Push Pin GIF file from a web URL and
> applies a new Style to the first selected editable layer that shows a
> Push Pin at each point in the geometry.  See the attached JPEGs for
> examples.
>
> The script is:
>
> {
> filenameOrURL = new
> URL("http://www.techsoup.org/fb/fxforums/images/pushpin.gif";);
> //filenameOrURL = "c:/junk/Arrow.jpg";
> image = Toolkit.getDefaultToolkit().getImage(filenameOrURL);
> import java.awt.geom.Point2D;
> import com.vividsolutions.jts.geom.*;
> import com.vividsolutions.jump.feature.*;
> import com.vividsolutions.jump.geom.EnvelopeUtil;
> import com.vividsolutions.jump.workbench.model.*;
> import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
> import com.vividsolutions.jump.workbench.ui.Viewport;
> mediaTracker = new MediaTracker(wc.layerViewPanel);
> mediaTracker.addImage(image, 0);
> mediaTracker.waitForID(0);
> layer = wc.getLayerNamePanel().chooseEditableLayer();
> if (layer != null) {
>       wc.getLayerNamePanel().chooseEditableLayer().addStyle(new Style() {
>           public void paint(Feature f, Graphics2D g, Viewport viewport) {
>         int w = image.getWidth(wc.getLayerViewPanel());
>         int h = image.getHeight(wc.getLayerViewPanel());
>             Coordinate[] coordinates = f.getGeometry().getCoordinates();
>             for (int i = 0; i < coordinates.length; i++) {
>                     if 
> (!viewport.getEnvelopeInModelCoordinates().contains(coordinates[i]))
>                         continue;
>                 p = viewport.toViewPoint(coordinates[i]);
>                 g.drawImage(image, (int) p.getX() - w  + 2, (int) p.getY() - 
> h +
> 2, null);
>             }
>           }
>           public void initialize(Layer layer) {}
>           public Object clone() { throw new UnsupportedOperationException(); }
>           public void setEnabled(boolean enabled) {}
>           public boolean isEnabled() { return true; }
>         });
>         layer.getBasicStyle().renderingFill = false;
>         layer.getBasicStyle().renderingLine = false;
> }
> else {
>         wc.getWorkbench().getFrame().warnUser("Layer not editable");
> }
> }
>
>
> Don't think that this is production quality code.  I wrote it to
> demonstrate the concept which I hope will show how simple it is to
> extend OpenJump.
>
> regards,
> Larry Becker
> --
> http://amusingprogrammer.blogspot.com/
>
> _______________________________________________
> jump-users mailing list
> [email protected]
> http://lists.refractions.net/mailman/listinfo/jump-users
>
>
>
_______________________________________________
jump-users mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jump-users

Reply via email to