Hi Jukka,

  Here is a script that leverages the JTS distance function:

{
import com.vividsolutions.jts.geom.*;
import com.vividsolutions.jump.feature.*;
import com.vividsolutions.jump.workbench.model.*;

fc =
wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrapper();
Iterator i = fc.getFeatures().iterator();
if (i.hasNext()) {
    feature = (Feature) i.next();
    geoOne = feature.getGeometry();
    feature = (Feature) i.next();
    geoTwo= feature.getGeometry();
    htmlFrame = wc.workbench.frame.outputFrame;
    htmlFrame.createNewDocument();
    htmlFrame.addText("Distance = "+geoOne.distance(geoTwo));
    wc.workbench.frame.flash(htmlFrame);
    htmlFrame.surface();
}
}

regards,
Larry

On Sun, Dec 13, 2009 at 8:00 AM, Rahkonen Jukka
<jukka.rahko...@mmmtike.fi>wrote:

> Hi,
>
> I agree totally with Larry. OpenJump is already a very productive editing
> tool. Connecting routines which are used hundreds of times per day to menu
> shortcut or toolbar button does not only speed up the work but it also cuts
> down the number of errors, and perhaps most important, it makes the work
> much less irritating. And it seems to be that a very useful features can be
> added by writing a lines of scripting code. I think that we should have a
> script library somewhere in OpenJump wiki. As an example I must create some
> screen captures about how to use a fine script made by Larry for assisting
> in generating Web Coverage Service requests. I also notised a Jython script
> for measuring distance between two selected features from GvSIG mailing
> list.  Perhaps it could be modified to work with OpenJump as well because
> the real work is done by JTS.  Link to this sript is here:
>
> http://n2.nabble.com/Distance-using-Jython-td4139275.html#a4139275
>
> What I am missing most in OpenJump is the ability to write edited data back
> to the database.
>
> -Jukka Rahkonen-
>
>
> Larry Becker wrote:
>
>
> > Thanks for the feedback Michaël and Stefan.  In case anyone out there is
> > wondering what is the use of a toolbox that can only reuse existing menu
> > features, it is all about optimizing work flow.  I believe we have an
> > opportunity to position OpenJump as being the best tool for data creation
> > and editing.  The EZ Buttons function furthers that aim by allowing users
> to
> > optimize repetitive tasks.  EZ Buttons can be used in conjunction with
> > BeanTools scripting for the creation of custom tools.  However, I do
> intend
> > to eventually revisit Jukka's idea of a quick-and-easy custom data entry
> > tool for ad hoc field digitizing.
>
> > regards,
> > Larry
>
>
>
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



-- 
Larry Becker
Integrated Systems Analysts, Inc.
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to