Hi larry,thanks for the  model. I am going to write a couple of batch sample to 
use with gdal ad give a feedback
Peppe

--- Lun 14/12/09, Larry Becker <becker.la...@gmail.com> ha scritto:

Da: Larry Becker <becker.la...@gmail.com>
Oggetto: Re: [JPP-Devel] EZ Buttons, Beanshell console and gdal
A: "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net>
Data: Lunedì 14 dicembre 2009, 21:12

I have committed a CmdRunner support class.  Here is an example script for the 
nightly build that demonstrates it:

{
 import org.openjump.core.ui.plugin.customize.CmdRunner;
char delimiter = '\t'; //delimiter character must not occur in command line

String commandLine = "C:\\dup.bat" + delimiter + "C:\\Dist.txt";
//commandLine += delimiter + "-v" + delimiter + "-a";  //optional parameters
CmdRunner cmdRunner = new CmdRunner();

cmdRunner.run(commandLine, delmiter);
}

In the example above, "C:\\dup.bat" is a dos batch file that makes a backup of 
a file using: copy %1 %1.bak

 "C:\\Dist.txt" is a file parameter being passed to the command.  Additional 
parameters are also possible as shown in the commented out line beginning with 
//.  The result of running dup.bat is that Dist.txt is copied to Dist.txt.bak.


For windows systems, path backslashes "\" should always be doubled as shown.  
In the script, CmdRunner.isWindows() returns true on a windows system.

regards,
Larry




On Mon, Dec 14, 2009 at 10:06 AM, Larry Becker <becker.la...@gmail.com> wrote:

Hi Peppe,

  That is an interesting idea.  I would require some new support classes, but 
nothing that we haven't done already in iGOR.

regards,
Larry


On Mon, Dec 14, 2009 at 9:47 AM, Giuseppe Aruta <giuseppe_ar...@yahoo.it> wrote:



Hi all,
I want to create some customized batch files which I can run directly from OJ 
using beanshell script. My idea is to manage some gdal libraries to work on 
rasters (translate, reproject, contour etc) via batch files (through beanshell 
console) and see how it would be useful with sextante and EZ button on specific 
works.


I have no idea how to create a beanshell script to launch a batch, something 
like .... c\OJ\gdal\test,bat.... or user/oj/gdal/test.sh  or better with 
relative path like ..\ ..\gdal\test.bat etc etc
Of coarse I will test both in windows and Linux. Does somebody can help me with 
a script sample?
 
 
- on the other hand EZ buttons itself could be launch some external batch or 
exe file? without passing throught beanshell editor?
 
thanks
 
 
Peppe
 
@Larry
I think EZ buttons is valid idea, 
 
 Lun 14/12/09, Larry Becker <becker.la...@gmail.com> ha scritto:


Da: Larry Becker <becker.la...@gmail.com>
Oggetto: Re: [JPP-Devel] EZ Buttons


A: "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net>
Data: Lunedì 14 dicembre 2009, 15:46


Sorry, it should have been:

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

features= 
wc.getLayerViewPanel().getSelectionManager().getFeaturesWithSelectedItems();


Iterator i = features.iterator(); 
if (features.size() == 2){
    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();
}
}

The former script got the distance between the first two features on the
 selected layer.  This one uses the two selected items.

Larry


On Mon, Dec 14, 2009 at 8:33 AM, Larry Becker <becker.la...@gmail.com> wrote:



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.



-- 
Larry Becker
Integrated Systems Analysts, Inc.

-----Segue allegato-----




------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev



-----Segue allegato-----


_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel





      
------------------------------------------------------------------------------

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.




-- 
Larry Becker
Integrated Systems Analysts, Inc.


-----Segue allegato-----

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

-----Segue allegato-----

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



      
------------------------------------------------------------------------------
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