first commit

This commit is contained in:
wyq 2019-02-26 17:55:04 +08:00
parent 6e2306f96e
commit 3c01f7a958
179 changed files with 30084 additions and 0 deletions

10
MeteoInfoMap/config.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="config.xml" Type="configurefile">
<Path OpenPath="D:\Temp\grads"/>
<Font>
<TextFont FontName="宋体" FontSize="15"/>
<LegendFont FontName="宋体" FontSize="12"/>
</Font>
<ScriptLanguage Language="Jython"/>
<Startup MainFormLocation="-6,-6" MainFormSize="1295,696" ShowMeteoDataDlg="true"/>
</MeteoInfo>

47
MeteoInfoMap/default.mip Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="default.mip" Type="projectfile">
<MapFrames>
<MapFrame Active="true" DrawGridLabel="true" DrawGridLine="false" DrawNeatLine="true" Expanded="true" GridFontName="Arial" GridFontSize="12" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH" GridXDelt="10.0" GridXOrigin="0.0" GridYDelt="10.0" GridYOrigin="0.0" Height="404" Left="48" Name="New Map Frame" NeatLineColor="0xff000000" NeatLineSize="1.0" Order="0" Top="30" Width="592">
<Extents xMax="180.0" xMin="-180.0" yMax="83.62359619140625" yMin="-90.0"/>
<MapProperty BackColor="0xffffffff" ForeColor="0xff000000" HighSpeedWheelZoom="true" MultiGlobalDraw="true" PointSmoothingMode="true" SelectColor="0xff66ffff" SmoothingMode="false" XYScaleFactor="1.0"/>
<GridLine DrawGridLine="false" DrawGridTickLine="false" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH"/>
<MaskOut MaskLayer="china.shp" SetMaskLayer="false"/>
<Projection IsLonLatMap="true" ProjStr="+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees "/>
<GroupLayer>
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\..\Temp\Map\country1.shp" Handle="1" IsMaskout="false" LayerDrawType="Map" LayerName="country1.shp" LayerType="VectorLayer" ShapeType="Polygon" TransparencyPerc="0" Visible="true">
<LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SingleSymbol" MaxValue="0.0" MinValue="0.0" ShapeType="Polygon" UNDEF="-9999.0">
<Breaks>
<Break BackColor="0x00ffffff" Caption="" Color="0xfffffbc3" DrawFill="false" DrawOutline="true" DrawShape="true" EndValue="0" OutlineColor="0xff000000" OutlineSize="1.0" StartValue="0" Style="NONE" StyleSize="8" Tag=""/>
</Breaks>
</LegendScheme>
<LabelSet AlignType="Center" AutoDecimal="true" AvoidCollision="true" DecimalDigits="2" DrawLabels="false" DrawShadow="false" FieldName="" FontName="宋体" FontSize="12" LabelColor="0xff000000" Offset="0" ShadowColor="0xffffffff"/>
<Graphics/>
<ChartSet AlignType="Center" AvoidCollision="true" BarWidth="8" ChartType="BarChart" DrawCharts="false" DrawLabel="false" FieldNames="" FontName="Arial" FontSize="12" LabelColor="0xff000000" MaxSize="50" MaxValue="0.0" MinSize="0" MinValue="0.0" Thickness="5" View3D="false" XShift="0" YShift="0">
<LegendScheme BreakNum="0" FieldName="" HasNoData="false" LegendType="SingleSymbol" MaxValue="0.0" MinValue="0.0" ShapeType="Polygon" UNDEF="0.0">
<Breaks/>
</LegendScheme>
</ChartSet>
<ChartGraphics/>
<VisibleScale EnableMaxVisScale="false" EnableMinVisScale="false" MaxVisScale="0.0" MinVisScale="0.0"/>
</Layer>
</GroupLayer>
<Graphics/>
</MapFrame>
</MapFrames>
<Layout BackColor="0xffffffff" ForeColor="0xff000000" Landscape="true" PaperSizeHeight="750" PaperSizeName="Custom" PaperSizeWidth="500" SmoothingMode="false">
<LayoutElements>
<LayoutMap DrawBackColor="false" DrawDegreeSymbol="false" DrawGridLabel="true" DrawGridLine="false" DrawNeatLine="true" ElementType="LayoutMap" GridFontName="Arial" GridFontSize="12" GridLabelPosition="LeftBottom" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH" GridXDelt="10.0" GridXOrigin="0.0" GridYDelt="10.0" GridYOrigin="0.0" Height="404" Left="48" NeatLineColor="0xff000000" NeatLineSize="1.0" Top="30" Width="592"/>
<LayoutGraphic ElementType="LayoutGraphic" Height="16" IsTitle="false" Left="309" Top="13" Width="106">
<Graphic>
<Shape Selected="false" ShapeType="Point" Visible="true">
<Points>
<Point X="362.0" Y="23.0"/>
</Points>
</Shape>
<Legend Angle="0.0" Color="0xff000000" FontBold="false" FontName="宋体" FontSize="16" LegendType="LabelBreak" Text="$\rm{Unit:} \mu g \ m^{-3}$" YShift="0.0"/>
</Graphic>
</LayoutGraphic>
<LayoutLegend BackColor="0x00000000" ColumnNumber="1" DrawBackColor="false" DrawChartBreaks="true" DrawNeatLine="false" ElementType="LayoutLegend" FontName="Arial" FontSize="10" ForceDrawOutline="true" Height="349" LayerUpdateType="FirstMeteoLayer" LayoutMapIndex="0" Left="650" LegendLayer="" LegendStyle="Bar_Vertical" NeatLineColor="0xff000000" NeatLineSize="1.0" Top="63" Width="39"/>
</LayoutElements>
</Layout>
</MeteoInfo>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath org.meteoinfo.desktop.forms.Program</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.meteoinfo.desktop.forms.Program</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath org.meteoinfo.desktop.forms.Program</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>

37
MeteoInfoMap/pom.xml Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.meteoinfo</groupId>
<artifactId>MeteoInfo</artifactId>
<version>1.7-SNAPSHOT</version>
</parent>
<artifactId>MeteoInfoMap</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MeteoInfoLib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.14</version>
</dependency>
<dependency>
<groupId>com.sun.woodstock.dependlibs</groupId>
<artifactId>jhall</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.fifesoft</groupId>
<artifactId>rsyntaxtextarea</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>

View File

@ -0,0 +1,374 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.codecomplete;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import org.meteoinfo.console.NameCompletion;
import org.python.core.Py;
import org.python.core.PyFunction;
import org.python.core.PyList;
import org.python.core.PyMethod;
import org.python.core.PyObject;
import org.python.core.PyReflectedFunction;
import org.python.core.PySystemState;
import org.python.core.PyTuple;
import org.python.util.PythonInterpreter;
/**
*
* @author Yaqiang Wang
*/
public class JIntrospect implements NameCompletion {
private final Pattern IMPORT_PACKAGE = Pattern.compile("import\\s+(.+)\\.");
private final Pattern FROM_PACKAGE_IMPORT = Pattern.compile("from\\s+(\\w+(?:\\.\\w+)*)\\.?(?:\\s*import\\s*)?");
private final PythonInterpreter interp;
/**
* Constructor
*
* @param interp
*/
public JIntrospect(PythonInterpreter interp) {
this.interp = interp;
}
/**
* Complete package name
*
* @param target Target
* @return Package names
*/
public List<String> completePackageName(String target) {
String[] targetComponents = target.split("\\.");
String base = targetComponents[0];
PySystemState state = interp.getSystemState();
PyObject importer = state.getBuiltins().__getitem__(Py.newString("__import__"));
PyObject module = importer.__call__(Py.newString(base));
if (targetComponents.length > 1) {
for (int i = 1; i < targetComponents.length; i++) {
module = module.__getattr__(targetComponents[i]);
}
}
PyList plist = (PyList) module.__dir__();
List<String> list = new ArrayList<>();
String name;
for (int i = 0; i < plist.__len__(); i++) {
name = plist.get(i).toString();
if (!name.startsWith("__")) {
list.add(name);
}
}
//list.add("*");
return list;
}
/**
* Get package name
*
* @param command The command
* @return Package name
*/
public String getPackageName(String command) {
Matcher match = IMPORT_PACKAGE.matcher(command);
if (match.find()) {
return match.group(1);
} else {
match = FROM_PACKAGE_IMPORT.matcher(command);
if (match.find()) {
return match.group(1);
} else {
return null;
}
}
}
/**
* Get auto complete list
* @param command Command string
* @return Complete list string
* @throws IOException
*/
public List<String> getAutoCompleteList(String command) throws IOException{
return this.getAutoCompleteList(command, true, true, true);
}
/**
* Get auto complete list
*
* @param command The command
* @param includeMagic
* @param includeSingle
* @param includeDouble
* @return Auto complete list
* @throws java.io.IOException
*/
public List<String> getAutoCompleteList(String command, boolean includeMagic,
boolean includeSingle, boolean includeDouble) throws IOException {
// Temp KLUDGE here rather than in console.py
//command += ".";
if (command.startsWith("import ") || command.startsWith("from ")) {
String target = getPackageName(command);
if (target == null) {
return null;
}
return completePackageName(target);
}
String root = this.getRoot(command, ".");
if (root.isEmpty())
return null;
try {
PyObject object = this.interp.eval(root);
PyList plist = (PyList) object.__dir__();
List<String> list = new ArrayList<>();
String name;
for (int i = 0; i < plist.__len__(); i++) {
name = plist.get(i).toString();
if (!name.startsWith("__")) {
list.add(name);
}
}
return list;
} catch (Exception e){
return null;
}
}
private boolean ispython(Object object){
if (object instanceof Class)
return false;
else if (object instanceof Object)
return false;
else if (object instanceof PyReflectedFunction)
return false;
else
return true;
}
@Override
public String[] completeName(String paramString) {
List<String> names = null;
try {
names = this.getAutoCompleteList(paramString, true, true, true);
} catch (IOException ex) {
Logger.getLogger(JIntrospect.class.getName()).log(Level.SEVERE, null, ex);
}
if (names == null) {
return null;
}
Collections.sort(names);
return names.toArray(new String[names.size()]);
}
/**
* Return the rightmost root portion of an arbitrary Python command.
* @param command The command
* @param terminator The terminator - '(' or '.'
* @return Rightmost root portion
* @throws java.io.IOException
*/
public String getRoot(String command, String terminator) throws IOException{
String[] temp = command.split("\n");
command = temp[temp.length - 1];
if (command.startsWith("... ")){
command = command.substring(4);
}
command = command.trim();
if (terminator.equals("(")){
if (command.endsWith("("))
command = command.substring(0, command.length() - 1);
} else
command = rtrimTerminus(command, terminator);
PyList tokens = this.getTokens(command);
if (tokens == null || tokens.isEmpty())
return "";
PyTuple token = (PyTuple)tokens.get(tokens.size() - 1);
if ((int)token.get(0) == 0)
tokens.remove(tokens.size() - 1);
if (tokens.isEmpty())
return "";
token = (PyTuple)tokens.get(tokens.size() - 1);
if (terminator.equals(".") && (!token.get(1).toString().equals(".") ||
(int)token.get(0) != 51)){
return "";
} else {
if (command.endsWith(terminator)){
int size = terminator.length();
command = command.substring(0, command.length() - size);
}
}
command = command.trim();
tokens = this.getTokens(command);
tokens.reverse();
String line = "";
Integer start = null;
String prefix = "";
String laststring = ".";
List<String> emptyTypes = new ArrayList<>();
emptyTypes.add("[]");
emptyTypes.add("()");
emptyTypes.add("{}");
for (int i = 0; i < tokens.size(); i++){
token = (PyTuple)tokens.get(i);
int tokentype = (int)token.get(0);
String tokenstring = token.get(1).toString();
line = token.get(4).toString();
if (tokentype == 0)
continue;
if (tokentype == 1 || tokentype == 2 || tokentype == 3){
if (!laststring.equals(".")){
int idx = (int)((PyTuple)token.get(3)).get(1);
if (!prefix.isEmpty() && line.substring(idx, idx + 1).equals(" "))
prefix = "";
break;
}
}
if (tokentype == 1 || tokentype == 2 || tokentype == 3 || (tokentype == 51 &&
tokenstring.equals("."))){
if (!prefix.isEmpty()){
prefix = "";
break;
} else {
start = (int)((PyTuple)token.get(2)).get(1);
}
} else if (tokenstring.length() == 1 && "[({])}".contains(tokenstring)){
if (emptyTypes.contains(prefix) && "[({".contains(tokenstring)){
break;
} else {
prefix = tokenstring + prefix;
}
} else
break;
laststring = tokenstring;
}
if (start == null){
start = line.length();
}
String root = line.substring(start);
if (emptyTypes.contains(prefix)){
root = prefix + root;
}
return root;
}
/**
* Return list of token for command.
* @param command The command
* @return Token list
* @throws java.io.UnsupportedEncodingException
*/
public PyList getTokens(String command) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
sb.append("import cStringIO");
sb.append("\n");
sb.append("import tokenize");
sb.append("\n");
sb.append("command = str('");
sb.append(command);
sb.append("')");
sb.append("\n");
sb.append("f = cStringIO.StringIO(command)");
sb.append("\n");
sb.append("tokens = []");
sb.append("\n");
sb.append("def eater(*args):");
sb.append("\n");
sb.append(" tokens.append(args)");
sb.append("\n");
sb.append("tokenize.tokenize_loop(f.readline, eater)");
sb.append("\n");
String code = sb.toString();
String encoding = "utf-8";
PythonInterpreter pi = new PythonInterpreter();
try {
pi.execfile(new ByteArrayInputStream(code.getBytes(encoding)));
PyList tokens = (PyList)pi.get("tokens");
return tokens;
} catch (Exception e){
return null;
}
}
/**
* Return command minus anything that follows the final terminator.
* @param command The command
* @param terminator The terminator - '(' or '.'
* @return Result string
*/
public String rtrimTerminus(String command, String terminator){
if (terminator != null){
String[] pieces = command.split(terminator);
if (pieces.length > 1){
command = pieces[0];
for (int i = 1; i < pieces.length - 1; i++){
command = command + terminator + pieces[i];
}
command = command + terminator;
}
}
return command;
}
/**
* For a command, return a tuple of object name, argspec, tip text.
* @param command Command string
* @return Tip text
* @throws java.io.IOException
*/
public String[] getCallTipJava(String command) throws IOException{
String[] callTip = new String[]{"","",""};
String root = getRoot(command, "(");
try {
PyObject object = this.interp.eval(root);
if (object instanceof PyFunction){
PyFunction func = (PyFunction)object;
String name = func.__doc__.toString();
callTip[2] = name;
} else if (object instanceof PyMethod){
PyMethod method = (PyMethod)object;
PyFunction func = (PyFunction)method.__func__;
String name = func.__doc__.toString();
callTip[2] = name;
} else {
callTip[2] = object.toString();
}
} catch (Exception e){
}
return callTip;
}
@Override
public String[] getTip(String command){
try {
return this.getCallTipJava(command);
} catch (IOException ex) {
Logger.getLogger(JIntrospect.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
}

View File

@ -0,0 +1,53 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.config;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author yaqiang
*/
public class EncodingUtil {
private static final Pattern pep263EncodingPattern = Pattern.compile("#.*coding[:=]\\s*([-\\w.]+)");
public static String matchEncoding(String inputStr) {
Matcher matcher = pep263EncodingPattern.matcher(inputStr);
boolean matchFound = matcher.find();
if ((matchFound) && (matcher.groupCount() == 1)) {
String groupStr = matcher.group(1);
return groupStr;
}
return null;
}
public static String findEncoding(BufferedReader br)
throws IOException {
String encoding = null;
for (int i = 0; i < 2; i++) {
String strLine = br.readLine();
if (strLine == null) {
break;
}
String result = matchEncoding(strLine);
if (result != null) {
encoding = result;
break;
}
}
return encoding;
}
public static String findEncoding(String text) throws IOException{
return findEncoding(new BufferedReader(new StringReader(text)));
}
}

View File

@ -0,0 +1,117 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.io.File;
import javax.swing.filechooser.FileFilter;
/**
*
* @author yaqiang
*/
public class GenericFileFilter extends FileFilter {
private static final boolean ONE = true;
private String fileExt;
private String[] fileExts;
private boolean type = false;
private String description;
private int length;
private String extension;
/**
* This is the constructor - it takes in the following:-<br> filesExtsIn -
* this is the array of file extensions that you wish to create a file
* filter for. <br> description - this is the description that will be
* displayed in the file chooser dialog box.
* @param filesExtsIn File extensions
* @param description Description
*/
public GenericFileFilter(String[] filesExtsIn, String description) {
if (filesExtsIn.length == 1) {//we only have one file
type = ONE;
fileExt = filesExtsIn[0];
} else {
fileExts = filesExtsIn;
length = fileExts.length;
}
this.description = description;
}
/**
* Get file extent
*
* @return File extent
*/
public String getFileExtent(){
return fileExt;
}
/**
* This is the method to allow a file to bee added to the displayed list or
* not. This method is called by the model that handles the FileChooser
* dialog
* @param f File
* @return Boolean
*/
@Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
extension = getExtension(f);
if (extension != null) {
if (type) {
return check(fileExt);
} else {
for (int i = 0; i < length; i++) {
if (check(fileExts[i])) {
return true;
}
}
}
}
return false;
}
/**
* This checks to see if the extension (stored) is the same as the file type
* stored at construction time. The "in" being the value passed over.
*/
private boolean check(String in) {
return extension.equalsIgnoreCase(in);
}
/**
* This is the method defined by the model
* @return
*/
@Override
public String getDescription() {
return description;
}
/**
* This is the method to get the file extension from the file name
*/
private String getExtension(File file) {
String filename = file.getName();
int len = filename.length();
int i = filename.lastIndexOf('.');
if (i > 0 && i < len - 1) {
return filename.substring(i + 1).toLowerCase();
}
return null;
}
}

View File

@ -0,0 +1,50 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.config;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.swing.JTextArea;
/**
*
* @author yaqiang
*/
public class JTextAreaPrintStream extends PrintStream{
private final JTextArea _jta;
/**
*
* @param out Output stream
* @param textArea
*/
public JTextAreaPrintStream(OutputStream out, JTextArea textArea){
super(out);
_jta = textArea;
}
@Override
public void write(byte[] buf){
String message = new String(buf);
_jta.append(message);
}
@Override
public void write(byte[] buf, int off, int len){
String message = new String(buf, off, len);
_jta.append(message);
//_jta.setCaretPosition(_jta.getText().length());
}
@Override
public void println(String str){
_jta.append(str + "\n");
}
@Override
public void print(String str){
_jta.append(str);
}
}

View File

@ -0,0 +1,96 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.config;
import java.io.Writer;
import javax.swing.JTextArea;
/**
*
* @author yaqiang
*/
public class JTextAreaWriter extends Writer {
private final JTextArea _jta;
private final int _maxBuffSize;
private final StringBuffer _stringBuffer = new StringBuffer();
private final int _maxLength = 1000;
public JTextAreaWriter(JTextArea ta) {
this(ta, -1);
}
public JTextAreaWriter(JTextArea ta, int maxBuffSize) {
_jta = ta;
_jta.setWrapStyleWord(false);
_maxBuffSize = maxBuffSize;
}
private void flushBufferToTextArea() {
boolean onLastPosition = _jta.getCaretPosition() == _jta.getText().length();
_jta.append(_stringBuffer.toString());
if (onLastPosition) {
_jta.setCaretPosition(_jta.getText().length());
}
_stringBuffer.setLength(0);
}
/**
* returns the written string
* @return
*/
@Override
public synchronized String toString() {
flushBufferToTextArea();
return _jta.getText();
}
/**
* overrides OutputStream.flush()
*/
@Override
public synchronized void flush() {
flushBufferToTextArea();
}
/**
* implements the stream: writes the byte to the string buffer
*/
@Override
public synchronized void write(int b) {
if ((_stringBuffer.length() >= _maxBuffSize) || (b == '\n')) {
flushBufferToTextArea();
}
if (_jta.getText().length() > _maxLength) {
_jta.setText("");
}
_stringBuffer.append((char) b);
}
@Override
public synchronized void write(char[] cbuf, int off, int len) {
// for (int i = off; i < len; i++) {
// write(cbuf[i]);
// }
String line = new String(cbuf, off, len);
if (_jta.getLineCount() > _maxLength) {
_jta.setText("");
}
_jta.append(line);
}
@Override
public void close() {
//nothing
}
}

View File

@ -0,0 +1,58 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.io.File;
import javax.swing.filechooser.FileFilter;
/**
*
* @author yaqiang
*/
public class MapFileFilter extends FileFilter {
@Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
//get the extension of the file
String extension = getExtension(f);
//check to see if the extension is equal to "html" or "htm"
if ((extension.equals("shp")) || (extension.equals("wmp"))) {
return true;
}
//default -- fall through. False is return on all
//occasions except:
//a) the file is a directory
//b) the file's extension is what we are looking for.
return false;
}
@Override
public String getDescription() {
return "Shape File (*.shp)";
}
private String getExtension(File f) {
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
return s.substring(i + 1).toLowerCase();
}
return "";
}
}

View File

@ -0,0 +1,322 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
* @author yaqiang
*/
public class Options {
// <editor-fold desc="Variables">
private String _fileName;
private Font _textFont = new Font("Simsun", Font.PLAIN, 15);
private Font _legendFont;
private String _scriptLanguage = "Groovy";
private boolean showStartMeteoDataDlg = true;
private Point mainFormLocation = new Point(0, 0);
private Dimension mainFormSize = new Dimension(1000, 650);
// </editor-fold>
// <editor-fold desc="Constructor">
// </editor-fold>
// <editor-fold desc="Get Set Methods">
/**
* Get text font
*
* @return Text Font
*/
public Font getTextFont() {
return _textFont;
}
/**
* Set text font
*
* @param font Text font
*/
public void setTextFont(Font font) {
_textFont = font;
}
/**
* Get legend text font
*
* @return Legend Text Font
*/
public Font getLegendFont() {
return _legendFont;
}
/**
* Get file name
*
* @return File name
*/
public String getFileName() {
return _fileName;
}
/**
* Set legend text font
*
* @param font Legend text font
*/
public void setLegendFont(Font font) {
_legendFont = font;
}
/**
* Get script language name - Groovy or Jython
*
* @return Script language name
*/
public String getScriptLanguage() {
return this._scriptLanguage;
}
/**
* Set script language name - Groovy or Jython
*
* @param value Script language name
*/
public void setScriptLanguage(String value) {
this._scriptLanguage = value;
}
/**
* Get if show start meteo data dialog
* @return Boolean
*/
public boolean isShowStartMeteoDataDlg(){
return this.showStartMeteoDataDlg;
}
/**
* Set if show start meteo data dialog
* @param value Boolean
*/
public void setShowStartMeteoDataDlg(boolean value){
this.showStartMeteoDataDlg = value;
}
/**
* Get main form location
* @return Main form location
*/
public Point getMainFormLocation(){
return this.mainFormLocation;
}
/**
* Set main form location
* @param value Main form location
*/
public void setMainFormLocation(Point value){
this.mainFormLocation = value;
}
/**
* Get main form size
* @return Main form size
*/
public Dimension getMainFormSize(){
return this.mainFormSize;
}
/**
* Set main form size
* @param value Main form size
*/
public void setMainFormSize(Dimension value){
this.mainFormSize = value;
}
// </editor-fold>
// <editor-fold desc="Methods">
/**
* Save configure file
*
* @param fileName File name
* @throws javax.xml.parsers.ParserConfigurationException
*/
public void saveConfigFile(String fileName) throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Element root = doc.createElement("MeteoInfo");
File af = new File(fileName);
Attr fn = doc.createAttribute("File");
Attr type = doc.createAttribute("Type");
fn.setValue(af.getName());
type.setValue("configurefile");
root.setAttributeNode(fn);
root.setAttributeNode(type);
doc.appendChild(root);
//Path
Element path = doc.createElement("Path");
Attr pAttr = doc.createAttribute("OpenPath");
String userPath = System.getProperty("user.dir");
pAttr.setValue(userPath);
path.setAttributeNode(pAttr);
root.appendChild(path);
//Font
Element font = doc.createElement("Font");
Element textFont = doc.createElement("TextFont");
Attr nameAttr = doc.createAttribute("FontName");
Attr sizeAttr = doc.createAttribute("FontSize");
nameAttr.setValue(_textFont.getFontName());
sizeAttr.setValue(String.valueOf(_textFont.getSize()));
textFont.setAttributeNode(nameAttr);
textFont.setAttributeNode(sizeAttr);
font.appendChild(textFont);
Element legendFont = doc.createElement("LegendFont");
nameAttr = doc.createAttribute("FontName");
sizeAttr = doc.createAttribute("FontSize");
nameAttr.setValue(_legendFont.getFontName());
sizeAttr.setValue(String.valueOf(_legendFont.getSize()));
legendFont.setAttributeNode(nameAttr);
legendFont.setAttributeNode(sizeAttr);
font.appendChild(legendFont);
root.appendChild(font);
//Script language
Element scriptlang = doc.createElement("ScriptLanguage");
Attr slAttr = doc.createAttribute("Language");
slAttr.setValue(this._scriptLanguage);
scriptlang.setAttributeNode(slAttr);
root.appendChild(scriptlang);
//Start up form setting
Element startForm = doc.createElement("Startup");
Attr meteoDlgAttr = doc.createAttribute("ShowMeteoDataDlg");
Attr mfLocationAttr = doc.createAttribute("MainFormLocation");
Attr mfSizeAttr = doc.createAttribute("MainFormSize");
meteoDlgAttr.setValue(String.valueOf(this.showStartMeteoDataDlg));
mfLocationAttr.setValue(String.valueOf(this.mainFormLocation.x) + "," +
String.valueOf(this.mainFormLocation.y));
mfSizeAttr.setValue(String.valueOf(this.mainFormSize.width) + "," +
String.valueOf(this.mainFormSize.height));
startForm.setAttributeNode(meteoDlgAttr);
startForm.setAttributeNode(mfLocationAttr);
startForm.setAttributeNode(mfSizeAttr);
root.appendChild(startForm);
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
DOMSource source = new DOMSource(doc);
Properties properties = transformer.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING, "UTF-8");
properties.setProperty(OutputKeys.INDENT, "yes");
properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.setOutputProperties(properties);
// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
// PrintWriter pw = new PrintWriter(new FileOutputStream(fileName));
FileOutputStream out = new FileOutputStream(fileName);
StreamResult result = new StreamResult(out);
transformer.transform(source, result);
} catch (TransformerException mye) {
} catch (IOException exp) {
}
}
/**
* Load configure file
*
* @param fileName File name
* @throws javax.xml.parsers.ParserConfigurationException
* @throws org.xml.sax.SAXException
* @throws java.io.IOException
*/
public void loadConfigFile(String fileName) throws ParserConfigurationException, SAXException, IOException {
_fileName = fileName;
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
InputSource is = new InputSource(br);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(is);
Element root = doc.getDocumentElement();
try {
//Path
Node path = root.getElementsByTagName("Path").item(0);
String currentPath = path.getAttributes().getNamedItem("OpenPath").getNodeValue();
if (new File(currentPath).isDirectory()) {
System.setProperty("user.dir", currentPath);
}
//Font
Element font = (Element) root.getElementsByTagName("Font").item(0);
Node textFont = font.getElementsByTagName("TextFont").item(0);
String fontName = textFont.getAttributes().getNamedItem("FontName").getNodeValue();
float fontSize = Float.parseFloat(textFont.getAttributes().getNamedItem("FontSize").getNodeValue());
this._textFont = new Font(fontName, Font.PLAIN, (int) fontSize);
Node legendFont = font.getElementsByTagName("LegendFont").item(0);
fontName = legendFont.getAttributes().getNamedItem("FontName").getNodeValue();
fontSize = Float.parseFloat(legendFont.getAttributes().getNamedItem("FontSize").getNodeValue());
this._legendFont = new Font(fontName, Font.PLAIN, (int) fontSize);
//Script language
Node scriptlang = root.getElementsByTagName("ScriptLanguage").item(0);
this._scriptLanguage = scriptlang.getAttributes().getNamedItem("Language").getNodeValue();
//Start up form setting
Node startForm = root.getElementsByTagName("Startup").item(0);
this.showStartMeteoDataDlg = Boolean.parseBoolean(startForm.getAttributes().getNamedItem("ShowMeteoDataDlg").getNodeValue());
String loc = startForm.getAttributes().getNamedItem("MainFormLocation").getNodeValue();
this.mainFormLocation.x = Integer.parseInt(loc.split(",")[0]);
this.mainFormLocation.y = Integer.parseInt(loc.split(",")[1]);
String size = startForm.getAttributes().getNamedItem("MainFormSize").getNodeValue();
this.mainFormSize.width = Integer.parseInt(size.split(",")[0]);
this.mainFormSize.height = Integer.parseInt(size.split(",")[1]);
} catch (Exception e) {
}
}
// </editor-fold>
}

View File

@ -0,0 +1,129 @@
/* Copyright 2012 - Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import org.meteoinfo.plugin.IPlugin;
import org.meteoinfo.plugin.PluginBase;
/**
*
* @author Yaqiang Wang
*/
public class Plugin extends PluginBase{
// <editor-fold desc="Variables">
//private String _name;
private String _jarFileName;
private String _className;
private IPlugin _pluginObject = null;
private boolean _isLoad = false;
// </editor-fold>
// <editor-fold desc="Constructor">
// </editor-fold>
// <editor-fold desc="Get Set Methods">
/**
* Get jar file name
* @return Jar file name
*/
public String getJarFileName(){
return this._jarFileName;
}
/**
* Set jar file name
* @param value Jar file name
*/
public void setJarFileName(String value){
this._jarFileName = value;
}
/**
* Get jar path in 'plugins' folder
* @return Jar path
*/
public String getJarPath(){
String path = this._jarFileName;
int idx = path.indexOf("plugins");
if (idx >= 0){
path = path.substring(idx + 8);
}
return path;
}
/**
* Get class name
* @return Class name
*/
public String getClassName(){
return this._className;
}
/**
* Set class name
* @param value Class name
*/
public void setClassName(String value){
this._className = value;
}
/**
* Get plugin object
* @return Plugin object
*/
public IPlugin getPluginObject(){
return this._pluginObject;
}
/**
* Set plugin object
* @param value Plugin object
*/
public void setPluginObject(IPlugin value){
this._pluginObject = value;
if (value != null){
this.setName(value.getName());
this.setAuthor(value.getAuthor());
this.setVersion(value.getVersion());
this.setDescription(value.getDescription());
}
}
/**
* Get if load the plugin
* @return Boolean
*/
public boolean isLoad(){
return this._isLoad;
}
/**
* Set if load the plugin
* @param value Boolean
*/
public void setLoad(boolean value){
this._isLoad = value;
}
// </editor-fold>
// <editor-fold desc="Methods">
/**
* Override toString method
* @return String
*/
@Override
public String toString(){
return this.getName();
}
// </editor-fold>
}

View File

@ -0,0 +1,197 @@
/* Copyright 2012 - Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
* @author Yaqiang Wang
*/
public class PluginCollection extends ArrayList<Plugin> {
// <editor-fold desc="Variables">
private String _pluginPath;
private String _pluginConfigFile;
// </editor-fold>
// <editor-fold desc="Constructor">
// </editor-fold>
// <editor-fold desc="Get Set Methods">
/**
* Get plugin path
* @return Plugin path
*/
public String getPluginPath(){
return this._pluginPath;
}
/**
* Set plugin path
* @param value Plugin path
*/
public void setPluginPath(String value){
this._pluginPath = value;
}
/**
* Get plugin configure file
* @return Plugin configure file
*/
public String getPluginConfigFile(){
return this._pluginConfigFile;
}
/**
* Set plugin configure file
* @param value Plugin configure file
*/
public void setPluginConfigFile(String value){
this._pluginConfigFile = value;
}
// </editor-fold>
// <editor-fold desc="Methods">
/**
* Save plugin configure file
* @throws ParserConfigurationException
*/
public void saveConfigFile() throws ParserConfigurationException{
this.saveConfigFile(this._pluginConfigFile);
}
/**
* Save plugin configure file
*
* @param fileName File name
* @throws javax.xml.parsers.ParserConfigurationException
*/
public void saveConfigFile(String fileName) throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
//Plugins
Element pluginsElem = doc.createElement("Plugins");
for (Plugin plugin : this){
Element pluginElem = doc.createElement("Plugin");
Attr pluginNameAttr = doc.createAttribute("Name");
Attr pluginAuthorAttr = doc.createAttribute("Author");
Attr pluginVersionAttr = doc.createAttribute("Version");
Attr pluginDescriptionAttr = doc.createAttribute("Description");
Attr pluginJarPathAttr = doc.createAttribute("JarPath");
Attr pluginClassNameAttr = doc.createAttribute("ClassName");
Attr pluginIsLoadAttr = doc.createAttribute("IsLoad");
pluginNameAttr.setValue(plugin.getName());
pluginAuthorAttr.setValue(plugin.getAuthor());
pluginVersionAttr.setValue(plugin.getVersion());
pluginDescriptionAttr.setValue(plugin.getDescription());
pluginJarPathAttr.setValue(plugin.getJarPath());
pluginClassNameAttr.setValue(plugin.getClassName());
pluginIsLoadAttr.setValue(String.valueOf(plugin.isLoad()));
pluginElem.setAttributeNode(pluginNameAttr);
pluginElem.setAttributeNode(pluginAuthorAttr);
pluginElem.setAttributeNode(pluginVersionAttr);
pluginElem.setAttributeNode(pluginDescriptionAttr);
pluginElem.setAttributeNode(pluginJarPathAttr);
pluginElem.setAttributeNode(pluginClassNameAttr);
pluginElem.setAttributeNode(pluginIsLoadAttr);
pluginsElem.appendChild(pluginElem);
}
doc.appendChild(pluginsElem);
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
DOMSource source = new DOMSource(doc);
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
PrintWriter pw = new PrintWriter(new FileOutputStream(fileName));
StreamResult result = new StreamResult(pw);
transformer.transform(source, result);
} catch (TransformerException mye) {
} catch (IOException exp) {
}
}
/**
* Load plugin configure file
*
* @param fileName File name
* @throws javax.xml.parsers.ParserConfigurationException
* @throws org.xml.sax.SAXException
* @throws java.io.IOException
*/
public void loadConfigFile(String fileName) throws ParserConfigurationException, SAXException, IOException {
if (!new File(fileName).exists())
return;
this._pluginConfigFile = fileName;
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
InputSource is = new InputSource(br);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(is);
try {
//Plugins
this.clear();
Element pluginsElem = doc.getDocumentElement();
NodeList pluginNodeList = pluginsElem.getElementsByTagName("Plugin");
for (int i = 0; i < pluginNodeList.getLength(); i++){
Node pluginNode = pluginNodeList.item(i);
Plugin plugin = new Plugin();
NamedNodeMap attrs = pluginNode.getAttributes();
plugin.setName(attrs.getNamedItem("Name").getNodeValue());
plugin.setAuthor(attrs.getNamedItem("Author").getNodeValue());
plugin.setVersion(attrs.getNamedItem("Version").getNodeValue());
plugin.setDescription(attrs.getNamedItem("Description").getNodeValue());
String jarPath = attrs.getNamedItem("JarPath").getNodeValue();
jarPath = this._pluginPath + File.separator + jarPath;
if (!new File(jarPath).exists())
continue;
plugin.setJarFileName(jarPath);
plugin.setClassName(attrs.getNamedItem("ClassName").getNodeValue());
plugin.setLoad(Boolean.parseBoolean(attrs.getNamedItem("IsLoad").getNodeValue()));
this.add(plugin);
}
} catch (Exception e) {
}
}
// </editor-fold>
}

