Initial import.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@69314 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gisViewer</name>
|
||||
<comment>gwtGeoExt project</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,5 @@
|
|||
#Thu Feb 16 16:58:27 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=
|
||||
googleCloudSqlEnabled=false
|
||||
localDevMySqlEnabled=true
|
|
@ -0,0 +1,6 @@
|
|||
#Thu Feb 16 16:57:45 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
launchConfigExternalUrlPrefix=
|
||||
warSrcDir=
|
||||
warSrcDirIsOutput=true
|
|
@ -0,0 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
filesCopiedToWebInfLib=
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPm9yZy5nY3ViZS5wb3J0bGV0cy51c2VyLmdpc3ZpZXdlci50ZXN0LlRlc3RHaXNWaWV3ZXI8L2VudHJ5LXBvaW50LW1vZHVsZT48L2d3dC1jb21waWxlLXNldHRpbmdzPg\=\=
|
|
@ -0,0 +1,4 @@
|
|||
#Fri Feb 15 11:27:20 CET 2013
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
|
@ -0,0 +1,6 @@
|
|||
#Fri Feb 15 11:27:20 CET 2013
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,5 @@
|
|||
#Fri Feb 15 11:25:42 CET 2013
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,16 @@
|
|||
v. 2.1.3 (2012-11-30)
|
||||
* Update
|
||||
v. 2.1.2 (2012-10-25)
|
||||
* Update
|
||||
v. 2.1.1 (2012-09-03)
|
||||
* Update
|
||||
v. 2.1 (2012-07-24)
|
||||
* WFS performance improvement
|
||||
* Advanced click data interface
|
||||
* Enabling workspace image exporting
|
||||
* Interface enhancement
|
||||
v. 2.0 (2012-05-04)
|
||||
* Gis Viewer
|
||||
v. 1.2 (07-09-11)
|
||||
* Gis Viewer
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Add those lines to the web.xml:
|
||||
<servlet>
|
||||
<servlet-name>GisViewerService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.user.gisviewer.server.DefaultGisViewerServletImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>GisViewerService</servlet-name>
|
||||
<url-pattern>/<YOUR APPLICATION NAME>/ViewerService</url-pattern>
|
||||
</servlet-mapping>
|
|
@ -0,0 +1,7 @@
|
|||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
* Francesco Cerasuolo (francesco.cerasuolo@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
|
@ -0,0 +1,46 @@
|
|||
The gCube System - GisViewer
|
||||
------------------------------------------------------------
|
||||
|
||||
This work is partially funded by the European Commission in the
|
||||
context of the D4Science project (www.d4science.eu), under the 1st call of FP7 IST priority.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Francesco Cerasuolo (francesco.cerasuolo@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
||||
|
||||
* Federico Biagini (fedbiagi@hotmail.com), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
||||
|
||||
* Gianpaolo Coro (coro@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
||||
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. 2.1.3 2012-11-30
|
||||
|
||||
Description
|
||||
-----------
|
||||
GWT Widget application to access GIS Data
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
Source code is available from SVN:
|
||||
https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/GISViewer
|
||||
|
||||
Binaries can be downloaded from:
|
||||
http://www.gcube-system.org/index.php?option=com_content&view=article&id=290&Itemid=48
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,45 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-3" date="2012-11-30">
|
||||
<Change>Update</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-2" date="2012-10-25">
|
||||
<Change>Update</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-1" date="2012-09-03">
|
||||
<Change>Update</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-0" date="2012-07-24">
|
||||
<Change>WFS performance improvement</Change>
|
||||
<Change>Advanced click data interface</Change>
|
||||
<Change>Enabling workspace image exporting</Change>
|
||||
<Change>Interface enhancement</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.2-0-0" date="2012-05-04">
|
||||
<Change>Code optimizing</Change>
|
||||
<Change>Interface Enhancement</Change>
|
||||
<Change>Implementation of an additional panel interface version besides a window interface</Change>
|
||||
<Change>Openlayers toolbar reimplementation</Change>
|
||||
<Change>Added a set of external Base Layers using OpenLayers</Change>
|
||||
<Change>CSV data export</Change>
|
||||
<Change>Advanced data request: box rectangular area selection</Change>
|
||||
<Change>Snapshot with external layers</Change>
|
||||
<Change>Pluggable Layers from WMS links</Change>
|
||||
<Change>Delete Search Button</Change>
|
||||
<Change>Optimize map preview</Change>
|
||||
<Change>Filter on Workspace</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.1-4-0" date="2012-02-17">
|
||||
<Change>Most of the code has been refactorized</Change>
|
||||
<Change>Unused files and libraries have been removed</Change>
|
||||
<Change>Added generic parameters retrieving system</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.1-2" date="2011-07-09">
|
||||
<Change>release with minor changes</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.1-1-1" date="2011-12-07">
|
||||
<Change>release with minor changes</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.GISViewer.1-1-0" date="2011-02-02">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,48 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>target/apidocs</directory>
|
||||
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.jar</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID></ID>
|
||||
<Type>Library</Type>
|
||||
<Profile>
|
||||
<Description>{description}</Description>
|
||||
<Class>PortletsUser</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1 @@
|
|||
${scm.url}
|
|
@ -0,0 +1,214 @@
|
|||
<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>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gis-viewer</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>GIS Viewer Widget</name>
|
||||
<description>
|
||||
GIS Viewer Widget
|
||||
</description>
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
|
||||
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
|
||||
</scm>
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.4.0</gwtVersion>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<maven.compiler.source>1.6</maven.compiler.source>
|
||||
<maven.compiler.target>1.6</maven.compiler.target>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Google Web Toolkit (GWT) -->
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<!-- "provided" so that we don't deploy -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- This dependency is needed to use GWT UI BInder without old Xerces
|
||||
version of gCore complaining -->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>gcf</artifactId>
|
||||
<version>[1.5.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<version>[3.2.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>geoserverinterface</artifactId>
|
||||
<version>[1.10.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gwtopenmaps.openlayers</groupId>
|
||||
<artifactId>gwt-openlayers-client</artifactId>
|
||||
<version>0.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
<artifactId>gxt</artifactId>
|
||||
<version>2.2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>fully.qualified.MainClass</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<!-- TODO: Update version to 2.5.0 once gwt-maven-plugin 2.5.0 final
|
||||
is released (post-GWT 2.5.0) -->
|
||||
<version>2.4.0</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-dev</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!-- JS is only needed in the package phase, this speeds up testing -->
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
|
||||
documentation at codehaus.org -->
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
<module>
|
||||
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||
|
||||
<inherits name='org.gwtopenmaps.openlayers.OpenLayers' />
|
||||
|
||||
<script src="OpenLayers.js"></script>
|
||||
<script src="LineHandler.js"></script>
|
||||
<script src="http://maps.google.com/maps/api/js?gwt=1&v=3&sensor=false"></script>
|
||||
|
||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||
|
||||
<stylesheet src='gisViewer.css' />
|
||||
|
||||
<!-- TODO adjust -->
|
||||
<stylesheet src="css/treePanelStyle.css" />
|
||||
<stylesheet src="theme/default/style.css" />
|
||||
|
||||
</module>
|
|
@ -0,0 +1,120 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
import com.extjs.gxt.ui.client.widget.Info;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static String VERSION = "2.1.3";
|
||||
public static String defaultGroup=
|
||||
// "5141",
|
||||
// "groupTemplate",
|
||||
// "group4cad6de9f-e980-4fda-a38b-41d1d0c6b3f0",
|
||||
// //very
|
||||
// big
|
||||
// csquare table
|
||||
// "group468e7b3b0-7e32-4718-89ab-d7cdcfe803d4",
|
||||
// "WMS_AbalisterStellarisJP2011_07_13_13_08_11_088",
|
||||
// "group4d2867cb8-d413-42b2-a271-a8d3d60d7e3e"
|
||||
// "group408849276-1b22-4427-9d1c-d2d8b3979e44",
|
||||
// "group428b5c4e7-4f5e-4ca1-bd6e-64f5287f35a2";
|
||||
// "group4026dc4de-7a57-4434-b9b4-495b15e7325c";
|
||||
// "vtigroup_64969591-09e0-40c3-b3c4-9f706572a470";
|
||||
|
||||
//"group4838c40e5-410f-4848-b92b-6d52ded12489";
|
||||
"group45be7606f-4add-4636-ad14-f353163d0bd3";
|
||||
//"group4b02b381f-6572-4348-b827-0ecee9d7d8a0"
|
||||
//"vtigrp_4a60c06c-5e41-4818-87c4-5ff6be2ef610"
|
||||
;
|
||||
public static String defaultGroup2 = "groupTemplate";
|
||||
|
||||
// LOG AND INFO PRINTING
|
||||
public static boolean printLog=false;
|
||||
public static void log(String s) {
|
||||
if (printLog)
|
||||
System.out.println(s);
|
||||
}
|
||||
public static void info(String title, String text) {
|
||||
if (printLog)
|
||||
Info.display(title, text);
|
||||
}
|
||||
public static void alert(String string, String string2) {
|
||||
if (printLog)
|
||||
MessageBox.alert(string, string2, null);
|
||||
}
|
||||
|
||||
// LAYERS
|
||||
public static final double defaultOpacityLayers = 0.7;
|
||||
|
||||
public static final String[] brightLayers = {
|
||||
"TrueMarble.16km.2700x1350",
|
||||
"Test.TrueMarble.16km.2700x1350_gf",
|
||||
"depthmean",
|
||||
"depthmean_annual",
|
||||
// "depthMean",
|
||||
};
|
||||
|
||||
public static final String[][] defaultStyleTransects = {
|
||||
{"depth_style", "DepthMean", "depth"},
|
||||
{"primprod_style", "PrimProdMean", "primprod"},
|
||||
{"salinity_style", "SalinityMean", "salinity"},
|
||||
{"sst_style", "SSTAnMean", "sst"},
|
||||
{"biodiversity_style", "Biodiv", "biodiversity"},
|
||||
{"ice_style", "IceConAnn", "ice"},
|
||||
{"occurrence_style", "GoodCell", "occurrence"}
|
||||
};
|
||||
|
||||
public static final String[] dataStoresWithTransect = {
|
||||
"aquamapsdb",
|
||||
"aquamapsgeomar"
|
||||
};
|
||||
|
||||
public static final String borderLayer = "Test.TrueMarble.16km.2700x1350_gf";
|
||||
public static final String baseLayer = "TrueMarble.16km.2700x1350";
|
||||
public static boolean isBorderLayerVisible=false;
|
||||
|
||||
public static final int MAX_WFS_FEATURES = 200; // zero for no limit
|
||||
|
||||
//INTERFACE
|
||||
public static final int geoWindowWidth=1000;//900;
|
||||
public static final int geoWindowHeight=760;//550;
|
||||
public static final int geoWindowMinWidth=300;
|
||||
public static final int geoWindowMinHeight=300;
|
||||
public static final String geoWindowTitle="GIS Viewer "+ VERSION;
|
||||
public static final boolean geoWindowShadow = false;
|
||||
public static final boolean geoWindowDataPanelOpenedAtStart = true;
|
||||
|
||||
public static final String hcafLegendWidth = "400px";
|
||||
|
||||
public static final int omHeight = 279; //379;
|
||||
public static final int omWidth = 701;
|
||||
public static final int omMaxHeight = 550;
|
||||
public static final int omMaxWidth = 930;
|
||||
|
||||
public static final String panelsBodyStyle = "background-color:#FFFFFF";
|
||||
public static final int mapPanelSpacingX = 5;
|
||||
public static final int mapPanelSpacingY = 56;
|
||||
public static final String MessageLoadingLayersData = "Loading layers data...";
|
||||
public static final String FAO_DATA_STORE = "FI Geoserver";
|
||||
public static final String FAO_DATA_STORE_PREFIX = "fifao_";
|
||||
|
||||
public static final String defaultScope =
|
||||
// "/gcube/devsec/devVRE";
|
||||
"/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling";
|
||||
|
||||
public static int openLayersMapDefaultZoom=2;
|
||||
public static boolean isOverViewMapVisible=false;
|
||||
|
||||
public static boolean isSaveButtonEnabled = false;
|
||||
|
||||
protected static int legendDialogMaxHeight = 500;
|
||||
protected static int legendDialogWidth = 200;
|
||||
|
||||
public static enum Mode {NORMAL, TEST};
|
||||
public static Mode MODE = Mode.NORMAL;
|
||||
|
||||
public static boolean getLayerTitles = true;
|
||||
public static boolean layersDragEnabled = true;
|
||||
//protected static String defaultProjection = "EPSG:900913";//"EPSG:4326";
|
||||
public static boolean buttonSaveLayerEnabled = true;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public interface DataPanelOpenListener {
|
||||
public void dataPanelOpen(boolean isOpen, int panelHeight);
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Resources;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.BoxComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox.MessageBoxType;
|
||||
import com.extjs.gxt.ui.client.widget.Window;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
|
||||
public class GisViewer extends Window {
|
||||
|
||||
GisViewerPanel gg;
|
||||
private boolean first = true;
|
||||
public static Resources resources = GWT.create(Resources.class);
|
||||
public static GisViewerServiceAsync service = (GisViewerServiceAsync) GWT.create(GisViewerService.class);
|
||||
|
||||
|
||||
public GisViewer() {
|
||||
this(new GisViewerParameters());
|
||||
}
|
||||
|
||||
public GisViewer(GisViewerParameters parameters) {
|
||||
|
||||
super();
|
||||
|
||||
this.setHeading(Constants.geoWindowTitle);
|
||||
this.setSize(Constants.geoWindowWidth, Constants.geoWindowHeight);
|
||||
this.setMinWidth(Constants.geoWindowMinWidth);
|
||||
this.setMinHeight(Constants.geoWindowMinHeight);
|
||||
this.setMaximizable(true);
|
||||
this.setLayout(new FitLayout());
|
||||
|
||||
if (Constants.geoWindowShadow)
|
||||
this.setStyleAttribute("padding", "10px");
|
||||
|
||||
gg = new GisViewerPanel(parameters);
|
||||
this.add(gg);
|
||||
|
||||
this.addListener(Events.Move, new Listener<BoxComponentEvent>(){
|
||||
@Override
|
||||
public void handleEvent(BoxComponentEvent be) {
|
||||
if (gg!=null) {
|
||||
gg.updateOpenLayersSize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// public void addLayers(LayerConfiguration ... layersConfigurations) {
|
||||
// gg.addLayersByLayerConfigurations(layersConfigurations);
|
||||
// }
|
||||
|
||||
public void addLayersByNames(String ... layerNames) {
|
||||
gg.addLayersByLayerNames(Arrays.asList(layerNames));
|
||||
}
|
||||
|
||||
public void addLayersByNames(List<String> layerNames) {
|
||||
gg.addLayersByLayerNames(layerNames);
|
||||
}
|
||||
|
||||
public void addLayerByName(String layerName) {
|
||||
List<String> layerNames = new ArrayList<String>();
|
||||
layerNames.add(layerName);
|
||||
gg.addLayersByLayerNames(layerNames);
|
||||
}
|
||||
|
||||
|
||||
public void addLayersByLayerItems(List<LayerItem> layerItems) {
|
||||
gg.addLayersByLayerItems(layerItems);
|
||||
}
|
||||
|
||||
public void addLayerByLayerItem(LayerItem layerItem) {
|
||||
gg.addLayerByLayerItem(layerItem);
|
||||
}
|
||||
|
||||
public void addGroup(String groupName) {
|
||||
gg.addGroupByGroupName(groupName);
|
||||
}
|
||||
|
||||
public void addLayersByLayerItemsToTop(List<LayerItem> layerItems) {
|
||||
gg.addLayersByLayerItemsToTop(layerItems);
|
||||
}
|
||||
|
||||
public void addLayerByLayerItemToTop(LayerItem layerItem) {
|
||||
gg.addLayerByLayerItemToTop(layerItem);
|
||||
}
|
||||
|
||||
public void removeAllLayers() {
|
||||
gg.removeAllLayers();
|
||||
}
|
||||
|
||||
public void addLayerByWms(String title, String layerName, String url, boolean isBase, boolean displayInLayerSwitcher) {
|
||||
gg.addLayerByWms(title, layerName, url, isBase, displayInLayerSwitcher);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.extjs.gxt.ui.client.widget.Window#show()
|
||||
*/
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
showIntro();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showIntro() {
|
||||
if (first) {
|
||||
final String str = "first_time";
|
||||
if (Cookies.getCookie(str) == null) {
|
||||
MessageBox box = new MessageBox();
|
||||
box.setType(MessageBoxType.CONFIRM);
|
||||
box.setButtons(MessageBox.OKCANCEL);
|
||||
box.setIcon(MessageBox.INFO);
|
||||
box.setClosable(false);
|
||||
box.setMaxWidth(400);
|
||||
box.setMinWidth(400);
|
||||
box.setMessage("" +
|
||||
"GIS Viewer is a standalone application for supporting geospatial data visualization and management including:" +
|
||||
"<br><br> - layers visualization where the layers reside in multiple data sources, namely geoserver instances;" +
|
||||
"<br> - layers ordering with respect to the z axis through drag and drop;" +
|
||||
"<br> - layers filtering through cql;" +
|
||||
"<br> - layers data visualization;" +
|
||||
"<br><br>GIS Viewer has been designed and developed by the NeMIS Laboratory team at ISTI-CNR Pisa, Italy." +
|
||||
"<br><br>The Gis Viewer has been produced with the co-funding of the European Commission in the context of the iMarine project. " +
|
||||
"iMarine (www.i-marine.eu) (RI – 283644) is a Research Infrastructures Combination of Collaborative Project and Coordination " +
|
||||
"and Support Action (CP-CSA) co-funded by the European Commission under the Capacities Programme, Framework Programme Seven (FP7)." +
|
||||
"<br><br>Press CANCEL if you want this message not to be shown anymore.");
|
||||
|
||||
// "Gis Viewer is a standalone application developed by the NeMIS Laboratory at ISTI-CNR Pisa, Italy.\n" +
|
||||
// "The software was developed during the iMarine european project, which promotes an initiative to establish and operate " +
|
||||
// "an e-infrastructure supporting the principles of the Ecosystem Approach to fisheries management " +
|
||||
// "and conservation of marine living resources.\npress CANCEL if you want this message not to be shown anymore.");
|
||||
box.setModal(true);
|
||||
box.setTitle("Welcome to the GisViewer");
|
||||
box.addCallback(new Listener<MessageBoxEvent>(){
|
||||
@Override
|
||||
public void handleEvent(MessageBoxEvent be) {
|
||||
if (be.getButtonClicked().getText().equals("Cancel"))
|
||||
Cookies.setCookie(str, str);
|
||||
}
|
||||
});
|
||||
box.show();
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return Constants.VERSION;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,256 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.datafeature.DataPanelHandler;
|
||||
import org.gcube.portlets.user.gisviewer.client.datafeature.DataResultPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.layerspanel.LayersPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.OpenLayersMap;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.event.BorderLayoutEvent;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.util.Margins;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.layout.AnchorData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
public class GisViewerLayout extends LayoutContainer {
|
||||
|
||||
private static final String MSG_DATAPANEL_EMPTY = "No data found in this area.";
|
||||
private static final String MSG_NO_DATA_LOADED = "No data loaded.";
|
||||
private static final String REFRESH_DATA_BUTTON_TOOLTIP = "Refresh data from last point selected";
|
||||
private static final String EXPORT_DATA_BUTTON_TOOLTIP = "Export data into a table";
|
||||
private static final String HEADING_DATA = ".: Data <SMALL>(visualization limited to "+Constants.MAX_WFS_FEATURES+" rows)</SMALL>";
|
||||
private OpenLayersMap openLayersMap;
|
||||
//private BorderLayoutData northPanelData;
|
||||
private BorderLayoutData westPanelData;
|
||||
private BorderLayoutData centerPanelData;
|
||||
private BorderLayoutData southPanelData;
|
||||
private ContentPanel westPanel;
|
||||
private ContentPanel northPanel;
|
||||
private ContentPanel southPanel;
|
||||
private ContentPanel centerPanel;
|
||||
private boolean isOpenlayersStarted=false;
|
||||
private BorderLayout layout;
|
||||
private Button refreshDataButton;
|
||||
private Button exportDataButton;
|
||||
private DataPanelHandler handler;
|
||||
private boolean openDataPanel;
|
||||
protected boolean started=false;
|
||||
|
||||
public GisViewerLayout(boolean openDataPanel, DataPanelHandler dataPanelHandler) {
|
||||
super();
|
||||
|
||||
this.openDataPanel = openDataPanel;
|
||||
|
||||
this.handler = dataPanelHandler;
|
||||
|
||||
// settaggio layout
|
||||
layout = new BorderLayout();
|
||||
|
||||
layout.addListener(Events.Expand, new Listener<BorderLayoutEvent>(){
|
||||
@Override
|
||||
public void handleEvent(BorderLayoutEvent be) {
|
||||
if (started && be.getRegion()==LayoutRegion.SOUTH)
|
||||
handler.dataPanelOpen(true, southPanel.getHeight());
|
||||
}
|
||||
});
|
||||
|
||||
layout.addListener(Events.BeforeCollapse, new Listener<BorderLayoutEvent>(){
|
||||
@Override
|
||||
public void handleEvent(BorderLayoutEvent be) {
|
||||
if (started && be.getRegion()==LayoutRegion.SOUTH)
|
||||
handler.dataPanelOpen(false, southPanel.getHeight());
|
||||
}
|
||||
});
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
/*
|
||||
northPanelData = new BorderLayoutData(LayoutRegion.NORTH, 100);
|
||||
northPanelData.setCollapsible(true);
|
||||
northPanelData.setFloatable(true);
|
||||
northPanelData.setHideCollapseTool(true);
|
||||
northPanelData.setSplit(false);
|
||||
northPanelData.setCollapsible(true);
|
||||
northPanelData.setMargins(new Margins(0, 0, 5, 0));
|
||||
*/
|
||||
|
||||
westPanelData = new BorderLayoutData(LayoutRegion.WEST, 300);
|
||||
westPanelData.setSplit(true);
|
||||
westPanelData.setCollapsible(true);
|
||||
westPanelData.setFloatable(true);
|
||||
westPanelData.setMargins(new Margins(0, 5, 0, 0));
|
||||
|
||||
// center.setScrollMode(Scroll.AUTOX);
|
||||
centerPanelData = new BorderLayoutData(LayoutRegion.CENTER);
|
||||
centerPanelData.setMargins(new Margins(0));
|
||||
|
||||
southPanelData = new BorderLayoutData(LayoutRegion.SOUTH, 200);
|
||||
southPanelData.setSplit(true);
|
||||
southPanelData.setCollapsible(true);
|
||||
southPanelData.setFloatable(true);
|
||||
southPanelData.setMargins(new Margins(5, 0, 0, 0));
|
||||
|
||||
westPanel = new ContentPanel();
|
||||
westPanel.setLayout(new FlowLayout());
|
||||
westPanel.setHeading(".: Layers");
|
||||
westPanel.setBodyStyle(Constants.panelsBodyStyle);
|
||||
//westPanel.setSize(500, 100);
|
||||
westPanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
// northPanel = new ContentPanel();
|
||||
// northPanel.setBodyStyle(Constants.panelsBodyStyle);
|
||||
|
||||
southPanel = new ContentPanel();
|
||||
// if (Constants.MODE==Mode.TEST)
|
||||
southPanel.setLayout(new FitLayout());
|
||||
southPanel.setHeading(HEADING_DATA);
|
||||
southPanel.setBodyStyle(Constants.panelsBodyStyle);
|
||||
southPanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
centerPanel = new ContentPanel(){
|
||||
protected void onResize(int width, int height) {
|
||||
super.onResize(width, height);
|
||||
if (isOpenlayersStarted)
|
||||
openLayersMap.changeSize(
|
||||
Integer.toString(width-Constants.mapPanelSpacingX),
|
||||
Integer.toString(height-Constants.mapPanelSpacingY)
|
||||
);
|
||||
};
|
||||
};
|
||||
centerPanel.setHeading(".: Map");
|
||||
centerPanel.setBodyStyle(Constants.panelsBodyStyle);
|
||||
|
||||
this.add(westPanel, westPanelData);
|
||||
//this.add(northPanel, northPanelData);
|
||||
this.add(southPanel, southPanelData);
|
||||
this.add(centerPanel, centerPanelData);
|
||||
|
||||
initDataPanel();
|
||||
}
|
||||
|
||||
public void setLayersPanel(LayersPanel layersPanel) {
|
||||
westPanel.add(layersPanel, new AnchorData("100%"));
|
||||
this.layout();
|
||||
}
|
||||
|
||||
public void setOpenLayers(OpenLayersMap openLayersMap) {
|
||||
centerPanel.removeAll();
|
||||
|
||||
this.openLayersMap = openLayersMap;
|
||||
centerPanel.add(this.openLayersMap.getContentPanel());
|
||||
isOpenlayersStarted = true;
|
||||
int w = centerPanel.getWidth(); // TODO
|
||||
int h = centerPanel.getHeight();
|
||||
this.openLayersMap.changeSize((w-5)+"", (h-56)+"");
|
||||
|
||||
this.layout();
|
||||
}
|
||||
|
||||
public void setMapEmptyMessage() {
|
||||
if (openLayersMap==null) {
|
||||
Label l = new Label("No such layers in the map");
|
||||
l.setStyleAttribute("font-size", "12px");
|
||||
centerPanel.add(l);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void initDataPanel() {
|
||||
setDataPanelMessage(MSG_NO_DATA_LOADED);
|
||||
|
||||
refreshDataButton = new Button();
|
||||
refreshDataButton.setIcon(Images.iconRefresh());
|
||||
refreshDataButton.setToolTip(REFRESH_DATA_BUTTON_TOOLTIP);
|
||||
refreshDataButton.setEnabled(false);
|
||||
refreshDataButton.addListener(Events.Select, new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
handler.showDataPanel();
|
||||
}
|
||||
});
|
||||
|
||||
exportDataButton = new Button();
|
||||
exportDataButton.setIcon(Images.iconTable());
|
||||
exportDataButton.setToolTip(EXPORT_DATA_BUTTON_TOOLTIP);
|
||||
exportDataButton.setEnabled(false);
|
||||
exportDataButton.addListener(Events.Select, new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
handler.exportData(false);
|
||||
}
|
||||
});
|
||||
|
||||
southPanel.getHeader().addTool(refreshDataButton);
|
||||
southPanel.getHeader().addTool(exportDataButton);
|
||||
//southPanel.getHeader().addTool(fooButton);
|
||||
|
||||
if (!openDataPanel)
|
||||
layout.collapse(LayoutRegion.SOUTH);
|
||||
}
|
||||
|
||||
|
||||
private MessageBox waitMessageBox;
|
||||
|
||||
|
||||
public void setDataPanelWait(boolean wait) {
|
||||
if (wait)
|
||||
waitMessageBox = MessageBox.wait("", "Generating data results, please wait...", "Generating...");
|
||||
else
|
||||
waitMessageBox.close();
|
||||
}
|
||||
|
||||
public void setDataPanelContent(DataResultPanel dpanel) {
|
||||
if (dpanel.isEmpty()) {
|
||||
this.setDataPanelMessage(MSG_DATAPANEL_EMPTY);
|
||||
}
|
||||
else {
|
||||
refreshDataButton.setEnabled(true);
|
||||
exportDataButton.setEnabled(true);
|
||||
southPanel.setLayout(new FitLayout());
|
||||
southPanel.removeAll();
|
||||
southPanel.add(dpanel);
|
||||
southPanel.layout();
|
||||
this.layout();
|
||||
}
|
||||
layout.expand(LayoutRegion.SOUTH);
|
||||
}
|
||||
|
||||
public void setDataPanelMessage(String msg) {
|
||||
southPanel.removeAll();
|
||||
southPanel.setLayout(new CenterLayout());
|
||||
southPanel.add(new HTML(msg));
|
||||
southPanel.layout();
|
||||
}
|
||||
|
||||
public String getMapPanelWidth() {
|
||||
return Integer.toString(centerPanel.getWidth()-Constants.mapPanelSpacingX);
|
||||
}
|
||||
|
||||
public String getMapPanelHeight() {
|
||||
return Integer.toString(centerPanel.getHeight()-Constants.mapPanelSpacingY);
|
||||
}
|
||||
|
||||
public void startPanelOpenMonitoring() {
|
||||
this.started = true;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return Constants.VERSION;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,794 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.GeoserverItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItemsResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.MapViewInfo;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.utils.ClickDataInfo;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.utils.URLMakers;
|
||||
import org.gcube.portlets.user.gisviewer.client.datafeature.DataPanelHandler;
|
||||
import org.gcube.portlets.user.gisviewer.client.datafeature.DataResultPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.layerspanel.LayersPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.layerspanel.LayersPanelHandler;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.CqlFilterHandler;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.CqlFilterPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.OpenLayersHandler;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.OpenLayersMap;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.ToolBarPanel;
|
||||
import org.gcube.portlets.user.gisviewer.client.openlayers.ToolbarHandler;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.LoadEvent;
|
||||
import com.google.gwt.event.dom.client.LoadHandler;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
public class GisViewerPanel extends LayoutContainer
|
||||
implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandler, OpenLayersHandler {
|
||||
|
||||
private static final String ALERT_HARD_SPATIAL_QUERY = "The spatial query can take long time. Do you want to continue to download it?";
|
||||
private GisViewerLayout mainPanel;
|
||||
private LayersPanel layersPanel;
|
||||
private OpenLayersMap openLayersMap;
|
||||
private ToolBarPanel toolBarPanel;
|
||||
private GisViewerServiceAsync gisViewerServiceAsync;
|
||||
|
||||
private GisViewerSaveHandler gisViewerSaveHandler;
|
||||
private GisViewerParameters parameters;
|
||||
private String projection;
|
||||
private CqlFilterPanel cqlFilterPanel = new CqlFilterPanel(this);
|
||||
|
||||
private ClickDataInfo lastClickDataInfo = null;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GisViewerPanel() {
|
||||
this(new GisViewerParameters());
|
||||
}
|
||||
|
||||
|
||||
public GisViewerPanel(GisViewerParameters parameters) {
|
||||
super();
|
||||
this.parameters = parameters;
|
||||
this.gisViewerServiceAsync = GisViewer.service;
|
||||
this.gisViewerSaveHandler = parameters.getGisViewerSaveHandler();
|
||||
this.projection = parameters.getProjection();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameters
|
||||
* @param gisViewerSaveHandler
|
||||
*/
|
||||
public GisViewerPanel(GisViewerParameters parameters, GisViewerSaveHandler gisViewerSaveHandler) {
|
||||
super();
|
||||
this.parameters = parameters;
|
||||
this.parameters.setGisViewerSaveHandler(gisViewerSaveHandler);
|
||||
this.gisViewerServiceAsync = GisViewer.service;
|
||||
this.gisViewerSaveHandler = parameters.getGisViewerSaveHandler();
|
||||
this.projection = parameters.getProjection();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void init() {
|
||||
// create an empty layers panel
|
||||
layersPanel = new LayersPanel(this);
|
||||
createOpenLayersMap();
|
||||
|
||||
// initialize the layout
|
||||
this.setLayout(new FitLayout());
|
||||
mainPanel = new GisViewerLayout(parameters.isOpenDataPanelAtStart(), this) {
|
||||
/* (non-Javadoc)
|
||||
* @see com.extjs.gxt.ui.client.widget.LayoutContainer#onRender(com.google.gwt.user.client.Element, int)
|
||||
*/
|
||||
@Override
|
||||
protected void onRender(Element parent, int index) {
|
||||
super.onRender(parent, index);
|
||||
mainPanel.setLayersPanel(layersPanel);
|
||||
mainPanel.setOpenLayers(openLayersMap);
|
||||
}
|
||||
};
|
||||
|
||||
this.add(mainPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(Element parent, int pos) {
|
||||
super.onRender(parent, pos);
|
||||
|
||||
// monitoring of the datapanel open/close event
|
||||
if (parameters.getDataPanelOpenHandler()!=null)
|
||||
mainPanel.startPanelOpenMonitoring();
|
||||
|
||||
getTransectUrl();
|
||||
|
||||
if (parameters.getOpeningGroup()!=null)
|
||||
addGroupByGroupName(parameters.getOpeningGroup());
|
||||
else if (parameters.getOpeningLayers()!=null)
|
||||
addLayersByLayerNames(parameters.getOpeningLayers());
|
||||
};
|
||||
|
||||
private void waitMessage(boolean show) {
|
||||
if (show)
|
||||
this.mask(Constants.MessageLoadingLayersData);
|
||||
else
|
||||
this.unmask();
|
||||
}
|
||||
|
||||
protected void getTransectUrl() {
|
||||
gisViewerServiceAsync.getTransectUrl(new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
MessageBox.alert("Error retrieving the transect url", caught.getMessage(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
openLayersMap.setTransectUrl(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addGroupByGroupName(final String groupName) {
|
||||
waitMessage(true);
|
||||
gisViewerServiceAsync.getGroupsInfo(groupName, new AsyncCallback<LayerItemsResult>() {
|
||||
public void onSuccess(LayerItemsResult result) {
|
||||
waitMessage(false);
|
||||
if (!result.getStatus().equals(""))
|
||||
MessageBox.alert("Error", result.getStatus(), null);
|
||||
|
||||
if (result.getLayerItemsSize()!=0) {
|
||||
List<LayerItem> layerItems = result.getLayerItems();
|
||||
addLayersOnMap(layerItems, false);
|
||||
showLayer(layerItems.get(layerItems.size()-1)); // show last layer
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
waitMessage(false);
|
||||
Window.alert("The layers doesn't exist");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addLayersByLayerNames(String ... layerNames) {
|
||||
addLayersByLayerNames(Arrays.asList(layerNames));
|
||||
}
|
||||
|
||||
public void addLayersByLayerNames(List<String> layerNames) {
|
||||
addLayersByLayerNames(layerNames, false);
|
||||
}
|
||||
|
||||
public void addLayersByLayerNamesToTop(final List<String> layerNames) {
|
||||
addLayersByLayerNames(layerNames, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItems
|
||||
*/
|
||||
public void addLayersByLayerItems(List<LayerItem> layerItems) {
|
||||
addLayersByLayerItems(layerItems, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
*/
|
||||
public void addLayerByLayerItem(LayerItem layerItem) {
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
layerItems.add(layerItem);
|
||||
addLayersByLayerItems(layerItems, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItems
|
||||
*/
|
||||
public void addLayersByLayerItemsToTop(List<LayerItem> layerItems) {
|
||||
addLayersByLayerItems(layerItems, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
*/
|
||||
public void addLayerByLayerItemToTop(LayerItem layerItem) {
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
layerItems.add(layerItem);
|
||||
addLayersByLayerItems(layerItems, true);
|
||||
}
|
||||
|
||||
// public void addLayersByLayerConfigurations(LayerConfiguration ... layersConfigurations) {
|
||||
// this.addLayersByLayerConfigurations(Arrays.asList(layersConfigurations), false);
|
||||
// }
|
||||
//
|
||||
// public void addLayersByLayerConfigurationsToTop(LayerConfiguration ... layersConfigurations) {
|
||||
// this.addLayersByLayerConfigurations(Arrays.asList(layersConfigurations), true);
|
||||
// }
|
||||
//
|
||||
// private void addLayersByLayerConfigurations(final List<LayerConfiguration> layerConfigurations, final boolean toTop) {
|
||||
// waitMessage(true);
|
||||
// gisViewerServiceAsync.getLayersInfoByLayerConfigurations(layerConfigurations, new AsyncCallback<LayerItemsResult>() {
|
||||
//
|
||||
// public void onSuccess(LayerItemsResult result) {
|
||||
// waitMessage(false);
|
||||
// if (!result.getStatus().equals(""))
|
||||
// MessageBox.alert("Error", result.getStatus(), null);
|
||||
//
|
||||
// if (result.getLayerItemsSize()!=0)
|
||||
// addLayersOnMap(result.getLayerItems(), toTop);
|
||||
// }
|
||||
//
|
||||
// public void onFailure(Throwable caught) {
|
||||
// waitMessage(false);
|
||||
// caught.printStackTrace();
|
||||
// Window.alert("The layers doesn't exist");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private void addLayersByLayerNames(final List<String> layerNames, final boolean toTop) {
|
||||
waitMessage(true);
|
||||
gisViewerServiceAsync.getLayersInfo(layerNames, new AsyncCallback<LayerItemsResult>() {
|
||||
public void onSuccess(LayerItemsResult result) {
|
||||
waitMessage(false);
|
||||
if (!result.getStatus().equals(""))
|
||||
MessageBox.alert("Error", result.getStatus(), null);
|
||||
|
||||
if (result.getLayerItemsSize()!=0)
|
||||
addLayersOnMap(result.getLayerItems(), toTop);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
waitMessage(false);
|
||||
Window.alert("The layers doesn't exist");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addLayersByLayerItems(List<LayerItem> layerItems, final boolean onTop) {
|
||||
waitMessage(true);
|
||||
gisViewerServiceAsync.getLayersInfoByLayerItems(layerItems, new AsyncCallback<LayerItemsResult>() {
|
||||
public void onSuccess(LayerItemsResult result) {
|
||||
waitMessage(false);
|
||||
if (!result.getStatus().equals(""))
|
||||
MessageBox.alert("Error", result.getStatus(), null);
|
||||
|
||||
if (result.getLayerItemsSize()!=0)
|
||||
addLayersOnMap(result.getLayerItems(), onTop);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
waitMessage(false);
|
||||
Window.alert("The layers doesn't exist");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addLayerByWms(String title, String layerName, String url, boolean isBase, boolean displayInLayerSwitcher) {
|
||||
LayerItem l = new LayerItem();
|
||||
l.setBaseLayer(isBase);
|
||||
l.setTitle(title);
|
||||
l.setName(layerName);
|
||||
l.setLayer(layerName);
|
||||
l.setUrl(url);
|
||||
l.setGeoserverUrl(url);
|
||||
l.setGeoserverWmsUrl(url);
|
||||
l.setExternal(true);
|
||||
l.setOpacity(1d);
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
layerItems.add(l);
|
||||
|
||||
openLayersMap.addLayerItemByWms(l, displayInLayerSwitcher);
|
||||
layersPanel.addLayerItems(layerItems, false);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
private void addLayersOnMap(List<LayerItem> layerItems, boolean toTop) {
|
||||
for (LayerItem layerItem : layerItems)
|
||||
layerItem.setBaseLayer(false);
|
||||
openLayersMap.addLayerItems(layerItems, toTop);
|
||||
layersPanel.addLayerItems(layerItems, toTop);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
public void removeAllLayers() {
|
||||
if (openLayersMap!=null && openLayersMap.getLayerItems()!=null && openLayersMap.getLayerItems().size()>0) {
|
||||
List<LayerItem> layers = new ArrayList<LayerItem>();
|
||||
layers.addAll(openLayersMap.getLayerItems());
|
||||
for (LayerItem l: layers)
|
||||
removeLayer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.gisviewer.client.layerspanel.LayersPanelHandler#removeLayer(org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem)
|
||||
*/
|
||||
@Override
|
||||
public void removeLayer(LayerItem layerItem) {
|
||||
openLayersMap.removeLayer(layerItem);
|
||||
layersPanel.removeLayer(layerItem);
|
||||
updateLayersOrder();
|
||||
}
|
||||
|
||||
private void createOpenLayersMap() { // TODO update for pluggable layers
|
||||
openLayersMap = new OpenLayersMap(Constants.omWidth + "px",
|
||||
Constants.omHeight + "px", 12, "GisViewer ver. "+Constants.VERSION, this);
|
||||
|
||||
toolBarPanel = new ToolBarPanel(this, openLayersMap);
|
||||
// toolBarPanel.setStyleName("x-toolbar");
|
||||
openLayersMap.addToolBar(toolBarPanel);
|
||||
}
|
||||
|
||||
private List<String> gerUrlsForClickData(ClickDataInfo clickDataInfo) {
|
||||
List<String> urls = new ArrayList<String>();
|
||||
|
||||
if (clickDataInfo==null)
|
||||
return urls;
|
||||
|
||||
// get visible layers
|
||||
List<LayerItem> visibleLayerItems = layersPanel.getVisibleLayers();
|
||||
|
||||
if (clickDataInfo.isPoint()) {
|
||||
// group layers by geoserver
|
||||
List<GeoserverItem> geoserverItems = groupLayersByGeoserver(visibleLayerItems, true);
|
||||
|
||||
// create a list of url request for data (for each geoserver)
|
||||
for (GeoserverItem geoserverItem : geoserverItems) {
|
||||
String urlRequest = URLMakers.getURL(clickDataInfo, openLayersMap.getProjection(), geoserverItem.getLayerItems());
|
||||
urls.add(geoserverItem.getUrl() + urlRequest);
|
||||
}
|
||||
} else if (clickDataInfo.isBox()) {
|
||||
for (LayerItem layerItem : visibleLayerItems)
|
||||
urls.add(URLMakers.getWfsFeatureUrl(layerItem, clickDataInfo.getBbox(), 0, "csv"));
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
public void showDataPanel() {
|
||||
if (lastClickDataInfo==null)
|
||||
return;
|
||||
|
||||
if (lastClickDataInfo.isPoint()) {
|
||||
List<String> urls = gerUrlsForClickData(lastClickDataInfo);
|
||||
mainPanel.setDataPanelWait(true);
|
||||
|
||||
gisViewerServiceAsync.getDataResult(urls,
|
||||
new AsyncCallback<List<DataResult>>() {
|
||||
@Override
|
||||
public void onSuccess(List<DataResult> result) {
|
||||
DataResultPanel dpanel = new DataResultPanel();
|
||||
dpanel.setDataResult(result);
|
||||
mainPanel.setDataPanelContent(dpanel);
|
||||
mainPanel.setDataPanelWait(false);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
mainPanel.setDataPanelWait(false);
|
||||
mainPanel.setDataPanelMessage("Data Error");
|
||||
}
|
||||
});
|
||||
} else if (lastClickDataInfo.isBox()) {
|
||||
String bbox = lastClickDataInfo.getBbox();
|
||||
mainPanel.setDataPanelWait(true);
|
||||
|
||||
gisViewerServiceAsync.getDataResult(layersPanel.getVisibleLayers(), bbox, new AsyncCallback<List<WfsTable>>() {
|
||||
@Override
|
||||
public void onSuccess(List<WfsTable> result) {
|
||||
DataResultPanel dpanel = new DataResultPanel();
|
||||
dpanel.setDataResultFromWfs(result);
|
||||
mainPanel.setDataPanelContent(dpanel);
|
||||
mainPanel.setDataPanelWait(false);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
mainPanel.setDataPanelWait(false);
|
||||
mainPanel.setDataPanelMessage("Data Error");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showLegendPopup(LayerItem layerItem, final int left, final int top) {
|
||||
final Dialog dialog = new Dialog(){
|
||||
@Override
|
||||
protected void onAfterLayout() {
|
||||
super.onAfterLayout();
|
||||
if (this.getHeight()>Constants.legendDialogMaxHeight) {
|
||||
this.setAutoHeight(false);
|
||||
this.setHeight(Constants.legendDialogMaxHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
dialog.setHeading("Legend");
|
||||
dialog.setBodyStyleName("pad-text");
|
||||
dialog.setScrollMode(Scroll.AUTO);
|
||||
dialog.setHideOnButtonClick(true);
|
||||
dialog.setBodyStyle("background-color:#FFFFFF");
|
||||
dialog.setWidth(Constants.legendDialogWidth);
|
||||
dialog.setAutoWidth(true);
|
||||
dialog.setAutoHeight(true);
|
||||
dialog.setPosition(left, top);
|
||||
dialog.setActive(false);
|
||||
|
||||
String url = layerItem.getGeoserverWmsUrl()
|
||||
+ "?service=WMS&version=1.1.1&request=GetLegendGraphic&"
|
||||
+ "layer="
|
||||
+ layerItem.getLayer()
|
||||
+ "&format=image/png"
|
||||
+ "&STYLE="
|
||||
+ layerItem.getStyle()
|
||||
+ "&LEGEND_OPTIONS=forceRule:True;dx:0.2;dy:0.2;mx:0.2;my:0.2;fontStyle:bold;"
|
||||
+ "borderColor:000000;border:true;fontColor:000000;fontSize:14";
|
||||
|
||||
final Image img = new Image(url);
|
||||
img.addLoadHandler(new LoadHandler(){
|
||||
public void onLoad(LoadEvent event) {
|
||||
int h = img.getHeight();
|
||||
int w = img.getWidth();
|
||||
if (h>Constants.legendDialogMaxHeight-13) {
|
||||
dialog.setAutoHeight(false);
|
||||
dialog.setHeight(Constants.legendDialogMaxHeight);
|
||||
}
|
||||
dialog.setAutoWidth(false);
|
||||
dialog.setWidth(w<50 ? w+100 : w+50);
|
||||
}
|
||||
});
|
||||
dialog.add(img);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public void updateOpenLayersSize() {
|
||||
if (openLayersMap!=null)
|
||||
openLayersMap.updateSize();
|
||||
}
|
||||
|
||||
public void openBrowserMapImage(String outputFormat, boolean isWMS) {
|
||||
String url = getMapImageUrl(outputFormat, isWMS);
|
||||
Window.open(url, "_blank", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSaveSupported() {
|
||||
return (gisViewerSaveHandler!=null);
|
||||
}
|
||||
|
||||
|
||||
public void saveMapImage(String outputFormat, boolean isWMS) {
|
||||
//String url = getMapImageUrl(outputFormat, isWMS);
|
||||
|
||||
String fileName = "MapImage_"+DateTimeFormat.getFormat("yyyy-MM-dd").format(new Date());
|
||||
|
||||
MapViewInfo mapViewInfo = openLayersMap.getMapViewInfo();
|
||||
|
||||
String bbox = mapViewInfo.getLowerLeftX()
|
||||
+ "," + mapViewInfo.getLowerLeftY()
|
||||
+ "," + mapViewInfo.getUpperRightX()
|
||||
+ "," + mapViewInfo.getUpperRightY();
|
||||
String width = ""+mapViewInfo.getWidth();
|
||||
String height = ""+mapViewInfo.getHeight();
|
||||
|
||||
// get visible layers
|
||||
List<LayerItem> visibleLayers = new ArrayList<LayerItem>();
|
||||
visibleLayers.add(openLayersMap.getActiveBaseLayer());
|
||||
visibleLayers.addAll(layersPanel.getVisibleLayers());
|
||||
List<GeoserverItem> geoserverItems = groupLayersByGeoserver(visibleLayers, false);
|
||||
|
||||
ArrayList<String> geoservers = new ArrayList<String>();
|
||||
ArrayList<String> layers = new ArrayList<String>();
|
||||
ArrayList<String> styles = new ArrayList<String>();
|
||||
ArrayList<String> opacities = new ArrayList<String>();
|
||||
ArrayList<String> cqlfilters = new ArrayList<String>();
|
||||
ArrayList<String> gsrefs = new ArrayList<String>();
|
||||
|
||||
|
||||
int gsIndex=0;
|
||||
for (GeoserverItem geoserverItem: geoserverItems) {
|
||||
geoservers.add(geoserverItem.getUrl());
|
||||
//geoservers.add(URLMakers.encodeUrl(geoserverItem.getUrl()));
|
||||
|
||||
for (LayerItem layerItem: geoserverItem.getLayerItems()) {
|
||||
String cqlFilter = layerItem.getCqlFilter();
|
||||
|
||||
layers.add(layerItem.getLayer());
|
||||
styles.add((layerItem.getStyle()==null ? "null" : layerItem.getStyle()));
|
||||
opacities.add(""+layerItem.getOpacity());
|
||||
cqlfilters.add((cqlFilter.equals("") ? "null" : cqlFilter));
|
||||
|
||||
gsrefs.add(""+gsIndex);
|
||||
}
|
||||
}
|
||||
|
||||
gisViewerSaveHandler.saveMapImage(fileName, outputFormat, bbox, width, height,
|
||||
geoservers.toArray(new String[geoservers.size()]),
|
||||
layers.toArray(new String[layers.size()]),
|
||||
styles.toArray(new String[styles.size()]),
|
||||
opacities.toArray(new String[opacities.size()]),
|
||||
cqlfilters.toArray(new String[cqlfilters.size()]),
|
||||
gsrefs.toArray(new String[gsrefs.size()]));
|
||||
}
|
||||
|
||||
private String getMapImageUrl(String outputFormat, boolean isWMS) {
|
||||
boolean firstGs=true, firstLayer=true;
|
||||
|
||||
if (openLayersMap==null || layersPanel==null)
|
||||
return null;
|
||||
|
||||
// get visible layers
|
||||
List<LayerItem> visibleLayers = new ArrayList<LayerItem>();
|
||||
visibleLayers.add(openLayersMap.getActiveBaseLayer());
|
||||
visibleLayers.addAll(layersPanel.getVisibleLayers());
|
||||
List<GeoserverItem> geoserverItems = groupLayersByGeoserver(visibleLayers, false);
|
||||
|
||||
String strGeoservers="", strOpacities="", strLayers="", strStyles="", strCqlFilters="", strGeoserverRefs="";
|
||||
|
||||
int gsIndex=0;
|
||||
for (GeoserverItem geoserverItem: geoserverItems) {
|
||||
String geoserverUrl = URLMakers.encodeUrl(geoserverItem.getUrl());
|
||||
strGeoservers += ((firstGs) ? "" : ";") + geoserverUrl;
|
||||
|
||||
for (LayerItem layerItem: geoserverItem.getLayerItems()) {
|
||||
String cqlFilter = layerItem.getCqlFilter();
|
||||
strLayers += ((firstLayer) ? "" : ";") + layerItem.getLayer();
|
||||
strStyles += ((firstLayer) ? "" : ";") + (layerItem.getStyle()==null ? "null" : layerItem.getStyle());
|
||||
strOpacities += ((firstLayer) ? "" : ";") + layerItem.getOpacity();
|
||||
strCqlFilters += ((firstLayer) ? "" : ";") + (cqlFilter.equals("") ? "null" : cqlFilter);
|
||||
strGeoserverRefs += ((firstLayer) ? "" : ";") + gsIndex;
|
||||
|
||||
if (firstLayer) firstLayer = false;
|
||||
}
|
||||
gsIndex++;
|
||||
if (firstGs) firstGs = false;
|
||||
}
|
||||
|
||||
MapViewInfo mapViewInfo = openLayersMap.getMapViewInfo();
|
||||
String urlReturn = GWT.getModuleBaseURL() + "MapGenerator?outputFormat="+outputFormat
|
||||
+ "&bbox=" + mapViewInfo.getLowerLeftX()
|
||||
+ "," + mapViewInfo.getLowerLeftY()
|
||||
+ "," + mapViewInfo.getUpperRightX()
|
||||
+ "," + mapViewInfo.getUpperRightY()
|
||||
+ "&width=" + mapViewInfo.getWidth()
|
||||
+ "&height=" + mapViewInfo.getHeight()
|
||||
+ "&geoservers=" + strGeoservers
|
||||
+ "&layers=" + strLayers
|
||||
+ "&styles=" + strStyles
|
||||
+ "&opacities=" + strOpacities
|
||||
+ "&cqlfilters=" + strCqlFilters
|
||||
+ "&gsrefs=" + strGeoserverRefs;
|
||||
|
||||
return urlReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void exportData(boolean force) {
|
||||
if (force) {
|
||||
List<String> urls = gerUrlsForClickData(lastClickDataInfo);
|
||||
for (String url : urls) {
|
||||
System.out.println("WFS: "+url);
|
||||
Window.open(url, "_blank", "");
|
||||
}
|
||||
} else {
|
||||
if (lastClickDataInfo!=null && lastClickDataInfo.isHardQuery())
|
||||
MessageBox.confirm("Warning"
|
||||
, ALERT_HARD_SPATIAL_QUERY
|
||||
,new Listener<MessageBoxEvent>(){
|
||||
@Override
|
||||
public void handleEvent(MessageBoxEvent be) {
|
||||
if (be.getButtonClicked().getText().contentEquals("Yes"))
|
||||
exportData(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
else
|
||||
exportData(true);
|
||||
}
|
||||
}
|
||||
|
||||
private String getLayerImageUrl(LayerItem layerItem, String format,
|
||||
boolean isWMS) {
|
||||
String url;
|
||||
if (isWMS) {
|
||||
String cqlFilter = layerItem.getCqlFilter();
|
||||
MapViewInfo mapViewInfo = openLayersMap.getMapViewInfo();
|
||||
url = "/wms?SERVICE=WMS&version=1.1.0&REQUEST=GetMap&LAYERS="
|
||||
+ layerItem.getLayer()
|
||||
+ "&STYLES="
|
||||
+ layerItem.getStyle()
|
||||
+ "&BBOX=" + mapViewInfo.getLowerLeftX()
|
||||
+ "," + mapViewInfo.getLowerLeftY()
|
||||
+ "," + mapViewInfo.getUpperRightX()
|
||||
+ "," + mapViewInfo.getUpperRightY()
|
||||
+ "&WIDTH=" + mapViewInfo.getWidth()
|
||||
+"&HEIGHT=" + mapViewInfo.getHeight()
|
||||
+ (cqlFilter.equals("") ? "" : "&CQL_FILTER="+cqlFilter)
|
||||
+"&SRS=EPSG:4326"
|
||||
+ "&FORMAT=" + format;
|
||||
} else {
|
||||
|
||||
url = "/ows?service=WFS&version=1.0.0&request=GetFeature&typeName="
|
||||
+ layerItem.getLayer() + "&outputFormat=" + format;
|
||||
}
|
||||
return layerItem.getGeoserverUrl()+url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openBrowserLayerImage(LayerItem layerItem, String format, boolean isWMS) {
|
||||
String url = getLayerImageUrl(layerItem, format, isWMS);
|
||||
Constants.log("open layer: " + url);
|
||||
Window.open(url, "_blank", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveLayerImage(LayerItem layerItem, String format, boolean isWMS) {
|
||||
String url = getLayerImageUrl(layerItem, format, isWMS);
|
||||
Constants.log("open layer: " + url);
|
||||
gisViewerSaveHandler.saveLayerImage(layerItem.getName(), format, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLegend(LayerItem layerItem, int left, int top) {
|
||||
showLegendPopup(layerItem, left, top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeLegend(LayerItem layerItem, String style) {
|
||||
openLayersMap.setNewStyle(layerItem, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpacityLayer(LayerItem layerItem, double value) {
|
||||
openLayersMap.setOpacity(layerItem, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLayer(LayerItem layerItem) {
|
||||
openLayersMap.setVisibility(layerItem, true);
|
||||
layersPanel.setLayerVisible(layerItem, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLayer(LayerItem layerItem) {
|
||||
openLayersMap.setVisibility(layerItem, false);
|
||||
layersPanel.setLayerVisible(layerItem, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showFilterQuery(final LayerItem layerItem, int left, int top) {
|
||||
cqlFilterPanel.open(layerItem, left, top);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFilterQuery(LayerItem layerItem) {
|
||||
removeCqlFilter(layerItem);
|
||||
}
|
||||
|
||||
private List<GeoserverItem> groupLayersByGeoserver(List<LayerItem> layerItems, boolean forData) {
|
||||
List<GeoserverItem> geoserverItems = new ArrayList<GeoserverItem>();
|
||||
boolean found;
|
||||
|
||||
for (LayerItem layerItem : layerItems) {
|
||||
// FIXME: now the "fifao_*" layers were not considerated beacause they belong to fao datastore
|
||||
if (forData && (layerItem.isExternal() || layerItem.getName().substring(0, 6).equals(Constants.FAO_DATA_STORE_PREFIX)))
|
||||
; // do nothing, the layer is skipped
|
||||
else {
|
||||
found = false;
|
||||
for (GeoserverItem geoserverItem : geoserverItems)
|
||||
if (layerItem.getGeoserverWmsUrl().equals(geoserverItem.getUrl())) {
|
||||
geoserverItem.addLayerItem(layerItem);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
GeoserverItem geoserverItem = (forData ?
|
||||
new GeoserverItem(layerItem.getGeoserverUrl()) :
|
||||
new GeoserverItem(layerItem.getGeoserverWmsUrl())
|
||||
);
|
||||
geoserverItem.addLayerItem(layerItem);
|
||||
geoserverItems.add(geoserverItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return geoserverItems;
|
||||
}
|
||||
|
||||
public void addGroup(String groupName) {
|
||||
this.addGroupByGroupName(groupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLayersOrder() {
|
||||
this.openLayersMap.updateLayersOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCQLFilter(LayerItem layerItem, String filter) {
|
||||
if (filter==null || filter.equals(""))
|
||||
removeCqlFilter(layerItem);
|
||||
else {
|
||||
openLayersMap.setCqlFilter(layerItem, filter);
|
||||
layersPanel.setCqlTip(layerItem, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCqlFilter(LayerItem layerItem) {
|
||||
if (layerItem.getCqlFilter()!=null || layerItem.getCqlFilter().equals("")) {
|
||||
openLayersMap.removeCqlFilter(layerItem);
|
||||
layersPanel.setCqlTip(layerItem, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateTransect(LayerItem layerItem, String table, String field) {
|
||||
toolBarPanel.setAllUp();
|
||||
toolBarPanel.setTransectPanelVisible(layerItem, true);
|
||||
layersPanel.setTransectTip(layerItem, true);
|
||||
openLayersMap.activateTransectDraw(true);
|
||||
openLayersMap.activateZoomIn(false);
|
||||
openLayersMap.activatePan(false);
|
||||
openLayersMap.activateClickData(false);
|
||||
openLayersMap.setTableTransect(table);
|
||||
openLayersMap.setFieldTransect(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivateTransect(LayerItem layerItem) {
|
||||
layersPanel.setTransectTip(layerItem, false);
|
||||
toolBarPanel.setTransectPanelVisible(layerItem, false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.gisviewer.client.datafeature.DataPanelHandler#panelOpen(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void dataPanelOpen(boolean isOpen, int panelHeight) {
|
||||
DataPanelOpenListener handler = parameters.getDataPanelOpenHandler();
|
||||
if (handler!=null)
|
||||
handler.dataPanelOpen(isOpen, panelHeight);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.gisviewer.client.openlayers.OpenLayersHandler#selectBox(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void selectBox(double x1, double y1, double x2, double y2) {
|
||||
if (toolBarPanel!=null) {// && toolBarPanel.isClickBox()) {
|
||||
// create a new click data information
|
||||
lastClickDataInfo = new ClickDataInfo(x1, y1, x2, y2);
|
||||
|
||||
// create a list of url request for data (for each geoserver)
|
||||
showDataPanel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class GisViewerParameters {
|
||||
|
||||
private String projection = null;
|
||||
private String openingGroup = null;
|
||||
private List<String> openingLayers = null;
|
||||
private GisViewerSaveHandler gisViewerSaveHandler = null;
|
||||
private DataPanelOpenListener dataPanelOpenHandler = null;
|
||||
private boolean openDataPanelAtStart = Constants.geoWindowDataPanelOpenedAtStart;
|
||||
|
||||
//protected static GisViewerParameters instance = new GisViewerParameters();
|
||||
// public static GisViewerParameters getInstance() {
|
||||
// return instance;
|
||||
// }
|
||||
|
||||
public GisViewerParameters(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param projection
|
||||
* @param groupName
|
||||
* @param layers
|
||||
* @param gisViewerSaveHandler
|
||||
*/
|
||||
public GisViewerParameters(String projection, String openingGroup, List<String> openingLayers, GisViewerSaveHandler gisViewerSaveHandler) {
|
||||
this.projection = projection;
|
||||
this.openingGroup = openingGroup;
|
||||
this.openingLayers = openingLayers;
|
||||
this.gisViewerSaveHandler = gisViewerSaveHandler;
|
||||
}
|
||||
|
||||
public void setProjection(String projection) {
|
||||
this.projection = projection;
|
||||
}
|
||||
|
||||
public void setOpeningGroup(String groupName) {
|
||||
this.openingGroup = groupName;
|
||||
}
|
||||
|
||||
public void setOpeningLayers(List<String> layers) {
|
||||
this.openingLayers = layers;
|
||||
}
|
||||
|
||||
public void setOpeningLayers(String[] layers) {
|
||||
this.openingLayers = Arrays.asList(layers);
|
||||
}
|
||||
|
||||
|
||||
public String getProjection() {
|
||||
return projection;
|
||||
}
|
||||
|
||||
public String getOpeningGroup() {
|
||||
return this.openingGroup;
|
||||
}
|
||||
|
||||
public List<String> getOpeningLayers() {
|
||||
return this.openingLayers;
|
||||
}
|
||||
|
||||
public void setGisViewerSaveHandler(GisViewerSaveHandler gisViewerSaveHandler) {
|
||||
this.gisViewerSaveHandler = gisViewerSaveHandler;
|
||||
}
|
||||
|
||||
public GisViewerSaveHandler getGisViewerSaveHandler() {
|
||||
return gisViewerSaveHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the openDataPanelAtStart
|
||||
*/
|
||||
public boolean isOpenDataPanelAtStart() {
|
||||
return openDataPanelAtStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param openDataPanelAtStart the openDataPanelAtStart to set
|
||||
*/
|
||||
public void setOpenDataPanelAtStart(boolean openDataPanelAtStart) {
|
||||
this.openDataPanelAtStart = openDataPanelAtStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataPanelOpenHandler the dataPanelOpenHandler to set
|
||||
*/
|
||||
public void setDataPanelOpenListener(DataPanelOpenListener dataPanelOpenHandler) {
|
||||
this.dataPanelOpenHandler = dataPanelOpenHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataPanelOpenHandler
|
||||
*/
|
||||
public DataPanelOpenListener getDataPanelOpenHandler() {
|
||||
return dataPanelOpenHandler;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
public interface GisViewerSaveHandler {
|
||||
public void saveLayerImage(String name, String contentType, String url);
|
||||
|
||||
public void saveMapImage(String name,
|
||||
String outputFormat,
|
||||
String bbox,
|
||||
String width,
|
||||
String height,
|
||||
String[] geoservers,
|
||||
String[] layers,
|
||||
String[] styles,
|
||||
String[] opacities,
|
||||
String[] cqlfilters,
|
||||
String[] gsrefs);
|
||||
|
||||
//public void saveMapImage(String name, String contentType, String url);
|
||||
}
|
||||
|
||||
// public void saveLayer(String name, String contentType, String url);
|
||||
// public void saveGroup(
|
||||
// GroupInfo groupInfo,
|
||||
// String format,
|
||||
// String contentType);
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItemsResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
||||
/**
|
||||
* The client side stub for the RPC service.
|
||||
*/
|
||||
@RemoteServiceRelativePath("GisViewerService")
|
||||
public interface GisViewerService extends RemoteService {
|
||||
|
||||
String getTransectUrl();
|
||||
|
||||
List<DataResult> getDataResult(List<String> urls);
|
||||
|
||||
LayerItemsResult getGroupsInfo(String groupName);
|
||||
|
||||
LayerItemsResult getLayersInfo(List<String> layersName);
|
||||
|
||||
LayerItemsResult getLayersInfoByLayerItems(List<LayerItem> layerItems);
|
||||
|
||||
List<WfsTable> getDataResult(List<LayerItem> layerItems, String bbox);
|
||||
|
||||
// LayerItemsResult getLayersInfoByLayerConfigurations(List<LayerConfiguration> layerConfigurations);
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItemsResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* The async counterpart of <code>GreetingService</code>.
|
||||
*/
|
||||
public interface GisViewerServiceAsync {
|
||||
|
||||
public void getDataResult(List<String> urls, AsyncCallback<List<DataResult>> callback);
|
||||
|
||||
public void getGroupsInfo(String groupName, AsyncCallback<LayerItemsResult> callback);
|
||||
|
||||
public void getLayersInfo(List<String> layersName, AsyncCallback<LayerItemsResult> callback);
|
||||
|
||||
public void getLayersInfoByLayerItems(List<LayerItem> layerItems, AsyncCallback<LayerItemsResult> asyncCallback);
|
||||
|
||||
void getTransectUrl(AsyncCallback<String> callback);
|
||||
|
||||
public void getDataResult(List<LayerItem> layerItems, String bbox, AsyncCallback<List<WfsTable>> asyncCallback);
|
||||
|
||||
// public void getLayersInfoByLayerConfigurations(List<LayerConfiguration> layerConfigurations, AsyncCallback<LayerItemsResult> asyncCallback);
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class BoundsMap implements IsSerializable{
|
||||
|
||||
private double lowerLeftX = 0.0;
|
||||
private double lowerLeftY = 0.0;
|
||||
private double upperRightX = 0.0;
|
||||
private double upperRightY = 0.0;
|
||||
private String crs = "";
|
||||
|
||||
public BoundsMap() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public BoundsMap(double lowerLeftX, double lowerLeftY, double upperRightX,
|
||||
double upperRightY, String crs) {
|
||||
super();
|
||||
this.lowerLeftX = lowerLeftX;
|
||||
this.lowerLeftY = lowerLeftY;
|
||||
this.upperRightX = upperRightX;
|
||||
this.upperRightY = upperRightY;
|
||||
this.crs = crs;
|
||||
}
|
||||
|
||||
public double getLowerLeftX() {
|
||||
return lowerLeftX;
|
||||
}
|
||||
|
||||
public void setLowerLeftX(double lowerLeftX) {
|
||||
this.lowerLeftX = lowerLeftX;
|
||||
}
|
||||
|
||||
public double getLowerLeftY() {
|
||||
return lowerLeftY;
|
||||
}
|
||||
|
||||
public void setLowerLeftY(double lowerLeftY) {
|
||||
this.lowerLeftY = lowerLeftY;
|
||||
}
|
||||
|
||||
public double getUpperRightX() {
|
||||
return upperRightX;
|
||||
}
|
||||
|
||||
public void setUpperRightX(double upperRightX) {
|
||||
this.upperRightX = upperRightX;
|
||||
}
|
||||
|
||||
public double getUpperRightY() {
|
||||
return upperRightY;
|
||||
}
|
||||
|
||||
public void setUpperRightY(double upperRightY) {
|
||||
this.upperRightY = upperRightY;
|
||||
}
|
||||
|
||||
public String getCrs() {
|
||||
return crs;
|
||||
}
|
||||
|
||||
public void setCrs(String crs) {
|
||||
this.crs = crs;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class CQLQueryObject implements IsSerializable {
|
||||
|
||||
private String layerName;
|
||||
private String cqlQuery;
|
||||
|
||||
public CQLQueryObject() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public CQLQueryObject(String layerName, String cqlQuery) {
|
||||
super();
|
||||
this.layerName = layerName;
|
||||
this.cqlQuery = cqlQuery;
|
||||
}
|
||||
|
||||
public String getLayerName() {
|
||||
return layerName;
|
||||
}
|
||||
|
||||
public void setLayerName(String layerName) {
|
||||
this.layerName = layerName;
|
||||
}
|
||||
|
||||
public String getCqlQuery() {
|
||||
return cqlQuery;
|
||||
}
|
||||
|
||||
public void setCqlQuery(String cqlQuery) {
|
||||
this.cqlQuery = cqlQuery;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class DataResult implements IsSerializable {
|
||||
|
||||
private String title;
|
||||
private ResultTable table;
|
||||
|
||||
public DataResult() {
|
||||
|
||||
}
|
||||
|
||||
public DataResult(String title, ResultTable table) {
|
||||
this.title = title;
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public ResultTable getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
public void setTable(ResultTable table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.utils.URLMakers;
|
||||
|
||||
public class GeoserverItem {
|
||||
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
String url;
|
||||
|
||||
|
||||
public GeoserverItem(String url) {
|
||||
super();
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void addLayerItem(LayerItem layerItem) {
|
||||
this.layerItems.add(layerItem);
|
||||
}
|
||||
|
||||
public List<LayerItem> getLayerItems() {
|
||||
return layerItems;
|
||||
}
|
||||
|
||||
public void setLayerItems(List<LayerItem> layerItems) {
|
||||
this.layerItems = layerItems;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = "";
|
||||
s += "GEOSERVER " + url + "\n LAYERS " ;
|
||||
for (LayerItem l : layerItems)
|
||||
s += l.getName() + ",";
|
||||
s += "\n";
|
||||
return s;
|
||||
}
|
||||
//
|
||||
// List<LayerItem> layersItems = new ArrayList<LayerItem>();
|
||||
// String geoserverUrl, wmsUrl, gwcUrl;
|
||||
//
|
||||
//
|
||||
// public GeoserverItem(String wmsUrl) {
|
||||
// super();
|
||||
// this.wmsUrl = wmsUrl;
|
||||
// }
|
||||
//
|
||||
// public GeoserverItem(String geoserverUrl, boolean isGeoserverUrl) {
|
||||
// if (isGeoserverUrl) {
|
||||
// this.geoserverUrl = geoserverUrl;
|
||||
// this.wmsUrl = URLMakers.getGeoserverWmsUrl(geoserverUrl);
|
||||
// this.gwcUrl = URLMakers.getGeoserverGwcUrl(geoserverUrl);
|
||||
// } else
|
||||
// this.wmsUrl = geoserverUrl;
|
||||
// }
|
||||
//
|
||||
// public GeoserverItem(String geoserverUrl, String wmsUrl, String gwcUrl) {
|
||||
// super();
|
||||
// this.geoserverUrl = geoserverUrl;
|
||||
// this.wmsUrl = wmsUrl;
|
||||
// this.gwcUrl = gwcUrl;
|
||||
// }
|
||||
//
|
||||
// public void addLayerItem(LayerItem layerItem) {
|
||||
// this.layersItems.add(layerItem);
|
||||
// }
|
||||
//
|
||||
// public List<LayerItem> getLayerItems() {
|
||||
// return layersItems;
|
||||
// }
|
||||
//
|
||||
// public void setLayersItems(List<LayerItem> layersItems) {
|
||||
// this.layersItems = layersItems;
|
||||
// }
|
||||
//
|
||||
// public String getGeoserverUrl() {
|
||||
// return geoserverUrl;
|
||||
// }
|
||||
//
|
||||
// public void setGeoserverUrl(String geoserverUrl) {
|
||||
// this.geoserverUrl = geoserverUrl;
|
||||
// }
|
||||
//
|
||||
// public String getWmsUrl() {
|
||||
// return wmsUrl;
|
||||
// }
|
||||
//
|
||||
// public void setWmsUrl(String wmsUrl) {
|
||||
// this.wmsUrl = wmsUrl;
|
||||
// }
|
||||
//
|
||||
// public String getGwcUrl() {
|
||||
// return gwcUrl;
|
||||
// }
|
||||
//
|
||||
// public void setGwcUrl(String gwcUrl) {
|
||||
// this.gwcUrl = gwcUrl;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// String s = "";
|
||||
// s += "GEOSERVER " + geoserverUrl + "\n LAYERS " ;
|
||||
// for (LayerItem l : layersItems)
|
||||
// s += l.getName() + ",";
|
||||
// s += "\n";
|
||||
// return s;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class GroupInfo implements IsSerializable{
|
||||
|
||||
private String name;
|
||||
private ArrayList<LayerItem> layers;
|
||||
private BoundsMap bounds;
|
||||
|
||||
public GroupInfo() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public GroupInfo(String name, ArrayList<LayerItem> layers, BoundsMap bounds) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.layers = layers;
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ArrayList<LayerItem> getLayers() {
|
||||
return layers;
|
||||
}
|
||||
|
||||
public void setLayers(ArrayList<LayerItem> layers) {
|
||||
this.layers = layers;
|
||||
}
|
||||
|
||||
public BoundsMap getBounds() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public void setBounds(BoundsMap bounds) {
|
||||
this.bounds = bounds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public class LayerConfiguration implements Serializable {
|
||||
//
|
||||
// String layerName;
|
||||
//
|
||||
// LayerItem layerItem;
|
||||
//
|
||||
// boolean isVisible = true;
|
||||
//
|
||||
// double opacity = Constants.defaultOpacityLayers; // TODO
|
||||
//
|
||||
// public LayerConfiguration() {
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerName
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(String layerName, boolean isVisible, double opacity) {
|
||||
// super();
|
||||
// this.layerName = layerName;
|
||||
// this.isVisible = isVisible;
|
||||
// this.opacity = opacity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerName
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(String layerName, boolean isVisible) {
|
||||
// super();
|
||||
// this.layerName = layerName;
|
||||
// this.isVisible = isVisible;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerName
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(String layerName, double opacity) {
|
||||
// super();
|
||||
// this.layerName = layerName;
|
||||
// this.opacity = opacity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerTitle
|
||||
// */
|
||||
// public LayerConfiguration(String layerName) {
|
||||
// super();
|
||||
// this.layerName = layerName;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @param layerItem
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(LayerItem layerItem, boolean isVisible, double opacity) {
|
||||
// super();
|
||||
// this.layerItem = layerItem;
|
||||
// this.isVisible = isVisible;
|
||||
// this.opacity = opacity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerItem
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(LayerItem layerItem, boolean isVisible) {
|
||||
// super();
|
||||
// this.layerItem = layerItem;
|
||||
// this.isVisible = isVisible;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerItem
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(LayerItem layerItem, double opacity) {
|
||||
// super();
|
||||
// this.layerItem = layerItem;
|
||||
// this.opacity = opacity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerItem
|
||||
// * @param isVisible
|
||||
// * @param opacity
|
||||
// */
|
||||
// public LayerConfiguration(LayerItem layerItem) {
|
||||
// super();
|
||||
// this.layerItem = layerItem;
|
||||
// }
|
||||
//
|
||||
// public LayerConfiguration(String title, String name, String wmsUrl, boolean isVisible, double opacity) {
|
||||
// super();
|
||||
// LayerItem layerItem = new LayerItem();
|
||||
// layerItem.setName(name);
|
||||
// layerItem.setTitle(title);
|
||||
// layerItem.setUrl(wmsUrl);
|
||||
// layerItem.setGeoserverUrl(wmsUrl);
|
||||
// layerItem.setGeoserverWmsUrl(wmsUrl);
|
||||
// layerItem.setExternal(true);
|
||||
// this.setLayerItem(layerItem);
|
||||
// this.setVisible(isVisible);
|
||||
// this.setOpacity(opacity);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return the layerName
|
||||
// */
|
||||
// public String getLayerName() {
|
||||
// return layerName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerName the layerName to set
|
||||
// */
|
||||
// public void setLayerName(String layerName) {
|
||||
// this.layerName = layerName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return the layerItem
|
||||
// */
|
||||
// public LayerItem getLayerItem() {
|
||||
// return layerItem;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param layerItem the layerItem to set
|
||||
// */
|
||||
// public void setLayerItem(LayerItem layerItem) {
|
||||
// this.layerItem = layerItem;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return the isVisible
|
||||
// */
|
||||
// public boolean isVisible() {
|
||||
// return isVisible;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param isVisible the isVisible to set
|
||||
// */
|
||||
// public void setVisible(boolean isVisible) {
|
||||
// this.isVisible = isVisible;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return the opacity
|
||||
// */
|
||||
// public double getOpacity() {
|
||||
// return opacity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param opacity the opacity to set
|
||||
// */
|
||||
// public void setOpacity(double opacity) {
|
||||
// this.opacity = opacity;
|
||||
// }
|
||||
//
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class LayerDescriptor implements Comparable<LayerDescriptor>, IsSerializable {
|
||||
|
||||
private String id = "";
|
||||
private boolean hasLegend = false;
|
||||
private String name = "";
|
||||
private String father = null;
|
||||
private boolean visible = false;
|
||||
private boolean baseLayer = false;
|
||||
private boolean container = false;
|
||||
private int level_node = 0;
|
||||
|
||||
public LayerDescriptor() {
|
||||
this("ROOT");
|
||||
}
|
||||
|
||||
public LayerDescriptor(String id, boolean hasLegend, String name,
|
||||
String father, boolean visible, boolean baseLayer,
|
||||
boolean container, int levelNode) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.hasLegend = hasLegend;
|
||||
this.name = name;
|
||||
this.father = father;
|
||||
this.visible = visible;
|
||||
this.baseLayer = baseLayer;
|
||||
this.container = container;
|
||||
level_node = levelNode;
|
||||
}
|
||||
|
||||
public LayerDescriptor(String id, boolean hasLegend, String name,
|
||||
String father, boolean visible,
|
||||
boolean container, int levelNode) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.hasLegend = hasLegend;
|
||||
this.name = name;
|
||||
this.father = father;
|
||||
this.visible = visible;
|
||||
this.container = container;
|
||||
level_node = levelNode;
|
||||
}
|
||||
|
||||
public LayerDescriptor(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isHasLegend() {
|
||||
return hasLegend;
|
||||
}
|
||||
|
||||
public void setHasLegend(boolean hasLegend) {
|
||||
this.hasLegend = hasLegend;
|
||||
}
|
||||
|
||||
public boolean isBaseLayer() {
|
||||
return baseLayer;
|
||||
}
|
||||
|
||||
public void setBaseLayer(boolean baseLayer) {
|
||||
this.baseLayer = baseLayer;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isContainer() {
|
||||
return container;
|
||||
}
|
||||
public void setContainer(boolean container) {
|
||||
this.container = container;
|
||||
}
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
public String getFather() {
|
||||
return father;
|
||||
}
|
||||
public void setFather(String father) {
|
||||
this.father = father;
|
||||
}
|
||||
public int getLevel_node() {
|
||||
return level_node;
|
||||
}
|
||||
public void setLevel_node(int level_node) {
|
||||
this.level_node = level_node;
|
||||
}
|
||||
|
||||
public int compareTo(LayerDescriptor o) {
|
||||
// compara i due contatori
|
||||
return this.getName().compareToIgnoreCase(o.getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,363 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class LayerItem implements IsSerializable, Cloneable {
|
||||
|
||||
private String name;
|
||||
private String url;
|
||||
private String layer;
|
||||
private String style;
|
||||
private boolean isTrasparent=false;
|
||||
private boolean isBaseLayer=true;
|
||||
private boolean isBorderLayer=false;
|
||||
private boolean wrapDateLine=true;
|
||||
private int buffer = 0;
|
||||
private boolean hasLegend=false;
|
||||
private boolean isVisible=true;
|
||||
private boolean isOnMap=true;
|
||||
private boolean clickData=true;
|
||||
private BoundsMap maxExtent = null;
|
||||
private String defaultStyle = "";
|
||||
private double opacity = -1;
|
||||
private ArrayList<String> styles = new ArrayList<String>();
|
||||
private String title=null;
|
||||
|
||||
private List<Property> properties = new ArrayList<Property>();
|
||||
private String dataStore = "";
|
||||
private String geoserverUrl;
|
||||
private String geoserverWmsUrl;
|
||||
private String cqlFilter = "";
|
||||
private long id;
|
||||
private long order;
|
||||
private boolean isExternal = false;
|
||||
public static final String FLOAT_TYPE = "xsd:float";
|
||||
public static final String INT_TYPE = "xsd:int";
|
||||
public static long ID_COUNTER = 0;
|
||||
|
||||
|
||||
public LayerItem() {
|
||||
super();
|
||||
this.id = (ID_COUNTER++);
|
||||
}
|
||||
|
||||
public LayerItem(boolean isExternal) {
|
||||
this();
|
||||
this.setExternal(isExternal);
|
||||
}
|
||||
|
||||
public boolean isHasLegend() {
|
||||
return hasLegend;
|
||||
}
|
||||
|
||||
public void setHasLegend(boolean hasLegend) {
|
||||
this.hasLegend = hasLegend;
|
||||
}
|
||||
|
||||
public BoundsMap getMaxExtent() {
|
||||
return maxExtent;
|
||||
}
|
||||
|
||||
public void setMaxExtent(BoundsMap maxExtent) {
|
||||
this.maxExtent = maxExtent;
|
||||
}
|
||||
|
||||
public void setMaxExtent(double lowerLeftX,
|
||||
double lowerLeftY,
|
||||
double upperRightX,
|
||||
double upperRightY,
|
||||
String crs) {
|
||||
|
||||
this.maxExtent = new BoundsMap(lowerLeftX, lowerLeftY, upperRightX, upperRightY, crs);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public String getLayer() {
|
||||
return layer;
|
||||
}
|
||||
public void setLayer(String layer) {
|
||||
this.layer = layer;
|
||||
}
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
public void setStyle(String style) {
|
||||
this.style = style;
|
||||
}
|
||||
public boolean isTrasparent() {
|
||||
return isTrasparent;
|
||||
}
|
||||
public void setTrasparent(boolean isTrasparent) {
|
||||
this.isTrasparent = isTrasparent;
|
||||
}
|
||||
public boolean isBaseLayer() {
|
||||
return isBaseLayer;
|
||||
}
|
||||
public void setBaseLayer(boolean isBaseLayer) {
|
||||
this.isBaseLayer = isBaseLayer;
|
||||
}
|
||||
public boolean isWrapDateLine() {
|
||||
return wrapDateLine;
|
||||
}
|
||||
public void setWrapDateLine(boolean wrapDateLine) {
|
||||
this.wrapDateLine = wrapDateLine;
|
||||
}
|
||||
public int getBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
public void setBuffer(int buffer) {
|
||||
this.buffer = buffer;
|
||||
}
|
||||
public boolean isVisible() {
|
||||
return isVisible;
|
||||
}
|
||||
public void setVisible(boolean isVisible) {
|
||||
this.isVisible = isVisible;
|
||||
}
|
||||
public boolean isOnMap() {
|
||||
return isOnMap;
|
||||
}
|
||||
public void setOnMap(boolean isOnMap) {
|
||||
this.isOnMap = isOnMap;
|
||||
}
|
||||
public boolean isClickData() {
|
||||
return clickData;
|
||||
}
|
||||
public void setClickData(boolean clickData) {
|
||||
this.clickData = clickData;
|
||||
}
|
||||
public String getDefaultStyle() {
|
||||
return defaultStyle;
|
||||
}
|
||||
public void setDefaultStyle(String defaultStyle) {
|
||||
this.defaultStyle = defaultStyle;
|
||||
}
|
||||
public ArrayList<String> getStyles() {
|
||||
return styles;
|
||||
}
|
||||
public void setStyles(ArrayList<String> styles) {
|
||||
this.styles = styles;
|
||||
}
|
||||
public double getOpacity() {
|
||||
return opacity;
|
||||
}
|
||||
|
||||
public void setOpacity(double opacity) {
|
||||
this.opacity = opacity;
|
||||
}
|
||||
|
||||
public LayerItem clone() {
|
||||
LayerItem ele = new LayerItem();
|
||||
|
||||
ele.setBaseLayer(this.isBaseLayer);
|
||||
ele.setClickData(this.clickData);
|
||||
ele.setBuffer(this.buffer);
|
||||
ele.setDefaultStyle(this.defaultStyle);
|
||||
ele.setHasLegend(this.hasLegend);
|
||||
ele.setLayer(this.layer);
|
||||
ele.setMaxExtent(maxExtent);
|
||||
ele.setName(this.name);
|
||||
ele.setOnMap(this.isOnMap);
|
||||
ele.setOpacity(this.opacity);
|
||||
ele.setStyle(this.style);
|
||||
ele.setStyles(this.styles);
|
||||
ele.setTrasparent(this.isTrasparent);
|
||||
ele.setUrl(this.url);
|
||||
ele.setVisible(this.isVisible);
|
||||
ele.setWrapDateLine(this.wrapDateLine);
|
||||
ele.setProperties(this.getProperties());
|
||||
|
||||
return ele;
|
||||
}
|
||||
|
||||
public List<Property> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<Property> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
// search a float property in the layer's feature type
|
||||
public boolean containsProperty(String propertyName) {
|
||||
boolean contains = false;
|
||||
for (Property p : properties) {
|
||||
if (p.getName().equals(propertyName) && (p.getType().equals(FLOAT_TYPE) || p.getType().equals(INT_TYPE)))
|
||||
contains=true;
|
||||
}
|
||||
return contains;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
// search a property in the layer's feature type, giving property name and property type
|
||||
public boolean containsProperty(String propertyName, String propertyType) {
|
||||
if (properties==null)
|
||||
return false;
|
||||
|
||||
boolean contains = false;
|
||||
for (Property p : properties) {
|
||||
if (p.getName().equals(propertyName) && p.getType().equals(propertyType))
|
||||
contains=true;
|
||||
}
|
||||
return contains;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
// search a property in the layer's feature type, giving a property object
|
||||
public boolean containsProperty(Property property) {
|
||||
if (properties==null)
|
||||
return false;
|
||||
|
||||
boolean contains = false;
|
||||
for (Property p : properties) {
|
||||
if (p.getName().equals(property.getName()) && p.getType().equals(property.getType()))
|
||||
contains=true;
|
||||
}
|
||||
return contains;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
// search for float Property objects belongs to the layer
|
||||
public List<Property> getAllFloatProperties() {
|
||||
if (properties==null)
|
||||
return null;
|
||||
|
||||
List<Property> floatProperties = new ArrayList<Property>();
|
||||
for (Property p : properties) {
|
||||
if (p.getType().equals(FLOAT_TYPE))
|
||||
floatProperties.add(p);
|
||||
}
|
||||
return floatProperties;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
// search for float Property names belongs to the layer
|
||||
public List<String> getAllFloatPropertyNames() {
|
||||
if (properties==null)
|
||||
return null;
|
||||
|
||||
List<String> floatPropertyNames = new ArrayList<String>();
|
||||
for (Property p : properties) {
|
||||
if (p.getType().equals(FLOAT_TYPE))
|
||||
floatPropertyNames.add(p.getName());
|
||||
}
|
||||
|
||||
return floatPropertyNames;
|
||||
}
|
||||
|
||||
|
||||
// added by ceras
|
||||
// get the first float Property names belongs to the layer
|
||||
public String getFirstFloatPropertyName() {
|
||||
if (properties==null)
|
||||
return null;
|
||||
|
||||
for (Property p : properties) {
|
||||
if (p.getType().equals(FLOAT_TYPE))
|
||||
return p.getName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public void setDataStore(String dataStore) {
|
||||
this.dataStore = dataStore;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public String getDataStore() {
|
||||
return dataStore;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public void setBorderLayer(boolean isBorderLayer) {
|
||||
this.isBorderLayer = isBorderLayer;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public boolean isBorderLayer() {
|
||||
return isBorderLayer;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public void setGeoserverUrl(String geoserverUrl) {
|
||||
this.geoserverUrl = geoserverUrl;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public String getGeoserverUrl() {
|
||||
return geoserverUrl;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public void setGeoserverWmsUrl(String geoserverWmsUrl) {
|
||||
this.geoserverWmsUrl = geoserverWmsUrl;
|
||||
}
|
||||
|
||||
// added by ceras
|
||||
public String getGeoserverWmsUrl() {
|
||||
return geoserverWmsUrl;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setOrder(long order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public long getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public String getCqlFilter() {
|
||||
return cqlFilter;
|
||||
}
|
||||
|
||||
public void setCqlFilter(String cqlFilter) {
|
||||
this.cqlFilter = cqlFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isExternal the isExternal to set
|
||||
*/
|
||||
public void setExternal(boolean isExternal) {
|
||||
this.isExternal = isExternal;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LayerItemsResult implements Serializable {
|
||||
String status = "";
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
|
||||
public LayerItemsResult() {
|
||||
}
|
||||
|
||||
|
||||
public LayerItemsResult(String status, List<LayerItem> layerItems) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.layerItems = layerItems;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void addStatusMessage(String message) {
|
||||
status += (status=="" ? "" : "<br>") + message;
|
||||
}
|
||||
|
||||
public List<LayerItem> getLayerItems() {
|
||||
return layerItems;
|
||||
}
|
||||
|
||||
public void setLayerItems(List<LayerItem> layerItems) {
|
||||
this.layerItems = layerItems;
|
||||
}
|
||||
|
||||
public void addLayerItem(LayerItem layerItem) {
|
||||
this.layerItems.add(layerItem);
|
||||
}
|
||||
|
||||
|
||||
public int getLayerItemsSize() {
|
||||
return layerItems.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gwtopenmaps.openlayers.client.layer.Layer;
|
||||
|
||||
public class LayersList {
|
||||
HashMap<LayerItem, Layer> hashLayerItems = new HashMap<LayerItem, Layer>();
|
||||
HashMap<Layer, LayerItem> hashLayers = new HashMap<Layer, LayerItem>();
|
||||
|
||||
public LayersList() {
|
||||
}
|
||||
|
||||
public void addLayer(LayerItem layerItem, Layer layer) {
|
||||
this.hashLayerItems.put(layerItem, layer);
|
||||
this.hashLayers.put(layer, layerItem);
|
||||
}
|
||||
|
||||
public Layer getLayerByLayerItem(LayerItem layerItem) {
|
||||
return this.hashLayerItems.get(layerItem);
|
||||
}
|
||||
|
||||
public LayerItem getLayerItemByLayer(Layer layer) {
|
||||
return this.hashLayers.get(layer);
|
||||
}
|
||||
|
||||
public void remove(LayerItem layerItem) {
|
||||
this.hashLayerItems.remove(layerItem);
|
||||
}
|
||||
|
||||
public void remove(Layer layer) {
|
||||
hashLayers.remove(layer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
public class MapViewInfo {
|
||||
double lowerLeftX;
|
||||
double lowerLeftY;
|
||||
double upperRightX;
|
||||
double upperRightY;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
public MapViewInfo(double lowerLeftX, double lowerLeftY,
|
||||
double upperRightX, double upperRightY, int width, int height) {
|
||||
super();
|
||||
this.lowerLeftX = lowerLeftX;
|
||||
this.lowerLeftY = lowerLeftY;
|
||||
this.upperRightX = upperRightX;
|
||||
this.upperRightY = upperRightY;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
|
||||
public double getLowerLeftX() {
|
||||
return lowerLeftX;
|
||||
}
|
||||
|
||||
|
||||
public double getLowerLeftY() {
|
||||
return lowerLeftY;
|
||||
}
|
||||
|
||||
|
||||
public double getUpperRightX() {
|
||||
return upperRightX;
|
||||
}
|
||||
|
||||
|
||||
public double getUpperRightY() {
|
||||
return upperRightY;
|
||||
}
|
||||
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class Property implements IsSerializable, Cloneable {
|
||||
|
||||
private String name;
|
||||
private String type;
|
||||
private boolean nillable=true;
|
||||
private int maxOccours=1;
|
||||
private int minOccours=0;
|
||||
|
||||
public Property() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Property(String name, String type, boolean nillable,
|
||||
int maxOccours, int minOccours) {
|
||||
super();
|
||||
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.nillable = nillable;
|
||||
this.maxOccours = maxOccours;
|
||||
this.minOccours = minOccours;
|
||||
}
|
||||
|
||||
public Property(String name, String type) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isNillable() {
|
||||
return nillable;
|
||||
}
|
||||
|
||||
public void setNillable(boolean nillable) {
|
||||
this.nillable = nillable;
|
||||
}
|
||||
|
||||
public int getMaxOccours() {
|
||||
return maxOccours;
|
||||
}
|
||||
|
||||
public void setMaxOccours(int maxOccours) {
|
||||
this.maxOccours = maxOccours;
|
||||
}
|
||||
|
||||
public int getMinOccours() {
|
||||
return minOccours;
|
||||
}
|
||||
|
||||
public void setMinOccours(int minOccours) {
|
||||
this.minOccours = minOccours;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class ResultColumn implements IsSerializable {
|
||||
|
||||
private String null_value="null";
|
||||
private String value;
|
||||
|
||||
public ResultColumn() {
|
||||
|
||||
}
|
||||
|
||||
public ResultColumn(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
if(value.equals("")){
|
||||
return null_value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getNull_value() {
|
||||
return null_value;
|
||||
}
|
||||
|
||||
public void setNull_value(String nullValue) {
|
||||
null_value = nullValue;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class ResultRow implements IsSerializable {
|
||||
|
||||
private List<ResultColumn> columns;
|
||||
|
||||
public ResultRow() {
|
||||
|
||||
}
|
||||
|
||||
public ResultRow(List<ResultColumn> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public List<ResultColumn> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void setColumns(List<ResultColumn> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class ResultTable implements IsSerializable {
|
||||
|
||||
private List<ResultRow> rows;
|
||||
|
||||
public ResultTable() {
|
||||
|
||||
}
|
||||
|
||||
public ResultTable(List<ResultRow> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public List<ResultRow> getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(List<ResultRow> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public void addResultRow(ResultRow resultRow) {
|
||||
this.rows.add(resultRow);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SavedGroup implements IsSerializable{
|
||||
private String name;
|
||||
private String url;
|
||||
public SavedGroup() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
public SavedGroup(String name, String url) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.commons.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.BaseModel;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.TabItem;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public class WfsTable implements IsSerializable {
|
||||
private String title;
|
||||
//List<String> columnNames = new ArrayList<String>();
|
||||
List<BaseModel> rows = new ArrayList<BaseModel>();
|
||||
boolean error=false;
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rows
|
||||
*/
|
||||
public List<BaseModel> getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows the rows to set
|
||||
*/
|
||||
public void setRows(List<BaseModel> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the columnNames
|
||||
*/
|
||||
public List<String> getColumnNames() {
|
||||
if (rows.size()>0)
|
||||
return new ArrayList<String>(rows.get(0).getPropertyNames());
|
||||
else
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param columnNames the columnNames to set
|
||||
// */
|
||||
// public void setColumnNames(List<String> columnNames) {
|
||||
// this.columnNames = columnNames;
|
||||
// }
|
||||
//
|
||||
public void addRow(BaseModel row) {
|
||||
this.rows.add(row);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param error the error to set
|
||||
*/
|
||||
public void setError(boolean error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the error
|
||||
*/
|
||||
public boolean isError() {
|
||||
return error;
|
||||
}
|
||||
// public void addColumnName(String columnName) {
|
||||
// this.columnNames.add(columnName);
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.utils;
|
||||
|
||||
|
||||
/*
|
||||
* author: ceras
|
||||
*/
|
||||
public class ClickDataInfo {
|
||||
private enum TYPE {POINT, BOX}
|
||||
|
||||
private static final double THRESHOLD_AREA = 300;
|
||||
|
||||
private int x, y, w, h;
|
||||
private String bbox;
|
||||
// private List<GeoserverItem> geoserverItems = new ArrayList<GeoserverItem>();
|
||||
private TYPE type=null;
|
||||
private double x1;
|
||||
private double y1;
|
||||
private double x2;
|
||||
private double y2;
|
||||
|
||||
// public ClickDataInfo(int x, int y, int w, int h, String bbox, List<GeoserverItem> geoserverItems) {
|
||||
// super();
|
||||
// this.x = x;
|
||||
// this.y = y;
|
||||
// this.w = w;
|
||||
// this.h = h;
|
||||
// this.bbox = bbox;
|
||||
// this.geoserverItems = geoserverItems;
|
||||
// this.type = TYPE.POINT;
|
||||
// }
|
||||
|
||||
public ClickDataInfo(int x, int y, int w, int h, String bbox) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.bbox = bbox;
|
||||
this.type = TYPE.POINT;
|
||||
// System.out.println("POINT SELECTED: x="+x+", y="+y+", w="+w+", h="+h+", bbox="+bbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bbox2
|
||||
*/
|
||||
public ClickDataInfo(double x1, double y1, double x2, double y2) {
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
|
||||
// note: the bounding box is left,lower,right,upper
|
||||
this.bbox = y1 +","+ x1 +","+ y2 +","+ x2;
|
||||
|
||||
this.type = TYPE.BOX;
|
||||
|
||||
double area = (x2-x1) * (y2-y1);
|
||||
// System.out.println("BOX SELECTED: BBOX="+bbox + ", AREA="+area);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getW() {
|
||||
return w;
|
||||
}
|
||||
|
||||
public void setW(int w) {
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public int getH() {
|
||||
return h;
|
||||
}
|
||||
|
||||
public void setH(int h) {
|
||||
this.h = h;
|
||||
}
|
||||
|
||||
// public void setGeoserverItems(List<GeoserverItem> geoserverItems) {
|
||||
// this.geoserverItems = geoserverItems;
|
||||
// }
|
||||
//
|
||||
// public List<GeoserverItem> getGeoserverItems() {
|
||||
// return geoserverItems;
|
||||
// }
|
||||
//
|
||||
// public void removeAllLayers() {
|
||||
// this.geoserverItems.clear();
|
||||
// }
|
||||
|
||||
public String getBbox() {
|
||||
return bbox;
|
||||
}
|
||||
|
||||
public void setBbox(String bbox) {
|
||||
this.bbox = bbox;
|
||||
}
|
||||
|
||||
public boolean isPoint() {
|
||||
return this.type==TYPE.POINT;
|
||||
}
|
||||
|
||||
public boolean isBox() {
|
||||
return this.type==TYPE.BOX;
|
||||
}
|
||||
|
||||
public boolean isHardQuery() {
|
||||
if (this.isPoint())
|
||||
return false;
|
||||
else {
|
||||
double area = (x2-x1) * (y2-y1);
|
||||
return (area > THRESHOLD_AREA);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the x1
|
||||
*/
|
||||
public double getX1() {
|
||||
return x1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the x2
|
||||
*/
|
||||
public double getX2() {
|
||||
return x2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the y1
|
||||
*/
|
||||
public double getY1() {
|
||||
return y1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the y2
|
||||
*/
|
||||
public double getY2() {
|
||||
return y2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.commons.utils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
|
||||
public class URLMakers {
|
||||
|
||||
private static String encodingLayer(String l){
|
||||
String result = l.replace(":", "%3A");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static String getURL(String projection, String width, String height,int x, int y,String bbox, Vector<String> layers){
|
||||
|
||||
String layer="";
|
||||
boolean first=true;
|
||||
for(String s : layers){
|
||||
if(!first)layer=layer+"%2C"+encodingLayer(s);
|
||||
if(first)layer=encodingLayer(s);
|
||||
first=false;
|
||||
}
|
||||
|
||||
String [] _bbox=bbox.split(",");
|
||||
|
||||
projection = encodingLayer(projection);
|
||||
String result="?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX="+_bbox[0]+"%2C"+_bbox[1]+"%2C"+_bbox[2]+"%2C"+_bbox[3]+"&X="+x+"&Y="+y+"&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS="+layer+"&FEATURE_COUNT=50&Layers="+layer+"&Styles=&Srs="+projection+"&WIDTH="+width+"&HEIGHT="+height+"&format=image%2Fpng";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getURL(String projection, int width, int height,int x, int y,String bbox, List<LayerItem> layerItems){
|
||||
String strListLayers="";
|
||||
boolean first=true;
|
||||
for(LayerItem layerItem : layerItems){
|
||||
if (layerItem.isClickData()) {
|
||||
String strLayer = encodingLayer(layerItem.getName());
|
||||
strListLayers = first ? strLayer : strListLayers+"%2C"+strLayer;
|
||||
first=false;
|
||||
}
|
||||
}
|
||||
|
||||
String [] _bbox=bbox.split(",");
|
||||
|
||||
projection = encodingLayer(projection);
|
||||
String result="?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX="+_bbox[0]+"%2C"+_bbox[1]+"%2C"+_bbox[2]+"%2C"+_bbox[3]+"&X="+x+"&Y="+y+"&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS="+strListLayers+"&FEATURE_COUNT=50&Layers="+strListLayers+"&Styles=&Srs="+projection+"&WIDTH="+width+"&HEIGHT="+height+"&format=image%2Fpng";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// public static String getURLFeatureInfo(ClickDataInfo clickDataInfo, String projection, String bbox) {
|
||||
// return getURL(projection, clickDataInfo.getW(), clickDataInfo.getH(), clickDataInfo.getX(), clickDataInfo.getY(), bbox, clickDataInfo.getLayers());
|
||||
// }
|
||||
|
||||
public static String getGeoserverWmsUrl(String geoserverUrl) {
|
||||
return geoserverUrl + "/wms";
|
||||
}
|
||||
|
||||
public static String getGeoserverGwcUrl(String geoserverUrl) {
|
||||
return geoserverUrl + "/gwc/service/wms";
|
||||
}
|
||||
|
||||
|
||||
public static String getURL(ClickDataInfo clickDataInfo, String projection, List<LayerItem> layerItems) {
|
||||
return getURL(projection, clickDataInfo.getW(), clickDataInfo.getH(), clickDataInfo.getX(), clickDataInfo.getY(), clickDataInfo.getBbox(), layerItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param geoserverUrl
|
||||
* @param bbox
|
||||
* @return
|
||||
*/
|
||||
public static String getWfsFeatureUrl(LayerItem l, String bbox, int limit, String format) {
|
||||
String link = l.getGeoserverUrl() + "/wfs?service=wfs&version=1.1.0&REQUEST=GetFeature" +
|
||||
"&TYPENAME=" + l.getLayer() +
|
||||
"&BBOX=" + bbox +
|
||||
(limit==0 ? "" : "&MAXFEATURES="+limit) +
|
||||
(format==null ? "" : "&OUTPUTFORMAT="+format);
|
||||
//System.out.println("WFS: "+link);
|
||||
return link;
|
||||
}
|
||||
|
||||
static String[][] a = {
|
||||
{"\\?","%3F"},
|
||||
{"&","%26"},
|
||||
};
|
||||
|
||||
|
||||
public static String encodeUrl(String url) {
|
||||
String urlNew = url;
|
||||
for (String[] s: a)
|
||||
urlNew = urlNew.replaceAll(s[0], s[1]);
|
||||
return urlNew;
|
||||
}
|
||||
|
||||
public static String decodeUrl(String url) {
|
||||
String urlNew = url;
|
||||
for (String[] s: a)
|
||||
urlNew = urlNew.replaceAll(s[1], s[0]);
|
||||
return urlNew;
|
||||
}
|
||||
|
||||
public static String getGeoserverUrlFromWmsUrl(String wmsUrl) {
|
||||
String gsUrl = new String(wmsUrl);
|
||||
// remove each string after "?"
|
||||
int index = gsUrl.indexOf("?");
|
||||
if (index!=-1)
|
||||
gsUrl = gsUrl.substring(0, gsUrl.indexOf("?"));
|
||||
// remove suffix "/wms" or "/wms/"
|
||||
gsUrl = gsUrl.replaceFirst("(/wms)$", "").replaceFirst("(/wms/)$", "");
|
||||
|
||||
return gsUrl;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.datafeature;
|
||||
|
||||
public interface DataPanelHandler {
|
||||
|
||||
public void showDataPanel();
|
||||
|
||||
public void exportData(boolean force);
|
||||
|
||||
public void dataPanelOpen(boolean isOpen, int panelHeight);
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.datafeature;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.ResultColumn;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.ResultRow;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.BaseModel;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Html;
|
||||
import com.extjs.gxt.ui.client.widget.TabItem;
|
||||
import com.extjs.gxt.ui.client.widget.TabPanel;
|
||||
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
|
||||
|
||||
public class DataResultPanel extends TabPanel {
|
||||
|
||||
private static final String MESSAGE_NO_DATA = "No data found in this selection for this layer.";
|
||||
private static final String MESSAGE_WFS_NOT_SUPPORTED = "Wfs requests not supported for this layer.";
|
||||
private String grid_h;
|
||||
private String grid_w;
|
||||
|
||||
public DataResultPanel() {
|
||||
super();
|
||||
|
||||
this.setMinTabWidth(115);
|
||||
this.setAutoWidth(true);
|
||||
|
||||
this.setResizeTabs(true);
|
||||
this.setTabScroll(true);
|
||||
this.setAnimScroll(true);
|
||||
this.setCloseContextMenu(true);
|
||||
}
|
||||
|
||||
|
||||
public String getGrid_h() {
|
||||
return grid_h;
|
||||
}
|
||||
|
||||
public void setGrid_h(String gridH) {
|
||||
grid_h = gridH;
|
||||
}
|
||||
|
||||
public String getGrid_w() {
|
||||
return grid_w;
|
||||
}
|
||||
|
||||
public void setGrid_w(String gridW) {
|
||||
grid_w = gridW;
|
||||
}
|
||||
|
||||
public void setDataResult(List<DataResult> dataResults) {
|
||||
|
||||
for (DataResult dr : dataResults) {
|
||||
|
||||
List<ResultRow> rows = dr.getTable().getRows();
|
||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||
ListStore<BaseModel> listStore = new ListStore<BaseModel>();
|
||||
List<String> columnNames = new ArrayList<String>();
|
||||
|
||||
int row_n = 0;
|
||||
for (ResultRow row : rows) {
|
||||
List<ResultColumn> resultCols = row.getColumns();
|
||||
if (row_n == 0) {
|
||||
// first row, initializing columns
|
||||
for (ResultColumn resultColumn : resultCols) {
|
||||
ColumnConfig column = new ColumnConfig();
|
||||
column.setId(resultColumn.getValue());
|
||||
column.setHeader(resultColumn.getValue());
|
||||
column.setWidth(65);
|
||||
configs.add(column);
|
||||
columnNames.add(resultColumn.getValue());
|
||||
}
|
||||
} else {
|
||||
// other rows
|
||||
BaseModel bs = new BaseModel();
|
||||
int index=0;
|
||||
for (ResultColumn column : resultCols) {
|
||||
bs.set(columnNames.get(index), column.getValue());
|
||||
index++;
|
||||
}
|
||||
listStore.add(bs);
|
||||
}
|
||||
row_n++;
|
||||
}
|
||||
|
||||
ColumnModel cm = new ColumnModel(configs);
|
||||
Grid<BaseModel> grid = new Grid<BaseModel>(listStore, cm);
|
||||
grid.setStyleAttribute("borderTop", "none");
|
||||
grid.setBorders(true);
|
||||
grid.setStripeRows(true);
|
||||
grid.setColumnLines(true);
|
||||
|
||||
|
||||
TabItem item = new TabItem();
|
||||
item.setText(dr.getTitle());
|
||||
item.setClosable(true);
|
||||
|
||||
|
||||
item.setLayout(new FitLayout());
|
||||
item.addStyleName("pad-text");
|
||||
item.add(grid);
|
||||
this.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (this.getItems()==null || this.getItems().size()==0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param result
|
||||
*/
|
||||
public void setDataResultFromWfs(List<WfsTable> result) {
|
||||
for (WfsTable table: result) {
|
||||
TabItem item = new TabItem();
|
||||
item.setText(table.getTitle());
|
||||
item.setClosable(true);
|
||||
|
||||
item.addStyleName("pad-text");
|
||||
|
||||
if (table.isError()) {
|
||||
item.setLayout(new CenterLayout());
|
||||
item.add(new Html(MESSAGE_WFS_NOT_SUPPORTED));
|
||||
}
|
||||
else if (table.getRows().size()>0) {
|
||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||
ListStore<BaseModel> listStore = new ListStore<BaseModel>();
|
||||
|
||||
List<String> columnNames = table.getColumnNames();
|
||||
for (String columnName : columnNames) {
|
||||
ColumnConfig column = new ColumnConfig();
|
||||
column.setId(columnName);
|
||||
column.setHeader(columnName);
|
||||
column.setWidth(65);
|
||||
configs.add(column);
|
||||
}
|
||||
|
||||
listStore.add(table.getRows());
|
||||
|
||||
ColumnModel cm = new ColumnModel(configs);
|
||||
Grid<BaseModel> grid = new Grid<BaseModel>(listStore, cm);
|
||||
grid.setStyleAttribute("borderTop", "none");
|
||||
grid.setBorders(true);
|
||||
grid.setStripeRows(true);
|
||||
grid.setColumnLines(true);
|
||||
|
||||
item.setLayout(new FitLayout());
|
||||
item.add(grid);
|
||||
|
||||
} else {
|
||||
item.setLayout(new CenterLayout());
|
||||
item.add(new Html(MESSAGE_NO_DATA));
|
||||
}
|
||||
this.add(item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,516 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.layerspanel;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.GisViewer;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.FieldEvent;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MenuEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.event.SliderEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Html;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.Slider;
|
||||
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.CheckBox;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.MouseOutEvent;
|
||||
import com.google.gwt.event.dom.client.MouseOutHandler;
|
||||
import com.google.gwt.event.dom.client.MouseOverEvent;
|
||||
import com.google.gwt.event.dom.client.MouseOverHandler;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
public class LayerToolsPanel extends VerticalPanel {
|
||||
private static final String TOOLS_PADDING = "20px";
|
||||
|
||||
private static final String OPACITY_SLIDER_WIDTH = "120px";
|
||||
private static final String CHECKBOX_CELL_WIDTH = "28px";
|
||||
private static final String OPENBUTTON_CELL_WIDTH = "20px";
|
||||
private static final int LAYER_TOOLS_PANEL_HEIGHT = 84;
|
||||
private static final ImageResource ICON_TRANSECT_TIP = GisViewer.resources.iconTransectTip();
|
||||
private static final ImageResource ICON_TRANSECT_TIP_DELETE = GisViewer.resources.iconTransectTipDelete();
|
||||
private static final ImageResource ICON_CQL_TIP = GisViewer.resources.iconCqlTip();
|
||||
private static final ImageResource ICON_CQL_TIP_DELETE = GisViewer.resources.iconCqlTipDelete();
|
||||
private static final ImageResource ICON_TRIANGLE_RIGHT = GisViewer.resources.iconTriangleRight();
|
||||
private static final ImageResource ICON_TRIANGLE_DOWN = GisViewer.resources.iconTriangleDown();
|
||||
private static final ImageResource ICON_CLOSE_LAYER = GisViewer.resources.iconCloseLayer();
|
||||
private static final ImageResource ICON_CLOSE_LAYER_OVER = GisViewer.resources.iconCloseLayerOver();
|
||||
|
||||
private static final String[][] FORMATS = {
|
||||
{"AtomPub", "application/atom+xml"},
|
||||
{"GIF", "image/gif"},
|
||||
{"GeoRSS", "application/rss+xml"},
|
||||
{"JPEG", "image/jpeg"},
|
||||
{"KML (compressed)", "application/vnd.google-earth.kmz+xml"},
|
||||
{"KML (plain)", "application/vnd.google-earth.kml+xml"},
|
||||
{"PDF", "application/pdf"},
|
||||
{"PNG", "image/png"},
|
||||
{"SVG", "image/svg+xml"},
|
||||
{"Tiff", "image/tiff"},
|
||||
};
|
||||
private static final AbstractImagePrototype[] FORMAT_IMAGES = {
|
||||
Images.iconAtompub(),
|
||||
Images.iconGeorss(),
|
||||
Images.iconGif(),
|
||||
Images.iconJpeg(),
|
||||
Images.iconKml(),
|
||||
Images.iconKml(),
|
||||
Images.iconPdf(),
|
||||
Images.iconPng(),
|
||||
Images.iconSvg(),
|
||||
Images.iconTiff()
|
||||
};
|
||||
|
||||
private LayerItem layerItem;
|
||||
private VerticalPanel tools;
|
||||
private Image imgOpenButton;
|
||||
private Image imgCloseLayerButton;
|
||||
private Image imgCqlTip;
|
||||
private Image imgTransectTip;
|
||||
private CheckBox checkBox;
|
||||
private Slider opacitySlider;
|
||||
boolean isToolsOpened = false;
|
||||
|
||||
private String fieldTransect=null;
|
||||
private String tableTransect=null;
|
||||
private LayersPanelHandler layersPanelHandler;
|
||||
private HorizontalPanel cp;
|
||||
|
||||
private boolean cqlTipInserted=false;
|
||||
private boolean transectTipInserted=false;
|
||||
|
||||
|
||||
|
||||
public LayerToolsPanel(LayerItem layerItem, LayersPanelHandler layersPanelHandler) {
|
||||
// create the vertical panel that represents all the layer ui
|
||||
super();
|
||||
this.layerItem = layerItem;
|
||||
this.layersPanelHandler = layersPanelHandler;
|
||||
setTransectInfo();
|
||||
|
||||
this.setTableWidth("100%");
|
||||
|
||||
// layer info
|
||||
cp = new HorizontalPanel();
|
||||
cp.setWidth("100%");
|
||||
|
||||
createCheckBox();
|
||||
Html text = createText();
|
||||
createOpenButton();
|
||||
createTipImages();
|
||||
createOpacitySlider();
|
||||
createTools();
|
||||
createCloseLayerButton();
|
||||
|
||||
cp.add(new Html(" "));
|
||||
cp.add(checkBox);
|
||||
cp.add(imgOpenButton);
|
||||
cp.add(text);
|
||||
cp.add(imgCloseLayerButton);
|
||||
|
||||
cp.setCellWidth(checkBox, CHECKBOX_CELL_WIDTH);
|
||||
cp.setCellWidth(imgOpenButton, OPENBUTTON_CELL_WIDTH);
|
||||
cp.setCellWidth(text, "100%");
|
||||
cp.setStyleName("layersPanel1");
|
||||
|
||||
this.add(cp);
|
||||
}
|
||||
|
||||
private void createTools() {
|
||||
tools = new VerticalPanel();
|
||||
tools.setStyleAttribute("padding-left", TOOLS_PADDING);
|
||||
//tools.setStyleAttribute("background-color", "#E5E5E5");
|
||||
tools.setStyleName("layersPanel2");
|
||||
tools.setHeight(LAYER_TOOLS_PANEL_HEIGHT);
|
||||
|
||||
// TOOLBAR TRANSECT, FILTER AND EXPORT
|
||||
ToolBar toolBar1 = new ToolBar();
|
||||
toolBar1.setStyleName("myToolbar"); // TODO define style
|
||||
toolBar1.add(new SizedLabel("General", 10));
|
||||
toolBar1.add(new SeparatorToolItem());
|
||||
|
||||
if ((tableTransect!=null && fieldTransect!=null)) {
|
||||
// transect button
|
||||
Button btnTransect = new Button("", Images.iconTransect(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
setTransectTip(true);
|
||||
layersPanelHandler.activateTransect(layerItem, tableTransect, fieldTransect);
|
||||
}
|
||||
});
|
||||
btnTransect.setToolTip("Generate a Transect function");
|
||||
//btnTransect.setEnabled((tableTransect!=null && fieldTransect!=null));
|
||||
toolBar1.add(btnTransect);
|
||||
}
|
||||
|
||||
// filter button
|
||||
Button btnFilter = new Button("", Images.iconFilter(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
int left = ce.getButton().getAbsoluteLeft();
|
||||
int top = ce.getButton().getAbsoluteTop();
|
||||
layersPanelHandler.showFilterQuery(layerItem, left, top);
|
||||
}
|
||||
});
|
||||
btnFilter.setToolTip("Set a CQL filter to the layer " + this.layerItem.getName() + " (or remove previous filter)");
|
||||
toolBar1.add(btnFilter);
|
||||
|
||||
// layer export
|
||||
Button btnExportLayer = new Button("", Images.iconExport());
|
||||
btnExportLayer.setToolTip("Export layer view");
|
||||
Menu menuExportLayer = new Menu();
|
||||
menuExportLayer.setStyleName("gisViewerMenu");
|
||||
int i=0;
|
||||
for (final String[] exportItem : FORMATS) {
|
||||
menuExportLayer.add(new MenuItem(exportItem[0], FORMAT_IMAGES[i++], new SelectionListener<MenuEvent>(){
|
||||
@Override
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
layersPanelHandler.openBrowserLayerImage(layerItem, exportItem[1], true);
|
||||
// TODO manage isWms
|
||||
}
|
||||
}));
|
||||
}
|
||||
btnExportLayer.setMenu(menuExportLayer);
|
||||
toolBar1.add(btnExportLayer);
|
||||
|
||||
// layer save
|
||||
if (layersPanelHandler.isSaveSupported()) {
|
||||
Button btnSaveLayer = new Button("", Images.iconSave());
|
||||
btnSaveLayer.setToolTip("Save layer view");
|
||||
Menu menuSaveLayer = new Menu();
|
||||
menuSaveLayer.setStyleName("gisViewerMenu");
|
||||
i=0;
|
||||
for (final String[] exportItem : FORMATS) {
|
||||
menuSaveLayer.add(new MenuItem(exportItem[0], FORMAT_IMAGES[i++], new SelectionListener<MenuEvent>(){
|
||||
@Override
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
layersPanelHandler.saveLayerImage(layerItem, exportItem[1], true);
|
||||
// TODO manage isWms
|
||||
}
|
||||
}));
|
||||
}
|
||||
btnSaveLayer.setMenu(menuSaveLayer);
|
||||
toolBar1.add(btnSaveLayer);
|
||||
}
|
||||
|
||||
tools.add(toolBar1);
|
||||
// tools.add(generalToolBar);
|
||||
|
||||
|
||||
// OPACITY TOOLBAR
|
||||
ToolBar toolBar2 = new ToolBar();
|
||||
toolBar2.setStyleName("myToolbar"); // TODO define style
|
||||
toolBar2.add(new SizedLabel("Opacity", 10));
|
||||
toolBar2.add(new SeparatorToolItem());
|
||||
toolBar2.add(opacitySlider);
|
||||
|
||||
tools.add(toolBar2);
|
||||
|
||||
|
||||
// LEGEND TOOLBAR
|
||||
if (layerItem.isHasLegend()) {
|
||||
HorizontalPanel toolbar3 = new HorizontalPanel();
|
||||
toolbar3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
toolbar3.setStyleName("myToolbar");
|
||||
Label label = new SizedLabel("Legend", 10);
|
||||
toolbar3.add(label);
|
||||
toolbar3.add(new SeparatorToolItem());
|
||||
|
||||
//legend button
|
||||
final Button btnLegend = new Button("", Images.iconLegend(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
int left = ce.getButton().getAbsoluteLeft();
|
||||
int top = ce.getButton().getAbsoluteTop();
|
||||
layersPanelHandler.showLegend(layerItem, left, top);
|
||||
}
|
||||
});
|
||||
btnLegend.setToolTip("Show Legend");
|
||||
toolbar3.add(btnLegend);
|
||||
|
||||
// legend list
|
||||
if (layerItem.getStyles().size()==1) {
|
||||
toolbar3.add(new SizedLabel(layerItem.getStyle(), 10, 18));
|
||||
} else {
|
||||
String defaultStyle = layerItem.getStyle();
|
||||
|
||||
|
||||
final Button btnStyle = new Button((defaultStyle.length()<11) ? defaultStyle : defaultStyle.substring(0, 11) + "...");
|
||||
btnStyle.setToolTip("Change the style");
|
||||
Menu menuStyle = new Menu();
|
||||
menuStyle.setStyleName("gisViewerMenu");
|
||||
|
||||
for (final String style : layerItem.getStyles()) {
|
||||
menuStyle.add(new MenuItem(style, new SelectionListener<MenuEvent>(){
|
||||
@Override
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
btnStyle.setText((style.length()<11) ? style : style.substring(0, 11) + "...");
|
||||
Constants.log("index: " + style);
|
||||
layerItem.setStyle(style);
|
||||
layersPanelHandler.changeLegend(layerItem, style);
|
||||
}
|
||||
}));
|
||||
}
|
||||
btnStyle.setMenu(menuStyle);
|
||||
|
||||
toolbar3.add(btnStyle);
|
||||
}
|
||||
|
||||
tools.add(toolbar3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createOpacitySlider() {
|
||||
opacitySlider = new Slider();
|
||||
opacitySlider.setMinValue(0);
|
||||
opacitySlider.setMaxValue(100);
|
||||
opacitySlider.setIncrement(5);
|
||||
opacitySlider.setWidth(OPACITY_SLIDER_WIDTH);
|
||||
opacitySlider.addListener(Events.Change, new Listener<SliderEvent>() {
|
||||
public void handleEvent(SliderEvent be) {
|
||||
double newValue = (double)(be.getNewValue())/100;
|
||||
layerItem.setOpacity(newValue);
|
||||
layersPanelHandler.setOpacityLayer(layerItem, newValue);
|
||||
}
|
||||
});
|
||||
|
||||
// boolean isBrightLayer = false;
|
||||
// for (String s : Constants.brightLayers)
|
||||
// if (s.equals(layerItem.getName()))
|
||||
// isBrightLayer = true;
|
||||
//
|
||||
// double opacity = (isBrightLayer ? 1.0 : Constants.defaultOpacityLayers);
|
||||
// opacitySlider.setValue((int)(opacity*100));
|
||||
opacitySlider.setValue((int)(layerItem.getOpacity()*100));
|
||||
}
|
||||
|
||||
private Html createText() {
|
||||
Html newHtml = new Html("<div style='font-size:12px;'>"+layerItem.getTitle()+"</div>");
|
||||
// Html newHtml = new Html(" -"+layerItem.getName()+"- ");
|
||||
//newHtml.setStyleAttribute("width", "120px");
|
||||
newHtml.setStyleAttribute("overflow", "hidden");
|
||||
newHtml.addListener(Events.OnClick, new Listener<BaseEvent>(){
|
||||
@Override
|
||||
public void handleEvent(BaseEvent be) {
|
||||
toggleTools();
|
||||
}
|
||||
});
|
||||
return newHtml;
|
||||
}
|
||||
|
||||
private void createCheckBox() {
|
||||
checkBox = new CheckBox();
|
||||
checkBox.addListener(Events.Change, new Listener<FieldEvent>() {
|
||||
public void handleEvent(FieldEvent fe) {
|
||||
layerItem.setVisible(checkBox.getValue());
|
||||
if (checkBox.getValue())
|
||||
layersPanelHandler.showLayer(layerItem);
|
||||
else
|
||||
layersPanelHandler.hideLayer(layerItem);
|
||||
}
|
||||
});
|
||||
checkBox.setValue(layerItem.isVisible());
|
||||
}
|
||||
|
||||
private void createOpenButton() {
|
||||
imgOpenButton = new Image(ICON_TRIANGLE_RIGHT);
|
||||
imgOpenButton.setStyleName("imgCursor");
|
||||
//imgOpenButton.setSize("16px", "16px");
|
||||
imgOpenButton.addClickHandler(new ClickHandler(){
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
toggleTools();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createCloseLayerButton() {
|
||||
imgCloseLayerButton = new Image(ICON_CLOSE_LAYER);
|
||||
//imgOpenButton.setSize("16px", "16px");
|
||||
imgCloseLayerButton.addClickHandler(new ClickHandler(){
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
layersPanelHandler.removeLayer(layerItem);
|
||||
}
|
||||
});
|
||||
imgCloseLayerButton.addMouseOverHandler(new MouseOverHandler(){
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
imgCloseLayerButton.setResource(ICON_CLOSE_LAYER_OVER);
|
||||
}
|
||||
});
|
||||
imgCloseLayerButton.addMouseOutHandler(new MouseOutHandler(){
|
||||
@Override
|
||||
public void onMouseOut(MouseOutEvent event) {
|
||||
imgCloseLayerButton.setResource(ICON_CLOSE_LAYER);
|
||||
}
|
||||
});
|
||||
imgCloseLayerButton.setTitle("Remove Layer");
|
||||
imgCloseLayerButton.setStyleName("imgCql");
|
||||
}
|
||||
|
||||
private void createTipImages() {
|
||||
imgCqlTip = new Image(ICON_CQL_TIP);
|
||||
//imgOpenButton.setSize("16px", "16px");
|
||||
imgCqlTip.addClickHandler(new ClickHandler(){
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
layersPanelHandler.removeFilterQuery(layerItem);
|
||||
}
|
||||
});
|
||||
imgCqlTip.addMouseOverHandler(new MouseOverHandler(){
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
imgCqlTip.setResource(ICON_CQL_TIP_DELETE);
|
||||
}
|
||||
});
|
||||
imgCqlTip.addMouseOutHandler(new MouseOutHandler(){
|
||||
@Override
|
||||
public void onMouseOut(MouseOutEvent event) {
|
||||
imgCqlTip.setResource(ICON_CQL_TIP);
|
||||
}
|
||||
});
|
||||
imgCqlTip.setTitle("Remove CQL Filter");
|
||||
imgCqlTip.setStyleName("imgCql");
|
||||
|
||||
|
||||
imgTransectTip = new Image(ICON_TRANSECT_TIP);
|
||||
//imgOpenButton.setSize("16px", "16px");
|
||||
imgTransectTip.addClickHandler(new ClickHandler(){
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
imgTransectTip.setResource(ICON_TRANSECT_TIP);
|
||||
layersPanelHandler.deactivateTransect(layerItem);
|
||||
}
|
||||
});
|
||||
imgTransectTip.addMouseOverHandler(new MouseOverHandler(){
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
imgTransectTip.setResource(ICON_TRANSECT_TIP_DELETE);
|
||||
}
|
||||
});
|
||||
imgTransectTip.addMouseOutHandler(new MouseOutHandler(){
|
||||
@Override
|
||||
public void onMouseOut(MouseOutEvent event) {
|
||||
imgTransectTip.setResource(ICON_TRANSECT_TIP);
|
||||
}
|
||||
});
|
||||
imgTransectTip.setTitle("Remove Transect interaction");
|
||||
imgTransectTip.setStyleName("imgCql");
|
||||
}
|
||||
|
||||
// open/close tools
|
||||
protected void toggleTools() {
|
||||
if (isToolsOpened)
|
||||
this.remove(tools);
|
||||
else
|
||||
this.add(tools);
|
||||
this.layout();
|
||||
isToolsOpened = !isToolsOpened;
|
||||
imgOpenButton.setResource((isToolsOpened ? ICON_TRIANGLE_DOWN : ICON_TRIANGLE_RIGHT));
|
||||
}
|
||||
|
||||
// sets transect info of a layer into node
|
||||
private void setTransectInfo() {
|
||||
if (!layerItem.isHasLegend())
|
||||
return;
|
||||
|
||||
// search for transect by stylename
|
||||
boolean foundDefaultStyle = false;
|
||||
for (int i = 0; (i < Constants.defaultStyleTransects.length && !foundDefaultStyle); i++) {
|
||||
String styleName = Constants.defaultStyleTransects[i][0];
|
||||
String fieldTransect = Constants.defaultStyleTransects[i][1];
|
||||
String tableTransect = Constants.defaultStyleTransects[i][2];
|
||||
if (layerItem.getStyle().contentEquals(styleName)) {
|
||||
this.fieldTransect = fieldTransect;
|
||||
this.tableTransect = tableTransect;
|
||||
foundDefaultStyle = true;
|
||||
}
|
||||
}
|
||||
|
||||
// search for transect by datastore
|
||||
if (!foundDefaultStyle) {
|
||||
boolean foundDataStore = false;
|
||||
for (int i = 0; (i < Constants.dataStoresWithTransect.length && !foundDataStore); i++) {
|
||||
if (layerItem.getDataStore().equals(
|
||||
Constants.dataStoresWithTransect[i]))
|
||||
foundDataStore = true;
|
||||
}
|
||||
|
||||
if (foundDataStore) {
|
||||
if (layerItem.containsProperty("maxspeciescountinacell")) {
|
||||
this.fieldTransect = "maxspeciescountinacell";
|
||||
this.tableTransect = layerItem.getName();
|
||||
} else if (layerItem.containsProperty("probability")) {
|
||||
this.fieldTransect = "probability";
|
||||
this.tableTransect = layerItem.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: search for a float property // layerItem.getFirstFloatPropertyName()
|
||||
}
|
||||
|
||||
private class SizedLabel extends Label {
|
||||
public SizedLabel(String text, int size) {
|
||||
super(text);
|
||||
this.setStyleAttribute("font-size", ""+size+"px");
|
||||
}
|
||||
public SizedLabel(String text, int size, int maxChar) {
|
||||
super(text);
|
||||
if (text.length()>maxChar)
|
||||
this.setText(text.substring(0, maxChar) + "...");
|
||||
this.setStyleAttribute("font-size", ""+size+"px");
|
||||
}
|
||||
}
|
||||
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
public void setCqlTip(boolean show) {
|
||||
if (show) {
|
||||
if (!cqlTipInserted) {
|
||||
cp.insert(imgCqlTip, 3);
|
||||
cqlTipInserted = true;
|
||||
}
|
||||
} else
|
||||
if (cqlTipInserted) {
|
||||
cp.remove(imgCqlTip);
|
||||
cqlTipInserted = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransectTip(boolean show) {
|
||||
if (show) {
|
||||
if (!transectTipInserted) {
|
||||
cp.insert(imgTransectTip, (cqlTipInserted ? 4 : 3));
|
||||
transectTipInserted = true;
|
||||
}
|
||||
} else
|
||||
if (transectTipInserted) {
|
||||
cp.remove(imgTransectTip);
|
||||
transectTipInserted = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void setCheckVisible(boolean isVisible) {
|
||||
checkBox.setValue(isVisible);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.layerspanel;
|
||||
|
||||
|
||||
/*
|
||||
* Ext GWT 2.2.3 - Ext for GWT
|
||||
* Copyright(c) 2007-2010, Ext JS, LLC.
|
||||
* licensing@extjs.com
|
||||
*
|
||||
* http://extjs.com/license
|
||||
*/
|
||||
|
||||
import com.extjs.gxt.ui.client.dnd.DropTarget;
|
||||
import com.extjs.gxt.ui.client.dnd.Insert;
|
||||
import com.extjs.gxt.ui.client.event.DNDEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
||||
|
||||
/**
|
||||
* A <code>DropTarget</code> implementation for Grids. Supports both inserts and
|
||||
* appends, specified using
|
||||
* {@link #setOperation(com.extjs.gxt.ui.client.dnd.DND.Operation)}.
|
||||
* <p />
|
||||
* Supported drag data:
|
||||
* <ul>
|
||||
* <li>A single ModelData instance.</li>
|
||||
* <li>A List of ModelData instances.</li>
|
||||
* <li>A List of TreeStoreModel instances (children are ignored).
|
||||
* </ul>
|
||||
*/
|
||||
public class LayersDropTarget extends DropTarget {
|
||||
|
||||
protected LayersPanel layersPanel;
|
||||
private int lastPosition = -1;
|
||||
static final int spacing = 3;
|
||||
|
||||
/**
|
||||
* Creates a new drop target instance.
|
||||
*
|
||||
* @param grid the target LayersPanel
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public LayersDropTarget(LayersPanel layersPanel) {
|
||||
super(layersPanel);
|
||||
this.layersPanel = layersPanel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDragMove(DNDEvent e) {
|
||||
int[] ar = getPosition(e);
|
||||
int newPosition = ar[0];
|
||||
int newPositionY = ar[1];
|
||||
e.setCancelled(false);
|
||||
|
||||
if (newPosition!=lastPosition) {
|
||||
Insert insert = Insert.get();
|
||||
insert.show();
|
||||
insert.el().setBounds(layersPanel.getAbsoluteLeft(), newPositionY-3, layersPanel.getWidth(), 6);
|
||||
|
||||
// if (newPosition==0)
|
||||
// System.out.println("All'inizio, prima di " + newPosition);
|
||||
// else if (newPosition==that.getItems().size())
|
||||
// System.out.println("Alla fine, dopo di " + (newPosition-1));
|
||||
// else
|
||||
// System.out.println("Tra " + (newPosition-1) + " e " + (newPosition));
|
||||
lastPosition = newPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private int[] getPosition(DNDEvent e) {
|
||||
int y = e.getClientY();
|
||||
int i=0, position=0, positionY = 0;
|
||||
|
||||
for (Component c : layersPanel.getItems()) {
|
||||
int cy1 = c.getAbsoluteTop();
|
||||
int cy2 = cy1+c.getOffsetHeight()+spacing;
|
||||
if (cy1<=y && y<=cy2) {
|
||||
// if y<average then the object will drop before the i-object, else after.
|
||||
if (y <= (cy1+cy2)/2) {
|
||||
position = i;
|
||||
positionY = cy1 - spacing/2;
|
||||
} else {
|
||||
position = i+1;
|
||||
positionY = cy2 + spacing/2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return new int[]{position,positionY};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDragDrop(DNDEvent event) {
|
||||
int[] ar = getPosition(event);
|
||||
int pos = ar[0];
|
||||
VerticalPanel vp = event.getData();
|
||||
//that.add(hp);
|
||||
|
||||
if (pos>=layersPanel.getItemCount())
|
||||
layersPanel.add(vp);
|
||||
else
|
||||
layersPanel.insert(vp, pos);
|
||||
layersPanel.layout(true);
|
||||
|
||||
this.layersPanel.updateLayersOrder();
|
||||
|
||||
// String str;
|
||||
// if (pos==0)
|
||||
// str = "All'inizio, prima di " + pos;
|
||||
// else if (pos==layersPanel.getItemCount())
|
||||
// str = "Alla fine, dopo di " + (pos-1);
|
||||
// else
|
||||
// str = "Tra " + (pos-1) + " e " + (pos);
|
||||
// Info.display("", str);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.layerspanel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
|
||||
import com.extjs.gxt.ui.client.core.El;
|
||||
import com.extjs.gxt.ui.client.dnd.DragSource;
|
||||
import com.extjs.gxt.ui.client.dnd.DropTarget;
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
import com.extjs.gxt.ui.client.event.DNDEvent;
|
||||
import com.extjs.gxt.ui.client.event.DomEvent;
|
||||
import com.extjs.gxt.ui.client.event.EventType;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.Info;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.layout.TableData;
|
||||
|
||||
|
||||
public class LayersPanel extends VerticalPanel {
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
Map<LayerItem, LayerToolsPanel> map = new HashMap<LayerItem, LayerToolsPanel>();
|
||||
static final int spacing = 3;
|
||||
private LayersPanelHandler layersPanelHandler;
|
||||
private boolean isEmpty = true;
|
||||
private LayerItem layerItemTransect;
|
||||
private boolean firstTimeOver = true;
|
||||
|
||||
public LayersPanel(LayersPanelHandler layersPanelHandler) {
|
||||
super();
|
||||
this.layersPanelHandler = layersPanelHandler;
|
||||
|
||||
this.setSpacing(spacing);
|
||||
|
||||
if (Constants.layersDragEnabled) {
|
||||
DropTarget target = new LayersDropTarget(this);
|
||||
target.setGroup("layersPanel");
|
||||
}
|
||||
|
||||
setTableWidth("100%");
|
||||
|
||||
this.addListener(Events.OnMouseOver, new Listener<DomEvent>(){
|
||||
@Override
|
||||
public void handleEvent(DomEvent be) {
|
||||
if (firstTimeOver) {
|
||||
Info.display("Layers Panel", "Now it's possible to move layers to ordering change.");
|
||||
firstTimeOver = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showEmptyMessage() {
|
||||
this.removeAll();
|
||||
Label l = new Label("No layers");
|
||||
l.setStyleAttribute("font-size", "12px");
|
||||
this.add(l);
|
||||
this.layout();
|
||||
}
|
||||
|
||||
public void addLayer(LayerItem layerItem, boolean toTop) {
|
||||
// add layer item object
|
||||
if (toTop)
|
||||
this.layerItems.add(0, layerItem);
|
||||
else
|
||||
this.layerItems.add(layerItem);
|
||||
|
||||
final LayerToolsPanel layerToolsPanel = new LayerToolsPanel(layerItem, layersPanelHandler);
|
||||
|
||||
if (Constants.layersDragEnabled) {
|
||||
DragSource source = new DragSource(layerToolsPanel) {
|
||||
@Override
|
||||
protected void onDragStart(DNDEvent event) {
|
||||
if (event.getClientY()<layerToolsPanel.getAbsoluteTop()+20) {
|
||||
event.setData(layerToolsPanel);
|
||||
event.getStatus().update(El.fly(layerToolsPanel.getElement()).cloneNode(true));
|
||||
} else
|
||||
event.setData(null);
|
||||
}
|
||||
};
|
||||
source.setGroup("layersPanel");
|
||||
}
|
||||
|
||||
if (isEmpty) {
|
||||
this.removeAll();
|
||||
isEmpty = false;
|
||||
}
|
||||
map.put(layerItem, layerToolsPanel);
|
||||
|
||||
if (toTop)
|
||||
this.insert(layerToolsPanel, 0, new TableData("100%", ""));
|
||||
else
|
||||
this.add(layerToolsPanel, new TableData("100%", ""));
|
||||
}
|
||||
|
||||
public void addLayerItems(List<LayerItem> layers, boolean toTop) {
|
||||
for (LayerItem layerItem : layers)
|
||||
this.addLayer(layerItem, toTop);
|
||||
this.layout();
|
||||
}
|
||||
|
||||
public List<LayerItem> getVisibleLayers() {
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
for (LayerItem layerItem : this.layerItems)
|
||||
if (layerItem.isVisible())
|
||||
layerItems.add(layerItem);
|
||||
return layerItems;
|
||||
}
|
||||
|
||||
public void updateLayersOrder() {
|
||||
// System.out.println("LAYERS ORDER");
|
||||
int i=0;
|
||||
for (Component c : this.getItems()) {
|
||||
LayerToolsPanel layerToolPanel = (LayerToolsPanel)c;
|
||||
LayerItem layerItem = layerToolPanel.getLayerItem();
|
||||
layerItem.setOrder(++i);
|
||||
// System.out.println(""+(++i)+") " + layerItem.getLayer() + " ("+layerItem.getId()+")");
|
||||
}
|
||||
this.layersPanelHandler.updateLayersOrder();
|
||||
}
|
||||
|
||||
public void setCqlTip(LayerItem layerItem, boolean show) {
|
||||
LayerToolsPanel layerToolsPanel = map.get(layerItem);
|
||||
layerToolsPanel.setCqlTip(show);
|
||||
}
|
||||
|
||||
public void setTransectTip(LayerItem layerItem, boolean show) {
|
||||
// delete previous transet tip
|
||||
if (show && this.layerItemTransect!=null) {
|
||||
LayerToolsPanel layerToolsPanelTransect = map.get(layerItemTransect);
|
||||
if (layerToolsPanelTransect!=null)
|
||||
layerToolsPanelTransect.setTransectTip(false);
|
||||
}
|
||||
|
||||
LayerToolsPanel layerToolsPanel = map.get(layerItem);
|
||||
if (layerToolsPanel!=null) {
|
||||
layerToolsPanel.setTransectTip(show);
|
||||
this.layerItemTransect = show ? layerItem : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
*/
|
||||
public void removeLayer(LayerItem layerItem) {
|
||||
LayerToolsPanel layertoolsPanel = map.get(layerItem);
|
||||
map.remove(layerItem);
|
||||
layerItems.remove(layerItem);
|
||||
this.remove(layertoolsPanel);
|
||||
this.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public List<LayerItem> getLayerItems() {
|
||||
return this.layerItems;
|
||||
}
|
||||
|
||||
public void setLayerVisible(LayerItem layerItem, boolean isVisible) {
|
||||
LayerToolsPanel layertoolsPanel = map.get(layerItem);
|
||||
if (layertoolsPanel!=null)
|
||||
layertoolsPanel.setCheckVisible(isVisible);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.layerspanel;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
|
||||
public interface LayersPanelHandler {
|
||||
|
||||
public void activateTransect(LayerItem layerItem, String table, String field);
|
||||
|
||||
public void openBrowserLayerImage(LayerItem layerItem, String format, boolean isWMS);
|
||||
public void saveLayerImage(LayerItem layerItem, String format, boolean isWMS);
|
||||
|
||||
public void showLegend(LayerItem layerItem, int left, int top);
|
||||
public void changeLegend(LayerItem layerItem, String style);
|
||||
|
||||
public void setOpacityLayer(LayerItem layerItem, double value);
|
||||
|
||||
public void showLayer(LayerItem layerItem);
|
||||
public void hideLayer(LayerItem layerItem);
|
||||
|
||||
public boolean showFilterQuery(LayerItem layerItem, int left, int top);
|
||||
public void removeFilterQuery(LayerItem layerItem);
|
||||
|
||||
public void updateLayersOrder();
|
||||
|
||||
public boolean isSaveSupported();
|
||||
|
||||
public void deactivateTransect(LayerItem layerItem);
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
*/
|
||||
public void removeLayer(LayerItem layerItem);
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
|
||||
public interface CqlFilterHandler {
|
||||
|
||||
public void removeCqlFilter(LayerItem layerItem);
|
||||
|
||||
public void setCQLFilter(LayerItem layerItem, String filter);
|
||||
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.CQLQueryObject;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.Property;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.KeyListener;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Html;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
|
||||
public class CqlFilterPanel {
|
||||
private LayerItem layerItem;
|
||||
private Dialog dialog = null;
|
||||
private TextField<String> filterTextField;
|
||||
private Button executeQueryButton;
|
||||
private Button removeFilterButton;
|
||||
private CqlFilterHandler cqlFilterHandler;
|
||||
|
||||
public CqlFilterPanel(CqlFilterHandler _cqlFilterHandler) {
|
||||
this.cqlFilterHandler = _cqlFilterHandler;
|
||||
|
||||
dialog = new Dialog();
|
||||
dialog.setHeading("CQL Filter");
|
||||
dialog.setButtons(Dialog.CLOSE);
|
||||
//dialog.setBodyStyleName("pad-text");
|
||||
dialog.addText("");
|
||||
dialog.setModal(true);
|
||||
dialog.setScrollMode(Scroll.AUTO);
|
||||
dialog.setHideOnButtonClick(true);
|
||||
dialog.addListener(Events.Close, new Listener<BaseEvent>() {
|
||||
public void handleEvent(BaseEvent be) {
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// init text field
|
||||
filterTextField = new TextField<String>();
|
||||
filterTextField.setWidth(300);
|
||||
filterTextField.addKeyListener(new KeyListener(){
|
||||
@Override
|
||||
public void componentKeyDown(ComponentEvent event) {
|
||||
super.componentKeyDown(event);
|
||||
if (event.getKeyCode() == KeyCodes.KEY_ENTER)
|
||||
execQuery();
|
||||
}
|
||||
});
|
||||
|
||||
// init execute query button
|
||||
executeQueryButton = new Button("", Images.iconExecuteQuery(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
execQuery();
|
||||
}
|
||||
});
|
||||
executeQueryButton.setSize(25, 25);
|
||||
executeQueryButton.setToolTip("Execute Query");
|
||||
|
||||
// init remove filter button
|
||||
removeFilterButton = new Button("", Images.iconRemoveCqlFilter(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
cqlFilterHandler.removeCqlFilter(layerItem);
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
removeFilterButton.setSize(25, 25);
|
||||
removeFilterButton.setToolTip("Remove Filter");
|
||||
}
|
||||
|
||||
|
||||
public void open(LayerItem layerItem, int x, int y) {
|
||||
this.layerItem = layerItem;
|
||||
String cqlFilter = layerItem.getCqlFilter();
|
||||
|
||||
dialog.removeAll();
|
||||
dialog.setHeading("CQL Filter on " + layerItem.getTitle());
|
||||
dialog.add(new Label("<br/>Current filter: <b>"+(cqlFilter.equals("") ? "none" : cqlFilter)+"</b>"+"<br/><br/>"));
|
||||
|
||||
List<Property> properties = layerItem.getProperties();
|
||||
if (properties!=null && properties.size()>0) {
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
String str = "";
|
||||
for (Property p: properties)
|
||||
str += (p==properties.get(0) ? "" : ", ") + p.getName();
|
||||
Label l = new Label("Fields: ");
|
||||
l.setStyleAttribute("font-size", "12px");
|
||||
hp.add(l);
|
||||
hp.add(new Html("<div class=\"cqlPropertiesText\"><nobr>"+str+"<nobr></div>"));
|
||||
dialog.add(hp);
|
||||
}
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(new Label("CQL Filter: "));
|
||||
hp.add(filterTextField);
|
||||
hp.add(executeQueryButton);
|
||||
hp.add(removeFilterButton);
|
||||
dialog.add(hp);
|
||||
|
||||
dialog.setPagePosition(x, y);
|
||||
dialog.setWidth(450);
|
||||
//dialog.setSize(450, 180);
|
||||
dialog.setAutoHeight(true);
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
private void execQuery() {
|
||||
CQLQueryObject cqlQueryObject = new CQLQueryObject();
|
||||
cqlQueryObject.setCqlQuery(filterTextField.getValue());
|
||||
cqlFilterHandler.setCQLFilter(layerItem, cqlQueryObject.getCqlQuery());
|
||||
dialog.hide();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.BoundsMap;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gwtopenmaps.openlayers.client.Bounds;
|
||||
import org.gwtopenmaps.openlayers.client.layer.GMapType;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Google;
|
||||
import org.gwtopenmaps.openlayers.client.layer.GoogleOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Layer;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMS;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMSParams;
|
||||
|
||||
public class LayerItemsHandler {
|
||||
|
||||
private List<Layer> layers_click = new ArrayList<Layer>(); // it was WMS instead Layer
|
||||
private List<Layer> layers_legend = new ArrayList<Layer>(); // it was WMS instead Layer
|
||||
private List<Layer> layers = new ArrayList<Layer>();
|
||||
|
||||
public LayerItemsHandler(List<LayerItem> layerItems) {
|
||||
|
||||
for (LayerItem layerItem : layerItems) {
|
||||
Layer layer = getLayerFromLayerItem(layerItem);
|
||||
if (layerItem.isOnMap())
|
||||
layers.add(layer);
|
||||
if (layerItem.isClickData())
|
||||
layers_click.add(layer);
|
||||
if (layerItem.isHasLegend())
|
||||
layers_legend.add(layer);
|
||||
}
|
||||
}
|
||||
|
||||
public LayerItemsHandler(List<LayerItem> layerItems,
|
||||
HashMap<LayerItem, Layer> mappingLayerItemsToLayers,
|
||||
HashMap<Layer, LayerItem> mappingLayersToLayerItems) {
|
||||
|
||||
for (LayerItem layerItem : layerItems) {
|
||||
Layer layer = getLayerFromLayerItem(layerItem);
|
||||
|
||||
mappingLayerItemsToLayers.put(layerItem, layer);
|
||||
mappingLayersToLayerItems.put(layer, layerItem);
|
||||
|
||||
if (layerItem.isOnMap())
|
||||
layers.add(layer);
|
||||
if (layerItem.isClickData())
|
||||
layers_click.add(layer);
|
||||
if (layerItem.isHasLegend())
|
||||
layers_legend.add(layer);
|
||||
}
|
||||
}
|
||||
|
||||
private Layer getLayerFromLayerItem(LayerItem layerItem) {
|
||||
Layer layer;
|
||||
BoundsMap bounds = layerItem.getMaxExtent();
|
||||
if (layerItem.getName().contentEquals("Google Satellite")) {
|
||||
GoogleOptions googleOptions = new GoogleOptions();
|
||||
googleOptions.setType(GMapType.G_SATELLITE_MAP);
|
||||
googleOptions.setNumZoomLevels(12);
|
||||
googleOptions.setProjection("EPSG:4326");
|
||||
googleOptions.setDisplayOutsideMaxExtent(true);
|
||||
googleOptions.setIsBaseLayer(layerItem.isBaseLayer());
|
||||
googleOptions.setMaxExtent(new Bounds(bounds.getLowerLeftX(),
|
||||
bounds.getLowerLeftY(),
|
||||
bounds.getUpperRightX(),
|
||||
bounds.getUpperRightY()));
|
||||
|
||||
layer = new Google("Google Satellite", googleOptions);
|
||||
|
||||
} else {
|
||||
WMSOptions wmso = new WMSOptions();
|
||||
wmso.setIsBaseLayer(layerItem.isBaseLayer());
|
||||
wmso.setBuffer(layerItem.getBuffer());
|
||||
wmso.setWrapDateLine(layerItem.isWrapDateLine());
|
||||
|
||||
WMSParams wmsp = new WMSParams();
|
||||
wmsp.setLayers(layerItem.getLayer());
|
||||
wmsp.setStyles(layerItem.getStyle());
|
||||
|
||||
if (bounds!=null) {
|
||||
wmsp.setMaxExtent(new Bounds(bounds.getLowerLeftX(),
|
||||
bounds.getLowerLeftY(),
|
||||
bounds.getUpperRightX(),
|
||||
bounds.getUpperRightY()));
|
||||
}
|
||||
wmsp.setIsTransparent(layerItem.isTrasparent());
|
||||
|
||||
layer = new WMS(layerItem.getName(), layerItem.getUrl(), wmsp, wmso);
|
||||
}
|
||||
//layerItem.setOpenlayersLayer((LayerItem.Layer2)layer);
|
||||
layer.setIsVisible(layerItem.isVisible());
|
||||
layer.setOpacity((float)layerItem.getOpacity());
|
||||
return layer;
|
||||
}
|
||||
|
||||
// private void setOpacity(Layer l) {
|
||||
// boolean isBrightLayer=false;
|
||||
// for (String s : Constants.brightLayers)
|
||||
// if (s.equals(l.getName()))
|
||||
// isBrightLayer=true;
|
||||
//
|
||||
// if (!isBrightLayer)
|
||||
// l.setOpacity((float) Constants.defaultOpacityLayers);
|
||||
// }
|
||||
|
||||
public List<Layer> getLayersWithLegend() {
|
||||
return layers_legend;
|
||||
}
|
||||
|
||||
public List<Layer> getLayersClickData() {
|
||||
return layers_click;
|
||||
}
|
||||
|
||||
public List<Layer> getLayers() {
|
||||
return layers;
|
||||
}
|
||||
|
||||
public static String getLayerName(WMS layer){
|
||||
return layer.getJSObject().getProperty("params").getPropertyAsString("LAYERS");
|
||||
}
|
||||
public static String getLayerStyle(WMS layer){
|
||||
return layer.getJSObject().getProperty("params").getPropertyAsString("STYLES");
|
||||
}
|
||||
public static String getLayerStyle(Layer layer){
|
||||
return layer.getJSObject().getProperty("params").getPropertyAsString("STYLES");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import org.gwtopenmaps.openlayers.client.handler.PointHandler;
|
||||
import org.gwtopenmaps.openlayers.client.util.JSObject;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Edwin Commandeur - Atlis EJS
|
||||
*
|
||||
*/
|
||||
public class LineHandler extends PointHandler {
|
||||
|
||||
protected LineHandler(JSObject element) {
|
||||
super(element);
|
||||
}
|
||||
|
||||
public LineHandler(){
|
||||
this(LineHandlerImpl.create());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import org.gwtopenmaps.openlayers.client.util.JSObject;
|
||||
|
||||
public class LineHandlerImpl {
|
||||
public static native JSObject create() /*-{
|
||||
return $wnd.OpenLayers.Handler.Line;
|
||||
}-*/;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public interface OpenLayersHandler {
|
||||
|
||||
// public void clickOnMap(int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* @param bbo
|
||||
*/
|
||||
public void selectBox(double x1, double y1, double x2, double y2);
|
||||
}
|
|
@ -0,0 +1,751 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.MapViewInfo;
|
||||
import org.gwtopenmaps.openlayers.client.Bounds;
|
||||
import org.gwtopenmaps.openlayers.client.LonLat;
|
||||
import org.gwtopenmaps.openlayers.client.Map;
|
||||
import org.gwtopenmaps.openlayers.client.MapOptions;
|
||||
import org.gwtopenmaps.openlayers.client.MapWidget;
|
||||
import org.gwtopenmaps.openlayers.client.control.Control;
|
||||
import org.gwtopenmaps.openlayers.client.control.DrawFeature;
|
||||
import org.gwtopenmaps.openlayers.client.control.DrawFeature.FeatureAddedListener;
|
||||
import org.gwtopenmaps.openlayers.client.control.DrawFeatureOptions;
|
||||
import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
|
||||
import org.gwtopenmaps.openlayers.client.control.MouseDefaults;
|
||||
import org.gwtopenmaps.openlayers.client.control.MousePosition;
|
||||
import org.gwtopenmaps.openlayers.client.control.MousePositionOptions;
|
||||
import org.gwtopenmaps.openlayers.client.control.MousePositionOutput;
|
||||
import org.gwtopenmaps.openlayers.client.control.NavToolbar;
|
||||
import org.gwtopenmaps.openlayers.client.control.PanZoomBar;
|
||||
import org.gwtopenmaps.openlayers.client.control.ZoomBox;
|
||||
import org.gwtopenmaps.openlayers.client.event.MapClickListener;
|
||||
import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
|
||||
import org.gwtopenmaps.openlayers.client.geometry.Geometry;
|
||||
import org.gwtopenmaps.openlayers.client.geometry.Point;
|
||||
import org.gwtopenmaps.openlayers.client.handler.RegularPolygonHandler;
|
||||
import org.gwtopenmaps.openlayers.client.handler.RegularPolygonHandlerOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Layer;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Vector;
|
||||
import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMS;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMSParams;
|
||||
import org.gwtopenmaps.openlayers.client.util.JObjectArray;
|
||||
import org.gwtopenmaps.openlayers.client.util.JSObject;
|
||||
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class OpenLayersMap {
|
||||
|
||||
protected static final int MAX_ZINDEX = 100000;
|
||||
private List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
private Map map;
|
||||
private MapWidget mapWidget;
|
||||
private HashMap<String, String> mapping = new HashMap<String, String>();
|
||||
private HashMap<LayerItem, Layer> mappingLayerItemsToLayers = new HashMap<LayerItem, Layer>();
|
||||
private HashMap<Layer, LayerItem> mappingLayersToLayerItems = new HashMap<Layer, LayerItem>();
|
||||
private NavToolbar mouseToolBar;
|
||||
private MouseDefaults mouseDefaults;
|
||||
//private OverviewMap overViewMap;
|
||||
//private MouseClickOnMap mouseClickOnMap;
|
||||
// private ToolBarPanelOld toolBarPanel;
|
||||
private int numZoomLevels = 0;
|
||||
//private String projection = "";
|
||||
private Vector vectorLayer;
|
||||
private ZoomBox zoomBox;
|
||||
private boolean clickData = false;
|
||||
private String tableTransect = "";
|
||||
private String fieldTransect = "";
|
||||
private VectorFeature prevVf;
|
||||
public static Bounds defaultBounds = new Bounds(-180, -90, 180, 90);// -180, -90, 180, 90 //-20037508.34,-20037508.34,20037508.34,20037508.34);// TODO -180, -90, 180, 90);
|
||||
public static String defaultProjection = "EPSG:4326";
|
||||
private List<Layer> baseLayers = new ArrayList<Layer>();
|
||||
private String transectUrl;
|
||||
//private static String defaultProjection = "EPSG:900913";//"EPSG:4326";
|
||||
private DrawFeature drawBoxControl;
|
||||
private DrawFeature drawLineControl;
|
||||
private OpenLayersHandler handler=null;
|
||||
private int maxZindex = 0;
|
||||
private ToolBarPanel toolBarPanel;
|
||||
|
||||
// constructor
|
||||
public OpenLayersMap(String w, String h, int numZoomLevels, // projection, transectUrl removed
|
||||
String title, final OpenLayersHandler handler) {
|
||||
|
||||
this.handler = handler;
|
||||
this.numZoomLevels = numZoomLevels;
|
||||
//this.projection = defaultBounds.;
|
||||
|
||||
// set map options
|
||||
MapOptions mapOptions = new MapOptions();
|
||||
mapOptions.setControls(new JObjectArray(new JSObject[] {}));
|
||||
mapOptions.setNumZoomLevels(numZoomLevels);
|
||||
mapOptions.setProjection(defaultProjection);
|
||||
|
||||
// let's create map widget and map objects
|
||||
mapWidget = new MapWidget(w, h, mapOptions); // map widget
|
||||
map = mapWidget.getMap(); // map js-mapped object
|
||||
mapWidget.setTitle(title); // set title
|
||||
map.setMaxExtent(defaultBounds);
|
||||
//map.getJSObject().setProperty("allOverlays", true);
|
||||
|
||||
// set click listener on the map
|
||||
map.addMapClickListener(new MapClickListener() {
|
||||
public void onClick(MapClickEvent mapClickEvent) {
|
||||
if (clickData) {
|
||||
double lat = mapClickEvent.getLonLat().lat();
|
||||
double lon = mapClickEvent.getLonLat().lon();
|
||||
addPoint(lon, lat);
|
||||
|
||||
// int x = mapClickEvent.getJSObject().getProperty("xy")
|
||||
// .getPropertyAsInt("x");
|
||||
// int y = mapClickEvent.getJSObject().getProperty("xy")
|
||||
// .getPropertyAsInt("y");
|
||||
|
||||
int w = (int) map.getSize().getWidth();
|
||||
int h = (int) map.getSize().getHeight();
|
||||
// handler.clickOnMap(x, y, w, h);
|
||||
|
||||
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
|
||||
// where 10px is the pixel diameter dimension of the clicked point
|
||||
|
||||
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
|
||||
double geoWidth = bboxWidth / w * 10 / 2;
|
||||
double x1 = Math.min(lon+geoWidth, lon-geoWidth);
|
||||
double x2 = Math.max(lon+geoWidth, lon-geoWidth);
|
||||
double y1 = Math.min(lat+geoWidth, lat-geoWidth);
|
||||
double y2 = Math.max(lat+geoWidth, lat-geoWidth);
|
||||
Constants.log("("+(x1)+","+(y1)+")("+(x2)+","+(y2)+")");
|
||||
handler.selectBox(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// set the other controls
|
||||
mouseDefaults = new MouseDefaults();
|
||||
mouseToolBar = new NavToolbar();
|
||||
PanZoomBar pamZoomBar = new PanZoomBar();
|
||||
zoomBox = new ZoomBox();
|
||||
|
||||
Element e = mouseDefaults.getJSObject().getPropertyAsDomElement("position");
|
||||
e.setPropertyDouble("x", -300);
|
||||
mouseDefaults.getJSObject().setProperty("position", e);
|
||||
|
||||
|
||||
VectorOptions vectoroptions = new VectorOptions();
|
||||
vectoroptions.setDisplayInLayerSwitcher(false);
|
||||
vectoroptions.setDisplayOutsideMaxExtent(true);
|
||||
vectoroptions.setProjection(defaultProjection);
|
||||
vectorLayer = new Vector("transet", vectoroptions);
|
||||
map.addLayer(vectorLayer);
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
addBaseLayers();
|
||||
|
||||
addControl(mouseDefaults);
|
||||
addControl(pamZoomBar);
|
||||
addControl(getMousePosition());
|
||||
addControl(zoomBox);
|
||||
addControl(new LayerSwitcher());
|
||||
|
||||
addTransectControl();
|
||||
addBoxControl();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void addTransectControl() {
|
||||
FeatureAddedListener listener = new FeatureAddedListener() {
|
||||
public void onFeatureAdded(VectorFeature vf) {
|
||||
if (transectUrl==null)
|
||||
return;
|
||||
org.gwtopenmaps.openlayers.client.geometry.LineString line = org.gwtopenmaps.openlayers.client.geometry.LineString
|
||||
.narrowToLineString(vf.getGeometry().getJSObject());
|
||||
|
||||
Double x1;
|
||||
Double y1;
|
||||
Double x2;
|
||||
Double y2;
|
||||
|
||||
try {
|
||||
double[][] coordinate = line.getCoordinateArray();
|
||||
|
||||
x1 = coordinate[0][0];
|
||||
y1 = coordinate[0][1];
|
||||
x2 = coordinate[1][0];
|
||||
y2 = coordinate[1][1];
|
||||
String url = transectUrl + "?"
|
||||
+ "x1=" + x1 + "&" + "y1=" + y1 + "&" + "x2=" + x2
|
||||
+ "&" + "y2=" + y2 + "&SRID=4326"
|
||||
+ "&maxelements=1000" + "&minimumgap=-1"
|
||||
+ "&tablename=" + getTableTransect()
|
||||
+ "&biodiversityfield=" + getFieldTransect();
|
||||
|
||||
Window.open(url, "_blank", "");
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
vf.destroy();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
DrawFeatureOptions drawoptions = new DrawFeatureOptions();
|
||||
drawoptions.onFeatureAdded(listener);
|
||||
|
||||
LineHandler handler = new LineHandler();
|
||||
|
||||
drawLineControl = new DrawFeature(vectorLayer, handler, drawoptions);
|
||||
addControl(drawLineControl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void addBoxControl() {
|
||||
FeatureAddedListener listener = new FeatureAddedListener() {
|
||||
@Override
|
||||
public void onFeatureAdded(VectorFeature vf) {
|
||||
if (prevVf!=null)
|
||||
vectorLayer.removeFeature(prevVf);
|
||||
prevVf = vf;
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
Geometry geo = vf.getGeometry();
|
||||
Bounds bounds = geo.getBounds();
|
||||
double x1 = bounds.getLowerLeftX();
|
||||
double y1 = bounds.getLowerLeftY();
|
||||
double x2 = bounds.getUpperRightX();
|
||||
double y2 = bounds.getUpperRightY();
|
||||
handler.selectBox(x1, y1, x2, y2);
|
||||
}
|
||||
};
|
||||
|
||||
DrawFeatureOptions options = new DrawFeatureOptions();
|
||||
options.onFeatureAdded(listener);
|
||||
RegularPolygonHandlerOptions handlerOptions = new RegularPolygonHandlerOptions();
|
||||
handlerOptions.setSides(4);
|
||||
handlerOptions.setIrregular(true);
|
||||
options.setHandlerOptions(handlerOptions);
|
||||
drawBoxControl = new DrawFeature(vectorLayer, new RegularPolygonHandler(), options);
|
||||
this.map.addControl(drawBoxControl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private Control getMousePosition() {
|
||||
// set text mouse position (latitude and longitude)
|
||||
MousePositionOutput mpOut = new MousePositionOutput() {
|
||||
@Override
|
||||
public String format(LonLat lonLat, Map map) {
|
||||
String out = "";
|
||||
out += "<table bgcolor=\"#000000\">";
|
||||
out += "<tr><td>";
|
||||
out += "<font color=\"#FFFFFF\" align=\"left\"><b>Latitude</b></font></td>";
|
||||
out += "<td bgcolor=\"#AAAAAA\"><font color=\"#000000\">";
|
||||
out += Util.getFormattedLonLat(lonLat.lat(), "", "");
|
||||
// out += lonLat.lat();
|
||||
out += "</font></td>";
|
||||
out += "<td>";
|
||||
out += "<font color=\"#FFFFFF\" align=\"left\"><b>Longitude</b></font></td>";
|
||||
out += "<td bgcolor=\"#AAAAAA\"><font color=\"#000000\">";
|
||||
out += Util.getFormattedLonLat(lonLat.lon(), "lon", "");
|
||||
// out += lonLat.lon();
|
||||
out += "</font></td></tr>";
|
||||
out += "</table>";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
};
|
||||
MousePositionOptions mpOptions = new MousePositionOptions();
|
||||
mpOptions.setFormatOutput(mpOut);
|
||||
MousePosition mousePosition = new MousePosition(mpOptions);
|
||||
return mousePosition;
|
||||
}
|
||||
|
||||
public void activateZoomOut() {
|
||||
mouseToolBar.getJSObject().setProperty("mode", "zoomout");
|
||||
}
|
||||
|
||||
public void addLayerItems(List<LayerItem> layerItems, boolean toTop) {
|
||||
if (toTop)
|
||||
for (LayerItem layerItem : layerItems)
|
||||
this.layerItems.add(0, layerItem);
|
||||
else
|
||||
for (LayerItem layerItem : layerItems)
|
||||
this.layerItems.add(layerItem);
|
||||
|
||||
LayerItemsHandler lh = new LayerItemsHandler(layerItems,
|
||||
mappingLayerItemsToLayers, mappingLayersToLayerItems);
|
||||
List<Layer> ls = lh.getLayers();
|
||||
Layer[] lsArray = new Layer[ls.size()];
|
||||
ls.toArray(lsArray);
|
||||
this.addLayers(lsArray);
|
||||
}
|
||||
|
||||
private void addLayers(Layer[] layers) {
|
||||
|
||||
for (Layer l : layers) {
|
||||
l.setIsBaseLayer(false);
|
||||
l.getJSObject().setProperty("animationEnabled", true);
|
||||
l.getJSObject().setProperty("displayInLayerSwitcher", false);
|
||||
|
||||
if (l.getName().contentEquals("Google Satellite"))
|
||||
mapping.put("Google Satellite", l.getId());
|
||||
else {
|
||||
String layerName = l.getJSObject().getProperty("params").getPropertyAsString("LAYERS");
|
||||
mapping.put(layerName, l.getId());
|
||||
}
|
||||
}
|
||||
|
||||
map.addLayers(layers);
|
||||
//vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
// OverviewMapOptions overOptions = new OverviewMapOptions();
|
||||
// Layer[] ls = new Layer[1];
|
||||
// ls[0] = layers[0];
|
||||
//
|
||||
// overOptions.setLayers(ls);
|
||||
//
|
||||
// if (Constants.isOverViewMapVisible) {
|
||||
// overViewMap = new OverviewMap();
|
||||
// addControl(overViewMap);
|
||||
// }
|
||||
}
|
||||
|
||||
// public void addToolBarOld(ToolBarPanelOld toolBarPanel) {
|
||||
// this.toolBarPanel = toolBarPanel;
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* @param toolBarPanel2
|
||||
*/
|
||||
public void addToolBar(ToolBarPanel toolBarPanel) {
|
||||
this.toolBarPanel = toolBarPanel;
|
||||
}
|
||||
|
||||
private void addControl(Control control) {
|
||||
map.addControl(control);
|
||||
}
|
||||
|
||||
public List<LayerItem> getLayerItems() {
|
||||
return layerItems;
|
||||
}
|
||||
|
||||
public Widget getDockPanel() {
|
||||
// int zoom=map.getZoomForExtent(map.getMaxExtent(), true);
|
||||
// let's center the map to somewhere and set zoom level to 5
|
||||
LonLat center = new LonLat(0, 0);
|
||||
map.setCenter(center, Constants.openLayersMapDefaultZoom);
|
||||
// map.setCenter(center, zoom);
|
||||
|
||||
// eventually add the map widget to div:map
|
||||
final DockPanel dockPanel = new DockPanel();
|
||||
|
||||
if (toolBarPanel != null)
|
||||
dockPanel.add(toolBarPanel, DockPanel.NORTH);
|
||||
|
||||
dockPanel.add(mapWidget, DockPanel.CENTER);
|
||||
|
||||
return dockPanel;
|
||||
|
||||
}
|
||||
|
||||
public ContentPanel getContentPanel() {
|
||||
ContentPanel panel = new ContentPanel();
|
||||
panel.setHeaderVisible(false);
|
||||
panel.setLayout(new FitLayout());
|
||||
panel.add(mapWidget);
|
||||
panel.setTopComponent(toolBarPanel);
|
||||
|
||||
// int zoom=map.getZoomForExtent(map.getMaxExtent(), true);
|
||||
// let's center the map to somewhere and set zoom level to 5
|
||||
LonLat center = new LonLat(0, 0);
|
||||
map.setCenter(center, Constants.openLayersMapDefaultZoom);
|
||||
// map.setCenter(center, zoom);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
public void setOpacity(LayerItem layerItem, double opacity) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
if (layer != null)
|
||||
layer.setOpacity(new Float(opacity).floatValue());
|
||||
}
|
||||
|
||||
public void setVisibility(LayerItem layerItem, boolean visible) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
if (layer != null) {
|
||||
layer.setIsVisible(visible);
|
||||
layer.redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public void reproject(String proj) {
|
||||
|
||||
Constants.log("change " + proj);
|
||||
|
||||
MapOptions mapOptions = new MapOptions();
|
||||
mapOptions.setControls(new JObjectArray(new JSObject[] {}));
|
||||
mapOptions.setNumZoomLevels(this.numZoomLevels);
|
||||
mapOptions.setProjection(proj);
|
||||
|
||||
mapWidget.getMap().setOptions(mapOptions);
|
||||
}
|
||||
|
||||
public void zoomToMaxExtent() {
|
||||
this.map.zoomToMaxExtent();
|
||||
}
|
||||
|
||||
public String getProjection() {
|
||||
return this.map.getProjection();
|
||||
}
|
||||
|
||||
public Bounds getMaxExtent() {
|
||||
return this.map.getMaxExtent();
|
||||
}
|
||||
|
||||
public Bounds getExtent() {
|
||||
return this.map.getExtent();
|
||||
}
|
||||
|
||||
public void activateTransectDraw(boolean isActivate) {
|
||||
if (isActivate)
|
||||
drawLineControl.activate();
|
||||
else
|
||||
drawLineControl.deactivate();
|
||||
}
|
||||
|
||||
public void activateClickData(boolean isActivate) {
|
||||
this.clickData = isActivate;
|
||||
}
|
||||
|
||||
public void activateDrawBoxControl(boolean isActivate) {
|
||||
if (isActivate)
|
||||
this.drawBoxControl.activate();
|
||||
else
|
||||
this.drawBoxControl.deactivate();
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
}
|
||||
|
||||
public void activateZoomIn(boolean isActivate) {
|
||||
if (isActivate)
|
||||
zoomBox.activate();
|
||||
else
|
||||
zoomBox.deactivate();
|
||||
}
|
||||
|
||||
public void activatePan(boolean isActivate) {
|
||||
if (isActivate)
|
||||
mouseDefaults.activate();
|
||||
else
|
||||
mouseDefaults.deactivate();
|
||||
}
|
||||
|
||||
// added by gianpaolo coro in 13-07-11 for returning to cache when
|
||||
// CQL_FILTERING is finished
|
||||
/*
|
||||
* //String name = this.getLayer(layer).getName(); JSObject layerjs =
|
||||
* this.map.getLayerByName(name).getJSObject(); String url =
|
||||
* layerjs.getPropertyAsString("url");
|
||||
* System.out.println("Switching from Previous URL: "+url); url =
|
||||
* url.replace("geoserver/wms", "geoserver/gwc/service/wms");
|
||||
* layerjs.setProperty("url", url); System.out.println("To New URL: "+url);
|
||||
* //this.map.getLayerByName(name).redraw(true); layer.redraw();
|
||||
*/
|
||||
|
||||
public void removeCqlFilter(LayerItem layerItem) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
|
||||
if (layer!=null) {
|
||||
JSObject layerJs = layer.getJSObject();
|
||||
layerJs.getProperty("params").setProperty("CQL_FILTER", "include");
|
||||
layerItem.setCqlFilter("");
|
||||
|
||||
// switch to the default layer's request url
|
||||
String url = layerItem.getUrl();
|
||||
layerJs.setProperty("url", url);
|
||||
layer.redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCqlFilter(LayerItem layerItem, String filter) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
|
||||
if (layer != null) {
|
||||
Constants.log("LAYER : " + layerItem.getName() + " FILTER : " + filter);
|
||||
JSObject layerJs = layer.getJSObject();
|
||||
layerItem.setCqlFilter(filter);
|
||||
|
||||
if (filter.equals("")) {
|
||||
layerJs.getProperty("params").setProperty("CQL_FILTER", "include");
|
||||
} else {
|
||||
layerJs.getProperty("params").setProperty("CQL_FILTER", filter);
|
||||
|
||||
// added by gianpaolo coro: In the case of filtering don't use
|
||||
// the GWC but directly the wms service
|
||||
// this will be used till the next refresh
|
||||
String wmsUrl = layerItem.getGeoserverWmsUrl();
|
||||
layerJs.setProperty("url", wmsUrl);
|
||||
}
|
||||
layer.redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewStyle(LayerItem layerItem, String newStyle) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
layer.getJSObject().getProperty("params")
|
||||
.setProperty("STYLES", newStyle);
|
||||
layer.redraw();
|
||||
}
|
||||
|
||||
public void setTableTransect(String layerTransect) {
|
||||
this.tableTransect = layerTransect;
|
||||
}
|
||||
|
||||
public String getTableTransect() {
|
||||
return tableTransect;
|
||||
}
|
||||
|
||||
public void setFieldTransect(String fieldTransect) {
|
||||
this.fieldTransect = fieldTransect;
|
||||
}
|
||||
|
||||
public String getFieldTransect() {
|
||||
return fieldTransect;
|
||||
}
|
||||
|
||||
public void changeSize(String w, String h) {
|
||||
// if together are positives
|
||||
if (Integer.parseInt(w) > 0 && Integer.parseInt(h) > 0) {
|
||||
mapWidget.setWidth(w);
|
||||
mapWidget.setHeight(h);
|
||||
this.updateSize();
|
||||
}
|
||||
// mapWidget.setSize(w, h);
|
||||
}
|
||||
|
||||
public void updateSize() {
|
||||
map.updateSize();
|
||||
Constants.info("Update size", "(" + getMapWidth() + "," + getMapHeight() + ")");
|
||||
}
|
||||
|
||||
public int getMapWidth() {
|
||||
return (int) this.map.getSize().getWidth();
|
||||
}
|
||||
|
||||
public int getMapHeight() {
|
||||
return (int) this.map.getSize().getHeight();
|
||||
}
|
||||
|
||||
public MapWidget getMapWidget() {
|
||||
return mapWidget;
|
||||
}
|
||||
|
||||
|
||||
public void addPoint(double x, double y) {
|
||||
// remove any previuos point
|
||||
if (this.prevVf != null)
|
||||
vectorLayer.removeFeature(prevVf);
|
||||
|
||||
// add new point
|
||||
VectorFeature vf = new VectorFeature(new Point(x, y));
|
||||
vectorLayer.addFeature(vf);
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
// store the point
|
||||
this.prevVf = vf;
|
||||
}
|
||||
|
||||
public MapViewInfo getMapViewInfo() {
|
||||
double lowerLeftX = (getExtent().getLowerLeftX() < getMaxExtent()
|
||||
.getLowerLeftX()) ? getMaxExtent().getLowerLeftX()
|
||||
: getExtent().getLowerLeftX();
|
||||
double lowerLeftY = (getExtent().getLowerLeftY() < getMaxExtent()
|
||||
.getLowerLeftY()) ? getMaxExtent().getLowerLeftY()
|
||||
: getExtent().getLowerLeftY();
|
||||
double upperRightX = (getExtent().getUpperRightX() > getMaxExtent()
|
||||
.getUpperRightX()) ? getMaxExtent().getUpperRightX()
|
||||
: getExtent().getUpperRightX();
|
||||
double upperRightY = (getExtent().getUpperRightY() > getMaxExtent()
|
||||
.getUpperRightY()) ? getMaxExtent().getUpperRightY()
|
||||
: getExtent().getUpperRightY();
|
||||
return new MapViewInfo(lowerLeftX, lowerLeftY, upperRightX,
|
||||
upperRightY, getMapWidth(), getMapHeight());
|
||||
}
|
||||
|
||||
public void updateLayersOrder() {
|
||||
// System.out.println("LAYERS NEW ORDER");
|
||||
maxZindex = 0;
|
||||
for (Layer layer : baseLayers) {
|
||||
if (Integer.parseInt((String)layer.getZIndex())>maxZindex)
|
||||
maxZindex = Integer.parseInt((String)layer.getZIndex());
|
||||
}
|
||||
|
||||
for (LayerItem layerItem : layerItems) {
|
||||
// System.out.println("" + (layerItem.getOrder()+zIndexCounter) + ") " + layerItem.getLayer() + " (" + layerItem.getId() + ")");
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
layer.setZIndex(maxZindex + (int)layerItem.getOrder());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
*/
|
||||
public void removeLayer(LayerItem layerItem) {
|
||||
Layer layer = mappingLayerItemsToLayers.get(layerItem);
|
||||
map.removeLayer(layer);
|
||||
layerItems.remove(layerItem);
|
||||
mappingLayerItemsToLayers.remove(layerItem);
|
||||
mappingLayersToLayerItems.remove(layer);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void addBaseLayers() {
|
||||
// options = new GoogleV3Options();
|
||||
// options.setIsBaseLayer(true);
|
||||
// options.setDisplayInLayerSwitcher(true);
|
||||
// options.setType(GoogleV3MapType.G_TERRAIN_MAP);
|
||||
// googleLayer = new GoogleV3("Google Terrain", options);
|
||||
// map.addLayer(googleLayer);
|
||||
//
|
||||
// reproject
|
||||
// MapOptions mapOptions = new MapOptions();
|
||||
// mapOptions.setControls(new JObjectArray(new JSObject[] {}));
|
||||
// mapOptions.setNumZoomLevels(this.numZoomLevels);
|
||||
// mapOptions.setProjection("EPSG:900913");
|
||||
// mapOptions.setMaxExtent(new Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34));
|
||||
// mapOptions.setMaxResolutionToAuto();
|
||||
// mapWidget.getMap().setOptions(mapOptions);
|
||||
|
||||
addBaseLayer("True Marble", "truemarble", "http://romeo.jrc.it/maps/mapserv.cgi?map=../mapfiles/acpmap_static.map&");
|
||||
// addBaseLayer("Blue Marble", "bluemarble_1", "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms");
|
||||
addBaseLayer("Global Surface Relief", "etopo1_ice:z", "http://oos.soest.hawaii.edu/erddap/wms/etopo1_ice/request");
|
||||
addBaseLayer("Shaded Relief", "shaded_relief", "http://maps.ngdc.noaa.gov/soap/etopo1/MapServer/WMSServer");
|
||||
addBaseLayer("Dem", "dem", "http://maps.ngdc.noaa.gov/soap/etopo1/MapServer/WMSServer");
|
||||
addBaseLayer("Etopo180", "etopo180:altitude", "http://coastwatch.pfeg.noaa.gov/erddap/wms/erdBAssta5day/request");
|
||||
addBaseLayer("Groundwater Map", "bgr_groundwater_whymap", "http://www.bgr.de/Service/groundwater/whymap/");
|
||||
addBaseLayer("LandMask", "LandMask", "http://oos.soest.hawaii.edu/erddap/wms/etopo1_ice/request");
|
||||
addBaseLayer("Coastlines", "Coastlines", "http://oos.soest.hawaii.edu/erddap/wms/etopo1_ice/request");
|
||||
// addBaseLayer("test2", "NWW3_Global_Best:Tdir", "http://oos.soest.hawaii.edu/erddap/wms/NWW3_Global_Best/request");
|
||||
addBaseLayer("GEBCO", "GEBCO_08_Grid", "http://www.gebco.net/data_and_products/web_map_service/mapserv/request");
|
||||
addBaseLayer("test2", "", ""); // do not anything
|
||||
|
||||
//var extent = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34); //-2200000,-712631,3072800,3840000);
|
||||
|
||||
// map = new OpenLayers.Map( 'map', {
|
||||
// allOverlays: true,
|
||||
// maxExtent: extent,
|
||||
// projection: '900913' //'EPSG:42304'
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param result
|
||||
*/
|
||||
public void setTransectUrl(String transectUrl) {
|
||||
this.transectUrl = transectUrl;
|
||||
}
|
||||
|
||||
public void deactivateDrawBoxControl() {
|
||||
this.drawBoxControl.deactivate();
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
}
|
||||
|
||||
public void activateDrawBoxControl() {
|
||||
this.drawBoxControl.activate();
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title
|
||||
* @param layerName
|
||||
* @param url
|
||||
*/
|
||||
private void addBaseLayer(String title, String layerName, String url) {
|
||||
if (url==null || url.equals("") || layerName==null || layerName.equals(""))
|
||||
return;
|
||||
LayerItem l = new LayerItem(true);
|
||||
l.setTitle(title);
|
||||
l.setName(layerName);
|
||||
l.setLayer(layerName);
|
||||
l.setGeoserverWmsUrl(url);
|
||||
l.setBaseLayer(true);
|
||||
l.setOpacity(1d);
|
||||
addLayerItemByWms(l, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
* @param displayInLayerSwitcher
|
||||
*/
|
||||
public void addLayerItemByWms(LayerItem layerItem, boolean displayInLayerSwitcher) {
|
||||
WMSOptions wmsOptions = new WMSOptions();
|
||||
wmsOptions.setIsBaseLayer(layerItem.isBaseLayer());
|
||||
wmsOptions.setBuffer(2); // from serviceimpl
|
||||
wmsOptions.setWrapDateLine(true); // default
|
||||
WMSParams wmsParams = new WMSParams();
|
||||
wmsParams.setLayers(layerItem.getLayer());
|
||||
wmsParams.setIsTransparent(!layerItem.isBaseLayer());
|
||||
wmsParams.setFormat("image/png");
|
||||
//wmsParams.setMaxExtent(defaultBounds);
|
||||
Layer layer = new WMS(layerItem.getTitle(), layerItem.getGeoserverWmsUrl(), wmsParams, wmsOptions);
|
||||
layer.setDisplayInLayerSwitcher(displayInLayerSwitcher);
|
||||
mappingLayerItemsToLayers.put(layerItem, layer);
|
||||
mappingLayersToLayerItems.put(layer, layerItem);
|
||||
map.addLayer(layer);
|
||||
|
||||
if (layerItem.isBaseLayer())
|
||||
baseLayers.add(layer);
|
||||
else
|
||||
layerItems.add(layerItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public LayerItem getActiveBaseLayer() {
|
||||
for (Layer l : baseLayers)
|
||||
if (l.isVisible())
|
||||
return mappingLayersToLayerItems.get(l);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void zoomOut() {
|
||||
int z = map.getZoom();
|
||||
Constants.log("ACTUAL:" + z);
|
||||
map.zoomTo(z-1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void removeDataFeature() {
|
||||
if (prevVf!=null) {
|
||||
vectorLayer.removeFeature(prevVf);
|
||||
prevVf = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.MenuEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Html;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
|
||||
|
||||
public class ToolBarPanel extends ToolBar {
|
||||
|
||||
private OpenLayersMap om;
|
||||
|
||||
private HorizontalPanel transectPanel = new HorizontalPanel();
|
||||
private Label labelTransect = new Label("Draw a line for a transect on the layer ");
|
||||
|
||||
private ToolbarHandler toolBarHandler;
|
||||
private LayerItem layerItemTransect;
|
||||
|
||||
private Button maxExtentButton = new Button();
|
||||
private ToggleButton panToggle = new ToggleButton();
|
||||
private ToggleButton zoomInToggle = new ToggleButton();
|
||||
private Button zoomOutButton = new Button();
|
||||
private ToggleButton clickDataToggle = new ToggleButton();
|
||||
private ToggleButton boxDataToggle = new ToggleButton();
|
||||
private Button removeDataButton = new Button();
|
||||
private Button exportButton;
|
||||
private Button saveMapImageButton;
|
||||
|
||||
private final static String TOGGLE_GROUP = "toggleGroup";
|
||||
|
||||
private static final String BOX_DATA_TOOLTIP = "Data box selection";
|
||||
private static final String CLICK_DATA_TOOLTIP = "Data point selection";
|
||||
private static final String PAN_TOOLTIP = "Pan";
|
||||
private static final String ZOOM_IN_TOOLTIP = "Zoom in";
|
||||
private static final String ZOOM_OUT_TOOLTIP = "Zoom out";
|
||||
private static final String MAX_EXTENT_TOOLTIP = "Zoom to max extent";
|
||||
private static final String REMOVE_DATA_TOOLTIP = "Remove spatial query selection";
|
||||
private static final String EXPORT_TOOLTIP = "Export a map snapshot";
|
||||
private static final String SAVE_TOOLTIP = "Save a map snapshot into the Workspace";
|
||||
|
||||
private enum TOGGLES {PAN, ZOOMIN, CLICKDATA, BOXDATA};
|
||||
|
||||
private static final String[][] FORMATS = {
|
||||
{"GIF", "image/gif"},
|
||||
{"JPEG", "image/jpeg"},
|
||||
{"PNG", "image/png"},
|
||||
};
|
||||
private static final AbstractImagePrototype[] FORMAT_IMAGES = {
|
||||
Images.iconGif(),
|
||||
Images.iconJpeg(),
|
||||
Images.iconPng(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
public ToolBarPanel(ToolbarHandler toolbarHandler, OpenLayersMap om) {
|
||||
super();
|
||||
this.om = om;
|
||||
this.toolBarHandler = toolbarHandler;
|
||||
|
||||
setmaxExtentButton();
|
||||
setPanToggle();
|
||||
setZoomInToggle();
|
||||
setZoomOutButton();
|
||||
setClickDataToggle();
|
||||
setBoxDataToggle();
|
||||
setRemoveDataButton();
|
||||
setOpenBrowserMapImageBox();
|
||||
|
||||
this.getAriaSupport().setLabel("Openlayers Toolbar");
|
||||
this.add(maxExtentButton);
|
||||
this.add(panToggle);
|
||||
this.add(zoomInToggle);
|
||||
//this.add(zoomOutButton);
|
||||
this.add(clickDataToggle);
|
||||
this.add(boxDataToggle);
|
||||
this.add(removeDataButton);
|
||||
this.add(new SeparatorMenuItem());
|
||||
|
||||
addProjectionBox();
|
||||
addTransectBox();
|
||||
this.add(exportButton);
|
||||
|
||||
if (toolbarHandler.isSaveSupported()) {
|
||||
setSaveMapImageBox();
|
||||
this.add(saveMapImageButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void setOpenBrowserMapImageBox() {
|
||||
// layer export
|
||||
exportButton = new Button("", Images.iconExport());
|
||||
exportButton.setToolTip(EXPORT_TOOLTIP);
|
||||
Menu menuExport = new Menu();
|
||||
menuExport.setStyleName("gisViewerMenu");
|
||||
int i=0;
|
||||
for (final String[] saveItem : FORMATS) {
|
||||
menuExport.add(new MenuItem(saveItem[0], FORMAT_IMAGES[i++], new SelectionListener<MenuEvent>(){
|
||||
@Override
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
toolBarHandler.openBrowserMapImage(saveItem[1], true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
exportButton.setMenu(menuExport);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void setSaveMapImageBox() {
|
||||
// layer export
|
||||
saveMapImageButton = new Button("", Images.iconSave());
|
||||
saveMapImageButton.setToolTip(SAVE_TOOLTIP);
|
||||
Menu menuExport = new Menu();
|
||||
menuExport.setStyleName("gisViewerMenu");
|
||||
int i=0;
|
||||
for (final String[] saveItem : FORMATS) {
|
||||
menuExport.add(new MenuItem(saveItem[0], FORMAT_IMAGES[i++], new SelectionListener<MenuEvent>(){
|
||||
@Override
|
||||
public void componentSelected(MenuEvent ce) {
|
||||
toolBarHandler.saveMapImage(saveItem[1], true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
saveMapImageButton.setMenu(menuExport);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void addTransectBox() {
|
||||
labelTransect.setStyleName("vertical_middle");
|
||||
|
||||
transectPanel.setBorders(true);
|
||||
transectPanel.add(labelTransect);
|
||||
|
||||
transectPanel.setStyleName("geo-panel-body");
|
||||
add(new Html(" "));
|
||||
|
||||
transectPanel.setVisible(false);
|
||||
|
||||
add(transectPanel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param button
|
||||
* @param boxDataTooltip
|
||||
* @param abstractImagePrototype
|
||||
*/
|
||||
private void setUpBotton(Button button, AbstractImagePrototype img, String toolTip) {
|
||||
button.setIcon(img);
|
||||
// button.addStyleName("iconOpenlayersToolbar");
|
||||
button.setToolTip(toolTip);
|
||||
// button.setSize(25, 25);
|
||||
}
|
||||
|
||||
|
||||
private void setBoxDataToggle() {
|
||||
setUpBotton(boxDataToggle, Images.iconBoxData(), BOX_DATA_TOOLTIP);
|
||||
boxDataToggle.setToggleGroup(TOGGLE_GROUP);
|
||||
boxDataToggle.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent be) {
|
||||
boolean isPressed = ((ToggleButton)be.getButton()).isPressed();
|
||||
togglePressed(isPressed, TOGGLES.BOXDATA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void setZoomInToggle() {
|
||||
zoomInToggle = new ToggleButton();
|
||||
zoomInToggle.setIcon(Images.iconZoomIn());
|
||||
zoomInToggle.setToolTip(ZOOM_IN_TOOLTIP);
|
||||
//TODO
|
||||
//zoomInToggle.setToggleGroup(TOGGLE_GROUP);
|
||||
zoomInToggle.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent be) {
|
||||
boolean isPressed = ((ToggleButton)be.getButton()).isPressed();
|
||||
togglePressed(isPressed, TOGGLES.ZOOMIN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setClickDataToggle() {
|
||||
setUpBotton(clickDataToggle, Images.iconClickData(), CLICK_DATA_TOOLTIP);
|
||||
clickDataToggle.setToggleGroup(TOGGLE_GROUP);
|
||||
clickDataToggle.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent be) {
|
||||
boolean isPressed = ((ToggleButton)be.getButton()).isPressed();
|
||||
togglePressed(isPressed, TOGGLES.CLICKDATA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPanToggle() {
|
||||
setUpBotton(panToggle, Images.iconPan(), PAN_TOOLTIP);
|
||||
panToggle.toggle(true);
|
||||
panToggle.setToggleGroup(TOGGLE_GROUP);
|
||||
panToggle.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent be) {
|
||||
boolean isPressed = ((ToggleButton)be.getButton()).isPressed();
|
||||
togglePressed(isPressed, TOGGLES.PAN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setZoomOutButton() {
|
||||
setUpBotton(zoomOutButton, Images.iconZoomOut(), ZOOM_OUT_TOOLTIP);
|
||||
zoomOutButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
om.zoomOut();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setmaxExtentButton() {
|
||||
setUpBotton(maxExtentButton, Images.iconMaxExtent(), MAX_EXTENT_TOOLTIP);
|
||||
maxExtentButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
om.zoomToMaxExtent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void setRemoveDataButton() {
|
||||
setUpBotton(removeDataButton, Images.iconToolbarRemove(), REMOVE_DATA_TOOLTIP);
|
||||
removeDataButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
om.removeDataFeature();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void togglePressed(boolean isPressed, TOGGLES toggleType) {
|
||||
if (!isPressed) {
|
||||
panToggle.toggle(true);
|
||||
if (toggleType!=TOGGLES.PAN)
|
||||
togglePressed(true, TOGGLES.PAN);
|
||||
} else {
|
||||
om.activateClickData(toggleType==TOGGLES.CLICKDATA);
|
||||
om.activateDrawBoxControl(toggleType==TOGGLES.BOXDATA);
|
||||
om.activateZoomIn(toggleType==TOGGLES.ZOOMIN);
|
||||
om.activatePan(toggleType==TOGGLES.PAN);
|
||||
toolBarHandler.deactivateTransect(layerItemTransect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param layerItem
|
||||
* @param b
|
||||
*/
|
||||
public void setTransectPanelVisible(LayerItem layerItem, boolean visible) {
|
||||
if (visible)
|
||||
this.labelTransect.setText("Draw a transect line for the layer "+layerItem.getName());
|
||||
else
|
||||
om.activateTransectDraw(false);
|
||||
this.transectPanel.setVisible(visible);
|
||||
this.layerItemTransect = layerItem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setAllUp() {
|
||||
om.activateClickData(false);
|
||||
om.activateDrawBoxControl(false);
|
||||
om.activateZoomIn(false);
|
||||
om.activatePan(false);
|
||||
}
|
||||
|
||||
private void addProjectionBox(){
|
||||
// TODO
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
|
||||
public interface ToolbarHandler {
|
||||
public void openBrowserMapImage(String outputFormat, boolean isWMS);
|
||||
public void saveMapImage(String outputFormat, boolean isWMS);
|
||||
public boolean isSaveSupported();
|
||||
public void deactivateTransect(LayerItem layerItemTransect);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.openlayers;
|
||||
|
||||
public class Util {
|
||||
public static native String getFormattedLonLat(double coordinate, String axis, String dmsOption)/*-{
|
||||
return $wnd.OpenLayers.Util.getFormattedLonLat(coordinate, axis, dmsOption);
|
||||
}-*/;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers.googlev3;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
import org.gwtopenmaps.openlayers.client.LonLat;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Layer;
|
||||
import org.gwtopenmaps.openlayers.client.util.JSObject;
|
||||
|
||||
/**
|
||||
* A layer to show a Google map using the <a href=
|
||||
* "http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/"
|
||||
* >Google Maps JavaScript API V3</a>.
|
||||
*
|
||||
* Tested with Google API loading from
|
||||
* <code><script src="http://maps.google.com/maps/api/js?gwt=1&v=3.6&sensor=false"></script></code>
|
||||
*
|
||||
* @author Max Gensthaler
|
||||
*/
|
||||
public class GoogleV3 extends Layer {
|
||||
// In OpenLayers this class inherits from both EventPane and FixedZoomLevels
|
||||
|
||||
protected GoogleV3(JSObject element) {
|
||||
super(element);
|
||||
}
|
||||
|
||||
public GoogleV3 narrowToGoogle(JSObject google) {
|
||||
return (google == null) ? null : new GoogleV3(google);
|
||||
}
|
||||
|
||||
public GoogleV3(String name) {
|
||||
this(GoogleV3Impl.create(name));
|
||||
}
|
||||
|
||||
public GoogleV3(String name, GoogleV3Options options) {
|
||||
this(GoogleV3Impl.create(name, options.getJSObject()));
|
||||
}
|
||||
|
||||
public LonLat forwardMercator(double lon, double lat) {
|
||||
return LonLat.narrowToLonLat(GoogleV3Impl.forwardMercator(getJSObject(), lon, lat));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers.googlev3;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
import org.gwtopenmaps.openlayers.client.util.JSObject;
|
||||
|
||||
/**
|
||||
* @author Erdem Gunay
|
||||
* @author Aaron Novstrup - Stottler Henke Associates, Inc.
|
||||
*/
|
||||
class GoogleV3Impl {
|
||||
public static native JSObject create(String name)/*-{
|
||||
return new $wnd.OpenLayers.Layer.Google(name);
|
||||
}-*/;
|
||||
|
||||
public static native JSObject create(String name, JSObject options)/*-{
|
||||
return new $wnd.OpenLayers.Layer.Google(name, options);
|
||||
}-*/;
|
||||
|
||||
public static native JSObject forwardMercator(JSObject google, double lon, double lat)/*-{
|
||||
return google.forwardMercator(lon, lat);
|
||||
}-*/;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers.googlev3;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public enum GoogleV3MapType {
|
||||
/** This map type shows Google Earth satellite images. */
|
||||
G_SATELLITE_MAP(GoogleV3MapTypeImpl.G_SATELLITE_MAP()),
|
||||
/** Normal street map type. */
|
||||
G_NORMAL_MAP(GoogleV3MapTypeImpl.G_NORMAL_MAP()),
|
||||
/** This map type transposes street maps and labels over satellite images. */
|
||||
G_HYBRID_MAP(GoogleV3MapTypeImpl.G_HYBRID_MAP()),
|
||||
/** A terrain map type. */
|
||||
G_TERRAIN_MAP(GoogleV3MapTypeImpl.G_TERRAIN_MAP());
|
||||
|
||||
private final String type;
|
||||
|
||||
private GoogleV3MapType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public String getNativeType() {
|
||||
return type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers.googlev3;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
class GoogleV3MapTypeImpl {
|
||||
/** This is the normal street map type. */
|
||||
native static public String G_NORMAL_MAP()/*-{
|
||||
if ($wnd.google.maps.MapTypeId.RADMAP) return $wnd.google.maps.MapTypeId.RADMAP;
|
||||
else return null;
|
||||
}-*/;
|
||||
|
||||
/** This map type shows Google Earth satellite images. */
|
||||
native static public String G_SATELLITE_MAP()/*-{
|
||||
if ($wnd.google.maps.MapTypeId.SATELLITE) return $wnd.google.maps.MapTypeId.SATELLITE;
|
||||
else return null;
|
||||
}-*/;
|
||||
|
||||
/** This map type shows transparent street maps over Google Earth satellite images. */
|
||||
native static public String G_HYBRID_MAP()/*-{
|
||||
if ($wnd.google.maps.MapTypeId.HYBRID) return $wnd.google.maps.MapTypeId.HYBRID;
|
||||
else return null;
|
||||
}-*/;
|
||||
|
||||
/** This map type shows transparent street maps over Google Earth satellite images. */
|
||||
native static public String G_TERRAIN_MAP()/*-{
|
||||
if ($wnd.google.maps.MapTypeId.TERRAIN) return $wnd.google.maps.MapTypeId.TERRAIN;
|
||||
else return null;
|
||||
}-*/;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.gisviewer.client.openlayers.googlev3;
|
||||
|
||||
import org.gwtopenmaps.openlayers.client.layer.EventPaneOptions;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
*/
|
||||
public class GoogleV3Options extends EventPaneOptions {
|
||||
public void setType(GoogleV3MapType type) {
|
||||
getJSObject().setProperty("type", type.getNativeType());
|
||||
}
|
||||
|
||||
public void setSphericalMercator(boolean value) {
|
||||
getJSObject().setProperty("sphericalMercator", value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.resources;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.GisViewer;
|
||||
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
public class Images {
|
||||
|
||||
public static AbstractImagePrototype iconAtompub() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconAtompub());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconGeorss() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconGeorss());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconGif() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconGif());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconJpeg() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconJpeg());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconKml() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconKml());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconPdf() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconPdf());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconPng() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconPng());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconSvg() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconSvg());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconTiff() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconTiff());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconExport() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconExport());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconFilter() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconFilter());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconTable() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconTable());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconRefresh() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconRefresh());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconTransect() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconTransect());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconLegend() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconLegend());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconSave() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconSave());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconExecuteQuery() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconArrowBlueRight());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconRemoveCqlFilter() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconRemoveCqlFilter());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconToolbarRemove() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconToolbarRemove());
|
||||
}
|
||||
|
||||
|
||||
public static AbstractImagePrototype iconMaxExtent() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconMaxExtent());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconZoomIn() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconZoomIn());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconZoomOut() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconZoomOut());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconPan() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconPan());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconClickData() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconClickData());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype iconBoxData() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.iconBoxData());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.resources;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.GisViewer;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
public interface Resources extends ClientBundle {
|
||||
|
||||
@Source("atompub.png")
|
||||
ImageResource iconAtompub();
|
||||
|
||||
@Source("georss.gif")
|
||||
ImageResource iconGeorss();
|
||||
|
||||
@Source("gif.gif")
|
||||
ImageResource iconGif();
|
||||
|
||||
@Source("jpeg.gif")
|
||||
ImageResource iconJpeg();
|
||||
|
||||
@Source("kml.png")
|
||||
ImageResource iconKml();
|
||||
|
||||
@Source("pdf.gif")
|
||||
ImageResource iconPdf();
|
||||
|
||||
@Source("png.gif")
|
||||
ImageResource iconPng();
|
||||
|
||||
@Source("svg.png")
|
||||
ImageResource iconSvg();
|
||||
|
||||
@Source("tiff.gif")
|
||||
ImageResource iconTiff();
|
||||
|
||||
@Source("export.gif")
|
||||
ImageResource iconExport();
|
||||
|
||||
@Source("filter.gif")
|
||||
ImageResource iconFilter();
|
||||
|
||||
@Source("table_ico.gif")
|
||||
ImageResource iconTable();
|
||||
|
||||
@Source("refresh_ico.gif")
|
||||
ImageResource iconRefresh();
|
||||
|
||||
@Source("wave.png")
|
||||
ImageResource iconTransect();
|
||||
|
||||
@Source("legend.png")
|
||||
ImageResource iconLegend();
|
||||
|
||||
@Source("triangle-right.png")
|
||||
ImageResource iconTriangleRight();
|
||||
|
||||
@Source("triangle-down.png")
|
||||
ImageResource iconTriangleDown();
|
||||
|
||||
@Source("saveLayer.png")
|
||||
ImageResource iconSave();
|
||||
|
||||
@Source("arrowBlueRight.png")
|
||||
ImageResource iconArrowBlueRight();
|
||||
|
||||
@Source("remove.png")
|
||||
ImageResource iconRemoveCqlFilter();
|
||||
|
||||
@Source("cancel_icon.png")
|
||||
ImageResource iconToolbarRemove();
|
||||
|
||||
@Source("cqlFilterTip.png")
|
||||
ImageResource iconCqlTip();
|
||||
|
||||
@Source("cqlFilterTipDelete.png")
|
||||
ImageResource iconCqlTipDelete();
|
||||
|
||||
@Source("transectTip.png")
|
||||
ImageResource iconTransectTip();
|
||||
|
||||
@Source("transectTipDelete.png")
|
||||
ImageResource iconTransectTipDelete();
|
||||
|
||||
@Source("close.png")
|
||||
ImageResource iconCloseLayer();
|
||||
|
||||
@Source("closeOver.png")
|
||||
ImageResource iconCloseLayerOver();
|
||||
|
||||
|
||||
@Source("icon_zoomfull2.png")
|
||||
ImageResource iconMaxExtent();
|
||||
|
||||
@Source("zoom_in.png")
|
||||
ImageResource iconZoomIn();
|
||||
|
||||
@Source("zoom_out.png")
|
||||
ImageResource iconZoomOut();
|
||||
|
||||
@Source("hand.png")
|
||||
ImageResource iconPan();
|
||||
|
||||
@Source("info_icon.gif")
|
||||
ImageResource iconClickData();
|
||||
|
||||
@Source("selection.gif")
|
||||
ImageResource iconBoxData();
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 410 B |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 416 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 630 B |
After Width: | Height: | Size: 650 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 949 B |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 185 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 947 B |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 575 B |
After Width: | Height: | Size: 620 B |
After Width: | Height: | Size: 91 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 129 B |