Skip to content

Commit

Permalink
Improved; documentation in TestTools. Converted; geometric fixtures t…
Browse files Browse the repository at this point in the history
…o JML format.
  • Loading branch information
hastebrot committed Jan 10, 2012
1 parent 9afbce9 commit 8e064ee
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 48 deletions.
Binary file removed share/dissolve.dbf
Binary file not shown.
104 changes: 104 additions & 0 deletions share/dissolve.jml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version='1.0' encoding='UTF-8'?>
<JCSDataFile xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" >
<JCSGMLInputTemplate>
<CollectionElement>featureCollection</CollectionElement>
<FeatureElement>feature</FeatureElement>
<GeometryElement>geometry</GeometryElement>
<ColumnDefinitions>
<column>
<name>LABEL</name>
<type>STRING</type>
<valueElement elementName="property" attributeName="name" attributeValue="LABEL"/>
<valueLocation position="body"/>
</column>
</ColumnDefinitions>
</JCSGMLInputTemplate>

<featureCollection>
<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>220.0,900.0
220.0,960.0
280.0,960.0
280.0,900.0
220.0,900.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
<property name="LABEL">A</property>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>260.0,860.0
260.0,920.0
320.0,920.0
320.0,860.0
260.0,860.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
<property name="LABEL">A</property>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>360.0,880.0
360.0,940.0
420.0,940.0
420.0,880.0
360.0,880.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
<property name="LABEL">B</property>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>420.0,880.0
420.0,940.0
480.0,940.0
480.0,880.0
420.0,880.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
<property name="LABEL">B</property>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>260.0,780.0
260.0,840.0
320.0,840.0
320.0,780.0
260.0,780.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
<property name="LABEL">A</property>
</feature>

</featureCollection>
</JCSDataFile>
Binary file removed share/dissolve.shp
Binary file not shown.
Binary file removed share/dissolve.shx
Binary file not shown.
60 changes: 60 additions & 0 deletions share/inner-ring-invalid.jml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version='1.0' encoding='UTF-8'?>
<JCSDataFile xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" >
<JCSGMLInputTemplate>
<CollectionElement>featureCollection</CollectionElement>
<FeatureElement>feature</FeatureElement>
<GeometryElement>geometry</GeometryElement>
<ColumnDefinitions>
</ColumnDefinitions>
</JCSGMLInputTemplate>

<featureCollection>
<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>220.0,600.0
220.0,760.0
380.0,760.0
440.0,760.0
440.0,600.0
220.0,600.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
<gml:innerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>380.0,760.0
280.0,740.0
280.0,640.0
380.0,640.0
380.0,760.0 </gml:coordinates>
</gml:LinearRing>
</gml:innerBoundaryIs>
</gml:Polygon>
</geometry>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>220.0,580.0
380.0,580.0
280.0,560.0
280.0,460.0
380.0,460.0
380.0,580.0
440.0,580.0
440.0,420.0
220.0,420.0
220.0,580.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
</feature>

</featureCollection>
</JCSDataFile>
45 changes: 45 additions & 0 deletions share/inner-ring.jml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version='1.0' encoding='UTF-8'?>
<JCSDataFile xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" >
<JCSGMLInputTemplate>
<CollectionElement>featureCollection</CollectionElement>
<FeatureElement>feature</FeatureElement>
<GeometryElement>geometry</GeometryElement>
<ColumnDefinitions>
</ColumnDefinitions>
</JCSGMLInputTemplate>

<featureCollection>
<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>220.0,600.0
220.0,760.0
440.0,760.0
440.0,600.0
220.0,600.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
</feature>

<feature>
<geometry>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>280.0,740.0
280.0,640.0
380.0,640.0
380.0,760.0
280.0,740.0 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</geometry>
</feature>

</featureCollection>
</JCSDataFile>
4 changes: 2 additions & 2 deletions src/org/openjump/tools/plugin/UnionByAttributePlugInTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -84,7 +84,7 @@ public static void afterClass() {
@Test
public void testAddedResultLayer() throws Exception {
// given: "a loaded shapefile fixture"
TestTools.openFile(new File("share/dissolve.shp"), workbench.getContext());
TestTools.openFile(new File("share/dissolve.jml"), workbench.getContext());

// and: "plugin with dialog values"
PlugIn plugin = new UnionByAttributePlugIn();
Expand Down
23 changes: 23 additions & 0 deletions src/org/openjump/tools/plugin/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Plugins from the tools menu.
*/
package org.openjump.tools.plugin;
2 changes: 1 addition & 1 deletion src/org/openjump/tools/test/DialogParameters.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down
2 changes: 1 addition & 1 deletion src/org/openjump/tools/test/DialogParametersTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down
2 changes: 1 addition & 1 deletion src/org/openjump/tools/test/ReflectionUtils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down
2 changes: 1 addition & 1 deletion src/org/openjump/tools/test/ReflectionUtilsTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down
29 changes: 17 additions & 12 deletions src/org/openjump/tools/test/TestTools.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI for
* visualizing and manipulating spatial features with geometry and attributes.
* Copyright (C) 2011 The JUMP/OpenJUMP contributors
* Copyright (C) 2012 The JUMP/OpenJUMP contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -87,6 +87,12 @@ public static JUMPWorkbench buildWorkbench(String[] args) throws Exception {
return workbench;
}

/**
* Opens a geometric fixture in the task panel.
*
* @param file File
* @param context Context.
*/
public static void openFile(File file, WorkbenchContext context) {
OpenFilePlugIn filePlugin = new OpenFilePlugIn(context, file);
filePlugin.actionPerformed(new ActionEvent(filePlugin, 0, ""));
Expand All @@ -99,11 +105,10 @@ public static void installPlugIn(PlugIn plugin, WorkbenchContext context)
}

/**
* Configure PlugIn via fields in the object. Replaces the configuration of the
* plugin via an user dialog in PlugIn.execute().
* Configures execution parameters for {@link PlugIn} using its instance fields.
*
* @param plugin
* @param parameters
* @param plugin Plugin.
* @param parameters Execution parameters.
*/
public static void configurePlugIn(PlugIn plugin, Map<String, Object> parameters)
throws Exception {
Expand All @@ -113,12 +118,11 @@ public static void configurePlugIn(PlugIn plugin, Map<String, Object> parameters
}

/**
* Configure PlugIn via a dialog field. Replaces the configuration of the
* plugin via an user dialog in PlugIn.execute().
* Configures execution parameters for {@link PlugIn} using a new user dialog.
*
* @param plugin
* @param parameters
* @param retrieveFieldNamesFromPlugIn
* @param plugin Plugin.
* @param parameters Execution parameters.
* @param retrieveFieldNamesFromPlugIn Retrieve {@link I18N} string names.
*/
public static void configurePlugIn(PlugIn plugin, Map<String, Object> parameters,
boolean retrieveFieldNamesFromPlugIn) throws Exception {
Expand All @@ -136,9 +140,10 @@ public static void configurePlugIn(PlugIn plugin, Map<String, Object> parameters
}

/**
* Executes operations of the {@link Plugin}.
*
* @param plugin
* @param context
* @param plugin Plugin.
* @param context Context.
* @see com.vividsolutions.jump.workbench.plugin.AbstractPlugIn#toActionListener
*/
public static void executePlugIn(PlugIn plugin, WorkbenchContext context)
Expand Down
Loading

0 comments on commit 8e064ee

Please sign in to comment.