gov.noaa.nws.mdl.viz.boundaryTool moved from its own repo
This commit is contained in:
parent
1372fba828
commit
344058c0cd
25 changed files with 6316 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gov.noaa.nws.mdl.viz.boundaryTool.common.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1 @@
|
|||
bin.includes = feature.xml
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="gov.noaa.nws.mdl.viz.boundaryTool.common.feature"
|
||||
label="Feature"
|
||||
version="1.0.0.qualifier">
|
||||
|
||||
<description url="http://www.example.com/description">
|
||||
[Enter Feature Description here.]
|
||||
</description>
|
||||
|
||||
<copyright url="http://www.example.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.ui"/>
|
||||
<import plugin="com.raytheon.viz.core"/>
|
||||
<import plugin="org.apache.commons.lang"/>
|
||||
<import plugin="org.geotools"/>
|
||||
<import plugin="com.raytheon.viz.ui.tools.map"/>
|
||||
<import plugin="com.raytheon.viz.ui"/>
|
||||
<import plugin="javax.measure"/>
|
||||
<import plugin="com.raytheon.uf.common.pointdata"/>
|
||||
<import plugin="javax.vecmath" version="1.3.1" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.common.awipstools" version="1.12.1112" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.common.serialization.comm" version="1.12.1112" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.viz.d2d.core"/>
|
||||
<import plugin="com.raytheon.uf.common.dataplugin.radar" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.viz.core.maps" version="1.12.1174" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.viz.d2d.ui"/>
|
||||
<import plugin="com.raytheon.viz.awipstools"/>
|
||||
<import plugin="com.raytheon.uf.viz.points" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.viz.core.rsc" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.raytheon.uf.common.topo"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.mdl.viz.boundaryTool"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
7
cave/gov.noaa.nws.mdl.viz.boundaryTool/.classpath
Normal file
7
cave/gov.noaa.nws.mdl.viz.boundaryTool/.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.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
cave/gov.noaa.nws.mdl.viz.boundaryTool/.project
Normal file
17
cave/gov.noaa.nws.mdl.viz.boundaryTool/.project
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gov.noaa.nws.mdl.viz.boundaryTool</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
36
cave/gov.noaa.nws.mdl.viz.boundaryTool/META-INF/MANIFEST.MF
Normal file
36
cave/gov.noaa.nws.mdl.viz.boundaryTool/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,36 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Boundarytools Plug-in
|
||||
Bundle-SymbolicName: gov.noaa.nws.mdl.viz.boundaryTool;singleton:=true
|
||||
Bundle-Version: 1.15.0.qualifier
|
||||
Bundle-Vendor: MDL
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core.rsc
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui,
|
||||
com.raytheon.viz.core,
|
||||
org.apache.commons.lang,
|
||||
org.geotools,
|
||||
com.raytheon.viz.ui.tools.map,
|
||||
com.raytheon.viz.ui,
|
||||
javax.measure,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
javax.vecmath;bundle-version="1.3.1",
|
||||
com.raytheon.uf.common.awipstools;bundle-version="1.12.1112",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1112",
|
||||
com.raytheon.uf.viz.d2d.core,
|
||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.d2d.ui,
|
||||
com.raytheon.viz.awipstools,
|
||||
com.raytheon.uf.viz.points;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: gov.noaa.nws.mdl.viz.boundaryTool,
|
||||
gov.noaa.nws.mdl.viz.boundaryTool.common.boundary,
|
||||
gov.noaa.nws.mdl.viz.boundaryTool.ui.action,
|
||||
gov.noaa.nws.mdl.viz.boundaryTool.ui.dialog,
|
||||
gov.noaa.nws.mdl.viz.boundaryTool.ui.layer
|
||||
Import-Package: com.raytheon.uf.common.topo,
|
||||
com.raytheon.uf.viz.d2d.core,
|
||||
com.raytheon.uf.viz.d2d.ui.dialogs.procedures
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
6
cave/gov.noaa.nws.mdl.viz.boundaryTool/build.properties
Normal file
6
cave/gov.noaa.nws.mdl.viz.boundaryTool/build.properties
Normal file
|
@ -0,0 +1,6 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
localization/
|
31
cave/gov.noaa.nws.mdl.viz.boundaryTool/plugin.xml
Normal file
31
cave/gov.noaa.nws.mdl.viz.boundaryTool/plugin.xml
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="gov.noaa.nws.mdl.viz.boundaryTool.ui.action.BoundaryEditorAction"
|
||||
commandId="gov.noaa.nws.mdl.viz.boundaryTool.boundaryeditor">
|
||||
</handler>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
<command
|
||||
id="gov.noaa.nws.mdl.viz.boundaryTool.boundaryeditor"
|
||||
name="Boundary Editor">
|
||||
</command>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution
|
||||
locationURI="menu:tools?after=tools.Ti">
|
||||
<command commandId="gov.noaa.nws.mdl.viz.boundaryTool.boundaryeditor"
|
||||
label="Boundary Tool..."
|
||||
style="push">
|
||||
<visibleWhen>
|
||||
<reference definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
</plugin>
|
|
@ -0,0 +1,977 @@
|
|||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.07.12 at 04:10:24 PM EDT
|
||||
//
|
||||
|
||||
package gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="UserName" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="TimeInfo">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="FileCreationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
|
||||
* <element name="FileCreationUtime" type="{http://www.w3.org/2001/XMLSchema}long"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="Boundary" maxOccurs="unbounded" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="BoundaryId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="BoundaryType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="BoundaryMode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="BoundaryLifeSpan" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="BoundaryCreationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryCreationUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="BoundaryEditedTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryEditedUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="BoundaryExpirationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryExpirationUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="NumberOfVertices" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="Vertex" maxOccurs="unbounded" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Latitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Longitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Azimuth" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Speed" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="U" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="V" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="ForbiddenBoundaryIds" maxOccurs="unbounded" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="ForbiddenId" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="Log" maxOccurs="unbounded" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Comment" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "userName", "timeInfo", "boundary",
|
||||
"forbiddenBoundaryIds", "log" })
|
||||
@XmlRootElement(name = "Boundaries")
|
||||
public class Boundaries {
|
||||
|
||||
@XmlElement(name = "UserName", required = true)
|
||||
protected String userName;
|
||||
@XmlElement(name = "TimeInfo", required = true)
|
||||
protected Boundaries.TimeInfo timeInfo;
|
||||
@XmlElement(name = "Boundary")
|
||||
protected List<Boundaries.Boundary> boundary;
|
||||
@XmlElement(name = "ForbiddenBoundaryIds")
|
||||
protected List<Boundaries.ForbiddenBoundaryIds> forbiddenBoundaryIds;
|
||||
@XmlElement(name = "Log")
|
||||
protected List<Boundaries.Log> log;
|
||||
|
||||
/**
|
||||
* Gets the value of the userName property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the userName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setUserName(String value) {
|
||||
this.userName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the timeInfo property.
|
||||
*
|
||||
* @return possible object is {@link Boundaries.TimeInfo }
|
||||
*
|
||||
*/
|
||||
public Boundaries.TimeInfo getTimeInfo() {
|
||||
return timeInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the timeInfo property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Boundaries.TimeInfo }
|
||||
*
|
||||
*/
|
||||
public void setTimeInfo(Boundaries.TimeInfo value) {
|
||||
this.timeInfo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundary property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the boundary property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getBoundary().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Boundaries.Boundary }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Boundaries.Boundary> getBoundary() {
|
||||
if (boundary == null) {
|
||||
boundary = new ArrayList<Boundaries.Boundary>();
|
||||
}
|
||||
return this.boundary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the forbiddenBoundaryIds property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the forbiddenBoundaryIds property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getForbiddenBoundaryIds().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Boundaries.ForbiddenBoundaryIds }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Boundaries.ForbiddenBoundaryIds> getForbiddenBoundaryIds() {
|
||||
if (forbiddenBoundaryIds == null) {
|
||||
forbiddenBoundaryIds = new ArrayList<Boundaries.ForbiddenBoundaryIds>();
|
||||
}
|
||||
return this.forbiddenBoundaryIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the log property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list will
|
||||
* be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the log property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getLog().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Boundaries.Log }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Boundaries.Log> getLog() {
|
||||
if (log == null) {
|
||||
log = new ArrayList<Boundaries.Log>();
|
||||
}
|
||||
return this.log;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained
|
||||
* within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="BoundaryId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="BoundaryType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="BoundaryMode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="BoundaryLifeSpan" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="BoundaryCreationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryCreationUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="BoundaryEditedTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryEditedUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="BoundaryExpirationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="BoundaryExpirationUtime" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
|
||||
* <element name="NumberOfVertices" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="Vertex" maxOccurs="unbounded" minOccurs="0">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Latitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Longitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Azimuth" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Speed" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="U" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="V" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "boundaryId", "boundaryType",
|
||||
"boundaryMode", "boundaryLifeSpan", "boundaryCreationTime",
|
||||
"boundaryCreationUtime", "boundaryEditedTime",
|
||||
"boundaryEditedUtime", "boundaryExpirationTime",
|
||||
"boundaryExpirationUtime", "numberOfVertices", "vertex" })
|
||||
public static class Boundary {
|
||||
|
||||
@XmlElement(name = "BoundaryId")
|
||||
protected Integer boundaryId;
|
||||
@XmlElement(name = "BoundaryType")
|
||||
protected String boundaryType;
|
||||
@XmlElement(name = "BoundaryMode")
|
||||
protected String boundaryMode;
|
||||
@XmlElement(name = "BoundaryLifeSpan")
|
||||
protected Integer boundaryLifeSpan;
|
||||
@XmlElement(name = "BoundaryCreationTime")
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar boundaryCreationTime;
|
||||
@XmlElement(name = "BoundaryCreationUtime")
|
||||
protected Long boundaryCreationUtime;
|
||||
@XmlElement(name = "BoundaryEditedTime")
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar boundaryEditedTime;
|
||||
@XmlElement(name = "BoundaryEditedUtime")
|
||||
protected Long boundaryEditedUtime;
|
||||
@XmlElement(name = "BoundaryExpirationTime")
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar boundaryExpirationTime;
|
||||
@XmlElement(name = "BoundaryExpirationUtime")
|
||||
protected Long boundaryExpirationUtime;
|
||||
@XmlElement(name = "NumberOfVertices")
|
||||
protected Integer numberOfVertices;
|
||||
@XmlElement(name = "Vertex")
|
||||
protected List<Boundaries.Boundary.Vertex> vertex;
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryId property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getBoundaryId() {
|
||||
return boundaryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryId property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryId(Integer value) {
|
||||
this.boundaryId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryType property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getBoundaryType() {
|
||||
return boundaryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryType property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryType(String value) {
|
||||
this.boundaryType = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryMode property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getBoundaryMode() {
|
||||
return boundaryMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryMode property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryMode(String value) {
|
||||
this.boundaryMode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryLifeSpan property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getBoundaryLifeSpan() {
|
||||
return boundaryLifeSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryLifeSpan property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryLifeSpan(Integer value) {
|
||||
this.boundaryLifeSpan = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryCreationTime property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getBoundaryCreationTime() {
|
||||
return boundaryCreationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryCreationTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryCreationTime(XMLGregorianCalendar value) {
|
||||
this.boundaryCreationTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryCreationUtime property.
|
||||
*
|
||||
* @return possible object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public Long getBoundaryCreationUtime() {
|
||||
return boundaryCreationUtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryCreationUtime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryCreationUtime(Long value) {
|
||||
this.boundaryCreationUtime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryEditedTime property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getBoundaryEditedTime() {
|
||||
return boundaryEditedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryEditedTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryEditedTime(XMLGregorianCalendar value) {
|
||||
this.boundaryEditedTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryEditedUtime property.
|
||||
*
|
||||
* @return possible object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public Long getBoundaryEditedUtime() {
|
||||
return boundaryEditedUtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryEditedUtime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryEditedUtime(Long value) {
|
||||
this.boundaryEditedUtime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryExpirationTime property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getBoundaryExpirationTime() {
|
||||
return boundaryExpirationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryExpirationTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryExpirationTime(XMLGregorianCalendar value) {
|
||||
this.boundaryExpirationTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the boundaryExpirationUtime property.
|
||||
*
|
||||
* @return possible object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public Long getBoundaryExpirationUtime() {
|
||||
return boundaryExpirationUtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the boundaryExpirationUtime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Long }
|
||||
*
|
||||
*/
|
||||
public void setBoundaryExpirationUtime(Long value) {
|
||||
this.boundaryExpirationUtime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the numberOfVertices property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getNumberOfVertices() {
|
||||
return numberOfVertices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the numberOfVertices property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setNumberOfVertices(Integer value) {
|
||||
this.numberOfVertices = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the vertex property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list
|
||||
* will be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the vertex property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getVertex().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Boundaries.Boundary.Vertex }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Boundaries.Boundary.Vertex> getVertex() {
|
||||
if (vertex == null) {
|
||||
vertex = new ArrayList<Boundaries.Boundary.Vertex>();
|
||||
}
|
||||
return this.vertex;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content
|
||||
* contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Latitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Longitude" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Azimuth" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="Speed" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="U" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* <element name="V" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "latitude", "longitude", "azimuth",
|
||||
"speed", "u", "v" })
|
||||
public static class Vertex {
|
||||
|
||||
@XmlElement(name = "Latitude")
|
||||
protected Float latitude;
|
||||
@XmlElement(name = "Longitude")
|
||||
protected Float longitude;
|
||||
@XmlElement(name = "Azimuth")
|
||||
protected Float azimuth;
|
||||
@XmlElement(name = "Speed")
|
||||
protected Float speed;
|
||||
@XmlElement(name = "U")
|
||||
protected Float u;
|
||||
@XmlElement(name = "V")
|
||||
protected Float v;
|
||||
|
||||
/**
|
||||
* Gets the value of the latitude property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the latitude property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setLatitude(Float value) {
|
||||
this.latitude = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the longitude property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the longitude property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setLongitude(Float value) {
|
||||
this.longitude = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the azimuth property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getAzimuth() {
|
||||
return azimuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the azimuth property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setAzimuth(Float value) {
|
||||
this.azimuth = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the speed property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the speed property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setSpeed(Float value) {
|
||||
this.speed = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the u property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getU() {
|
||||
return u;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the u property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setU(Float value) {
|
||||
this.u = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the v property.
|
||||
*
|
||||
* @return possible object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public Float getV() {
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the v property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link Float }
|
||||
*
|
||||
*/
|
||||
public void setV(Float value) {
|
||||
this.v = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained
|
||||
* within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="ForbiddenId" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "forbiddenId" })
|
||||
public static class ForbiddenBoundaryIds {
|
||||
|
||||
@XmlElement(name = "ForbiddenId")
|
||||
protected List<String> forbiddenId;
|
||||
|
||||
/**
|
||||
* Gets the value of the forbiddenId property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list
|
||||
* will be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the forbiddenId property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getForbiddenId().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link String }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<String> getForbiddenId() {
|
||||
if (forbiddenId == null) {
|
||||
forbiddenId = new ArrayList<String>();
|
||||
}
|
||||
return this.forbiddenId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained
|
||||
* within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Comment" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "comment" })
|
||||
public static class Log {
|
||||
|
||||
@XmlElement(name = "Comment")
|
||||
protected List<String> comment;
|
||||
|
||||
/**
|
||||
* Gets the value of the comment property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a
|
||||
* snapshot. Therefore any modification you make to the returned list
|
||||
* will be present inside the JAXB object. This is why there is not a
|
||||
* <CODE>set</CODE> method for the comment property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
*
|
||||
* <pre>
|
||||
* getComment().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link String }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<String> getComment() {
|
||||
if (comment == null) {
|
||||
comment = new ArrayList<String>();
|
||||
}
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained
|
||||
* within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="FileCreationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
|
||||
* <element name="FileCreationUtime" type="{http://www.w3.org/2001/XMLSchema}long"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = { "fileCreationTime", "fileCreationUtime" })
|
||||
public static class TimeInfo {
|
||||
|
||||
@XmlElement(name = "FileCreationTime", required = true)
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar fileCreationTime;
|
||||
@XmlElement(name = "FileCreationUtime")
|
||||
protected long fileCreationUtime;
|
||||
|
||||
/**
|
||||
* Gets the value of the fileCreationTime property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getFileCreationTime() {
|
||||
return fileCreationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the fileCreationTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setFileCreationTime(XMLGregorianCalendar value) {
|
||||
this.fileCreationTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the fileCreationUtime property.
|
||||
*
|
||||
*/
|
||||
public long getFileCreationUtime() {
|
||||
return fileCreationUtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the fileCreationUtime property.
|
||||
*
|
||||
*/
|
||||
public void setFileCreationUtime(long value) {
|
||||
this.fileCreationUtime = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Boundaries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoundariesStateSchema.xsd">
|
||||
<UserName>UserName</UserName>
|
||||
<TimeInfo>
|
||||
<FileCreationTime>2001-12-31T12:00:00</FileCreationTime>
|
||||
<FileCreationUtime>0</FileCreationUtime>
|
||||
</TimeInfo>
|
||||
<Boundary>
|
||||
<BoundaryId>0</BoundaryId>
|
||||
<BoundaryType>BoundaryType</BoundaryType>
|
||||
<BoundaryMode>BoundaryMode</BoundaryMode>
|
||||
<BoundaryLifeSpan>0</BoundaryLifeSpan>
|
||||
<BoundaryCreationTime>2001-12-31T12:00:00</BoundaryCreationTime>
|
||||
<BoundaryCreationUtime>0</BoundaryCreationUtime>
|
||||
<BoundaryEditedTime>2001-12-31T12:00:00</BoundaryEditedTime>
|
||||
<BoundaryEditedUtime>0</BoundaryEditedUtime>
|
||||
<BoundaryExpirationTime>2001-12-31T12:00:00</BoundaryExpirationTime>
|
||||
<BoundaryExpirationUtime>0</BoundaryExpirationUtime>
|
||||
<NumberOfVertices>0</NumberOfVertices>
|
||||
<Vertex/>
|
||||
</Boundary>
|
||||
<ForbiddenBoundaryIds>
|
||||
<ForbiddenId>ForbiddenId</ForbiddenId>
|
||||
</ForbiddenBoundaryIds>
|
||||
<Log>
|
||||
<Comment>Comment</Comment>
|
||||
</Log>
|
||||
</Boundaries>
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema elementFormDefault="qualified"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<xsd:element name="Boundaries">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="UserName" type="xsd:string"
|
||||
maxOccurs="1" minOccurs="1">
|
||||
</xsd:element>
|
||||
<xsd:element name="TimeInfo" maxOccurs="1" minOccurs="1">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="FileCreationTime" type="xsd:dateTime"
|
||||
maxOccurs="1" minOccurs="1">
|
||||
</xsd:element>
|
||||
<xsd:element name="FileCreationUtime" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="1">
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="Boundary" maxOccurs="unbounded"
|
||||
minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="BoundaryId" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryType" type="xsd:string"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryMode" type="xsd:string"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryLifeSpan" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryCreationTime" type="xsd:dateTime"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryCreationUtime" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryEditedTime" type="xsd:dateTime"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryEditedUtime" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryExpirationTime" type="xsd:dateTime"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="BoundaryExpirationUtime" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="NumberOfVertices" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="Vertex" maxOccurs="unbounded"
|
||||
minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="Latitude" type="xsd:float"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="Longitude" type="xsd:float"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="Azimuth" type="xsd:float"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="Speed" type="xsd:float"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="U" type="xsd:float" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="V" type="xsd:float" maxOccurs="1"
|
||||
minOccurs="0">
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="ForbiddenBoundaryIds" maxOccurs="unbounded"
|
||||
minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="ForbiddenId" type="xsd:string"
|
||||
maxOccurs="unbounded" minOccurs="0">
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="Log" maxOccurs="unbounded" minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="Comment" type="xsd:string"
|
||||
maxOccurs="unbounded" minOccurs="0">
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
|
@ -0,0 +1,82 @@
|
|||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.07.12 at 04:10:24 PM EDT
|
||||
//
|
||||
|
||||
package gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
|
||||
/**
|
||||
* This object contains factory methods for each Java content interface and Java
|
||||
* element interface generated in the generated package.
|
||||
* <p>
|
||||
* An ObjectFactory allows you to programatically construct new instances of the
|
||||
* Java representation for XML content. The Java representation of XML content
|
||||
* can consist of schema derived interfaces and classes representing the binding
|
||||
* of schema type definitions, element declarations and model groups. Factory
|
||||
* methods for each of these are provided in this class.
|
||||
*
|
||||
*/
|
||||
@XmlRegistry
|
||||
public class BoundaryObjectFactory {
|
||||
|
||||
/**
|
||||
* Create a new ObjectFactory that can be used to create new instances of
|
||||
* schema derived classes for package: generated
|
||||
*
|
||||
*/
|
||||
public BoundaryObjectFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries.TimeInfo }
|
||||
*
|
||||
*/
|
||||
public Boundaries.TimeInfo createBoundariesTimeInfo() {
|
||||
return new Boundaries.TimeInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries.Boundary }
|
||||
*
|
||||
*/
|
||||
public Boundaries.Boundary createBoundariesBoundary() {
|
||||
return new Boundaries.Boundary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries.Boundary.Vertex }
|
||||
*
|
||||
*/
|
||||
public Boundaries.Boundary.Vertex createBoundariesBoundaryVertex() {
|
||||
return new Boundaries.Boundary.Vertex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries.Log }
|
||||
*
|
||||
*/
|
||||
public Boundaries.Log createBoundariesLog() {
|
||||
return new Boundaries.Log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries }
|
||||
*
|
||||
*/
|
||||
public Boundaries createBoundaries() {
|
||||
return new Boundaries();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Boundaries.ForbiddenBoundaryIds }
|
||||
*
|
||||
*/
|
||||
public Boundaries.ForbiddenBoundaryIds createBoundariesForbiddenBoundaryIds() {
|
||||
return new Boundaries.ForbiddenBoundaryIds();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml.Boundaries.ForbiddenBoundaryIds;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
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.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
||||
/**
|
||||
* Methods to be called to read boundary xml file via LocalizationFile and
|
||||
* populate BoundaryState objects for the display active boundaries by
|
||||
* BounadaryDisplay class
|
||||
*
|
||||
* <pre>
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class ReadBoundariesXmlFile {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ReadBoundariesXmlFile.class);
|
||||
|
||||
public void readBoundariesXmlFile(BoundaryState currentState)
|
||||
throws VizException, DatatypeConfigurationException,
|
||||
FileNotFoundException {
|
||||
Date d = null;
|
||||
|
||||
long createTime = 0;
|
||||
long currTime = 0;
|
||||
float bndLifeSpan = 0;
|
||||
long oneHour = TimeUtil.MILLIS_PER_HOUR;
|
||||
String moving = "Moving";
|
||||
|
||||
// Use Localization context to read boundary data
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
LocalizationFile boundaryFile = pm.getLocalizationFile(context,
|
||||
"awipsTools" + IPathManager.SEPARATOR + "boundaryTool.xml");
|
||||
|
||||
if (boundaryFile.exists()) {
|
||||
try {
|
||||
// Read boundary data via localization
|
||||
Boundaries boundariesObj = boundaryFile.jaxbUnmarshal(
|
||||
Boundaries.class, new JAXBManager(Boundaries.class));
|
||||
|
||||
d = new Date(boundariesObj.getTimeInfo().getFileCreationUtime());
|
||||
|
||||
currentState.creationFileTime = new DataTime(d);
|
||||
|
||||
for (int i = 0; i < boundariesObj.getBoundary().size(); i++) {
|
||||
int boundaryId = boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryId();
|
||||
// Populate boundary active list for those active
|
||||
// boundaries.
|
||||
|
||||
d = new Date(boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryCreationUtime());
|
||||
|
||||
DataTime t = new DataTime(SimulatedTime.getSystemTime()
|
||||
.getTime());
|
||||
currTime = t.getMatchRef();
|
||||
createTime = boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryCreationUtime();
|
||||
bndLifeSpan = (currTime - createTime) / oneHour;
|
||||
|
||||
if (bndLifeSpan >= (float) boundariesObj.getBoundary()
|
||||
.get(i).getBoundaryLifeSpan()) {
|
||||
// Add expired boundaries to forbidden list
|
||||
if (currentState.forbiddenBoundaryIdsMap
|
||||
.get(boundaryId) != null) {
|
||||
currentState.forbiddenBoundaryIdsMap
|
||||
.remove(boundaryId);
|
||||
currentState.forbiddenBoundaryIdsMap.put(
|
||||
boundaryId, boundaryId);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
currentState.createTimeMap.put(boundaryId, new DataTime(d));
|
||||
currentState.boundaryDurationMap.put(boundaryId,
|
||||
boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryLifeSpan());
|
||||
|
||||
d = new Date(boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryEditedUtime());
|
||||
currentState.editedTimeMap.put(boundaryId, new DataTime(d));
|
||||
|
||||
d = new Date(boundariesObj.getBoundary().get(i)
|
||||
.getBoundaryExpirationUtime());
|
||||
currentState.expirationTimeMap.put(boundaryId,
|
||||
new DataTime(d));
|
||||
|
||||
Coordinate[] coords = new Coordinate[boundariesObj
|
||||
.getBoundary().get(i).getNumberOfVertices()];
|
||||
float[] speed = new float[boundariesObj.getBoundary()
|
||||
.get(i).getNumberOfVertices()];
|
||||
float[] angle = new float[boundariesObj.getBoundary()
|
||||
.get(i).getNumberOfVertices()];
|
||||
|
||||
for (int j = 0; j < boundariesObj.getBoundary().get(i)
|
||||
.getVertex().size(); j++) {
|
||||
coords[j] = new Coordinate(boundariesObj.getBoundary()
|
||||
.get(i).getVertex().get(j).getLongitude(),
|
||||
boundariesObj.getBoundary().get(i).getVertex()
|
||||
.get(j).getLatitude());
|
||||
speed[j] = boundariesObj.getBoundary().get(i)
|
||||
.getVertex().get(j).getSpeed();
|
||||
angle[j] = boundariesObj.getBoundary().get(i)
|
||||
.getVertex().get(j).getAzimuth();
|
||||
|
||||
}
|
||||
|
||||
currentState.boundariesMap.put(boundaryId,
|
||||
new GeometryFactory().createLineString(coords));
|
||||
|
||||
if (boundariesObj.getBoundary().get(i).getBoundaryMode()
|
||||
.equals(moving)) {
|
||||
currentState.isMovingMap.put(boundaryId, true);
|
||||
currentState.vertexAngleMap.put(boundaryId, angle);
|
||||
currentState.vertexSpeedMap.put(boundaryId, speed);
|
||||
} else {
|
||||
currentState.isMovingMap.put(boundaryId, false);
|
||||
}
|
||||
currentState.boundaryTypeMap.put(boundaryId, boundariesObj
|
||||
.getBoundary().get(i).getBoundaryType());
|
||||
currentState.boundaryId = boundaryId;
|
||||
if (currentState.boundariesMap.size() != 0) {
|
||||
if (currentState.existingBoundaryNotEmptyMap
|
||||
.get(boundaryId) != null) {
|
||||
currentState.existingBoundaryNotEmptyMap
|
||||
.remove(boundaryId);
|
||||
}
|
||||
|
||||
currentState.existingBoundaryNotEmptyMap.put(
|
||||
boundaryId, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Populate boundary forbidden id list
|
||||
|
||||
List<ForbiddenBoundaryIds> forbiden = boundariesObj
|
||||
.getForbiddenBoundaryIds();
|
||||
|
||||
Iterator<ForbiddenBoundaryIds> iterator = forbiden.iterator();
|
||||
|
||||
int id = 0;
|
||||
Iterable<String> s1 = null;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
s1 = iterator.next().getForbiddenId();
|
||||
for (String e : s1) {
|
||||
try {
|
||||
id = Integer.parseInt(e);
|
||||
|
||||
} catch (NumberFormatException ex) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem in parsing the integer", ex);
|
||||
}
|
||||
currentState.forbiddenBoundaryIdsMap.put(id, id);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"problem in reading boundary data", e);
|
||||
} catch (LocalizationException e1) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Localization exception", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,272 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml;
|
||||
|
||||
import static java.lang.Math.PI;
|
||||
import static java.lang.Math.cos;
|
||||
import static java.lang.Math.sin;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml.Boundaries.Boundary.Vertex;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml.Boundaries.ForbiddenBoundaryIds;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.BoundaryPolyLine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.SaveableOutputStream;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
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.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
||||
/**
|
||||
* Methods to be called to save boundary xml file via LocalizationFile
|
||||
*
|
||||
* <pre>
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
* </pre>
|
||||
*/
|
||||
public class WriteBoundariesXmlFile {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(WriteBoundariesXmlFile.class);
|
||||
private static JAXBManager jaxbManager;
|
||||
private static boolean initialized;
|
||||
|
||||
/**
|
||||
* Populate the Boundaries Object and save it via LocalizationFile.
|
||||
*/
|
||||
public void writeBoundariesXmlFile(BoundaryState currentState,
|
||||
DataTime[] dataTimes, int currentTimeIndex) throws VizException,
|
||||
DatatypeConfigurationException {
|
||||
BoundaryObjectFactory ofObj = new BoundaryObjectFactory();
|
||||
Boundaries boundariesObj = ofObj.createBoundaries();
|
||||
|
||||
// Use Localization context to save boundary data
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
|
||||
LocalizationFile boundaryFile = pm.getLocalizationFile(context,
|
||||
"awipsTools" + IPathManager.SEPARATOR + "boundaryTool.xml");
|
||||
|
||||
/*
|
||||
* Use ProfileDescription methods to populate the ProfileDescription
|
||||
* object with values. Fist the simple type variables.
|
||||
*/
|
||||
|
||||
// Populate the Boundaries Object
|
||||
|
||||
// Current user name
|
||||
boundariesObj.setUserName(System.getProperty("user.name"));
|
||||
|
||||
// Time info (Time frame)
|
||||
// currentTimeIndex = this.trackUtil.getCurrentFrame(info);
|
||||
|
||||
long currentUTime = 0;
|
||||
long oneHour = TimeUtil.MILLIS_PER_HOUR;
|
||||
long expirationUTime = 0;
|
||||
long boundaryCreationUtime = 0;
|
||||
long boundaryEditedUtime = 0;
|
||||
Date d;
|
||||
Date expiration_date;
|
||||
// dataTimes = trackUtil.getDataTimes(info);
|
||||
|
||||
currentUTime = dataTimes[currentTimeIndex].getMatchRef();
|
||||
d = new Date(currentUTime);
|
||||
|
||||
GregorianCalendar c = new GregorianCalendar();
|
||||
c.setTime(d);
|
||||
|
||||
XMLGregorianCalendar d2 = DatatypeFactory.newInstance()
|
||||
.newXMLGregorianCalendar(c);
|
||||
|
||||
Boundaries.TimeInfo timeInfoObj = ofObj.createBoundariesTimeInfo();
|
||||
timeInfoObj.setFileCreationTime(d2);
|
||||
timeInfoObj.setFileCreationUtime(currentUTime);
|
||||
|
||||
boundariesObj.setTimeInfo(timeInfoObj);
|
||||
|
||||
// Populate active boundaries: loop over all existing boundaries
|
||||
|
||||
int moveIndex = currentTimeIndex;
|
||||
|
||||
BoundaryPolyLine[] currentTimePoints;
|
||||
LineString line;
|
||||
Iterator<Integer> iterator = currentState.boundariesMap.keySet()
|
||||
.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String boundaryMode = null;
|
||||
|
||||
Boundaries.Boundary boundary = ofObj.createBoundariesBoundary();
|
||||
|
||||
int boundaryId = iterator.next();
|
||||
boundary.setBoundaryId(boundaryId);
|
||||
if (currentState.isMovingMap.get(boundaryId)) {
|
||||
boundaryMode = "Moving";
|
||||
currentTimePoints = currentState.timePointsMap.get(boundaryId);
|
||||
line = currentTimePoints[moveIndex].polyline;
|
||||
|
||||
} else {
|
||||
line = currentState.boundariesMap.get(boundaryId);
|
||||
boundaryMode = "Stationary";
|
||||
}
|
||||
boundary.setBoundaryMode(boundaryMode);
|
||||
boundary.setBoundaryType(currentState.boundaryTypeMap
|
||||
.get(boundaryId));
|
||||
boundary.setBoundaryLifeSpan(currentState.boundaryDurationMap
|
||||
.get(boundaryId));
|
||||
|
||||
Coordinate[] coords = line.getCoordinates();
|
||||
boundary.setNumberOfVertices(coords.length);
|
||||
// Populate boundary's time attributes
|
||||
// Set boundary creation time attributes
|
||||
boundaryCreationUtime = currentState.createTimeMap.get(boundaryId)
|
||||
.getMatchRef();
|
||||
expirationUTime = boundaryCreationUtime
|
||||
+ (currentState.boundaryDurationMap.get(boundaryId) * oneHour);
|
||||
d = new Date(boundaryCreationUtime);
|
||||
expiration_date = new Date(expirationUTime);
|
||||
DataTime expirationDataTime = new DataTime(expiration_date);
|
||||
|
||||
// Set Boundary expiration Time
|
||||
if (currentState.expirationTimeMap.get(boundaryId) != null)
|
||||
currentState.expirationTimeMap.remove(boundaryId);
|
||||
currentState.expirationTimeMap.put(boundaryId, expirationDataTime);
|
||||
|
||||
c = new GregorianCalendar();
|
||||
c.setTime(d);
|
||||
d2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
|
||||
boundary.setBoundaryCreationTime(d2);
|
||||
boundary.setBoundaryCreationUtime(boundaryCreationUtime);
|
||||
|
||||
// Set modification Time attributes
|
||||
boundaryEditedUtime = currentState.editedTimeMap.get(boundaryId)
|
||||
.getMatchRef();
|
||||
d = new Date(boundaryEditedUtime);
|
||||
c = new GregorianCalendar();
|
||||
c.setTime(d);
|
||||
d2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
|
||||
boundary.setBoundaryEditedTime(d2);
|
||||
boundary.setBoundaryEditedUtime(boundaryEditedUtime);
|
||||
|
||||
// Set boundary expiration time attributes
|
||||
c = new GregorianCalendar();
|
||||
c.setTime(expiration_date);
|
||||
d2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
|
||||
boundary.setBoundaryExpirationTime(d2);
|
||||
boundary.setBoundaryExpirationUtime(expirationUTime);
|
||||
|
||||
// populate vertices
|
||||
// boundaryObj.setNumberOfVertices(coords.length);
|
||||
|
||||
List<Boundaries.Boundary.Vertex> vertexList = new ArrayList<Boundaries.Boundary.Vertex>();
|
||||
// add vertex to the list
|
||||
for (int i = 0; i < coords.length; i++) {
|
||||
// coordinates
|
||||
Boundaries.Boundary.Vertex vertex = ofObj
|
||||
.createBoundariesBoundaryVertex();
|
||||
vertexList.add(vertex);
|
||||
|
||||
Vertex vx = vertexList.get(i);
|
||||
vx.setLongitude((float) coords[i].x);
|
||||
vx.setLatitude((float) coords[i].y);
|
||||
|
||||
// speed and angle
|
||||
if (currentState.isMovingMap.get(boundaryId)) {
|
||||
vx.setAzimuth(currentState.vertexAngleMap.get(boundaryId)[i]);
|
||||
vx.setSpeed(currentState.vertexSpeedMap.get(boundaryId)[i]);
|
||||
// Compute u,v components of speed
|
||||
float u = (float) (currentState.vertexSpeedMap
|
||||
.get(boundaryId)[i] * sin(currentState.vertexAngleMap
|
||||
.get(boundaryId)[i] * PI / 180.));
|
||||
float v = (float) (currentState.vertexSpeedMap
|
||||
.get(boundaryId)[i] * cos(currentState.vertexAngleMap
|
||||
.get(boundaryId)[i] * PI / 180.));
|
||||
vx.setU(u);
|
||||
vx.setV(v);
|
||||
} else {
|
||||
vx.setAzimuth((float) 0.0);
|
||||
vx.setSpeed((float) 0.0);
|
||||
vx.setU((float) 0.0);
|
||||
vx.setV((float) 0.0);
|
||||
|
||||
}
|
||||
boundary.getVertex().add(vx);
|
||||
|
||||
}
|
||||
|
||||
boundariesObj.getBoundary().add(boundary);
|
||||
}
|
||||
|
||||
// Populate forbidden ids list
|
||||
|
||||
Iterator<Integer> logIndex = currentState.logMap.keySet().iterator();
|
||||
|
||||
while (logIndex.hasNext()) {
|
||||
Boundaries.Log log = ofObj.createBoundariesLog();
|
||||
int id = logIndex.next();
|
||||
log.getComment().add(currentState.logMap.get(id));
|
||||
boundariesObj.getLog().add(log);
|
||||
}
|
||||
|
||||
Iterator<Integer> forbidenIds = currentState.forbiddenBoundaryIdsMap
|
||||
.keySet().iterator();
|
||||
|
||||
while (forbidenIds.hasNext()) {
|
||||
ForbiddenBoundaryIds forbiden = ofObj
|
||||
.createBoundariesForbiddenBoundaryIds();
|
||||
int id = forbidenIds.next();
|
||||
String s = "" + id;
|
||||
forbiden.getForbiddenId().add(s);
|
||||
boundariesObj.getForbiddenBoundaryIds().add(forbiden);
|
||||
}
|
||||
|
||||
try {
|
||||
initialize();
|
||||
} catch (JAXBException e1) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Initialization fails", e1);
|
||||
}
|
||||
try (SaveableOutputStream sos = boundaryFile.openOutputStream()) {
|
||||
jaxbManager.marshalToStream(boundariesObj, sos);
|
||||
sos.save();
|
||||
} catch (IOException | LocalizationException | SerializationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize jaxb manager
|
||||
*
|
||||
* @throws JAXBException
|
||||
*/
|
||||
private static synchronized void initialize() throws JAXBException {
|
||||
if (!initialized) {
|
||||
jaxbManager = new JAXBManager(Boundaries.class);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,271 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.Mode;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.UserAction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||
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.AbstractResourceData;
|
||||
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.ResourceProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
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.tools.GenericToolsResourceData;
|
||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
||||
/**
|
||||
* Abstract class for drawing boundary object
|
||||
*
|
||||
* @author Mamoudou ba
|
||||
* @version 1.0
|
||||
*
|
||||
* Modified from A2 "AbstractStormTrackResource" class by renaming the
|
||||
* class name and methods
|
||||
*/
|
||||
|
||||
public abstract class AbstractBoundaryResource extends
|
||||
AbstractVizResource<AbstractResourceData, MapDescriptor> implements
|
||||
IResourceDataChanged, IContextMenuContributor {
|
||||
|
||||
private BoundaryDisplay display;
|
||||
|
||||
protected BoundaryState displayState;
|
||||
|
||||
protected BoundaryUIManager manager;
|
||||
|
||||
private boolean timeMatchBasis = false;
|
||||
|
||||
private int maximumFrameCount = -1;
|
||||
|
||||
protected BoundaryUtil trackUtil;
|
||||
|
||||
private boolean keepTrackOfDuration = false;
|
||||
|
||||
private int lastFrameCount = -1;
|
||||
|
||||
public AbstractBoundaryResource(
|
||||
GenericToolsResourceData<? extends AbstractBoundaryResource> resourceData,
|
||||
LoadProperties loadProperties, MapDescriptor descriptor) {
|
||||
super(resourceData, loadProperties);
|
||||
setDescriptor(descriptor);
|
||||
resourceData.addChangeListener(this);
|
||||
dataTimes = new ArrayList<DataTime>();
|
||||
|
||||
displayState = new BoundaryState();
|
||||
trackUtil = new BoundaryUtil();
|
||||
initializeState(displayState);
|
||||
|
||||
if (displayState.duration == -1) {
|
||||
keepTrackOfDuration = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescriptor(MapDescriptor descriptor) {
|
||||
super.setDescriptor(descriptor);
|
||||
if (display != null) {
|
||||
display.setDescriptor(descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataTime[] getDataTimes() {
|
||||
if (timeMatchBasis) {
|
||||
/*
|
||||
* We only want to calculate more data times if the user hasselected
|
||||
* more frames than there have been in the past.
|
||||
*/
|
||||
if (this.descriptor.getNumberOfFrames() > this.maximumFrameCount) {
|
||||
int variance = this.descriptor.getNumberOfFrames()
|
||||
- this.maximumFrameCount;
|
||||
|
||||
this.maximumFrameCount = this.descriptor.getNumberOfFrames();
|
||||
|
||||
DataTime earliestTime = this.dataTimes.get(0);
|
||||
this.fillDataTimeArray(earliestTime, variance);
|
||||
}
|
||||
} else {
|
||||
FramesInfo info = descriptor.getFramesInfo();
|
||||
dataTimes.clear();
|
||||
this.maximumFrameCount = this.descriptor.getNumberOfFrames();
|
||||
// First time called
|
||||
if (info.getFrameTimes() != null) {
|
||||
for (DataTime dt : info.getFrameTimes()) {
|
||||
dataTimes.add(dt);
|
||||
}
|
||||
}
|
||||
|
||||
if (dataTimes.size() == 0) {
|
||||
timeMatchBasis = true;
|
||||
/*
|
||||
* Case where this tool is time match basis or no data loaded
|
||||
*/
|
||||
DataTime currentTime = null;
|
||||
if (dataTimes.size() > 0) {
|
||||
currentTime = dataTimes.get(dataTimes.size() - 1);
|
||||
} else {
|
||||
currentTime = new DataTime(SimulatedTime.getSystemTime()
|
||||
.getTime());
|
||||
}
|
||||
|
||||
dataTimes.add(currentTime);
|
||||
this.fillDataTimeArray(currentTime,
|
||||
this.descriptor.getNumberOfFrames() - 1);
|
||||
}
|
||||
}
|
||||
Collections.sort(dataTimes);
|
||||
return dataTimes.toArray(new DataTime[dataTimes.size()]);
|
||||
}
|
||||
|
||||
private void fillDataTimeArray(DataTime startDataTime, int numberOfDataTimes) {
|
||||
long fifteenMin = 15 * TimeUtil.MILLIS_PER_MINUTE;
|
||||
long time = startDataTime.getRefTime().getTime();
|
||||
DataTime currentDataTime = null;
|
||||
|
||||
for (int i = 0; i < numberOfDataTimes; i++) {
|
||||
time -= fifteenMin;
|
||||
currentDataTime = new DataTime(new Date(time));
|
||||
this.dataTimes.add(currentDataTime);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEditable() {
|
||||
return getCapability(EditableCapability.class).isEditable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
if (manager != null) {
|
||||
manager.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
EditableManager.makeEditable(this, true);
|
||||
manager = new BoundaryUIManager(this);
|
||||
manager.setTrackUtil(trackUtil);
|
||||
// Create the display
|
||||
display = new BoundaryDisplay(descriptor, manager);
|
||||
descriptor.getTimeMatcher().redoTimeMatching(this);
|
||||
descriptor.getTimeMatcher().redoTimeMatching(descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
FramesInfo info = paintProps.getFramesInfo();
|
||||
manager.setHandleInput(displayState.isEditable());
|
||||
if (keepTrackOfDuration && lastFrameCount != info.getFrameCount()) {
|
||||
displayState.duration = -1;
|
||||
lastFrameCount = info.getFrameCount();
|
||||
}
|
||||
|
||||
displayState.color = getCapability(ColorableCapability.class)
|
||||
.getColor();
|
||||
displayState.lineWidth = getCapability(OutlineCapability.class)
|
||||
.getOutlineWidth();
|
||||
displayState.lineStyle = getCapability(OutlineCapability.class)
|
||||
.getLineStyle();
|
||||
// set the magnification for the display state
|
||||
displayState.magnification = getCapability(
|
||||
MagnificationCapability.class).getMagnification().floatValue();
|
||||
|
||||
PaintProperties newProps = new BoundaryProperties(paintProps,
|
||||
displayState);
|
||||
|
||||
display.paint(target, newProps);
|
||||
|
||||
manager.setHandleInput(displayState.isEditable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type == ChangeType.CAPABILITY) {
|
||||
displayState.geomChanged = true;
|
||||
if (object instanceof EditableCapability) {
|
||||
displayState.editable = ((EditableCapability) object)
|
||||
.isEditable();
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
public BoundaryState getBoundaryState() {
|
||||
return displayState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
DataTime[] frameTimes = descriptor.getFramesInfo().getFrameTimes();
|
||||
if (frameTimes != null) {
|
||||
descriptor.getTimeMatchingMap().put(this, frameTimes);
|
||||
}
|
||||
return getResourceName();
|
||||
}
|
||||
|
||||
public void resetState() {
|
||||
displayState = new BoundaryState();
|
||||
initializeState(displayState);
|
||||
}
|
||||
|
||||
public BoundaryUIManager getUIManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
protected String getAddVertexText() {
|
||||
return "Add Vertex";
|
||||
}
|
||||
|
||||
protected String getDeleteVertexText() {
|
||||
return "Remove Vertex";
|
||||
}
|
||||
|
||||
protected abstract void initializeState(BoundaryState state);
|
||||
|
||||
protected abstract String getResourceName();
|
||||
|
||||
@Override
|
||||
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
||||
if (displayState.mode == Mode.DRAG_ME
|
||||
|| displayState.userAction != UserAction.INSERT_BOUNDARY) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (manager.closeToPoint()) {
|
||||
menuManager.add(manager.getDeleteAction());
|
||||
} else if (manager.closeToLine()) {
|
||||
menuManager.add(manager.getAddAction());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertiesChanged(ResourceProperties props) {
|
||||
manager.setHandleInput(props.isVisible());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||
displayState.geomChanged = true;
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,33 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
*
|
||||
* Entirely reused of A2 "StormTrackProperties" Class by renaming it
|
||||
* and its methods
|
||||
*/
|
||||
|
||||
public class BoundaryProperties extends PaintProperties {
|
||||
|
||||
private BoundaryState state;
|
||||
|
||||
public BoundaryProperties(PaintProperties props, BoundaryState state) {
|
||||
super(props);
|
||||
this.state = state;
|
||||
state.distanceThreshold = (props.getView().getExtent().getWidth() / props
|
||||
.getCanvasBounds().width) * 10;
|
||||
}
|
||||
|
||||
public BoundaryState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(BoundaryState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,258 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.ui.dialog.BoundaryEditorDialog;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou ba
|
||||
* @version 1.0
|
||||
*
|
||||
* April 2011: Substantially modified from A2 "StormTrackState" class
|
||||
*/
|
||||
|
||||
public class BoundaryState {
|
||||
|
||||
public enum Mode {
|
||||
DRAG_ME, TRACK, NONE
|
||||
};
|
||||
|
||||
public enum UserAction {
|
||||
SAVE("save me"), INSERT_BOUNDARY("line"), EDIT_BOUNDARY(" edit me"), DELETE_BOUNDARY(
|
||||
"delete me"), READ_ACTIVE_BOUNDARIES("read me"), CANCEL_MODIFICATION(
|
||||
"cancel modif"), NONE("no action");
|
||||
|
||||
public String dragWhat;
|
||||
|
||||
private UserAction(String text) {
|
||||
this.dragWhat = text;
|
||||
}
|
||||
}
|
||||
|
||||
public enum LabelMode {
|
||||
TIME, SPEED;
|
||||
}
|
||||
|
||||
public static class BoundaryPolyLine {
|
||||
public LineString polyline;
|
||||
|
||||
public DataTime time;
|
||||
|
||||
public BoundaryPolyLine(LineString polyline, DataTime time) {
|
||||
this.polyline = polyline;
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
|
||||
/** Drawing mode, TRACK or DRAG */
|
||||
public Mode mode;
|
||||
|
||||
/**
|
||||
* User's actions: Insert, Edit, Save, Delete a boundary, or Select a
|
||||
* boundary type ------------- and Read from XML when the tool opens
|
||||
*/
|
||||
public UserAction userAction;
|
||||
|
||||
/**
|
||||
* How to draw the labels (SPEED or TIME)
|
||||
*/
|
||||
public LabelMode labelMode;
|
||||
|
||||
public boolean editable = true;
|
||||
|
||||
// public boolean isMoving = false;
|
||||
|
||||
public Map<Integer, Boolean> isMovingMap = new HashMap<Integer, Boolean>();
|
||||
|
||||
public boolean isEditable() {
|
||||
return editable;
|
||||
}
|
||||
|
||||
/** the array of time/loc coordinates for the frames */
|
||||
|
||||
public BoundaryPolyLine[] timePoints;
|
||||
|
||||
public Map<Integer, BoundaryPolyLine[]> timePointsMap = new HashMap<Integer, BoundaryPolyLine[]>();
|
||||
|
||||
/**
|
||||
* The future points, will include timePoints[timePoints.length-1] as
|
||||
* element 0
|
||||
*/
|
||||
public BoundaryPolyLine[] futurePoints;
|
||||
|
||||
public Map<Integer, BoundaryPolyLine[]> futurePointsMap = new HashMap<Integer, BoundaryPolyLine[]>();
|
||||
|
||||
/** The Points for the drag me points */
|
||||
public Point[] dragMePoint;
|
||||
|
||||
public Point newLineCenter;
|
||||
|
||||
/** Drag me line */
|
||||
public LineString dragMeLine;
|
||||
|
||||
public LineString editedLineForMotionComputation;
|
||||
|
||||
public int displayedIndexAtStartMotionCompute;
|
||||
|
||||
public int frameAtCreationTime = 0;
|
||||
|
||||
public int motionIndex;
|
||||
|
||||
public boolean dragingLineNotAllowed = false;
|
||||
|
||||
public boolean lineIsMoving = false;
|
||||
|
||||
public boolean movingEdited = false;
|
||||
|
||||
public boolean loopingWasOn = false;
|
||||
|
||||
public boolean motionIsResetToStationary = false;
|
||||
|
||||
public LineString prevBoundary;
|
||||
|
||||
/** Map to store active boundaries */
|
||||
public Map<Integer, LineString> boundariesMap = new HashMap<Integer, LineString>();
|
||||
|
||||
// public Map<String, String> boundaryIdsMap = new HashMap<String,
|
||||
// String>();
|
||||
|
||||
/** Drag me Line for the points for the drag me points */
|
||||
public Map<Integer, LineString> dragMePointMap = new HashMap<Integer, LineString>();
|
||||
|
||||
/** Map to store the list of forbidden ids (deleted boundaries */
|
||||
public Map<Integer, Integer> forbiddenBoundaryIdsMap = new HashMap<Integer, Integer>();
|
||||
|
||||
/** Drag me line creation/modification time */
|
||||
// public DataTime createTime;
|
||||
public Map<Integer, DataTime> createTimeMap = new HashMap<Integer, DataTime>();
|
||||
|
||||
public Map<Integer, DataTime> editedTimeMap = new HashMap<Integer, DataTime>();
|
||||
|
||||
/** Drag me line expiration time */
|
||||
// public DataTime createTime;
|
||||
public Map<Integer, DataTime> expirationTimeMap = new HashMap<Integer, DataTime>();
|
||||
|
||||
public Map<Integer, String> logMap = new HashMap<Integer, String>();
|
||||
|
||||
/** Geometry object when mouse is down */
|
||||
public Geometry mouseDownGeom;
|
||||
|
||||
/** current geometry object */
|
||||
public Geometry dragMeGeom;
|
||||
|
||||
// parameters passed to method saving the data
|
||||
public int timeIndex = 0;
|
||||
|
||||
public DataTime[] currentDataTimes = null;
|
||||
|
||||
public BoundaryEditorDialog dialogObject = null;
|
||||
|
||||
/** Number of drag points for line to start with. when line is created */
|
||||
public int numDragMePoints;
|
||||
|
||||
/** index into timePoints where pivot point should be */
|
||||
public int pivotIndex;
|
||||
|
||||
/** The pivot index to use when current frame index is on pivotIndex */
|
||||
public int otherPivotIndex;
|
||||
|
||||
/** The next pivot index to use */
|
||||
public int nextPivotIndex = -1;
|
||||
|
||||
/** The currently displayed pivot index (pivotIndex or otherPivotIndex) */
|
||||
public int displayedPivotIndex;
|
||||
|
||||
/** The angle of the line */
|
||||
public double angle = Double.NaN;
|
||||
|
||||
public float[] vertexAngle = null;
|
||||
|
||||
public Map<Integer, float[]> vertexAngleMap = new HashMap<Integer, float[]>();
|
||||
|
||||
/** The speed of the line */
|
||||
public double speed = Double.NaN;
|
||||
|
||||
public float[] vertexSpeed = null;
|
||||
|
||||
public Map<Integer, float[]> vertexSpeedMap = new HashMap<Integer, float[]>();
|
||||
|
||||
/** "Storm" or "feature" or whatever you want people to drag the point to */
|
||||
public String thingToDragTo;
|
||||
|
||||
public int editedBoundaryId;
|
||||
|
||||
public String boundaryType;
|
||||
|
||||
public Map<Integer, String> boundaryTypeMap = new HashMap<Integer, String>();
|
||||
|
||||
public int boundaryId;
|
||||
|
||||
public String fileName;
|
||||
|
||||
/**
|
||||
* size of line of storms, not sure about units. Used when poly line is
|
||||
* first constructed
|
||||
*/
|
||||
public double lineOfStormsLength = 30000;
|
||||
|
||||
/**
|
||||
* Some value calculated in BoundaryProperties based on some things, used
|
||||
* with lineOfStormsLength
|
||||
*/
|
||||
public double distanceThreshold;
|
||||
|
||||
/** Set true if the geometry has changed and needs to be redrawn */
|
||||
public boolean geomChanged = true;
|
||||
|
||||
/** set true if the number of vertex in the line increases/decreases */
|
||||
|
||||
public boolean numberPointChanged = false;
|
||||
|
||||
// Resource capabilities
|
||||
/** The width of the line to draw, resource should set before passed on */
|
||||
public float lineWidth;
|
||||
|
||||
/** The style of the line to draw */
|
||||
public IGraphicsTarget.LineStyle lineStyle;
|
||||
|
||||
/** The color of the lines to draw, resource should set */
|
||||
public RGB color = new RGB(255, 255, 255);
|
||||
|
||||
/** Duration of the future time in minutes */
|
||||
public int duration = -1;
|
||||
|
||||
/** Set if you want to change the duration */
|
||||
public int newDuration = -1;
|
||||
|
||||
public boolean trackVisible = true;
|
||||
|
||||
public boolean lineMoved = false;
|
||||
|
||||
/** set magnification to default value */
|
||||
public float magnification = 1.0f;
|
||||
|
||||
public Map<Integer, Boolean> existingBoundaryNotEmptyMap = new HashMap<Integer, Boolean>();
|
||||
|
||||
public DataTime creationFileTime = null;
|
||||
|
||||
public Map<Integer, Boolean> lineMovedMap = new HashMap<Integer, Boolean>();
|
||||
|
||||
public int boundaryDuration = 8;
|
||||
|
||||
public Map<Integer, Integer> boundaryDurationMap = new HashMap<Integer, Integer>();
|
||||
|
||||
/** Set if you the duration needs to be calculated from the end time */
|
||||
public Calendar endTime = null;
|
||||
|
||||
}
|
|
@ -0,0 +1,682 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.Mode;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.UserAction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||
import com.raytheon.viz.ui.input.InputAdapter;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineSegment;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou ba
|
||||
* @version 1.0
|
||||
*
|
||||
* Substantially modified of A2 "StormTrackUIManager" class
|
||||
*/
|
||||
|
||||
public class BoundaryUIManager extends InputAdapter {
|
||||
|
||||
private enum MoveType {
|
||||
SINGLE_POINT, ALL_POINTS;
|
||||
}
|
||||
|
||||
private AbstractBoundaryResource controller;
|
||||
|
||||
private Cursor movePolygon;
|
||||
|
||||
private Cursor movePoint;
|
||||
|
||||
private MoveType moveType = null;
|
||||
|
||||
private int movePointIndex = -1;
|
||||
|
||||
private int lastX, lastY;
|
||||
|
||||
private boolean pointCreated = false;
|
||||
|
||||
private boolean handle = true;
|
||||
|
||||
private BoundaryUtil trackUtil;
|
||||
|
||||
public static final double point_coord = 3.0;
|
||||
|
||||
public BoundaryUIManager(AbstractBoundaryResource controller) {
|
||||
this.controller = controller;
|
||||
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
if (container != null) {
|
||||
container.registerMouseHandler(this);
|
||||
}
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Display display = getShell().getDisplay();
|
||||
movePolygon = display.getSystemCursor(SWT.CURSOR_SIZEALL);
|
||||
movePoint = display.getSystemCursor(SWT.CURSOR_HAND);
|
||||
display.getSystemCursor(SWT.CURSOR_ARROW);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
if (container != null) {
|
||||
container.unregisterMouseHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param draw
|
||||
*/
|
||||
public void setHandleInput(boolean handle) {
|
||||
this.handle = handle;
|
||||
if (!handle) {
|
||||
getShell().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHandleInput() {
|
||||
if (handle) {
|
||||
if (controller.displayState.mode != Mode.NONE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseMove(int x, int y) {
|
||||
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
if (!isHandleInput()) {
|
||||
return super.handleMouseMove(x, y);
|
||||
}
|
||||
moveType = null;
|
||||
movePointIndex = -1;
|
||||
pointCreated = false;
|
||||
Coordinate mouse = new Coordinate(x, y);
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (state.isEditable() == false) {
|
||||
return super.handleMouseMove(x, y);
|
||||
}
|
||||
Geometry dragme = state.dragMeGeom;
|
||||
Cursor toUse = null;
|
||||
if (dragme != null) {
|
||||
Coordinate[] coords = dragme.getCoordinates();
|
||||
int idx = getCoordinateIndex(controller, coords, mouse);
|
||||
if (idx > -1) {
|
||||
toUse = movePoint;
|
||||
moveType = MoveType.SINGLE_POINT;
|
||||
/*
|
||||
* In AWIPS I, When Looping Is Enabled Before A Track Has Been
|
||||
* Created, Looping Will Automatically Be Disabled When TheMouse
|
||||
* Cursor Comes Into The Proximity Of The Tool.
|
||||
*/
|
||||
if (state.mode == BoundaryState.Mode.DRAG_ME) {
|
||||
if (container.getLoopProperties().isLooping()) {
|
||||
container.getLoopProperties().setLooping(false);
|
||||
state.loopingWasOn = true;
|
||||
}
|
||||
}
|
||||
movePointIndex = idx;
|
||||
}
|
||||
|
||||
if (moveType == null) {
|
||||
if (state.userAction == UserAction.INSERT_BOUNDARY
|
||||
|| state.userAction == UserAction.EDIT_BOUNDARY) {
|
||||
if (closeToLine(controller, coords, mouse)) {
|
||||
toUse = movePolygon;
|
||||
moveType = MoveType.ALL_POINTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getShell().setCursor(toUse);
|
||||
return super.handleMouseMove(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
||||
if (controller.getBoundaryState().dragingLineNotAllowed) {
|
||||
return false;
|
||||
}
|
||||
if (!isHandleInput()) {
|
||||
return super.handleMouseDown(x, y, mouseButton);
|
||||
}
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
pointCreated = false;
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (state.isEditable() == false) {
|
||||
return super.handleMouseDown(x, y, mouseButton);
|
||||
}
|
||||
if (mouseButton == 1 && moveType != null) {
|
||||
Geometry moveGeom = (Geometry) state.dragMeGeom.clone();
|
||||
state.mouseDownGeom = moveGeom;
|
||||
return true;
|
||||
} else if (mouseButton == 2 && moveType != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
moveType = null;
|
||||
movePointIndex = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||
if (controller.getBoundaryState().dragingLineNotAllowed) {
|
||||
return false;
|
||||
}
|
||||
if (controller.getBoundaryState().movingEdited) {
|
||||
return false;
|
||||
}
|
||||
if (!isHandleInput()) {
|
||||
return super.handleMouseDownMove(x, y, mouseButton);
|
||||
}
|
||||
boolean move = false;
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (state.isEditable() == false) {
|
||||
return super.handleMouseDownMove(x, y, mouseButton);
|
||||
}
|
||||
if (mouseButton == 1 && moveType != null) {
|
||||
move = true;
|
||||
} else if (mouseButton == 2
|
||||
&& moveType != null
|
||||
&& controller.getBoundaryState().userAction == UserAction.INSERT_BOUNDARY
|
||||
&& controller.getBoundaryState().lineIsMoving == false) {
|
||||
if (!pointCreated) {
|
||||
state = controller.getBoundaryState();
|
||||
pointCreated = true;
|
||||
movePointIndex = addVertex(lastX, lastY);
|
||||
state.mouseDownGeom = (Geometry) state.dragMeGeom.clone();
|
||||
moveType = MoveType.SINGLE_POINT;
|
||||
}
|
||||
move = true;
|
||||
}
|
||||
|
||||
if (move) {
|
||||
move(x, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.handleMouseDownMove(x, y, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||
if (controller.getBoundaryState().dragingLineNotAllowed) {
|
||||
controller.getBoundaryState().dragingLineNotAllowed = false;
|
||||
return false;
|
||||
}
|
||||
if (!isHandleInput()) {
|
||||
super.handleMouseUp(x, y, mouseButton);
|
||||
}
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
boolean rval = false;
|
||||
if (((mouseButton == 1) || (mouseButton == 2 && pointCreated && controller
|
||||
.getBoundaryState().lineIsMoving == false)) && moveType != null) {
|
||||
state.dragMeGeom = state.mouseDownGeom;
|
||||
state.mouseDownGeom = null;
|
||||
if (state.mode == Mode.DRAG_ME) {
|
||||
state.mode = Mode.TRACK;
|
||||
}
|
||||
state.lineMovedMap.put(state.boundaryId, true);
|
||||
FramesInfo info = controller.getDescriptor().getFramesInfo();
|
||||
trackUtil.setPivotIndexes(info, state);
|
||||
|
||||
// This code is duplicated from StormTrackDisplay.paint().
|
||||
if (state.displayedPivotIndex == trackUtil.getCurrentFrame(info)) {
|
||||
if (state.displayedPivotIndex == state.pivotIndex
|
||||
&& state.otherPivotIndex >= 0) {
|
||||
state.displayedPivotIndex = state.otherPivotIndex;
|
||||
} else if (state.pivotIndex >= 0) {
|
||||
state.displayedPivotIndex = state.pivotIndex;
|
||||
}
|
||||
}
|
||||
rval = true;
|
||||
} else if (mouseButton == 2 && !pointCreated) {
|
||||
rval = true;
|
||||
Coordinate[] coords = state.dragMeGeom.getCoordinates();
|
||||
Coordinate mouse = new Coordinate(x, y);
|
||||
int idxToDelete = getCoordinateIndex(controller, coords, mouse);
|
||||
if (idxToDelete >= 0) {
|
||||
if (!controller.getBoundaryState().lineIsMoving)
|
||||
deleteVertex(idxToDelete);
|
||||
} else if (closeToLine(controller, coords, mouse)) {
|
||||
if (!controller.getBoundaryState().lineIsMoving) {
|
||||
addVertex(lastX, lastY);
|
||||
}
|
||||
} else {
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rval) {
|
||||
state.geomChanged = true;
|
||||
|
||||
state.dragMeLine = (LineString) state.dragMeGeom;
|
||||
state.boundariesMap.put(state.boundaryId, state.dragMeLine);
|
||||
|
||||
updateNumberOfPointsForLine();
|
||||
controller.issueRefresh();
|
||||
}
|
||||
pointCreated = false;
|
||||
return rval;
|
||||
}
|
||||
|
||||
public static int getCoordinateIndex(AbstractBoundaryResource resource,
|
||||
Coordinate[] coords, Coordinate mouse) {
|
||||
return getCoordinateIndex(resource.getResourceContainer(), coords,
|
||||
mouse, 15.0);
|
||||
}
|
||||
|
||||
public static int getCoordinateIndex(IDisplayPaneContainer container,
|
||||
Coordinate[] coords, Coordinate mouse, double threshold) {
|
||||
int rval = -1;
|
||||
int i = 0;
|
||||
for (Coordinate c : coords) {
|
||||
double[] screen = container.translateInverseClick(c);
|
||||
if (screen != null) {
|
||||
c = new Coordinate(screen[0], screen[1]);
|
||||
if (c.distance(mouse) <= threshold) {
|
||||
rval = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
public static boolean closeToLine(AbstractBoundaryResource controller,
|
||||
Coordinate[] coords, Coordinate mouse) {
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
if (coords.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
List<Coordinate> inverted = new ArrayList<Coordinate>(coords.length);
|
||||
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
double[] vals = container.translateInverseClick(coords[i]);
|
||||
|
||||
// handle offscreen coords
|
||||
// TODO: use nearest point on line that is on screen?
|
||||
if (vals != null) {
|
||||
inverted.add(new Coordinate(vals[0], vals[1]));
|
||||
}
|
||||
}
|
||||
|
||||
if (inverted.size() > 1) {
|
||||
return (gf.createLineString(
|
||||
inverted.toArray(new Coordinate[inverted.size()]))
|
||||
.distance(gf.createPoint(mouse)) <= point_coord);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void move(int x, int y) {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
|
||||
int changeX = x - lastX;
|
||||
int changeY = y - lastY;
|
||||
switch (moveType) {
|
||||
case ALL_POINTS: {
|
||||
Coordinate[] coords = state.mouseDownGeom.getCoordinates();
|
||||
for (Coordinate c : coords) {
|
||||
double[] vals = container.translateInverseClick(c);
|
||||
vals[0] += changeX;
|
||||
vals[1] += changeY;
|
||||
|
||||
Coordinate tmp = container.translateClick(vals[0], vals[1]);
|
||||
if (tmp != null) {
|
||||
c.x = tmp.x;
|
||||
c.y = tmp.y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SINGLE_POINT: {
|
||||
if (state.mouseDownGeom != null) {
|
||||
Coordinate[] coords = state.mouseDownGeom.getCoordinates();
|
||||
Coordinate c = coords[movePointIndex];
|
||||
double[] vals = container.translateInverseClick(c);
|
||||
vals[0] += changeX;
|
||||
vals[1] += changeY;
|
||||
|
||||
Coordinate tmp = container.translateClick(vals[0], vals[1]);
|
||||
if (tmp != null) {
|
||||
c.x = tmp.x;
|
||||
c.y = tmp.y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
controller.issueRefresh();
|
||||
}
|
||||
|
||||
public int addVertex(int x, int y) {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
double bestDistance = Double.MAX_VALUE;
|
||||
int insertionPoint = 0;
|
||||
Coordinate[] coords = state.dragMeGeom.getCoordinates();
|
||||
Coordinate mouse = container.translateClick(x, y);
|
||||
for (int i = 1; i < coords.length; i++) {
|
||||
LineSegment segment = new LineSegment(coords[i - 1], coords[i]);
|
||||
double distance = segment.distance(mouse);
|
||||
if (distance < bestDistance) {
|
||||
insertionPoint = i;
|
||||
bestDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
Coordinate[] newLine = new Coordinate[coords.length + 1];
|
||||
for (int i = 0; i < newLine.length; i++) {
|
||||
if (i < insertionPoint) {
|
||||
newLine[i] = coords[i];
|
||||
} else if (i > insertionPoint) {
|
||||
newLine[i] = coords[i - 1];
|
||||
} else {
|
||||
newLine[i] = mouse;
|
||||
}
|
||||
}
|
||||
|
||||
state.dragMeGeom = new GeometryFactory().createLineString(newLine);
|
||||
state.geomChanged = true;
|
||||
state.numberPointChanged = true;
|
||||
return insertionPoint;
|
||||
}
|
||||
|
||||
public void deleteVertex(int index) {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
Coordinate[] coords = state.dragMeGeom.getCoordinates();
|
||||
if (coords.length > 2) {
|
||||
Coordinate[] newCoords = new Coordinate[coords.length - 1];
|
||||
int j = 0;
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
if (i != index) {
|
||||
newCoords[j++] = coords[i];
|
||||
}
|
||||
}
|
||||
|
||||
state.dragMeGeom = new GeometryFactory()
|
||||
.createLineString(newCoords);
|
||||
state.geomChanged = true;
|
||||
state.numberPointChanged = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateNumberOfPointsForLine() {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (state.timePointsMap.get(state.boundaryId) != null)
|
||||
state.dragMePointMap.remove(state.boundaryId);
|
||||
state.dragMePointMap.put(state.boundaryId,
|
||||
state.boundariesMap.get(state.boundaryId));
|
||||
Coordinate[] coords = state.dragMePointMap.get(state.boundaryId)
|
||||
.getCoordinates();
|
||||
state.dragMePoint = new Point[coords.length];
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
for (int k = 0; k < coords.length; k++) {
|
||||
state.dragMePoint[k] = gf.createPoint(coords[k]);
|
||||
}
|
||||
|
||||
// Check if a vertex is added or deleted in the boundary;
|
||||
// if so, update the polyline accordingly along the track
|
||||
state.timePoints = state.timePointsMap.get(state.boundaryId);
|
||||
if (state.timePoints != null) {
|
||||
|
||||
for (int i = 0; i < state.timePoints.length; i++) {
|
||||
Point point = getPointFromLine(state.timePoints[i].polyline);
|
||||
state.timePoints[i].polyline = figureLineFromPoint(
|
||||
state.dragMePointMap.get(state.boundaryId), point);
|
||||
state.numberPointChanged = false;
|
||||
}
|
||||
state.timePointsMap.put(state.boundaryId, state.timePoints);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Point getPointFromLine(LineString line) {
|
||||
Coordinate[] coords = line.getCoordinates();
|
||||
if (coords.length % 2 == 1) {
|
||||
return new GeometryFactory()
|
||||
.createPoint(coords[(coords.length - 1) / 2]);
|
||||
} else {
|
||||
Coordinate middleLeft = coords[coords.length / 2];
|
||||
Coordinate middleRight = coords[(coords.length - 2) / 2];
|
||||
return new GeometryFactory().createPoint(new Coordinate(
|
||||
middleLeft.x + ((middleRight.x - middleLeft.x) / 2),
|
||||
middleLeft.y + ((middleRight.y - middleLeft.y) / 2)));
|
||||
}
|
||||
}
|
||||
|
||||
public static Point getPointFromLine(LineString line, int indexVertex) {
|
||||
Coordinate[] coords = line.getCoordinates();
|
||||
return new GeometryFactory().createPoint(coords[indexVertex]);
|
||||
|
||||
}
|
||||
|
||||
public LineString figureLineFromPoint(LineString line, Point pointGeom) {
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
Coordinate point = pointGeom.getCoordinate();
|
||||
Coordinate linePoint = getPointFromLine(line).getCoordinate();
|
||||
|
||||
double[] dest = container.translateInverseClick(point);
|
||||
double[] start = container.translateInverseClick(linePoint);
|
||||
|
||||
double changeX = dest[0] - start[0];
|
||||
double changeY = dest[1] - start[1];
|
||||
|
||||
Coordinate[] coords = line.getCoordinates();
|
||||
Coordinate[] newLineCoords = new Coordinate[coords.length];
|
||||
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
double[] vals = container.translateInverseClick(coords[i]);
|
||||
newLineCoords[i] = container.translateClick(vals[0] + changeX,
|
||||
vals[1] + changeY);
|
||||
}
|
||||
return new GeometryFactory().createLineString(newLineCoords);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return null if the line or point are offscreen.
|
||||
*
|
||||
* @param line
|
||||
* @param pointGeom
|
||||
* @return
|
||||
*/
|
||||
public LineString figureLineFromPoint(LineString line, Point[] pointGeom)
|
||||
throws ImpossibleTrackException {
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
|
||||
IDisplayPane pane = container.getActiveDisplayPane();
|
||||
|
||||
Coordinate[] coords = line.getCoordinates();
|
||||
Coordinate[] newLineCoords = new Coordinate[coords.length];
|
||||
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
Coordinate point = pointGeom[i].getCoordinate();
|
||||
Coordinate linePoint = getPointFromLine(line, i).getCoordinate();
|
||||
|
||||
double[] dest = container.translateInverseClick(point);
|
||||
double[] start = container.translateInverseClick(linePoint);
|
||||
if (dest != null && start != null) {
|
||||
double changeX = dest[0] - start[0];
|
||||
double changeY = dest[1] - start[1];
|
||||
double[] vals = container.translateInverseClick(coords[i]);
|
||||
double[] translated = pane.getDescriptor().pixelToWorld(
|
||||
pane.screenToGrid(vals[0] + changeX, vals[1] + changeY,
|
||||
|
||||
0));
|
||||
newLineCoords[i] = new Coordinate(translated[0], translated[1]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new GeometryFactory().createLineString(newLineCoords);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean closeToPoint() {
|
||||
LineString line = null;
|
||||
for (Integer boundaryId : controller.getBoundaryState().boundariesMap
|
||||
.keySet()) {
|
||||
if (boundaryId == controller.getBoundaryState().boundaryId) {
|
||||
line = controller.getBoundaryState().boundariesMap
|
||||
.get(boundaryId);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return getCoordinateIndex(controller, line.getCoordinates(),
|
||||
new Coordinate(lastX, lastY)) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean closeToLine() {
|
||||
LineString line = null;
|
||||
for (Integer boundaryId : controller.getBoundaryState().boundariesMap
|
||||
.keySet()) {
|
||||
if (boundaryId == controller.getBoundaryState().boundaryId) {
|
||||
line = controller.getBoundaryState().boundariesMap
|
||||
.get(boundaryId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return closeToLine(controller, line.getCoordinates(), new Coordinate(
|
||||
lastX, lastY));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IAction getDeleteAction() {
|
||||
return new DeleteVertexAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IAction getAddAction() {
|
||||
return new AddVertexAction();
|
||||
}
|
||||
|
||||
private class DeleteVertexAction extends AbstractRightClickAction {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (!controller.getBoundaryState().lineIsMoving)
|
||||
deleteVertex(getCoordinateIndex(controller, state.boundariesMap
|
||||
.get(state.boundaryId).getCoordinates(),
|
||||
new Coordinate(lastX, lastY)));
|
||||
state.dragMeLine = (LineString) state.dragMeGeom;
|
||||
state.geomChanged = true;
|
||||
updateNumberOfPointsForLine();
|
||||
controller.issueRefresh();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#getText()
|
||||
*/
|
||||
@Override
|
||||
public String getText() {
|
||||
return controller.getDeleteVertexText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AddVertexAction extends AbstractRightClickAction {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
BoundaryState state = controller.getBoundaryState();
|
||||
if (!controller.getBoundaryState().lineIsMoving)
|
||||
addVertex(lastX, lastY);
|
||||
state.dragMeLine = (LineString) state.dragMeGeom;
|
||||
state.geomChanged = true;
|
||||
updateNumberOfPointsForLine();
|
||||
controller.issueRefresh();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)B
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#getText()
|
||||
*/
|
||||
@Override
|
||||
public String getText() {
|
||||
return controller.getAddVertexText();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param trackUtil
|
||||
*/
|
||||
public void setTrackUtil(BoundaryUtil trackUtil) {
|
||||
this.trackUtil = trackUtil;
|
||||
}
|
||||
|
||||
public BoundaryUtil getTrackUtil() {
|
||||
return trackUtil;
|
||||
}
|
||||
|
||||
private Shell getShell() {
|
||||
IDisplayPaneContainer container = controller.getResourceContainer();
|
||||
if (container instanceof IWorkbenchPart) {
|
||||
return ((IWorkbenchPart) container).getSite().getShell();
|
||||
} else {
|
||||
return VizWorkbenchManager.getInstance().getCurrentWindow()
|
||||
.getShell();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*
|
||||
* Slightly modified of "StormTrackUti" class
|
||||
*/
|
||||
|
||||
public class BoundaryUtil {
|
||||
|
||||
public BoundaryUtil() {
|
||||
}
|
||||
|
||||
public int getFrameCount(FramesInfo info) {
|
||||
int len = makeUniqueTimes(info.getFrameTimes()).length;
|
||||
return len;
|
||||
}
|
||||
|
||||
public int getCurrentFrame(FramesInfo info) {
|
||||
int returnIndex = 0;
|
||||
if (info.getFrameTimes() == null || info.getFrameCount() < 1) {
|
||||
return -1;
|
||||
}
|
||||
DataTime[] uniqueTimes = makeUniqueTimes(info.getFrameTimes());
|
||||
DataTime currTime = info.getFrameTimes()[info.getFrameIndex()];
|
||||
|
||||
if (uniqueTimes == null) {
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < uniqueTimes.length; i++) {
|
||||
if (currTime.equals(uniqueTimes[i], true)) {
|
||||
returnIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnIndex;
|
||||
}
|
||||
|
||||
public DataTime[] getDataTimes(FramesInfo info) {
|
||||
return makeUniqueTimes(info.getFrameTimes());
|
||||
}
|
||||
|
||||
public void setPivotIndexes(FramesInfo info, BoundaryState boundaryState) {
|
||||
int lastFrame = getFrameCount(info) - 1;
|
||||
if (getCurrentFrame(info) == lastFrame) {
|
||||
// We Are Presently On The Last Frame.
|
||||
boundaryState.otherPivotIndex = 0;
|
||||
boundaryState.nextPivotIndex = lastFrame;
|
||||
boundaryState.pivotIndex = lastFrame;
|
||||
} else {
|
||||
boundaryState.otherPivotIndex = 0;
|
||||
boundaryState.nextPivotIndex = -1;
|
||||
boundaryState.pivotIndex = lastFrame;
|
||||
}
|
||||
}
|
||||
|
||||
private DataTime[] makeUniqueTimes(DataTime[] times) {
|
||||
List<DataTime> uniqueTimes = new ArrayList<DataTime>();
|
||||
if (times != null && times.length > 0) {
|
||||
DataTime lastTime = times[0];
|
||||
uniqueTimes.add(times[0]);
|
||||
for (int i = 1; i < times.length; ++i) {
|
||||
if (!lastTime.equals(times[i], true)) {
|
||||
uniqueTimes.add(times[i]);
|
||||
lastTime = times[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return uniqueTimes.toArray(new DataTime[uniqueTimes.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time between times in seconds using valid time
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
public int timeBetweenDataTimes(DataTime a, DataTime b) {
|
||||
return (int) (Math.abs(a.getValidTime().getTimeInMillis()
|
||||
- b.getValidTime().getTimeInMillis()) / 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the angle from -360/360 to be between -180/180
|
||||
*
|
||||
* @param angle
|
||||
* @return
|
||||
*/
|
||||
protected double adjustAngle(double angle) {
|
||||
double newVal = angle % 360;
|
||||
if (newVal > 180) {
|
||||
newVal -= 360;
|
||||
} else if (newVal < -180) {
|
||||
newVal += 360;
|
||||
}
|
||||
return newVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the angle from -180/180 to be between 0/360
|
||||
*
|
||||
* @param angle
|
||||
* @return
|
||||
*/
|
||||
protected double unadjustAngle(double angle) {
|
||||
double newVal = angle;
|
||||
if (newVal < 0) {
|
||||
newVal = 360 - newVal;
|
||||
}
|
||||
return newVal;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.common.boundary;
|
||||
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
*
|
||||
* Entirely reused of A2 "ImpossibleTrackException" class
|
||||
*/
|
||||
|
||||
public class ImpossibleTrackException extends VizException {
|
||||
|
||||
private static final long serialVersionUID = -7171916545937661879L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ImpossibleTrackException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public ImpossibleTrackException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public ImpossibleTrackException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public ImpossibleTrackException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.ui.action;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.ui.layer.BoundaryEditorLayer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
|
||||
|
||||
/**
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
*
|
||||
* April 2011: Substantially modified from A2 "TimeOfArrivalAction"
|
||||
* class
|
||||
*/
|
||||
|
||||
public class BoundaryEditorAction extends
|
||||
AbstractGenericToolAction<BoundaryEditorLayer> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @seecom.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<BoundaryEditorLayer> getResourceData() {
|
||||
return new GenericToolsResourceData<BoundaryEditorLayer>(
|
||||
BoundaryEditorLayer.NAME, BoundaryEditorLayer.class);
|
||||
|
||||
}
|
||||
|
||||
// November 25, 2013
|
||||
|
||||
@Override
|
||||
protected BoundaryEditorLayer getResource(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
BoundaryEditorLayer layer = getExistingResource();
|
||||
if (layer == null)
|
||||
return super.getResource(loadProperties, descriptor);
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BoundaryEditorLayer layer = getExistingResource();
|
||||
if (layer != null) {
|
||||
layer.makeEditableAndReopenDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
return layer;
|
||||
|
||||
}
|
||||
|
||||
private BoundaryEditorLayer getExistingResource() {
|
||||
IDisplayPane[] panes = getSelectedPanes();
|
||||
if (panes != null && panes.length > 0) {
|
||||
List<BoundaryEditorLayer> layers = null;
|
||||
layers = panes[0].getDescriptor().getResourceList()
|
||||
.getResourcesByTypeAsType(BoundaryEditorLayer.class);
|
||||
if (!layers.isEmpty()) {
|
||||
return layers.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,87 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.ui.dialog;
|
||||
|
||||
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.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou Ba
|
||||
* @version 1.0
|
||||
*
|
||||
* Dialog class which allows users to input a string defining a
|
||||
* boundary type
|
||||
*
|
||||
* December 2015: Initial creation
|
||||
*
|
||||
* January 2016: extends to use CaveSWTDialog dialog, and remove
|
||||
* unnecessary getters and setters
|
||||
*/
|
||||
|
||||
class UserInputBndType extends CaveSWTDialog {
|
||||
protected static Boolean isOK = false;
|
||||
protected String userInput;
|
||||
|
||||
public UserInputBndType(Shell parent) {
|
||||
this(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
|
||||
}
|
||||
|
||||
public UserInputBndType(Shell parent, int style) {
|
||||
super(parent, style);
|
||||
setText("Input Dialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(final Shell shell) {
|
||||
|
||||
shell.setLayout(new GridLayout(2, true));
|
||||
|
||||
Label label = new Label(shell, SWT.NONE);
|
||||
label.setText("Please enter a boundary type:");
|
||||
GridData data = new GridData();
|
||||
data.horizontalSpan = 2;
|
||||
label.setLayoutData(data);
|
||||
|
||||
final Text text = new Text(shell, SWT.BORDER);
|
||||
data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
data.horizontalSpan = 2;
|
||||
text.setLayoutData(data);
|
||||
|
||||
Button okButton = new Button(shell, SWT.PUSH);
|
||||
okButton.setText("OK");
|
||||
data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
okButton.setLayoutData(data);
|
||||
|
||||
okButton.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
userInput = text.getText();
|
||||
isOK = true;
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
Button cancelButton = new Button(shell, SWT.PUSH);
|
||||
cancelButton.setText("Cancel");
|
||||
data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
cancelButton.setLayoutData(data);
|
||||
cancelButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
isOK = false;
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
shell.setDefaultButton(okButton);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,319 @@
|
|||
package gov.noaa.nws.mdl.viz.boundaryTool.ui.layer;
|
||||
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.boundaries.state.xml.ReadBoundariesXmlFile;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.AbstractBoundaryResource;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState.LabelMode;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryUIManager;
|
||||
import gov.noaa.nws.mdl.viz.boundaryTool.ui.dialog.BoundaryEditorDialog;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
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.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ProgressiveDisclosureProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
import com.raytheon.viz.ui.input.InputAdapter;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mamoudou ba
|
||||
* @version 1.0
|
||||
*
|
||||
* April 2011: Based on A2 "TimeOfArrivalLayer" class
|
||||
*/
|
||||
|
||||
public class BoundaryEditorLayer extends AbstractBoundaryResource {
|
||||
|
||||
public static class BoundaryEditorState {
|
||||
public Coordinate loc;
|
||||
|
||||
public Coordinate mouseLoc;
|
||||
|
||||
// public String text = "Drag me to Point of Arrival";
|
||||
|
||||
public double distance;
|
||||
|
||||
public boolean changed;
|
||||
}
|
||||
|
||||
private final DateFormat timeFormat = new SimpleDateFormat("HH:mm");
|
||||
|
||||
public static final String NAME = "Boundary Editor";
|
||||
|
||||
private static final int PD_MAX_WIDTH = 1999000;
|
||||
|
||||
private IWireframeShape jazzyExtras;
|
||||
|
||||
private BoundaryEditorDialog dialog;
|
||||
|
||||
private BoundaryEditorState boundaryEditState;
|
||||
|
||||
private ProgressiveDisclosureProperties pdProps;
|
||||
|
||||
private Shell shell;
|
||||
|
||||
private Cursor movePoint;
|
||||
|
||||
private boolean hovering = false;
|
||||
|
||||
private InputAdapter adapter = new InputAdapter() {
|
||||
@Override
|
||||
public boolean handleMouseMove(int x, int y) {
|
||||
Coordinate mouse = new Coordinate(x, y);
|
||||
hovering = false;
|
||||
Coordinate loc = boundaryEditState.loc;
|
||||
|
||||
if (loc != null) {
|
||||
if (BoundaryUIManager.getCoordinateIndex(
|
||||
BoundaryEditorLayer.this, new Coordinate[] { loc },
|
||||
mouse) > -1) {
|
||||
shell.setCursor(movePoint);
|
||||
hovering = true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleMouseMove(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
||||
|
||||
if (mouseButton == 1 && hovering) {
|
||||
boundaryEditState.mouseLoc = new Coordinate(
|
||||
boundaryEditState.loc);
|
||||
issueRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// November 25 2013 - updated from TimeOfArrivalLayer
|
||||
@Override
|
||||
public boolean handleMouseDownMove(int arg_x, int arg_y, int mouseButton) {
|
||||
double x = arg_x;
|
||||
double y = arg_y;
|
||||
if (mouseButton == 1 && hovering) {
|
||||
|
||||
// check if point of arrival is off the drawn map, draw at
|
||||
// closest border if it is
|
||||
IDisplayPane pane = getResourceContainer()
|
||||
.getActiveDisplayPane();
|
||||
double[] world = pane.screenToGrid(x, y, 0);
|
||||
GridEnvelope ge = pane.getDescriptor().getGridGeometry()
|
||||
.getGridRange();
|
||||
IExtent extent = new PixelExtent(ge);
|
||||
if (world == null) {
|
||||
return true;
|
||||
} else if (extent.contains(world) == false) {
|
||||
// snap x coord to closest edge if out of bounds
|
||||
if (world[0] > extent.getMaxX()) {
|
||||
world[0] = extent.getMaxX();
|
||||
} else if (world[0] < extent.getMinX()) {
|
||||
world[0] = extent.getMinX();
|
||||
}
|
||||
|
||||
// snap y coord to closest edge if out of bounds
|
||||
if (world[1] > extent.getMaxY()) {
|
||||
world[1] = extent.getMaxY();
|
||||
} else if (world[1] < extent.getMinY()) {
|
||||
world[1] = extent.getMinY();
|
||||
}
|
||||
|
||||
// translate back to screen coords
|
||||
double[] screen = pane.gridToScreen(world);
|
||||
x = screen[0];
|
||||
y = screen[1];
|
||||
}
|
||||
|
||||
// translate from screen to lat/lon
|
||||
Coordinate c = getResourceContainer().translateClick(x, y);
|
||||
if (c != null) {
|
||||
boundaryEditState.mouseLoc = c;
|
||||
issueRefresh();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||
if (mouseButton == 1 && hovering) {
|
||||
boundaryEditState.loc = boundaryEditState.mouseLoc;
|
||||
boundaryEditState.mouseLoc = null;
|
||||
boundaryEditState.changed = true;
|
||||
|
||||
displayState.geomChanged = true;
|
||||
|
||||
issueRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public BoundaryEditorLayer(
|
||||
GenericToolsResourceData<BoundaryEditorLayer> resourceData,
|
||||
LoadProperties loadProperties, MapDescriptor descriptor) {
|
||||
super(resourceData, loadProperties, descriptor);
|
||||
// add magnification capability
|
||||
getCapabilities().addCapability(new MagnificationCapability());
|
||||
this.pdProps = new ProgressiveDisclosureProperties();
|
||||
this.pdProps.setMaxDisplayWidth(BoundaryEditorLayer.PD_MAX_WIDTH);
|
||||
|
||||
timeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
// reopenDialog();
|
||||
boundaryEditState = new BoundaryEditorState();
|
||||
|
||||
shell = VizWorkbenchManager.getInstance().getCurrentWindow().getShell();
|
||||
|
||||
Display display = Display.getCurrent();
|
||||
|
||||
movePoint = display.getSystemCursor(SWT.CURSOR_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
super.initInternal(target);
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container != null) {
|
||||
container.registerMouseHandler(adapter);
|
||||
}
|
||||
reopenDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
super.disposeInternal();
|
||||
dialog.close();
|
||||
displayState.dialogObject = null;
|
||||
if (jazzyExtras != null) {
|
||||
jazzyExtras.dispose();
|
||||
}
|
||||
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container != null) {
|
||||
container.unregisterMouseHandler(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.AbstractBoundaryResource
|
||||
* #getResourceName()
|
||||
*/
|
||||
@Override
|
||||
protected String getResourceName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.AbstractBoundaryResource
|
||||
* #initializeState
|
||||
* (gov.noaa.nws.mdl.viz.boundaryTool.common.boundary.BoundaryState)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeState(BoundaryState state) {
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container.getLoopProperties().isLooping()) {
|
||||
container.getLoopProperties().setLooping(false);
|
||||
state.loopingWasOn = true;
|
||||
}
|
||||
FramesInfo info = descriptor.getFramesInfo();
|
||||
// Setup the initial state for the storm track
|
||||
// Default angle for POINT
|
||||
displayState.userAction = BoundaryState.UserAction.READ_ACTIVE_BOUNDARIES;
|
||||
|
||||
displayState.labelMode = LabelMode.TIME;
|
||||
state.angle = 90;
|
||||
state.boundaryId = 0;
|
||||
state.dragMePoint = null;
|
||||
state.dragMeLine = null;
|
||||
// default for POLY, calculated usually
|
||||
state.lineOfStormsLength = 1000;
|
||||
state.mode = BoundaryState.Mode.DRAG_ME;
|
||||
state.numDragMePoints = 1;
|
||||
state.pivotIndex = trackUtil.getCurrentFrame(info);
|
||||
state.otherPivotIndex = displayState.pivotIndex > 0 ? 0 : trackUtil
|
||||
.getFrameCount(info) - 1;
|
||||
state.thingToDragTo = "boundary location";
|
||||
|
||||
ReadBoundariesXmlFile readXMLFile = new ReadBoundariesXmlFile();
|
||||
try {
|
||||
readXMLFile.readBoundariesXmlFile(state);
|
||||
readXMLFile = null;
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "No such file exists", e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "VisException", e);
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Data type configuration problem", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-opens the dialog if closed
|
||||
*/
|
||||
public void reopenDialog() {
|
||||
// Open the dialog
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (dialog == null || dialog.getShell() == null
|
||||
|| dialog.getShell().isDisposed()) {
|
||||
dialog = new BoundaryEditorDialog(VizWorkbenchManager
|
||||
.getInstance().getCurrentWindow().getShell(),
|
||||
BoundaryEditorLayer.this);
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.open();
|
||||
displayState.dialogObject = dialog;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// November 25, 2013
|
||||
|
||||
public void makeEditableAndReopenDialog() {
|
||||
EditableManager.makeEditable(this, true);
|
||||
reopenDialog();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue