Revision 1121

View differences:

org.gvsig.raster.wcs/tags/buildNumber_19/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuración general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
org.gvsig.raster.wcs/tags/buildNumber_19/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<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">
3
	<modelVersion>4.0.0</modelVersion>
4
	<artifactId>org.gvsig.raster.wcs</artifactId>
5
	<packaging>pom</packaging>
6
	<version>2.0.0-SNAPSHOT</version>
7
	<name>org.gvsig.raster.wcs</name>
8
	<description>wcs client</description>
9
	<inceptionYear>2011</inceptionYear>
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>gvsig-base-pom</artifactId>
13
        <version>2.0-SNAPSHOT</version>
14
    </parent>	
15
	<properties>
16
		<build-dir>${basedir}/../..</build-dir>
17
	</properties>
18
	<modules>
19
		<module>org.gvsig.raster.wcs.io</module>
20
		<module>org.gvsig.raster.wcs.app</module>
21
	</modules>
22
</project>
0 23

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.raster.wcs.app</artifactId>
7
    <packaging>pom</packaging>
8
    <version>2.0.0-SNAPSHOT</version>
9
    <name>org.gvsig.raster.wcs.app</name>
10
    <description>WCS application</description>
11
    <parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
14
        <version>1.0.8-SNAPSHOT</version>
15
    </parent>
16

  
17
    <scm>
18
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wcs/trunk/org.gvsig.raster.wcs/org.gvsig.raster.wcs.app</connection>
19
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wcs/trunk/org.gvsig.raster.wcs/org.gvsig.raster.wcs.app</developerConnection>
20
        <url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.wcs/trunk/org.gvsig.raster.wcs/org.gvsig.raster.wcs.app</url>
21
    </scm>
22

  
23
    <developers>
24
        <developer>
25
            <id>nbrodin</id>
26
            <name>Nacho Brodin</name>
27
            <email>nachobrodin@gmail.com</email>
28
            <roles>
29
                <role>Architect</role>
30
                <role>Developer</role>
31
            </roles>
32
        </developer>
33
    </developers>
34
    <repositories>
35
        <repository>
36
            <id>gvsig-public-http-repository</id>
37
            <name>gvSIG maven public HTTP repository</name>
38
            <url>http://devel.gvsig.org/m2repo/j2se</url>
39
            <releases>
40
                <enabled>true</enabled>
41
                <updatePolicy>daily</updatePolicy>
42
                <checksumPolicy>warn</checksumPolicy>
43
            </releases>
44
            <snapshots>
45
                <enabled>true</enabled>
46
                <updatePolicy>daily</updatePolicy>
47
                <checksumPolicy>warn</checksumPolicy>
48
            </snapshots>
49
        </repository>
50
    </repositories>
51
    <dependencyManagement>
52
        <dependencies>
53
            <dependency>
54
                <groupId>org.gvsig</groupId>
55
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
56
                <type>pom</type>
57
                <version>2.0.1-SNAPSHOT</version>
58
                <scope>import</scope>
59
            </dependency>
60
        </dependencies>
61
    </dependencyManagement>
62
    <dependencies>
63
        <dependency>
64
            <groupId>org.gvsig</groupId>
65
            <artifactId>org.gvsig.andami</artifactId>
66
            <scope>compile</scope>
67
        </dependency>
68
        <dependency>
69
            <groupId>org.gvsig</groupId>
70
            <artifactId>org.gvsig.i18n</artifactId>
71
            <scope>compile</scope>
72
        </dependency>
73
        <dependency>
74
            <groupId>org.gvsig</groupId>
75
            <artifactId>org.gvsig.tools.lib</artifactId>
76
            <scope>compile</scope>
77
        </dependency>
78
        <dependency>
79
            <groupId>org.slf4j</groupId>
80
            <artifactId>slf4j-api</artifactId>
81
            <scope>compile</scope>
82
        </dependency>
83
        <dependency>
84
            <groupId>org.slf4j</groupId>
85
            <artifactId>slf4j-log4j12</artifactId>
86
            <scope>runtime</scope>
87
        </dependency>
88
    </dependencies>
89
    <modules>
90
        <module>org.gvsig.raster.wcs.app.wcsclient</module>
91
    </modules>
92
    <properties>
93
    	<package.info.state>devel</package.info.state>
94
    </properties>
95
</project>
0 96

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Mon Jun 25 09:21:36 CEST 2012
3
buildNumber=2
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
	</fileSets>