View File

@ -0,0 +1,189 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import javax.swing.JFrame;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.meteoinfo.desktop.forms.FrmMain;
import org.meteoinfo.map.MapView;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
*
* @author Yaqiang Wang
*/
public class ProjectFile {
// <editor-fold desc="Variables">
private String _fileName;
private String _pathFileName;
private FrmMain _mainForm;
// </editor-fold>
// <editor-fold desc="Constructor">
/**
* Constructor
*
* @param mainForm Main form
*/
public ProjectFile(JFrame mainForm) {
_fileName = "";
_pathFileName = "";
_mainForm = (FrmMain)mainForm;
}
// </editor-fold>
// <editor-fold desc="Get Set Methods">
/**
* Get project file name
*
* @return The porject file name
*/
public String getFileName() {
return _fileName;
}
/**
* Set project file name
*
* @param fn File name
*/
public void setFileName(String fn) {
_fileName = fn;
}
/**
* Get configure file name
*
* @return Configure file name
*/
public String getConfigureFileName() {
return _pathFileName;
}
// </editor-fold>
// <editor-fold desc="Methods">
// <editor-fold desc="Save project">
/**
* Save project file
*
* @param aFile File name
* @throws javax.xml.parsers.ParserConfigurationException
*/
public void saveProjFile(String aFile) throws ParserConfigurationException {
_fileName = aFile;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Element root = doc.createElement("MeteoInfo");
File af = new File(aFile);
Attr fn = doc.createAttribute("File");
Attr type = doc.createAttribute("Type");
fn.setValue(af.getName());
type.setValue("projectfile");
root.setAttributeNode(fn);
root.setAttributeNode(type);
doc.appendChild(root);
//Add language element
//addLanguageElement(doc, root, Thread.CurrentThread.CurrentUICulture.Name);
//Add LayersLegend content
_mainForm.getMapDocument().getMapLayout().updateMapFrameOrder();
_mainForm.getMapDocument().exportProjectXML(doc, root, _fileName);
//Add MapLayout content
_mainForm.getMapDocument().getMapLayout().exportProjectXML(doc, root);
//Save project file
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
DOMSource source = new DOMSource(doc);
Properties properties = transformer.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING, "UTF-8");
properties.setProperty(OutputKeys.INDENT, "yes");
properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.setOutputProperties(properties);
// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
//PrintWriter pw = new PrintWriter(new FileOutputStream(aFile));
FileOutputStream out = new FileOutputStream(aFile);
StreamResult result = new StreamResult(out);
transformer.transform(source, result);
} catch (TransformerException mye) {
} catch (IOException exp) {
}
}
// </editor-fold>
// <editor-fold desc="Load project">
/**
* Load project file
*
* @param aFile
* @throws javax.xml.parsers.ParserConfigurationException
* @throws org.xml.sax.SAXException
* @throws java.io.IOException
*/
public void loadProjFile(String aFile) throws ParserConfigurationException, SAXException, IOException {
_fileName = aFile;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File(aFile));
Element root = doc.getDocumentElement();
Properties property = System.getProperties();
String path = System.getProperty("user.dir");
property.setProperty("user.dir", new File(aFile).getAbsolutePath());
//Load elements
//_mainForm.getMapDocument().getActiveMapFrame().getMapView().setLockViewUpdate(true);
MapView mapView = _mainForm.getMapDocument().getActiveMapFrame().getMapView();
mapView.setLockViewUpdate(true);
//LoadLanguageElement(root);
//Load map frames content
_mainForm.getMapDocument().importProjectXML(root);
_mainForm.getMapDocument().getMapLayout().setMapFrames(_mainForm.getMapDocument().getMapFrames());
//Load MapLayout content
_mainForm.getMapDocument().getMapLayout().importProjectXML(root);
//_mainForm.getMapDocument().getActiveMapFrame().getMapView().setLockViewUpdate(false);
//_mainForm.getMapDocument().getActiveMapFrame().getMapView().paintLayers();
property.setProperty("user.dir", path);
}
// </editor-fold>
// </editor-fold>
}

View File

@ -0,0 +1,93 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.config;
import org.meteoinfo.console.JavaCharStream;
import org.meteoinfo.console.JConsole;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
import org.python.util.InteractiveConsole;
/**
*
* @author yaqiang
*/
public class PythonInteractiveInterpreter extends InteractiveConsole implements Runnable {
transient Reader in;
transient PrintStream out;
transient PrintStream err;
JConsole console;
public PythonInteractiveInterpreter(JConsole console) {
super();
this.cflags.source_is_utf8 = true;
this.console = console;
in = console.getIn();
out = console.getOut();
err = console.getErr();
setOut(out);
setErr(err);
}
@Override
public void run() {
boolean eof = false;
JavaCharStream stream = new JavaCharStream(in, 1, 1);
// exec("_ps1 = sys.ps1");
// PyObject ps1Obj = get("_ps1");
// String ps1 = ps1Obj.toString();
String ps1 = ">>> ";
// exec("_ps2 = sys.ps2");
// PyObject ps2Obj = get("_ps2");
// String ps2 = ps2Obj.toString();
String ps2 = "... ";
out.print(getDefaultBanner() + "\n");
out.print(ps1);
String line = "";
while (!eof) {
// try to sync up the console
System.out.flush();
System.err.flush();
Thread.yield(); // this helps a little
try {
boolean eol = false;
line = "";
while (!eol) {
char aChar = stream.readChar();
eol = (aChar == '\n');
if (!eol) {
line = line + aChar;
}
}
//hitting Enter at prompt returns a semicolon
//get rid of it since it returns an error when executed
if (line.equals(";")) {
line = "";
}
{
boolean retVal = push(line);
if (retVal) {
out.print(ps2);
} else {
out.print(ps1);
}
}
} catch (IOException ex) {
}
}
}
}

View File

