Omaha #4709 Initial implementation of viz point set resources.
Former-commit-id: 3c8d0990c2eb1f031b23d7c0c5accd92af3196f0
This commit is contained in:
parent
c99eeea94f
commit
0cb0471380
15 changed files with 1140 additions and 1 deletions
7
cave/com.raytheon.uf.viz.pointset/.classpath
Normal file
7
cave/com.raytheon.uf.viz.pointset/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
28
cave/com.raytheon.uf.viz.pointset/.project
Normal file
28
cave/com.raytheon.uf.viz.pointset/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.raytheon.uf.viz.pointset</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
20
cave/com.raytheon.uf.viz.pointset/META-INF/MANIFEST.MF
Normal file
20
cave/com.raytheon.uf.viz.pointset/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: PointSet Visualization
|
||||||
|
Bundle-SymbolicName: com.raytheon.uf.viz.pointset;singleton:=true
|
||||||
|
Bundle-Version: 1.15.0.qualifier
|
||||||
|
Bundle-Vendor: RAYTHEON
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
Require-Bundle: com.raytheon.uf.common.dataplugin.pointset;bundle-version="1.15.0",
|
||||||
|
com.raytheon.uf.viz.core;bundle-version="1.15.1",
|
||||||
|
com.raytheon.uf.common.dataplugin;bundle-version="1.14.0",
|
||||||
|
com.raytheon.uf.common.geospatial;bundle-version="1.15.0",
|
||||||
|
com.raytheon.uf.viz.productbrowser.datalisting;bundle-version="1.15.0",
|
||||||
|
com.raytheon.uf.common.datastorage;bundle-version="1.15.0",
|
||||||
|
com.raytheon.uf.common.colormap;bundle-version="1.15.0",
|
||||||
|
org.eclipse.core.runtime;bundle-version="3.8.0",
|
||||||
|
com.raytheon.uf.viz.drawables.triangulated;bundle-version="1.15.0",
|
||||||
|
com.raytheon.uf.common.style;bundle-version="1.15.0",
|
||||||
|
javax.measure;bundle-version="1.0.0",
|
||||||
|
com.raytheon.uf.common.numeric;bundle-version="1.14.0",
|
||||||
|
com.raytheon.uf.common.util;bundle-version="1.15.0"
|
5
cave/com.raytheon.uf.viz.pointset/build.properties
Normal file
5
cave/com.raytheon.uf.viz.pointset/build.properties
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.,\
|
||||||
|
plugin.xml
|
12
cave/com.raytheon.uf.viz.pointset/plugin.xml
Normal file
12
cave/com.raytheon.uf.viz.pointset/plugin.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
<extension
|
||||||
|
point="com.raytheon.uf.viz.productbrowser.dataDefinition">
|
||||||
|
<dataDefinition
|
||||||
|
class="com.raytheon.uf.viz.pointset.PointSetProductBrowserDataDefinition"
|
||||||
|
name="com.raytheon.uf.viz.pointset.PointSetProductBrowserDataDefinition">
|
||||||
|
</dataDefinition>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</plugin>
|
|
@ -0,0 +1,178 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datalisting.DataListing;
|
||||||
|
import com.raytheon.uf.common.datalisting.impl.DefaultDataListing;
|
||||||
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
|
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||||
|
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetConstants;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
|
import com.raytheon.uf.common.parameter.Parameter;
|
||||||
|
import com.raytheon.uf.common.parameter.lookup.ParameterLookup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@link DataListing} which can format several different pointset elements
|
||||||
|
* nicely.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetDataListing extends DefaultDataListing {
|
||||||
|
|
||||||
|
public PointSetDataListing() throws ReflectiveOperationException {
|
||||||
|
super(PointSetRecord.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointSetDataListing(List<String> keySet) {
|
||||||
|
super(PointSetConstants.POINTSET, keySet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointSetDataListing(Set<String> keySet) {
|
||||||
|
super(PointSetConstants.POINTSET, keySet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, RequestConstraint> getRequestConstraints(Map<String, String> keyVals) {
|
||||||
|
Map<String, RequestConstraint> constraints = super.getRequestConstraints(keyVals);
|
||||||
|
if (keyVals.containsKey(PointSetConstants.LEVEL_ID)) {
|
||||||
|
constraints.remove(PointSetConstants.LEVEL_ID);
|
||||||
|
/*
|
||||||
|
* Convert Level id to level one and level two values so that it is
|
||||||
|
* possible to update using a datauri.
|
||||||
|
*/
|
||||||
|
Level level = LevelFactory.getInstance().getLevel(
|
||||||
|
keyVals.get(PointSetConstants.LEVEL_ID));
|
||||||
|
constraints.put(PointSetConstants.LEVEL_ONE,
|
||||||
|
new RequestConstraint(level.getLevelOneValueAsString()));
|
||||||
|
constraints.put(PointSetConstants.LEVEL_TWO,
|
||||||
|
new RequestConstraint(level.getLevelTwoValueAsString()));
|
||||||
|
constraints.put(PointSetConstants.MASTER_LEVEL_NAME,
|
||||||
|
new RequestConstraint(
|
||||||
|
level.getMasterLevel().getName()));
|
||||||
|
}
|
||||||
|
return constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getFormattedValues(String key, Collection<String> values) {
|
||||||
|
if (PointSetConstants.PARAMETER_ABBREVIATION.equals(key)) {
|
||||||
|
Map<String, String> formatted = new LinkedHashMap<>();
|
||||||
|
ParameterLookup lookup = ParameterLookup.getInstance();
|
||||||
|
for (String value : values) {
|
||||||
|
Parameter p = lookup.getParameter(value);
|
||||||
|
if (p == null || p.getName().isEmpty()) {
|
||||||
|
formatted.put(value, value);
|
||||||
|
} else {
|
||||||
|
formatted.put(value, p.getName() + " (" + value + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sortByValue(formatted);
|
||||||
|
} else if (PointSetConstants.LEVEL_ID.equals(key)) {
|
||||||
|
List<Level> levels = new ArrayList<>(values.size());
|
||||||
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
for (String value : values) {
|
||||||
|
levels.add(lf.getLevel(value));
|
||||||
|
}
|
||||||
|
Collections.sort(levels, levelComparator);
|
||||||
|
Map<String, String> formatted = new LinkedHashMap<>();
|
||||||
|
for (Level level : levels) {
|
||||||
|
String levelName = level.toString().replace("_", "-");
|
||||||
|
levelName = levelName.replace(level.getMasterLevel().getName(), " " + level.getMasterLevel().getName());
|
||||||
|
formatted.put(Long.toString(level.getId()), levelName);
|
||||||
|
}
|
||||||
|
return formatted;
|
||||||
|
} else if (PointSetConstants.MASTER_LEVEL_NAME.equals(key)) {
|
||||||
|
Map<String, String> formatted = new LinkedHashMap<>();
|
||||||
|
LevelFactory lf = LevelFactory.getInstance();
|
||||||
|
for (String value : values) {
|
||||||
|
MasterLevel masterLevel = lf.getMasterLevel(value);
|
||||||
|
formatted.put(masterLevel.getName(), masterLevel.getDescription() + " (" + masterLevel.getName() + ")");
|
||||||
|
}
|
||||||
|
return sortByValue(formatted);
|
||||||
|
}
|
||||||
|
return super.getFormattedValues(key, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, String> sortByValue(Map<String, String> formattedMap) {
|
||||||
|
List<Entry<String, String>> entryList = new ArrayList<>(formattedMap.entrySet());
|
||||||
|
Collections.sort(entryList, sortByValueComparator);
|
||||||
|
Map<String, String> sortedMap = new LinkedHashMap<>();
|
||||||
|
for (Entry<String, String> entry : entryList) {
|
||||||
|
sortedMap.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
return sortedMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Comparator<Entry<String, String>> sortByValueComparator = new Comparator<Entry<String, String>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Entry<String, String> o1, Entry<String, String> o2) {
|
||||||
|
int result = o1.getValue().compareTo(o2.getValue());
|
||||||
|
if (result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return o1.getKey().compareTo(o2.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final Comparator<Level> levelComparator = new Comparator<Level>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Level o1, Level o2) {
|
||||||
|
if (o1.isRangeLevel() == o2.isRangeLevel()) {
|
||||||
|
int val = Double.compare(o1.getLevelonevalue(), o2.getLevelonevalue());
|
||||||
|
if (val == 0) {
|
||||||
|
val = Double.compare(o1.getLeveltwovalue(), o2.getLeveltwovalue());
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
if (o1.isRangeLevel()) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetConstants;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
|
import com.raytheon.uf.viz.pointset.rsc.PointSetResourceData;
|
||||||
|
import com.raytheon.uf.viz.productbrowser.datalisting.DataListingProductBrowserDefinition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Uses the {@link PointSetDataListing} to get metadata for a
|
||||||
|
* {@link PointSetResourceData}.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetProductBrowserDataDefinition extends DataListingProductBrowserDefinition {
|
||||||
|
|
||||||
|
public PointSetProductBrowserDataDefinition() {
|
||||||
|
super(new PointSetDataListing(
|
||||||
|
Arrays.asList(PointSetConstants.DATASET_ID,
|
||||||
|
PointSetConstants.PARAMETER_ABBREVIATION,
|
||||||
|
PointSetConstants.MASTER_LEVEL_NAME,
|
||||||
|
PointSetConstants.LEVEL_ID)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractResourceData createResourceData(Map<String, String> keyVals) {
|
||||||
|
PointSetResourceData resourceData = new PointSetResourceData();
|
||||||
|
Map<String, RequestConstraint> constraints = listing.getRequestConstraints(keyVals);
|
||||||
|
resourceData.setMetadataMap(new HashMap<>(constraints));
|
||||||
|
return resourceData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.image;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.colormap.image.ColorMapData;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||||
|
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||||
|
import com.raytheon.uf.common.datastorage.Request;
|
||||||
|
import com.raytheon.uf.common.datastorage.StorageException;
|
||||||
|
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||||
|
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link IColorMapDataRetrievalCallback} implementation for loading point set
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetDataCallback implements
|
||||||
|
IColorMapDataRetrievalCallback {
|
||||||
|
|
||||||
|
private final PointSetRecord record;
|
||||||
|
|
||||||
|
public PointSetDataCallback(PointSetRecord record) {
|
||||||
|
this.record = record;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ColorMapData getColorMapData() throws VizException {
|
||||||
|
IDataStore store = DataStoreFactory.getDataStore(record
|
||||||
|
.getStoragePath().toFile());
|
||||||
|
try {
|
||||||
|
IDataRecord record = store.retrieve(this.record.getDataURI(),
|
||||||
|
DataStoreFactory.DEF_DATASET_NAME, Request.ALL);
|
||||||
|
float[] data = (float[]) record.getDataObject();
|
||||||
|
return new ColorMapData(FloatBuffer.wrap(data),
|
||||||
|
new int[] { data.length });
|
||||||
|
} catch (StorageException | FileNotFoundException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.image;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.lang.ref.SoftReference;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
|
import org.opengis.referencing.FactoryException;
|
||||||
|
import org.opengis.referencing.operation.TransformException;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetLocation;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.traingulate.DelauneyTriangulator;
|
||||||
|
import com.raytheon.uf.common.datastorage.StorageException;
|
||||||
|
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.drawables.triangulated.ITriangleLocationCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link IColorMapDataRetrievalCallback} implementation for loading point set
|
||||||
|
* location data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetLocationCallback implements
|
||||||
|
ITriangleLocationCallback {
|
||||||
|
|
||||||
|
private final IDescriptor descriptor;
|
||||||
|
|
||||||
|
private final PointSetRecord record;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Kept as soft reference becasue both methods from the interface need the
|
||||||
|
* location but after they are both called we probably won't need it again
|
||||||
|
* so let it get reclaimed when the memory is needed.
|
||||||
|
*/
|
||||||
|
private SoftReference<PointSetLocation> locationRef;
|
||||||
|
|
||||||
|
public PointSetLocationCallback(IDescriptor descriptor,
|
||||||
|
PointSetRecord record) {
|
||||||
|
this.descriptor = descriptor;
|
||||||
|
this.record = record;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PointSetLocation getLocation() throws VizException {
|
||||||
|
PointSetLocation location = null;
|
||||||
|
if (locationRef != null) {
|
||||||
|
location = locationRef.get();
|
||||||
|
}
|
||||||
|
if (location == null) {
|
||||||
|
try {
|
||||||
|
location = PointSetLocation.load(record.getStoragePath()
|
||||||
|
.toFile(), record.getLocationId());
|
||||||
|
} catch (FileNotFoundException | StorageException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double[][] getCoordinates() throws VizException {
|
||||||
|
PointSetLocation location = getLocation();
|
||||||
|
FloatBuffer longitude = location.getLongitudes().duplicate();
|
||||||
|
longitude.rewind();
|
||||||
|
FloatBuffer latitude = location.getLatitudes().duplicate();
|
||||||
|
latitude.rewind();
|
||||||
|
int numPoints = longitude.capacity();
|
||||||
|
|
||||||
|
double[][] coordinates = new double[numPoints][];
|
||||||
|
double[] in = new double[2];
|
||||||
|
for (int i = 0; i < numPoints; i += 1) {
|
||||||
|
in[0] = longitude.get();
|
||||||
|
in[1] = latitude.get();
|
||||||
|
coordinates[i] = descriptor.worldToPixel(in);
|
||||||
|
}
|
||||||
|
return coordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getTriangleIndices() throws VizException {
|
||||||
|
PointSetLocation location = getLocation();
|
||||||
|
IntBuffer triangles = location.getTriangles();
|
||||||
|
if (triangles != null) {
|
||||||
|
return triangles.array();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
triangles = new DelauneyTriangulator(true)
|
||||||
|
.triangulate(location);
|
||||||
|
return triangles.array();
|
||||||
|
} catch (TransformException | FactoryException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.rsc;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||||
|
import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImage;
|
||||||
|
import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImageExtension;
|
||||||
|
import com.raytheon.uf.viz.pointset.image.PointSetDataCallback;
|
||||||
|
import com.raytheon.uf.viz.pointset.image.PointSetLocationCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object responsible for rendering a single frame of point set data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetFrame {
|
||||||
|
|
||||||
|
private static final transient IUFStatusHandler logger = UFStatus
|
||||||
|
.getHandler(PointSetFrame.class);
|
||||||
|
|
||||||
|
private final PointSetRecord record;
|
||||||
|
|
||||||
|
private final PointSetResource resource;
|
||||||
|
|
||||||
|
private ITriangulatedImage image;
|
||||||
|
|
||||||
|
private volatile boolean staged = false;
|
||||||
|
|
||||||
|
public PointSetFrame(PointSetRecord record, PointSetResource resource) {
|
||||||
|
super();
|
||||||
|
this.record = record;
|
||||||
|
this.resource = resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointSetRecord getRecord() {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release any graphics resources associated with this image. This must not
|
||||||
|
* be called concurrently with paint.
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
ITriangulatedImage image = this.image;
|
||||||
|
if (image != null) {
|
||||||
|
image.dispose();
|
||||||
|
}
|
||||||
|
image = null;
|
||||||
|
staged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String inspect(double x, double y) {
|
||||||
|
return image.getDataValue(x, y) + record.getParameter().getUnitString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean paint(PaintProperties paintProps, IGraphicsTarget target)
|
||||||
|
throws VizException {
|
||||||
|
ITriangulatedImage image = this.image;
|
||||||
|
if (image == null) {
|
||||||
|
ColorMapParameters colorMapParameters = resource.getCapability(
|
||||||
|
ColorMapCapability.class).getColorMapParameters();
|
||||||
|
ITriangulatedImageExtension triangleExt = target
|
||||||
|
.getExtension(ITriangulatedImageExtension.class);
|
||||||
|
this.image = triangleExt.initializeImage(colorMapParameters,
|
||||||
|
new PointSetLocationCallback(resource.getDescriptor(),
|
||||||
|
record), new PointSetDataCallback(record));
|
||||||
|
return false;
|
||||||
|
} else if (staged) {
|
||||||
|
ITriangulatedImageExtension triangleExt = target
|
||||||
|
.getExtension(ITriangulatedImageExtension.class);
|
||||||
|
triangleExt.drawImage(paintProps, image);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stage() {
|
||||||
|
ITriangulatedImage image = this.image;
|
||||||
|
if (image == null || staged) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
image.stage();
|
||||||
|
staged = true;
|
||||||
|
resource.issueRefresh();
|
||||||
|
} catch (VizException e) {
|
||||||
|
logger.error("Unable to stage point set data.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,294 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.rsc;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.DoubleBuffer;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
import java.nio.ShortBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.measure.unit.Unit;
|
||||||
|
import javax.measure.unit.UnitFormat;
|
||||||
|
|
||||||
|
import org.opengis.referencing.FactoryException;
|
||||||
|
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||||
|
import org.opengis.referencing.operation.TransformException;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.colormap.ColorMapException;
|
||||||
|
import com.raytheon.uf.common.colormap.ColorMapLoader;
|
||||||
|
import com.raytheon.uf.common.colormap.image.ColorMapData;
|
||||||
|
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
|
||||||
|
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||||
|
import com.raytheon.uf.common.numeric.UnsignedNumbers;
|
||||||
|
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
|
||||||
|
import com.raytheon.uf.common.style.StyleException;
|
||||||
|
import com.raytheon.uf.common.style.StyleManager;
|
||||||
|
import com.raytheon.uf.common.style.StyleManager.StyleType;
|
||||||
|
import com.raytheon.uf.common.style.StyleRule;
|
||||||
|
import com.raytheon.uf.common.style.image.ColorMapParameterFactory;
|
||||||
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
import com.raytheon.uf.common.util.BufferUtil;
|
||||||
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||||
|
import com.raytheon.uf.viz.pointset.image.PointSetDataCallback;
|
||||||
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resource for rendering {@link PointSetRecord} data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetResource extends
|
||||||
|
AbstractVizResource<PointSetResourceData, IMapDescriptor> {
|
||||||
|
|
||||||
|
private final PointSetStageJob stageJob = new PointSetStageJob();
|
||||||
|
|
||||||
|
private Map<DataTime, PointSetFrame> frames = new HashMap<>();
|
||||||
|
|
||||||
|
protected PointSetResource(PointSetResourceData resourceData,
|
||||||
|
LoadProperties loadProperties) {
|
||||||
|
super(resourceData, loadProperties);
|
||||||
|
this.dataTimes = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void resourceDataChanged(ChangeType type, Object updateObject) {
|
||||||
|
if (type == ChangeType.DATA_UPDATE) {
|
||||||
|
for (PluginDataObject pdo : (PluginDataObject[]) updateObject) {
|
||||||
|
addRecord((PointSetRecord) pdo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.resourceDataChanged(type, updateObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColorMapParameters createColorMapParameters(PointSetRecord record)
|
||||||
|
throws VizException {
|
||||||
|
ParamLevelMatchCriteria matchCriteria = new ParamLevelMatchCriteria();
|
||||||
|
matchCriteria.setParameterName(Arrays.asList(record.getParameter()
|
||||||
|
.getAbbreviation()));
|
||||||
|
// TODO convert level to a style level.
|
||||||
|
//matchCriteria.setLevels(new ArrayList<Level>());
|
||||||
|
matchCriteria.setCreatingEntityNames(Arrays.asList(record
|
||||||
|
.getDatasetId()));
|
||||||
|
try {
|
||||||
|
StyleRule styleRule = StyleManager.getInstance().getStyleRule(
|
||||||
|
StyleType.IMAGERY, matchCriteria);
|
||||||
|
if (styleRule != null) {
|
||||||
|
return ColorMapParameterFactory.build(styleRule, record
|
||||||
|
.getParameter().getUnit());
|
||||||
|
} else {
|
||||||
|
ColorMapData data = new PointSetDataCallback(record)
|
||||||
|
.getColorMapData();
|
||||||
|
ColorMapDataType type = data.getDataType();
|
||||||
|
Buffer buffer = BufferUtil.duplicate(data.getBuffer());
|
||||||
|
buffer.rewind();
|
||||||
|
float min = Float.POSITIVE_INFINITY;
|
||||||
|
float max = Float.NEGATIVE_INFINITY;
|
||||||
|
while (buffer.hasRemaining()) {
|
||||||
|
float val = extractVal(type, buffer);
|
||||||
|
if (val < min) {
|
||||||
|
min = val;
|
||||||
|
}
|
||||||
|
if (val > max) {
|
||||||
|
max = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ColorMapParameterFactory.build(min, max,
|
||||||
|
data.getDataUnit(), matchCriteria);
|
||||||
|
}
|
||||||
|
} catch (StyleException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float extractVal(ColorMapDataType type, Buffer buffer)
|
||||||
|
throws VizException {
|
||||||
|
switch (type) {
|
||||||
|
case SIGNED_BYTE:
|
||||||
|
return ((ByteBuffer) buffer).get();
|
||||||
|
case BYTE:
|
||||||
|
return UnsignedNumbers.ubyteToShort(((ByteBuffer) buffer).get());
|
||||||
|
case SHORT:
|
||||||
|
return ((ShortBuffer) buffer).get();
|
||||||
|
case UNSIGNED_SHORT:
|
||||||
|
return UnsignedNumbers.ushortToInt(((ShortBuffer) buffer).get());
|
||||||
|
case INT:
|
||||||
|
return ((IntBuffer) buffer).get();
|
||||||
|
case FLOAT:
|
||||||
|
return ((FloatBuffer) buffer).get();
|
||||||
|
case DOUBLE:
|
||||||
|
return (float) ((DoubleBuffer) buffer).get();
|
||||||
|
default:
|
||||||
|
throw new VizException("Unable to handle data of type: " + type);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addRecord(PointSetRecord record) {
|
||||||
|
synchronized (frames) {
|
||||||
|
if (frames.isEmpty() && getStatus() == ResourceStatus.INITIALIZED) {
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
* Normally this happens in init but this is a fallback if
|
||||||
|
* the resource was inited with no data.
|
||||||
|
*/
|
||||||
|
createColorMapParameters(record);
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.error(
|
||||||
|
"Unable to create color map parameters.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frames.put(record.getDataTime(), new PointSetFrame(record, this));
|
||||||
|
dataTimes.add(record.getDataTime());
|
||||||
|
Collections.sort(dataTimes);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(DataTime dataTime) {
|
||||||
|
synchronized (frames) {
|
||||||
|
PointSetFrame frame = frames.remove(dataTime);
|
||||||
|
frame.dispose();
|
||||||
|
super.remove(dataTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void disposeInternal() {
|
||||||
|
synchronized (frames) {
|
||||||
|
for (PointSetFrame frame : frames.values()) {
|
||||||
|
frame.dispose();
|
||||||
|
}
|
||||||
|
frames.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintInternal(IGraphicsTarget target,
|
||||||
|
PaintProperties paintProps) throws VizException {
|
||||||
|
PointSetFrame frame = frames.get(paintProps.getDataTime());
|
||||||
|
if (frame == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean painted = frame.paint(paintProps, target);
|
||||||
|
if (!painted) {
|
||||||
|
stageJob.schedule(frame);
|
||||||
|
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
|
if (!frames.isEmpty()) {
|
||||||
|
ColorMapParameters colorMapParameters = createColorMapParameters(frames
|
||||||
|
.values().iterator().next().getRecord());
|
||||||
|
if (colorMapParameters.getColorMapName() == null) {
|
||||||
|
colorMapParameters.setColorMapName("Grid/gridded data");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
colorMapParameters.setColorMap(ColorMapLoader
|
||||||
|
.loadColorMap(colorMapParameters.getColorMapName()));
|
||||||
|
} catch (ColorMapException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
getCapability(ColorMapCapability.class).setColorMapParameters(
|
||||||
|
colorMapParameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
PointSetFrame frame = frames.get(descriptor.getTimeForResource(this));
|
||||||
|
if (frame == null) {
|
||||||
|
return "Point Set Data";
|
||||||
|
} else {
|
||||||
|
PointSetRecord record = frame.getRecord();
|
||||||
|
String unitStr = record.getParameter().getUnitString();
|
||||||
|
ColorMapParameters parameters = getCapability(
|
||||||
|
ColorMapCapability.class).getColorMapParameters();
|
||||||
|
if (parameters != null) {
|
||||||
|
Unit<?> unit = parameters.getDisplayUnit();
|
||||||
|
if (unit != null) {
|
||||||
|
unitStr = UnitFormat.getUCUMInstance().format(unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return frame.getRecord().getDatasetId() + " " + record.getLevel()
|
||||||
|
+ " " + record.getParameter().getName() + " (" + unitStr
|
||||||
|
+ ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String inspect(ReferencedCoordinate coord) throws VizException {
|
||||||
|
PointSetFrame frame = frames.get(descriptor.getTimeForResource(this));
|
||||||
|
if (frame == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Coordinate ll = coord.asLatLon();
|
||||||
|
double[] pix = descriptor.worldToPixel(new double[] { ll.x,
|
||||||
|
ll.y });
|
||||||
|
return frame.inspect(pix[0], pix[1]);
|
||||||
|
} catch (FactoryException | TransformException e) {
|
||||||
|
throw new VizException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||||
|
synchronized (frames) {
|
||||||
|
for (PointSetFrame frame : frames.values()) {
|
||||||
|
frame.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.rsc;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
|
import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resource data for creating {@link PointSetResource}s.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
|
public class PointSetResourceData extends AbstractRequestableResourceData {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PointSetResource constructResource(
|
||||||
|
LoadProperties loadProperties, PluginDataObject[] objects)
|
||||||
|
throws VizException {
|
||||||
|
PointSetResource resource = new PointSetResource(this, loadProperties);
|
||||||
|
for (PluginDataObject object : objects) {
|
||||||
|
resource.addRecord((PointSetRecord) object);
|
||||||
|
}
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/**
|
||||||
|
* 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.pointset.rsc;
|
||||||
|
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stages point set frames in the background.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetStageJob extends Job {
|
||||||
|
|
||||||
|
private Deque<PointSetFrame> frames = new LinkedBlockingDeque<>();
|
||||||
|
|
||||||
|
public PointSetStageJob() {
|
||||||
|
super("Staging PointSet data");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void schedule(PointSetFrame frame) {
|
||||||
|
if (!frames.contains(frame)) {
|
||||||
|
frames.add(frame);
|
||||||
|
}
|
||||||
|
this.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
PointSetFrame frame = frames.poll();
|
||||||
|
while (frame != null) {
|
||||||
|
frame.stage();
|
||||||
|
frame = frames.poll();
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/**
|
||||||
|
* 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.common.dataplugin.pointset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Contains some useful constants for dealing with point set data, mostly just
|
||||||
|
* hibernate names of attributes.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- --------- --------------------------
|
||||||
|
* Aug 28, 2015 4709 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class PointSetConstants {
|
||||||
|
|
||||||
|
public static final String POINTSET = "pointset";
|
||||||
|
|
||||||
|
public static final String DATASET_ID = "datasetId";
|
||||||
|
|
||||||
|
public static final String PARAMETER = "parameter";
|
||||||
|
|
||||||
|
public static final String PARAMETER_ABBREVIATION = PARAMETER
|
||||||
|
+ ".abbreviation";
|
||||||
|
|
||||||
|
public static final String PARAMETER_NAME = PARAMETER + ".name";
|
||||||
|
|
||||||
|
public static final String LEVEL = "level";
|
||||||
|
|
||||||
|
public static final String LEVEL_ID = LEVEL + ".id";
|
||||||
|
|
||||||
|
public static final String MASTER_LEVEL_NAME = LEVEL + ".masterLevel.name";
|
||||||
|
|
||||||
|
public static final String LEVEL_ONE = LEVEL + ".levelonevalue";
|
||||||
|
|
||||||
|
public static final String LEVEL_TWO = LEVEL + ".leveltwovalue";
|
||||||
|
|
||||||
|
}
|
|
@ -144,7 +144,7 @@ public class PointSetRecord extends PersistablePluginDataObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPluginName() {
|
public String getPluginName() {
|
||||||
return "pointset";
|
return PointSetConstants.POINTSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue