mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Fixed queries
Also added internal display of existing docuemtns (so they can be deleted)
This commit is contained in:
parent
9018176899
commit
74deebe446
@ -61,6 +61,7 @@ import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.Timer;
|
||||
@ -234,6 +235,14 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
|
||||
boolean posOK = true;
|
||||
try {
|
||||
posOK = ScreenSize.isPointOnScreen(topCorner);
|
||||
// some weird stuff going down whereby the screen position is
|
||||
// given as -8 from the corner where it really it. this can return
|
||||
// false and then push the display onto a different monitor, so alow for this.
|
||||
if (posOK == false) {
|
||||
topCorner.x += 10;
|
||||
topCorner.y += 10;
|
||||
posOK = ScreenSize.isPointOnScreen(topCorner);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (!posOK) {
|
||||
@ -1657,10 +1666,10 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
|
||||
protected void getGuiParameters() {
|
||||
guiParameters.extendedState = frame.getExtendedState();
|
||||
guiParameters.state = frame.getState();
|
||||
if (guiParameters.state != Frame.MAXIMIZED_BOTH) {
|
||||
// if (guiParameters.state != Frame.MAXIMIZED_BOTH) {
|
||||
guiParameters.size = frame.getSize();
|
||||
guiParameters.bounds = frame.getBounds();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1976,5 +1985,29 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
|
||||
return this.mainTab;
|
||||
}
|
||||
|
||||
/**
|
||||
* find a parent window for a JComponent. This can be useful in
|
||||
* finding windows to open child dialogs when the object holding
|
||||
* the component may not have a direct reference back to it's dialog.
|
||||
* @param component any Swing component
|
||||
* @return parent Window (or frame) if it can be found
|
||||
*/
|
||||
public static Window findComponentWindow(JComponent component) {
|
||||
if (component == null) {
|
||||
return null;
|
||||
}
|
||||
JRootPane root = component.getRootPane();
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
Container rootP = root.getParent();
|
||||
if (rootP instanceof Window) {
|
||||
return (Window) rootP;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -6,16 +6,20 @@ import PamguardMVC.PamProcess;
|
||||
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
|
||||
import PamguardMVC.dataSelector.DataSelectorCreator;
|
||||
import RightWhaleEdgeDetector.datasel.RWDataSelCreator;
|
||||
import RightWhaleEdgeDetector.species.RWSpeciesManager;
|
||||
import pamScrollSystem.ViewLoadObserver;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
import whistlesAndMoans.AbstractWhistleDataBlock;
|
||||
|
||||
public class RWEDataBlock extends AbstractWhistleDataBlock implements GroupedDataSource {
|
||||
public class RWEDataBlock extends AbstractWhistleDataBlock<RWEDataUnit> implements GroupedDataSource {
|
||||
|
||||
private double[] rwFreqRange = {50., 250.};
|
||||
private RWEControl rweControl;
|
||||
private RWEProcess rweProcess;
|
||||
private RWDataSelCreator dataSelCreator;
|
||||
|
||||
private RWSpeciesManager rwSpeciesManager;
|
||||
|
||||
public RWEDataBlock(RWEControl rweControl, String dataName,
|
||||
RWEProcess rweProcess, int channelMap) {
|
||||
super(RWEDataUnit.class, dataName, rweProcess, channelMap);
|
||||
@ -53,4 +57,12 @@ public class RWEDataBlock extends AbstractWhistleDataBlock implements GroupedDat
|
||||
return dataSelCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesManager<RWEDataUnit> getDatablockSpeciesManager() {
|
||||
if (rwSpeciesManager == null) {
|
||||
rwSpeciesManager = new RWSpeciesManager(this);
|
||||
}
|
||||
return rwSpeciesManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
26
src/RightWhaleEdgeDetector/species/RWSpeciesManager.java
Normal file
26
src/RightWhaleEdgeDetector/species/RWSpeciesManager.java
Normal file
@ -0,0 +1,26 @@
|
||||
package RightWhaleEdgeDetector.species;
|
||||
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import RightWhaleEdgeDetector.RWEDataUnit;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
import tethys.species.DataBlockSpeciesTypes;
|
||||
|
||||
public class RWSpeciesManager extends DataBlockSpeciesManager<RWEDataUnit> {
|
||||
|
||||
private RWSpeciesTypes rwSpeciesTypes = new RWSpeciesTypes();
|
||||
|
||||
public RWSpeciesManager(PamDataBlock<RWEDataUnit> dataBlock) {
|
||||
super(dataBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesTypes getSpeciesTypes() {
|
||||
return rwSpeciesTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeciesString(RWEDataUnit dataUnit) {
|
||||
return RWSpeciesTypes.onlyType;
|
||||
}
|
||||
|
||||
}
|
15
src/RightWhaleEdgeDetector/species/RWSpeciesTypes.java
Normal file
15
src/RightWhaleEdgeDetector/species/RWSpeciesTypes.java
Normal file
@ -0,0 +1,15 @@
|
||||
package RightWhaleEdgeDetector.species;
|
||||
|
||||
import tethys.species.DataBlockSpeciesTypes;
|
||||
|
||||
public class RWSpeciesTypes extends DataBlockSpeciesTypes {
|
||||
|
||||
public static final String onlyType = "Up call";
|
||||
|
||||
private static final int glacialis = 180536;
|
||||
|
||||
public RWSpeciesTypes() {
|
||||
super(glacialis, onlyType);
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,8 @@ import clickDetector.ClickDataBlock;
|
||||
import clickDetector.ClickDetection;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
import tethys.species.DataBlockSpeciesTypes;
|
||||
import tethys.species.ITISTypes;
|
||||
import tethys.species.SpeciesMapItem;
|
||||
|
||||
public class ClickBlockSpeciesManager extends DataBlockSpeciesManager<ClickDetection> {
|
||||
|
||||
@ -13,6 +15,8 @@ public class ClickBlockSpeciesManager extends DataBlockSpeciesManager<ClickDetec
|
||||
public ClickBlockSpeciesManager(ClickControl clickControl, ClickDataBlock clickDataBlock) {
|
||||
super(clickDataBlock);
|
||||
this.clickControl = clickControl;
|
||||
setDefaultDefaultSpecies(new SpeciesMapItem(ITISTypes.UNKNOWN, "Unknown", "Unknown"));
|
||||
setDefaultName("Unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -22,14 +26,27 @@ public class ClickBlockSpeciesManager extends DataBlockSpeciesManager<ClickDetec
|
||||
return null;
|
||||
}
|
||||
String[] speciesList = masterManager.getSpeciesList();
|
||||
// add the default
|
||||
String[] fullList = new String[speciesList.length+1];
|
||||
fullList[0] = getDefaultName();
|
||||
for (int i = 0; i < speciesList.length; i++) {
|
||||
fullList[i+1] = speciesList[i];
|
||||
}
|
||||
|
||||
return new DataBlockSpeciesTypes(speciesList);
|
||||
return new DataBlockSpeciesTypes("Click", fullList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeciesString(ClickDetection dataUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
ClickTypeMasterManager masterManager = clickControl.getClickTypeMasterManager();
|
||||
if (masterManager == null) {
|
||||
return null;
|
||||
}
|
||||
int listIndex = masterManager.codeToListIndex(dataUnit.getClickType());
|
||||
if (listIndex < 0) {
|
||||
return null;
|
||||
}
|
||||
return masterManager.getSpeciesList()[listIndex];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import tethys.species.ITISFunctions;
|
||||
import tethys.swing.ProjectDeploymentsDialog;
|
||||
import tethys.swing.TethysTabPanel;
|
||||
import tethys.swing.XMLStringView;
|
||||
import tethys.swing.documents.TethysDocumentsFrame;
|
||||
|
||||
/**
|
||||
* Quick play with a simple system for outputting data to Tethys. At it's start
|
||||
@ -284,8 +285,23 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
|
||||
* open client in the default web browser
|
||||
*/
|
||||
public void openTethysCollection(String collectionName) {
|
||||
if (collectionName == null) {
|
||||
return;
|
||||
}
|
||||
if (getTethysExportParams().listDocsInPamguard && collectionName.equals("Client") == false) {
|
||||
openCollectionInPAMGuard(collectionName);
|
||||
}
|
||||
else {
|
||||
openCollectionInBrowser(collectionName);
|
||||
}
|
||||
}
|
||||
public void openCollectionInPAMGuard(String collectionName) {
|
||||
TethysDocumentsFrame.showTable(getGuiFrame(), this, collectionName);
|
||||
}
|
||||
|
||||
public void openCollectionInBrowser(String collectionName) {
|
||||
String urlString = tethysExportParams.getFullServerName() + "/" + collectionName;
|
||||
System.out.println("Opening url " + urlString);
|
||||
// System.out.println("Opening url " + urlString);
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
|
@ -67,6 +67,7 @@ public class TethysTimeFuncs {
|
||||
try {
|
||||
date = df.parse(gregorianString);
|
||||
} catch (ParseException e) {
|
||||
System.out.printf("Unparsable date string:\"%s\"", gregorianString);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ public class DBXMLConnect {
|
||||
this.tethysControl = tethysControl;
|
||||
|
||||
checkTempFolder();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,6 +62,7 @@ public class DBXMLConnect {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the client. The client will only be recreated if the url changes
|
||||
* @return Jersy client
|
||||
|
@ -145,6 +145,77 @@ public class DBXMLQueries {
|
||||
return new DBQueryResult(System.currentTimeMillis()-t1, queryResult, schemaPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether or not to strip of the s of one of the collection names.
|
||||
* This is caused by some daft thing whereby the Deployments colleciton is called Deployments
|
||||
* byt the Detections collection is called Detection
|
||||
* @param collection
|
||||
* @return
|
||||
*/
|
||||
public String checkCollectionPlural(String collection) {
|
||||
switch (collection) {
|
||||
case "Deployments":
|
||||
return "Deployment";
|
||||
case "Localizations":
|
||||
return "Localize";
|
||||
case "Calibrations":
|
||||
return "Calibration";
|
||||
case "SpeciesAbbreviations":
|
||||
return "SpeciesAbbreviations";
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all documents in a collection.
|
||||
* @param collection
|
||||
* @return list of all documents in a collection, or null if no collection.
|
||||
*/
|
||||
public ArrayList<String> getCollectionDocumentList(String collection) {
|
||||
if (collection == null) {
|
||||
return null;
|
||||
}
|
||||
collection = checkCollectionPlural(collection);
|
||||
// if (collection.endsWith("s")) {
|
||||
// collection = collection.substring(0, collection.length()-1);
|
||||
// }
|
||||
String baseQuery = "{\"return\":[\"COLLECTIONNAME/Id\"],\"select\":[],\"enclose\":1}";
|
||||
baseQuery = baseQuery.replace("COLLECTIONNAME", collection);
|
||||
String tagName = "Id";
|
||||
|
||||
if (collection.equals("SpeciesAbbreviations")) {
|
||||
baseQuery = "{\"return\":[\"Abbreviations/Name\"],\"select\":[],\"enclose\":1}";
|
||||
tagName = "Name";
|
||||
}
|
||||
|
||||
DBQueryResult result;
|
||||
try {
|
||||
result = executeQuery(baseQuery);
|
||||
} catch (TethysQueryException e) {
|
||||
System.out.println("Error with query: " + baseQuery);
|
||||
tethysControl.showException(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (result == null || result.queryResult == null) {
|
||||
return null;
|
||||
}
|
||||
Document doc = convertStringToXMLDocument(result.queryResult);
|
||||
if (doc == null) {
|
||||
return null;
|
||||
}
|
||||
NodeList returns = doc.getElementsByTagName(tagName);
|
||||
ArrayList<String> docIds = new ArrayList<>();
|
||||
int n = returns.getLength();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Node aNode = returns.item(i);
|
||||
String docId = aNode.getTextContent();
|
||||
docIds.add(docId);
|
||||
}
|
||||
|
||||
return docIds;
|
||||
}
|
||||
|
||||
public ArrayList<String> getProjectNames() {
|
||||
|
||||
String projectQuery = "{\"return\":[\"Deployment/Project\"],\"select\":[],\"enclose\":1}";
|
||||
@ -644,10 +715,13 @@ public class DBXMLQueries {
|
||||
if (nodeList == null || nodeList.getLength() == 0) {
|
||||
return null;
|
||||
}
|
||||
Node firstNode = nodeList.item(0);
|
||||
if (firstNode instanceof Element) {
|
||||
root = (Element) firstNode;
|
||||
break;
|
||||
int count = nodeList.getLength();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Node firstNode = nodeList.item(i);
|
||||
if (firstNode instanceof Element) {
|
||||
root = (Element) firstNode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return root.getTextContent();
|
||||
|
@ -455,8 +455,11 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
public long getDeploymentOverlap(PDeployment aDeployment, RecordingPeriod aPeriod) {
|
||||
long start = aPeriod.getRecordStart(); // recording period.
|
||||
long stop = aPeriod.getRecordStop();
|
||||
long depStart = aDeployment.getAudioStart();
|
||||
long depStop = aDeployment.getAudioEnd();
|
||||
Long depStart = aDeployment.getAudioStart();
|
||||
Long depStop = aDeployment.getAudioEnd();
|
||||
if (depStart == null || depStop == null) {
|
||||
return -1;
|
||||
}
|
||||
long overlap = (Math.min(stop, depStop)-Math.max(start, depStart));
|
||||
return overlap;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class PDeployment {
|
||||
|
||||
public Long getAudioStart() {
|
||||
DeploymentRecoveryDetails detail = deployment.getDeploymentDetails();
|
||||
if (detail == null) {
|
||||
if (detail == null || detail.getAudioTimeStamp() == null) {
|
||||
return null;
|
||||
}
|
||||
return TethysTimeFuncs.millisFromGregorianXML(detail.getAudioTimeStamp());
|
||||
@ -31,7 +31,7 @@ public class PDeployment {
|
||||
|
||||
public Long getAudioEnd() {
|
||||
DeploymentRecoveryDetails detail = deployment.getRecoveryDetails();
|
||||
if (detail == null) {
|
||||
if (detail == null || detail.getAudioTimeStamp() == null) {
|
||||
return null;
|
||||
}
|
||||
return TethysTimeFuncs.millisFromGregorianXML(detail.getAudioTimeStamp());
|
||||
@ -52,7 +52,13 @@ public class PDeployment {
|
||||
}
|
||||
|
||||
public String getShortDescription() {
|
||||
return String.format("%s %s", deployment.getId(), PamCalendar.formatDBDate(getAudioStart()));
|
||||
Long audioStart = getAudioStart();
|
||||
if (audioStart == null) {
|
||||
return String.format("%s %s", deployment.getId(), "unknown start");
|
||||
}
|
||||
else {
|
||||
return String.format("%s %s", deployment.getId(), PamCalendar.formatDBDate(getAudioStart()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +38,8 @@ public class TethysExportParams implements Serializable, Cloneable{
|
||||
*/
|
||||
private String datasetName;
|
||||
|
||||
public boolean listDocsInPamguard;
|
||||
|
||||
/**
|
||||
* @return the datasetName
|
||||
*/
|
||||
|
@ -16,6 +16,10 @@ abstract public class DataBlockSpeciesManager<T extends PamDataUnit> {
|
||||
|
||||
private PamDataBlock<T> dataBlock;
|
||||
|
||||
private String defaultName = null;
|
||||
|
||||
private SpeciesMapItem defaultDefaultSpecies = null;
|
||||
|
||||
public abstract DataBlockSpeciesTypes getSpeciesTypes();
|
||||
|
||||
public abstract String getSpeciesString(T dataUnit);
|
||||
@ -29,7 +33,7 @@ abstract public class DataBlockSpeciesManager<T extends PamDataUnit> {
|
||||
public SpeciesMapItem getSpeciesItem(T dataUnit) {
|
||||
String speciesString = getSpeciesString(dataUnit);
|
||||
if (speciesString == null) {
|
||||
return null;
|
||||
return getDefaultDefaultSpecies();
|
||||
}
|
||||
DataBlockSpeciesMap speciesMap = getDatablockSpeciesMap();
|
||||
if (speciesMap == null) {
|
||||
@ -41,10 +45,18 @@ abstract public class DataBlockSpeciesManager<T extends PamDataUnit> {
|
||||
public DataBlockSpeciesMap getDatablockSpeciesMap() {
|
||||
if (datablockSpeciesMap == null) {
|
||||
datablockSpeciesMap = new DataBlockSpeciesMap();
|
||||
checkMapDefault();
|
||||
}
|
||||
return datablockSpeciesMap;
|
||||
}
|
||||
|
||||
private void checkMapDefault() {
|
||||
SpeciesMapItem defaultItem = datablockSpeciesMap.getItem(getDefaultName());
|
||||
if (defaultItem == null) {
|
||||
datablockSpeciesMap.putItem(getDefaultName(), getDefaultDefaultSpecies());
|
||||
}
|
||||
}
|
||||
|
||||
public void setDatablockSpeciesMap(DataBlockSpeciesMap datablockSpeciesMap) {
|
||||
this.datablockSpeciesMap = datablockSpeciesMap;
|
||||
}
|
||||
@ -59,4 +71,32 @@ abstract public class DataBlockSpeciesManager<T extends PamDataUnit> {
|
||||
public PamDataBlock<T> getDataBlock() {
|
||||
return dataBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the defaultSpecies
|
||||
*/
|
||||
public SpeciesMapItem getDefaultDefaultSpecies() {
|
||||
return defaultDefaultSpecies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultSpecies the defaultSpecies to set
|
||||
*/
|
||||
public void setDefaultDefaultSpecies(SpeciesMapItem defaultDefaultSpecies) {
|
||||
this.defaultDefaultSpecies = defaultDefaultSpecies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the defaultName
|
||||
*/
|
||||
public String getDefaultName() {
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultName the defaultName to set
|
||||
*/
|
||||
public void setDefaultName(String defaultName) {
|
||||
this.defaultName = defaultName;
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,44 @@ import java.util.ArrayList;
|
||||
public class DataBlockSpeciesTypes {
|
||||
|
||||
/**
|
||||
* List of species names / codes associated with this data block.
|
||||
* List of species names / codes associated with this data block. These can be translated,
|
||||
* via a HashMap to more detailed objects which include an ITIS code.
|
||||
*/
|
||||
private ArrayList<String> speciesNames;
|
||||
|
||||
/**
|
||||
* Probably only to be used when there are no defined names, but helpful if it's set.
|
||||
*/
|
||||
private int itisDefault = ITISTypes.UNKNOWN;
|
||||
|
||||
/**
|
||||
* A default sound type, which can be used for all 'species', but can get
|
||||
* overridden in other scenarios. e.g. 'Click', 'Whistle'
|
||||
*/
|
||||
private String defaultType;
|
||||
|
||||
/**
|
||||
* @param defaultType
|
||||
*/
|
||||
public DataBlockSpeciesTypes(String defaultType) {
|
||||
this.defaultType = defaultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itisDefault
|
||||
* @param defaultType
|
||||
*/
|
||||
public DataBlockSpeciesTypes(int itisDefault, String defaultType) {
|
||||
this.itisDefault = itisDefault;
|
||||
this.defaultType = defaultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor to use with a array of String names.
|
||||
* @param speciesList
|
||||
*/
|
||||
public DataBlockSpeciesTypes(String[] speciesList) {
|
||||
public DataBlockSpeciesTypes(String defaultType, String[] speciesList) {
|
||||
this.defaultType = defaultType;
|
||||
if (speciesList == null) {
|
||||
speciesNames = new ArrayList<>();
|
||||
}
|
||||
@ -39,5 +68,40 @@ public class DataBlockSpeciesTypes {
|
||||
return speciesNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itisDefault
|
||||
*/
|
||||
public int getItisDefault() {
|
||||
return itisDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itisDefault the itisDefault to set
|
||||
*/
|
||||
public void setItisDefault(int itisDefault) {
|
||||
this.itisDefault = itisDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the defaultType
|
||||
*/
|
||||
public String getDefaultType() {
|
||||
return defaultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultType the defaultType to set
|
||||
*/
|
||||
public void setDefaultType(String defaultType) {
|
||||
this.defaultType = defaultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param speciesNames the speciesNames to set
|
||||
*/
|
||||
public void setSpeciesNames(ArrayList<String> speciesNames) {
|
||||
this.speciesNames = speciesNames;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
22
src/tethys/species/ITISTypes.java
Normal file
22
src/tethys/species/ITISTypes.java
Normal file
@ -0,0 +1,22 @@
|
||||
package tethys.species;
|
||||
|
||||
/**
|
||||
* Some MR defined ITIS codes for non animal sounds.
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class ITISTypes {
|
||||
|
||||
public static final int UNKNOWN = 0;
|
||||
public static final int ANTHROPOGENIC = -10;
|
||||
|
||||
public static final String getName(int code) {
|
||||
switch (code) {
|
||||
case UNKNOWN:
|
||||
return "Unknown";
|
||||
case ANTHROPOGENIC:
|
||||
return "Anthropogenic";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,5 +1,15 @@
|
||||
package tethys.species;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import PamController.settings.output.xml.PamguardXMLWriter;
|
||||
import dbxml.JerseyClient;
|
||||
import dbxml.Queries;
|
||||
import tethys.dbxml.DBQueryResult;
|
||||
@ -66,26 +76,62 @@ public class SpeciesTest {
|
||||
private void runXQuery() {
|
||||
System.out.println("Running runXQuery()");
|
||||
String queryBase = "count(collection(\"Detections\")/Detections[Id=\"ReplaceDocumentId\"]/OnEffort/Detection)";
|
||||
String xQ = "collection(\"ITIS_ranks\")/ty:ranks/ty:rank[dbxml:contains(ty:completename, \"Physeter\")]";
|
||||
// String xQ = "collection(\"ITIS_ranks\")/ty:ranks/ty:rank[dbxml:contains(ty:completename, \"Physeter\")]";
|
||||
|
||||
// String xQ = "<Result xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> {\r\n"
|
||||
// + " for $Deployment0 in collection(\"Deployments\")/Deployment[Project = \"BM\"]\r\n"
|
||||
// + " return\r\n"
|
||||
// + " <Deployment>{\r\n"
|
||||
// + " $Deployment0/Id\r\n"
|
||||
// + " }</Deployment>\r\n"
|
||||
// + "} </Result>";
|
||||
|
||||
String xQ = "<Result xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> {\r\n"
|
||||
+ " for $rank0 in collection(\"ITIS_ranks\")/rank[tsn = \"180488\"]\r\n"
|
||||
+ " return\r\n"
|
||||
+ " <rank>{\r\n"
|
||||
+ " $rank0/completename\r\n"
|
||||
+ " }</rank>\r\n"
|
||||
+ "} </Result>";
|
||||
|
||||
|
||||
JerseyClient jerseyClient = new JerseyClient(uri);
|
||||
Queries queries = new Queries(jerseyClient);
|
||||
|
||||
String result = null;
|
||||
String queryResult = null;
|
||||
try {
|
||||
result = queries.QueryTethys(xQ);
|
||||
queryResult = queries.QueryTethys(xQ);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(result);
|
||||
//API to obtain DOM Document instance
|
||||
DocumentBuilder builder = null;
|
||||
Document doc = null;
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
//Create DocumentBuilder with default configuration
|
||||
builder = factory.newDocumentBuilder();
|
||||
|
||||
//Parse the content to Document object
|
||||
doc = builder.parse(new InputSource(new StringReader(queryResult)));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println(queryResult);
|
||||
}
|
||||
// PAMGuardXMLPreview xmlPreview = new PAMGuardXMLPreview(null, "returned", qResult.queryResult)
|
||||
PamguardXMLWriter pamXMLWriter = PamguardXMLWriter.getXMLWriter();
|
||||
String fDoc = pamXMLWriter.getAsString(doc, true);
|
||||
System.out.println(fDoc);
|
||||
// System.out.println(queryResult);
|
||||
|
||||
}
|
||||
private void runJson() {
|
||||
// String jQ = "{\"return\":[\"Deployment\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Deployment/Project\",\"DCLDE2022\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"=\",\"operands\":[\"ranks/rank/tsn\",\"180488\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
// String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"=\",\"operands\":[\"ranks/rank/completename\",\"Mesoplodon\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
// String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"dbxml:contains\",\"operands\":[\"ranks/rank/completename\",\"Mesoplodon\"],\"optype\":\"function\"}],\"enclose\":1}";
|
||||
// String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"=\",\"operands\":[\"ranks/rank/tsn\",\"180488\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"=\",\"operands\":[\"ranks/rank/tsn\",\"180488\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
// String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"=\",\"operands\":[\"ranks/rank/completename\",\"Physeter macrocephalus\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||
// String jQ = "{\"return\":[\"ranks/rank\"],\"select\":[{\"op\":\"dbxml:contains\",\"operands\":[\"ranks/rank/completename\",\"Sperm\"],\"optype\":\"function\"}],\"enclose\":1}";
|
||||
|
||||
System.out.println(jQ);
|
||||
|
||||
@ -103,7 +149,26 @@ public class SpeciesTest {
|
||||
}
|
||||
long t2 = System.nanoTime();
|
||||
System.out.printf("Query time was %3.1fms\n" , (double) (t2-t1)/1e6);
|
||||
System.out.println(queryResult);
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
||||
//API to obtain DOM Document instance
|
||||
DocumentBuilder builder = null;
|
||||
Document doc = null;
|
||||
try {
|
||||
//Create DocumentBuilder with default configuration
|
||||
builder = factory.newDocumentBuilder();
|
||||
|
||||
//Parse the content to Document object
|
||||
doc = builder.parse(new InputSource(new StringReader(queryResult)));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println(queryResult);
|
||||
}
|
||||
// PAMGuardXMLPreview xmlPreview = new PAMGuardXMLPreview(null, "returned", qResult.queryResult)
|
||||
PamguardXMLWriter pamXMLWriter = PamguardXMLWriter.getXMLWriter();
|
||||
String fDoc = pamXMLWriter.getAsString(doc, true);
|
||||
System.out.println(fDoc);
|
||||
// System.out.println(queryResult);
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,16 @@ public class DataBlockSpeciesDialog extends PamDialog {
|
||||
speciesPanel = new DataBlockSpeciesPanel(dataBlock);
|
||||
mainPanel.add(BorderLayout.CENTER, speciesPanel.getDialogComponent());
|
||||
JButton itisButton = new JButton("Go to ITIS web site");
|
||||
itisButton.setToolTipText("Go to ITIS website to search for species codes");
|
||||
itisButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gotoITIS();
|
||||
}
|
||||
});
|
||||
mainPanel.add(BorderLayout.NORTH, itisButton);
|
||||
JPanel nPanel = new JPanel(new BorderLayout());
|
||||
nPanel.add(BorderLayout.EAST, itisButton);
|
||||
mainPanel.add(BorderLayout.NORTH, nPanel);
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class SpeciesSubPanel {
|
||||
commonName.setText(null);
|
||||
return;
|
||||
}
|
||||
pamguardName.setText(speciesMapItem.getPamguardName());
|
||||
pamguardName.setText("\"" + speciesMapItem.getPamguardName() + "\"");
|
||||
itisCode.setText(String.format("%d", speciesMapItem.getItisCode()));
|
||||
callType.setText(speciesMapItem.getCallType());
|
||||
latinName.setText(speciesMapItem.getLatinName());
|
||||
|
@ -8,9 +8,11 @@ import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
@ -31,11 +33,14 @@ public class FancyClientButton extends JPanel {
|
||||
private JButton dropButton;
|
||||
private JPopupMenu collectionsMenu;
|
||||
private TethysControl tethysControl;
|
||||
private JCheckBoxMenuItem showBrowser;
|
||||
private AbstractButton showPAMGuard;
|
||||
|
||||
|
||||
public FancyClientButton(TethysControl tethysControl) {
|
||||
this.tethysControl = tethysControl;
|
||||
setLayout(new GridBagLayout());
|
||||
// setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
// setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.ipadx = c.ipady = 0;
|
||||
c.insets = new Insets(0,0,0,0);
|
||||
@ -44,8 +49,8 @@ public class FancyClientButton extends JPanel {
|
||||
clientButton.setToolTipText("Open Tethys web client in default browser");
|
||||
ImageIcon arrowDown= null;
|
||||
try {
|
||||
arrowDown = new ImageIcon(ClassLoader
|
||||
.getSystemResource("Resources/SidePanelShowH.png"));
|
||||
arrowDown = new ImageIcon(ClassLoader
|
||||
.getSystemResource("Resources/SidePanelShowH.png"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
@ -68,6 +73,32 @@ public class FancyClientButton extends JPanel {
|
||||
|
||||
String[] collections = DBXMLConnect.collections;
|
||||
collectionsMenu = new JPopupMenu();
|
||||
boolean isP = tethysControl.getTethysExportParams().listDocsInPamguard;
|
||||
showBrowser = new JCheckBoxMenuItem("Show in Browser", isP == false);
|
||||
showBrowser.setEnabled(isP);
|
||||
showBrowser.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
tethysControl.getTethysExportParams().listDocsInPamguard = false;
|
||||
enableItems();
|
||||
}
|
||||
});
|
||||
showBrowser.setToolTipText("Show collection in default Web Browser");
|
||||
collectionsMenu.add(showBrowser);
|
||||
showPAMGuard = new JCheckBoxMenuItem("Show in PAMGuard", isP);
|
||||
showPAMGuard.setEnabled(isP == false);
|
||||
showPAMGuard.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
tethysControl.getTethysExportParams().listDocsInPamguard = true;
|
||||
enableItems();
|
||||
}
|
||||
});
|
||||
showPAMGuard.setToolTipText("Show collection in PAMGuard window");
|
||||
collectionsMenu.add(showPAMGuard);
|
||||
|
||||
collectionsMenu.addSeparator();
|
||||
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
JMenuItem menuItem = new JMenuItem(collections[i]);
|
||||
menuItem.addActionListener(new OpenCollection(collections[i]));
|
||||
@ -80,6 +111,15 @@ public class FancyClientButton extends JPanel {
|
||||
collectionsMenu.show(dropButton, 0, 0);
|
||||
}
|
||||
});
|
||||
enableItems();
|
||||
}
|
||||
|
||||
protected void enableItems() {
|
||||
boolean isP = tethysControl.getTethysExportParams().listDocsInPamguard;
|
||||
showBrowser.setSelected(!isP);
|
||||
showBrowser.setEnabled(true);
|
||||
showPAMGuard.setSelected(isP);
|
||||
showPAMGuard.setEnabled(true);
|
||||
}
|
||||
|
||||
public void addActionListener(ActionListener actionListener) {
|
||||
|
196
src/tethys/swing/documents/TethysDocumentTable.java
Normal file
196
src/tethys/swing/documents/TethysDocumentTable.java
Normal file
@ -0,0 +1,196 @@
|
||||
package tethys.swing.documents;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import PamView.dialog.PamDialogPanel;
|
||||
import PamView.tables.SwingTableColumnWidths;
|
||||
import tethys.TethysControl;
|
||||
|
||||
/**
|
||||
* Table view of a collection of Tethys documents.
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class TethysDocumentTable implements PamDialogPanel {
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
private String collectionName;
|
||||
|
||||
private JTable mainTable;
|
||||
|
||||
private TableModel tableModel;
|
||||
|
||||
private ArrayList<String> documentNames;
|
||||
|
||||
private JPanel mainPanel;
|
||||
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
/**
|
||||
* @param tethysControl
|
||||
* @param collectionName
|
||||
*/
|
||||
public TethysDocumentTable(TethysControl tethysControl, String collectionName) {
|
||||
this.tethysControl = tethysControl;
|
||||
mainPanel = new JPanel(new BorderLayout());
|
||||
tableModel = new TableModel();
|
||||
mainTable = new JTable(tableModel);
|
||||
scrollPane = new JScrollPane(mainTable);
|
||||
mainPanel.add(BorderLayout.CENTER, scrollPane);
|
||||
new SwingTableColumnWidths(tethysControl.getUnitName()+"TethysDocumentsTable", mainTable);
|
||||
this.setCollectionName(collectionName);
|
||||
mainTable.addMouseListener(new TableMouse());
|
||||
}
|
||||
|
||||
public void updateTableData() {
|
||||
documentNames = tethysControl.getDbxmlQueries().getCollectionDocumentList(collectionName);
|
||||
if (documentNames != null) {
|
||||
Collections.sort(documentNames);
|
||||
}
|
||||
tableModel.fireTableDataChanged();
|
||||
}
|
||||
|
||||
private class TableMouse extends MouseAdapter {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
showPopupMenu(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
showPopupMenu(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showPopupMenu(MouseEvent e) {
|
||||
if (documentNames == null) {
|
||||
return;
|
||||
}
|
||||
int row = mainTable.getSelectedRow();
|
||||
if (row < 0|| row >= documentNames.size()) {
|
||||
return;
|
||||
}
|
||||
String docName = documentNames.get(row);
|
||||
JPopupMenu popMenu = new JPopupMenu();
|
||||
JMenuItem menuItem = new JMenuItem("Show document " + docName);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showDocument(docName);
|
||||
}
|
||||
});
|
||||
popMenu.add(menuItem);
|
||||
menuItem = new JMenuItem("Delete document " + docName);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
deleteDocument(docName);
|
||||
}
|
||||
});
|
||||
popMenu.add(menuItem);
|
||||
|
||||
popMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
|
||||
private void showDocument(String docName) {
|
||||
tethysControl.displayDocument(collectionName, docName);
|
||||
}
|
||||
|
||||
private void deleteDocument(String docName) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private class TableModel extends AbstractTableModel {
|
||||
|
||||
private String[] columnNames = {"", "Document Id/Name"};
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
if (documentNames == null) {
|
||||
return 0;
|
||||
}
|
||||
return documentNames.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return columnNames.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
if (documentNames == null) {
|
||||
return null;
|
||||
}
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return rowIndex+1;
|
||||
case 1:
|
||||
return documentNames.get(rowIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
return columnNames[column];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public JComponent getDialogComponent() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collectionName
|
||||
*/
|
||||
public String getCollectionName() {
|
||||
return collectionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionName the collectionName to set
|
||||
*/
|
||||
public void setCollectionName(String collectionName) {
|
||||
this.collectionName = collectionName;
|
||||
updateTableData();
|
||||
}
|
||||
}
|
49
src/tethys/swing/documents/TethysDocumentsFrame.java
Normal file
49
src/tethys/swing/documents/TethysDocumentsFrame.java
Normal file
@ -0,0 +1,49 @@
|
||||
package tethys.swing.documents;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
import PamView.dialog.PamDialog;
|
||||
import tethys.TethysControl;
|
||||
|
||||
public class TethysDocumentsFrame extends PamDialog {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static TethysDocumentsFrame singleInstance;
|
||||
|
||||
private TethysDocumentTable documentsTable;
|
||||
|
||||
private TethysDocumentsFrame(Window parentFrame,TethysControl tethysControl) {
|
||||
super(parentFrame, "Documents", false);
|
||||
documentsTable = new TethysDocumentTable(tethysControl, null);
|
||||
setDialogComponent(documentsTable.getDialogComponent());
|
||||
setModalityType(ModalityType.MODELESS);
|
||||
setResizable(true);
|
||||
getOkButton().setVisible(false);
|
||||
getCancelButton().setText("Close");
|
||||
}
|
||||
|
||||
public static void showTable(Window parentFrame, TethysControl tethysControl, String collectionName) {
|
||||
if (singleInstance == null) {
|
||||
singleInstance = new TethysDocumentsFrame(parentFrame, tethysControl);
|
||||
}
|
||||
singleInstance.documentsTable.setCollectionName(collectionName);
|
||||
singleInstance.setTitle(collectionName + " Documents");
|
||||
singleInstance.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelButtonPressed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreDefaultSettings() {
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +1,21 @@
|
||||
package tethys.swing.export;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Label;
|
||||
import java.awt.Window;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.PamGui;
|
||||
import PamView.dialog.PamDialog;
|
||||
import nilus.DescriptionType;
|
||||
import tethys.niluswraps.PDescriptionType;
|
||||
@ -75,14 +81,15 @@ public class DescriptionTypePanel {
|
||||
}
|
||||
|
||||
public boolean getParams(PDescriptionType description) {
|
||||
Window f = PamGui.findComponentWindow(mainPanel);
|
||||
if (checkField(requireObjective, tObjectives) == false) {
|
||||
return PamDialog.showWarning(null, "Objectives", "The objectives field must be competed");
|
||||
return PamDialog.showWarning(f, "Objectives", "The objectives field must be completed");
|
||||
}
|
||||
if (checkField(requireAbstract, tAbstract) == false) {
|
||||
return PamDialog.showWarning(null, "Abstract", "The abstract field must be competed");
|
||||
return PamDialog.showWarning(f, "Abstract", "The abstract field must be completed");
|
||||
}
|
||||
if (checkField(requireMethod, tMethod) == false) {
|
||||
return PamDialog.showWarning(null, "Method", "The method field must be competed");
|
||||
return PamDialog.showWarning(f, "Method", "The method field must be completed");
|
||||
}
|
||||
|
||||
description.setObjectives(tObjectives.getText());
|
||||
|
@ -2,6 +2,7 @@ package whistlesAndMoans;
|
||||
|
||||
import whistlesAndMoans.alarm.WMAlarmCounterProvider;
|
||||
import whistlesAndMoans.dataSelector.WMDDataSelectCreator;
|
||||
import whistlesAndMoans.species.WhistleSpeciesManager;
|
||||
import whistlesAndMoans.toad.WSLToadCalculator;
|
||||
import PamView.GroupedDataSource;
|
||||
import PamView.GroupedSourceParameters;
|
||||
@ -10,14 +11,16 @@ import PamguardMVC.dataSelector.DataSelectorCreator;
|
||||
import PamguardMVC.toad.TOADCalculator;
|
||||
import alarm.AlarmCounterProvider;
|
||||
import alarm.AlarmDataSource;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
|
||||
public class ConnectedRegionDataBlock extends AbstractWhistleDataBlock implements AlarmDataSource, GroupedDataSource, FFTDataHolderBlock {
|
||||
public class ConnectedRegionDataBlock extends AbstractWhistleDataBlock<ConnectedRegionDataUnit> implements AlarmDataSource, GroupedDataSource, FFTDataHolderBlock {
|
||||
|
||||
private WhistleToneConnectProcess parentProcess;
|
||||
private WhistleMoanControl whistleMoanControl;
|
||||
private WMAlarmCounterProvider wmAlarmCounterProvider;
|
||||
private WMDDataSelectCreator dataSelectCreator;
|
||||
private WSLToadCalculator wslToadCalculator;
|
||||
private WhistleSpeciesManager whistleSpeciesManager;
|
||||
|
||||
public ConnectedRegionDataBlock(String dataName,
|
||||
WhistleMoanControl whistleMoanControl, WhistleToneConnectProcess parentProcess, int channelMap) {
|
||||
@ -86,6 +89,14 @@ public class ConnectedRegionDataBlock extends AbstractWhistleDataBlock implement
|
||||
return fftParams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesManager<ConnectedRegionDataUnit> getDatablockSpeciesManager() {
|
||||
if (whistleSpeciesManager == null) {
|
||||
whistleSpeciesManager = new WhistleSpeciesManager(this);
|
||||
}
|
||||
return whistleSpeciesManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
34
src/whistlesAndMoans/species/WhistleSpeciesManager.java
Normal file
34
src/whistlesAndMoans/species/WhistleSpeciesManager.java
Normal file
@ -0,0 +1,34 @@
|
||||
package whistlesAndMoans.species;
|
||||
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
import tethys.species.DataBlockSpeciesTypes;
|
||||
import tethys.species.ITISTypes;
|
||||
import tethys.species.SpeciesMapItem;
|
||||
import whistlesAndMoans.ConnectedRegionDataUnit;
|
||||
|
||||
public class WhistleSpeciesManager extends DataBlockSpeciesManager<ConnectedRegionDataUnit> {
|
||||
|
||||
private String defaultName = "Tonal";
|
||||
|
||||
|
||||
public WhistleSpeciesManager(PamDataBlock<ConnectedRegionDataUnit> dataBlock) {
|
||||
super(dataBlock);
|
||||
setDefaultDefaultSpecies(new SpeciesMapItem(180404, "Tonal", "Odontocete"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesTypes getSpeciesTypes() {
|
||||
String spList[] = {"Unknown"};
|
||||
|
||||
DataBlockSpeciesTypes whistleSpeciesTypes = new DataBlockSpeciesTypes("Tonal", spList);
|
||||
return whistleSpeciesTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeciesString(ConnectedRegionDataUnit dataUnit) {
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user