@ -0,0 +1,256 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.config;
import java.awt.BorderLayout;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.fife.ui.rsyntaxtextarea.SyntaxScheme;
import org.fife.ui.rsyntaxtextarea.TextEditorPane;
import org.fife.ui.rtextarea.RTextScrollPane;
/**
*
* @author Yaqiang Wang
*/
public class TextEditor extends JPanel {
// <editor-fold desc="Variables">
private TextEditorPane _textArea;
private String _title;
private File _file = null;
private JTabbedPane _parent;
// </editor-fold>
// <editor-fold desc="Constructor">
/**
* Constructor
*
* @param parent Parent
* @param title Title text
*/
public TextEditor(JTabbedPane parent, String title) {
super();
this.setLayout(new BorderLayout());
_title = title;
_parent = parent;
_textArea = new TextEditorPane();
_textArea.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
checkUpdate();
}
@Override
public void removeUpdate(DocumentEvent e) {
checkUpdate();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkUpdate();
}
});
//_textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
//_textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
_textArea.setCodeFoldingEnabled(true);
_textArea.setAntiAliasingEnabled(true);
//_textArea.setEncoding("GB2312");
_textArea.setEncoding("utf-8");
_textArea.setTabSize(4);
_textArea.setTabsEmulated(true);
RTextScrollPane sp = new RTextScrollPane(_textArea);
sp.setFoldIndicatorEnabled(true);
this.add(sp);
}
// </editor-fold>
// <editor-fold desc="Get Set Methods">
/**
* Get text area
*
* @return The RSyntaxTextArea
*/
public TextEditorPane getTextArea() {
return _textArea;
}
/**
* Get title text
*
* @return Title text
*/
public String getTitle() {
return _title;
}
/**
* Set title text
*
* @param value Title text
*/
public void setTitle(String value) {
int idx = _parent.indexOfTab(_title);
_title = value;
_parent.setTitleAt(idx, _title);
}
/**
* Get file
*
* @return File
*/
public File getFile(){
return _file;
}
public void setFile(File file){
_file = file;
setTitle(_file.getName());
}
/**
* Get file name
*
* @return File name
*/
public String getFileName() {
if (_file == null) {
return "";
} else {
return _file.getAbsolutePath();
}
}
// </editor-fold>
// <editor-fold desc="Methods">
/**
* Open file
*
* @param file The file
*/
public void openFile(File file) {
if (file.isDirectory()) { // Clicking on a space character
JOptionPane.showMessageDialog(this, file.getAbsolutePath()
+ " is a directory", "Error", JOptionPane.ERROR_MESSAGE);
return;
} else if (!file.isFile()) {
JOptionPane.showMessageDialog(this, "No such file: "
+ file.getAbsolutePath(), "Error", JOptionPane.ERROR_MESSAGE);
return;
}
try {
BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
//BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
_textArea.read(r, null);
r.close();
//String estr = _textArea.getEncoding();
//_textArea.setEncoding("UTF-8");
//_textArea.setEncoding("GB2312");
//_textArea.save();
// FileLocation fl = FileLocation.create(file);
// this._textArea.load(fl, null);
// String estr = _textArea.getEncoding();
// //_textArea.setEncoding("UTF-8");
// //_textArea.setEncoding("GB2312");
// _textArea.save();
setFile(file);
_textArea.discardAllEdits();
_textArea.setDirty(false);
} catch (IOException ioe) {
UIManager.getLookAndFeel().provideErrorFeedback(_textArea);
}
}
/**
* Save file
*
* @param file The file
*/
public void saveFile(File file) {
OutputStreamWriter w = null;
try {
w = new OutputStreamWriter(new FileOutputStream(file.getAbsolutePath()), "UTF-8");
_textArea.write(w);
} catch (FileNotFoundException ex) {
Logger.getLogger(TextEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TextEditor.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
w.close();
setFile(file);
_textArea.setDirty(false);
checkUpdate();
} catch (IOException ex) {
Logger.getLogger(TextEditor.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
private void checkUpdate() {
String title = _title;
if (_title.substring(_title.length() - 1).equals("*")) {
_title = _title.substring(0, _title.length() - 1);
}
if (_textArea.isDirty()) {
_title = _title + '*';
}
if (!title.equals(_title)) {
int idx = _parent.indexOfTab(title);
_parent.setTitleAt(idx, _title);
}
}
/**
* Set the font for all token types.
*
* @param font The font to use.
*/
public void setTextFont(Font font) {
if (font != null) {
SyntaxScheme ss = _textArea.getSyntaxScheme();
ss = (SyntaxScheme) ss.clone();
for (int i = 0; i < ss.getStyleCount(); i++) {
if (ss.getStyle(i) != null) {
ss.getStyle(i).font = font;
}
}
_textArea.setSyntaxScheme(ss);
_textArea.setFont(font);
}
}
// </editor-fold>
}

View File

@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.config;
import org.python.util.PythonInterpreter;
/**
*
* @author yaqiang
*/
public class UPythonInterpreter extends PythonInterpreter{
public UPythonInterpreter(){
this.cflags.source_is_utf8 = true;
this.cflags.encoding = "utf-8";
}
}

View File

@ -0,0 +1,30 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.event;
import java.util.EventObject;
/**
*
* @author Yaqiang Wang
*/
public class CurrentToolChangedEvent extends EventObject {
/**
* Constructor
* @param source Source object
*/
public CurrentToolChangedEvent(Object source){
super(source);
}
}

View File

@ -0,0 +1,24 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.event;
import java.util.EventListener;
/**
*
* @author yaqiang
*/
public interface ICurrentToolChangedListener extends EventListener {
public void currentToolChangedEvent(CurrentToolChangedEvent event);
}

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="146" max="-2" attributes="0"/>
<Component id="jButton_Close" min="-2" pref="81" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButton_Close" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/images/logo.jpg"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Close">
<Properties>
<Property name="text" type="java.lang.String" value="Close"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="284" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel_version" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_web" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="160" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_version" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_web" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="MeteoInfoMap"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="GIS software for meteorological data"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Version:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Author:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Yaqiang Wang"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_version">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Email:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="yaqiang.wang@gmail.com"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Homepage:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_web">
<Properties>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="0" red="0" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="http://www.meteothink.org"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="&#x9ed8;&#x8ba4;&#x5149;&#x6807;"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabel_webMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,264 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.meteoinfo.global.util.GlobalUtil;
/**
*
* @author yaqiang
*/
public class FrmAbout extends javax.swing.JDialog {
/**
* Creates new form frmAbout
* @param parent
* @param modal
*/
public FrmAbout(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.setTitle("About");
this.jLabel_version.setText(GlobalUtil.getVersion());
this.jLabel_web.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jButton_Close = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel_version = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel_web = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/logo.jpg"))); // NOI18N
jButton_Close.setText("Close");
jButton_Close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CloseActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("宋体", 1, 18)); // NOI18N
jLabel2.setText("MeteoInfoMap");
jLabel3.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N
jLabel3.setText("GIS software for meteorological data");
jLabel4.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jLabel4.setText("Version:");
jLabel5.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jLabel5.setText("Author:");
jLabel6.setText("Yaqiang Wang");
jLabel_version.setText("...");
jLabel8.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jLabel8.setText("Email:");
jLabel9.setText("yaqiang.wang@gmail.com");
jLabel10.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jLabel10.setText("Homepage:");
jLabel_web.setForeground(new java.awt.Color(0, 0, 255));
jLabel_web.setText("http://www.meteothink.org");
jLabel_web.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jLabel_web.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel_webMouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 284, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(jLabel_version))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel8)
.addComponent(jLabel10))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_web)
.addComponent(jLabel9)
.addComponent(jLabel6)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(62, 62, 62)
.addComponent(jLabel2)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 160, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jLabel_version))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jLabel_web))
.addContainerGap()))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(146, 146, 146)
.addComponent(jButton_Close, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton_Close)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jLabel_webMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_webMouseClicked
// TODO add your handling code here:
try {
URI uri = new URI("http://www.meteothink.org");
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
if (desktop != null) {
desktop.browse(uri);
}
} catch (URISyntaxException ex) {
Logger.getLogger(FrmAbout.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ioe) {
}
}//GEN-LAST:event_jLabel_webMouseClicked
private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CloseActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmAbout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmAbout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmAbout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmAbout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmAbout dialog = new FrmAbout(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Close;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel jLabel_version;
private javax.swing.JLabel jLabel_web;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Add Field"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jTextField_FieldName" max="32767" attributes="0"/>
<Component id="jComboBox_FieldType" pref="221" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Component id="jButton_OK" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace pref="74" max="32767" attributes="0"/>
<Component id="jButton_Cancel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_FieldName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_FieldType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_OK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="25" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_FieldName">
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_FieldType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_OK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Cancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CancelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,191 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import org.meteoinfo.data.DataTypes;
/**
*
* @author yaqiang
*/
public class FrmAddField extends javax.swing.JDialog {
private boolean _isOK = false;
/**
* Creates new form FrmAddField
* @param parent
* @param modal
*/
public FrmAddField(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.jComboBox_FieldType.removeAllItems();
this.jComboBox_FieldType.addItem(DataTypes.String);
this.jComboBox_FieldType.addItem(DataTypes.Integer);
this.jComboBox_FieldType.addItem(DataTypes.Double);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField_FieldName = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jComboBox_FieldType = new javax.swing.JComboBox();
jButton_OK = new javax.swing.JButton();
jButton_Cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Add Field");
jLabel1.setText("Name:");
jLabel2.setText("Type:");
jComboBox_FieldType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jButton_OK.setText("OK");
jButton_OK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OKActionPerformed(evt);
}
});
jButton_Cancel.setText("Cancel");
jButton_Cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField_FieldName)
.addComponent(jComboBox_FieldType, 0, 221, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jButton_OK, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 74, Short.MAX_VALUE)
.addComponent(jButton_Cancel)
.addGap(39, 39, 39))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField_FieldName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jComboBox_FieldType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_OK)
.addComponent(jButton_Cancel))
.addContainerGap(25, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
_isOK = true;
this.dispose();
}//GEN-LAST:event_jButton_OKActionPerformed
private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed
// TODO add your handling code here:
_isOK = false;
this.dispose();
}//GEN-LAST:event_jButton_CancelActionPerformed
/**
* Get if is OK
*
* @return Boolean
*/
public boolean isOK(){
return _isOK;
}
public String getFieldName(){
return this.jTextField_FieldName.getText();
}
public DataTypes getDataType(){
return DataTypes.valueOf(this.jComboBox_FieldType.getSelectedItem().toString());
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmAddField.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmAddField.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmAddField.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmAddField.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmAddField dialog = new FrmAddField(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Cancel;
private javax.swing.JButton jButton_OK;
private javax.swing.JComboBox jComboBox_FieldType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jTextField_FieldName;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel_SelFields" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jButton_InputFile" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_InputFile" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton_AddData" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="67" max="-2" attributes="0"/>
<Component id="jButton_Close" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="75" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_InputFile" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_InputFile" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel_SelFields" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_AddData" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Close" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="22" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="wheelScrollingEnabled" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea1">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="e1" green="ff" id="&#x4fe1;&#x606f;" palette="2" red="ff" type="palette"/>
</Property>
<Property name="columns" type="int" value="20"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="This tool will create a station layer from a ASCII file with comma, simicolon or space separator. The file must contain column titles as the first row."/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder/>
</Border>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_InputFile">
<Properties>
<Property name="text" type="java.lang.String" value="Input File"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_InputFileActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_InputFile">
</Component>
<Container class="javax.swing.JPanel" name="jPanel_SelFields">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Select Fields From Input File"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jComboBox_LonField" pref="248" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jComboBox_LatField" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_LonField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_LatField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Lon Field:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_LonField">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Lat Field:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_LatField">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_AddData">
<Properties>
<Property name="text" type="java.lang.String" value="Add Data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AddDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Close">
<Properties>
<Property name="text" type="java.lang.String" value="Close"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,433 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.meteoinfo.data.mapdata.Field;
import org.meteoinfo.global.GenericFileFilter;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.global.PointD;
import org.meteoinfo.data.DataTypes;
import org.meteoinfo.global.util.GlobalUtil;
import org.meteoinfo.layer.LayerDrawType;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.legend.LegendManage;
import org.meteoinfo.shape.PointShape;
import org.meteoinfo.shape.ShapeTypes;
/**
*
* @author yaqiang
*/
public class FrmAddXYData extends javax.swing.JDialog {
private FrmMain _parent;
private String separator = null;
private List<Field> fields = new ArrayList<>();
/**
* Creates new form FrmAddXYData
* @param parent
* @param modal
*/
public FrmAddXYData(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.jPanel_SelFields.setEnabled(false);
_parent = (FrmMain) parent;
this.jComboBox_LonField.removeAllItems();
this.jComboBox_LatField.removeAllItems();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton_InputFile = new javax.swing.JButton();
jTextField_InputFile = new javax.swing.JTextField();
jPanel_SelFields = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jComboBox_LonField = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_LatField = new javax.swing.JComboBox();
jButton_AddData = new javax.swing.JButton();
jButton_Close = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jScrollPane1.setBackground(new java.awt.Color(255, 255, 204));
jScrollPane1.setWheelScrollingEnabled(false);
jTextArea1.setEditable(false);
jTextArea1.setBackground(java.awt.SystemColor.info);
jTextArea1.setColumns(20);
jTextArea1.setLineWrap(true);
jTextArea1.setRows(4);
jTextArea1.setText("This tool will create a station layer from a ASCII file with comma, simicolon or space separator. The file must contain column titles as the first row.");
jTextArea1.setWrapStyleWord(true);
jTextArea1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jScrollPane1.setViewportView(jTextArea1);
jButton_InputFile.setText("Input File");
jButton_InputFile.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_InputFileActionPerformed(evt);
}
});
jPanel_SelFields.setBorder(javax.swing.BorderFactory.createTitledBorder("Select Fields From Input File"));
jLabel1.setText("Lon Field:");
jComboBox_LonField.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("Lat Field:");
jComboBox_LatField.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout jPanel_SelFieldsLayout = new javax.swing.GroupLayout(jPanel_SelFields);
jPanel_SelFields.setLayout(jPanel_SelFieldsLayout);
jPanel_SelFieldsLayout.setHorizontalGroup(
jPanel_SelFieldsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_SelFieldsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel_SelFieldsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_SelFieldsLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox_LonField, 0, 248, Short.MAX_VALUE))
.addGroup(jPanel_SelFieldsLayout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox_LatField, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel_SelFieldsLayout.setVerticalGroup(
jPanel_SelFieldsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_SelFieldsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel_SelFieldsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox_LonField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel_SelFieldsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jComboBox_LatField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton_AddData.setText("Add Data");
jButton_AddData.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddDataActionPerformed(evt);
}
});
jButton_Close.setText("Close");
jButton_Close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel_SelFields, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton_InputFile)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_InputFile)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_AddData)
.addGap(67, 67, 67)
.addComponent(jButton_Close)
.addGap(75, 75, 75))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_InputFile)
.addComponent(jTextField_InputFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel_SelFields, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_AddData)
.addComponent(jButton_Close))
.addContainerGap(22, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_InputFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_InputFileActionPerformed
// TODO add your handling code here:
String path = System.getProperty("user.dir");
File pathDir = new File(path);
JFileChooser aDlg = new JFileChooser();
aDlg.setAcceptAllFileFilterUsed(false);
aDlg.setCurrentDirectory(pathDir);
String[] fileExts = new String[]{"csv", "txt"};
GenericFileFilter allFileFilter = new GenericFileFilter(fileExts, "Supported Formats");
aDlg.addChoosableFileFilter(allFileFilter);
fileExts = new String[]{"csv"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "CSV File (*.csv)");
aDlg.addChoosableFileFilter(mapFileFilter);
fileExts = new String[]{"txt"};
mapFileFilter = new GenericFileFilter(fileExts, "Text File (*.txt)");
aDlg.addChoosableFileFilter(mapFileFilter);
aDlg.setFileFilter(allFileFilter);
if (JFileChooser.APPROVE_OPTION == aDlg.showOpenDialog(this)) {
File aFile = aDlg.getSelectedFile();
System.setProperty("user.dir", aFile.getParent());
this.jTextField_InputFile.setText(aFile.getAbsolutePath());
try {
//BufferedReader sr = new BufferedReader(new FileReader(aFile));
BufferedReader sr = new BufferedReader(new InputStreamReader(new FileInputStream(aFile), "UTF-8"));
String title = sr.readLine().trim();
//Determine separator
separator = GlobalUtil.getDelimiter(title);
String[] titleArray = GlobalUtil.split(title, separator);
if (titleArray.length <= 2) {
JOptionPane.showMessageDialog(null, "File Format Error!");
sr.close();
} else {
//Get fields
String aLine = sr.readLine().trim(); //Second line
String[] dataArray = GlobalUtil.split(aLine, separator);
if (dataArray.length != titleArray.length) {
JOptionPane.showMessageDialog(null, "File Format Error!");
sr.close();
return;
}
String fieldName;
DataTypes dataType;
for (int i = 0; i < dataArray.length; i++) {
fieldName = titleArray[i];
if (MIMath.isNumeric(dataArray[i])) {
dataType = DataTypes.Double;
} else {
dataType = DataTypes.String;
}
fields.add(new Field(fieldName, dataType));
}
sr.close();
this.jPanel_SelFields.setEnabled(true);
this.jComboBox_LonField.removeAllItems();
this.jComboBox_LatField.removeAllItems();
for (int i = 0; i < titleArray.length; i++) {
this.jComboBox_LonField.addItem(titleArray[i]);
this.jComboBox_LatField.addItem(titleArray[i]);
}
}
} catch (FileNotFoundException ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jButton_InputFileActionPerformed
private void jButton_AddDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddDataActionPerformed
// TODO add your handling code here:
String lonField = this.jComboBox_LonField.getSelectedItem().toString();
String latField = this.jComboBox_LatField.getSelectedItem().toString();
if (lonField.isEmpty() || latField.isEmpty()) {
JOptionPane.showMessageDialog(null, "All fields should be set!");
return;
}
JFileChooser aDlg = new JFileChooser();
String curDir = System.getProperty("user.dir");
aDlg.setCurrentDirectory(new File(curDir));
String[] fileExts = {"shp"};
GenericFileFilter pFileFilter = new GenericFileFilter(fileExts, "Shape File (*.shp)");
aDlg.setFileFilter(pFileFilter);
aDlg.setAcceptAllFileFilterUsed(false);
if (JFileChooser.APPROVE_OPTION == aDlg.showSaveDialog(null)) {
BufferedReader sr = null;
try {
File aFile = aDlg.getSelectedFile();
System.setProperty("user.dir", aFile.getParent());
String extent = ((org.meteoinfo.global.GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = aFile.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
//New layer
VectorLayer aLayer = new VectorLayer(ShapeTypes.Point);
aLayer.setLayerDrawType(LayerDrawType.Map);
aLayer.setLayerName(aFile.getName());
aLayer.setFileName(fileName);
aLayer.setLegendScheme(LegendManage.createSingleSymbolLegendScheme(ShapeTypes.Point, Color.black, 5));
aLayer.setVisible(true);
for (Field field : fields){
aLayer.editAddField(field);
}
int lonIdx = this.jComboBox_LonField.getSelectedIndex();
int latIdx = this.jComboBox_LatField.getSelectedIndex();
double lon, lat;
String inFile = this.jTextField_InputFile.getText();
sr = new BufferedReader(new InputStreamReader(new FileInputStream(inFile), "UTF-8"));
//sr = new BufferedReader(new FileReader(new File(inFile)));
String[] dataArray;
sr.readLine(); //First line - title
String aLine = sr.readLine(); //First data line
while (aLine != null) {
aLine = aLine.trim();
dataArray = GlobalUtil.split(aLine, separator);
if (dataArray.length < 2) {
aLine = sr.readLine();
continue;
}
PointD aPoint = new PointD();
lon = Double.parseDouble(dataArray[lonIdx].trim());
lat = Double.parseDouble(dataArray[latIdx].trim());
aPoint.X = lon;
aPoint.Y = lat;
//Add shape
PointShape aPS = new PointShape();
aPS.setPoint(aPoint);
int shapeNum = aLayer.getShapeNum();
if (aLayer.editInsertShape(aPS, shapeNum)) {
//Edit record value
for (int j = 0; j < aLayer.getFieldNumber(); j++) {
Field field = aLayer.getField(j);
switch (field.getDataType()) {
case Double:
aLayer.editCellValue(j, shapeNum, Double.parseDouble(dataArray[j].trim()));
break;
case String:
aLayer.editCellValue(j, shapeNum, dataArray[j].trim());
break;
}
}
}
aLine = sr.readLine();
}
aLayer.saveFile(fileName);
this._parent.getMapDocument().getActiveMapFrame().addLayer(aLayer);
} catch (FileNotFoundException ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
} catch (IOException ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
} catch (Exception ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
} finally {
try {
sr.close();
} catch (IOException ex) {
Logger.getLogger(FrmAddXYData.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}
}
}
}//GEN-LAST:event_jButton_AddDataActionPerformed
private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CloseActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmAddXYData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmAddXYData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmAddXYData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmAddXYData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmAddXYData dialog = new FrmAddXYData(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_AddData;
private javax.swing.JButton jButton_Close;
private javax.swing.JButton jButton_InputFile;
private javax.swing.JComboBox jComboBox_LatField;
private javax.swing.JComboBox jComboBox_LonField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel_SelFields;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField_InputFile;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -0,0 +1,91 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
/**
*
* @author yaqiang
*/
public class FrmArrivalTimes extends javax.swing.JDialog {
/**
* Creates new form FrmArrivalTimes
* @param parent
* @param modal
*/
public FrmArrivalTimes(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmArrivalTimes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmArrivalTimes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmArrivalTimes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmArrivalTimes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmArrivalTimes dialog = new FrmArrivalTimes(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Buffer"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jTextField_Distance" min="-2" pref="145" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_IsMerge" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_Distance" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="149" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace pref="152" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_Distance" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_Distance" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_IsMerge" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_Distance">
<Properties>
<Property name="text" type="java.lang.String" value="Buffer distance:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_Distance">
<Properties>
<Property name="text" type="java.lang.String" value="1"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_IsMerge">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Merge buffer result"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,210 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
/**
*
* @author yaqiang
*/
public class FrmBuffer extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmBuffer(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
jLabel_Distance = new javax.swing.JLabel();
jTextField_Distance = new javax.swing.JTextField();
jCheckBox_IsMerge = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Buffer");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jCheckBox_SelFeatureOnly.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jLabel_Distance.setText("Buffer distance:");
jTextField_Distance.setText("1");
jCheckBox_IsMerge.setSelected(true);
jCheckBox_IsMerge.setText("Merge buffer result");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jTextField_Distance, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_IsMerge)
.addComponent(jLabel_Distance)
.addComponent(jCheckBox_SelFeatureOnly)
.addComponent(jLabel1))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(149, 149, 149)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(152, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_Distance)
.addComponent(jTextField_Distance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_IsMerge)
.addGap(18, 18, 18)
.addComponent(jButton_Apply)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly.isSelected();
double distance = Double.parseDouble(this.jTextField_Distance.getText());
boolean isMerge = this.jCheckBox_IsMerge.isSelected();
VectorLayer newLayer = fromLayer.buffer(distance, onlySel, isMerge);
newLayer.setLayerName("Buffer_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmBuffer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmBuffer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmBuffer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmBuffer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmBuffer dialog = new FrmBuffer(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_IsMerge;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel_Distance;
private javax.swing.JTextField jTextField_Distance;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Clipping"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Component id="jComboBox_ClippingLayer" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="135" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace pref="166" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_ClippingLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton_Apply" pref="32" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Clipping layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_ClippingLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_ClippingLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,238 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
/**
*
* @author yaqiang
*/
public class FrmClipping extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
List<VectorLayer> _polygonLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmClipping(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
this.jComboBox_ClippingLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
switch (layer.getShapeType()) {
case Polygon:
case PolygonZ:
case PolygonM:
this._polygonLayers.add((VectorLayer) layer);
this.jComboBox_ClippingLayer.addItem(layer.getLayerName());
break;
}
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
if (this.jComboBox_ClippingLayer.getItemCount() > 0) {
this.jComboBox_ClippingLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_ClippingLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Clipping");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("Clipping layer:");
jComboBox_ClippingLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_ClippingLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_ClippingLayerActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox_ClippingLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_SelFeatureOnly)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(135, 135, 135)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(166, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_ClippingLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly)
.addGap(18, 18, 18)
.addComponent(jButton_Apply, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
if (this.jComboBox_SubjectLayer.getSelectedItem().toString().equals(this.jComboBox_ClippingLayer.getSelectedItem().toString())) {
JOptionPane.showMessageDialog(null, "The two layers are same!");
return;
}
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
VectorLayer clipLayer = _polygonLayers.get(this.jComboBox_ClippingLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly.isSelected();
VectorLayer newLayer = fromLayer.clip(clipLayer, onlySel);
newLayer.setLayerName("Clip_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
private void jComboBox_ClippingLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_ClippingLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_ClippingLayer.getItemCount() > 0) {
VectorLayer aLayer = _polygonLayers.get(this.jComboBox_ClippingLayer.getSelectedIndex());
List<Integer> selIndexes = aLayer.getSelectedShapeIndexes();
if (selIndexes.size() > 0) {
this.jCheckBox_SelFeatureOnly.setEnabled(true);
this.jCheckBox_SelFeatureOnly.setText("Selected features only (" + String.valueOf(selIndexes.size()) + " features selected)");
} else {
this.jCheckBox_SelFeatureOnly.setEnabled(false);
this.jCheckBox_SelFeatureOnly.setSelected(false);
this.jCheckBox_SelFeatureOnly.setText("Selected features only");
}
}
}//GEN-LAST:event_jComboBox_ClippingLayerActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmClipping.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmClipping.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmClipping.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmClipping.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmClipping dialog = new FrmClipping(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly;
private javax.swing.JComboBox jComboBox_ClippingLayer;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
</Form>

View File

@ -0,0 +1,148 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;
import java.util.Locale;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import org.meteoinfo.desktop.config.PythonInteractiveInterpreter;
import org.meteoinfo.global.util.GlobalUtil;
import org.meteoinfo.console.JConsole;
import org.meteoinfo.desktop.codecomplete.JIntrospect;
import org.python.core.Py;
/**
*
* @author yaqiang
*/
public class FrmConsole extends javax.swing.JFrame {
private FrmMain frmMain = null;
/**
* Creates new form FrmConsole
*
* @param parent
*/
public FrmConsole(java.awt.Frame parent) {
super();
initComponents();
this.setSize(600, 400);
frmMain = (FrmMain) parent;
BufferedImage image = null;
try {
image = ImageIO.read(this.getClass().getResource("/images/MeteoInfo_1_16x16x8.png"));
} catch (Exception e) {
}
this.setIconImage(image);
}
/**
* Initialize console
*/
public void InitializeConsole() {
JConsole console = new JConsole();
console.setLocale(Locale.getDefault());
System.out.println(console.getFont());
console.setPreferredSize(new Dimension(600, 400));
console.println(new ImageIcon(this.getClass().getResource("/images/jython_small_c.png")));
// boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
// getInputArguments().toString().contains("jdwp");
String pluginPath = this.frmMain.getStartupPath() + File.separator + "plugins";
List<String> jarfns = GlobalUtil.getFiles(pluginPath, ".jar");
Py.getSystemState().setdefaultencoding("utf-8");
PythonInteractiveInterpreter interp = new PythonInteractiveInterpreter(console);
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
interp.exec("import sys");
//interp.exec("sys.path.append('" + path + "')");
//interp.exec("from milab import *");
//interp.exec("mipylib.miplot.isinteractive = True");
interp.set("miapp", frmMain);
for (String jarfn : jarfns) {
interp.exec("sys.path.append('" + jarfn + "')");
}
} catch (Exception e) {
e.printStackTrace();
this.setCursor(Cursor.getDefaultCursor());
}
new Thread(interp).start();
this.setCursor(Cursor.getDefaultCursor());
JIntrospect nameComplete = new JIntrospect(interp);
console.setNameCompletion(nameComplete);
this.getContentPane().add(console, BorderLayout.CENTER);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmConsole dialog = new FrmConsole(new javax.swing.JFrame());
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Convexhull"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_IsMerge" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="185" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="149" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_IsMerge" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_IsMerge">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Create only one convexhull"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,195 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
/**
*
* @author Yaqiang Wang
*/
public class FrmConvexhull extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmConvexhull(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
jCheckBox_IsMerge = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Convexhull");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jCheckBox_SelFeatureOnly.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jCheckBox_IsMerge.setSelected(true);
jCheckBox_IsMerge.setText("Create only one convexhull");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_IsMerge)
.addComponent(jCheckBox_SelFeatureOnly)
.addComponent(jLabel1))
.addGap(0, 185, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(149, 149, 149))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_IsMerge)
.addGap(18, 18, 18)
.addComponent(jButton_Apply)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly.isSelected();
boolean isMerge = this.jCheckBox_IsMerge.isSelected();
VectorLayer newLayer = fromLayer.convexhull(onlySel, isMerge);
newLayer.setLayerName("Convexhull_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmConvexhull.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmConvexhull.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmConvexhull.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmConvexhull.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmConvexhull dialog = new FrmConvexhull(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_IsMerge;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-49,0,0,2,122"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_Save">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/meteoinfo/resources/Disk_1_16x16x8.png"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SaveActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea_Info">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,173 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.forms;
import java.awt.image.BufferedImage;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import org.meteoinfo.desktop.config.GenericFileFilter;
/**
*
* @author Yaqiang Wang
*/
public class FrmDataInfo extends javax.swing.JFrame {
/**
* Creates new form FrmDataInfo
*/
public FrmDataInfo() {
initComponents();
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setSize(600, 400);
BufferedImage image = null;
try {
image = ImageIO.read(this.getClass().getResource("/images/MeteoInfo_1_16x16x8.png"));
this.setIconImage(image);
} catch (Exception e) {
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jButton_Save = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea_Info = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jToolBar1.setRollover(true);
jButton_Save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Disk_1_16x16x8.png"))); // NOI18N
jButton_Save.setFocusable(false);
jButton_Save.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton_Save.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton_Save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SaveActionPerformed(evt);
}
});
jToolBar1.add(jButton_Save);
getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START);
jTextArea_Info.setColumns(20);
jTextArea_Info.setRows(5);
jScrollPane1.setViewportView(jTextArea_Info);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SaveActionPerformed
// TODO add your handling code here:
JFileChooser aDlg = new JFileChooser();
String[] fileExts = new String[]{"txt"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "Text File (*.txt)");
aDlg.setFileFilter(mapFileFilter);
File dir = new File(System.getProperty("user.dir"));
if (dir.isDirectory()) {
aDlg.setCurrentDirectory(dir);
}
aDlg.setAcceptAllFileFilterUsed(false);
if (aDlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
File file = aDlg.getSelectedFile();
System.setProperty("user.dir", file.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = file.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
file = new File(fileName);
}
try {
BufferedWriter sw = new BufferedWriter(new FileWriter(file));
sw.write(this.jTextArea_Info.getText());
sw.flush();
sw.close();
} catch (IOException ex) {
Logger.getLogger(FrmDataInfo.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jButton_SaveActionPerformed
/**
* Set text
*
* @param text Text
*/
public void setText(String text) {
this.jTextArea_Info.setText(text);
this.jTextArea_Info.setCaretPosition(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmDataInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmDataInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmDataInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmDataInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmDataInfo().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Save;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea_Info;
private javax.swing.JToolBar jToolBar1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Difference"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="134" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace pref="167" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Component id="jComboBox_DifferenceLayer" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Difference" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_DifferenceLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Difference" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="12" max="32767" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Difference layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_DifferenceLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_DifferenceLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Difference">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Subject">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,254 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
import org.meteoinfo.shape.PolygonShape;
/**
*
* @author yaqiang
*/
public class FrmDifference extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
List<VectorLayer> _polygonLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmDifference(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
this.jComboBox_DifferenceLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
switch (layer.getShapeType()) {
case Polygon:
case PolygonZ:
case PolygonM:
this._polygonLayers.add((VectorLayer) layer);
this.jComboBox_DifferenceLayer.addItem(layer.getLayerName());
break;
}
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
if (this.jComboBox_DifferenceLayer.getItemCount() > 0) {
this.jComboBox_DifferenceLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_DifferenceLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly_Difference = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
jCheckBox_SelFeatureOnly_Subject = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Difference");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("Difference layer:");
jComboBox_DifferenceLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_DifferenceLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_DifferenceLayerActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Difference.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Subject.setText("Selected features only");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(134, 134, 134)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(167, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox_DifferenceLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addComponent(jLabel1)
.addComponent(jCheckBox_SelFeatureOnly_Difference)
.addComponent(jLabel2))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_DifferenceLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly_Difference)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(jButton_Apply)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
if (this.jComboBox_SubjectLayer.getSelectedItem().toString().equals(this.jComboBox_DifferenceLayer.getSelectedItem().toString())) {
JOptionPane.showMessageDialog(null, "The two layers are same!");
return;
}
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
VectorLayer clipLayer = _polygonLayers.get(this.jComboBox_DifferenceLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly_Subject.isSelected();
List<PolygonShape> clipShapes;
if (this.jCheckBox_SelFeatureOnly_Difference.isSelected()){
clipShapes = (List<PolygonShape>)clipLayer.getSelectedShapes();
} else {
clipShapes = (List<PolygonShape>)clipLayer.getShapes();
}
VectorLayer newLayer = fromLayer.difference(clipShapes, onlySel);
newLayer.setLayerName("Intersection_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
private void jComboBox_DifferenceLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_DifferenceLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_DifferenceLayer.getItemCount() > 0) {
VectorLayer aLayer = _polygonLayers.get(this.jComboBox_DifferenceLayer.getSelectedIndex());
List<Integer> selIndexes = aLayer.getSelectedShapeIndexes();
if (selIndexes.size() > 0) {
this.jCheckBox_SelFeatureOnly_Difference.setEnabled(true);
this.jCheckBox_SelFeatureOnly_Difference.setText("Selected features only (" + String.valueOf(selIndexes.size()) + " features selected)");
} else {
this.jCheckBox_SelFeatureOnly_Difference.setEnabled(false);
this.jCheckBox_SelFeatureOnly_Difference.setSelected(false);
this.jCheckBox_SelFeatureOnly_Difference.setText("Selected features only");
}
}
}//GEN-LAST:event_jComboBox_DifferenceLayerActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmDifference.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmDifference dialog = new FrmDifference(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Difference;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Subject;
private javax.swing.JComboBox jComboBox_DifferenceLayer;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="jButton_AddFiles" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
<Component id="jButton_Clear" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_Delay" min="-2" pref="69" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_Repeat" min="-2" pref="38" max="-2" attributes="0"/>
<EmptySpace pref="57" max="32767" attributes="0"/>
<Component id="jButton_Create" min="-2" pref="99" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_AddFiles" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Clear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="354" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_Delay" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_Repeat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Create" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_ImageFiles">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_AddFiles">
<Properties>
<Property name="text" type="java.lang.String" value="Add Image Files"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AddFilesActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Delay (ms):"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_Delay">
<Properties>
<Property name="text" type="java.lang.String" value="1000"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Repeat times:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_Repeat">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Create">
<Properties>
<Property name="text" type="java.lang.String" value="Create"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CreateActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Clear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ClearActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,261 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.meteoinfo.desktop.config.GenericFileFilter;
import org.meteoinfo.image.ImageUtil;
/**
*
* @author yaqiang
*/
public class FrmGifAnimator extends javax.swing.JDialog {
/**
* Creates new form FrmGifAnimator
*/
public FrmGifAnimator(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.jList_ImageFiles.setModel(new DefaultListModel());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jList_ImageFiles = new javax.swing.JList();
jButton_AddFiles = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jTextField_Delay = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField_Repeat = new javax.swing.JTextField();
jButton_Create = new javax.swing.JButton();
jButton_Clear = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jScrollPane1.setViewportView(jList_ImageFiles);
jButton_AddFiles.setText("Add Image Files");
jButton_AddFiles.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddFilesActionPerformed(evt);
}
});
jLabel1.setText("Delay (ms):");
jTextField_Delay.setText("1000");
jLabel2.setText("Repeat times:");
jTextField_Repeat.setText("0");
jButton_Create.setText("Create");
jButton_Create.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CreateActionPerformed(evt);
}
});
jButton_Clear.setText("Clear");
jButton_Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ClearActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jButton_AddFiles)
.addGap(37, 37, 37)
.addComponent(jButton_Clear)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_Delay, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_Repeat, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
.addComponent(jButton_Create, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_AddFiles)
.addComponent(jButton_Clear))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField_Delay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jTextField_Repeat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_Create))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_AddFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddFilesActionPerformed
// TODO add your handling code here:
String path = System.getProperty("user.dir");
File pathDir = new File(path);
JFileChooser aDlg = new JFileChooser();
aDlg.setAcceptAllFileFilterUsed(false);
aDlg.setCurrentDirectory(pathDir);
String[] fileExts = new String[]{"gif", "jpg", "png"};
GenericFileFilter allFileFilter = new GenericFileFilter(fileExts, "Supported Formats");
aDlg.addChoosableFileFilter(allFileFilter);
fileExts = new String[]{"gif"};
GenericFileFilter gifFileFilter = new GenericFileFilter(fileExts, "Gif File (*.gif)");
aDlg.addChoosableFileFilter(gifFileFilter);
fileExts = new String[]{"png"};
GenericFileFilter pngFileFilter = new GenericFileFilter(fileExts, "Png File (*.png)");
aDlg.addChoosableFileFilter(pngFileFilter);
fileExts = new String[]{"jpg"};
GenericFileFilter jpgFileFilter = new GenericFileFilter(fileExts, "Jpeg File (*.jpg)");
aDlg.addChoosableFileFilter(jpgFileFilter);
aDlg.setFileFilter(allFileFilter);
aDlg.setMultiSelectionEnabled(true);
if (JFileChooser.APPROVE_OPTION == aDlg.showOpenDialog(this)) {
File[] files = aDlg.getSelectedFiles();
System.setProperty("user.dir", files[0].getParent());
DefaultListModel listModel = (DefaultListModel) this.jList_ImageFiles.getModel();
if (listModel == null) {
listModel = new DefaultListModel();
}
for (File f : files) {
listModel.addElement(f.getAbsoluteFile());
}
this.jList_ImageFiles.setModel(listModel);
}
}//GEN-LAST:event_jButton_AddFilesActionPerformed
private void jButton_ClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ClearActionPerformed
// TODO add your handling code here:
this.jList_ImageFiles.setModel(new DefaultListModel());
}//GEN-LAST:event_jButton_ClearActionPerformed
private void jButton_CreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CreateActionPerformed
// TODO add your handling code here:
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String path = System.getProperty("user.dir");
File pathDir = new File(path);
JFileChooser saveDlg = new JFileChooser();
saveDlg.setAcceptAllFileFilterUsed(false);
saveDlg.setCurrentDirectory(pathDir);
String[] fileExts = new String[]{"gif"};
GenericFileFilter gifFileFilter = new GenericFileFilter(fileExts, "Gif File (*.gif)");
saveDlg.setFileFilter(gifFileFilter);
if (JFileChooser.APPROVE_OPTION == saveDlg.showSaveDialog(this)) {
File outfile = saveDlg.getSelectedFile();
String extent = ((GenericFileFilter) saveDlg.getFileFilter()).getFileExtent();
String fileName = outfile.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
DefaultListModel listModel = (DefaultListModel) this.jList_ImageFiles.getModel();
List<String> fns = new ArrayList<String>();
for (int i = 0; i < listModel.getSize(); i++) {
fns.add(listModel.get(i).toString());
}
int delay = Integer.parseInt(this.jTextField_Delay.getText());
int repeat = Integer.parseInt(this.jTextField_Repeat.getText());
ImageUtil.createGifAnimator(fns, fileName, delay, repeat);
JOptionPane.showMessageDialog(null, "Gif animator file is created!");
}
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_CreateActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmGifAnimator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmGifAnimator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmGifAnimator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmGifAnimator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmGifAnimator dialog = new FrmGifAnimator(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_AddFiles;
private javax.swing.JButton jButton_Clear;
private javax.swing.JButton jButton_Create;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JList jList_ImageFiles;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField_Delay;
private javax.swing.JTextField jTextField_Repeat;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,264 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Grid Set"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton_OK" min="-2" pref="77" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="69" max="-2" attributes="0"/>
<Component id="jButton_Cancel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="87" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_OK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="20" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Output Grid Set"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField_XSize" min="-2" pref="100" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jTextField_MinY" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MaxY" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="8" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jTextField_XNum" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_YNum" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_YSize" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MinX" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MaxX" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace pref="22" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxX" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_XSize" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_YSize" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_XNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_YNum" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="MinX:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinX">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MinXActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="MaxX:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxX">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MaxXActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="MinY:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinY">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MinYActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="MaxY:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxY">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MaxYActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="XSize:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_XSize">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_XSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="YSize:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_YSize">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_YSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="XNum:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_XNum">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_XNumActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="YNum:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_YNum">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_YNumActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_OK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Cancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CancelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,439 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import org.meteoinfo.data.meteodata.GridDataSetting;
/**
*
* @author yaqiang
*/
public class FrmGridSet extends javax.swing.JDialog {
private boolean _isOK = false;
/**
* Creates new form FrmGridSet
*/
public FrmGridSet(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextField_MinX = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField_MaxX = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField_MinY = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField_MaxY = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTextField_XSize = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField_YSize = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jTextField_XNum = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jTextField_YNum = new javax.swing.JTextField();
jButton_OK = new javax.swing.JButton();
jButton_Cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Grid Set");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Output Grid Set"));
jLabel1.setText("MinX:");
jTextField_MinX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MinXActionPerformed(evt);
}
});
jLabel2.setText("MaxX:");
jTextField_MaxX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MaxXActionPerformed(evt);
}
});
jLabel3.setText("MinY:");
jTextField_MinY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MinYActionPerformed(evt);
}
});
jLabel4.setText("MaxY:");
jTextField_MaxY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MaxYActionPerformed(evt);
}
});
jLabel5.setText("XSize:");
jTextField_XSize.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_XSizeActionPerformed(evt);
}
});
jLabel6.setText("YSize:");
jTextField_YSize.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_YSizeActionPerformed(evt);
}
});
jLabel7.setText("XNum:");
jTextField_XNum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_XNumActionPerformed(evt);
}
});
jLabel8.setText("YNum:");
jTextField_YNum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_YNumActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField_XSize, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTextField_MinY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MaxY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(8, 8, 8)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jTextField_XNum, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_YNum, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_YSize, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MinX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MaxX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap(22, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField_MinX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jTextField_MaxX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField_MinY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(jTextField_MaxY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField_XSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6)
.addComponent(jTextField_YSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jTextField_XNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(jTextField_YNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton_OK.setText("OK");
jButton_OK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OKActionPerformed(evt);
}
});
jButton_Cancel.setText("Cancel");
jButton_Cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_OK, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69)
.addComponent(jButton_Cancel)
.addGap(87, 87, 87))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_OK)
.addComponent(jButton_Cancel))
.addContainerGap(20, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* Get if is OK
* @return Boolean
*/
public boolean isOK(){
return this._isOK;
}
private void jTextField_MinXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MinXActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MinXActionPerformed
private void jTextField_MaxXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MaxXActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MaxXActionPerformed
private void jTextField_MinYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MinYActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MinYActionPerformed
private void jTextField_MaxYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MaxYActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MaxYActionPerformed
private void jTextField_XSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_XSizeActionPerformed
// TODO add your handling code here:
this.setXYNum();
}//GEN-LAST:event_jTextField_XSizeActionPerformed
private void jTextField_YSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_YSizeActionPerformed
// TODO add your handling code here:
this.setXYNum();
}//GEN-LAST:event_jTextField_YSizeActionPerformed
private void jTextField_XNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_XNumActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_XNumActionPerformed
private void jTextField_YNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_YNumActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_YNumActionPerformed
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
this._isOK = true;
this.dispose();
}//GEN-LAST:event_jButton_OKActionPerformed
private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed
// TODO add your handling code here:
this._isOK = false;
this.dispose();
}//GEN-LAST:event_jButton_CancelActionPerformed
public void setParameters(GridDataSetting aGDP) {
this.jTextField_MinX.setText(String.valueOf(aGDP.dataExtent.minX));
this.jTextField_MaxX.setText(String.valueOf(aGDP.dataExtent.maxX));
this.jTextField_MinY.setText(String.valueOf(aGDP.dataExtent.minY));
this.jTextField_MaxY.setText(String.valueOf(aGDP.dataExtent.maxY));
this.jTextField_XNum.setText(String.valueOf(aGDP.xNum));
this.jTextField_YNum.setText(String.valueOf(aGDP.yNum));
setXYSize();
}
public GridDataSetting getParameters() {
float minX, maxX, minY, maxY;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
GridDataSetting aGDP = new GridDataSetting();
aGDP.dataExtent.minX = minX;
aGDP.dataExtent.maxX = maxX;
aGDP.dataExtent.minY = minY;
aGDP.dataExtent.maxY = maxY;
aGDP.xNum = Integer.parseInt(this.jTextField_XNum.getText());
aGDP.yNum = Integer.parseInt(this.jTextField_YNum.getText());
return aGDP;
}
private void setXYNum() {
float minX, maxX, minY, maxY;
float XSize, YSize;
int XNum, YNum;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
XSize = Float.parseFloat(this.jTextField_XSize.getText());
YSize = Float.parseFloat(this.jTextField_YSize.getText());
XNum = (int) ((maxX - minX) / XSize);
YNum = (int) ((maxY - minY) / YSize);
maxX = minX + XNum * XSize;
maxY = minY + YNum * YSize;
XNum += 1;
YNum += 1;
this.jTextField_XNum.setText(String.valueOf(XNum));
this.jTextField_YNum.setText(String.valueOf(YNum));
this.jTextField_MaxX.setText(String.valueOf(maxX));
this.jTextField_MaxY.setText(String.valueOf(maxY));
}
private void setXYSize() {
float minX, maxX, minY, maxY;
float XSize, YSize;
int XNum, YNum;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
XNum = Integer.parseInt(this.jTextField_XNum.getText());
YNum = Integer.parseInt(this.jTextField_YNum.getText());
XSize = (maxX - minX) / (XNum - 1);
YSize = (maxY - minY) / (YNum - 1);
this.jTextField_XSize.setText(String.valueOf(XSize));
this.jTextField_YSize.setText(String.valueOf(YSize));
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmGridSet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmGridSet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmGridSet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmGridSet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmGridSet dialog = new FrmGridSet(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Cancel;
private javax.swing.JButton jButton_OK;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField_MaxX;
private javax.swing.JTextField jTextField_MaxY;
private javax.swing.JTextField jTextField_MinX;
private javax.swing.JTextField jTextField_MinY;
private javax.swing.JTextField jTextField_XNum;
private javax.swing.JTextField jTextField_XSize;
private javax.swing.JTextField jTextField_YNum;
private javax.swing.JTextField jTextField_YSize;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,361 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Interpolate"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="67" max="-2" attributes="0"/>
<Component id="jButton_OK" min="-2" pref="72" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
<Component id="jButton_Cancel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_OK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="21" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Output Grid Set"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_MinX" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_MinY" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_XSize" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_XNum" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField_MinX" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_MinY" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_XSize" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_XNum" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_MaxX" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_MaxY" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_YSize" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_YNum" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField_MaxX" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_MaxY" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_YSize" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="jTextField_YNum" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_MinX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_MaxX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxX" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_MinY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_MaxY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_XSize" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_XSize" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_YSize" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_YSize" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_XNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_XNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_YNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_YNum" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel_MinX">
<Properties>
<Property name="text" type="java.lang.String" value="minX:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinX">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MinXActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_MaxX">
<Properties>
<Property name="text" type="java.lang.String" value="maxX:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxX">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MaxXActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_MinY">
<Properties>
<Property name="text" type="java.lang.String" value="minY:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinY">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MinYActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_MaxY">
<Properties>
<Property name="text" type="java.lang.String" value="maxY:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxY">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_MaxYActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_XSize">
<Properties>
<Property name="text" type="java.lang.String" value="XSize:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_XSize">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_XSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_YSize">
<Properties>
<Property name="text" type="java.lang.String" value="YSize:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_YSize">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_YSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_XNum">
<Properties>
<Property name="text" type="java.lang.String" value="XNum:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_XNum">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_XNumActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_YNum">
<Properties>
<Property name="text" type="java.lang.String" value="YNum:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_YNum">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField_YNumActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Method Set"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="jLabel_Method" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Methods" min="-2" pref="176" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel_MinNum" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_Radius" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jTextField_MinNum" min="-2" pref="44" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel_MissingValue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MissingValue" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jTextField_Radius" min="-2" pref="156" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_Method" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Methods" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_Radius" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_Radius" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_MinNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinNum" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_MissingValue" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MissingValue" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel_Method">
<Properties>
<Property name="text" type="java.lang.String" value="Method:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Methods">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_MethodsActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_Radius">
<Properties>
<Property name="text" type="java.lang.String" value="Radius:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_Radius">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_MinNum">
<Properties>
<Property name="text" type="java.lang.String" value="MinNum:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinNum">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_MissingValue">
<Properties>
<Property name="text" type="java.lang.String" value="Missing Value:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MissingValue">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_OK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Cancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CancelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,600 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.util.ArrayList;
import java.util.List;
import org.meteoinfo.data.meteodata.GridDataSetting;
import org.meteoinfo.geoprocess.analysis.InterpolationMethods;
import org.meteoinfo.geoprocess.analysis.InterpolationSetting;
/**
*
* @author yaqiang
*/
public class FrmInterpolate extends javax.swing.JDialog {
private InterpolationSetting _interpSetting = new InterpolationSetting();
private boolean _isOK = false;
/**
* Creates new form FrmInterpolate
*/
public FrmInterpolate(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel_MinX = new javax.swing.JLabel();
jTextField_MinX = new javax.swing.JTextField();
jLabel_MaxX = new javax.swing.JLabel();
jTextField_MaxX = new javax.swing.JTextField();
jLabel_MinY = new javax.swing.JLabel();
jTextField_MinY = new javax.swing.JTextField();
jLabel_MaxY = new javax.swing.JLabel();
jTextField_MaxY = new javax.swing.JTextField();
jLabel_XSize = new javax.swing.JLabel();
jTextField_XSize = new javax.swing.JTextField();
jLabel_YSize = new javax.swing.JLabel();
jTextField_YSize = new javax.swing.JTextField();
jLabel_XNum = new javax.swing.JLabel();
jTextField_XNum = new javax.swing.JTextField();
jLabel_YNum = new javax.swing.JLabel();
jTextField_YNum = new javax.swing.JTextField();
jPanel2 = new javax.swing.JPanel();
jLabel_Method = new javax.swing.JLabel();
jComboBox_Methods = new javax.swing.JComboBox();
jLabel_Radius = new javax.swing.JLabel();
jTextField_Radius = new javax.swing.JTextField();
jLabel_MinNum = new javax.swing.JLabel();
jTextField_MinNum = new javax.swing.JTextField();
jLabel_MissingValue = new javax.swing.JLabel();
jTextField_MissingValue = new javax.swing.JTextField();
jButton_OK = new javax.swing.JButton();
jButton_Cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Interpolate");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Output Grid Set"));
jLabel_MinX.setText("minX:");
jTextField_MinX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MinXActionPerformed(evt);
}
});
jLabel_MaxX.setText("maxX:");
jTextField_MaxX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MaxXActionPerformed(evt);
}
});
jLabel_MinY.setText("minY:");
jTextField_MinY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MinYActionPerformed(evt);
}
});
jLabel_MaxY.setText("maxY:");
jTextField_MaxY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_MaxYActionPerformed(evt);
}
});
jLabel_XSize.setText("XSize:");
jTextField_XSize.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_XSizeActionPerformed(evt);
}
});
jLabel_YSize.setText("YSize:");
jTextField_YSize.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_YSizeActionPerformed(evt);
}
});
jLabel_XNum.setText("XNum:");
jTextField_XNum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_XNumActionPerformed(evt);
}
});
jLabel_YNum.setText("YNum:");
jTextField_YNum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField_YNumActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_MinX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_MinY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_XSize, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_XNum, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField_MinX, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_MinY, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_XSize, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_XNum, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_MaxX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_MaxY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_YSize, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_YNum, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField_MaxX, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_MaxY, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_YSize, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField_YNum, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_MinX)
.addComponent(jTextField_MinX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_MaxX)
.addComponent(jTextField_MaxX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_MinY)
.addComponent(jTextField_MinY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_MaxY)
.addComponent(jTextField_MaxY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_XSize)
.addComponent(jTextField_XSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_YSize)
.addComponent(jTextField_YSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_XNum)
.addComponent(jTextField_XNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_YNum)
.addComponent(jTextField_YNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Method Set"));
jLabel_Method.setText("Method:");
jComboBox_Methods.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_Methods.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_MethodsActionPerformed(evt);
}
});
jLabel_Radius.setText("Radius:");
jLabel_MinNum.setText("MinNum:");
jLabel_MissingValue.setText("Missing Value:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel_Method)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_Methods, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel_MinNum)
.addComponent(jLabel_Radius))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jTextField_MinNum, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel_MissingValue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MissingValue))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jTextField_Radius, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_Method)
.addComponent(jComboBox_Methods, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_Radius)
.addComponent(jTextField_Radius, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_MinNum)
.addComponent(jTextField_MinNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_MissingValue)
.addComponent(jTextField_MissingValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton_OK.setText("OK");
jButton_OK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OKActionPerformed(evt);
}
});
jButton_Cancel.setText("Cancel");
jButton_Cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jButton_OK, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(jButton_Cancel)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_OK)
.addComponent(jButton_Cancel))
.addContainerGap(21, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextField_XSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_XSizeActionPerformed
// TODO add your handling code here:
this.setXYNum();
}//GEN-LAST:event_jTextField_XSizeActionPerformed
private void jTextField_YSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_YSizeActionPerformed
// TODO add your handling code here:
this.setXYNum();
}//GEN-LAST:event_jTextField_YSizeActionPerformed
private void jTextField_MinXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MinXActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MinXActionPerformed
private void jTextField_MaxXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MaxXActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MaxXActionPerformed
private void jTextField_MinYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MinYActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MinYActionPerformed
private void jTextField_MaxYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_MaxYActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_MaxYActionPerformed
private void jTextField_XNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_XNumActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_XNumActionPerformed
private void jTextField_YNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_YNumActionPerformed
// TODO add your handling code here:
this.setXYSize();
}//GEN-LAST:event_jTextField_YNumActionPerformed
private void jComboBox_MethodsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_MethodsActionPerformed
// TODO add your handling code here:
if (jComboBox_Methods.getItemCount() == 0) {
return;
}
InterpolationMethods method = InterpolationMethods.valueOf(this.jComboBox_Methods.getSelectedItem().toString());
switch (method) {
case IDW_Radius:
this.jTextField_Radius.setEnabled(true);
this.jTextField_MinNum.setEnabled(true);
this.jTextField_Radius.setText(String.valueOf(this._interpSetting.getRadius()));
break;
case IDW_Neighbors:
this.jTextField_Radius.setEnabled(false);
this.jTextField_MinNum.setEnabled(true);
this.jTextField_Radius.setText(String.valueOf(this._interpSetting.getRadius()));
break;
case Cressman:
this.jTextField_Radius.setEnabled(true);
this.jTextField_MinNum.setEnabled(false);
String radStr = "";
for (int i = 0; i < this._interpSetting.getRadiusList().size(); i++) {
radStr = radStr + String.valueOf(this._interpSetting.getRadiusList().get(i)) + ";";
}
radStr = radStr.substring(0, radStr.length() - 1);
this.jTextField_Radius.setText(radStr);
break;
}
}//GEN-LAST:event_jComboBox_MethodsActionPerformed
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
this._isOK = true;
this.dispose();
}//GEN-LAST:event_jButton_OKActionPerformed
private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CancelActionPerformed
public boolean isOK(){
return this._isOK;
}
public void setParameters(InterpolationSetting interpSetting) {
this._interpSetting = interpSetting;
this.jTextField_MinX.setText(String.valueOf(interpSetting.getGridDataSetting().dataExtent.minX));
this.jTextField_MaxX.setText(String.valueOf(interpSetting.getGridDataSetting().dataExtent.maxX));
this.jTextField_MinY.setText(String.valueOf(interpSetting.getGridDataSetting().dataExtent.minY));
this.jTextField_MaxY.setText(String.valueOf(interpSetting.getGridDataSetting().dataExtent.maxY));
this.jTextField_XNum.setText(String.valueOf(interpSetting.getGridDataSetting().xNum));
this.jTextField_YNum.setText(String.valueOf(interpSetting.getGridDataSetting().yNum));
setXYSize();
this.jComboBox_Methods.removeAllItems();
this.jComboBox_Methods.addItem(InterpolationMethods.IDW_Radius.toString());
this.jComboBox_Methods.addItem(InterpolationMethods.IDW_Neighbors.toString());
this.jComboBox_Methods.addItem(InterpolationMethods.Cressman.toString());
this.jComboBox_Methods.addItem(InterpolationMethods.AssignPointToGrid.toString());
this.jComboBox_Methods.setSelectedItem(this._interpSetting.getInterpolationMethod().toString());
switch (this._interpSetting.getInterpolationMethod()) {
case Cressman:
String radStr = "";
for (int i = 0; i < this._interpSetting.getRadiusList().size(); i++) {
radStr = radStr + String.valueOf(this._interpSetting.getRadiusList().get(i)) + ";";
}
radStr = radStr.substring(0, radStr.length() - 1);
this.jTextField_Radius.setText(radStr);
this.jTextField_MinNum.setText(String.valueOf(this._interpSetting.getMinPointNum()));
this.jTextField_MissingValue.setText(String.valueOf(this._interpSetting.getMissingValue()));
this.jTextField_MissingValue.setEnabled(false);
break;
case IDW_Neighbors:
case IDW_Radius:
this.jTextField_Radius.setText(((Double) this._interpSetting.getRadius()).toString());
this.jTextField_MinNum.setText(String.valueOf(this._interpSetting.getMinPointNum()));
this.jTextField_MissingValue.setText(String.valueOf(this._interpSetting.getMissingValue()));
this.jTextField_MissingValue.setEnabled(false);
break;
case AssignPointToGrid:
break;
}
}
public InterpolationSetting getParameters() {
float minX, maxX, minY, maxY;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
GridDataSetting aGDP = new GridDataSetting();
aGDP.dataExtent.minX = minX;
aGDP.dataExtent.maxX = maxX;
aGDP.dataExtent.minY = minY;
aGDP.dataExtent.maxY = maxY;
aGDP.xNum = Integer.parseInt(this.jTextField_XNum.getText());
aGDP.yNum = Integer.parseInt(this.jTextField_YNum.getText());
InterpolationSetting interpSetting = new InterpolationSetting();
interpSetting.setGridDataSetting(aGDP);
interpSetting.setInterpolationMethod(InterpolationMethods.valueOf(this.jComboBox_Methods.getSelectedItem().toString()));
switch (interpSetting.getInterpolationMethod()) {
case Cressman:
if (!this.jTextField_Radius.getText().isEmpty()) {
String[] radStrs = this.jTextField_Radius.getText().split(";");
List<Double> radList = new ArrayList<Double>();
for (int i = 0; i < radStrs.length; i++) {
radList.add(Double.parseDouble(radStrs[i]));
}
interpSetting.setRadiusList(radList);
} else {
interpSetting.setRadiusList(new ArrayList<Double>());
}
interpSetting.setMinPointNum(Integer.parseInt(this.jTextField_MinNum.getText()));
break;
case IDW_Neighbors:
case IDW_Radius:
interpSetting.setRadius(Double.parseDouble(this.jTextField_Radius.getText()));
interpSetting.setMinPointNum(Integer.parseInt(this.jTextField_MinNum.getText()));
break;
}
return interpSetting;
}
private void setXYSize() {
float minX, maxX, minY, maxY;
float XSize, YSize;
int XNum, YNum;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
XNum = Integer.parseInt(this.jTextField_XNum.getText());
YNum = Integer.parseInt(this.jTextField_YNum.getText());
XSize = (maxX - minX) / (XNum - 1);
YSize = (maxY - minY) / (YNum - 1);
this.jTextField_XSize.setText(String.valueOf(XSize));
this.jTextField_YSize.setText(String.valueOf(YSize));
}
private void setXYNum() {
float minX, maxX, minY, maxY;
float XSize, YSize;
int XNum, YNum;
minX = Float.parseFloat(this.jTextField_MinX.getText());
maxX = Float.parseFloat(this.jTextField_MaxX.getText());
minY = Float.parseFloat(this.jTextField_MinY.getText());
maxY = Float.parseFloat(this.jTextField_MaxY.getText());
XSize = Float.parseFloat(this.jTextField_XSize.getText());
YSize = Float.parseFloat(this.jTextField_YSize.getText());
XNum = (int) ((maxX - minX) / XSize);
YNum = (int) ((maxY - minY) / YSize);
maxX = minX + XNum * XSize;
maxY = minY + YNum * YSize;
XNum += 1;
YNum += 1;
this.jTextField_XNum.setText(String.valueOf(XNum));
this.jTextField_YNum.setText(String.valueOf(YNum));
this.jTextField_MaxX.setText(String.valueOf(maxX));
this.jTextField_MaxY.setText(String.valueOf(maxY));
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmInterpolate.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmInterpolate.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmInterpolate.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmInterpolate.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmInterpolate dialog = new FrmInterpolate(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Cancel;
private javax.swing.JButton jButton_OK;
private javax.swing.JComboBox jComboBox_Methods;
private javax.swing.JLabel jLabel_MaxX;
private javax.swing.JLabel jLabel_MaxY;
private javax.swing.JLabel jLabel_Method;
private javax.swing.JLabel jLabel_MinNum;
private javax.swing.JLabel jLabel_MinX;
private javax.swing.JLabel jLabel_MinY;
private javax.swing.JLabel jLabel_MissingValue;
private javax.swing.JLabel jLabel_Radius;
private javax.swing.JLabel jLabel_XNum;
private javax.swing.JLabel jLabel_XSize;
private javax.swing.JLabel jLabel_YNum;
private javax.swing.JLabel jLabel_YSize;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTextField jTextField_MaxX;
private javax.swing.JTextField jTextField_MaxY;
private javax.swing.JTextField jTextField_MinNum;
private javax.swing.JTextField jTextField_MinX;
private javax.swing.JTextField jTextField_MinY;
private javax.swing.JTextField jTextField_MissingValue;
private javax.swing.JTextField jTextField_Radius;
private javax.swing.JTextField jTextField_XNum;
private javax.swing.JTextField jTextField_XSize;
private javax.swing.JTextField jTextField_YNum;
private javax.swing.JTextField jTextField_YSize;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Intersection"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="134" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace pref="167" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Component id="jComboBox_IntersectionLayer" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Intersection" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_IntersectionLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Intersection" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="12" max="32767" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Intersection layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_IntersectionLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_IntersectionLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Intersection">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Subject">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,246 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
/**
*
* @author yaqiang
*/
public class FrmIntersection extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
List<VectorLayer> _polygonLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmIntersection(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
this.jComboBox_IntersectionLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
switch (layer.getShapeType()) {
case Polygon:
case PolygonZ:
case PolygonM:
this._polygonLayers.add((VectorLayer) layer);
this.jComboBox_IntersectionLayer.addItem(layer.getLayerName());
break;
}
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
if (this.jComboBox_IntersectionLayer.getItemCount() > 0) {
this.jComboBox_IntersectionLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_IntersectionLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly_Intersection = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
jCheckBox_SelFeatureOnly_Subject = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Intersection");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("Intersection layer:");
jComboBox_IntersectionLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_IntersectionLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_IntersectionLayerActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Intersection.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Subject.setText("Selected features only");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(134, 134, 134)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(167, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox_IntersectionLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addComponent(jLabel1)
.addComponent(jCheckBox_SelFeatureOnly_Intersection)
.addComponent(jLabel2))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_IntersectionLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly_Intersection)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(jButton_Apply)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
if (this.jComboBox_SubjectLayer.getSelectedItem().toString().equals(this.jComboBox_IntersectionLayer.getSelectedItem().toString())) {
JOptionPane.showMessageDialog(null, "The two layers are same!");
return;
}
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
VectorLayer clipLayer = _polygonLayers.get(this.jComboBox_IntersectionLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly_Intersection.isSelected();
VectorLayer newLayer = fromLayer.clip(clipLayer, onlySel);
newLayer.setLayerName("Intersection_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
private void jComboBox_IntersectionLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_IntersectionLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_IntersectionLayer.getItemCount() > 0) {
VectorLayer aLayer = _polygonLayers.get(this.jComboBox_IntersectionLayer.getSelectedIndex());
List<Integer> selIndexes = aLayer.getSelectedShapeIndexes();
if (selIndexes.size() > 0) {
this.jCheckBox_SelFeatureOnly_Intersection.setEnabled(true);
this.jCheckBox_SelFeatureOnly_Intersection.setText("Selected features only (" + String.valueOf(selIndexes.size()) + " features selected)");
} else {
this.jCheckBox_SelFeatureOnly_Intersection.setEnabled(false);
this.jCheckBox_SelFeatureOnly_Intersection.setSelected(false);
this.jCheckBox_SelFeatureOnly_Intersection.setText("Selected features only");
}
}
}//GEN-LAST:event_jComboBox_IntersectionLayerActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmIntersection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmIntersection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmIntersection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmIntersection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmIntersection dialog = new FrmIntersection(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Intersection;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Subject;
private javax.swing.JComboBox jComboBox_IntersectionLayer;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton_Select" alignment="0" min="-2" pref="54" max="-2" attributes="0"/>
<Component id="jButton_UnSelecte" alignment="0" min="-2" pref="54" max="-2" attributes="0"/>
<Component id="jButton_SelectAll" alignment="0" min="-2" pref="54" max="-2" attributes="0"/>
<Component id="jButton_UnSelectAll" alignment="0" min="-2" pref="54" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane2" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jButton_DataFolder" min="-2" pref="36" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel_DataFolder" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jTextField_TimeDimName" min="-2" pref="175" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jButton_Join" min="-2" pref="79" max="-2" attributes="0"/>
<EmptySpace min="0" pref="58" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jButton_DataFolder" max="32767" attributes="0"/>
<Component id="jLabel_DataFolder" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="70" max="-2" attributes="0"/>
<Component id="jButton_Select" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton_UnSelecte" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton_SelectAll" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton_UnSelectAll" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jScrollPane2" pref="275" max="32767" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_Join" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="3" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_TimeDimName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="24" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_DataFolder">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Folder_1_16x16x8.png"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DataFolderActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_DataFolder">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_AllFiles">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_SelectedFiles">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_SelectAll">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="&gt;&gt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SelectAllActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_UnSelecte">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="&lt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UnSelecteActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Select">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="&gt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SelectActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_UnSelectAll">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="15" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="&lt;&lt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UnSelectAllActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Join">
<Properties>
<Property name="text" type="java.lang.String" value="Join"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_JoinActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Time Dimension Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_TimeDimName">
<Properties>
<Property name="text" type="java.lang.String" value="time"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,366 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.meteoinfo.data.meteodata.netcdf.NetCDFDataInfo;
import org.meteoinfo.desktop.config.GenericFileFilter;
/**
*
* @author yaqiang
*/
public class FrmJoinNCFiles extends javax.swing.JDialog {
/**
* Creates new form FrmJoinNCFiles
* @param parent
* @param modal
*/
public FrmJoinNCFiles(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.jList_AllFiles.setModel(new DefaultListModel());
this.jList_SelectedFiles.setModel(new DefaultListModel());
File path = new File(System.getProperty("user.dir"));
this.setDataFolder(path);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton_DataFolder = new javax.swing.JButton();
jLabel_DataFolder = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jList_AllFiles = new javax.swing.JList();
jScrollPane2 = new javax.swing.JScrollPane();
jList_SelectedFiles = new javax.swing.JList();
jButton_SelectAll = new javax.swing.JButton();
jButton_UnSelecte = new javax.swing.JButton();
jButton_Select = new javax.swing.JButton();
jButton_UnSelectAll = new javax.swing.JButton();
jButton_Join = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jTextField_TimeDimName = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jButton_DataFolder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Folder_1_16x16x8.png"))); // NOI18N
jButton_DataFolder.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_DataFolderActionPerformed(evt);
}
});
jLabel_DataFolder.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jList_AllFiles.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(jList_AllFiles);
jList_SelectedFiles.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jScrollPane2.setViewportView(jList_SelectedFiles);
jButton_SelectAll.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jButton_SelectAll.setText(">>");
jButton_SelectAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SelectAllActionPerformed(evt);
}
});
jButton_UnSelecte.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jButton_UnSelecte.setText("<");
jButton_UnSelecte.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_UnSelecteActionPerformed(evt);
}
});
jButton_Select.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jButton_Select.setText(">");
jButton_Select.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SelectActionPerformed(evt);
}
});
jButton_UnSelectAll.setFont(new java.awt.Font("宋体", 1, 15)); // NOI18N
jButton_UnSelectAll.setText("<<");
jButton_UnSelectAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_UnSelectAllActionPerformed(evt);
}
});
jButton_Join.setText("Join");
jButton_Join.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_JoinActionPerformed(evt);
}
});
jLabel1.setText("Time Dimension Name:");
jTextField_TimeDimName.setText("time");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton_Select, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_UnSelecte, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_SelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_UnSelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton_DataFolder, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel_DataFolder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_TimeDimName, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(jButton_Join, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 58, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton_DataFolder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel_DataFolder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(70, 70, 70)
.addComponent(jButton_Select)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton_UnSelecte)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton_SelectAll)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton_UnSelectAll))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
.addComponent(jScrollPane1))))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_Join)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField_TimeDimName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(24, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_DataFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_DataFolderActionPerformed
// TODO add your handling code here:
JFileChooser aDlg = new JFileChooser();
String path = System.getProperty("user.dir");
File pathDir = new File(path);
if (pathDir.isDirectory()) {
aDlg.setCurrentDirectory(pathDir);
}
aDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (JFileChooser.APPROVE_OPTION == aDlg.showOpenDialog(this)) {
File aFile = aDlg.getSelectedFile();
System.setProperty("user.dir", aFile.getAbsolutePath());
this.setDataFolder(aFile);
}
}//GEN-LAST:event_jButton_DataFolderActionPerformed
private void jButton_SelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectActionPerformed
// TODO add your handling code here:
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
List<String> selNames = this.jList_AllFiles.getSelectedValuesList();
for (String name : selNames){
listModel_sel.addElement(name);
}
}//GEN-LAST:event_jButton_SelectActionPerformed
private void jButton_UnSelecteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UnSelecteActionPerformed
// TODO add your handling code here:
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
List<String> selNames = this.jList_SelectedFiles.getSelectedValuesList();
for (String name : selNames){
listModel_sel.removeElement(name);
}
}//GEN-LAST:event_jButton_UnSelecteActionPerformed
private void jButton_SelectAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectAllActionPerformed
// TODO add your handling code here:
DefaultListModel listModel_all = (DefaultListModel)this.jList_AllFiles.getModel();
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
listModel_sel.clear();
for (int i = 0; i < listModel_all.getSize(); i++){
listModel_sel.addElement(listModel_all.getElementAt(i));
}
}//GEN-LAST:event_jButton_SelectAllActionPerformed
private void jButton_UnSelectAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UnSelectAllActionPerformed
// TODO add your handling code here:
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
listModel_sel.clear();
}//GEN-LAST:event_jButton_UnSelectAllActionPerformed
private void jButton_JoinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_JoinActionPerformed
// TODO add your handling code here:
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
List<String> sfns = new ArrayList<>();
for (int i = 0; i < listModel_sel.getSize(); i++){
sfns.add(listModel_sel.getElementAt(i).toString());
}
if (sfns.size() < 2){
JOptionPane.showMessageDialog(null, "At least two files should be selected for joining!", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
String path = this.jLabel_DataFolder.getText();
List<String> fns = new ArrayList<>();
for (String sfn : sfns){
String fn = path + File.separator + sfn;
if (new File(fn).isFile())
fns.add(fn);
}
File pathDir = new File(path);
JFileChooser aDlg = new JFileChooser();
aDlg.setCurrentDirectory(pathDir);
String[] fileExts = new String[]{"nc"};
GenericFileFilter ncFileFilter = new GenericFileFilter(fileExts, "NetCDF file (*.nc)");
aDlg.setFileFilter(ncFileFilter);
aDlg.setAcceptAllFileFilterUsed(false);
if (JFileChooser.APPROVE_OPTION == aDlg.showSaveDialog(this)) {
File aFile = aDlg.getSelectedFile();
System.setProperty("user.dir", aFile.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = aFile.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String tDimName = this.jTextField_TimeDimName.getText();
NetCDFDataInfo.joinDataFiles(fns, fileName, tDimName);
this.setCursor(Cursor.getDefaultCursor());
}
}//GEN-LAST:event_jButton_JoinActionPerformed
private void setDataFolder(File path) {
if (!path.isDirectory())
return;
this.jLabel_DataFolder.setText(path.getAbsolutePath());
DefaultListModel listModel_all = (DefaultListModel)this.jList_AllFiles.getModel();
DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel();
listModel_all.clear();
listModel_sel.clear();
File[] files = path.listFiles();
Arrays.sort(files);
for (File file : files) {
if (file.isFile()) {
String name = file.getName();
listModel_all.addElement(name);
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmJoinNCFiles.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmJoinNCFiles.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmJoinNCFiles.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmJoinNCFiles.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmJoinNCFiles dialog = new FrmJoinNCFiles(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_DataFolder;
private javax.swing.JButton jButton_Join;
private javax.swing.JButton jButton_Select;
private javax.swing.JButton jButton_SelectAll;
private javax.swing.JButton jButton_UnSelectAll;
private javax.swing.JButton jButton_UnSelecte;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel_DataFolder;
private javax.swing.JList jList_AllFiles;
private javax.swing.JList jList_SelectedFiles;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField jTextField_TimeDimName;
// End of variables declaration//GEN-END:variables
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,565 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.title" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_formBundle" type="java.lang.String" value="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" max="32767" attributes="0"/>
<Component id="jSplitPane1" alignment="0" pref="764" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSplitPane1" pref="476" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_DataInfo">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/information.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_DataInfo.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DataInfoActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
</Component>
<Component class="javax.swing.JButton" name="jButton_Draw">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_Draw.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_Draw.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DrawActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ViewData">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ViewData.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_ViewData.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ViewDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ClearDraw">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ClearDrawing.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_ClearDraw.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ClearDrawActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
</Component>
<Component class="javax.swing.JButton" name="jButton_PreTime">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_PreTime.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_PreTime.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PreTimeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_NexTime">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_NextTime.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_NexTime.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_NexTimeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Animator">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/animation-1.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_Animator.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AnimatorActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="dividerLocation" type="int" value="250"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[737, 465]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 463]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel_PlotDims" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_PlotDim" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="jPanel_Dimensions" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel_DrawType" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_DrawType" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jCheckBox_YReverse" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel_Variable" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Variable" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jComboBox_Variable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_Variable" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_DrawType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_DrawType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_PlotDims" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_PlotDim" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Component id="jCheckBox_YReverse" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel_Dimensions" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel_DrawType">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jLabel_DrawType.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_DrawType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_DrawTypeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_PlotDims">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jLabel_PlotDims.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_PlotDim">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_PlotDimActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel_Dimensions">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox_Lat" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Lat2" alignment="0" pref="124" max="32767" attributes="0"/>
<Component id="jComboBox_Lat1" alignment="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox_Lon" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Lon1" alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="jComboBox_Lon2" alignment="1" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_Level" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_Time" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Time1" alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="jComboBox_Time2" alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="jComboBox_Level1" alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="jComboBox_Level2" alignment="1" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Time" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Time1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Time2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Level" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Level1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Level2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Lat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Lat1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Lat2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Lon" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Lon1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Lon2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Time">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jCheckBox_Time.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_TimeStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Time1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Level">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jCheckBox_Level.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LevelStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Time2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Level1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Level2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Lat">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jCheckBox_Lat.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LatStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lat1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lat2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Lon">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jCheckBox_Lon.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LonStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lon1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lon2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel_Variable">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jLabel_Variable.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Variable">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_VariableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_YReverse">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmOneDim.properties" key="FrmOneDim.jCheckBox_YReverse.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu_OpenData">
<Properties>
<Property name="text" type="java.lang.String" value="Open Data"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_NetCDF">
<Properties>
<Property name="text" type="java.lang.String" value="NetCDF, GRIB, HDF..."/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_GrADS">
<Properties>
<Property name="text" type="java.lang.String" value="GrADS Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_ARL">
<Properties>
<Property name="text" type="java.lang.String" value="ARL Data"/>
</Properties>
</MenuItem>
<Menu class="javax.swing.JMenu" name="jMenu_HYSPLIT">
<Properties>
<Property name="text" type="java.lang.String" value="HYSPLIT Data"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Traj">
<Properties>
<Property name="text" type="java.lang.String" value="Trajectory Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Conc">
<Properties>
<Property name="text" type="java.lang.String" value="Concentration Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Particle">
<Properties>
<Property name="text" type="java.lang.String" value="Particle Data"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu_ASCII">
<Properties>
<Property name="text" type="java.lang.String" value="ASCII Data"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_LonLat">
<Properties>
<Property name="text" type="java.lang.String" value="Lon/Lat Station Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Synop">
<Properties>
<Property name="text" type="java.lang.String" value="SYNOP Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Metar">
<Properties>
<Property name="text" type="java.lang.String" value="METAR Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator1">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_ESRI">
<Properties>
<Property name="text" type="java.lang.String" value="ESRI ASCII Grid Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Surfer">
<Properties>
<Property name="text" type="java.lang.String" value="Surfer ASCII Grid Data"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Micaps">
<Properties>
<Property name="text" type="java.lang.String" value="MICAPS Data"/>
</Properties>
</MenuItem>
<Menu class="javax.swing.JMenu" name="jMenu_MM5">
<Properties>
<Property name="text" type="java.lang.String" value="MM5 Data"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_MM5_Output">
<Properties>
<Property name="text" type="java.lang.String" value="MM5 Output Data"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_MM5_Inter">
<Properties>
<Property name="text" type="java.lang.String" value="MM5 Intermediate Data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_MM5_InterActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_AWX">
<Properties>
<Property name="text" type="java.lang.String" value="AWX Data"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Open Data"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="173" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="44" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -0,0 +1,210 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
/**
*
* @author wyq
*/
public class FrmOpenData extends javax.swing.JDialog {
/**
* Creates new form FrmOpenData
* @param parent
* @param modal
*/
public FrmOpenData(javax.swing.JDialog parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu_OpenData = new javax.swing.JMenu();
jMenuItem_NetCDF = new javax.swing.JMenuItem();
jMenuItem_GrADS = new javax.swing.JMenuItem();
jMenuItem_ARL = new javax.swing.JMenuItem();
jMenu_HYSPLIT = new javax.swing.JMenu();
jMenuItem_Traj = new javax.swing.JMenuItem();
jMenuItem_Conc = new javax.swing.JMenuItem();
jMenuItem_Particle = new javax.swing.JMenuItem();
jMenu_ASCII = new javax.swing.JMenu();
jMenuItem_LonLat = new javax.swing.JMenuItem();
jMenuItem_Synop = new javax.swing.JMenuItem();
jMenuItem_Metar = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
jMenuItem_ESRI = new javax.swing.JMenuItem();
jMenuItem_Surfer = new javax.swing.JMenuItem();
jMenuItem_Micaps = new javax.swing.JMenuItem();
jMenu_MM5 = new javax.swing.JMenu();
jMenuItem_MM5_Output = new javax.swing.JMenuItem();
jMenuItem_MM5_Inter = new javax.swing.JMenuItem();
jMenuItem_AWX = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Open Data");
jMenu_OpenData.setText("Open Data");
jMenuItem_NetCDF.setText("NetCDF, GRIB, HDF...");
jMenu_OpenData.add(jMenuItem_NetCDF);
jMenuItem_GrADS.setText("GrADS Data");
jMenu_OpenData.add(jMenuItem_GrADS);
jMenuItem_ARL.setText("ARL Data");
jMenu_OpenData.add(jMenuItem_ARL);
jMenu_HYSPLIT.setText("HYSPLIT Data");
jMenuItem_Traj.setText("Trajectory Data");
jMenu_HYSPLIT.add(jMenuItem_Traj);
jMenuItem_Conc.setText("Concentration Data");
jMenu_HYSPLIT.add(jMenuItem_Conc);
jMenuItem_Particle.setText("Particle Data");
jMenu_HYSPLIT.add(jMenuItem_Particle);
jMenu_OpenData.add(jMenu_HYSPLIT);
jMenu_ASCII.setText("ASCII Data");
jMenuItem_LonLat.setText("Lon/Lat Station Data");
jMenu_ASCII.add(jMenuItem_LonLat);
jMenuItem_Synop.setText("SYNOP Data");
jMenu_ASCII.add(jMenuItem_Synop);
jMenuItem_Metar.setText("METAR Data");
jMenu_ASCII.add(jMenuItem_Metar);
jMenu_ASCII.add(jSeparator1);
jMenuItem_ESRI.setText("ESRI ASCII Grid Data");
jMenu_ASCII.add(jMenuItem_ESRI);
jMenuItem_Surfer.setText("Surfer ASCII Grid Data");
jMenu_ASCII.add(jMenuItem_Surfer);
jMenu_OpenData.add(jMenu_ASCII);
jMenuItem_Micaps.setText("MICAPS Data");
jMenu_OpenData.add(jMenuItem_Micaps);
jMenu_MM5.setText("MM5 Data");
jMenuItem_MM5_Output.setText("MM5 Output Data");
jMenu_MM5.add(jMenuItem_MM5_Output);
jMenuItem_MM5_Inter.setText("MM5 Intermediate Data");
jMenuItem_MM5_Inter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem_MM5_InterActionPerformed(evt);
}
});
jMenu_MM5.add(jMenuItem_MM5_Inter);
jMenu_OpenData.add(jMenu_MM5);
jMenuItem_AWX.setText("AWX Data");
jMenu_OpenData.add(jMenuItem_AWX);
jMenuBar1.add(jMenu_OpenData);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 173, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 44, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jMenuItem_MM5_InterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_MM5_InterActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenuItem_MM5_InterActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmOpenData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmOpenData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmOpenData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmOpenData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmOpenData dialog = new FrmOpenData(new javax.swing.JDialog(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem_ARL;
private javax.swing.JMenuItem jMenuItem_AWX;
private javax.swing.JMenuItem jMenuItem_Conc;
private javax.swing.JMenuItem jMenuItem_ESRI;
private javax.swing.JMenuItem jMenuItem_GrADS;
private javax.swing.JMenuItem jMenuItem_LonLat;
private javax.swing.JMenuItem jMenuItem_MM5_Inter;
private javax.swing.JMenuItem jMenuItem_MM5_Output;
private javax.swing.JMenuItem jMenuItem_Metar;
private javax.swing.JMenuItem jMenuItem_Micaps;
private javax.swing.JMenuItem jMenuItem_NetCDF;
private javax.swing.JMenuItem jMenuItem_Particle;
private javax.swing.JMenuItem jMenuItem_Surfer;
private javax.swing.JMenuItem jMenuItem_Synop;
private javax.swing.JMenuItem jMenuItem_Traj;
private javax.swing.JMenu jMenu_ASCII;
private javax.swing.JMenu jMenu_HYSPLIT;
private javax.swing.JMenu jMenu_MM5;
private javax.swing.JMenu jMenu_OpenData;
private javax.swing.JPopupMenu.Separator jSeparator1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,301 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Options"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane_Option" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="71" max="-2" attributes="0"/>
<Component id="jButton_OK" min="-2" pref="81" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="51" max="-2" attributes="0"/>
<Component id="jButton_Cancel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="85" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jTabbedPane_Option" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_OK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane_Option">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel_General">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="General">
<Property name="tabTitle" type="java.lang.String" value="General"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel_LookAndFeel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jComboBox_LookAndFeel" min="-2" pref="196" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jComboBox_LookAndFeel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_LookAndFeel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="32" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Script Language"/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="Script Language" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jRadioButton_Groovy" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="120" max="32767" attributes="0"/>
<Component id="jRadioButton_Jython" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jRadioButton_Groovy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton_Jython" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="jRadioButton_Groovy">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="Groovy"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton_GroovyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton_Jython">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="Jython"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton_JythonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel_LookAndFeel">
<Properties>
<Property name="text" type="java.lang.String" value="LookAndFeel:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_LookAndFeel">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel_Font">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Font">
<Property name="tabTitle" type="java.lang.String" value="Font"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_LegendFont" alignment="0" min="-2" pref="156" max="-2" attributes="0"/>
<Component id="jLabel_TextFont" alignment="0" min="-2" pref="156" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton_LegendFont" min="-2" pref="45" max="-2" attributes="0"/>
<Component id="jButton_TextFont" min="-2" pref="45" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="66" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_LegendFont" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_LegendFont" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_TextFont" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_TextFont" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="67" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Legend Font:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_LegendFont">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_LegendFont">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_LegendFontActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Text Font:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_TextFont">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_TextFont">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TextFontActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_OK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Cancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CancelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,402 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import com.l2fprod.common.swing.JFontChooser;
import java.awt.Font;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.meteoinfo.desktop.config.Options;
/**
*
* @author yaqiang
*/
public class FrmOptions extends javax.swing.JDialog {
private final FrmMain _parent;
private Font _legendFont;
private Font _textFont;
/**
* Creates new form FrmOptions
* @param parent
* @param modal
*/
public FrmOptions(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
Options options = _parent.getOptions();
_legendFont = options.getLegendFont();
_textFont = options.getTextFont();
this.jLabel_LegendFont.setText(_legendFont.getFontName() + " " + _legendFont.getSize());
this.jLabel_TextFont.setText(_textFont.getFontName() + " " + _textFont.getSize());
if (options.getScriptLanguage().equals("Groovy")){
this.jRadioButton_Groovy.setSelected(true);
} else {
this.jRadioButton_Jython.setSelected(true);
}
//Look and feel
this.jComboBox_LookAndFeel.removeAllItems();
UIManager.LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lnf : lnfs) {
this.jComboBox_LookAndFeel.addItem(lnf.getName());
}
this.jComboBox_LookAndFeel.setSelectedItem(UIManager.getLookAndFeel().getName());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jTabbedPane_Option = new javax.swing.JTabbedPane();
jPanel_General = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jRadioButton_Groovy = new javax.swing.JRadioButton();
jRadioButton_Jython = new javax.swing.JRadioButton();
jLabel_LookAndFeel = new javax.swing.JLabel();
jComboBox_LookAndFeel = new javax.swing.JComboBox();
jPanel_Font = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel_LegendFont = new javax.swing.JLabel();
jButton_LegendFont = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel_TextFont = new javax.swing.JLabel();
jButton_TextFont = new javax.swing.JButton();
jButton_OK = new javax.swing.JButton();
jButton_Cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Options");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Script Language"));
jPanel1.setName("Script Language"); // NOI18N
buttonGroup1.add(jRadioButton_Groovy);
jRadioButton_Groovy.setText("Groovy");
jRadioButton_Groovy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton_GroovyActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton_Jython);
jRadioButton_Jython.setText("Jython");
jRadioButton_Jython.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton_JythonActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jRadioButton_Groovy)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE)
.addComponent(jRadioButton_Jython)
.addGap(50, 50, 50))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton_Groovy)
.addComponent(jRadioButton_Jython))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jLabel_LookAndFeel.setText("LookAndFeel:");
jComboBox_LookAndFeel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout jPanel_GeneralLayout = new javax.swing.GroupLayout(jPanel_General);
jPanel_General.setLayout(jPanel_GeneralLayout);
jPanel_GeneralLayout.setHorizontalGroup(
jPanel_GeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_GeneralLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel_GeneralLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel_LookAndFeel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox_LookAndFeel, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33))
);
jPanel_GeneralLayout.setVerticalGroup(
jPanel_GeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_GeneralLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel_GeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox_LookAndFeel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_LookAndFeel))
.addContainerGap(32, Short.MAX_VALUE))
);
jTabbedPane_Option.addTab("General", jPanel_General);
jLabel1.setText("Legend Font:");
jLabel_LegendFont.setText("jLabel2");
jLabel_LegendFont.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jButton_LegendFont.setText("...");
jButton_LegendFont.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_LegendFontActionPerformed(evt);
}
});
jLabel2.setText("Text Font:");
jLabel_TextFont.setText("jLabel2");
jLabel_TextFont.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jButton_TextFont.setText("...");
jButton_TextFont.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_TextFontActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel_FontLayout = new javax.swing.GroupLayout(jPanel_Font);
jPanel_Font.setLayout(jPanel_FontLayout);
jPanel_FontLayout.setHorizontalGroup(
jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_FontLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_LegendFont, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel_TextFont, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton_LegendFont, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_TextFont, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(66, 66, 66))
);
jPanel_FontLayout.setVerticalGroup(
jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_FontLayout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel_LegendFont)
.addComponent(jButton_LegendFont))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel_FontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel_TextFont)
.addComponent(jButton_TextFont))
.addContainerGap(67, Short.MAX_VALUE))
);
jTabbedPane_Option.addTab("Font", jPanel_Font);
jButton_OK.setText("OK");
jButton_OK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OKActionPerformed(evt);
}
});
jButton_Cancel.setText("Cancel");
jButton_Cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane_Option, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(71, 71, 71)
.addComponent(jButton_OK, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton_Cancel)
.addContainerGap(85, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane_Option)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_OK)
.addComponent(jButton_Cancel))
.addGap(9, 9, 9))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_LegendFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_LegendFontActionPerformed
// TODO add your handling code here:
Font lFont = JFontChooser.showDialog(this, null, _legendFont);
_legendFont = lFont;
this.jLabel_LegendFont.setText(_legendFont.getFontName() + " " + _legendFont.getSize());
}//GEN-LAST:event_jButton_LegendFontActionPerformed
private void jButton_TextFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_TextFontActionPerformed
// TODO add your handling code here:
Font tFont = JFontChooser.showDialog(this, null, _textFont);
_textFont = tFont;
this.jLabel_TextFont.setText(_textFont.getFontName() + " " + _textFont.getSize());
}//GEN-LAST:event_jButton_TextFontActionPerformed
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
//Font
if (_legendFont != null)
_parent.setLegendFont(_legendFont);
if (_textFont != null)
_parent.getOptions().setTextFont(_textFont);
//Script language
if (this.jRadioButton_Groovy.isSelected()){
_parent.getOptions().setScriptLanguage("Groovy");
} else {
_parent.getOptions().setScriptLanguage("Jython");
}
//Look and feel
String laf = this.jComboBox_LookAndFeel.getSelectedItem().toString();
String lafName = UIManager.getLookAndFeel().getClass().getName();
if (laf.equals("CDE/Motif")){
lafName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
} else if (laf.equals("Metal")){
lafName = "javax.swing.plaf.metal.MetalLookAndFeel";
} else if (laf.equals("Windows")){
lafName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
} else if (laf.equals("Windows Classic")){
lafName = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
} else if (laf.equals("Nimbus")){
lafName = "javax.swing.plaf.nimbus.NimbusLookAndFeel";
} else if (laf.equals("Mac")){
lafName = "com.sun.java.swing.plaf.mac.MacLookAndFeel";
} else if (laf.equals("GTK")){
lafName = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
}
try {
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel(lafName);
SwingUtilities.updateComponentTreeUI(this);
SwingUtilities.updateComponentTreeUI(this._parent);
SwingUtilities.updateComponentTreeUI(this._parent.getMeteoDataset());
} catch (ClassNotFoundException ex) {
Logger.getLogger(FrmOptions.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(FrmOptions.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(FrmOptions.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(FrmOptions.class.getName()).log(Level.SEVERE, null, ex);
}
this.dispose();
}//GEN-LAST:event_jButton_OKActionPerformed
private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CancelActionPerformed
private void jRadioButton_GroovyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_GroovyActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jRadioButton_GroovyActionPerformed
private void jRadioButton_JythonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_JythonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jRadioButton_JythonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmOptions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmOptions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmOptions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmOptions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmOptions dialog = new FrmOptions(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton_Cancel;
private javax.swing.JButton jButton_LegendFont;
private javax.swing.JButton jButton_OK;
private javax.swing.JButton jButton_TextFont;
private javax.swing.JComboBox jComboBox_LookAndFeel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel_LegendFont;
private javax.swing.JLabel jLabel_LookAndFeel;
private javax.swing.JLabel jLabel_TextFont;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel_Font;
private javax.swing.JPanel jPanel_General;
private javax.swing.JRadioButton jRadioButton_Groovy;
private javax.swing.JRadioButton jRadioButton_Jython;
private javax.swing.JTabbedPane jTabbedPane_Option;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Output Map Data"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_MapLayer" min="-2" pref="245" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_OutputFormat" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
<Component id="jButton_Output" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton_Close" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
</Group>
<Component id="jProgressBar1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_MapLayer" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_OutputFormat" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_Output" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Close" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="31" max="32767" attributes="0"/>
<Component id="jProgressBar1" min="-2" pref="22" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Map Layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Output Format:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_MapLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_MapLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_OutputFormat">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Output">
<Properties>
<Property name="text" type="java.lang.String" value="Output"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OutputActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Close">
<Properties>
<Property name="text" type="java.lang.String" value="Close"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JProgressBar" name="jProgressBar1">
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,746 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.desktop.config.GenericFileFilter;
import org.meteoinfo.data.meteodata.GridDataSetting;
import org.meteoinfo.data.meteodata.Variable;
import org.meteoinfo.data.meteodata.grads.GrADSDataInfo;
import org.meteoinfo.geoprocess.GeoComputation;
import org.meteoinfo.global.Extent;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.global.PointD;
import org.meteoinfo.shape.PointShape;
import org.meteoinfo.shape.PolygonShape;
import org.meteoinfo.shape.PolylineShape;
import org.meteoinfo.shape.Shape;
/**
*
* @author yaqiang
*/
public class FrmOutputMapData extends javax.swing.JDialog {
private List<VectorLayer> _mapLayers = new ArrayList<VectorLayer>();
private VectorLayer _currentLayer;
private FrmMain _parent;
/**
* Creates new form FrmOutputMapData
* @param parent
* @param modal
*/
public FrmOutputMapData(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain) parent;
initialize();
}
private void initialize() {
this.jProgressBar1.setVisible(false);
//Get map layer list
int i;
for (i = 0; i < _parent.getMapDocument().getActiveMapFrame().getMapView().getLayerNum(); i++) {
if (_parent.getMapDocument().getActiveMapFrame().getMapView().getLayers().get(i).getLayerType() == LayerTypes.VectorLayer) {
VectorLayer aLayer = (VectorLayer) _parent.getMapDocument().getActiveMapFrame().getMapView().getLayers().get(i);
_mapLayers.add(aLayer);
}
}
this.jComboBox_MapLayer.removeAllItems();
if (_mapLayers.size() > 0) {
for (i = 0; i < _mapLayers.size(); i++) {
this.jComboBox_MapLayer.addItem(_mapLayers.get(i).getLayerName());
}
this.jComboBox_MapLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jComboBox_MapLayer = new javax.swing.JComboBox();
jComboBox_OutputFormat = new javax.swing.JComboBox();
jButton_Output = new javax.swing.JButton();
jButton_Close = new javax.swing.JButton();
jProgressBar1 = new javax.swing.JProgressBar();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Output Map Data");
jLabel1.setText("Map Layer:");
jLabel2.setText("Output Format:");
jComboBox_MapLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_MapLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_MapLayerActionPerformed(evt);
}
});
jComboBox_OutputFormat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jButton_Output.setText("Output");
jButton_Output.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OutputActionPerformed(evt);
}
});
jButton_Close.setText("Close");
jButton_Close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_MapLayer, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_OutputFormat, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(jButton_Output)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_Close)
.addGap(49, 49, 49))
.addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox_MapLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jComboBox_OutputFormat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_Output)
.addComponent(jButton_Close))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
.addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jComboBox_MapLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_MapLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_MapLayer.getItemCount() > 0) {
_currentLayer = _mapLayers.get(this.jComboBox_MapLayer.getSelectedIndex());
int i;
String str = this.jComboBox_OutputFormat.getSelectedItem().toString();
this.jComboBox_OutputFormat.removeAllItems();
this.jComboBox_OutputFormat.addItem("ASCII wmp File");
this.jComboBox_OutputFormat.addItem("Shape File");
this.jComboBox_OutputFormat.addItem("KML File");
switch (_currentLayer.getShapeType()) {
case Polygon:
//this.jComboBox_OutputFormat.addItem("GrADS Map File");
this.jComboBox_OutputFormat.addItem("GrADS Maskout File");
//this.jComboBox_OutputFormat.addItem("Surfer BLN File");
break;
// case Polyline:
// this.jComboBox_OutputFormat.addItem("GrADS Map File");
// this.jComboBox_OutputFormat.addItem("Surfer BLN File");
// break;
}
List<String> items = new ArrayList<String>();
for (i = 0; i < this.jComboBox_OutputFormat.getItemCount(); i++) {
items.add(this.jComboBox_OutputFormat.getItemAt(i).toString());
}
int idx = items.indexOf(str);
if (idx >= 0) {
this.jComboBox_OutputFormat.setSelectedIndex(idx);
} else {
this.jComboBox_OutputFormat.setSelectedIndex(0);
}
}
}//GEN-LAST:event_jComboBox_MapLayerActionPerformed
private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CloseActionPerformed
private void jButton_OutputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OutputActionPerformed
// TODO add your handling code here:
String format = this.jComboBox_OutputFormat.getSelectedItem().toString();
if (format.equals("ASCII wmp File")) {
try {
saveWMPFile();
} catch (IOException ex) {
Logger.getLogger(FrmOutputMapData.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (format.equals("GrADS Map File")) {
saveGrADSMapFile();
} else if (format.equals("GrADS Maskout File")) {
try {
saveGrADSMaskoutFile();
} catch (IOException ex) {
Logger.getLogger(FrmOutputMapData.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (format.equals("Shape File")) {
saveShapeFile();
} else if (format.equals("Surfer BLN File")) {
saveBLNMapFile();
} else if (format.equals("KML File")) {
saveKMLFile();
}
}//GEN-LAST:event_jButton_OutputActionPerformed
private void saveWMPFile() throws IOException {
JFileChooser aDlg = new JFileChooser();
String[] fileExts = new String[]{"wmp"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "wmp File (*.wmp)");
aDlg.setFileFilter(mapFileFilter);
File dir = new File(System.getProperty("user.dir"));
if (dir.isDirectory()) {
aDlg.setCurrentDirectory(dir);
}
aDlg.setAcceptAllFileFilterUsed(false);
if (aDlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
//ProgressBar
this.jProgressBar1.setVisible(true);
this.jProgressBar1.setValue(0);
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File file = aDlg.getSelectedFile();
System.setProperty("user.dir", file.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = file.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
file = new File(fileName);
}
BufferedWriter sw = new BufferedWriter(new FileWriter(file));
List<Integer> selIndexes = _currentLayer.getSelectedShapeIndexes();
boolean hasSelShape = _currentLayer.hasSelectedShapes();
int shpNum = _currentLayer.getShapeNum();
if (hasSelShape) {
shpNum = selIndexes.size();
}
int i;
switch (_currentLayer.getShapeType()) {
case Point:
sw.write("Point");
sw.newLine();
sw.write(String.valueOf(shpNum));
sw.newLine();
PointShape aPS;
if (hasSelShape) {
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPS = (PointShape) _currentLayer.getShapes().get(i);
if (aPS.isSelected()) {
sw.write(String.valueOf(aPS.getPoint().X) + "," + String.valueOf(aPS.getPoint().Y));
sw.newLine();
}
this.jProgressBar1.setValue((i + 1) * 100 / _currentLayer.getShapeNum());
}
} else {
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPS = (PointShape) _currentLayer.getShapes().get(i);
sw.write(String.valueOf(aPS.getPoint().X) + "," + String.valueOf(aPS.getPoint().Y));
sw.newLine();
this.jProgressBar1.setValue((i + 1) * 100 / _currentLayer.getShapeNum());
}
}
break;
case Polyline:
case PolylineZ:
sw.write("Polyline");
sw.newLine();
int shapeNum = 0;
PolylineShape aPLS;
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPLS = (PolylineShape) _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPLS.isSelected()) {
continue;
}
}
shapeNum += aPLS.getPartNum();
}
sw.write(String.valueOf(shpNum));
sw.newLine();
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPLS = (PolylineShape) _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPLS.isSelected()) {
continue;
}
}
PointD[] Pointps;
for (int p = 0; p < aPLS.getPartNum(); p++) {
if (p == aPLS.getPartNum() - 1) {
Pointps = new PointD[aPLS.getPointNum() - aPLS.parts[p]];
for (int pp = aPLS.parts[p]; pp < aPLS.getPointNum(); pp++) {
Pointps[pp - aPLS.parts[p]] = (PointD) aPLS.getPoints().get(pp);
}
} else {
Pointps = new PointD[aPLS.parts[p + 1] - aPLS.parts[p]];
for (int pp = aPLS.parts[p]; pp < aPLS.parts[p + 1]; pp++) {
Pointps[pp - aPLS.parts[p]] = (PointD) aPLS.getPoints().get(pp);
}
}
sw.write(String.valueOf(Pointps.length));
sw.newLine();
for (PointD aPoint : Pointps) {
sw.write(String.valueOf(aPoint.X) + "," + String.valueOf(aPoint.Y));
sw.newLine();
}
shapeNum += 1;
}
this.jProgressBar1.setValue((i + 1) * 100 / _currentLayer.getShapeNum());
}
break;
case Polygon:
sw.write("Polygon");
sw.newLine();
shapeNum = 0;
PolygonShape aPGS;
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPGS = (PolygonShape) _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPGS.isSelected()) {
continue;
}
}
shapeNum += aPGS.getPartNum();
}
sw.write(String.valueOf(shapeNum));
sw.newLine();
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPGS = (PolygonShape) _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPGS.isSelected()) {
continue;
}
}
PointD[] Pointps;
for (int p = 0; p < aPGS.getPartNum(); p++) {
if (p == aPGS.getPartNum() - 1) {
Pointps = new PointD[aPGS.getPointNum() - aPGS.parts[p]];
for (int pp = aPGS.parts[p]; pp < aPGS.getPointNum(); pp++) {
Pointps[pp - aPGS.parts[p]] = (PointD) aPGS.getPoints().get(pp);
}
} else {
Pointps = new PointD[aPGS.parts[p + 1] - aPGS.parts[p]];
for (int pp = aPGS.parts[p]; pp < aPGS.parts[p + 1]; pp++) {
Pointps[pp - aPGS.parts[p]] = (PointD) aPGS.getPoints().get(pp);
}
}
sw.write(String.valueOf(Pointps.length));
sw.newLine();
for (PointD aPoint : Pointps) {
sw.write(String.valueOf(aPoint.X) + "," + String.valueOf(aPoint.Y));
sw.newLine();
}
shapeNum += 1;
}
this.jProgressBar1.setValue((i + 1) * 100 / _currentLayer.getShapeNum());
}
break;
}
sw.close();
//Progressbar
this.jProgressBar1.setValue(0);
this.jProgressBar1.setVisible(false);
this.setCursor(Cursor.getDefaultCursor());
}
}
private void saveGrADSMapFile() {
}
private void saveGrADSMaskoutFile() throws IOException {
JFileChooser aDlg = new JFileChooser();
String[] fileExts = new String[]{"ctl"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "GrADS File (*.ctl)");
aDlg.setFileFilter(mapFileFilter);
File dir = new File(System.getProperty("user.dir"));
if (dir.isDirectory()) {
aDlg.setCurrentDirectory(dir);
}
aDlg.setAcceptAllFileFilterUsed(false);
if (aDlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File file = aDlg.getSelectedFile();
System.setProperty("user.dir", file.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = file.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
int i;
boolean hasSelShape = _currentLayer.hasSelectedShapes();
//Get grid set
PolygonShape aPGS;
Extent aExtent = new Extent();
int n = 0;
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
aPGS = (PolygonShape) _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPGS.isSelected()) {
continue;
}
}
if (n == 0) {
aExtent = aPGS.getExtent();
} else {
aExtent = MIMath.getLagerExtent(aExtent, aPGS.getExtent());
}
n += 1;
}
GridDataSetting aGDP = new GridDataSetting();
aGDP.dataExtent.minX = Math.floor(aExtent.minX);
aGDP.dataExtent.maxX = Math.ceil(aExtent.maxX);
aGDP.dataExtent.minY = Math.floor(aExtent.minY);
aGDP.dataExtent.maxY = Math.ceil(aExtent.maxY);
aGDP.xNum = 20;
aGDP.yNum = 20;
FrmGridSet aFrmGS = new FrmGridSet((JFrame) SwingUtilities.getWindowAncestor(this), true);
aFrmGS.setParameters(aGDP);
aFrmGS.setLocationRelativeTo(this);
aFrmGS.setVisible(true);
if (aFrmGS.isOK()) {
aGDP = aFrmGS.getParameters();
//Show progressbar
this.jProgressBar1.setVisible(true);
this.jProgressBar1.setValue(0);
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//Get grid data
double[][] gridData = new double[aGDP.yNum][aGDP.xNum];
int j, p;
PointD aPoint = new PointD();
double xSize, ySize;
xSize = (aGDP.dataExtent.maxX - aGDP.dataExtent.minX) / (aGDP.xNum - 1);
ySize = (aGDP.dataExtent.maxY - aGDP.dataExtent.minY) / (aGDP.yNum - 1);
boolean isIn;
for (i = 0; i < aGDP.yNum; i++) {
aPoint.Y = aGDP.dataExtent.minY + i * ySize;
for (j = 0; j < aGDP.xNum; j++) {
aPoint.X = aGDP.dataExtent.minX + j * xSize;
isIn = false;
for (p = 0; p < _currentLayer.getShapeNum(); p++) {
aPGS = (PolygonShape) _currentLayer.getShapes().get(p);
if (hasSelShape) {
if (!aPGS.isSelected()) {
continue;
}
}
if (GeoComputation.pointInPolygon(aPGS, aPoint)) {
isIn = true;
break;
}
}
if (isIn) {
gridData[i][j] = 1;
} else {
gridData[i][j] = -1;
}
}
this.jProgressBar1.setValue((i + 1) * 100 / aGDP.yNum);
}
//Get GrADS data info
String dFile = fileName.replace(".ctl", ".dat");
GrADSDataInfo aDataInfo = new GrADSDataInfo();
aDataInfo.setFileName(fileName);
aDataInfo.TITLE = "Mask data";
aDataInfo.DSET = dFile;
aDataInfo.DTYPE = "GRIDDED";
aDataInfo.XDEF.Type = "LINEAR";
aDataInfo.XDEF.XNum = aGDP.xNum;
aDataInfo.XDEF.XMin = (float) aGDP.dataExtent.minX;
aDataInfo.XDEF.XDelt = (float) (xSize);
aDataInfo.YDEF.Type = "LINEAR";
aDataInfo.YDEF.YNum = aGDP.yNum;
aDataInfo.YDEF.YMin = (float) aGDP.dataExtent.minY;
aDataInfo.YDEF.YDelt = (float) (ySize);
aDataInfo.ZDEF.Type = "LINEAR";
aDataInfo.ZDEF.ZNum = 1;
aDataInfo.ZDEF.SLevel = 1;
aDataInfo.ZDEF.ZDelt = 1;
aDataInfo.TDEF.Type = "LINEAR";
//aDataInfo.TDEF.TNum = 1;
aDataInfo.TDEF.STime = new Date();
aDataInfo.TDEF.TDelt = "1mo";
Variable aVar = new Variable();
aVar.setName("mask");
//aVar.LevelNum = 0;
aVar.setUnits("99");
aVar.setDescription("background mask data");
aDataInfo.VARDEF.addVar(aVar);
//Save files
aDataInfo.writeGrADSCTLFile();
aDataInfo.createDataFile(dFile);
aDataInfo.writeGridData(gridData);
aDataInfo.closeDataFile();
this.jProgressBar1.setValue(0);
this.jProgressBar1.setVisible(false);
this.setCursor(Cursor.getDefaultCursor());
}
}
}
private void saveShapeFile() {
JFileChooser aDlg = new JFileChooser();
String[] fileExts = new String[]{"shp"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "Shape File (*.shp)");
aDlg.setFileFilter(mapFileFilter);
File dir = new File(System.getProperty("user.dir"));
if (dir.isDirectory()) {
aDlg.setCurrentDirectory(dir);
}
aDlg.setAcceptAllFileFilterUsed(false);
if (aDlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
File file = aDlg.getSelectedFile();
System.setProperty("user.dir", file.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = file.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
this.saveShapeFile(fileName);
}
}
private void saveShapeFile_bak(final String fileName) {
SwingWorker worker = new SwingWorker<String, String>() {
@Override
protected String doInBackground() throws Exception {
FrmOutputMapData.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
FrmOutputMapData.this.jProgressBar1.setVisible(true);
FrmOutputMapData.this.jProgressBar1.setValue(0);
//Create a VectorLayer with selected shapes
int i, j;
VectorLayer aLayer = new VectorLayer(_currentLayer.getShapeType());
for (i = 0; i < _currentLayer.getFieldNumber(); i++) {
aLayer.editAddField(_currentLayer.getField(i).getColumnName(), _currentLayer.getField(i).getDataType());
}
boolean hasSelShape = _currentLayer.hasSelectedShapes();
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
Shape aPS = _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPS.isSelected()) {
continue;
}
}
int sNum = aLayer.getShapeNum();
try {
if (aLayer.editInsertShape(aPS, sNum)) {
for (j = 0; j < aLayer.getFieldNumber(); j++) {
aLayer.editCellValue(j, sNum, _currentLayer.getCellValue(j, i));
}
}
} catch (Exception ex) {
Logger.getLogger(FrmOutputMapData.class.getName()).log(Level.SEVERE, null, ex);
}
FrmOutputMapData.this.jProgressBar1.setValue((int) ((double) i / _currentLayer.getShapeNum() * 100));
}
aLayer.setProjInfo(_currentLayer.getProjInfo());
aLayer.saveFile(fileName);
return "";
}
@Override
protected void done() {
FrmOutputMapData.this.setCursor(Cursor.getDefaultCursor());
FrmOutputMapData.this.jProgressBar1.setVisible(false);
}
};
worker.execute();
}
private void saveShapeFile(final String fileName) {
FrmOutputMapData.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
FrmOutputMapData.this.jProgressBar1.setVisible(true);
FrmOutputMapData.this.jProgressBar1.setValue(0);
//Create a VectorLayer with selected shapes
int i, j;
VectorLayer aLayer = new VectorLayer(_currentLayer.getShapeType());
for (i = 0; i < _currentLayer.getFieldNumber(); i++) {
aLayer.editAddField(_currentLayer.getField(i).getColumnName(), _currentLayer.getField(i).getDataType());
}
boolean hasSelShape = _currentLayer.hasSelectedShapes();
for (i = 0; i < _currentLayer.getShapeNum(); i++) {
Shape aPS = _currentLayer.getShapes().get(i);
if (hasSelShape) {
if (!aPS.isSelected()) {
continue;
}
}
int sNum = aLayer.getShapeNum();
try {
if (aLayer.editInsertShape(aPS, sNum)) {
for (j = 0; j < aLayer.getFieldNumber(); j++) {
aLayer.editCellValue(j, sNum, _currentLayer.getCellValue(j, i));
}
}
} catch (Exception ex) {
Logger.getLogger(FrmOutputMapData.class.getName()).log(Level.SEVERE, null, ex);
}
FrmOutputMapData.this.jProgressBar1.setValue((int) ((double) i / _currentLayer.getShapeNum() * 100));
}
aLayer.setProjInfo(_currentLayer.getProjInfo());
aLayer.saveFile(fileName);
FrmOutputMapData.this.setCursor(Cursor.getDefaultCursor());
FrmOutputMapData.this.jProgressBar1.setVisible(false);
}
private void saveBLNMapFile() {
}
private void saveKMLFile() {
JFileChooser aDlg = new JFileChooser();
String[] fileExts = new String[]{"kml"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "KML File (*.kml)");
aDlg.setFileFilter(mapFileFilter);
File dir = new File(System.getProperty("user.dir"));
if (dir.isDirectory()) {
aDlg.setCurrentDirectory(dir);
}
aDlg.setAcceptAllFileFilterUsed(false);
if (aDlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File file = aDlg.getSelectedFile();
System.setProperty("user.dir", file.getParent());
String extent = ((GenericFileFilter) aDlg.getFileFilter()).getFileExtent();
String fileName = file.getAbsolutePath();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
_currentLayer.saveAsKMLFile(fileName);
this.setCursor(Cursor.getDefaultCursor());
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmOutputMapData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmOutputMapData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmOutputMapData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmOutputMapData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmOutputMapData dialog = new FrmOutputMapData(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Close;
private javax.swing.JButton jButton_Output;
private javax.swing.JComboBox jComboBox_MapLayer;
private javax.swing.JComboBox jComboBox_OutputFormat;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JProgressBar jProgressBar1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Plugin Manager"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane2" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="156" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Plugins"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="391" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="126" max="-2" attributes="0"/>
<Component id="jButton_UpdateList" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="243" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton_UpdateList" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="org.meteoinfo.ui.JCheckBoxList" name="checkBoxList_Plugin">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="checkBoxList_PluginMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_UpdateList">
<Properties>
<Property name="text" type="java.lang.String" value="Update List"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UpdateListActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Plugin:"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea_PluginDetails">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,277 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import org.meteoinfo.desktop.config.Plugin;
import org.meteoinfo.desktop.config.PluginCollection;
import org.meteoinfo.global.util.GlobalUtil;
import org.meteoinfo.ui.CheckBoxListEntry;
/**
*
* @author yaqiang
*/
public class FrmPluginManager extends javax.swing.JDialog {
private final FrmMain _parent;
PluginCollection _plugins = new PluginCollection();
/**
* Creates new form FrmPluginManager
* @param parent
* @param modal
*/
public FrmPluginManager(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain) parent;
initialize();
}
private void initialize() {
this._plugins = _parent.getPlugins();
this.updatePluginCheckList();
}
private void updatePluginCheckList() {
DefaultListModel listModel = new DefaultListModel();
for (Plugin plugin : _plugins) {
listModel.addElement(new CheckBoxListEntry(plugin, plugin.isLoad()));
}
this.checkBoxList_Plugin.setModel(listModel);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
checkBoxList_Plugin = new org.meteoinfo.ui.JCheckBoxList();
jButton_UpdateList = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea_PluginDetails = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Plugin Manager");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Plugins"));
checkBoxList_Plugin.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
checkBoxList_Plugin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
checkBoxList_PluginMouseClicked(evt);
}
});
jScrollPane1.setViewportView(checkBoxList_Plugin);
jButton_UpdateList.setText("Update List");
jButton_UpdateList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_UpdateListActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 391, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(126, 126, 126)
.addComponent(jButton_UpdateList)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton_UpdateList))
);
jLabel1.setText("Plugin:");
jTextArea_PluginDetails.setColumns(20);
jTextArea_PluginDetails.setRows(5);
jScrollPane2.setViewportView(jTextArea_PluginDetails);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addComponent(jScrollPane2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void checkBoxList_PluginMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_checkBoxList_PluginMouseClicked
// TODO add your handling code here:
DefaultListModel listModel = (DefaultListModel) this.checkBoxList_Plugin.getModel();
int idx = this.checkBoxList_Plugin.getSelectedIndex();
CheckBoxListEntry item = (CheckBoxListEntry) listModel.getElementAt(idx);
Plugin plugin = (Plugin) item.getValue();
if (item.isSelected()) {
if (!plugin.isLoad()) {
_parent.loadPlugin(plugin);
_parent.validate();
}
} else {
if (plugin.isLoad()) {
_parent.unloadPlugin(plugin);
_parent.validate();
}
}
String detailStr = "Name: " + plugin.getName()
+ System.getProperty("line.separator") + "Author: " + plugin.getAuthor()
+ System.getProperty("line.separator") + "Version: " + plugin.getVersion()
+ System.getProperty("line.separator") + "Description: " + plugin.getDescription()
+ System.getProperty("line.separator") + "Jar Path: " + plugin.getJarPath()
+ System.getProperty("line.separator") + "Class Name: " + plugin.getClassName();
this.jTextArea_PluginDetails.setText(detailStr);
}//GEN-LAST:event_checkBoxList_PluginMouseClicked
private void jButton_UpdateListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UpdateListActionPerformed
// TODO add your handling code here:
List<Plugin> plugins = new ArrayList<>();
String pluginPath = _parent.getStartupPath() + File.separator + "plugins";
if (new File(pluginPath).isDirectory()) {
List<String> fileNames = GlobalUtil.getFiles(pluginPath, ".jar");
for (String fn : fileNames) {
Plugin plugin = _parent.readPlugin(fn);
if (plugin != null) {
plugins.add(plugin);
}
}
List<String> pluginNames = new ArrayList<>();
for (Plugin plugin : _plugins) {
pluginNames.add(plugin.getName());
}
List<String> newPluginNames = new ArrayList<>();
for (Plugin plugin : plugins) {
newPluginNames.add(plugin.getName());
}
for (int i = 0; i < _plugins.size(); i++) {
if (!newPluginNames.contains(_plugins.get(i).getName())) {
_parent.removePlugin(_plugins.get(i));
_plugins.remove(i);
i -= 1;
}
}
for (Plugin plugin : plugins) {
if (!pluginNames.contains(plugin.getName())) {
_plugins.add(plugin);
try {
_parent.addPlugin(plugin);
} catch (IOException ex) {
Logger.getLogger(FrmPluginManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
this.updatePluginCheckList();
}
}//GEN-LAST:event_jButton_UpdateListActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmPluginManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmPluginManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmPluginManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmPluginManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmPluginManager dialog = new FrmPluginManager(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.meteoinfo.ui.JCheckBoxList checkBoxList_Plugin;
private javax.swing.JButton jButton_UpdateList;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea_PluginDetails;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,278 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_formBundle" type="java.lang.String" value="meteoinfo/bundle/Bundle_FrmProjection"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel_Parameters" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Projection" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="112" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
<Component id="jButton_Close" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Projection" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel_Parameters" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jButton_Close" pref="31" max="32767" attributes="0"/>
<Component id="jButton_Apply" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel1.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Projection">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_ProjectionActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel_Parameters">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Parameters">
<ResourceString PropertyName="titleX" bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jPanel_Parameters.border.title" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_StdPara1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_RefLat" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_CentralMeridian" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField_CentralMeridian" pref="243" max="32767" attributes="0"/>
<Component id="jTextField_RefLat" max="32767" attributes="0"/>
<Component id="jTextField_StandPara1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_StdPara2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_FalseEasting" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_FalseNorthing" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel_ScaleFactor" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField_StandPara2" max="32767" attributes="0"/>
<Component id="jTextField_FalseEasting" max="32767" attributes="0"/>
<Component id="jTextField_FalseNorthing" alignment="0" max="32767" attributes="0"/>
<Component id="jTextField_ScaleFactor" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_CentralMeridian" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_CentralMeridian" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_RefLat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_RefLat" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_StdPara1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_StandPara1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel_StdPara2" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_StandPara2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_FalseEasting" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_FalseEasting" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_FalseNorthing" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_FalseNorthing" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_ScaleFactor" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_ScaleFactor" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel_CentralMeridian">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_CentralMeridian.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_CentralMeridian">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_RefLat">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_RefLat.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_RefLat">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_StdPara1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_StdPara1.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_StandPara1">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_StdPara2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_StdPara2.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_StandPara2">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_FalseEasting">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_FalseEasting.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_FalseEasting">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_FalseNorthing">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_FalseNorthing.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_FalseNorthing">
</Component>
<Component class="javax.swing.JLabel" name="jLabel_ScaleFactor">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jLabel_ScaleFactor.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_ScaleFactor">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jButton_Apply.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Close">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmProjection.properties" key="FrmProjection.jButton_Close.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,644 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import org.meteoinfo.projection.KnownCoordinateSystems;
import org.meteoinfo.projection.info.ProjectionInfo;
import org.meteoinfo.projection.ProjectionNames;
import java.awt.Component;
import java.awt.Cursor;
import org.meteoinfo.projection.proj4j.proj.Projection;
import static org.meteoinfo.projection.ProjectionNames.Mercator;
/**
*
* @author Yaqiang Wang
*/
public class FrmProjection extends javax.swing.JDialog {
private final FrmMain _parent;
private boolean _isLoading = false;
private ProjectionInfo projInfo;
/**
* Creates new form FrmProjection
* @param parent
* @param modal
*/
public FrmProjection(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain) parent;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_Projection = new javax.swing.JComboBox();
jPanel_Parameters = new javax.swing.JPanel();
jLabel_CentralMeridian = new javax.swing.JLabel();
jTextField_CentralMeridian = new javax.swing.JTextField();
jLabel_RefLat = new javax.swing.JLabel();
jTextField_RefLat = new javax.swing.JTextField();
jLabel_StdPara1 = new javax.swing.JLabel();
jTextField_StandPara1 = new javax.swing.JTextField();
jLabel_StdPara2 = new javax.swing.JLabel();
jTextField_StandPara2 = new javax.swing.JTextField();
jLabel_FalseEasting = new javax.swing.JLabel();
jTextField_FalseEasting = new javax.swing.JTextField();
jLabel_FalseNorthing = new javax.swing.JLabel();
jTextField_FalseNorthing = new javax.swing.JTextField();
jLabel_ScaleFactor = new javax.swing.JLabel();
jTextField_ScaleFactor = new javax.swing.JTextField();
jButton_Apply = new javax.swing.JButton();
jButton_Close = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("bundle/Bundle_FrmProjection"); // NOI18N
jLabel1.setText(bundle.getString("FrmProjection.jLabel1.text")); // NOI18N
jComboBox_Projection.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_Projection.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_ProjectionActionPerformed(evt);
}
});
jPanel_Parameters.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("FrmProjection.jPanel_Parameters.border.title"))); // NOI18N
jLabel_CentralMeridian.setText(bundle.getString("FrmProjection.jLabel_CentralMeridian.text")); // NOI18N
jLabel_RefLat.setText(bundle.getString("FrmProjection.jLabel_RefLat.text")); // NOI18N
jLabel_StdPara1.setText(bundle.getString("FrmProjection.jLabel_StdPara1.text")); // NOI18N
jLabel_StdPara2.setText(bundle.getString("FrmProjection.jLabel_StdPara2.text")); // NOI18N
jLabel_FalseEasting.setText(bundle.getString("FrmProjection.jLabel_FalseEasting.text")); // NOI18N
jLabel_FalseNorthing.setText(bundle.getString("FrmProjection.jLabel_FalseNorthing.text")); // NOI18N
jLabel_ScaleFactor.setText(bundle.getString("FrmProjection.jLabel_ScaleFactor.text")); // NOI18N
javax.swing.GroupLayout jPanel_ParametersLayout = new javax.swing.GroupLayout(jPanel_Parameters);
jPanel_Parameters.setLayout(jPanel_ParametersLayout);
jPanel_ParametersLayout.setHorizontalGroup(
jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_ParametersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_ParametersLayout.createSequentialGroup()
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_StdPara1)
.addComponent(jLabel_RefLat)
.addComponent(jLabel_CentralMeridian))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField_CentralMeridian, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
.addComponent(jTextField_RefLat)
.addComponent(jTextField_StandPara1)))
.addGroup(jPanel_ParametersLayout.createSequentialGroup()
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_StdPara2)
.addComponent(jLabel_FalseEasting)
.addComponent(jLabel_FalseNorthing)
.addComponent(jLabel_ScaleFactor))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField_StandPara2)
.addComponent(jTextField_FalseEasting)
.addComponent(jTextField_FalseNorthing)
.addComponent(jTextField_ScaleFactor))))
.addContainerGap())
);
jPanel_ParametersLayout.setVerticalGroup(
jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel_ParametersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_CentralMeridian)
.addComponent(jTextField_CentralMeridian, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_RefLat)
.addComponent(jTextField_RefLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_StdPara1)
.addComponent(jTextField_StandPara1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_StdPara2)
.addComponent(jTextField_StandPara2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_FalseEasting)
.addComponent(jTextField_FalseEasting, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_FalseNorthing)
.addComponent(jTextField_FalseNorthing, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel_ParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_ScaleFactor)
.addComponent(jTextField_ScaleFactor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton_Apply.setText(bundle.getString("FrmProjection.jButton_Apply.text")); // NOI18N
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jButton_Close.setText(bundle.getString("FrmProjection.jButton_Close.text")); // NOI18N
jButton_Close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel_Parameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_Projection, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(9, 9, 9)))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(112, 112, 112)
.addComponent(jButton_Apply)
.addGap(59, 59, 59)
.addComponent(jButton_Close)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox_Projection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel_Parameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton_Close, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
.addComponent(jButton_Apply, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
_isLoading = true;
this.jComboBox_Projection.removeAllItems();
for (ProjectionNames pName : ProjectionNames.values()) {
switch (pName) {
case Lambert_Equal_Area_Conic:
case Lambert_Azimuthal_Equal_Area:
case Stereographic_Azimuthal:
case Wagner3:
case Undefine:
continue;
}
this.jComboBox_Projection.addItem(pName.toString());
}
_isLoading = false;
this.jComboBox_Projection.setSelectedItem(_parent.getMapDocument().getActiveMapFrame().getMapView().
getProjection().getProjInfo().getProjectionName().toString());
}//GEN-LAST:event_formWindowOpened
private void jComboBox_ProjectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_ProjectionActionPerformed
// TODO add your handling code here:
if (_isLoading) {
return;
}
ProjectionNames aPrjName = ProjectionNames.valueOf(this.jComboBox_Projection.getSelectedItem().toString());
ProjectionInfo aProjInfo = _parent.getMapDocument().getActiveMapFrame().getMapView().getProjection().getProjInfo();
Projection aProj = aProjInfo.getCoordinateReferenceSystem().getProjection();
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("bundle/Bundle_FrmProjection");
this.jLabel_RefLat.setText(bundle.getString("FrmProjection.jLabel_RefLat.text"));
switch (aPrjName) {
case LongLat:
this.jPanel_Parameters.setEnabled(false);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
break;
case Lambert_Conformal_Conic:
case Albers_Equal_Area:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(true);
//aControl.setEnabled(true);
}
this.jLabel_ScaleFactor.setVisible(false);
this.jTextField_ScaleFactor.setVisible(false);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_RefLat.setText(String.valueOf(aProj.getProjectionLatitudeDegrees()));
this.jTextField_StandPara1.setText(String.valueOf(aProj.getProjectionLatitude1Degrees()));
this.jTextField_StandPara2.setText(String.valueOf(aProj.getProjectionLatitude2Degrees()));
this.jTextField_FalseEasting.setText(String.valueOf(aProj.getFalseEasting()));
this.jTextField_FalseNorthing.setText(String.valueOf(aProj.getFalseNorthing()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_RefLat.setText("0");
this.jTextField_StandPara1.setText("25");
this.jTextField_StandPara2.setText("47");
this.jTextField_FalseEasting.setText("0");
this.jTextField_FalseNorthing.setText("0");
}
break;
case Lambert_Azimuthal_Equal_Area:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_RefLat.setVisible(true);
this.jTextField_RefLat.setVisible(true);
this.jLabel_FalseEasting.setVisible(true);
this.jTextField_FalseEasting.setVisible(true);
this.jLabel_FalseNorthing.setVisible(true);
this.jTextField_FalseNorthing.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_RefLat.setText(String.valueOf(aProj.getProjectionLatitudeDegrees()));
this.jTextField_FalseEasting.setText(String.valueOf(aProj.getFalseEasting()));
this.jTextField_FalseNorthing.setText(String.valueOf(aProj.getFalseNorthing()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_RefLat.setText("90");
this.jTextField_FalseEasting.setText("0");
this.jTextField_FalseNorthing.setText("0");
}
break;
case North_Polar_Stereographic_Azimuthal:
case South_Polar_Stereographic_Azimuthal:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_StdPara1.setVisible(true);
this.jTextField_StandPara1.setVisible(true);
this.jLabel_ScaleFactor.setVisible(true);
this.jTextField_ScaleFactor.setVisible(true);
this.jLabel_FalseEasting.setVisible(true);
this.jTextField_FalseEasting.setVisible(true);
this.jLabel_FalseNorthing.setVisible(true);
this.jTextField_FalseNorthing.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_StandPara1.setText(String.valueOf(aProj.getTrueScaleLatitudeDegrees()));
this.jTextField_ScaleFactor.setText(String.valueOf(aProj.getScaleFactor()));
this.jTextField_FalseEasting.setText(String.valueOf(aProj.getFalseEasting()));
this.jTextField_FalseNorthing.setText(String.valueOf(aProj.getFalseNorthing()));
} else {
this.jTextField_CentralMeridian.setText("105");
if (aPrjName == ProjectionNames.North_Polar_Stereographic_Azimuthal)
this.jTextField_StandPara1.setText("90");
else
this.jTextField_StandPara1.setText("-90");
this.jTextField_ScaleFactor.setText("1.0");
this.jTextField_FalseEasting.setText("0");
this.jTextField_FalseNorthing.setText("0");
}
break;
case Mercator:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_StdPara1.setVisible(true);
this.jTextField_StandPara1.setVisible(true);
this.jLabel_FalseEasting.setVisible(true);
this.jTextField_FalseEasting.setVisible(true);
this.jLabel_FalseNorthing.setVisible(true);
this.jTextField_FalseNorthing.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_StandPara1.setText(String.valueOf(aProj.getProjectionLatitude1Degrees()));
this.jTextField_FalseEasting.setText(String.valueOf(aProj.getFalseEasting()));
this.jTextField_FalseNorthing.setText(String.valueOf(aProj.getFalseNorthing()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_StandPara1.setText("0");
this.jTextField_FalseEasting.setText("0");
this.jTextField_FalseNorthing.setText("0");
}
break;
case Robinson:
case Molleweide:
case Hammer_Eckert:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
} else {
this.jTextField_CentralMeridian.setText("105");
}
break;
case Geostationary_Satellite:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_RefLat.setText(bundle.getString("FrmProjection.jLabel_RefLat_1.text"));
this.jLabel_RefLat.setVisible(true);
this.jTextField_RefLat.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_RefLat.setText(String.valueOf(aProj.getHeightOfOrbit()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_RefLat.setText("35785831");
}
break;
case Orthographic_Azimuthal:
case Oblique_Stereographic_Alternative:
case Transverse_Mercator:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_RefLat.setVisible(true);
this.jTextField_RefLat.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_RefLat.setText(String.valueOf(aProj.getProjectionLatitudeDegrees()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_RefLat.setText("45");
}
break;
case Sinusoidal:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
} else {
this.jTextField_CentralMeridian.setText("105");
}
break;
case Cylindrical_Equal_Area:
this.jPanel_Parameters.setEnabled(true);
for (Component aControl : this.jPanel_Parameters.getComponents()) {
aControl.setVisible(false);
}
this.jLabel_CentralMeridian.setVisible(true);
this.jTextField_CentralMeridian.setVisible(true);
this.jLabel_StdPara1.setVisible(true);
this.jTextField_StandPara1.setVisible(true);
this.jLabel_FalseEasting.setVisible(true);
this.jTextField_FalseEasting.setVisible(true);
this.jLabel_FalseNorthing.setVisible(true);
this.jTextField_FalseNorthing.setVisible(true);
if (aProjInfo.getProjectionName() == aPrjName) {
this.jTextField_CentralMeridian.setText(String.valueOf(aProj.getProjectionLongitudeDegrees()));
this.jTextField_StandPara1.setText(String.valueOf(aProj.getProjectionLatitude1Degrees()));
this.jTextField_FalseEasting.setText(String.valueOf(aProj.getFalseEasting()));
this.jTextField_FalseNorthing.setText(String.valueOf(aProj.getFalseNorthing()));
} else {
this.jTextField_CentralMeridian.setText("105");
this.jTextField_StandPara1.setText("0");
this.jTextField_FalseEasting.setText("0");
this.jTextField_FalseNorthing.setText("0");
}
break;
}
if (this.jTextField_FalseEasting.getText().isEmpty()) {
this.jTextField_FalseEasting.setText("0");
}
if (this.jTextField_FalseNorthing.getText().isEmpty()) {
this.jTextField_FalseNorthing.setText("0");
}
}//GEN-LAST:event_jComboBox_ProjectionActionPerformed
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
ProjectionNames aPrjName = ProjectionNames.valueOf(this.jComboBox_Projection.getSelectedItem().toString());
String toProjStr;
switch (aPrjName) {
case Lambert_Conformal_Conic:
toProjStr = "+proj=lcc"
+ " +lat_1=" + this.jTextField_StandPara1.getText()
+ " +lat_2=" + this.jTextField_StandPara2.getText()
+ " +lat_0=" + this.jTextField_RefLat.getText()
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +x_0=" + this.jTextField_FalseEasting.getText()
+ " +y_0=" + this.jTextField_FalseNorthing.getText();
break;
case Albers_Equal_Area:
toProjStr = "+proj=aea"
+ " +lat_1=" + this.jTextField_StandPara1.getText()
+ " +lat_2=" + this.jTextField_StandPara2.getText()
+ " +lat_0=" + this.jTextField_RefLat.getText()
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +x_0=" + this.jTextField_FalseEasting.getText()
+ " +y_0=" + this.jTextField_FalseNorthing.getText();
break;
case Lambert_Azimuthal_Equal_Area:
toProjStr = "+proj=laea"
+ " +lat_0=" + this.jTextField_RefLat.getText()
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +x_0=" + this.jTextField_FalseEasting.getText()
+ " +y_0=" + this.jTextField_FalseNorthing.getText();
break;
case North_Polar_Stereographic_Azimuthal:
toProjStr = "+proj=stere"
+ " +lat_ts=" + this.jTextField_StandPara1.getText()
+ " +lat_0=90"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case South_Polar_Stereographic_Azimuthal:
toProjStr = "+proj=stere"
+ " +lat_ts=" + this.jTextField_StandPara1.getText()
+ " +lat_0=-90"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case Mercator:
toProjStr = "+proj=merc"
+ " +lat_ts=" + this.jTextField_StandPara1.getText()
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +x_0=" + this.jTextField_FalseEasting.getText()
+ " +y_0=" + this.jTextField_FalseNorthing.getText();
break;
case Robinson:
toProjStr = "+proj=robin"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case Molleweide:
toProjStr = "+proj=moll"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case Hammer_Eckert:
toProjStr = "+proj=hammer"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case Orthographic_Azimuthal:
toProjStr = "+proj=ortho"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +lat_0=" + this.jTextField_RefLat.getText();
break;
case Geostationary_Satellite:
toProjStr = "+proj=geos"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +h=" + this.jTextField_RefLat.getText();
break;
case Oblique_Stereographic_Alternative:
toProjStr = "+proj=stere"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +lat_0=" + this.jTextField_RefLat.getText();
break;
case Transverse_Mercator:
toProjStr = "+proj=tmerc"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +lat_0=" + this.jTextField_RefLat.getText();
break;
case LongLat:
toProjStr = KnownCoordinateSystems.geographic.world.WGS1984.toProj4String();
break;
case Sinusoidal:
toProjStr = "+proj=sinu"
+ "+lon_0=" + this.jTextField_CentralMeridian.getText();
break;
case Cylindrical_Equal_Area:
toProjStr = "+proj=cea"
+ " +lat_ts=" + this.jTextField_StandPara1.getText()
+ " +lon_0=" + this.jTextField_CentralMeridian.getText()
+ " +x_0=" + this.jTextField_FalseEasting.getText()
+ " +y_0=" + this.jTextField_FalseNorthing.getText();
break;
default:
toProjStr = "+proj=robin"
+ " +lon_0=" + this.jTextField_CentralMeridian.getText();
break;
}
ProjectionInfo toProj = ProjectionInfo.factory(toProjStr);
_parent.getMapDocument().getActiveMapFrame().getMapView().projectLayers(toProj);
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CloseActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmProjection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmProjection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmProjection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmProjection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmProjection dialog = new FrmProjection(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JButton jButton_Close;
private javax.swing.JComboBox jComboBox_Projection;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel_CentralMeridian;
private javax.swing.JLabel jLabel_FalseEasting;
private javax.swing.JLabel jLabel_FalseNorthing;
private javax.swing.JLabel jLabel_RefLat;
private javax.swing.JLabel jLabel_ScaleFactor;
private javax.swing.JLabel jLabel_StdPara1;
private javax.swing.JLabel jLabel_StdPara2;
private javax.swing.JPanel jPanel_Parameters;
private javax.swing.JTextField jTextField_CentralMeridian;
private javax.swing.JTextField jTextField_FalseEasting;
private javax.swing.JTextField jTextField_FalseNorthing;
private javax.swing.JTextField jTextField_RefLat;
private javax.swing.JTextField jTextField_ScaleFactor;
private javax.swing.JTextField jTextField_StandPara1;
private javax.swing.JTextField jTextField_StandPara2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,947 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.title" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_formBundle" type="java.lang.String" value="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPane1" alignment="0" max="32767" attributes="0"/>
<Component id="jToolBar2" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jToolBar1" min="-2" pref="666" max="-2" attributes="0"/>
<EmptySpace min="0" pref="134" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jSplitPane1" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jToolBar2" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_DataInfo">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/information.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_DataInfo.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DataInfoActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
</Component>
<Component class="javax.swing.JButton" name="jButton_Draw">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/MeteoInfo_1_16x16x8.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_Draw.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DrawActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ViewData">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ViewData.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_ViewData.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ViewDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ClearDraw">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ClearDrawing.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_ClearDraw.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ClearDrawActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
</Component>
<Component class="javax.swing.JButton" name="jButton_PreTime">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_PreTime.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_PreTime.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PreTimeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_NexTime">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_NextTime.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_NexTime.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_NexTimeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Animator">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/animation-1.png"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AnimatorActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_CreateAnimatorFile">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Animation-2.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_CreateAnimatorFile.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CreateAnimatorFileActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator3">
</Component>
<Component class="javax.swing.JButton" name="jButton_DrawSetting">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_DrawSetting.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_DrawSetting.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DrawSettingActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator4">
</Component>
<Component class="javax.swing.JButton" name="jButton_SelectElement">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Arrow.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_SelectElement.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SelectElementActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ZoomIn">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ZoomIn.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_ZoomIn.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ZoomInActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ZoomOut">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ZoomOut.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_ZoomOut.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ZoomOutActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Pan">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_Pan.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_Pan.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PanActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_FullExtent">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_FullExent.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_FullExtent.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_FullExtentActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_ZoomToLayer">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_ZoomToLayer.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_ZoomToLayer.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ZoomToLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Identifer">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/information.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_Identifer.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_IdentiferActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator5">
</Component>
<Component class="javax.swing.JButton" name="jButton_LabelSet">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_LabelSet.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_LabelSet.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_LabelSetActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator6">
</Component>
<Component class="javax.swing.JButton" name="jButton_PageSet">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/page_portrait.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_PageSet.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PageSetActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_PageZoomIn">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_PageZoomIn.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_PageZoomIn.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PageZoomInActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_PageZoomOut">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_PageZoomOut.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_PageZoomOut.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_PageZoomOutActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_FitToScreen">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/ZoomFullMap.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_FitToScreen.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_FitToScreenActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_PageZoom">
<Properties>
<Property name="editable" type="boolean" value="true"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[20, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[40, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_PageZoomActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator7">
</Component>
<Component class="javax.swing.JButton" name="jButton_SavePicture">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Save_Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jButton_SavePicture.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SavePictureActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="dividerLocation" type="int" value="250"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel_Setting">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Setting">
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jPanel_Setting.TabConstraints.tabTitle" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox_YReverse" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jCheckBox_ColorVar" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_PlotDim" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel_Variable" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_DrawType" max="32767" attributes="0"/>
<Component id="jComboBox_Variable" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel_Variable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Variable" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_DrawType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_YReverse" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_ColorVar" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_PlotDim" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jLabel3.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_Variable">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jLabel_Variable.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_DrawType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_DrawTypeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_YReverse">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_YReverse.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_ColorVar">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_ColorVar.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jLabel4.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_PlotDim">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_PlotDimActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Dimensions">
<ResourceString PropertyName="titleX" bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jPanel1.border.title" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox_Lat" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Lat2" max="32767" attributes="0"/>
<Component id="jComboBox_Lat1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox_Lon" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Lon1" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Component id="jComboBox_Lon2" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_Level" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_Time" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Time1" max="32767" attributes="0"/>
<Component id="jComboBox_Time2" max="32767" attributes="0"/>
<Component id="jComboBox_Level1" max="32767" attributes="0"/>
<Component id="jComboBox_Level2" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Time" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Time1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Time2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Level" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Level1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Level2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Lat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Lat1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Lat2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox_Lon" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Lon1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_Lon2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="72" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Time">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_Time.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_TimeStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Time1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Level">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_Level.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LevelStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Time2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Level1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Level2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Lat">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_Lat.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LatStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lat1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lat2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_Lon">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jCheckBox_Lon.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox_LonStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lon1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Lon2">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_Stations">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JComboBox" name="jComboBox_Variable">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_VariableActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel_Layers">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Layers">
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmSectionPlot.properties" key="FrmSectionPlot.jPanel_Layers.TabConstraints.tabTitle" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="layersLegend1" alignment="1" pref="244" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="layersLegend1" alignment="0" pref="520" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="org.meteoinfo.legend.LayersLegend" name="layersLegend1">
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="org.meteoinfo.layout.MapLayout" name="mapLayout1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JToolBar" name="jToolBar2">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel_Coordinate">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jLabel_Coordinate.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 15]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel_Status">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/meteoinfo/desktop/bundle/Bundle_FrmMain.properties" key="FrmMain.jLabel_Status.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,392 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Select By Attribute"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="116" max="32767" attributes="0"/>
<Component id="jButton_Select" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="74" max="-2" attributes="0"/>
<Component id="jButton_Clear" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="108" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jTextField_QueryString" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jScrollPane1" min="-2" pref="126" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jButton_EQ" max="32767" attributes="0"/>
<Component id="jButton_GT" max="32767" attributes="0"/>
<Component id="jButton_LT" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jButton_NE" max="32767" attributes="0"/>
<Component id="jButton_GE" max="32767" attributes="0"/>
<Component id="jButton_LE" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton_Or" min="-2" pref="52" max="-2" attributes="0"/>
<Component id="jButton_Not" min="-2" max="-2" attributes="0"/>
<Component id="jButton_And" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jButton_GetValues" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_Layer" max="32767" attributes="0"/>
<Component id="jComboBox_Method" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_OnlySelVisible" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Layer" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_Method" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane2" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_QueryString" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_OnlySelVisible" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="27" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_Select" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Clear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_EQ" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_NE" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_And" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_GT" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_GE" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Or" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_LT" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_LE" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Not" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton_GetValues" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Layer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_LayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Method:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_Method">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Fields:"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_Fields">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList_FieldsMouseClicked"/>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jList_FieldsValueChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Unique Values:"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList_UniqueValues">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList_UniqueValuesMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_EQ">
<Properties>
<Property name="text" type="java.lang.String" value="="/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_EQActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_NE">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;&gt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_NEActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_And">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="And"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 27]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AndActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_GT">
<Properties>
<Property name="text" type="java.lang.String" value="&gt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_GTActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_GE">
<Properties>
<Property name="text" type="java.lang.String" value="&gt;="/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_GEActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Or">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Or"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 27]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OrActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_LT">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_LTActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_LE">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;="/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_LEActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Not">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Not"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 27]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_NotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_GetValues">
<Properties>
<Property name="text" type="java.lang.String" value="Get Values"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_GetValuesActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="Select query string:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_QueryString">
</Component>
<Component class="javax.swing.JButton" name="jButton_Select">
<Properties>
<Property name="text" type="java.lang.String" value="Select"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SelectActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Clear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ClearActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_OnlySelVisible">
<Properties>
<Property name="text" type="java.lang.String" value="Only selection visible"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,620 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.ListSelectionModel;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.table.DataRow;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.shape.Shape;
/**
*
* @author yaqiang
*/
public class FrmSelectByAttributes extends javax.swing.JDialog {
private final List<VectorLayer> _mapLayers;
private VectorLayer _selectLayer;
private String _selectField;
private final FrmMain _frmMain;
/**
* Creates new form FrmSelectByAttributes
* @param parent
* @param modal
*/
public FrmSelectByAttributes(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
_frmMain = (FrmMain) parent;
//---- Add selectable layers
_mapLayers = new ArrayList<>();
int i;
for (i = 0; i < _frmMain.getMapDocument().getActiveMapFrame().getMapView().getLayerNum(); i++) {
MapLayer mLayer = _frmMain.getMapDocument().getActiveMapFrame().getMapView().getLayers().get(i);
if (mLayer.getLayerType() == LayerTypes.VectorLayer) {
VectorLayer aLayer = (VectorLayer) mLayer;
_mapLayers.add(aLayer);
}
}
this.jComboBox_Layer.removeAllItems();
if (_mapLayers.size() > 0) {
for (i = 0; i < _mapLayers.size(); i++) {
this.jComboBox_Layer.addItem(_mapLayers.get(i).getLayerName());
}
this.jComboBox_Layer.setSelectedIndex(0);
}
//Add select methods
this.jComboBox_Method.removeAllItems();
this.jComboBox_Method.addItem("Create a new selection");
this.jComboBox_Method.addItem("Add to current selection");
this.jComboBox_Method.addItem("Remove from current selection");
this.jComboBox_Method.addItem("Select from current selection");
this.jComboBox_Method.setSelectedIndex(0);
}
private void get_Fields() {
this.jList_Fields.removeAll();
DefaultListModel listModel = new DefaultListModel();
for (int i = 0; i < _selectLayer.getFieldNumber(); i++) {
listModel.addElement(_selectLayer.getField(i).getColumnName());
}
this.jList_Fields.setModel(listModel);
this.jList_Fields.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.jList_Fields.setSelectedIndex(0);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jComboBox_Layer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_Method = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jList_Fields = new javax.swing.JList();
jLabel4 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jList_UniqueValues = new javax.swing.JList();
jButton_EQ = new javax.swing.JButton();
jButton_NE = new javax.swing.JButton();
jButton_And = new javax.swing.JButton();
jButton_GT = new javax.swing.JButton();
jButton_GE = new javax.swing.JButton();
jButton_Or = new javax.swing.JButton();
jButton_LT = new javax.swing.JButton();
jButton_LE = new javax.swing.JButton();
jButton_Not = new javax.swing.JButton();
jButton_GetValues = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jTextField_QueryString = new javax.swing.JTextField();
jButton_Select = new javax.swing.JButton();
jButton_Clear = new javax.swing.JButton();
jCheckBox_OnlySelVisible = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Select By Attribute");
jLabel1.setText("Layer:");
jComboBox_Layer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_Layer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_LayerActionPerformed(evt);
}
});
jLabel2.setText("Method:");
jComboBox_Method.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel3.setText("Fields:");
jList_Fields.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jList_Fields.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jList_FieldsMouseClicked(evt);
}
});
jList_Fields.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
jList_FieldsValueChanged(evt);
}
});
jScrollPane1.setViewportView(jList_Fields);
jLabel4.setText("Unique Values:");
jList_UniqueValues.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jList_UniqueValuesMouseClicked(evt);
}
});
jScrollPane2.setViewportView(jList_UniqueValues);
jButton_EQ.setText("=");
jButton_EQ.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_EQActionPerformed(evt);
}
});
jButton_NE.setText("<>");
jButton_NE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_NEActionPerformed(evt);
}
});
jButton_And.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton_And.setText("And");
jButton_And.setPreferredSize(new java.awt.Dimension(53, 27));
jButton_And.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AndActionPerformed(evt);
}
});
jButton_GT.setText(">");
jButton_GT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_GTActionPerformed(evt);
}
});
jButton_GE.setText(">=");
jButton_GE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_GEActionPerformed(evt);
}
});
jButton_Or.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton_Or.setText("Or");
jButton_Or.setPreferredSize(new java.awt.Dimension(53, 27));
jButton_Or.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OrActionPerformed(evt);
}
});
jButton_LT.setText("<");
jButton_LT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_LTActionPerformed(evt);
}
});
jButton_LE.setText("<=");
jButton_LE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_LEActionPerformed(evt);
}
});
jButton_Not.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton_Not.setText("Not");
jButton_Not.setPreferredSize(new java.awt.Dimension(53, 27));
jButton_Not.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_NotActionPerformed(evt);
}
});
jButton_GetValues.setText("Get Values");
jButton_GetValues.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_GetValuesActionPerformed(evt);
}
});
jLabel5.setText("Select query string:");
jButton_Select.setText("Select");
jButton_Select.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SelectActionPerformed(evt);
}
});
jButton_Clear.setText("Clear");
jButton_Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ClearActionPerformed(evt);
}
});
jCheckBox_OnlySelVisible.setText("Only selection visible");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(116, Short.MAX_VALUE)
.addComponent(jButton_Select)
.addGap(74, 74, 74)
.addComponent(jButton_Clear)
.addGap(108, 108, 108))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField_QueryString)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton_EQ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_GT, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_LT))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton_NE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_GE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_LE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton_Or, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_Not, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_And, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton_GetValues))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_Layer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox_Method, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4)
.addGap(21, 21, 21))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_OnlySelVisible)
.addComponent(jLabel5))
.addGap(0, 0, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox_Layer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jComboBox_Method, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane1)
.addComponent(jScrollPane2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_QueryString, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_OnlySelVisible)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_Select)
.addComponent(jButton_Clear)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_EQ)
.addComponent(jButton_NE)
.addComponent(jButton_And, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_GT)
.addComponent(jButton_GE)
.addComponent(jButton_Or, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_LT)
.addComponent(jButton_LE)
.addComponent(jButton_Not, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton_GetValues)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jComboBox_LayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_LayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_Layer.getItemCount() == 0) {
return;
}
this._selectLayer = this._mapLayers.get(this.jComboBox_Layer.getSelectedIndex());
this.get_Fields();
}//GEN-LAST:event_jComboBox_LayerActionPerformed
private void jList_FieldsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList_FieldsValueChanged
// TODO add your handling code here:
if (this.jList_Fields.getSelectedValue() == null) {
return;
}
String selField = this.jList_Fields.getSelectedValue().toString();
if (!selField.equals(_selectField)) {
this.jList_UniqueValues.removeAll();
this.jList_UniqueValues.setEnabled(false);
this.jButton_GetValues.setEnabled(true);
}
_selectField = selField;
}//GEN-LAST:event_jList_FieldsValueChanged
private void jButton_GetValuesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_GetValuesActionPerformed
// TODO add your handling code here:
List<String> valueList = new ArrayList<String>();
boolean isNumeric = MIMath.isNumeric(_selectLayer.getField(_selectField));
for (int i = 0; i < _selectLayer.getAttributeTable().getTable().getRowCount(); i++) {
if (!valueList.contains(_selectLayer.getAttributeTable().getTable().getValue(i, _selectField).toString())) {
valueList.add(_selectLayer.getAttributeTable().getTable().getValue(i, _selectField).toString());
}
}
Collections.sort(valueList);
this.jList_UniqueValues.setEnabled(true);
DefaultListModel listModel = new DefaultListModel();
if (isNumeric) {
for (String vStr : valueList) {
listModel.addElement(vStr);
}
} else {
for (String vStr : valueList) {
listModel.addElement("'" + vStr + "'");
}
}
this.jList_UniqueValues.setModel(listModel);
this.jList_UniqueValues.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.jButton_GetValues.setEnabled(false);
}//GEN-LAST:event_jButton_GetValuesActionPerformed
private void jButton_EQActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_EQActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " = ");
}//GEN-LAST:event_jButton_EQActionPerformed
private void jButton_NEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_NEActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " <> ");
}//GEN-LAST:event_jButton_NEActionPerformed
private void jButton_GTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_GTActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " > ");
}//GEN-LAST:event_jButton_GTActionPerformed
private void jButton_LTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_LTActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " < ");
}//GEN-LAST:event_jButton_LTActionPerformed
private void jButton_GEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_GEActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " >= ");
}//GEN-LAST:event_jButton_GEActionPerformed
private void jButton_LEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_LEActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " <= ");
}//GEN-LAST:event_jButton_LEActionPerformed
private void jButton_AndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AndActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " and ");
}//GEN-LAST:event_jButton_AndActionPerformed
private void jButton_OrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OrActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " or ");
}//GEN-LAST:event_jButton_OrActionPerformed
private void jButton_NotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_NotActionPerformed
// TODO add your handling code here:
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + " not ");
}//GEN-LAST:event_jButton_NotActionPerformed
private void jList_FieldsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList_FieldsMouseClicked
// TODO add your handling code here:
if (evt.getClickCount() == 2) {
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + this.jList_Fields.getSelectedValue().toString());
}
}//GEN-LAST:event_jList_FieldsMouseClicked
private void jList_UniqueValuesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList_UniqueValuesMouseClicked
// TODO add your handling code here:
if (evt.getClickCount() == 2) {
this.jTextField_QueryString.setText(this.jTextField_QueryString.getText() + this.jList_UniqueValues.getSelectedValue().toString());
}
}//GEN-LAST:event_jList_UniqueValuesMouseClicked
private void jButton_SelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectActionPerformed
// TODO add your handling code here:
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String expression = this.jTextField_QueryString.getText();
boolean onlySelVisible = this.jCheckBox_OnlySelVisible.isSelected();
List<DataRow> rows = this._selectLayer.getAttributeTable().getTable().select(expression);
List<Integer> rowIdxs = new ArrayList<>();
for (DataRow row : rows) {
rowIdxs.add(row.getRowIndex());
}
int i;
switch (this.jComboBox_Method.getSelectedIndex()) {
case 0: //Create a new selection
for (i = 0; i < _selectLayer.getShapeNum(); i++) {
if (rowIdxs.contains(i)) {
_selectLayer.getShapes().get(i).setSelected(true);
} else {
_selectLayer.getShapes().get(i).setSelected(false);
}
}
break;
case 1: //Add to current selection
for (i = 0; i < _selectLayer.getShapeNum(); i++) {
if (rowIdxs.contains(i)) {
_selectLayer.getShapes().get(i).setSelected(true);
}
}
break;
case 2: //Remove from current selection
for (i = 0; i < _selectLayer.getShapeNum(); i++) {
if (rowIdxs.contains(i)) {
_selectLayer.getShapes().get(i).setSelected(false);
}
}
break;
case 3: //Select from current selection
for (i = 0; i < _selectLayer.getShapeNum(); i++) {
if (_selectLayer.getShapes().get(i).isSelected()) {
if (!rowIdxs.contains(i)) {
_selectLayer.getShapes().get(i).setSelected(false);
}
}
}
break;
}
if (onlySelVisible) {
for (Shape shape : _selectLayer.getShapes()) {
shape.setVisible(shape.isSelected());
}
}
this._frmMain.refreshMap();
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_SelectActionPerformed
private void jButton_ClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ClearActionPerformed
// TODO add your handling code here:
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
this._selectLayer.clearSelectedShapes();
for (Shape shape : _selectLayer.getShapes()) {
shape.setVisible(true);
}
this._frmMain.refreshMap();
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ClearActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmSelectByAttributes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmSelectByAttributes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmSelectByAttributes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmSelectByAttributes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmSelectByAttributes dialog = new FrmSelectByAttributes(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton_And;
private javax.swing.JButton jButton_Clear;
private javax.swing.JButton jButton_EQ;
private javax.swing.JButton jButton_GE;
private javax.swing.JButton jButton_GT;
private javax.swing.JButton jButton_GetValues;
private javax.swing.JButton jButton_LE;
private javax.swing.JButton jButton_LT;
private javax.swing.JButton jButton_NE;
private javax.swing.JButton jButton_Not;
private javax.swing.JButton jButton_Or;
private javax.swing.JButton jButton_Select;
private javax.swing.JCheckBox jCheckBox_OnlySelVisible;
private javax.swing.JComboBox jComboBox_Layer;
private javax.swing.JComboBox jComboBox_Method;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JList jList_Fields;
private javax.swing.JList jList_UniqueValues;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField jTextField_QueryString;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Select By Location"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_FromLayer" alignment="0" min="-2" pref="358" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_SelType" alignment="0" min="-2" pref="358" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_RelatedLayer" alignment="0" min="-2" pref="358" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeaturesOnly" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="85" max="-2" attributes="0"/>
<Component id="jButton_Select" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="69" max="-2" attributes="0"/>
<Component id="jButton_Clear" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_FromLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SelType" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_RelatedLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeaturesOnly" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="33" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_Select" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Clear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Select features from the layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_FromLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="That:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SelType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="The features in this layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_RelatedLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_RelatedLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeaturesOnly">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Select">
<Properties>
<Property name="text" type="java.lang.String" value="Select"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SelectActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Clear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ClearActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,332 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import org.meteoinfo.geoprocess.GeoComputation;
import org.meteoinfo.geoprocess.SpatialQueryTypes;
import org.meteoinfo.global.PointD;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.shape.PolygonShape;
import org.meteoinfo.shape.Shape;
import org.meteoinfo.shape.ShapeTypes;
/**
*
* @author yaqiang
*/
public class FrmSelectByLocation extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
private final FrmMain _frmMain;
/**
* Creates new form FrmSelectByLocation
* @param parent
* @param modal
*/
public FrmSelectByLocation(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
_frmMain = (FrmMain) parent;
for (MapLayer aLayer : _frmMain.getMapDocument().getActiveMapFrame().getMapView().getLayers()) {
if (aLayer.getLayerType() == LayerTypes.VectorLayer) {
_vLayers.add((VectorLayer) aLayer);
}
}
this.jComboBox_FromLayer.removeAllItems();
for (VectorLayer aLayer : _vLayers) {
jComboBox_FromLayer.addItem(aLayer.getLayerName());
}
jComboBox_FromLayer.setSelectedIndex(0);
this.jComboBox_SelType.removeAllItems();
for (SpatialQueryTypes type : SpatialQueryTypes.values()) {
jComboBox_SelType.addItem(type.toString());
}
jComboBox_SelType.setSelectedIndex(0);
this.jComboBox_RelatedLayer.removeAllItems();
for (VectorLayer aLayer : _vLayers) {
jComboBox_RelatedLayer.addItem(aLayer.getLayerName());
}
jComboBox_RelatedLayer.setSelectedIndex(0);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_FromLayer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_SelType = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
jComboBox_RelatedLayer = new javax.swing.JComboBox();
jCheckBox_SelFeaturesOnly = new javax.swing.JCheckBox();
jButton_Select = new javax.swing.JButton();
jButton_Clear = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Select By Location");
jLabel1.setText("Select features from the layer:");
jComboBox_FromLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("That:");
jComboBox_SelType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel3.setText("The features in this layer:");
jComboBox_RelatedLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_RelatedLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_RelatedLayerActionPerformed(evt);
}
});
jCheckBox_SelFeaturesOnly.setText("Selected features only");
jButton_Select.setText("Select");
jButton_Select.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SelectActionPerformed(evt);
}
});
jButton_Clear.setText("Clear");
jButton_Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ClearActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jComboBox_FromLayer, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jComboBox_SelType, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jComboBox_RelatedLayer, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox_SelFeaturesOnly)))
.addGroup(layout.createSequentialGroup()
.addGap(85, 85, 85)
.addComponent(jButton_Select)
.addGap(69, 69, 69)
.addComponent(jButton_Clear)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_FromLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SelType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_RelatedLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeaturesOnly)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_Select)
.addComponent(jButton_Clear))
.addGap(22, 22, 22))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jComboBox_RelatedLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_RelatedLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_RelatedLayer.getItemCount() == 0) {
return;
}
VectorLayer aLayer = _vLayers.get(this.jComboBox_RelatedLayer.getSelectedIndex());
List<Integer> selIndexes = aLayer.getSelectedShapeIndexes();
if (selIndexes.size() > 0) {
this.jCheckBox_SelFeaturesOnly.setEnabled(true);
this.jCheckBox_SelFeaturesOnly.setText("Selected features only (" + String.valueOf(selIndexes.size())
+ " features selected)");
} else {
jCheckBox_SelFeaturesOnly.setEnabled(false);
jCheckBox_SelFeaturesOnly.setSelected(false);
jCheckBox_SelFeaturesOnly.setText("Selected features only");
}
}//GEN-LAST:event_jComboBox_RelatedLayerActionPerformed
private void jButton_SelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectActionPerformed
// TODO add your handling code here:
if (this.jComboBox_FromLayer.getSelectedItem().toString().equals(this.jComboBox_RelatedLayer.
getSelectedItem().toString())) {
JOptionPane.showMessageDialog(null, "The two layers are same!");
return;
}
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_FromLayer.getSelectedIndex());
VectorLayer relatedLayer = _vLayers.get(this.jComboBox_RelatedLayer.getSelectedIndex());
SpatialQueryTypes selType = SpatialQueryTypes.valueOf(this.jComboBox_SelType.getSelectedItem().toString());
boolean onlySel = this.jCheckBox_SelFeaturesOnly.isSelected();
switch (selType) {
case Within:
if (relatedLayer.getShapeType() != ShapeTypes.Polygon) {
JOptionPane.showMessageDialog(null, "The second layer must be polygon layer for 'Within' case!");
this.setCursor(Cursor.getDefaultCursor());
return;
} else {
for (Shape aShape : fromLayer.getShapes()) {
boolean isIn = true;
List<PointD> points = (List<PointD>) aShape.getPoints();
for (PointD aPoint : points) {
if (!GeoComputation.pointInPolygonLayer(relatedLayer, aPoint, onlySel)) {
isIn = false;
break;
}
}
if (isIn) {
aShape.setSelected(true);
} else {
aShape.setSelected(false);
}
}
}
break;
case Contain:
if (fromLayer.getShapeType() != ShapeTypes.Polygon) {
JOptionPane.showMessageDialog(null, "The first layer must be polygon layer for 'Within' case!");
this.setCursor(Cursor.getDefaultCursor());
return;
} else {
List<Shape> shapes = new ArrayList<>();
if (onlySel) {
for (Shape aShape : relatedLayer.getShapes()) {
if (aShape.isSelected()) {
shapes.add(aShape);
}
}
} else {
shapes = (List<Shape>) relatedLayer.getShapes();
}
for (Shape aShape : fromLayer.getShapes()) {
aShape.setSelected(false);
PolygonShape aPolygon = (PolygonShape) aShape;
for (Shape bShape : shapes) {
boolean isIn = true;
List<PointD> points = (List<PointD>) bShape.getPoints();
for (PointD aPoint : points) {
if (!GeoComputation.pointInPolygon(aPolygon, aPoint)) {
isIn = false;
break;
}
}
if (isIn) {
aShape.setSelected(true);
break;
}
}
}
}
break;
}
_frmMain.refreshMap();
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_SelectActionPerformed
private void jButton_ClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ClearActionPerformed
// TODO add your handling code here:
VectorLayer fromLayer = _vLayers.get(this.jComboBox_FromLayer.getSelectedIndex());
fromLayer.clearSelectedShapes();
_frmMain.refreshMap();
}//GEN-LAST:event_jButton_ClearActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmSelectByLocation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmSelectByLocation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmSelectByLocation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmSelectByLocation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmSelectByLocation dialog = new FrmSelectByLocation(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Clear;
private javax.swing.JButton jButton_Select;
private javax.swing.JCheckBox jCheckBox_SelFeaturesOnly;
private javax.swing.JComboBox jComboBox_FromLayer;
private javax.swing.JComboBox jComboBox_RelatedLayer;
private javax.swing.JComboBox jComboBox_SelType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Symmetrical Difference"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="134" max="-2" attributes="0"/>
<Component id="jButton_Apply" min="-2" pref="85" max="-2" attributes="0"/>
<EmptySpace pref="167" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jComboBox_SubjectLayer" max="32767" attributes="0"/>
<Component id="jComboBox_SymDifferenceLayer" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Difference" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SubjectLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Subject" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_SymDifferenceLayer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox_SelFeatureOnly_Difference" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="12" max="32767" attributes="0"/>
<Component id="jButton_Apply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Subject layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SubjectLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Symmetrical Difference layer:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_SymDifferenceLayer">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_SymDifferenceLayerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Difference">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Apply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox_SelFeatureOnly_Subject">
<Properties>
<Property name="text" type="java.lang.String" value="Selected features only"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,258 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.meteoinfo.layer.LayerTypes;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.map.MapView;
import org.meteoinfo.shape.PolygonShape;
/**
*
* @author yaqiang
*/
public class FrmSymDifference extends javax.swing.JDialog {
List<VectorLayer> _vLayers = new ArrayList<>();
List<VectorLayer> _polygonLayers = new ArrayList<>();
private final FrmMain _parent;
/**
* Creates new form FrmClipping
* @param parent
* @param modal
*/
public FrmSymDifference(JFrame parent, boolean modal) {
super(parent, modal);
initComponents();
_parent = (FrmMain)parent;
this.initialize();
}
private void initialize() {
MapView mapView = _parent.getMapDocument().getActiveMapFrame().getMapView();
this.jComboBox_SubjectLayer.removeAllItems();
this.jComboBox_SymDifferenceLayer.removeAllItems();
for (int i = 0; i < mapView.getLayerNum(); i++) {
MapLayer layer = mapView.getLayers().get(i);
if (layer.getLayerType() == LayerTypes.VectorLayer) {
this._vLayers.add((VectorLayer) layer);
this.jComboBox_SubjectLayer.addItem(layer.getLayerName());
switch (layer.getShapeType()) {
case Polygon:
case PolygonZ:
case PolygonM:
this._polygonLayers.add((VectorLayer) layer);
this.jComboBox_SymDifferenceLayer.addItem(layer.getLayerName());
break;
}
}
}
if (this.jComboBox_SubjectLayer.getItemCount() > 0) {
this.jComboBox_SubjectLayer.setSelectedIndex(0);
}
if (this.jComboBox_SymDifferenceLayer.getItemCount() > 0) {
this.jComboBox_SymDifferenceLayer.setSelectedIndex(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jComboBox_SubjectLayer = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jComboBox_SymDifferenceLayer = new javax.swing.JComboBox();
jCheckBox_SelFeatureOnly_Difference = new javax.swing.JCheckBox();
jButton_Apply = new javax.swing.JButton();
jCheckBox_SelFeatureOnly_Subject = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Symmetrical Difference");
jLabel1.setText("Subject layer:");
jComboBox_SubjectLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel2.setText("Symmetrical Difference layer:");
jComboBox_SymDifferenceLayer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_SymDifferenceLayer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_SymDifferenceLayerActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Difference.setText("Selected features only");
jButton_Apply.setText("Apply");
jButton_Apply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ApplyActionPerformed(evt);
}
});
jCheckBox_SelFeatureOnly_Subject.setText("Selected features only");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(134, 134, 134)
.addComponent(jButton_Apply, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(167, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox_SubjectLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox_SymDifferenceLayer, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addComponent(jLabel1)
.addComponent(jCheckBox_SelFeatureOnly_Difference)
.addComponent(jLabel2))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SubjectLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jCheckBox_SelFeatureOnly_Subject)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_SymDifferenceLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox_SelFeatureOnly_Difference)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(jButton_Apply)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed
// TODO add your handling code here:
if (this.jComboBox_SubjectLayer.getSelectedItem().toString().equals(this.jComboBox_SymDifferenceLayer.getSelectedItem().toString())) {
JOptionPane.showMessageDialog(null, "The two layers are same!");
return;
}
//---- Show progressbar
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
VectorLayer fromLayer = _vLayers.get(this.jComboBox_SubjectLayer.getSelectedIndex());
VectorLayer clipLayer = _polygonLayers.get(this.jComboBox_SymDifferenceLayer.getSelectedIndex());
boolean onlySel = this.jCheckBox_SelFeatureOnly_Subject.isSelected();
List<PolygonShape> clipShapes;
if (this.jCheckBox_SelFeatureOnly_Difference.isSelected()){
clipShapes = (List<PolygonShape>)clipLayer.getSelectedShapes();
} else {
clipShapes = (List<PolygonShape>)clipLayer.getShapes();
}
VectorLayer newLayer = fromLayer.symDifference(clipShapes, onlySel);
newLayer.setLayerName("Intersection_" + newLayer.getLayerName());
_parent.getMapDocument().getActiveMapFrame().addLayer(newLayer);
//---- Hide progressbar
this.setCursor(Cursor.getDefaultCursor());
}//GEN-LAST:event_jButton_ApplyActionPerformed
private void jComboBox_SymDifferenceLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_SymDifferenceLayerActionPerformed
// TODO add your handling code here:
if (this.jComboBox_SymDifferenceLayer.getItemCount() > 0) {
VectorLayer aLayer = _polygonLayers.get(this.jComboBox_SymDifferenceLayer.getSelectedIndex());
List<Integer> selIndexes = aLayer.getSelectedShapeIndexes();
if (selIndexes.size() > 0) {
this.jCheckBox_SelFeatureOnly_Difference.setEnabled(true);
this.jCheckBox_SelFeatureOnly_Difference.setText("Selected features only (" + String.valueOf(selIndexes.size()) + " features selected)");
} else {
this.jCheckBox_SelFeatureOnly_Difference.setEnabled(false);
this.jCheckBox_SelFeatureOnly_Difference.setSelected(false);
this.jCheckBox_SelFeatureOnly_Difference.setText("Selected features only");
}
}
}//GEN-LAST:event_jComboBox_SymDifferenceLayerActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmSymDifference.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmSymDifference dialog = new FrmSymDifference(new FrmMain(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Apply;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Difference;
private javax.swing.JCheckBox jCheckBox_SelFeatureOnly_Subject;
private javax.swing.JComboBox jComboBox_SubjectLayer;
private javax.swing.JComboBox jComboBox_SymDifferenceLayer;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu_File">
<Properties>
<Property name="mnemonic" type="int" value="70"/>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_NewFile">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+N"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_NewFile.Image.png"/>
</Property>
<Property name="text" type="java.lang.String" value="New"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_NewFileActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_OpenFile">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+O"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Folder_1_16x16x8.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Open ..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_OpenFileActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_SaveFile">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+S"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Disk_1_16x16x8.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_SaveFileActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_SaveAs">
<Properties>
<Property name="text" type="java.lang.String" value="Save As ..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_SaveAsActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_CloseFile">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+W"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/closefile.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Close"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_CloseFileActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator3">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Exit">
<Properties>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_ExitActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
<Properties>
<Property name="mnemonic" type="int" value="69"/>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Cut">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+X"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSMI_EditCut.Image.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Cut"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_CutActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Copy">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+C"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/menuEditCopy.Image.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Copy"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_CopyActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_Paste">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+V"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/pasteToolStripButton.Image.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Paste"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_PasteActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu_Options">
<Properties>
<Property name="mnemonic" type="int" value="79"/>
<Property name="text" type="java.lang.String" value="Options"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem_SetFont">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/miSetFont.Image.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Set Font"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem_SetFontActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator5">
</MenuItem>
<Menu class="javax.swing.JMenu" name="jMenu_ScriptLanguage">
<Properties>
<Property name="text" type="java.lang.String" value="Script Language"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="jRadioButtonMenuItem_Groovy">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Groovy"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButtonMenuItem_GroovyActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="jRadioButtonMenuItem_Jython">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Jython"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButtonMenuItem_JythonActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,46,0,0,2,-45"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="rollover" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[74, 25]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_NewFile">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_NewFile.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="New File"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_NewFileActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_OpenFile">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Folder_1_16x16x8.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Open File"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OpenFileActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_CloseFile">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/closefile.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Close File"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseFileActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_SaveFile">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Disk_1_16x16x8.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Save File"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SaveFileActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="FrmTextEditor_jButton_SaveFile"/>
</AuxValues>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
</Component>
<Component class="javax.swing.JButton" name="jButton_Undo">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_Undo.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Undo"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UndoActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Redo">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_Redo.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Redo"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_RedoActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
</Component>
<Component class="javax.swing.JButton" name="jButton_RunScript">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_RunScript.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Run Script"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_RunScriptActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="dividerLocation" type="int" value="300"/>
<Property name="orientation" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="jSplitPane1ComponentResized"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea_Output">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_VSpeed" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_UDir" pref="159" max="32767" attributes="0"/>
</Group>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_UData" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_VData" pref="235" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jButton_OK" max="32767" attributes="0"/>
<Component id="jButton_Cancel" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox_UDir" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox_UData" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jComboBox_VSpeed" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_OK" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jComboBox_VData" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jRadioButton_UV" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jRadioButton_DirSpeed" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jRadioButton_UV" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton_DirSpeed" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="jRadioButton_UV">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="U/V"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton_UVActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton_DirSpeed">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="Direction/Speed"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton_DirSpeedActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Skip Factors"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSpinner_XSkip" min="-2" pref="68" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSpinner_YSkip" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinner_XSkip" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinner_YSkip" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="X Skip:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Y Skip:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner_XSkip">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner_YSkip">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="U/Direction:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="V/Speed:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_UDir">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[142, 24]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_VSpeed">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[142, 24]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_UData">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[142, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_UDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox_VData">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[142, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox_VDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_OK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[69, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Cancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[6, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CancelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,547 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import org.meteoinfo.data.meteodata.DataInfo;
import org.meteoinfo.data.meteodata.MeteoDataInfo;
import org.meteoinfo.data.meteodata.Variable;
/**
*
* @author User
*/
public class FrmUVSet extends javax.swing.JDialog {
private boolean _isOK = false;
/**
* Creates new form FrmUVSet
*
* @param parent
* @param modal
*/
public FrmUVSet(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jRadioButton_UV = new javax.swing.JRadioButton();
jRadioButton_DirSpeed = new javax.swing.JRadioButton();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSpinner_XSkip = new javax.swing.JSpinner();
jSpinner_YSkip = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jComboBox_UDir = new javax.swing.JComboBox();
jComboBox_VSpeed = new javax.swing.JComboBox();
jComboBox_UData = new javax.swing.JComboBox();
jComboBox_VData = new javax.swing.JComboBox();
jButton_OK = new javax.swing.JButton();
jButton_Cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
buttonGroup1.add(jRadioButton_UV);
jRadioButton_UV.setText("U/V");
jRadioButton_UV.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton_UVActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton_DirSpeed);
jRadioButton_DirSpeed.setText("Direction/Speed");
jRadioButton_DirSpeed.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton_DirSpeedActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jRadioButton_UV)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jRadioButton_DirSpeed)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton_UV)
.addComponent(jRadioButton_DirSpeed))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Skip Factors"));
jSpinner_XSkip.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
jSpinner_YSkip.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSpinner_XSkip, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSpinner_YSkip)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jSpinner_XSkip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jSpinner_YSkip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jLabel3.setText("U/Direction:");
jLabel4.setText("V/Speed:");
jComboBox_UDir.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_UDir.setPreferredSize(new java.awt.Dimension(142, 24));
jComboBox_VSpeed.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_VSpeed.setPreferredSize(new java.awt.Dimension(142, 24));
jComboBox_UData.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_UData.setPreferredSize(new java.awt.Dimension(142, 24));
jComboBox_UData.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_UDataActionPerformed(evt);
}
});
jComboBox_VData.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox_VData.setPreferredSize(new java.awt.Dimension(142, 24));
jComboBox_VData.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox_VDataActionPerformed(evt);
}
});
jButton_OK.setText("OK");
jButton_OK.setPreferredSize(new java.awt.Dimension(69, 23));
jButton_OK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_OKActionPerformed(evt);
}
});
jButton_Cancel.setText("Cancel");
jButton_Cancel.setPreferredSize(new java.awt.Dimension(6, 23));
jButton_Cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_VSpeed, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_UDir, 0, 159, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jComboBox_UData, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jComboBox_VData, 0, 235, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton_OK, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_Cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(35, 35, 35))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jComboBox_UDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox_UData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox_VSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(jButton_OK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox_VData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_Cancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jRadioButton_UVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_UVActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jRadioButton_UVActionPerformed
private void jRadioButton_DirSpeedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_DirSpeedActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jRadioButton_DirSpeedActionPerformed
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
this._isOK = true;
this.dispose();
}//GEN-LAST:event_jButton_OKActionPerformed
private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CancelActionPerformed
private void jComboBox_UDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_UDataActionPerformed
// TODO add your handling code here:
MeteoDataInfo mdi = (MeteoDataInfo) this.jComboBox_UData.getSelectedItem();
this.updateUData(mdi);
}//GEN-LAST:event_jComboBox_UDataActionPerformed
private void updateUData(MeteoDataInfo mdi){
DataInfo aDataInfo = mdi.getDataInfo();
this.jComboBox_UDir.removeAllItems();
for (int i = 0; i < aDataInfo.getVariables().size(); i++) {
Variable var = aDataInfo.getVariables().get(i);
if (mdi.isSWATHData()) {
Variable lonvar = aDataInfo.getVariable("longitude");
if (var.dimensionContains(lonvar)) {
this.jComboBox_UDir.addItem(var.getName());
}
} else {
if (var.isPlottable()) {
this.jComboBox_UDir.addItem(var.getName());
}
}
}
if (mdi.getVariableIndex() < this.jComboBox_UDir.getItemCount()) {
this.jComboBox_UDir.setSelectedIndex(mdi.getVariableIndex());
} else {
if (this.jComboBox_UDir.getItemCount() > 0) {
this.jComboBox_UDir.setSelectedIndex(0);
}
}
}
private void jComboBox_VDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_VDataActionPerformed
// TODO add your handling code here:
MeteoDataInfo mdi = (MeteoDataInfo) this.jComboBox_VData.getSelectedItem();
this.updateVData(mdi);
}//GEN-LAST:event_jComboBox_VDataActionPerformed
private void updateVData(MeteoDataInfo mdi){
DataInfo aDataInfo = mdi.getDataInfo();
this.jComboBox_VSpeed.removeAllItems();
for (int i = 0; i < aDataInfo.getVariables().size(); i++) {
Variable var = aDataInfo.getVariables().get(i);
if (mdi.isSWATHData()) {
Variable lonvar = aDataInfo.getVariable("longitude");
if (var.dimensionContains(lonvar)) {
this.jComboBox_VSpeed.addItem(var.getName());
}
} else {
if (var.isPlottable()) {
this.jComboBox_VSpeed.addItem(var.getName());
}
}
}
if (mdi.getVariableIndex() < this.jComboBox_VSpeed.getItemCount()) {
this.jComboBox_VSpeed.setSelectedIndex(mdi.getVariableIndex());
} else {
if (this.jComboBox_VSpeed.getItemCount() > 0) {
this.jComboBox_VSpeed.setSelectedIndex(0);
}
}
}
/**
* Set U/V data info
*
* @param dfs Data info list
*/
public void setUVData(List<MeteoDataInfo> dfs) {
DefaultComboBoxModel umodel = new DefaultComboBoxModel();
DefaultComboBoxModel vmodel = new DefaultComboBoxModel();
for (int i = 0; i < dfs.size(); i++) {
umodel.addElement(dfs.get(i));
vmodel.addElement(dfs.get(i));
}
this.jComboBox_UData.setModel(umodel);
this.jComboBox_VData.setModel(vmodel);
}
/**
* Set U/V items
*
* @param vList Variable names
*/
public void setUVItems(List<String> vList) {
int i;
this.jComboBox_UDir.removeAllItems();
this.jComboBox_VSpeed.removeAllItems();
for (i = 0; i < vList.size(); i++) {
this.jComboBox_UDir.addItem(vList.get(i));
this.jComboBox_VSpeed.addItem(vList.get(i));
}
}
/**
* Set if is U/V
*
* @param isTrue Boolean
*/
public void setUV(boolean isTrue) {
if (isTrue) {
this.jRadioButton_UV.setSelected(true);
} else {
this.jRadioButton_DirSpeed.setSelected(true);
}
}
/**
* Set U/Wind directory variable name
*
* @param ustr U/Wind directory variable name
*/
public void setUStr(String ustr) {
this.jComboBox_UDir.setSelectedItem(ustr);
}
/**
* Set V/Wind speed variable name
*
* @param vstr V/Wind speed variable name
*/
public void setVStr(String vstr) {
this.jComboBox_VSpeed.setSelectedItem(vstr);
}
/**
* Set x skip value
*
* @param xskip X skip
*/
public void setXSkip(int xskip) {
this.jSpinner_XSkip.setValue(xskip);
}
/**
* Set y skip value
*
* @param yskip Y skip
*/
public void setYSkip(int yskip) {
this.jSpinner_YSkip.setValue(yskip);
}
/**
* Get U data info
*
* @return U data info
*/
public MeteoDataInfo getUData() {
return (MeteoDataInfo) this.jComboBox_UData.getSelectedItem();
}
/**
* Set U data info
* @param value U data info
*/
public void setUData(MeteoDataInfo value){
this.jComboBox_UData.setSelectedItem(value);
this.updateUData(value);
}
/**
* Get V data info
*
* @return V data info
*/
public MeteoDataInfo getVData() {
return (MeteoDataInfo) this.jComboBox_VData.getSelectedItem();
}
/**
* Set V data info
* @param value V data info
*/
public void setVData(MeteoDataInfo value){
this.jComboBox_VData.setSelectedItem(value);
this.updateVData(value);
}
/**
* Get U/V variable names
*
* @return Variable names
*/
public String[] getUVItems() {
String uStr = this.jComboBox_UDir.getSelectedItem().toString();
String vStr = this.jComboBox_VSpeed.getSelectedItem().toString();
return new String[]{uStr, vStr};
}
/**
* Get if OK button is pressed
*
* @return Boolean
*/
public boolean isOK() {
return _isOK;
}
/**
* Get if is U/V
*
* @return Boolean
*/
public boolean isUV() {
return this.jRadioButton_UV.isSelected();
}
/**
* Get x skip
*
* @return X skip
*/
public int getXSkip() {
return Integer.parseInt(this.jSpinner_XSkip.getValue().toString());
}
/**
* Get y skip
*
* @return Y skip
*/
public int getYSkip() {
return Integer.parseInt(this.jSpinner_YSkip.getValue().toString());
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmUVSet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmUVSet dialog = new FrmUVSet(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton_Cancel;
private javax.swing.JButton jButton_OK;
private javax.swing.JComboBox jComboBox_UData;
private javax.swing.JComboBox jComboBox_UDir;
private javax.swing.JComboBox jComboBox_VData;
private javax.swing.JComboBox jComboBox_VSpeed;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JRadioButton jRadioButton_DirSpeed;
private javax.swing.JRadioButton jRadioButton_UV;
private javax.swing.JSpinner jSpinner_XSkip;
private javax.swing.JSpinner jSpinner_YSkip;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_formBundle" type="java.lang.String" value="org/meteoinfo/desktop/bundle/Bundle_FrmMeteoData"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,3,0,0,2,-22"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_Save">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Disk_1_16x16x8.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Save File"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_SaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
</Component>
<Component class="javax.swing.JButton" name="jButton_ToStation">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/TSB_NewPoint.Image.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="To Station Data"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ToStationActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Stat">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/Statictics.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Statistics"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton_Chart">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/meteoinfo/desktop/resources/chart.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="meteoinfo/bundle/Bundle_FrmMeteoData.properties" key="FrmMeteoData.jButton_1DPlot.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ChartActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTable1">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="4">
<Column editable="true" title="Title 1" type="java.lang.Object"/>
<Column editable="true" title="Title 2" type="java.lang.Object"/>
<Column editable="true" title="Title 3" type="java.lang.Object"/>
<Column editable="true" title="Title 4" type="java.lang.Object"/>
</Table>
</Property>
<Property name="autoResizeMode" type="int" value="0"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,422 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.Cursor;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import org.meteoinfo.data.GridData;
import org.meteoinfo.data.StationData;
import org.meteoinfo.data.XYListDataset;
import org.meteoinfo.data.meteodata.ascii.LonLatStationDataInfo;
import org.meteoinfo.desktop.config.GenericFileFilter;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.projection.KnownCoordinateSystems;
import org.meteoinfo.table.RowHeaderTable;
import org.meteoinfo.projection.info.ProjectionInfo;
/**
*
* @author yaqiang
*/
public class FrmViewData extends javax.swing.JFrame {
private double _missingValue;
private String _dataType = "GridData";
private Object _data;
private String[] _colNames;
public void setMissingValue(double value) {
_missingValue = value;
}
public void setGridData(GridData value) {
_data = value;
_dataType = "GridData";
this.jButton_ToStation.setEnabled(true);
GridData gData = (GridData) _data;
int xNum = gData.getXNum();
int yNum = gData.getYNum();
Object[][] tData = new Object[yNum][xNum];
_colNames = new String[xNum];
for (int i = 0; i < xNum; i++) {
_colNames[i] = String.valueOf(i);
}
double min = gData.getMaxMinValue()[1];
int dNum = MIMath.getDecimalNum(min);
String dFormat = "%1$." + String.valueOf(dNum) + "f";
for (int i = 0; i < yNum; i++) {
for (int j = 0; j < xNum; j++) {
tData[i][j] = String.format(dFormat, gData.data[i][j]);
}
}
DefaultTableModel model = new DefaultTableModel(tData, _colNames) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
this.jTable1.setModel(model);
this.jScrollPane1.setRowHeaderView(new RowHeaderTable(this.jTable1, 40, true));
}
public void setStationData(StationData value) {
_data = value;
_dataType = "StationData";
this.jButton_ToStation.setEnabled(false);
StationData sData = (StationData) _data;
double min = sData.getMinValue();
int dNum = MIMath.getDecimalNum(min);
String dFormat = "%1$." + String.valueOf(dNum) + "f";
int yNum = sData.getStNum();
//int xNum = sData.data.length + 1;
int xNum = 4;
Object[][] tData = new Object[yNum][xNum];
for (int i = 0; i < xNum; i++) {
if (i == 0) {
for (int j = 0; j < yNum; j++) {
tData[j][i] = sData.stations.get(j);
}
} else if (i <= 2) {
for (int j = 0; j < yNum; j++) {
//tData[j][i] = String.format("%1$.2f", sData.data[i - 1][j]);
tData[j][i] = String.valueOf(sData.data[j][i - 1]);
}
} else {
for (int j = 0; j < yNum; j++) {
tData[j][i] = String.format(dFormat, sData.data[j][i - 1]);
}
}
}
DefaultTableModel model = new DefaultTableModel(tData, _colNames) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
this.jTable1.setModel(model);
this.jScrollPane1.setRowHeaderView(new RowHeaderTable(this.jTable1, 40));
}
public void setXYData(XYListDataset value) {
_data = value;
_dataType = "XYData";
this.jButton_ToStation.setEnabled(false);
double min = value.getY(0, 0);
int dNum = MIMath.getDecimalNum(min);
String dFormat = "%1$." + String.valueOf(dNum) + "f";
int yNum = value.getItemCount();
int xNum = value.getSeriesCount() * 2;
_colNames = new String[xNum];
for (int i = 0; i < xNum / 2; i++) {
_colNames[i * 2] = value.getSeriesKey(i) + "_X";
_colNames[i * 2 + 1] = value.getSeriesKey(i) + "_Y";
}
Object[][] tData = new Object[yNum][xNum];
for (int i = 0; i < xNum / 2; i++) {
for (int j = 0; j < yNum; j++) {
tData[j][i * 2] = value.getX(i, j);
tData[j][i * 2 + 1] = value.getY(i, j);
}
}
DefaultTableModel model = new DefaultTableModel(tData, _colNames) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
this.jTable1.setModel(model);
this.jScrollPane1.setRowHeaderView(new RowHeaderTable(this.jTable1, 40));
}
/**
* Creates new form FrmViewData
*/
public FrmViewData() {
initComponents();
this.setSize(600, 400);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
BufferedImage image = null;
try {
image = ImageIO.read(this.getClass().getResource("/images/MeteoInfo_1_16x16x8.png"));
this.setIconImage(image);
} catch (Exception e) {
}
this.jButton_Stat.setEnabled(false);
this.jButton_Chart.setEnabled(false);
}
/**
* Constructor
*
* @param colNames
*/
public FrmViewData(String[] colNames) {
this();
_colNames = colNames;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jButton_Save = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
jButton_ToStation = new javax.swing.JButton();
jButton_Stat = new javax.swing.JButton();
jButton_Chart = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jToolBar1.setRollover(true);
jButton_Save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Disk_1_16x16x8.png"))); // NOI18N
jButton_Save.setToolTipText("Save File");
jButton_Save.setFocusable(false);
jButton_Save.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton_Save.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton_Save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SaveActionPerformed(evt);
}
});
jToolBar1.add(jButton_Save);
jToolBar1.add(jSeparator1);
jButton_ToStation.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TSB_NewPoint.Image.png"))); // NOI18N
jButton_ToStation.setToolTipText("To Station Data");
jButton_ToStation.setFocusable(false);
jButton_ToStation.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton_ToStation.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton_ToStation.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ToStationActionPerformed(evt);
}
});
jToolBar1.add(jButton_ToStation);
jButton_Stat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Statictics.png"))); // NOI18N
jButton_Stat.setToolTipText("Statistics");
jButton_Stat.setFocusable(false);
jButton_Stat.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton_Stat.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jToolBar1.add(jButton_Stat);
jButton_Chart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/chart.png"))); // NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("bundle/Bundle_FrmMeteoData"); // NOI18N
jButton_Chart.setToolTipText(bundle.getString("FrmMeteoData.jButton_1DPlot.toolTipText")); // NOI18N
jButton_Chart.setFocusable(false);
jButton_Chart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton_Chart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton_Chart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ChartActionPerformed(evt);
}
});
jToolBar1.add(jButton_Chart);
getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_ChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ChartActionPerformed
// TODO add your handling code here:
JOptionPane.showMessageDialog(null, "Under developing!");
}//GEN-LAST:event_jButton_ChartActionPerformed
private void jButton_ToStationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ToStationActionPerformed
// TODO add your handling code here:
String path = System.getProperty("user.dir");
File pathDir = new File(path);
JFileChooser aDlg = new JFileChooser();
//aDlg.setAcceptAllFileFilterUsed(false);
aDlg.setCurrentDirectory(pathDir);
String[] fileExts = new String[]{"txt", "csv"};
GenericFileFilter mapFileFilter = new GenericFileFilter(fileExts, "Supported Formats");
aDlg.setFileFilter(mapFileFilter);
if (JFileChooser.APPROVE_OPTION == aDlg.showOpenDialog(this)) {
File inf = aDlg.getSelectedFile();
String inFile = inf.getAbsolutePath();
JFileChooser outDlg = new JFileChooser();
outDlg.setCurrentDirectory(pathDir);
fileExts = new String[]{"csv"};
GenericFileFilter txtFileFilter = new GenericFileFilter(fileExts, "CSV file (*.csv)");
outDlg.setFileFilter(txtFileFilter);
outDlg.setAcceptAllFileFilterUsed(false);
if (JFileChooser.APPROVE_OPTION == outDlg.showSaveDialog(this)) {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String fileName = outDlg.getSelectedFile().getAbsolutePath();
String extent = ((GenericFileFilter) outDlg.getFileFilter()).getFileExtent();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
ProjectionInfo projInfo = ((GridData) _data).projInfo;
if (projInfo.isLonLat()) {
try {
((GridData) _data).toStation(inFile, fileName);
} catch (FileNotFoundException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
int result = JOptionPane.showConfirmDialog(null, "If project stations?", "Confirm", JOptionPane.YES_NO_CANCEL_OPTION);
if (result == JOptionPane.YES_OPTION) {
try {
LonLatStationDataInfo aDataInfo = new LonLatStationDataInfo();
aDataInfo.readDataInfo(inFile);
StationData inStData = aDataInfo.getNullStationData();
ProjectionInfo fromProj = KnownCoordinateSystems.geographic.world.WGS1984;
//StationData midStData = inStData.project(fromProj, projInfo);
//StationData outStData = ((GridData) _data).toStation(midStData);
inStData.projInfo = fromProj;
StationData outStData = ((GridData)_data).toStation(inStData);
outStData.saveAsCSVFile(fileName, "data");
} catch (FileNotFoundException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
try {
((GridData) _data).toStation(inFile, fileName);
} catch (FileNotFoundException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(FrmViewData.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
this.setCursor(Cursor.getDefaultCursor());
}
}
}//GEN-LAST:event_jButton_ToStationActionPerformed
private void jButton_SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SaveActionPerformed
// TODO add your handling code here:
String path = System.getProperty("user.dir");
File pathDir = new File(path);
JFileChooser outDlg = new JFileChooser();
outDlg.setCurrentDirectory(pathDir);
String[] fileExts;
GenericFileFilter txtFileFilter;
if (this._data instanceof GridData) {
fileExts = new String[]{"dat"};
txtFileFilter = new GenericFileFilter(fileExts, "Surfer ASCII file (*.dat)");
} else {
fileExts = new String[]{"csv"};
txtFileFilter = new GenericFileFilter(fileExts, "CSV file (*.csv)");
}
outDlg.setFileFilter(txtFileFilter);
outDlg.setAcceptAllFileFilterUsed(false);
if (JFileChooser.APPROVE_OPTION == outDlg.showSaveDialog(this)) {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String fileName = outDlg.getSelectedFile().getAbsolutePath();
String extent = ((GenericFileFilter) outDlg.getFileFilter()).getFileExtent();
if (!fileName.substring(fileName.length() - extent.length()).equals(extent)) {
fileName = fileName + "." + extent;
}
if (this._data instanceof GridData) {
((GridData) this._data).saveAsSurferASCIIFile(fileName);
} else {
((StationData) this._data).saveAsCSVFile(fileName, this._colNames[this._colNames.length - 1]);
}
this.setCursor(Cursor.getDefaultCursor());
}
}//GEN-LAST:event_jButton_SaveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmViewData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmViewData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmViewData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmViewData.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmViewData().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Chart;
private javax.swing.JButton jButton_Save;
private javax.swing.JButton jButton_Stat;
private javax.swing.JButton jButton_ToStation;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JToolBar.Separator jSeparator1;
private javax.swing.JTable jTable1;
private javax.swing.JToolBar jToolBar1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton_Zoom" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="65" max="-2" attributes="0"/>
<Component id="jButton_Close" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="69" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton_Zoom" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton_Close" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Lon/Lat Extent"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MinLon" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MinLat" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MaxLat" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField_MaxLon" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinLon" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxLon" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MaxLat" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField_MinLat" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Min Lon:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinLon">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Max Lon:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxLon">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Min Lat:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MinLat">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Max Lat:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_MaxLat">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton_Zoom">
<Properties>
<Property name="text" type="java.lang.String" value="Zoom"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ZoomActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton_Close">
<Properties>
<Property name="text" type="java.lang.String" value="Close"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_CloseActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,288 @@
/* Copyright 2012 Yaqiang Wang,
* yaqiang.wang@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*/
package org.meteoinfo.desktop.forms;
import org.meteoinfo.global.Extent;
import org.meteoinfo.map.MapView;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class FrmZoomToExtent extends javax.swing.JDialog {
private final FrmMain parent;
/**
* Creates new form FrmZoomToExtent
* @param parent
* @param modal
*/
public FrmZoomToExtent(java.awt.Frame parent, boolean modal) {
super(parent, modal);
this.parent = (FrmMain) parent;
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextField_MinLon = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField_MaxLon = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField_MinLat = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField_MaxLat = new javax.swing.JTextField();
jButton_Zoom = new javax.swing.JButton();
jButton_Close = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Lon/Lat Extent"));
jLabel1.setText("Min Lon:");
jTextField_MinLon.setText("jTextField1");
jLabel2.setText("Max Lon:");
jTextField_MaxLon.setText("jTextField1");
jLabel3.setText("Min Lat:");
jTextField_MinLat.setText("jTextField1");
jLabel4.setText("Max Lat:");
jTextField_MaxLat.setText("jTextField1");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MinLon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MinLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MaxLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField_MaxLon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField_MinLon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jTextField_MaxLon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTextField_MaxLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField_MinLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton_Zoom.setText("Zoom");
jButton_Zoom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ZoomActionPerformed(evt);
}
});
jButton_Close.setText("Close");
jButton_Close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_CloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_Zoom)
.addGap(65, 65, 65)
.addComponent(jButton_Close)
.addGap(69, 69, 69))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_Zoom)
.addComponent(jButton_Close))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
double minLon, maxLon, minLat, maxLat;
MapView mapView = ((FrmMain) parent).getMapDocument().getActiveMapFrame().getMapView();
if (mapView.getProjection().isLonLatMap()) {
minLon = mapView.getViewExtent().minX;
maxLon = mapView.getViewExtent().maxX;
minLat = mapView.getViewExtent().minY;
maxLat = mapView.getViewExtent().maxY;
} else {
minLon = 0;
maxLon = 0;
minLat = 0;
maxLat = 0;
}
this.jTextField_MinLon.setText(String.format("%.2f", minLon));
this.jTextField_MaxLon.setText(String.format("%.2f", maxLon));
this.jTextField_MinLat.setText(String.format("%.2f", minLat));
this.jTextField_MaxLat.setText(String.format("%.2f", maxLat));
}//GEN-LAST:event_formWindowOpened
private void jButton_ZoomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ZoomActionPerformed
// TODO add your handling code here:
//Check lon/lat set
double minLon, maxLon, minLat, maxLat;
minLon = Double.parseDouble(this.jTextField_MinLon.getText());
maxLon = Double.parseDouble(this.jTextField_MaxLon.getText());
minLat = Double.parseDouble(this.jTextField_MinLat.getText());
maxLat = Double.parseDouble(this.jTextField_MaxLat.getText());
if (minLon >= maxLon || minLat >= maxLat) {
JOptionPane.showMessageDialog(this, "Lon/Lat set error!", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
//Zoom to lon/lat extent
Extent aExtent = new Extent();
aExtent.minX = minLon;
aExtent.maxX = maxLon;
aExtent.minY = minLat;
aExtent.maxY = maxLat;
FrmMain frmMain = (FrmMain) parent;
if (frmMain.getMainTab().getSelectedIndex() == 0) {
frmMain.getMapDocument().getActiveMapFrame().getMapView().zoomToExtentLonLatEx(aExtent);
} else if (frmMain.getMainTab().getSelectedIndex() == 1) {
frmMain.getMapDocument().getMapLayout().getActiveLayoutMap().zoomToExtentLonLatEx(aExtent);
frmMain.getMapDocument().getMapLayout().paintGraphics();
}
}//GEN-LAST:event_jButton_ZoomActionPerformed
private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton_CloseActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmZoomToExtent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmZoomToExtent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmZoomToExtent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmZoomToExtent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
FrmZoomToExtent dialog = new FrmZoomToExtent(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_Close;
private javax.swing.JButton jButton_Zoom;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField_MaxLat;
private javax.swing.JTextField jTextField_MaxLon;
private javax.swing.JTextField jTextField_MinLat;
private javax.swing.JTextField jTextField_MinLon;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,336 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import groovy.lang.GroovyShell;
import groovy.lang.Script;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.codehaus.groovy.control.CompilationFailedException;
import org.meteoinfo.global.DataConvert;
import org.meteoinfo.global.util.FontUtil;
import org.meteoinfo.global.util.GlobalUtil;
import org.python.core.PyString;
import org.python.core.PySystemState;
import org.python.util.InteractiveConsole;
import org.python.util.PythonInterpreter;
/**
*
* @author yaqiang
*/
public class Program {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
//registerFonts();
if (args.length >= 1){
if (args[0].equalsIgnoreCase("-r")) {
String fontPath = GlobalUtil.getAppPath(FrmMain.class) + File.separator + "fonts";
//fontPath = "D:\\MyProgram\\java\\MeteoInfoDev\\MeteoInfo\\fonts";
List<String> fontFns = GlobalUtil.getFiles(fontPath, ".ttc");
for (String fontFn : fontFns){
System.out.println("Register: " + fontFn);
FontUtil.registerFont(fontFn);
}
args = (String[])DataConvert.resizeArray(args, args.length - 1);
}
}
if (args.length >= 1) {
if (args[0].equalsIgnoreCase("-e")) {
runTextEditor(args);
} else if (args[0].equalsIgnoreCase("-i")) {
runInteractive();
} else if (args[0].equalsIgnoreCase("-b")) {
if (args.length == 1) {
System.out.println("Script file name is needed!");
System.exit(0);
} else {
String fn = args[1];
if (new File(fn).isFile()) {
System.setProperty("java.awt.headless", "true");
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
System.out.println("Headless mode: " + ge.isHeadless());
runScript(args, fn, 1);
} else {
System.out.println("The script file does not exist!");
System.exit(0);
}
}
} else if (args[0].equalsIgnoreCase("-eng") || args[0].equalsIgnoreCase("-cn")) {
runApplication(args[0].substring(1));
} else if (args[0].equalsIgnoreCase("-r")) {
String fontPath = GlobalUtil.getAppPath(FrmMain.class) + File.separator + "fonts";
//fontPath = "D:\\MyProgram\\java\\MeteoInfoDev\\MeteoInfo\\fonts";
List<String> fontFns = GlobalUtil.getFiles(fontPath, ".ttc");
for (String fontFn : fontFns){
System.out.println("Register: " + fontFn);
FontUtil.registerFont(fontFn);
}
runApplication();
} else {
String fn = args[0];
if (new File(fn).isFile()) {
runScript(args, fn, 0);
} else {
System.out.println("The script file does not exist!");
System.exit(0);
}
}
} else {
runApplication();
}
}
private static void runScript(String args[], String fn, int idx) {
try {
String ext = GlobalUtil.getFileExtension(fn);
if (ext.equals("groovy")) {
System.out.println("Running Groovy script...");
GroovyShell shell = new GroovyShell();
//shell.setVariable("miapp", new FrmMainOld());
Script script = shell.parse(new File(fn));
script.run();
System.exit(0);
} else if (ext.equals("py")) {
System.out.println("Running Jython script...");
//PySystemState state = Py.getSystemState();
//Py.getSystemState().setdefaultencoding("utf-8");
PySystemState state = new PySystemState();
//state.setdefaultencoding("utf-8");
if (args.length > idx + 1) {
for (int i = idx + 1; i < args.length; i++) {
state.argv.append(new PyString(args[i]));
}
}
PythonInterpreter interp = new PythonInterpreter(null, state);
String pluginPath = GlobalUtil.getAppPath(FrmMain.class) + File.separator + "plugins";
List<String> jarfns = GlobalUtil.getFiles(pluginPath, ".jar");
String path = GlobalUtil.getAppPath(FrmMain.class) + File.separator + "pylib";
interp.exec("import sys");
//interp.set("mis", mis);
interp.exec("sys.path.append('" + path + "')");
//interp.exec("import mipylib");
//interp.exec("from mipylib.miscript import *");
//interp.exec("from meteoinfo.numeric.JNumeric import *");
for (String jarfn : jarfns) {
interp.exec("sys.path.append('" + jarfn + "')");
}
interp.execfile(fn);
System.exit(0);
}
} catch (CompilationFailedException ex) {
Logger.getLogger(Program.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Program.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static void runInteractive() {
//String path = GlobalUtil.getAppPath(FrmMain.class) + File.separator + "pylib";
InteractiveConsole console = new InteractiveConsole();
try {
//console.set("mis", mis);
console.exec("import sys");
//console.exec("sys.path.append('" + path + "')");
//console.exec("from milab import *");
//console.exec("mipylib.miplot.isinteractive = True");
} catch (Exception e) {
e.printStackTrace();
}
console.interact();
}
private static void runTextEditor(final String args[]) {
/* Set look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
//UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmTextEditor frmTE = new FrmTextEditor();
frmTE.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frmTE.setLocationRelativeTo(null);
frmTE.setVisible(true);
if (args.length > 1) {
String fn = args[1];
if (new File(fn).isFile()) {
frmTE.openFiles(new File[]{new File(fn)});
}
}
}
});
}
private static void runApplication() {
runApplication(null);
}
private static void runApplication(final String locale) {
/* Set look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//WebLookAndFeel.install();
//UIManager.setLookAndFeel("com.alee.laf.WebLookAndFeel");
//com.jtattoo.plaf.acryl.AcrylLookAndFeel.setTheme("Green", "INSERT YOUR LICENSE KEY HERE", "my company");
//UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");
//UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
//UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
//UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmTextEditor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
// System.setProperty("Quaqua.tabLayoutPolicy", "wrap");
// try {
// JFrame.setDefaultLookAndFeelDecorated(true);
// JDialog.setDefaultLookAndFeelDecorated(true);
// UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
// } catch (Exception e) {
// }
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// new Thread() {
// @Override
// public void run() {
// try {
// final SplashScreen splash = SplashScreen.getSplashScreen();
// if (splash == null){
// System.out.println("SplashScreen.getSplashScreen() returned null");
// return;
// }
// Graphics2D g = splash.createGraphics();
// g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// g.setFont(new Font("Arial", Font.BOLD, 60));
// g.setColor(Color.red);
// g.drawString("MeteoInfo", 100, 200);
// splash.update();
// Thread.sleep(1000);
// //splash.setImageURL(Program.class.getResource("/meteoinfo/resources/logo.png"));
// //splash.update();
// } catch (Exception e) {
// }
// }
// }.start();
boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
getInputArguments().toString().contains("jdwp");
// if (isDebug) {
// Locale.setDefault(Locale.ENGLISH);
// }
if (locale != null){
switch (locale.toLowerCase()){
case "eng":
Locale.setDefault(Locale.ENGLISH);
break;
case "cn":
Locale.setDefault(Locale.CHINA);
break;
}
}
StackWindow sw = null;
if (!isDebug) {
sw = new StackWindow("Show Exception Stack", 600, 400);
Thread.UncaughtExceptionHandler handler = sw;
Thread.setDefaultUncaughtExceptionHandler(handler);
System.setOut(sw.printStream);
System.setErr(sw.printStream);
}
//registerFonts();
org.meteoinfo.global.util.FontUtil.registerWeatherFont();
FrmMain frame = new FrmMain();
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
//frame.setLocationRelativeTo(null);
frame.setVisible(true);
if (sw != null) {
sw.setLocationRelativeTo(frame);
}
}
});
}
private static void registerFonts() {
FontUtil.registerWeatherFont();
String fn = GlobalUtil.getAppPath(FrmMain.class);
//fn = fn.substring(0, fn.lastIndexOf("/"));
String path = fn + File.separator + "font";
File pathDir = new File(path);
if (pathDir.isDirectory()) {
File[] files = pathDir.listFiles();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (File file : files) {
try {
Font font = Font.createFont(Font.TRUETYPE_FONT, file);
ge.registerFont(font);
} catch (FontFormatException ex) {
Logger.getLogger(Program.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Program.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}

View File

@ -0,0 +1,100 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.SortedMap;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.meteoinfo.io.IOUtil;
/**
*
* @author Yaqiang Wang
*/
public class ShapeFileChooser extends JFileChooser {
JComboBox encodingCB;
JPanel panel;
/**
* Constructor
*/
public ShapeFileChooser() {
super();
encodingCB = new JComboBox();
SortedMap m = Charset.availableCharsets();
DefaultComboBoxModel cbm = new DefaultComboBoxModel();
cbm.addElement("System");
Iterator ir = m.keySet().iterator();
while (ir.hasNext()) {
String n = (String) ir.next();
Charset e = (Charset) m.get(n);
cbm.addElement(e.displayName());
}
encodingCB.setModel(cbm);
panel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.WEST;
constraints.insets = new Insets(5, 10, 0, 0);
constraints.gridx = 0;
constraints.gridy = 0;
panel.add(new JLabel("Encoding:"), constraints);
constraints.gridy = 1;
panel.add(encodingCB, constraints);
setAccessory(panel);
//panel.setVisible(false);
this.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent pce) {
String prop = pce.getPropertyName();
//If a file became selected, find out which one.
if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
File file = (File) pce.getNewValue();
if (file != null && file.isFile()){
String fn = file.getAbsolutePath();
if (fn.toLowerCase().endsWith(".shp")) {
String encoding = IOUtil.encodingDetectShp(fn);
if (encoding.equals("ISO8859_1"))
encoding = "UTF-8";
encodingCB.setSelectedItem(encoding);
panel.setVisible(true);
} else {
panel.setVisible(false);
}
repaint();
}
}
}
});
}
/**
* Get encoding string
*
* @return Encoding string
*/
public String getEncoding() {
String encoding = this.encodingCB.getSelectedItem().toString();
if (encoding.equals("System")) {
encoding = Charset.defaultCharset().displayName();
}
return encoding;
}
}

View File

@ -0,0 +1,69 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.meteoinfo.desktop.forms;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.meteoinfo.desktop.config.JTextAreaPrintStream;
/**
*
* @author wyq
*/
public class StackWindow extends JFrame implements Thread.UncaughtExceptionHandler {
private final JTextArea textArea;
JTextAreaPrintStream printStream;
public StackWindow(
String title, final int width, final int height) {
super(title);
setSize(width, height);
textArea = new JTextArea();
JScrollPane pane = new JScrollPane(textArea);
textArea.setEditable(false);
getContentPane().add(pane);
printStream = new JTextAreaPrintStream(System.out, textArea);
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
}
@Override
public void uncaughtException(Thread t, Throwable e) {
addStackInfo(e);
}
public void addStackInfo(final Throwable t) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// Bring window to foreground
setVisible(true);
toFront();
// Convert stack dump to string
//StringWriter sw = new StringWriter();
//PrintWriter out = new PrintWriter(sw);
//t.printStackTrace(out);
// Add string to end of text area
//textArea.append(sw.toString());
t.printStackTrace(printStream);
textArea.setCaretPosition(0);
}
});
}
private void formWindowClosed(java.awt.event.WindowEvent evt){
textArea.setText("");
}
}

View File

@ -0,0 +1,128 @@
FrmMain.jButton_NewPolyline.toolTipText=New Polyline
FrmMain.jButton_NewCurvePolygon.toolTipText=New Curve Polygon
FrmMain.jButton_NewPolygon.toolTipText=New Polygon
FrmMain.jButton_NewCurve.toolTipText=New Curve
FrmMain.jButton_NewFreehand.toolTipText=New Freehand
FrmMain.jButton_SavePicture.toolTipText=Save Picture
FrmMain.jButton_NewLabel.toolTipText=New Label
FrmMain.jButton_NewPoint.toolTipText=New Point
FrmMain.jButton_PageSet.toolTipText=Page Set
FrmMain.jButton_PageZoomOut.toolTipText=Zoom Out Page
FrmMain.jButton_PageZoomIn.toolTipText=Zoom In Page
FrmMain.jButton_FitToScreen.toolTipText=Zoom Fit to Screen
FrmMain.jButton_NewRectangle.toolTipText=New Rectangle
FrmMain.jButton_NewCircle.toolTipText=New Circle
FrmMain.jButton_NewEllipse.toolTipText=New Ellipse
FrmMain.jButton_EditVertices.toolTipText=Edit Vertices
FrmMain.jMenuItem_PluginManager.text=Plugin Manager
FrmMain.jPanel_LayoutTab.TabConstraints.tabTitle=Layout
FrmMain.jMenuItem_About.text=About
# To change this template, choose Tools | Templates
# and open the template in the editor.
FrmMain.jMenu_Help.text=Help
FrmMain.jPanel_MapTab.TabConstraints.tabTitle=Map
FrmMain.jMenuItem_Help.text=Help
FrmMain.jMenuItem_SaveAs.text=Save As
FrmMain.jMenuItem_Save.text=Save
FrmMain.jMenuItem_Layers.text=Layers
FrmMain.jMenu_View.text=View
FrmMain.jMenuItem_Open.text=Open
FrmMain.jMenu_Project.text=Project
FrmMain.jMenu_Plugin.text=Plugin
FrmMain.jMenu_GeoProcessing.text=GeoProcessing
FrmMain.jMenuItem_Buffer.text=Buffer
FrmMain.jMenuItem_Clipping.text=Clipping
FrmMain.jMenuItem_Convexhull.text=Convexhull
FrmMain.jMenuItem_Intersection.text=Intersection
FrmMain.jMenuItem_Difference.text=Difference
FrmMain.jMenuItem_SymDifference.text=Symmetrical Difference
FrmMain.jMenuItem_ClearSelection.text=Clear Selected Features
FrmMain.jMenuItem_Script.text=Script Editor
FrmMain.jMenuItem_ScriptConsole.text=Script Console
FrmMain.jMenu_Tools.text=Tools
FrmMain.jMenuItem_Options.text=Options
FrmMain.jLabel_Status.text=...
FrmMain.jLabel_Coordinate.text=...
FrmMain.jMenuItem_OutputMapData.text=Ouput Map Data
FrmMain.jMenuItem_AddXYData.text=Add X/Y Data
FrmMain.jMenuItem_Animator.text=Gif Animator
FrmMain.jMenu_NetCDFData.text=NetCDF Data
FrmMain.jMenuItem_JoinNCFiles.text=Join NetCDF Files
FrmMain.jMenuItem_AttributeData.text=Attribute Data
FrmMain.jMenu_Edit.text=Edit
FrmMain.jMenuItem_Undo.text=Undo
FrmMain.jMenuItem_Redo.text=Redo
FrmMain.jMenuItem_Cut.text=Cut
FrmMain.jMenuItem_Copy.text=Copy
FrmMain.jMenuItem_Paste.text=Paste
FrmMain.jMenuItem_NewLayer.text=Creat New Layer
FrmMain.jMenuItem_AddRing.text=Add Hole
FrmMain.jMenuItem_FillRing.text=Fill Hole
FrmMain.jMenuItem_DeleteRing.text=Delete Hole
FrmMain.jMenuItem_ReformFeature.text=Reform Feature
FrmMain.jMenuItem_SplitFeature.text=Split Feature
FrmMain.jMenuItem_MergeFeature.text=Merge Selected Features
# To change this template, choose Tools | Templates
# and open the template in the editor.
FrmMain.jMenuItem_LayoutProperty.text=Layout Property
FrmMain.jMenuItem_MapProperty.text=Map Property
FrmMain.jMenuItem_MaskOut.text=Mask Out
FrmMain.jMenuItem_Projection.text=Projection
FrmMain.jMenu_Insert.text=Insert
FrmMain.jMenuItem_InsertMapFrame.text=Map Frame
FrmMain.jMenuItem_InsertText.text=Text
FrmMain.jMenuItem_InsertLegend.text=Legend
FrmMain.jMenuItem_InsertTitle.text=Title
FrmMain.jMenuItem_InsertScaleBar.text=Scale Bar
FrmMain.jMenuItem_InsertNorthArrow.text=North Arrow
FrmMain.jMenuItem_InsertWindArrow.text=Wind Arrow
FrmMain.jMenu_Selection.text=Selection
FrmMain.jMenuItem_SelByAttr.text=Select By Attribute
FrmMain.jMenuItem_SelByLocation.text=Select By Location
FrmMain.jButton_SelectElement.toolTipText=Select Element
FrmMain.jButton_RemoveDataLayers.toolTipText=Remove Data Layers
FrmMain.jButton_OpenData.toolTipText=Open Data
FrmMain.jButton_AddLayer.toolTipText=Add Layer
FrmMain.jButton_SelectFeature.toolTipText_Rectangle=Select Features by Rectangle
FrmMain.jButton_SelectFeature.toolTipText_Polygon=Select Features by Polygon
FrmMain.jButton_SelectFeature.toolTipText_Lasso=Select Features by Lasso
FrmMain.jButton_SelectFeature.toolTipText_Circle=Select Features by Circle
FrmMain.jMenuItem_SelByRectangle.text=Select by Rectangle
FrmMain.jMenuItem_SelByPolygon.text=Select by Polygon
FrmMain.jMenuItem_SelByLasso.text=Select by Lasso
FrmMain.jMenuItem_SelByCircle.text=Select by Circle
FrmMain.jButton_Measurement.toolTipText=Measurement
FrmMain.jButton_LabelSet.toolTipText=Set Label
FrmMain.jButton_ZoomToExtent.toolTipText=Zoom To Extent
FrmMain.jButton_ZoomToLayer.toolTipText=Zoom To Layer
FrmMain.jButton_ZoomUndo.toolTipText=To Next View
FrmMain.jButton_ZoomRedo.toolTipText=To Previous View
FrmMain.jButton_Identifer.toolTipText=Ientifer
FrmMain.jButton_ZoomOut.toolTipText=Zoom Out
FrmMain.jButton_ZoomIn.toolTipText=Zoom In
FrmMain.jButton_FullExtent.toolTipText=Full Extent
FrmMain.jButton_Pan.toolTipText=Pan
FrmMain.jButton_EditStartOrEnd.toolTipText=Switch Edit Status
FrmMain.jButton_EditSave.toolTipText=Save Edit
FrmMain.jButton_EditNewFeature.toolTipText=Add New Feature
FrmMain.jButton_EditRemoveFeature.toolTipText=Remove Selected Features
FrmMain.jButton_EditFeatureVertices.toolTipText=Edit Feature Vertices
FrmMain.jButton_EditTool.toolTipText=Edit Tool
FrmOneDim.jCheckBox_YReverse.text=Y_Reverse
FrmOneDim.jLabel_DrawType.text=DrawType:
FrmOneDim.jLabel_PlotDims.text=PlotDims:
FrmOneDim.jCheckBox_Level.text=Level
FrmOneDim.jCheckBox_Lon.text=Lon/X
FrmOneDim.jCheckBox_Lat.text=Lat/Y
FrmOneDim.title=One Dimension Chart
FrmOneDim.jLabel_Variable.text=Var:
FrmOneDim.jCheckBox_Time.text=Time
FrmOneDim.jPanel_Dimensions.border.title=Dimensions

View File

@ -0,0 +1,108 @@
FrmMain.jButton_NewPolyline.toolTipText=\u6dfb\u52a0\u7ebf
FrmMain.jButton_NewCurvePolygon.toolTipText=\u6dfb\u52a0\u66f2\u7ebf\u591a\u8fb9\u5f62
FrmMain.jButton_NewPolygon.toolTipText=\u6dfb\u52a0\u591a\u8fb9\u5f62
FrmMain.jButton_NewCurve.toolTipText=\u6dfb\u52a0\u66f2\u7ebf
FrmMain.jButton_NewFreehand.toolTipText=\u6dfb\u52a0\u624b\u7ed8\u7ebf
FrmMain.jButton_SavePicture.toolTipText=\u4fdd\u5b58\u56fe\u5f62\u6587\u4ef6
FrmMain.jButton_NewLabel.toolTipText=\u6dfb\u52a0\u6807\u6ce8
FrmMain.jButton_NewPoint.toolTipText=\u6dfb\u52a0\u70b9
FrmMain.jButton_PageSet.toolTipText=\u9875\u9762\u8bbe\u7f6e
FrmMain.jButton_PageZoomOut.toolTipText=\u7f29\u5c0f\u9875\u9762
FrmMain.jButton_PageZoomIn.toolTipText=\u653e\u5927\u9875\u9762
FrmMain.jButton_FitToScreen.toolTipText=\u7f29\u653e\u81f3\u7a97\u53e3\u8303\u56f4
FrmMain.jButton_NewRectangle.toolTipText=\u6dfb\u52a0\u957f\u65b9\u5f62
FrmMain.jButton_NewCircle.toolTipText=\u6dfb\u52a0\u5706
FrmMain.jButton_NewEllipse.toolTipText=\u6dfb\u52a0\u692d\u5706
FrmMain.jButton_EditVertices.toolTipText=\u7f16\u8f91\u8282\u70b9
FrmMain.jPanel_LayoutTab.TabConstraints.tabTitle=\u7248\u9762
FrmMain.jMenuItem_About.text=\u5173\u4e8e
FrmMain.jMenu_Help.text=\u5e2e\u52a9(H)
FrmMain.jPanel_MapTab.TabConstraints.tabTitle=\u5730\u56fe
FrmMain.jMenuItem_Help.text=\u5e2e\u52a9
FrmMain.jMenuItem_SaveAs.text=\u53e6\u5b58\u9879\u76ee
FrmMain.jMenuItem_Save.text=\u4fdd\u5b58\u9879\u76ee
FrmMain.jMenuItem_Layers.text=\u56fe\u5c42
FrmMain.jMenu_View.text=\u663e\u793a(V)
FrmMain.jMenuItem_Open.text=\u6253\u5f00\u9879\u76ee
FrmMain.jMenu_Project.text=\u9879\u76ee(P)
FrmMain.jMenu_GeoProcessing.text=\u7a7a\u95f4\u5206\u6790(G)
FrmMain.jMenuItem_Buffer.text=\u7f13\u51b2\u533a\u5206\u6790
FrmMain.jMenuItem_Clipping.text=\u88c1\u526a
FrmMain.jMenuItem_Convexhull.text=\u51f8\u5305
FrmMain.jMenuItem_Intersection.text=\u4ea4\u96c6\u64cd\u4f5c
FrmMain.jMenuItem_Difference.text=\u5dee\u503c
FrmMain.jMenuItem_SymDifference.text=\u5bf9\u79f0\u5dee\u503c
FrmMain.jMenu_Plugin.text=\u63d2\u4ef6(L)
FrmMain.jMenuItem_ClearSelection.text=\u6e05\u9664\u88ab\u9009\u56fe\u5143
FrmMain.jMenuItem_Script.text=\u811a\u672c\u7f16\u8f91\u5668
FrmMain.jMenuItem_ScriptConsole.text=\u811a\u672c\u63a7\u5236\u53f0
FrmMain.jMenu_Tools.text=\u5de5\u5177(T)
FrmMain.jMenuItem_Options.text=\u9009\u9879
FrmMain.jMenuItem_OutputMapData.text=\u8f93\u51fa\u5730\u56fe\u6570\u636e
FrmMain.jMenuItem_AddXYData.text=\u6dfb\u52a0X/Y\u6570\u636e
FrmMain.jMenuItem_Animator.text=Gif\u52a8\u753b
FrmMain.jMenu_NetCDFData.text=NetCDF\u6570\u636e
FrmMain.jMenuItem_JoinNCFiles.text=\u5408\u5e76NetCDF\u6570\u636e\u6587\u4ef6
FrmMain.jMenuItem_AttributeData.text=\u56fe\u5c42\u5c5e\u6027\u6570\u636e
FrmMain.jMenu_Edit.text=\u7f16\u8f91(E)
FrmMain.jMenuItem_Undo.text=\u64a4\u9500
FrmMain.jMenuItem_Redo.text=\u6062\u590d
FrmMain.jMenuItem_Cut.text=\u526a\u5207
FrmMain.jMenuItem_Copy.text=\u590d\u5236
FrmMain.jMenuItem_Paste.text=\u7c98\u8d34
FrmMain.jMenuItem_NewLayer.text=\u521b\u5efa\u65b0\u56fe\u5c42
FrmMain.jMenuItem_AddRing.text=\u6dfb\u52a0\u6d1e
FrmMain.jMenuItem_FillRing.text=\u586b\u5145\u6d1e
FrmMain.jMenuItem_DeleteRing.text=\u5220\u9664\u6d1e
FrmMain.jMenuItem_ReformFeature.text=\u91cd\u5851\u8981\u7d20
FrmMain.jMenuItem_SplitFeature.text=\u5206\u5272\u8981\u7d20
FrmMain.jMenuItem_MergeFeature.text=\u5408\u5e76\u9009\u4e2d\u7684\u8981\u7d20
# To change this template, choose Tools | Templates
# and open the template in the editor.
FrmMain.jMenuItem_LayoutProperty.text=\u7248\u9762\u5c5e\u6027
FrmMain.jMenuItem_MapProperty.text=\u5730\u56fe\u5c5e\u6027
FrmMain.jMenuItem_MaskOut.text=\u5c4f\u853d\u5916\u90e8\u56fe\u5f62
FrmMain.jMenuItem_Projection.text=\u6295\u5f71
FrmMain.jMenu_Insert.text=\u63d2\u5165(I)
FrmMain.jMenuItem_InsertMapFrame.text=\u56fe\u5f62\u6846\u67b6
FrmMain.jMenuItem_InsertText.text=\u6587\u5b57
FrmMain.jMenuItem_InsertLegend.text=\u56fe\u4f8b
FrmMain.jMenuItem_InsertTitle.text=\u6807\u9898
FrmMain.jMenuItem_InsertScaleBar.text=\u6bd4\u4f8b\u5c3a
FrmMain.jMenuItem_InsertNorthArrow.text=\u6307\u5317\u9488
FrmMain.jMenuItem_InsertWindArrow.text=\u98ce\u7bad\u5934
FrmMain.jMenu_Selection.text=\u9009\u62e9(S)
FrmMain.jMenuItem_SelByAttr.text=\u901a\u8fc7\u5c5e\u6027\u6570\u636e\u9009\u62e9
FrmMain.jMenuItem_SelByLocation.text=\u901a\u8fc7\u4f4d\u7f6e\u9009\u62e9
FrmMain.jButton_SelectElement.toolTipText=\u9009\u62e9
FrmMain.jButton_RemoveDataLayers.toolTipText=\u5220\u9664\u6570\u636e\u56fe\u5c42
FrmMain.jButton_OpenData.toolTipText=\u6253\u5f00\u6570\u636e\u6587\u4ef6
FrmMain.jButton_AddLayer.toolTipText=\u6dfb\u52a0\u56fe\u5c42
FrmMain.jButton_SelectFeature.toolTipText_Rectangle=\u901a\u8fc7\u77e9\u5f62\u9009\u62e9\u8981\u7d20
FrmMain.jButton_SelectFeature.toolTipText_Polygon=\u901a\u8fc7\u591a\u8fb9\u5f62\u9009\u62e9\u8981\u7d20
FrmMain.jButton_SelectFeature.toolTipText_Lasso=\u901a\u8fc7\u5957\u7d22\u9009\u62e9\u8981\u7d20
FrmMain.jButton_SelectFeature.toolTipText_Circle=\u901a\u8fc7\u5706\u9009\u62e9\u8981\u7d20
FrmMain.jMenuItem_SelByRectangle.text=\u6309\u77e9\u5f62\u9009\u62e9
FrmMain.jMenuItem_SelByPolygon.text=\u6309\u591a\u8fb9\u5f62\u9009\u62e9
FrmMain.jMenuItem_SelByLasso.text=\u6309\u5957\u7d22\u9009\u62e9
FrmMain.jMenuItem_SelByCircle.text=\u6309\u5706\u9009\u62e9
FrmMain.jButton_Measurement.toolTipText=\u6d4b\u91cf
FrmMain.jButton_LabelSet.toolTipText=\u6807\u6ce8
FrmMain.jButton_ZoomToExtent.toolTipText=\u81ea\u5b9a\u4e49\u8303\u56f4
FrmMain.jButton_ZoomToLayer.toolTipText=\u9009\u4e2d\u56fe\u5c42\u8303\u56f4
FrmMain.jButton_Identifer.toolTipText=\u8981\u7d20\u5c5e\u6027
FrmMain.jButton_ZoomOut.toolTipText=\u7f29\u5c0f
FrmMain.jButton_ZoomIn.toolTipText=\u653e\u5927
FrmMain.jButton_FullExtent.toolTipText=\u6240\u6709\u56fe\u5c42\u8303\u56f4
FrmMain.jButton_ZoomUndo.toolTipText=\u8fd4\u56de\u5230\u4e0a\u4e00\u89c6\u56fe
FrmMain.jButton_ZoomRedo.toolTipText=\u8f6c\u5230\u4e0b\u4e00\u89c6\u56fe
FrmMain.jButton_Pan.toolTipText=\u79fb\u52a8
FrmMain.jButton_EditStartOrEnd.toolTipText=\u5207\u6362\u7f16\u8f91\u72b6\u6001
FrmMain.jButton_EditSave.toolTipText=\u4fdd\u5b58\u7f16\u8f91\u5185\u5bb9
FrmMain.jButton_EditNewFeature.toolTipText=\u6dfb\u52a0\u8981\u7d20
FrmMain.jButton_EditRemoveFeature.toolTipText=\u5220\u9664\u9009\u4e2d\u8981\u7d20
FrmMain.jButton_EditFeatureVertices.toolTipText=\u7f16\u8f91\u8981\u7d20\u8282\u70b9
FrmMain.jButton_EditTool.toolTipText=\u7f16\u8f91\u5de5\u5177

View File

@ -0,0 +1,25 @@
FrmMeteoData.jButton_RemoveAllData.text=Remove All
FrmMeteoData.jCheckBox_ColorVar.text=Color
FrmMeteoData.jCheckBox_Smooth.text=Smooth
FrmMeteoData.jLabel4.text=Graph:
FrmMeteoData.jLabel2.text=Time:
FrmMeteoData.jLabel3.text=Level:
FrmMeteoData.jButton_OpenData.toolTipText=Open Data
FrmMeteoData.jButton_DataInfo.toolTipText=Show Data Infomation
FrmMeteoData.jButton_Draw.toolTipText=Draw Data
FrmMeteoData.jButton_ViewData.toolTipText=View Data
FrmMeteoData.jButton_ClearDraw.toolTipText=Clear Drawing
FrmMeteoData.jButton_PreTime.toolTipText=Previous Time
FrmMeteoData.jButton_NexTime.toolTipText=Next Time
FrmMeteoData.jButton_Animator.toolTipText=Animator
FrmMeteoData.jButton_CreateAnimatorFile.toolTipText=Create Animator File
FrmMeteoData.jButton_DrawSetting.toolTipText=Legend Setting
FrmMeteoData.jButton_Setting.toolTipText=Setting
FrmMeteoData.jButton_SectionPlot.toolTipText=Section Plot
FrmMeteoData.jButton_1DPlot.toolTipText=Chart
FrmMeteoData.jLabel_Variable.text=Variable:
FrmMeteoData.jCheckBox_Big_Endian.text=Big_Endian
FrmMeteoData.jSplitButton_Stat.toolTipText=Statistics
FrmMeteoData.jMenuItem_ArrivalTime.text=Arrival Times
FrmMeteoData.jMenu_OpenData.text=Open

View File

@ -0,0 +1,24 @@
FrmMeteoData.jButton_RemoveAllData.text=\u79fb\u9664\u5168\u90e8
FrmMeteoData.jCheckBox_ColorVar.text=\u7740\u8272
FrmMeteoData.jCheckBox_Smooth.text=\u5e73\u6ed1
FrmMeteoData.jLabel4.text=\u56fe\u5f62:
FrmMeteoData.jLabel2.text=\u65f6\u6b21:
FrmMeteoData.jLabel3.text=\u9ad8\u5ea6:
FrmMeteoData.jButton_OpenData.toolTipText=\u6253\u5f00\u6570\u636e\u6587\u4ef6
FrmMeteoData.jButton_DataInfo.toolTipText=\u663e\u793a\u6570\u636e\u4fe1\u606f
FrmMeteoData.jButton_Draw.toolTipText=\u7ed8\u5236\u6570\u636e\u56fe\u5f62
FrmMeteoData.jButton_ViewData.toolTipText=\u663e\u793a\u6570\u636e
FrmMeteoData.jButton_ClearDraw.toolTipText=\u5220\u9664\u6570\u636e\u56fe\u5f62
FrmMeteoData.jButton_PreTime.toolTipText=\u4e0a\u4e00\u65f6\u6b21
FrmMeteoData.jButton_NexTime.toolTipText=\u4e0b\u4e00\u65f6\u6b21
FrmMeteoData.jButton_Animator.toolTipText=\u52a8\u753b
FrmMeteoData.jButton_CreateAnimatorFile.toolTipText=\u521b\u5efa\u52a8\u753b\u6587\u4ef6
FrmMeteoData.jButton_DrawSetting.toolTipText=\u56fe\u4f8b\u8bbe\u7f6e
FrmMeteoData.jButton_Setting.toolTipText=\u8bbe\u7f6e
FrmMeteoData.jButton_SectionPlot.toolTipText=\u622a\u9762\u56fe
FrmMeteoData.jButton_1DPlot.toolTipText=\u4e00\u7ef4\u56fe
FrmMeteoData.jLabel_Variable.text=\u53d8\u91cf:
FrmMeteoData.jSplitButton_Stat.toolTipText=\u7edf\u8ba1
FrmMeteoData.jMenuItem_ArrivalTime.text=\u5230\u8fbe\u65f6\u95f4
FrmMeteoData.jMenu_OpenData.text=\u6253\u5f00

