<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ojwiki.soldin.de/index.php?action=history&amp;feed=atom&amp;title=Beanshell%3ALoading_an_Image_into_the_task</id>
	<title>Beanshell:Loading an Image into the task - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ojwiki.soldin.de/index.php?action=history&amp;feed=atom&amp;title=Beanshell%3ALoading_an_Image_into_the_task"/>
	<link rel="alternate" type="text/html" href="https://ojwiki.soldin.de/index.php?title=Beanshell:Loading_an_Image_into_the_task&amp;action=history"/>
	<updated>2026-04-22T03:12:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://ojwiki.soldin.de/index.php?title=Beanshell:Loading_an_Image_into_the_task&amp;diff=199&amp;oldid=prev</id>
		<title>Mentaer: Created page with &#039;This script will load in image into the current task. Change minx, maxx, miny, maxy and filenameOrURL as desired.    {  minx = 100; maxx = 376; miny = 100; maxy = 210; //Image co…&#039;</title>
		<link rel="alternate" type="text/html" href="https://ojwiki.soldin.de/index.php?title=Beanshell:Loading_an_Image_into_the_task&amp;diff=199&amp;oldid=prev"/>
		<updated>2009-10-11T23:51:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;This script will load in image into the current task. Change minx, maxx, miny, maxy and filenameOrURL as desired.    {  minx = 100; maxx = 376; miny = 100; maxy = 210; //Image co…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This script will load in image into the current task. Change minx, maxx, miny, maxy and filenameOrURL as desired.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 minx = 100; maxx = 376; miny = 100; maxy = 210; //Image coordinates&lt;br /&gt;
 filenameOrURL = new URL(&amp;quot;http://www.google.ca/intl/en_ca/images/logo.gif&amp;quot;);&lt;br /&gt;
 //filenameOrURL = &amp;quot;c:/junk/Arrow.jpg&amp;quot;;&lt;br /&gt;
 layerName = &amp;quot;Image&amp;quot;;&lt;br /&gt;
 image = Toolkit.getDefaultToolkit().getImage(filenameOrURL);&lt;br /&gt;
 import com.vividsolutions.jts.geom.*;&lt;br /&gt;
 import com.vividsolutions.jump.feature.*;&lt;br /&gt;
 import com.vividsolutions.jump.geom.EnvelopeUtil;&lt;br /&gt;
 import com.vividsolutions.jump.workbench.model.*;&lt;br /&gt;
 import com.vividsolutions.jump.workbench.ui.renderer.style.Style;&lt;br /&gt;
 import com.vividsolutions.jump.workbench.ui.Viewport;&lt;br /&gt;
 mediaTracker = new MediaTracker(wc.layerViewPanel);&lt;br /&gt;
 mediaTracker.addImage(image, 0);&lt;br /&gt;
 mediaTracker.waitForID(0);&lt;br /&gt;
 wc.layerManager.addLayer(StandardCategoryNames.WORKING, layerName, &lt;br /&gt;
       FeatureDatasetFactory.createFromGeometry(&lt;br /&gt;
       Collections.singleton(EnvelopeUtil.toGeometry(&lt;br /&gt;
       new Envelope(minx, maxx, miny, maxy))))).addStyle(new Style() {&lt;br /&gt;
   public void paint(Feature f, Graphics2D g, Viewport viewport) {    &lt;br /&gt;
     originalTransform = g.getTransform();&lt;br /&gt;
     try {    &lt;br /&gt;
       envelope = f.geometry.envelope;&lt;br /&gt;
       xScale = viewport.scale*envelope.width/image.getWidth(null);&lt;br /&gt;
       yScale = viewport.scale*envelope.height/image.getHeight(null);&lt;br /&gt;
       g.scale(xScale, yScale);&lt;br /&gt;
       upperLeftCorner = viewport.toViewPoint(new&lt;br /&gt;
  Coordinate(envelope.minx, envelope.maxy));&lt;br /&gt;
       g.translate(upperLeftCorner.x/xScale, upperLeftCorner.y/yScale);&lt;br /&gt;
       g.drawImage(image, 0, 0, null);    &lt;br /&gt;
     } &lt;br /&gt;
     finally {&lt;br /&gt;
         g.setTransform(originalTransform);  &lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   public void initialize(Layer layer) {}&lt;br /&gt;
   public Object clone() { throw new UnsupportedOperationException(); }&lt;br /&gt;
   public void setEnabled(boolean enabled) {}&lt;br /&gt;
   public boolean isEnabled() { return true; }&lt;br /&gt;
 });&lt;br /&gt;
 wc.layerManager.getLayer(layerName).getBasicStyle().renderingFill = false;&lt;br /&gt;
 wc.layerManager.getLayer(layerName).getBasicStyle().renderingLine = false;&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mentaer</name></author>
	</entry>
</feed>