diff --git a/cave/build/p2-build.xml b/cave/build/p2-build.xml
index 2fd38eadd4..a28b6ba957 100644
--- a/cave/build/p2-build.xml
+++ b/cave/build/p2-build.xml
@@ -272,40 +272,38 @@
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/.classpath b/cave/com.raytheon.uf.viz.gisdatastore.directory/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/.project b/cave/com.raytheon.uf.viz.gisdatastore.directory/.project
new file mode 100644
index 0000000000..671b450250
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/.project
@@ -0,0 +1,28 @@
+
+
+ com.raytheon.uf.viz.gisdatastore.directory
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.gisdatastore.directory/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..c3745d3f80
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Nov 05 11:53:02 CST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8779a54ea5
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shapefile support for DataStoreResource
+Bundle-SymbolicName: com.raytheon.uf.viz.gisdatastore.directory;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.raytheon.uf.viz.gisdatastore.directory.Activator
+Bundle-Vendor: RAYTHEON
+Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.viz.ui
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.geotools,
+ com.raytheon.uf.common.status,
+ com.raytheon.uf.viz.gisdatastore,
+ com.raytheon.uf.viz.core,
+ com.raytheon.viz.core,
+ com.raytheon.viz.ui,
+ com.raytheon.uf.common.util,
+ com.raytheon.uf.viz.core.maps;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: com.raytheon.uf.viz.gisdatastore.directory.rsc
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject
new file mode 100644
index 0000000000..8eb2ecad04
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject
@@ -0,0 +1 @@
+com.raytheon.uf.viz.gisdatastore.directory.rsc.DirectoryDataStoreResourceData
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties b/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties
new file mode 100644
index 0000000000..e9863e281e
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/plugin.xml b/cave/com.raytheon.uf.viz.gisdatastore.directory/plugin.xml
new file mode 100644
index 0000000000..42718c1f8e
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/plugin.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/Activator.java b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/Activator.java
new file mode 100644
index 0000000000..5deb1993a0
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/Activator.java
@@ -0,0 +1,122 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.directory;
+
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.raytheon.uf.common.localization.exception.LocalizationException;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 12, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+public class Activator extends AbstractUIPlugin {
+ public static final transient IUFStatusHandler statusHandler = UFStatus
+ .getHandler(Activator.class);
+
+ // pref store
+ private HierarchicalPreferenceStore prefs;
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.raytheon.uf.viz.gisdatastore.directory"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
+ */
+ @Override
+ public IPersistentPreferenceStore getPreferenceStore() {
+ try {
+ if (prefs == null) {
+ prefs = new HierarchicalPreferenceStore(this);
+ }
+ } catch (LocalizationException e) {
+ statusHandler.handle(
+ Priority.PROBLEM,
+ "Error reading preference store: "
+ + e.getLocalizedMessage(), e);
+ }
+
+ return prefs;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/DirectoryDataStorePlugin.java b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/DirectoryDataStorePlugin.java
new file mode 100644
index 0000000000..b96f4a1fe6
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/DirectoryDataStorePlugin.java
@@ -0,0 +1,181 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.directory;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.geotools.data.DataStore;
+import org.geotools.data.directory.DirectoryDataStoreFactory;
+
+import com.raytheon.uf.viz.gisdatastore.IGisDataStorePlugin;
+import com.raytheon.uf.viz.gisdatastore.directory.rsc.DirectoryDataStoreResourceData;
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResourceData;
+
+/**
+ * Directory GisDataStorePlugin implementation
+ *
+ * Will load data from any recognized GIS feature file types in a directory
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Dec 6, 2012 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class DirectoryDataStorePlugin implements IGisDataStorePlugin {
+ private static int DIR_LIST_SIZE = 10;
+
+ private Map connectionParameters;
+
+ private Combo dirCombo;
+
+ private Button browseButton;
+
+ private List dirList;
+
+ @Override
+ public void createControls(final Composite comp) {
+ GridLayout layout = (GridLayout) comp.getLayout();
+ layout.numColumns = 2;
+ layout.makeColumnsEqualWidth = false;
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText("Directory:");
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ label.setLayoutData(layoutData);
+
+ browseButton = new Button(comp, SWT.PUSH);
+ layoutData = new GridData(SWT.END, SWT.CENTER, false, false);
+ browseButton.setLayoutData(layoutData);
+ browseButton.setText("Browse...");
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dlg = new DirectoryDialog(comp.getShell());
+ dlg.setFilterPath(dirCombo.getText());
+ String dir = dlg.open();
+ if (dir != null) {
+ dirCombo.setText(dir);
+ }
+ }
+ });
+
+ dirCombo = new Combo(comp, SWT.DROP_DOWN);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = 300;
+ layoutData.horizontalSpan = 2;
+ dirCombo.setLayoutData(layoutData);
+ }
+
+ @Override
+ public Map getConnectionParameters() {
+ return this.connectionParameters;
+ }
+
+ @Override
+ public void loadFromPreferences() {
+ dirList = new ArrayList(DIR_LIST_SIZE);
+ IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
+ for (int i = 0; i < DIR_LIST_SIZE; i++) {
+ String url = prefs.getString("DirectoryImportPath" + i);
+ dirList.add(url);
+ }
+ dirCombo.setItems(dirList.toArray(new String[dirList.size()]));
+ dirCombo.setText(dirList.get(0));
+ }
+
+ @Override
+ public void saveToPreferences() {
+ IPersistentPreferenceStore prefs = Activator.getDefault()
+ .getPreferenceStore();
+ String dir = dirCombo.getText();
+ if (dirList.contains(dir)) {
+ // dir already in list remove it
+ dirList.remove(dir);
+ } else if (dirList.size() == DIR_LIST_SIZE) {
+ // list at max size remove last entry
+ dirList.remove(DIR_LIST_SIZE - 1);
+ }
+ // put dir at front of list
+ dirList.add(0, dir);
+
+ int i = 0;
+ for (String s : dirList) {
+ prefs.setValue("DirectoryImportPath" + i++, s);
+ }
+
+ try {
+ prefs.save();
+ } catch (IOException e) {
+ Activator.statusHandler.error(
+ "Unable to save recently used directories", e);
+ }
+ }
+
+ @Override
+ public DataStore connectToDataStore() throws IOException {
+ String dir = dirCombo.getText();
+ URL url = new File(dir).toURI().toURL();
+
+ Map params = new HashMap();
+ params.put(DirectoryDataStoreFactory.URLP.key, url);
+
+ DataStoreResourceData rd = constructResourceData(null, params);
+ DataStore dataStore = rd.getDataStore();
+
+ this.connectionParameters = params;
+
+ return dataStore;
+ }
+
+ @Override
+ public DataStoreResourceData constructResourceData(String typeName,
+ Map connectionParameters) {
+ DirectoryDataStoreResourceData rd = new DirectoryDataStoreResourceData(
+ typeName, connectionParameters);
+ return rd;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/rsc/DirectoryDataStoreResourceData.java b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/rsc/DirectoryDataStoreResourceData.java
new file mode 100644
index 0000000000..8d70b2a3b4
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.directory/src/com/raytheon/uf/viz/gisdatastore/directory/rsc/DirectoryDataStoreResourceData.java
@@ -0,0 +1,79 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.directory.rsc;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.directory.DirectoryDataStoreFactory;
+
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResourceData;
+
+/**
+ * DataStore resource data class for GIS feature files
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 31, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+@XmlAccessorType(XmlAccessType.NONE)
+public class DirectoryDataStoreResourceData extends DataStoreResourceData {
+ public DirectoryDataStoreResourceData() {
+ }
+
+ public DirectoryDataStoreResourceData(String typeName,
+ Map connectionParameters) {
+ super(typeName, connectionParameters);
+ }
+
+ @Override
+ protected DataStore constructDataStore() throws IOException {
+ DirectoryDataStoreFactory factory = new DirectoryDataStoreFactory();
+ Map params = new HashMap();
+ for (Entry entry : getConnectionParameters().entrySet()) {
+ if (entry.getValue() instanceof Serializable) {
+ params.put(entry.getKey(), (Serializable) entry.getValue());
+ } else {
+ throw new IllegalArgumentException(entry.getKey() + "("
+ + entry.getValue().getClass().getName()
+ + ") not an instance of java.io.Serializable");
+ }
+ }
+ DataStore dataStore = factory.createDataStore(params);
+ return dataStore;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.feature/.project b/cave/com.raytheon.uf.viz.gisdatastore.feature/.project
new file mode 100644
index 0000000000..7c06a73d13
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.feature/.project
@@ -0,0 +1,17 @@
+
+
+ com.raytheon.uf.viz.gisdatastore.feature
+
+
+
+
+
+ org.eclipse.pde.FeatureBuilder
+
+
+
+
+
+ org.eclipse.pde.FeatureNature
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.feature/build.properties b/cave/com.raytheon.uf.viz.gisdatastore.feature/build.properties
new file mode 100644
index 0000000000..64f93a9f0b
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml b/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml
new file mode 100644
index 0000000000..12b476b470
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore.feature/feature.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ [Enter Feature Description here.]
+
+
+
+ [Enter Copyright Description here.]
+
+
+
+ [Enter License Description here.]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/.classpath b/cave/com.raytheon.uf.viz.gisdatastore/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/.project b/cave/com.raytheon.uf.viz.gisdatastore/.project
new file mode 100644
index 0000000000..b5a51b3538
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/.project
@@ -0,0 +1,28 @@
+
+
+ com.raytheon.uf.viz.gisdatastore
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.gisdatastore/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..8ba0d6aa4f
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Nov 05 10:48:54 CST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.gisdatastore/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d72119e4d7
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Gisdatastore
+Bundle-SymbolicName: com.raytheon.uf.viz.gisdatastore;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.raytheon.uf.viz.gisdatastore.Activator
+Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.viz.ui
+Bundle-Vendor: RAYTHEON
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.geotools,
+ com.raytheon.uf.common.serialization,
+ com.raytheon.uf.common.status,
+ com.raytheon.uf.common.geospatial,
+ com.raytheon.uf.viz.core,
+ com.raytheon.uf.viz.core.maps;bundle-version="1.0.0",
+ com.raytheon.viz.core,
+ com.raytheon.viz.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: com.raytheon.uf.viz.gisdatastore,
+ com.raytheon.uf.viz.gisdatastore.rsc,
+ com.raytheon.uf.viz.gisdatastore.ui
+Import-Package: com.raytheon.uf.common.dataplugin.gfe.type
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/build.properties b/cave/com.raytheon.uf.viz.gisdatastore/build.properties
new file mode 100644
index 0000000000..e9863e281e
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/config.xml b/cave/com.raytheon.uf.viz.gisdatastore/config.xml
new file mode 100644
index 0000000000..12416abf0c
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/config.xml
@@ -0,0 +1,7 @@
+
+
+hot pink
+SOLID
+2
+0.35
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/plugin.xml b/cave/com.raytheon.uf.viz.gisdatastore/plugin.xml
new file mode 100644
index 0000000000..09cc3561f6
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/plugin.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/schema/gisDataStore.exsd b/cave/com.raytheon.uf.viz.gisdatastore/schema/gisDataStore.exsd
new file mode 100644
index 0000000000..5196761c64
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/schema/gisDataStore.exsd
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+ This extension point is used to identify classes that define new GIS DataStore implementations so that they can be found and registered at startup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 13.2.1
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/Activator.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/Activator.java
new file mode 100644
index 0000000000..def8d10277
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/Activator.java
@@ -0,0 +1,123 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore;
+
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.raytheon.uf.common.localization.exception.LocalizationException;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 12, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+public class Activator extends AbstractUIPlugin {
+ public static final transient IUFStatusHandler statusHandler = UFStatus
+ .getHandler(Activator.class);
+
+ // pref store
+ private HierarchicalPreferenceStore prefs;
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.raytheon.uf.viz.gisdatastore"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
+ */
+ @Override
+ public IPersistentPreferenceStore getPreferenceStore() {
+ try {
+ if (prefs == null) {
+ prefs = new HierarchicalPreferenceStore(this);
+ }
+ } catch (LocalizationException e) {
+ statusHandler.handle(
+ Priority.PROBLEM,
+ "Error reading preference store: "
+ + e.getLocalizedMessage(), e);
+ }
+
+ return prefs;
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/IGisDataStorePlugin.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/IGisDataStorePlugin.java
new file mode 100644
index 0000000000..1b7025aced
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/IGisDataStorePlugin.java
@@ -0,0 +1,25 @@
+package com.raytheon.uf.viz.gisdatastore;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.swt.widgets.Composite;
+import org.geotools.data.DataStore;
+
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResourceData;
+
+public interface IGisDataStorePlugin {
+
+ public void createControls(final Composite comp);
+
+ public Map getConnectionParameters();
+
+ public void loadFromPreferences();
+
+ public void saveToPreferences();
+
+ public DataStore connectToDataStore() throws IOException;
+
+ public DataStoreResourceData constructResourceData(String typeName,
+ Map connectionParameters);
+}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/CropAction.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/CropAction.java
new file mode 100644
index 0000000000..f4cd8b8e44
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/CropAction.java
@@ -0,0 +1,81 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.actions;
+
+import com.raytheon.uf.viz.core.PixelExtent;
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResource;
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResource.IRubberBandSelectionListener;
+import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
+
+/**
+ * Crop GIS resource action
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 29, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class CropAction extends AbstractRightClickAction {
+ public CropAction() {
+ super(AS_PUSH_BUTTON);
+ }
+
+ @Override
+ public String getText() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ final DataStoreResource rsc = (DataStoreResource) this
+ .getSelectedRsc();
+ if (rsc.isCropped()) {
+ return "Uncrop Shape";
+ }
+ }
+ return "Crop Shape";
+ }
+
+ @Override
+ public void run() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ final DataStoreResource rsc = (DataStoreResource) this
+ .getSelectedRsc();
+ if (rsc.isCropped()) {
+ rsc.uncrop();
+ } else {
+ rsc.addRubberBandSelectionListener(new IRubberBandSelectionListener() {
+ @Override
+ public void rubberBandSelectionChanged(PixelExtent extent) {
+ rsc.removeRubberBandSelectionListener(this);
+ rsc.crop(extent);
+ }
+ });
+ rsc.activateRubberBandBox();
+ }
+ }
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/DisplayAttributes.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/DisplayAttributes.java
new file mode 100644
index 0000000000..072dcef078
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/DisplayAttributes.java
@@ -0,0 +1,65 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.actions;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResource;
+import com.raytheon.uf.viz.gisdatastore.ui.AttributeViewer;
+import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
+
+/**
+ * Show All Records action
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 29, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class DisplayAttributes extends AbstractRightClickAction {
+
+ /**
+ *
+ */
+ public DisplayAttributes() {
+ super("Display Attributes", AS_PUSH_BUTTON);
+ }
+
+ @Override
+ public void run() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ DataStoreResource rsc = (DataStoreResource) this.getSelectedRsc();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ AttributeViewer.openDialog(shell, rsc);
+
+ }
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/ImportGisAction.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/ImportGisAction.java
new file mode 100644
index 0000000000..6ebef11c47
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/ImportGisAction.java
@@ -0,0 +1,78 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.actions;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.raytheon.uf.viz.core.drawables.IDescriptor;
+import com.raytheon.uf.viz.core.maps.actions.AbstractMapHandler;
+import com.raytheon.uf.viz.gisdatastore.ui.GisDataStoreParametersDialog;
+import com.raytheon.viz.ui.EditorUtil;
+
+/**
+ * Handler for Import GIS command
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Dec 6, 2012 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class ImportGisAction extends AbstractMapHandler {
+
+ private GisDataStoreParametersDialog dlg;
+
+ private IDescriptor descriptor;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
+ * ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (dlg == null || dlg.getShell() == null) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+
+ descriptor = EditorUtil.getActiveVizContainer()
+ .getActiveDisplayPane().getRenderableDisplay()
+ .getDescriptor();
+
+ dlg = new GisDataStoreParametersDialog(shell, descriptor);
+ dlg.setBlockOnOpen(false);
+ }
+ dlg.open();
+ return null;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/RenameAction.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/RenameAction.java
new file mode 100644
index 0000000000..daa16108dc
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/RenameAction.java
@@ -0,0 +1,68 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.actions;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResource;
+import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
+
+/**
+ * Rename Action
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 29, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class RenameAction extends AbstractRightClickAction {
+
+ public RenameAction() {
+ super("Rename", AS_PUSH_BUTTON);
+ }
+
+ @Override
+ public void run() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ DataStoreResource rsc = (DataStoreResource) this.getSelectedRsc();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+
+ InputDialog dlg = new InputDialog(shell, "Rename",
+ "Enter new name", rsc.getName(), null);
+ if (dlg.open() == Window.OK) {
+ rsc.setName(dlg.getValue());
+ }
+ }
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/SetSampleAttributeAction.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/SetSampleAttributeAction.java
new file mode 100644
index 0000000000..9430d94642
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/actions/SetSampleAttributeAction.java
@@ -0,0 +1,78 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.actions;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.raytheon.uf.viz.gisdatastore.rsc.DataStoreResource;
+import com.raytheon.uf.viz.gisdatastore.ui.SelectAttributeDialog;
+import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
+
+/**
+ * TODO Add Description
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Dec 13, 2012 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class SetSampleAttributeAction extends AbstractRightClickAction {
+
+ /**
+ *
+ */
+ public SetSampleAttributeAction() {
+ super("Select Sample Attribute...", AS_PUSH_BUTTON);
+ }
+
+ @Override
+ public boolean isHidden() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ final DataStoreResource rsc = (DataStoreResource) this
+ .getSelectedRsc();
+ return rsc.getProperties().isMapLayer();
+ }
+ return true;
+ }
+
+ @Override
+ public void run() {
+ if (this.getSelectedRsc() instanceof DataStoreResource) {
+ final DataStoreResource rsc = (DataStoreResource) this
+ .getSelectedRsc();
+
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ SelectAttributeDialog dlg = new SelectAttributeDialog(shell, rsc);
+ dlg.setBlockOnOpen(false);
+ dlg.open();
+ }
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java
new file mode 100644
index 0000000000..b07f3f11aa
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java
@@ -0,0 +1,1413 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.gisdatastore.rsc;
+
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.geotools.coverage.grid.GeneralGridEnvelope;
+import org.geotools.coverage.grid.GridGeometry2D;
+import org.geotools.data.DataStore;
+import org.geotools.data.DefaultQuery;
+import org.geotools.data.FeatureSource;
+import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.factory.GeoTools;
+import org.geotools.feature.FeatureCollection;
+import org.geotools.geometry.GeneralEnvelope;
+import org.geotools.geometry.jts.JTS;
+import org.geotools.geometry.jts.ReferencedEnvelope;
+import org.geotools.referencing.operation.DefaultMathTransformFactory;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.AttributeDescriptor;
+import org.opengis.filter.Filter;
+import org.opengis.filter.FilterFactory2;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.operation.MathTransform;
+
+import com.raytheon.uf.common.geospatial.MapUtil;
+import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
+import com.raytheon.uf.common.geospatial.util.WorldWrapCorrector;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.time.DataTime;
+import com.raytheon.uf.common.time.TimeRange;
+import com.raytheon.uf.viz.core.DrawableString;
+import com.raytheon.uf.viz.core.IDisplayPaneContainer;
+import com.raytheon.uf.viz.core.IExtent;
+import com.raytheon.uf.viz.core.IGraphicsTarget;
+import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
+import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
+import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
+import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
+import com.raytheon.uf.viz.core.PixelExtent;
+import com.raytheon.uf.viz.core.drawables.IFont;
+import com.raytheon.uf.viz.core.drawables.IShadedShape;
+import com.raytheon.uf.viz.core.drawables.IWireframeShape;
+import com.raytheon.uf.viz.core.drawables.PaintProperties;
+import com.raytheon.uf.viz.core.exception.VizException;
+import com.raytheon.uf.viz.core.map.MapDescriptor;
+import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
+import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
+import com.raytheon.uf.viz.core.rsc.LoadProperties;
+import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory;
+import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
+import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
+import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
+import com.raytheon.uf.viz.core.rsc.capabilities.LabelableCapability;
+import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
+import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
+import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
+import com.raytheon.uf.viz.gisdatastore.Activator;
+import com.raytheon.uf.viz.gisdatastore.ui.PreferenceConverter;
+import com.raytheon.viz.ui.input.InputAdapter;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.Point;
+
+/**
+ * Resource to render data from a GeoTools DataStore
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 31, 2012 #1326 randerso Initial creation
+ *
+ *
+ *
+ * @author randerso
+ * @version 1.0
+ */
+
+public class DataStoreResource extends
+ AbstractVizResource implements
+ IPropertyChangeListener, IResourceDataChanged {
+ private static final String ID_ATTRIBUTE_NAME = "Feature.ID";
+
+ private static final int CLICK_TOLERANCE = 3;
+
+ private static final RGB RUBBER_BAND_COLOR = new RGB(0, 255, 0);
+
+ /**
+ * The screen will be re-centered about the centroid of the selected feature
+ * only if the centroid lies outside the central portion of the screen as
+ * defined by this value.
+ */
+ private static final double RECENTER_TOLERANCE = 0.8;
+
+ public static final String HIGHLIGHT_COLOR_KEY = "HighlightColor";
+
+ public static final String HIGHLIGHT_COLOR_DEFAULT = "HotPink";
+
+ public static final String HIGHLIGHT_STYLE_KEY = "HighlightStyle";
+
+ public static final String HIGHLIGHT_STYLE_DEFAULT = "SOLID";
+
+ public static final String HIGHLIGHT_WIDTH_KEY = "HighlightWidth";
+
+ public static final String HIGHLIGHT_WIDTH_DEFAULT = "2";
+
+ public static final String PRODUCT_OPACITY_KEY = "ProductOpacity";
+
+ public static final String PRODUCT_OPACITY_DEFAULT = "0.35";
+
+ protected static final double EXPANSION_FACTOR = 0.25;
+
+ /**
+ * at time of writing this is the density multiplier used to determine if a
+ * label should be drawn in ZoneSelectorResource
+ */
+ private static final int BASE_DENSITY_MULT = 50;
+
+ protected static class LabelNode {
+ private final Rectangle2D rect;
+
+ private final String label;
+
+ private final double[] location;
+
+ public LabelNode(String label, double[] location, Rectangle2D rect) {
+ this.label = label;
+ this.location = location;
+ this.rect = rect;
+ }
+
+ /**
+ * @return the rect
+ */
+ public Rectangle2D getRect() {
+ return rect;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * @return the location
+ */
+ public double[] getLocation() {
+ return location;
+ }
+ }
+
+ static class DisplayAttributes {
+ private boolean visible;
+
+ private boolean highlighted;
+
+ private Point centroid;
+
+ public DisplayAttributes() {
+ visible = true;
+ highlighted = false;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public boolean isHighlighted() {
+ return highlighted;
+ }
+
+ public void setHighlighted(boolean highlighted) {
+ this.highlighted = highlighted;
+ }
+
+ public Point getCentroid() {
+ return centroid;
+ }
+
+ public void setCentroid(Point centroid) {
+ this.centroid = centroid;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (isVisible()) {
+ if (isHighlighted()) {
+ sb.append("Highlighted");
+ } else {
+ sb.append("Visible");
+ }
+ } else {
+ sb.append("Invisible");
+ }
+
+ return sb.toString();
+ }
+
+ }
+
+ private class MouseHandler extends InputAdapter {
+ private Coordinate start;
+
+ private Coordinate end;
+
+ private boolean inDrag;
+
+ @Override
+ public boolean handleMouseMove(int x, int y) {
+ if (rubberBandExtent != null) {
+ IDisplayPaneContainer container = getResourceContainer();
+ Coordinate c = container.translateClick(x, y);
+ if (c != null) {
+ try {
+ dragPromptCoord = new ReferencedCoordinate(c)
+ .asPixel(getDescriptor().getGridGeometry());
+ } catch (Exception e) {
+ dragPromptCoord = null;
+ }
+ } else {
+ dragPromptCoord = null;
+ }
+ issueRefresh();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean handleMouseDown(int x, int y, int mouseButton) {
+ if (rubberBandExtent != null) {
+ if (mouseButton == 1) {
+ IDisplayPaneContainer container = getResourceContainer();
+ Coordinate c = container.translateClick(x, y);
+ if (c != null) {
+ try {
+ start = new ReferencedCoordinate(c)
+ .asPixel(getDescriptor().getGridGeometry());
+ end = start;
+ inDrag = true;
+ return true;
+ } catch (Exception e) {
+ start = null;
+ return false;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean handleMouseDownMove(int x, int y, int mouseButton) {
+ if (rubberBandExtent != null) {
+ if (mouseButton == 1 && inDrag) {
+ IDisplayPaneContainer container = getResourceContainer();
+ Coordinate c = container.translateClick(x, y);
+ if (c != null) {
+ try {
+ end = new ReferencedCoordinate(c)
+ .asPixel(getDescriptor().getGridGeometry());
+ updateRubberBandBox(start, end);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean handleMouseUp(int x, int y, int mouseButton) {
+ if (rubberBandExtent != null) {
+ if (mouseButton == 1 && inDrag) {
+ IDisplayPaneContainer container = getResourceContainer();
+ Coordinate c = container.translateClick(x, y);
+ if (c != null) {
+ try {
+ end = new ReferencedCoordinate(c)
+ .asPixel(getDescriptor().getGridGeometry());
+ } catch (Exception e) {
+ // use previous end value
+ }
+ }
+ inDrag = false;
+ updateRubberBandBox(start, end);
+ deactivateRubberBandBox();
+ return true;
+ }
+ }
+
+ return super.handleMouseUp(x, y, mouseButton);
+ }
+
+ @Override
+ public boolean handleDoubleClick(int x, int y, int button) {
+ if (!doubleClickListeners.isEmpty()) {
+ IDisplayPaneContainer container = getResourceContainer();
+ Coordinate c = container.translateClick(x, y);
+
+ try {
+ List features = findFeatures(new ReferencedCoordinate(
+ c));
+ List featureIds = new ArrayList(
+ features.size());
+ for (SimpleFeature feature : features) {
+ featureIds.add(feature.getID());
+ }
+ for (Object obj : doubleClickListeners.getListeners()) {
+ IDoubleClickSelectionListener listener = (IDoubleClickSelectionListener) obj;
+ listener.selectedFeaturesChanged(featureIds);
+ }
+
+ } catch (VizException e) {
+ // ignore click
+ }
+ }
+
+ return super.handleDoubleClick(x, y, button);
+ }
+ }
+
+ public static interface IRubberBandSelectionListener {
+ public void rubberBandSelectionChanged(PixelExtent extent);
+ }
+
+ public static interface IDoubleClickSelectionListener {
+ public void selectedFeaturesChanged(List selectedIds);
+ }
+
+ protected DataStore dataStore;
+
+ private String typeName;
+
+ private SimpleFeatureType schema;
+
+ /**
+ * The valid time range for this resource. If null resource is time
+ * agnostic.
+ */
+ private TimeRange timeRange;
+
+ private String[] attributeNames;
+
+ private Object[][] attributes;
+
+ private Map displayAttributes;
+
+ protected IWireframeShape outlineShape;
+
+ protected IWireframeShape highlightShape;
+
+ protected IFont font;
+
+ protected PixelExtent lastExtent;
+
+ protected PixelExtent projExtent;
+
+ protected List labels;
+
+ protected IShadedShape shadedShape;
+
+ protected Map