View File

@ -0,0 +1,13 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
FrmOneDim.jLabel_DrawType.text=DrawType:
FrmOneDim.jCheckBox_YReverse.text=Y_Reverse
FrmOneDim.jLabel_Variable.text=Variable:
FrmOneDim.jCheckBox_Lon.text=Lon/X
FrmOneDim.title=One Dimension Chart
FrmOneDim.jCheckBox_Lat.text=Lat/Y
FrmOneDim.jCheckBox_Level.text=Level
FrmOneDim.jCheckBox_Time.text=Time
FrmOneDim.jLabel_PlotDims.text=PlotDims:

View File

@ -0,0 +1,13 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
FrmOneDim.jLabel_DrawType.text=\u56fe\u5f62:
FrmOneDim.jCheckBox_YReverse.text=Y\u8f74\u53cd\u5411
FrmOneDim.jLabel_Variable.text=\u53d8\u91cf:
FrmOneDim.jCheckBox_Lon.text=\u7ecf\u5ea6/X
FrmOneDim.title=\u4e00\u7ef4\u56fe
FrmOneDim.jCheckBox_Lat.text=\u7eac\u5ea6/Y
FrmOneDim.jCheckBox_Level.text=\u9ad8\u5ea6
FrmOneDim.jCheckBox_Time.text=\u65f6\u95f4
FrmOneDim.jLabel_PlotDims.text=\u56fe\u5f62\u7ef4:

View File

@ -0,0 +1,12 @@
FrmProjection.jLabel_RefLat_1.text=Height of Orbit:
FrmProjection.jLabel_RefLat.text=Reference Latitude:
FrmProjection.jLabel_FalseNorthing.text=False Northing:
FrmProjection.jLabel_FalseEasting.text=False Easting:
FrmProjection.jLabel_StdPara2.text=Standard Paralle 2:
FrmProjection.jLabel1.text=Projection:
FrmProjection.jButton_Close.text=Close
FrmProjection.jLabel_CentralMeridian.text=Central Meridian:
FrmProjection.jPanel_Parameters.border.title=Parameters
FrmProjection.jLabel_ScaleFactor.text=Scale Factor:
FrmProjection.jLabel_StdPara1.text=Standard Parallel 1:
FrmProjection.jButton_Apply.text=Apply

View File

@ -0,0 +1,15 @@
FrmProjection.jLabel_RefLat_1.text=\u8f68\u9053\u9ad8\u5ea6:
FrmProjection.jLabel_FalseNorthing.text=\u5317\u79fb\u5047\u5b9a\u503c:
FrmProjection.jLabel_FalseEasting.text=\u4e1c\u79fb\u5047\u5b9a\u503c:
FrmProjection.jLabel_StdPara2.text=\u6807\u51c6\u7eac\u5ea6 2:
FrmProjection.jLabel1.text=\u6295\u5f71:
FrmProjection.jButton_Close.text=\u5173\u95ed
FrmProjection.jLabel_CentralMeridian.text=\u4e2d\u592e\u7ecf\u5ea6:
FrmProjection.jPanel_Parameters.border.title=\u53c2\u6570
FrmProjection.jLabel_ScaleFactor.text=\u6bd4\u4f8b\u56e0\u5b50:
# To change this template, choose Tools | Templates
# and open the template in the editor.
FrmProjection.jLabel_StdPara1.text=\u6807\u51c6\u7eac\u5ea6 1:
FrmProjection.jButton_Apply.text=\u5e94\u7528
FrmProjection.jLabel_RefLat.text=\u53c2\u8003\u7eac\u5ea6:

View File

@ -0,0 +1,17 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
FrmSectionPlot.jPanel_Layers.TabConstraints.tabTitle=Layers
FrmSectionPlot.jCheckBox_Level.text=Level
FrmSectionPlot.jCheckBox_Lat.text=Lat/Y
FrmSectionPlot.jCheckBox_Lon.text=Lon/X
FrmSectionPlot.jLabel3.text=DrawType:
FrmSectionPlot.jPanel_Setting.TabConstraints.tabTitle=Setting
FrmSectionPlot.jLabel_Variable.text=Var:
FrmSectionPlot.jCheckBox_ColorVar.text=ColorVar
FrmSectionPlot.jCheckBox_YReverse.text=Y_Reverse
FrmSectionPlot.jLabel4.text=PlotDims:
FrmSectionPlot.jCheckBox_Time.text=Time
FrmSectionPlot.jPanel1.border.title=Dimensions
FrmSectionPlot.title=Section Plot

View File

@ -0,0 +1,17 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
FrmSectionPlot.jPanel_Layers.TabConstraints.tabTitle=\u56fe\u5c42
FrmSectionPlot.jCheckBox_Level.text=\u9ad8\u5ea6
FrmSectionPlot.jCheckBox_Lat.text=\u7eac\u5ea6/Y
FrmSectionPlot.jCheckBox_Lon.text=\u7ecf\u5ea6/X
FrmSectionPlot.jLabel3.text=\u56fe\u5f62:
FrmSectionPlot.jPanel_Setting.TabConstraints.tabTitle=\u8bbe\u7f6e
FrmSectionPlot.jLabel_Variable.text=\u53d8\u91cf:
FrmSectionPlot.jCheckBox_ColorVar.text=\u7740\u8272
FrmSectionPlot.jCheckBox_YReverse.text=Y\u8f74\u53cd\u5411
FrmSectionPlot.jLabel4.text=\u56fe\u5f62\u7ef4:
FrmSectionPlot.jCheckBox_Time.text=\u65f6\u95f4
FrmSectionPlot.jPanel1.border.title=\u7ef4
FrmSectionPlot.title=\u622a\u9762\u56fe

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Some files were not shown because too many files have changed in this diff Show More