Re: [JPP-Devel] EZ Buttons

2009-12-14 Thread Larry Becker
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.fiwrote:

 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


Re: [JPP-Devel] EZ Buttons

2009-12-14 Thread Larry Becker
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.comwrote:

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


[JPP-Devel] JTS mailing list - new location

2009-12-14 Thread Martin Davis
For anyone interested, the JTS mailing list is now here:

https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Please spread the word!

Martin

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


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


Re: [JPP-Devel] JTS mailing list - new location

2009-12-14 Thread Stefan Steiniger
Hei Martin,

thanks for the update.
I just recognized that I got my last jts email (digest mode) on November 
6th... so there was no general email going out to list members? In case 
that is true, can you send a message to all old members?

stefan

Martin Davis wrote:
 For anyone interested, the JTS mailing list is now here:
 
 https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
 
 Please spread the word!
 
 Martin
 

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


Re: [JPP-Devel] JTS mailing list - new location

2009-12-14 Thread Martin Davis
Stefan,

Yes, the list went down unexpectedly, so I couldn't send out an email 
announcing it!

I have the list of subscribers, so I'm going to try and send one out soon.

Martin

Stefan Steiniger wrote:
 Hei Martin,

 thanks for the update.
 I just recognized that I got my last jts email (digest mode) on November 
 6th... so there was no general email going out to list members? In case 
 that is true, can you send a message to all old members?

 stefan

 Martin Davis wrote:
   
 For anyone interested, the JTS mailing list is now here:

 https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

 Please spread the word!

 Martin

 

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

   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


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


Re: [JPP-Devel] EZ Buttons, Beanshell console and gdal

2009-12-14 Thread Larry Becker
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.comwrote:

 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.itwrote:

 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.comhttp://it.mc237.mail.yahoo.com/mc/compose?to=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.fihttp://it.mc237.mail.yahoo.com/mc/compose?to=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 

Re: [JPP-Devel] 3D develop in OJ

2009-12-14 Thread Martin Davis
To give a slightly different perspective on this:

I deliberately avoided doing much (any!) interpolation of Z values in 
JTS, because it seems to heavily dependent on exactly what the user's Z 
model is (eg is he working with data which is referenced to a DEM).  
Obviously linear interpolation could be used in some cases, but there 
may be many created points along a segment which might need 
interpolating, and those points might be a long distance from a 
reference point (in which case is the interpolation even useful?)  
Michael lists some other tricky issues as well.

I have thought a bit about this though, and I think that interpolation 
could be done post facto (eg after JTS processing), by matching vertices 
of the output geometry to the input geometry. Where there is a match, 
simply copy the Z value.  After this has been done, scan the unassigned 
Z values and try and interpolate them from adjacent vertices.

Essentially this uses the input geometries to define a simple surface 
model, which then provides the Z value for other points.

Martin

Michaël Michaud wrote:
 Larry Becker a écrit :
   
 I have added z interpolation to the Add Vertex tool for most 
 normal cases.  There are some boundary cases that still won't work 
 without further mods.  I have made those modifications to CoordUtil, 
 but won't commit them until the other developers approve since they 
 are called by many classes.  It is attached.
 
 Hi Larry an Luca,

 Thanks to Larry for this addition.

 I think that in the second method average(Collection coordinates), the test
 if (Double.isNaN(coordinate.z))
 should be
 if (!Double.isNaN(coordinate.z))

 About the general request from Luca, I think there are many places where 
 z can be handled in a better way, but one problem is that JTS algo don't 
 interpolate z and what can be done for the Add Vertex Tool may be hard 
 to generalize to other plugins :
 Examples :
 Intersection between linestring in a layer : I think z should be 
 interpolated, but the plugin heavily use JTS so that interpolation may 
 not be easy
 Union : added vertex may have two different interpolated z coming from 
 two different geometries : what to do in this case ? choose one 
 solution, a mean value or NaN ?

 Snap  new vertex to a feature with z : what to do if several points with 
 different z are located where one want to snap ?

 My 2 cents

 Michaël
  
   
 regards,
 Larry

 On Fri, Dec 11, 2009 at 9:05 AM, Larry Becker becker.la...@gmail.com 
 mailto:becker.la...@gmail.com wrote:

 Hi Luca,

 Thanks for your ideas to improve OJ.


 A great fix of this behavior could be:
 when you add a new vertex  the Z will become the linear
 interpolation
 of the previous and next vertex of polygon or line:


 It sounds simple enough to modify the Add Vertex tool to do this.

 and when you move this vertex it takes the Z of the
 destination vertex ...


 I'm not quite sure about this one.  Can you give an example?


 By the way: is normal that if run OJ from Eclipse (source from
 svn) the tools menu is in another place and trunked of a lot
 of items?


 This is definitely not normal.  Check your
 workbench-properties.xml file.  It should normally be empty.  It
 sounds like you may be getting multiple definitions of the menu
 options.  We need more information to know for sure.

 regards,
 Larry Becker


 On Fri, Dec 11, 2009 at 8:39 AM, luca marletta
 lucama...@gmail.com mailto:lucama...@gmail.com wrote:

 Follow Stefan  guide lines, if I got well, I post a request or
 suggestion for a 3D enhancement on existing functions.

 Problem:
 working with 3d geometry you often have to add a new vertex
 and move
 it on an adjacent polygon vertex.
 Now when you add a new vertex the Z is undefined and even when you
 move this new vertex on  an adjacent polygon vertex this is
 not able
 to change his undefined Z and get the adjacent polygon vertex Z.

 A great fix of this behavior could be:
 when you add a new vertex  the Z will become the linear
 interpolation
 of the previous and next vertex of polygon or line:

 a simple mean of Z weighted on 1/distance.

 and when you move this vertex it takes the Z of the
 destination vertex
 even if this is a behavior in my opinion convenient but
 someone could
 have different idea.

 I think is quite simple for the maintainer of these class and for
 working in 3D is a simple but great enhancement.


 By the way: is normal that if run OJ from Eclipse (source from
 svn)
 the tools menu is in another place and trunked of a lot of items?


 thanks a lot

 luca

 luca marletta
 www.beopen.it http://www.beopen.it