[JPP-Devel] SVN: [6581] core/trunk/src/com/vividsolutions/jump/workbench/ui/warp/ WarpingPlugIn.java

2020-10-05 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6581
  http://sourceforge.net/p/jump-pilot/code/6581
Author:   edso
Date: 2020-10-05 19:55:24 + (Mon, 05 Oct 2020)
Log Message:
---
remove toolbar layout workaround

Modified Paths:
--
core/trunk/src/com/vividsolutions/jump/workbench/ui/warp/WarpingPlugIn.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/warp/WarpingPlugIn.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/warp/WarpingPlugIn.java 
2020-10-05 19:54:50 UTC (rev 6580)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/warp/WarpingPlugIn.java 
2020-10-05 19:55:24 UTC (rev 6581)
@@ -34,7 +34,6 @@
 package com.vividsolutions.jump.workbench.ui.warp;
 
 import java.awt.BorderLayout;
-import java.awt.FlowLayout;
 
 import javax.swing.JComponent;
 
@@ -59,11 +58,10 @@
 
 protected void initializeToolbox(ToolboxDialog toolbox) {
 WarpingPanel warpingPanel = new WarpingPanel(toolbox);
-toolbox.getToolBar().setLayout(new FlowLayout());
 toolbox.getCenterPanel().add(warpingPanel, BorderLayout.CENTER);
 add(new DrawWarpingVectorTool(), false, toolbox, warpingPanel);
 add(new DeleteWarpingVectorTool(), false, toolbox, warpingPanel);
-toolbox.getToolBar().addSeparator();
+toolbox.getToolBar().addSeparator();
 add(new DrawIncrementalWarpingVectorTool(warpingPanel), true, toolbox, 
warpingPanel);
 add(new DeleteIncrementalWarpingVectorTool(warpingPanel), true, 
toolbox, warpingPanel);
 //Set y so it is positioned below Editing toolbox. [Jon Aquino]



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


[JPP-Devel] SVN: [6580] core/trunk/src/com/vividsolutions/jump/workbench/ui/toolbox/ ToolboxDialog.java

2020-10-05 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6580
  http://sourceforge.net/p/jump-pilot/code/6580
Author:   edso
Date: 2020-10-05 19:54:50 + (Mon, 05 Oct 2020)
Log Message:
---
move constructor and jbinit to top of class source
add north/south panel getter
make toolbar panel wrap properly and align it left
add a separator line below toolbar if buttons exist

Modified Paths:
--

core/trunk/src/com/vividsolutions/jump/workbench/ui/toolbox/ToolboxDialog.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/toolbox/ToolboxDialog.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/toolbox/ToolboxDialog.java  
2020-10-05 19:43:52 UTC (rev 6579)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/toolbox/ToolboxDialog.java  
2020-10-05 19:54:50 UTC (rev 6580)
@@ -42,9 +42,11 @@
 import java.util.List;
 
 import javax.swing.AbstractButton;
+import javax.swing.BorderFactory;
 import javax.swing.Icon;
 import javax.swing.JDialog;
 import javax.swing.JPanel;
+import javax.swing.JSeparator;
 import javax.swing.JToggleButton;
 
 import com.vividsolutions.jump.workbench.WorkbenchContext;
@@ -69,7 +71,119 @@
 // taskframe has been reworked, still it works, so leave it in peace [ede 
01.2013]
 public class ToolboxDialog extends JDialog {
 private ArrayList pluginsTools = new ArrayList();
-  
+
+public ToolboxDialog(final WorkbenchContext context) {
+  super(context.getWorkbench().getFrame(), "", false);
+  jbInit();
+  this.context = context;
+  setResizable(true);
+  setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+  this.addComponentListener(new ComponentAdapter() {
+public void componentHidden(ComponentEvent e) {
+  if 
(buttons.contains(context.getWorkbench().getFrame().getToolBar().getSelectedCursorToolButton()))
 {
+((AbstractButton) 
context.getWorkbench().getFrame().getToolBar().getButtonGroup().getElements()
+.nextElement()).doClick();
+  }
+}
+  });
+}
+
+private WorkbenchContext context;
+
+private JPanel northPanel = new JPanel();
+private JPanel centerPanel = new JPanel();
+private JPanel southPanel = new JPanel();
+
+private JPanel toolbarsPanel = new JPanel();
+private JSeparator northPanelSeparator = new 
JSeparator(JSeparator.HORIZONTAL);
+
+private GridLayout gridLayout1 = new GridLayout();
+
+private void jbInit() {
+  getContentPane().setLayout(new BorderLayout());
+
+  northPanel.setLayout(new BorderLayout());
+  getContentPane().add(northPanel, BorderLayout.NORTH);
+  centerPanel.setLayout(new BorderLayout());
+  getContentPane().add(centerPanel, BorderLayout.CENTER);
+  southPanel.setLayout(new BorderLayout());
+  getContentPane().add(southPanel, BorderLayout.SOUTH);
+
+  toolbarsPanel.setLayout(gridLayout1);
+  // pad toolbar left/right a bit
+  toolbarsPanel.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 10));
+  gridLayout1.setColumns(1);
+
+  // add toolbar panel to the north panel
+  northPanel.add(toolbarsPanel, BorderLayout.CENTER);
+  // separate toolbar visually from the center panel
+  northPanel.add(northPanelSeparator, BorderLayout.SOUTH);
+  // only shown if there are buttons registered
+  this.addComponentListener(new ComponentAdapter() {
+@Override
+public void componentShown(ComponentEvent e) {
+  northPanelSeparator.setVisible(pluginsTools.size()>0);
+}
+  });
+}
+
+public JPanel getNorthPanel() {
+  return northPanel;
+}
+
+public JPanel getSouthPanel() {
+  return southPanel;
+}
+
+public JPanel getCenterPanel() {
+  return centerPanel;
+}
+
+/**
+ * [ede 01.2013] disabled and replaced with ComponentListener above Call 
this
+ * method after all the CursorTools have been added.
+ */
+public void finishAddingComponents() {
+}
+
+public void setVisible(boolean visible) {
+  if (visible && !locationInitializedBeforeMakingDialogVisible) {
+// here comes a hack
+addComponentListener(new ComponentListener() {
+  public void componentShown(ComponentEvent e) {
+// we assume all plugins registered before us, so they will
+// install before us also, so we pack and unregister ourself
+pack();
+removeComponentListener(this);
+  }
+
+  public void componentResized(ComponentEvent e) {
+  }
+
+  public void componentMoved(ComponentEvent e) {
+  }
+
+  public void componentHidden(ComponentEvent e) {
+  }
+});
+
+// #initializeLocation was called in #finishAddingComponents,
+// but the Workbench may have moved since then, so call
+// #initializeLocation again just before making the dialog
+// visible. [Jon Aquino 

[JPP-Devel] SVN: [6579] core/trunk/src/com/vividsolutions/jump/workbench

2020-10-05 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6579
  http://sourceforge.net/p/jump-pilot/code/6579
Author:   edso
Date: 2020-10-05 19:43:52 + (Mon, 05 Oct 2020)
Log Message:
---
add multiple extension dirs support, needed eg. in eclipse where lib/ext/ and 
lib/plus/ are separate folders. might be usable in the future to place each 
extension in their own folder.
use by giving multiple -plug-in-directory params eg. -plug-in-directory 
"lib\plus" -plug-in-directory "lib\ext"

Modified Paths:
--
core/trunk/src/com/vividsolutions/jump/workbench/JUMPWorkbench.java
core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInManager.java

Modified: core/trunk/src/com/vividsolutions/jump/workbench/JUMPWorkbench.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/JUMPWorkbench.java 
2020-10-04 21:18:10 UTC (rev 6578)
+++ core/trunk/src/com/vividsolutions/jump/workbench/JUMPWorkbench.java 
2020-10-05 19:43:52 UTC (rev 6579)
@@ -267,27 +267,44 @@
 properties = new WorkbenchPropertiesFile(files, frame);
 
 // -- end new
-File extensionsDirectory;
+
+File extensionsDirectory = null;
+List moreDirs = new ArrayList();
 if (commandLine.hasOption(PLUG_IN_DIRECTORY_OPTION)) {
-  extensionsDirectory = new File(commandLine.getOption(
-  PLUG_IN_DIRECTORY_OPTION).getArg(0));
-  if (!extensionsDirectory.exists()) {
-Logger.warn("Extensions directory does not exist: "
-+ extensionsDirectory);
-extensionsDirectory = null;
+  // we support multiple -plug-in-directory definitions, where the first 
is set default
+  // and all others and contained jar/zip files get added to classpath 
below
+  // this mainly helps when run during development where lib/plus/ & 
lib/ext/ are different folders
+  Iterator paths = 
commandLine.getAllArguments(PLUG_IN_DIRECTORY_OPTION);
+  while (paths.hasNext()) {
+String path = paths.next();
+if (extensionsDirectory == null) {
+  // first entry get's default
+  extensionsDirectory = new File(path);
+  Logger.debug("Set plugin-dir -> "+path);
+  continue;
+}
+// rest get's added to classloader
+File dir = new File(path);
+if (!dir.exists()) {
+  Logger.error("given parameter "+PLUG_IN_DIRECTORY_OPTION+" 
'"+path+"' does not exist.");
+  continue;
+}
+Logger.debug("Add plugin-dir -> "+path);
+moreDirs.add(dir);
   }
 } else {
   extensionsDirectory = new File("lib/ext");
-  if (!extensionsDirectory.exists()) {
-// Added further information so that debug user will know where
-// it is actually looking for as the extension directory. [Ed Deen]
-Logger.warn("Extensions directory does not exist: "
-+ extensionsDirectory + " where homedir = ["
-+ System.getProperty("user.dir") + "]");
-extensionsDirectory = null;
-  }
 }
 
+if (!extensionsDirectory.exists()) {
+  // Added further information so that debug user will know where
+  // it is actually looking for as the extension directory. [Ed Deen]
+  Logger.error("Extensions directory does not exist: "
+  + extensionsDirectory + " where homedir = ["
+  + System.getProperty("user.dir") + "]");
+  extensionsDirectory = null;
+}
+
 // [ede 12.2012] deprecated -project option
 if (commandLine.hasOption(INITIAL_PROJECT_FILE)) {
   String task = commandLine.getOption(INITIAL_PROJECT_FILE).getArg(0);
@@ -308,7 +325,14 @@
   }
 }
 
+// create plugin manager
 plugInManager = new PlugInManager(context, extensionsDirectory, monitor);
+// add secondary extension folders (mainly for dev where we have lib/ext/ 
& lib/plus/)
+for (File dir : moreDirs) {
+  plugInManager.addExtensionDir(dir);
+}
+// debugging output of all urls in our classloader
+Logger.debug("Classpath -> 
"+Arrays.toString(plugInManager.getClassLoader().getURLs()));
 
 // Load drivers before initializing the frame because part of the frame
 // initialization is the initialization of the driver dialogs. [Jon

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInManager.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInManager.java  
2020-10-04 21:18:10 UTC (rev 6578)
+++ core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInManager.java  
2020-10-05 19:43:52 UTC (rev 6579)
@@ -30,7 +30,6 @@
 import java.io.FileFilter;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -67,9 +66,9 @@
 
 private TaskMonitor monitor;
 private WorkbenchContext context;
-private 

Re: [JPP-Devel] Tool that converts holes into polygons

2020-10-05 Thread edgar . soldin
you could

1. convert your sea to Multilinestring
2. explode that
3. convert the isles needed to Polygon again

..ede

On 10/5/2020 13:18, Rahkonen Jukka (MML) wrote:
> Hi,
>
> What if I would like to convert all the many holes in the sea polygon into 
> islands? We have a tool in OJ that does something similar with inner rings by 
> removing them (Remove holes and Remove small holes functions). What I am 
> after is to select the inner rings of selected features and copy them into a 
> new layer as outer rings. The simple tool could discard attributes but an 
> advanced one could optionally copy at least the ID of the source polygon. 
> Maybe also a "hole_id" could be generated for enabling unique values 
> "main_id"+"hole_id".
>
> I know that I can make a polygon as large as the sea and compute the 
> difference but sometimes it could be more convenient for users just to select 
> and run "extract holes as polygons". Also, copying the inner rings vertex by 
> vertex should be a fast and robust method. If some ring would make an invalid 
> polygon it could skipped with a warning. With difference it could mean that 
> the whole process fails.
>
> -Jukka Rahkonen-
>
>
>
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



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


[JPP-Devel] Tool that converts holes into polygons

2020-10-05 Thread Rahkonen Jukka (MML)
Hi,

What if I would like to convert all the many holes in the sea polygon into 
islands? We have a tool in OJ that does something similar with inner rings by 
removing them (Remove holes and Remove small holes functions). What I am after 
is to select the inner rings of selected features and copy them into a new 
layer as outer rings. The simple tool could discard attributes but an advanced 
one could optionally copy at least the ID of the source polygon. Maybe also a 
"hole_id" could be generated for enabling unique values "main_id"+"hole_id".

I know that I can make a polygon as large as the sea and compute the difference 
but sometimes it could be more convenient for users just to select and run 
"extract holes as polygons". Also, copying the inner rings vertex by vertex 
should be a fast and robust method. If some ring would make an invalid polygon 
it could skipped with a warning. With difference it could mean that the whole 
process fails.

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