14
	<files>
15
	   <file>
16
          <source>package.info</source>
17
          <outputDirectory>${extension.install.dir.name}</outputDirectory>
18
       </file>
19
    </files>
20
	<dependencySets>
21
		<dependencySet>
22
			<outputDirectory>${extension.install.dir.name}/${library-dir}
23
			</outputDirectory>
24
			<includes>
25
				<include>org.gvsig:org.gvsig.raster.wcs.app.wcsclient:jar</include>
26
				<include>org.gvsig:org.gvsig.raster.wcs.io:jar</include>
27
				<include>org.gvsig:org.gvsig.remoteclient</include>
28
			</includes>
29
		</dependencySet>
30
	</dependencySets>
31
</assembly>
0 32

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Mon Jun 25 09:21:40 CEST 2012
3
buildNumber=19
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/test/java/org/gvsig/wcs/app/extension/gui/panel/TestParameterPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.wcs.app.extension.gui.panel;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.ParameterPanel;
24

  
25
public class TestParameterPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private ParameterPanel    desc     = null;
30

  
31
	public TestParameterPanel() {
32
		desc = new ParameterPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestParameterPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/test/java/org/gvsig/wcs/app/extension/gui/panel/TestFormatsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.wcs.app.extension.gui.panel;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.FormatPanel;
24

  
25
public class TestFormatsPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private FormatPanel       desc     = null;
30

  
31
	public TestFormatsPanel() {
32
		desc = new FormatPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestFormatsPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/test/java/org/gvsig/wcs/app/extension/gui/panel/TestInfoPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.wcs.app.extension.gui.panel;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.InfoPanel;
24

  
25
public class TestInfoPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private InfoPanel         desc     = null;
30

  
31
	public TestInfoPanel() {
32
		desc = new InfoPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestInfoPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/test/java/org/gvsig/wcs/app/extension/gui/panel/TestLayerPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.wcs.app.extension.gui.panel;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.LayerPanel;
24

  
25
public class TestLayerPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private LayerPanel        desc     = null;
30

  
31
	public TestLayerPanel() {
32
		desc = new LayerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestLayerPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/exception/WCSDriverExceptionType.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.wcs.app.wcsclient.exception;
23

  
24
import org.gvsig.remoteclient.wcs.WCSStatus;
25
import org.gvsig.utils.ExceptionDescription;
26

  
27

  
28
public class WCSDriverExceptionType extends ExceptionDescription {
29

  
30
	WCSStatus status;
31
	
32
	public WCSDriverExceptionType(){
33
		super(60, "Error al acceder a un servicio WCS");
34
		
35
	}
36
	
37
	public String getHtmlErrorMessage() {
38
		String message = "<p><b>Error en una petici?n a servidor WCS</b></p>";
39
		message += "Informaci?n adicional:<br>";
40
		message += "Mensaje del error: " + status.getMessage();
41
		message += "Direcci?n: " + status.getOnlineResource();
42
		message += "<br> Par?metros: "+status.getParameters();
43
		return message;
44
	}
45

  
46
	public WCSStatus getWcsStatus() {
47
		return status;
48
	}
49

  
50
	public void setWcsStatus(WCSStatus wcsStatus) {
51
		this.status = wcsStatus;
52
	}
53

  
54
}
55

  
0 56

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/toc/WCSZoomPixelCursorListener.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.wcs.app.wcsclient.gui.toc;
23

  
24
import java.awt.Cursor;
25
import java.awt.Image;
26
import java.awt.Point;
27
import java.awt.Toolkit;
28
import java.awt.geom.Point2D;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.fmap.dal.exception.ReadException;
32
import org.gvsig.fmap.geom.GeometryLocator;
33
import org.gvsig.fmap.geom.GeometryManager;
34
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
35
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
36
import org.gvsig.fmap.geom.primitive.Envelope;
37
import org.gvsig.fmap.mapcontext.ViewPort;
38
import org.gvsig.fmap.mapcontext.layers.FLayer;
39
import org.gvsig.fmap.mapcontrol.MapControl;
40
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
41
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
42
import org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener;
43
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS;
44

  
45

  
46
/**
47
 * <p>Listener that executes a <i>zoom in</i> operation in the associated <code>MapControl</code>,
48
 *  having as center the point selected.</p>
49
 * 
50
 * <p>Listens a single click of any mouse's button.</p>
51
 * 
52
 * <p>The <i>zoom in</i> factor will depend on the maximum resolution of the <i>WCS</i> layers in
53
 *  the <code>MapControl</code>.</p>
54
 *
55
 * @author Nacho Brodin (brodin_ign@gva.es)
56
 */
57
public class WCSZoomPixelCursorListener implements PointListener {
58
	private static final GeometryManager 	geomManager 				= GeometryLocator.getGeometryManager();
59
	/**
60
	 * Object used to log messages for this listener.
61
	 */
62
	//private static Logger 	logger = Logger.getLogger(WCSZoomPixelCursorListener.class.getName());
63

  
64
	/**
65
	 * The image to display when the cursor is active.
66
	 */	
67
	private final Image img = PluginServices.getIconTheme().get("view-previsualize-area").getImage();
68

  
69
	/**
70
	 * The cursor used to work with this tool listener.
71
	 * 
72
	 * @see #getCursor()
73
	 */ 
74
	private Cursor 			cur = Toolkit.getDefaultToolkit().createCustomCursor(	img,
75

  
76
	/**
77
	 * Reference to the <code>MapControl</code> object that uses.
78
	 */																					new Point(16, 16), "");
79
	private MapControl 		mapCtrl;
80

  
81
	/**
82
	 * <p>Creates a new <code>WCSZoomPixelCursorListener</code> object.</p>
83
	 * 
84
	 * @param mc the <code>MapControl</code> where be applied the changes
85
	 */
86
	public WCSZoomPixelCursorListener(MapControl mc) {
87
		this.mapCtrl = mc;
88
	}
89
	
90
	/*
91
	 * (non-Javadoc)
92
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
93
	 */
94
	public void point(PointEvent event) throws BehaviorException {
95
		Point2D pReal = mapCtrl.getMapContext().getViewPort().toMapPoint(event.getPoint());
96
		//Point imagePoint = new Point((int) event.getPoint().getX(), (int) event.getPoint().getY());
97
		ViewPort v = mapCtrl.getMapContext().getViewPort();
98

  
99
		FLayer[] actives = mapCtrl.getMapContext().getLayers().getActives();
100
		Envelope ext = null;
101

  
102
		try {
103
			ext = actives[0].getFullEnvelope();
104
		} catch (ReadException e) {
105
			throw new BehaviorException(e.getMessage());
106
		}
107

  
108
  		if(	ext != null ){
109

  
110
  	    	double w2 = v.getImageWidth()/2D;
111
  	    	double h2 = v.getImageHeight()/2D;
112
  	    	double wcOriginX = pReal.getX();
113
  	    	double wcOriginY = pReal.getY();
114

  
115
  	    	Point2D maxRes = ((FLyrWCS)actives[0]).getMaxResolution();
116
  	    	double wcDstMinX = wcOriginX-w2*maxRes.getX();
117
  	    	double wcDstMinY = wcOriginY-h2*maxRes.getY();
118
  	    	double wcDstWidth = w2*maxRes.getX()*2D;
119
  	    	double wcDstHeight = h2*maxRes.getY()*2D;
120

  
121
  	    	Envelope rect;
122
			try {
123
				rect = geomManager.createEnvelope(
124
						wcDstMinX, wcDstMinY, wcDstMinX + wcDstWidth, wcDstMinY - wcDstHeight, SUBTYPES.GEOM2D);
125
			} catch (CreateEnvelopeException e) {
126
				throw new BehaviorException(e.getMessage());
127
			}
128
  	       	mapCtrl.getMapContext().getViewPort().setEnvelope(rect);
129
  		}
130

  
131
	}
132

  
133
	/*
134
	 * (non-Javadoc)
135
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
136
	 */
137
	public Cursor getCursor() {
138
		return cur;
139
	}
140

  
141
	/*
142
	 * (non-Javadoc)
143
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
144
	 */
145
	public boolean cancelDrawing() {
146
		return false;
147
	}
148

  
149
	/*
150
	 * (non-Javadoc)
151
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
152
	 */
153
	public void pointDoubleClick(PointEvent event) throws BehaviorException {
154
	}
155

  
156
	/*
157
	 * (non-Javadoc)
158
	 * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getImageCursor()
159
	 */
160
	public Image getImageCursor() {
161
		return img;
162
	}
163
}
0 164

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/toc/WCSPropsTocMenuEntry.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.wcs.app.wcsclient.gui.toc;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction;
26
import org.gvsig.app.project.documents.view.toc.ITocItem;
27
import org.gvsig.fmap.mapcontext.layers.FLayer;
28
import org.gvsig.raster.wcs.app.wcsclient.gui.dialog.WCSPropsDialog;
29
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS;
30

  
31

  
32
/**
33
 * Changes the connection properties.
34
 *
35
 * Cambia las propiedades de la conexi?n al servidor WCS.
36
 *
37
 * @author jaume - jaume.dominguez@iver.es
38
 */
39
public class WCSPropsTocMenuEntry extends AbstractTocContextMenuAction {
40

  
41
	public void execute(ITocItem item, FLayer[] selectedItems) {
42
       	WCSPropsDialog dialog = new WCSPropsDialog((FLyrWCS) selectedItems[0]);
43
       	PluginServices.getMDIManager().addWindow(dialog);
44
	}
45

  
46
	public String getText() {
47
		return PluginServices.getText(this, "wcs_properties");
48
	}
49

  
50
	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
51
		return selectedItems.length == 1 && selectedItems[0].isAvailable();
52
	}
53

  
54
	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
55
		if (selectedItems.length != 1) {
56
			return false;
57
		}
58
		return selectedItems[0] instanceof FLyrWCS;
59

  
60
	}
61

  
62
}
0 63

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/toc/WCSZoomPixelCursorTocMenuEntry.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.wcs.app.wcsclient.gui.toc;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
26
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction;
27
import org.gvsig.app.project.documents.view.toc.ITocItem;
28
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener;
29
import org.gvsig.fmap.mapcontext.layers.FLayer;
30
import org.gvsig.fmap.mapcontrol.MapControl;
31
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
32
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
33
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
34
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS;
35

  
36

  
37
/**
38
 * @author Nacho Brodin <nachobrodin@gmail.com>
39
 *
40
 * Entrada de men? para la activaci?n de la funcionalidad de zoom a un
41
 * pixel centrado en el cursor.
42
 */
43
public class WCSZoomPixelCursorTocMenuEntry extends
44
		AbstractTocContextMenuAction {
45

  
46
	public void execute(ITocItem item, FLayer[] selectedItems) {
47

  
48
		AbstractViewPanel vista = (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
49
		MapControl mapCtrl = vista.getMapControl();
50

  
51
		if (!mapCtrl.hasTool("zoom_pixel_cursor")) {
52
			StatusBarListener sbl = new StatusBarListener(mapCtrl);
53

  
54
			WCSZoomPixelCursorListener zp = new WCSZoomPixelCursorListener(
55
					mapCtrl);
56
			mapCtrl.addBehavior("zoom_pixel_cursor", new Behavior[] {
57
					new PointBehavior(zp), new MouseMovementBehavior(sbl) });
58

  
59
		}
60

  
61
		mapCtrl.setTool("zoom_pixel_cursor");
62
	}
63

  
64
	public String getText() {
65
		return PluginServices.getText(this, "Zoom_pixel");
66
	}
67

  
68
	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
69
		return selectedItems.length == 1 && selectedItems[0].isAvailable();
70
	}
71

  
72
	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
73
		if (selectedItems.length != 1) {
74
			return false;
75
		}
76
		return selectedItems[0] instanceof FLyrWCS;
77

  
78
	}
79

  
80
}
0 81

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/toc/WCSZoomToPixelTocMenuEntry.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
package org.gvsig.raster.wcs.app.wcsclient.gui.toc;
24

  
25
import java.awt.event.ActionEvent;
26
import java.awt.geom.Point2D;
27

  
28
import javax.swing.JMenuItem;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.app.project.documents.view.toc.TocMenuEntry;
32
import org.gvsig.app.project.documents.view.toc.gui.FPopupMenu;
33
import org.gvsig.fmap.geom.GeometryLocator;
34
import org.gvsig.fmap.geom.GeometryManager;
35
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
36
import org.gvsig.fmap.geom.primitive.Envelope;
37
import org.gvsig.fmap.mapcontext.ViewPort;
38
import org.gvsig.fmap.mapcontext.layers.FLayer;
39
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS;
40

  
41

  
42
/**
43
 * This class implements the TOC meny entry to do a zoom to pixel. Zooming to a
44
 * pixel causes to change the view's zoom to fit in the coverage's native
45
 * resolution.
46
 *
47
 * Entrada de men? para la activaci?n de la funcionalidad de zoom a un pixel.
48
 *
49
 * @author Jaume - jaume.dominguez@iver.es
50
 *
51
 * @deprecated not used
52
 */
53
public class WCSZoomToPixelTocMenuEntry extends TocMenuEntry {
54
	public static final int ZOOM_TO_VIEW_CENTER = 0x2;
55
	private JMenuItem properties;
56
	FLayer lyr = null;
57
	public int zoomType = ZOOM_TO_VIEW_CENTER;
58

  
59
	public void initialize(FPopupMenu m) {
60
		super.initialize(m);
61

  
62
		if (isTocItemBranch()) {
63
			lyr = getNodeLayer();
64
    		// Opciones para capas raster
65
    		if ((lyr instanceof FLyrWCS)) {
66
    			properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel"));
67
    			getMenu().add( properties );
68
    			//properties.setFont(FPopupMenu.theFont);
69
    			getMenu().setEnabled(true);
70
    			properties.addActionListener(this);
71
     		}
72
		}
73
	}
74
	/**
75
	 * Calculates the zoom that fits the coverage native resolution.
76
	 *
77
	 * TODO fix the little loss of accuracy caused by a floating point issue
78
	 */
79
	public void actionPerformed(ActionEvent e) {
80
		//System.out.println("Zoom a un pixel");
81

  
82
    	ViewPort v = getMapContext().getViewPort();
83

  
84
    	double w2 = v.getImageWidth()/2D;
85
    	double h2 = v.getImageHeight()/2D;
86
    	double wcOriginCenterX = v.getExtent().getMinX()+((v.getExtent().getMaxX()-v.getExtent().getMinX())/2D);
87
    	double wcOriginCenterY = v.getExtent().getMinY()+((v.getExtent().getMaxY()-v.getExtent().getMinY())/2D);
88

  
89
    	Point2D maxRes = ((FLyrWCS) lyr).getMaxResolution();
90
    	//double wcDstMinX = wcOriginCenterX-w2*maxRes;
91
    	double wcDstMinX = wcOriginCenterX-w2*maxRes.getX();
92
    	//double wcDstMinY = wcOriginCenterY+h2*maxRes;
93
    	double wcDstMinY = wcOriginCenterY+h2*maxRes.getY();
94
    	//double wcDstWidth = w2*maxRes*2D;
95
    	double wcDstWidth = w2*maxRes.getX()*2D;
96
       	//double wcDstHeight = h2*maxRes*2D;
97
    	double wcDstHeight = h2*maxRes.getY()*2D;
98

  
99

  
100
    	GeometryManager geoMan = GeometryLocator.getGeometryManager();
101
		Envelope rAux = null;
102
		try {
103
			rAux = geoMan.createEnvelope(wcDstMinX, wcDstMinY, wcDstMinX
104
					+ wcDstWidth, wcDstMinY + wcDstHeight, SUBTYPES.GEOM2D);
105

  
106
    	} catch (Exception e1) {
107
			e1.printStackTrace();
108
		}
109
		getMapContext().getViewPort().setEnvelope(rAux);
110

  
111
	}
112
}
113

  
0 114

  
org.gvsig.raster.wcs/tags/buildNumber_19/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/dialog/WCSPropsDialog.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
 
23
package org.gvsig.raster.wcs.app.wcsclient.gui.dialog;
24

  
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27
import java.util.HashMap;
28

  
29
import javax.swing.JButton;
30
import javax.swing.JDialog;
31
import javax.swing.JOptionPane;
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.andami.PluginServices;
35
import org.gvsig.andami.ui.mdiManager.IWindow;
36
import org.gvsig.andami.ui.mdiManager.WindowInfo;
37
import org.gvsig.app.gui.wizards.WizardListener;
38
import org.gvsig.app.gui.wizards.WizardListenerSupport;
39
import org.gvsig.fmap.dal.coverage.exception.RemoteServiceException;
40
import org.gvsig.fmap.mapcontext.MapContext;
41
import org.gvsig.fmap.mapcontext.exceptions.ConnectionErrorLayerException;
42
import org.gvsig.fmap.mapcontext.exceptions.DriverLayerException;
43
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
44
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
45
import org.gvsig.fmap.mapcontext.exceptions.NameLayerException;
46
import org.gvsig.fmap.mapcontext.exceptions.ProjectionLayerException;
47
import org.gvsig.fmap.mapcontext.exceptions.TypeLayerException;
48
import org.gvsig.fmap.mapcontext.exceptions.URLLayerException;
49
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException;
50
import org.gvsig.fmap.mapcontext.layers.FLayer;
51
import org.gvsig.fmap.mapcontext.layers.FLayers;
52
import org.gvsig.fmap.mapcontrol.MapControl;
53
import org.gvsig.raster.fmap.layers.FLyrRaster;
54
import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
55
import org.gvsig.raster.util.CancelTaskImpl;
56
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.WCSParamsPanel;
57
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS;
58
import org.gvsig.raster.wcs.io.WCSServerExplorer;
59

  
60

  
61
/**
62
 * The TOC WCS properties panel container.
63
 *
64
 * @author jaume - jaume.dominguez@iver.es
65
 *
66
 */
67
public class WCSPropsDialog extends JPanel implements IWindow {
68

  
69
	private static final long         serialVersionUID    = 1L;
70
	JDialog                           dlg                 = null;  
71
	private JPanel                    buttonsPanel        = null;
72
	private FLyrRaster                fLayer              = null;
73
	boolean                           applied             = false;;
74
	private WindowInfo                m_ViewInfo          = null;
75

  
76
	private JButton                   btnApply            = null;
77
	private JButton                   btnOk               = null;
78
	private JButton                   btnCancel           = null;
79
	private WCSParamsPanel            wcsParamsTabbedPane;
80
    private CommandListener           m_actionListener;
81
    private WCSServerExplorer         explorer            = null;
82

  
83
    public WCSPropsDialog(FLayer layer) {
84
		super();
85
		if(layer instanceof FLyrRaster)
86
			initialize((FLyrRaster)layer);
87
	}
88

  
89

  
90
	private void initialize(FLyrRaster layer) {
91
		setLayout(null);
92

  
93
        setFLayer(layer);
94
        wcsParamsTabbedPane = getParamsPanel(((FLyrWCS) layer).getProperties());
95
        wcsParamsTabbedPane.addWizardListener(new WizardListener() {
96
			public void wizardStateChanged(boolean finishable) {
97
				getBtnOk().setEnabled(finishable);
98
				getBtnApply().setEnabled(finishable);
99
			}
100

  
101
			public void error(Exception e) {
102
			}
103

  
104
        })  ;
105
        this.add(wcsParamsTabbedPane);
106
        this.add(getButtonsPanel(), null);
107

  
108
	}
109

  
110

  
111
	public void setFLayer(FLyrRaster f) {
112
		fLayer = f;
113
	}
114

  
115
	/**
116
	 * With getParamsPanel we have access to the map config TabbedPane.
117
	 * If this panel doesn't exist yet (which can occur when an existing project is
118
	 * recovered) it is been automatically constructed by connecting to the server,
119
	 * reloading the necessary data, filling up the content and setting the selected
120
	 * values that were selected when the projet was saved.
121
	 *
122
	 *
123
	 * Since a connection to the server is needed when rebuiliding the panel, this
124
	 * causes a delay for the panel's showing up or a nullPointer error if there is
125
	 * no path to the server.
126
	 *
127
	 *
128
	 * Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n
129
	 * del mapa. Si este panel todav?a no existe (como puede ser cuando
130
	 * recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando
131
	 * al servidor, recuperando los datos necesarios, rellenando el contenido y
132
	 * dejando seleccionados los valores que estaban seleccionados cuando se
133
	 * guarda el proyecto.
134
	 *
135
	 *
136
	 * Como para reconstruirse requiere una conexi?n con el servidor esto causa
137
	 * un retardo en la aparici?n en el toc o un error de nullPointer si no
138
	 * hay conexi?n hasta el servidor.
139
	 *
140
	 *
141
	 * @return WCSParamsPanel
142
	 */
143
	@SuppressWarnings("rawtypes")
144
	public WCSParamsPanel getParamsPanel(HashMap info) {
145
	    if (info != null) {
146
	    	try {
147
	    		if(explorer == null) {
148
					explorer = ((FLyrWCS)fLayer).getExplorer();
149
					
150
					try {
151
			    		explorer.connect(new CancelTaskImpl());
152
					} catch (RemoteServiceException e) {
153
						RasterToolsUtil.messageBoxError("The connection cannot be established", this, e);
154
						return null;
155
					} 
156
	    		}
157
	    	} catch (Exception e) {
158
	    		explorer = null;
159
	    		JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
160
	    	}
161
	    	try {
162

  
163
				WCSParamsPanel toc = new WCSParamsPanel();
164
				toc.setVisible(true);
165
				toc.setListenerSupport(new WizardListenerSupport());
166
				toc.setWizardData(explorer);
167

  
168
				toc.getLayerPanel().getLstCoverages().setListData(explorer.getCoverageList());
169

  
170
				String coverageName = (String) info.get("name");
171
				int index = toc.getLayerPanel().getCoverageIndex( coverageName );
172
				if (index != -1) {
173
					toc.getLayerPanel().getLstCoverages().setSelectedIndex(index);
174
				}
175

  
176
				toc.refreshData(((FLyrWCS)fLayer).getParameters());
177

  
178
				index = toc.getFormatsPanel().getSRSIndex((String) info.get("crs") );
179
				if (index != -1) {
180
					toc.getFormatsPanel().getLstCRSs().setSelectedIndex(index);
181
				}
182
				index = toc.getFormatsPanel().getFormatIndex((String) info.get("format"));
183
				if (index != -1) {
184
					toc.getFormatsPanel().getLstFormats().setSelectedIndex(index);
185
				}
186
				String time = (String) info.get("time");
187
				if (time != null && !time.equals("")) {
188
					toc.getTimePanel().getLstSelectedTimes().setListData(time.split(","));
189
				}
190
				String parameter = (String) info.get("parameter");
191
				if (parameter != null && !parameter.equals("")){
192
					String[] s = parameter.split("=");
193
					String pName = s[0];
194

  
195
					String regexDouble = "-?[0-9]+(\\.[0-9]+)?";
196
					String regexInterval = regexDouble+"/"+regexDouble;
197
					String regexIntervalList = regexInterval+"(,"+regexInterval+")*";
198
					if (s[1].matches(regexInterval)){
199
						// Single Interval
200
						toc.getParameterPanel().getJScrollPane5().setVisible(false);
201
						toc.getParameterPanel().getSingleParamValuesList().setEnabled(false);
202

  
203

  
204
					} else if (s[1].matches(regexIntervalList)){
205
						// Multiple Interval
206

  
207
					} else {
208
						// Single values
209
						toc.getParameterPanel().getJScrollPane5().setVisible(true);
210
						toc.getParameterPanel().getSingleParamValuesList().setEnabled(true);
211

  
212
						String[] pVals = s[1].split(",");
213
						index = toc.getParameterPanel().getParamIndex(pName);
214
						toc.getParameterPanel().getCmbParam().setSelectedIndex(index);
215
						//toc.refreshParamValues( coverageName );
216
						int[] indexes = new int[pVals.length];
217
						for (int i = 0; i < pVals.length; i++) {
218
							indexes[i] = toc.getParameterPanel().getValueIndex(pVals[i]);
219
						}
220

  
221
						toc.getParameterPanel().getSingleParamValuesList().setSelectedIndices(indexes);
222
					}
223
				}
224
				toc.refreshInfo();
225
				return toc;
226
			} catch (Exception e) {
227
				JOptionPane.showMessageDialog(null, "servidor_wcs_no_responde", "Error", JOptionPane.ERROR_MESSAGE);
228
				e.printStackTrace();
229
			}
230
	    }
231
	    return null;
232
	}
233

  
234
	public JPanel getButtonsPanel() {
235
		if (buttonsPanel == null) {
236
			m_actionListener = new CommandListener(this);
237
			buttonsPanel = new JPanel();
238
	        buttonsPanel.setBounds(5, wcsParamsTabbedPane.getHeight(), 471, 40);
239
			buttonsPanel.setLayout(null);
240
			buttonsPanel.setName("buttonPanel");
241

  
242
	        buttonsPanel.add(getBtnOk(), null);
243
	        buttonsPanel.add(getBtnApply(), null);
244
	        buttonsPanel.add(getBtnCancel(), null);
245
		}
246
		return buttonsPanel;
247
	}
248

  
249
	public JButton getBtnOk() {
250
		if (btnOk == null) {
251
	        btnOk = new JButton("ok");
252
	        btnOk.setText(PluginServices.getText(this,"ok"));
253
	        btnOk.setActionCommand("OK");
254
	        btnOk.addActionListener(m_actionListener);
255
	        btnOk.setBounds(367, 9, 90, 25);
256
		}
257
		return btnOk;
258
	}
259

  
260
	public JButton getBtnApply() {
261
		if (btnApply == null) {
262
	        btnApply = new JButton("apply");
263
	        btnApply.setText(PluginServices.getText(this,"apply"));
264
	        btnApply.setEnabled(false);
265
	        btnApply.setActionCommand("APPLY");
266
	        btnApply.addActionListener(m_actionListener);
267
	        btnApply.setBounds(267, 9, 90, 25);
268
		}
269
		return btnApply;
270
	}
271

  
272
	public JButton getBtnCancel() {
273
		if (btnCancel == null) {
274
	        btnCancel = new JButton("cancel");
275
	        btnCancel.setText(PluginServices.getText(this,"cancel"));
276
	        btnCancel.setActionCommand("CANCEL");
277
	        btnCancel.addActionListener(m_actionListener);
278
	        btnCancel.setBounds(137, 9, 90, 25);
279
		}
280
		return btnCancel;
281
	}
282

  
283
	private class CommandListener implements ActionListener {
284

  
285
		/**
286
		 * Creates a new ComandosListener object.
287
		 *
288
		 * @param lg DOCUMENT ME!
289
		 */
290
		public CommandListener(WCSPropsDialog tp) {
291
			//m_tp = tp;
292
		}
293

  
294
		/* (non-Javadoc)
295
		 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
296
		 */
297
		public void actionPerformed(ActionEvent e) {
298
			if (e.getActionCommand() == "CANCEL") {
299
				close();
300
			} else {
301
				((FLyrWCS) fLayer).getParameters().setFormat(wcsParamsTabbedPane.getFormat());
302
				try {
303
					((FLyrWCS) fLayer).getParameters().setSRS(wcsParamsTabbedPane.getSRS());
304
					((FLyrWCS) fLayer).getParameters().setCoverageName(wcsParamsTabbedPane.getLayerPanel().getSelectedCoverageName());
305

  
306
					//fLayer = wcsParamsTabbedPane.getLayer();
307
					FLayers parent = ((FLayer)fLayer).getParentLayer();
308

  
309
					MapControl mapCtrl = null;
310

  
311
					IWindow[] w = PluginServices.getMDIManager().getAllWindows();
312
					for (int i = 0; i < w.length; i++) {
313
						if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) {
314
							MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext();
315
							if(mapContext == fLayer.getMapContext())
316
								mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl();
317
						}
318
					} 
319

  
320
					if (parent != null) {
321
						FLayer layer = wcsParamsTabbedPane.getLayer();
322
						mapCtrl.getMapContext().getLayers().
323
						replaceLayer(fLayer.getName(), layer);
324
					} else {
325
						mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wcsParamsTabbedPane.getLayer());
326
					}
327
					//mapCtrl.getMapContext().getLayers().addLayer( fLayer );
328
					mapCtrl.getMapContext().invalidate();
329
					applied = true;
330
					getBtnApply().setEnabled(!applied);
331
					
332
					if (e.getActionCommand() == "OK") {
333
						close();
334
					}
335
				} catch (ConnectionErrorLayerException e1) {
336
					e1.printStackTrace();
337
				} catch (DriverLayerException e1) {
338
					e1.printStackTrace();
339
				} catch (LegendLayerException e1) {
340
					e1.printStackTrace();
341
				} catch (NameLayerException e1) {
342
					e1.printStackTrace();
343
				} catch (ProjectionLayerException e1) {
344
					e1.printStackTrace();
345
				} catch (TypeLayerException e1) {
346
					e1.printStackTrace();
347
				} catch (UnsupportedVersionLayerException e1) {
348
					e1.printStackTrace();
349
				} catch (URLLayerException e1) {
350
					e1.printStackTrace();
351
				} catch (LoadLayerException e1) {
352
					e1.printStackTrace();
353
				}
354
			}
355
		}
356
	}
357
    /**
358
     * Merge two FLayers in one
359
     * @param group1
360
     * @param group2
361
     * @return
362
     */
363
    @SuppressWarnings("unused")
364
	private FLayers mergeFLayers(FLayers group1, FLayers group2) {
365
    	//FLayers agrupation = new FLayers(group1.getFMap(), group1.getParentLayer());
366
    	FLayer layer;
367
    	for(int i = 0; i < group2.getLayersCount(); i++) {
368
    		layer = group2.getLayer( i );
369
    		if(group1.getLayer( layer.getName()) == null ) {
370
    			group1.addLayer( layer );
371
    		}
372
    	}
373

  
374
    	return group1;
375
    }
376

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff