Revision 9089

View differences:

org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.filteredheatmap</artifactId>
5
  <version>1.0.145</version>
6
  <packaging>pom</packaging>
7
  <name>${project.artifactId}</name>
8
  <description>Legend for filtered heat maps.</description>
9
  <parent>
10
    <groupId>org.gvsig</groupId>
11
    <artifactId>org.gvsig.desktop</artifactId>
12
    <version>2.0.436</version>
13
  </parent>
14
  <url>https://devel.gvsig.org/sites/org.gvsig.legend.filteredheatmap/${project.version}</url>
15
  <scm>
16
    <connection>scm:svn:http://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145</connection>
17
    <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145</developerConnection>
18
    <url>https://devel.gvsig.org/redmine/projects/gvsig-projects-pool/repository/show/org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145</url>
19
  </scm>
20
  <repositories>
21
    <repository>
22
      <id>gvsig-public-http-repository</id>
23
      <name>gvSIG maven public HTTP repository</name>
24
      <url>http://devel.gvsig.org/m2repo/j2se</url>
25
      <releases>
26
        <enabled>true</enabled>
27
        <updatePolicy>daily</updatePolicy>
28
        <checksumPolicy>warn</checksumPolicy>
29
      </releases>
30
      <snapshots>
31
        <enabled>true</enabled>
32
        <updatePolicy>daily</updatePolicy>
33
        <checksumPolicy>warn</checksumPolicy>
34
      </snapshots>
35
    </repository>
36
  </repositories>
37

  
38
  <distributionManagement>
39
    <site>
40
      <id>gvsig-repository</id>
41
      <url>dav:https://devel.gvsig.org/download/projects/gvsig-projects-pool/pool/${project.artifactId}/${project.version}</url>
42
    </site>
43
  </distributionManagement>
44

  
45
  <build>
46
    <plugins>
47
      <plugin>
48
        <groupId>org.apache.maven.plugins</groupId>
49
        <artifactId>maven-release-plugin</artifactId>
50
        <configuration>
51
          <tagBase>https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.legend.filteredheatmap/tags</tagBase>
52
        </configuration>
53
      </plugin>
54
    </plugins>
55
  </build>
56

  
57

  
58

  
59
  <dependencyManagement>
60
    <dependencies>
61
      <dependency>
62
        <groupId>org.gvsig</groupId>
63
        <artifactId>org.gvsig.legend.filteredheatmap.lib.api</artifactId>
64
        <version>1.0.145</version>
65
      </dependency>
66
      <dependency>
67
        <groupId>org.gvsig</groupId>
68
        <artifactId>org.gvsig.legend.filteredheatmap.lib.impl</artifactId>
69
        <version>1.0.145</version>
70
      </dependency>
71
      <dependency>
72
        <groupId>org.gvsig</groupId>
73
        <artifactId>org.gvsig.legend.filteredheatmap.swing.api</artifactId>
74
        <version>1.0.145</version>
75
      </dependency>
76
      <dependency>
77
        <groupId>org.gvsig</groupId>
78
        <artifactId>org.gvsig.legend.filteredheatmap.swing.impl</artifactId>
79
        <version>1.0.145</version>
80
      </dependency>
81
      <dependency>
82
        <groupId>org.gvsig</groupId>
83
        <artifactId>org.gvsig.legend.filteredheatmap.app.mainplugin</artifactId>
84
        <version>1.0.145</version>
85
      </dependency>
86
    </dependencies>
87
  </dependencyManagement>
88
  <modules>
89
    <module>org.gvsig.legend.filteredheatmap.lib</module>
90
    <module>org.gvsig.legend.filteredheatmap.swing</module>
91
    <module>org.gvsig.legend.filteredheatmap.app</module>
92
  </modules>
93
</project>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.filteredheatmap</artifactId>
6
    <version>1.0.145</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.filteredheatmap.app</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.legend.filteredheatmap.app</name>
12

  
13
  <modules>
14
    <module>org.gvsig.legend.filteredheatmap.app.mainplugin</module>
15
  </modules>
16

  
17
</project>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/buildNumber.properties
1
#Thu Oct 19 15:34:57 CEST 2023
2
buildNumber=149
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/java/org/gvsig/legend/filteredheatmap/app/FilteredHeatmapLegendExtension.java
1

  
2
package org.gvsig.legend.filteredheatmap.app;
3

  
4
import org.gvsig.andami.IconThemeHelper;
5
import org.gvsig.andami.plugins.Extension;
6

  
7

  
8
public class FilteredHeatmapLegendExtension extends Extension {
9

  
10
    @Override
11
    public void initialize() {
12
        IconThemeHelper.registerIcon("legend", "legend-overview-vectorial-filteredheatmap", this);
13
    }
14

  
15
    @Override
16
    public void execute(String string) {
17
    }
18

  
19
    @Override
20
    public boolean isEnabled() {
21
        return true;
22
    }
23

  
24
    @Override
25
    public boolean isVisible() {
26
        return true;
27
    }
28
    
29
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
3
  Association. This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by the Free Software
5
  Foundation; either version 3 of the License, or (at your option) any later version.
6
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
  PURPOSE. See the GNU General Public License for more details. You should have received
9
  a copy of the GNU General Public License along with this program; if not, write to
10
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
11
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
12
  or visit our website www.gvsig.com. -->
13
<plugin-config>
14
  <depends plugin-name="org.gvsig.app.mainplugin" />
15
  <resourceBundle name="text" />
16
  <libraries library-dir="lib" />
17
  <extensions>
18
    <extension class-name="org.gvsig.legend.filteredheatmap.app.FilteredHeatmapLegendExtension"
19
      description="" active="true" priority="1">
20

  
21
    </extension>
22

  
23
  </extensions>
24
</plugin-config>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.filteredheatmap.app.mainplugin
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.legend.filteredheatmap.app.mainplugin">
9
      <extends>
10
      </extends>
11
      <description>Persistence of the legend of aggregate texts</description>
12
      <fields>
13
      </fields>
14
    </class>
15
  </classes>
16
</definitions>  
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
_Filtered_heatmap_legend_description=Mapa de calor con filtrado que representa la densidad de puntos en un mapa.
2
_Filtered_heatmap_legend=Mapa de calor con filtrado
3
_Distance=Distancia
4
pixels=pixels
5
_Use_color_ramp=Usar un gradiente de color
6
_Number_of_colors=Numero de colores
7
_Hot_color=Color caliente
8
Alpha=Alpha
9
_Cold_color=Color frio
10
_Use_color_table=Usar tabla de color
11
_Color_table=Tabla de color
12
_Use_transparency=Usar transparencia
13
_Hot_color_transparency=Transparencia del color caliente
14
_Cold_color_transparency=Transparencia del color frio
15
_Use_a_field_to_weight_the_heat_map=Usar un campo para ponderar el mapa de calor
16
_Filter_values_to_show=Filtrar valores a mostrar
17
_Filter_by_expression=Filtrar por expresi\u00f3n
18
_Kernel_expression=Expresi\u00f3n del Kernel
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
_Filtered_heatmap_legend_description=Filtered heat map for representing the density of dots in a map.
2
_Filtered_heatmap_legend=Filtered heat map
3
_Distance=Distance
4
pixels=pixels
5
_Use_color_ramp=Use a color ramp
6
_Number_of_colors=Number of colors
7
_Hot_color=Hot color
8
Alpha=Alpha
9
_Cold_color=Cold color
10
_Use_color_table=Use a color table
11
_Color_table=Color table
12
_Use_transparency=Use transparencia
13
_Hot_color_transparency=Hot color transparency
14
_Cold_color_transparency=Cold color transparency
15
_Use_a_field_to_weight_the_heat_map=Use a field to weight the heat map
16
_Filter_values_to_show=Filter values to show
17
_Filter_by_expression=Filter by expression
18
_Kernel_expression=Kernel expression
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
2
  Association. This program is free software; you can redistribute it and/or modify
3
  it under the terms of the GNU General Public License as published by the Free Software
4
  Foundation; either version 3 of the License, or (at your option) any later version.
5
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
6
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7
  PURPOSE. See the GNU General Public License for more details. You should have received
8
  a copy of the GNU General Public License along with this program; if not, write to
9
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
10
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
11
  or visit our website www.gvsig.com. -->
12
<assembly>
13
  <id>gvsig-plugin-package</id>
14
  <formats>
15
    <format>zip</format>
16
  </formats>
17
  <baseDirectory>${project.artifactId}</baseDirectory>
18
  <includeBaseDirectory>true</includeBaseDirectory>
19
  <files>
20
    <file>
21
      <source>target/${project.artifactId}-${project.version}.jar</source>
22
      <outputDirectory>lib</outputDirectory>
23
    </file>
24
    <file>
25
      <source>target/package.info</source>
26
    </file>
27
  </files>
28

  
29
  <fileSets>
30
    <fileSet>
31
      <directory>src/main/resources-plugin</directory>
32
      <outputDirectory>.</outputDirectory>
33
    </fileSet>
34
  </fileSets>
35

  
36

  
37
  <dependencySets>
38
    <dependencySet>
39
      <useProjectArtifact>false</useProjectArtifact>
40
      <useTransitiveDependencies>false</useTransitiveDependencies>
41
      <outputDirectory>lib</outputDirectory>
42
      <includes>
43
        <include>org.gvsig:org.gvsig.legend.filteredheatmap.lib.api</include>
44
        <include>org.gvsig:org.gvsig.legend.filteredheatmap.lib.impl</include>
45
        <include>org.gvsig:org.gvsig.legend.filteredheatmap.swing.api</include>
46
        <include>org.gvsig:org.gvsig.legend.filteredheatmap.swing.impl</include>
47
      </includes>
48
    </dependencySet>
49
  </dependencySets>
50

  
51
</assembly>
52

  
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.app/org.gvsig.legend.filteredheatmap.app.mainplugin/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.filteredheatmap.app</artifactId>
6
    <version>1.0.145</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.filteredheatmap.app.mainplugin</artifactId>
10
  <version>1.0.145</version>
11
  <name>org.gvsig.legend.filteredheatmap.app.mainplugin</name>
12

  
13
    <properties>
14
    <!-- Package info property values -->
15
    <gvsig.package.info.state>testing</gvsig.package.info.state>
16
    <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.4.0-A</gvsig.package.info.dependencies>
17
    <gvsig.package.info.official>true</gvsig.package.info.official>
18
    <gvsig.package.info.name>Vector legend: filtered heat map</gvsig.package.info.name>
19
    <gvsig.package.info.description>Legend for aggregate text symbols that are near.</gvsig.package.info.description>
20
    <gvsig.package.info.categories>View,Vector,Symbology</gvsig.package.info.categories>
21
    <gvsig.package.info.javaVM>j1_7</gvsig.package.info.javaVM>
22
    <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-base-legends/pool</gvsig.package.info.poolURL>
23
  </properties>
24

  
25
  <dependencies>
26
    <dependency>
27
      <groupId>org.gvsig</groupId>
28
      <artifactId>org.gvsig.andami</artifactId>
29
      <scope>compile</scope>
30
    </dependency>
31
    <dependency>
32
      <groupId>org.gvsig</groupId>
33
      <artifactId>org.gvsig.legend.filteredheatmap.swing.api</artifactId>
34
      <scope>compile</scope>
35
    </dependency>
36
    <dependency>
37
      <groupId>org.gvsig</groupId>
38
      <artifactId>org.gvsig.legend.filteredheatmap.lib.api</artifactId>
39
      <scope>compile</scope>
40
    </dependency>
41
    <dependency>
42
      <groupId>org.gvsig</groupId>
43
      <artifactId>org.gvsig.legend.filteredheatmap.lib.impl</artifactId>
44
      <scope>runtime</scope>
45
    </dependency>
46
    <dependency>
47
      <groupId>org.gvsig</groupId>
48
      <artifactId>org.gvsig.legend.filteredheatmap.swing.impl</artifactId>
49
      <scope>runtime</scope>
50
    </dependency>
51
    <dependency>
52
      <groupId>org.gvsig</groupId>
53
      <artifactId>org.gvsig.app.mainplugin</artifactId>
54
      <scope>compile</scope>
55
    </dependency>
56
  </dependencies>
57
</project>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.filteredheatmap</artifactId>
6
    <version>1.0.145</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.filteredheatmap.lib</artifactId>
10
  <packaging>pom</packaging>
11
  <modules>
12
    <module>org.gvsig.legend.filteredheatmap.lib.api</module>
13
    <module>org.gvsig.legend.filteredheatmap.lib.impl</module>
14
  </modules>
15
</project>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.filteredheatmap.lib.api.FilteredHeatmapLegendLibrary
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/java/org/gvsig/legend/filteredheatmap/lib/api/FilteredHeatmapLegendLocator.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.filteredheatmap.lib.api;
24

  
25
import org.gvsig.expressionevaluator.SymbolTable;
26
import org.gvsig.tools.locator.AbstractLocator;
27
import org.gvsig.tools.locator.Locator;
28
import org.gvsig.tools.locator.LocatorException;
29

  
30

  
31
public class FilteredHeatmapLegendLocator extends AbstractLocator {
32

  
33
    /**
34
     * FilteredHeatmapLegend locator name
35
     */
36
    private static final String LOCATOR_NAME = "FilteredHeatmapLegendLocator";
37

  
38
    /**
39
     * HeatmapLegend manager name
40
     */
41
    public static final String MANAGER_NAME = "FilteredHeatmapLegendManager";
42

  
43
    /**
44
     * HeatmapLegend manager description
45
     */
46
    private static final String MANAGER_DESCRIPTION =
47
        "FilteredHeatmapLegend Manager of gvSIG";
48

  
49

  
50
    /**
51
     * Unique instance
52
     */
53
    private static final FilteredHeatmapLegendLocator instance = new FilteredHeatmapLegendLocator();
54

  
55
    @Override
56
    public String getLocatorName() {
57
        return LOCATOR_NAME;
58
    }
59

  
60
    /**
61
     * Registers the Class implementing the FilteredHeatmapLegendManager interface.
62
     *
63
     * @param clazz
64
     *            implementing the FilteredHeatmapLegendManager interface
65
     */
66
    public static void registerFilteredHeatmapLegendManager(Class clazz){
67
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
68
    }
69

  
70
    /**
71
     * Registers the default Class implementing the FilteredHeatmapLegendManager interface
72
     *
73
     * @param clazz
74
     *            implementing the FilteredHeatmapLegendManager interface
75
     */
76
    public static void registerDefaultFilteredHeatmapLegendManager(Class clazz){
77
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
78
    }
79

  
80
    /**
81
     * Return a reference to FilteredHeatmapLegendManager.
82
     *
83
     * @return a reference to HeatmapLegendManager
84
     * @throws LocatorException
85
     *             if there is no access to the class or the class
86
     *             cannot be instantiated
87
     * @see Locator#get(String)
88
     */
89
    public static FilteredHeatmapLegendManager getFilteredHeatmapLegendManager() throws LocatorException {
90
        return (FilteredHeatmapLegendManager) getInstance().get(MANAGER_NAME);
91
    }
92

  
93
    /**
94
     * @return
95
     */
96
    public static Locator getInstance() {
97
        return instance;
98
    }
99

  
100
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/java/org/gvsig/legend/filteredheatmap/lib/api/FilteredHeatmapLegendLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.filteredheatmap.lib.api;
24

  
25
import org.gvsig.fmap.mapcontext.MapContextLocator;
26
import org.gvsig.fmap.mapcontext.MapContextManager;
27
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
28
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
29
import org.gvsig.symbology.SymbologyLocator;
30
import org.gvsig.symbology.SymbologyManager;
31
import org.gvsig.tools.library.AbstractLibrary;
32
import org.gvsig.tools.library.LibraryException;
33
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
34

  
35

  
36
public class FilteredHeatmapLegendLibrary extends AbstractLibrary {
37

  
38
    @Override
39
    protected void doInitialize() throws LibraryException {
40
        registerAsAPI(FilteredHeatmapLegendLibrary.class);
41
    }
42

  
43
    @Override
44
    protected void doPostInitialize() throws LibraryException {
45
        // Validate there is any implementation registered.
46
        FilteredHeatmapLegendManager manager = FilteredHeatmapLegendLocator.getFilteredHeatmapLegendManager();
47
        if (manager == null) {
48
            throw new ReferenceNotRegisteredException(
49
                FilteredHeatmapLegendLocator.MANAGER_NAME, FilteredHeatmapLegendLocator.getInstance());
50
        }
51

  
52
        SymbologyManager symbolManager = SymbologyLocator.getSymbologyManager();
53
        ILegendWriter legendWriter = symbolManager.getDefaultLegendWriter();
54

  
55
        MapContextManager mcoman = MapContextLocator.getMapContextManager();
56
        mcoman.registerLegendWriter(
57
            FilteredHeatmapLegend.class,
58
            SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
59
            legendWriter.getClass());
60
    }
61

  
62
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/java/org/gvsig/legend/filteredheatmap/lib/api/KernelExpressionAlgorithm.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.legend.filteredheatmap.lib.api;
7

  
8
import java.awt.Color;
9
import java.awt.Graphics2D;
10
import java.awt.image.BufferedImage;
11
import org.gvsig.expressionevaluator.Expression;
12
import org.gvsig.fmap.geom.Geometry;
13
import org.gvsig.tools.task.Cancellable;
14

  
15
/**
16
 *
17
 * @author osc
18
 */
19
public interface KernelExpressionAlgorithm {
20

  
21
    public void setDistance(int distance);
22

  
23
    public int getDistance();
24

  
25
    public void init(int with, int height);
26

  
27
    public void add(int px, int py);
28

  
29
    public void add(int px, int py, double value);
30

  
31
    public void drawWithOpaqueColors(BufferedImage img, Graphics2D g, Color[] colorTable, Cancellable cancel, Geometry roi, int limitProportionToDraw);
32

  
33
    public void drawWithAlphaColors(BufferedImage img, Graphics2D g, Color[] colorTable, Cancellable cancel, Geometry roi, int limitProportion);
34

  
35
    public Expression getKernelExpression();
36

  
37
    public void setKernelExpression(Expression kernelExpression);
38
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/java/org/gvsig/legend/filteredheatmap/lib/api/FilteredHeatmapLegendManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 3
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.filteredheatmap.lib.api;
24

  
25
import org.gvsig.expressionevaluator.SymbolTable;
26

  
27

  
28
public interface FilteredHeatmapLegendManager {
29

  
30
    /**
31
     * Creates an aggregate legend
32
     *
33
     * @return the aggregate legend
34
     */
35
    public FilteredHeatmapLegend create();
36

  
37
    public Class<? extends FilteredHeatmapLegend> getLegendClass(); 
38
    
39
    public SymbolTable createKernelSymbolTable(KernelExpressionAlgorithm alg, int x, int y);
40
    
41
    public KernelExpressionAlgorithm createKernelExpressionAlgorithm(int distance);
42
    
43
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/src/main/java/org/gvsig/legend/filteredheatmap/lib/api/FilteredHeatmapLegend.java
1
package org.gvsig.legend.filteredheatmap.lib.api;
2

  
3
import java.awt.Color;
4
import org.gvsig.expressionevaluator.Expression;
5
import org.gvsig.fmap.geom.Geometry;
6
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
7

  
8
public interface FilteredHeatmapLegend extends IVectorLegend {
9

  
10
    public int getDistance();
11

  
12
    public void setDistance(int distance);
13

  
14
    public void setColorTable(Color[] colorTable);
15

  
16
    public void setColorTable(int numColors, Color coldColor, Color hotColor);
17

  
18
    public Color[] getSourceColorTable();
19

  
20
    public Color[] getTargetColorTable();
21
    
22
    public Geometry getROI();
23
    
24
    public void setROI(Geometry roi);
25

  
26
    public boolean useRamp();
27

  
28
    public String getFieldName();
29

  
30
    public void setFieldName(String fieldName);
31

  
32
    public int getColorTableHotColorAlpha();
33

  
34
    public void setColorTableHotColorAlpha(int colorTableHotColorAlpha);
35

  
36
    public int getColorTableColdColorAlpha();
37

  
38
    public void setColorTableColdColorAlpha(int colorTableColdColorAlpha);
39

  
40
    public boolean useAlphaInColorTable();
41

  
42
    public boolean setUseAlphaInColorTable(boolean use);
43

  
44
    public int getRampNumColors();
45

  
46
    public Color getRampColdColor();
47

  
48
    public Color getRampHotColor();
49
    
50
    public int getFilterProportionValue();
51
    public void setFilterProportionValue(int proportionValue);
52
    
53
    public Expression getFilterByExpression();
54
    public void setFilterByExpression(Expression filterExpression);
55
    
56
    public boolean getUseFilterByExpression();
57
    public void setUseFilterByExpression(boolean useFilterExpression);
58
    
59
    public Expression getKernelExpression();
60
    public void setKernelExpression(Expression kernelExpression);
61
    
62
    
63

  
64
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.api/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.filteredheatmap.lib.api</artifactId>
5
  <name>org.gvsig.legend.filteredheatmap.lib.api</name>
6
  <parent>
7
    <groupId>org.gvsig</groupId>
8
    <artifactId>org.gvsig.legend.filteredheatmap.lib</artifactId>
9
    <version>1.0.145</version>
10
  </parent>
11

  
12
  <build>
13
    <plugins>
14
      <plugin>
15
        <groupId>org.apache.maven.plugins</groupId>
16
        <artifactId>maven-jar-plugin</artifactId>
17
        <configuration>
18
        </configuration>
19
        <executions>
20
          <!-- Generates a jar file only with the test classes -->
21
          <execution>
22
            <goals>
23
              <goal>test-jar</goal>
24
            </goals>
25
          </execution>
26
        </executions>
27
      </plugin>
28
    </plugins>
29
  </build>
30

  
31
  <dependencies>
32
    <dependency>
33
      <groupId>org.gvsig</groupId>
34
      <artifactId>org.gvsig.tools.lib</artifactId>
35
      <scope>compile</scope>
36
    </dependency>
37
    <dependency>
38
      <groupId>org.gvsig</groupId>
39
      <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
40
      <scope>compile</scope>
41
    </dependency>
42
    <dependency>
43
      <groupId>org.gvsig</groupId>
44
      <artifactId>org.gvsig.symbology.lib.api</artifactId>
45
    </dependency>
46
  </dependencies>
47
</project>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.filteredheatmap.lib.impl.FilteredHeatmapLegendLibraryImpl
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.impl/src/main/resources/org/gvsig/legend/filteredheatmap/lib/impl/DefaultFilteredHeatmapLegend.persistence.xml
1
<?xml version="1.0"?>
2
<definitions>
3
    <version>1.0.0</version>
4
    <classes>
5
        <class name="DefaultFilteredHeatmapLegend">
6
            <extends>
7
                <class>VectorialLegend</class>
8
            </extends>
9
            <fields>
10
                <field name="isRamp" type="boolean" defaultValue="true">
11
                    <description></description>
12
                </field>
13
                <field name="sourceColorTable" type="list" classOfItems="java.awt.Color">
14
                    <description></description>
15
                </field>
16
                <field name="colorTableHotColorAlpha" type="integer" defaultValue="255">
17
                    <description></description>
18
                </field>
19
                <field name="colorTableColdColorAlpha" type="integer" defaultValue="255">
20
                    <description></description>
21
                </field>
22
                <field name="useAlphaInColorTable" type="boolean" defaultValue="false">
23
                    <description></description>
24
                </field>
25
                <field name="distance" type="integer" defaultValue="30">
26
                    <description></description>
27
                </field>
28
                <field name="fieldName" type="String" defaultValue="">
29
                    <description></description>
30
                </field>
31
                <field name="rampColdColor" type="Object" classOfValue="java.awt.Color">
32
                    <description></description>
33
                </field>
34
                <field name="rampHotColor" type="Object" classOfValue="java.awt.Color">
35
                    <description></description>
36
                </field>
37
                <field name="rampNumColors" type="integer" defaultValue="100">
38
                    <description></description>
39
                </field>
40
        
41
                <field name="proportionValue" type="integer" defaultValue="0">
42
                    <description></description>
43
                </field>
44
                <field name="useFilterExpression" type="boolean" defaultValue="false">
45
                    <description></description>
46
                </field>
47
                <field name="filterExpression" type="Object" classOfValue="org.gvsig.expressionevaluator.Expression">
48
                    <description></description>
49
                </field>
50
                <field name="distance" type="integer" defaultValue="30">
51
                    <description></description>
52
                </field>
53
                <field name="kernelExpression" type="Object" classOfValue="org.gvsig.expressionevaluator.Expression">
54
                    <description></description>
55
                </field>
56
            </fields>
57
        </class>
58

  
59
    </classes>
60
</definitions>
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.impl/src/main/java/org/gvsig/legend/filteredheatmap/lib/impl/DefaultFilteredHeatmapLegendManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.filteredheatmap.lib.impl;
24

  
25
import org.gvsig.expressionevaluator.SymbolTable;
26
import org.gvsig.legend.filteredheatmap.lib.api.FilteredHeatmapLegend;
27
import org.gvsig.legend.filteredheatmap.lib.api.FilteredHeatmapLegendManager;
28
import org.gvsig.legend.filteredheatmap.lib.api.KernelExpressionAlgorithm;
29

  
30

  
31
public class DefaultFilteredHeatmapLegendManager implements FilteredHeatmapLegendManager {
32

  
33
    @Override
34
    public FilteredHeatmapLegend create() {
35
        return new DefaultFilteredHeatmapLegend();
36
    }
37

  
38
    @Override
39
    public Class<? extends FilteredHeatmapLegend> getLegendClass() {
40
        return DefaultFilteredHeatmapLegend.class;
41
    }
42
    
43
        
44
    @Override
45
    public SymbolTable createKernelSymbolTable(KernelExpressionAlgorithm alg, int x, int y) {
46
        return new KernelSymbolTable(alg, x, y);
47
    }
48
    
49
    @Override
50
    public KernelExpressionAlgorithm createKernelExpressionAlgorithm(int distance) {
51
        return new DefaultKernelExpressionAlgorithm(distance, null);
52
    }
53

  
54
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.impl/src/main/java/org/gvsig/legend/filteredheatmap/lib/impl/KernelSymbolTable.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.legend.filteredheatmap.lib.impl;
7

  
8
import org.apache.commons.lang3.Range;
9
import org.gvsig.expressionevaluator.Interpreter;
10
import org.gvsig.expressionevaluator.spi.AbstractFunction;
11
import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
12
import org.gvsig.fmap.dal.DataManager;
13
import org.gvsig.legend.filteredheatmap.lib.api.KernelExpressionAlgorithm;
14

  
15
/**
16
 *
17
 * @author osc
18
 */
19
public class KernelSymbolTable extends AbstractSymbolTable {
20

  
21
    private KernelExpressionAlgorithm algorithm;
22
    private int pixely;
23
    private int pixelx;
24
    private double pixeldistance;
25

  
26
    public KernelSymbolTable(KernelExpressionAlgorithm algorithm, int x, int y) {
27
        super(DataManager.DAL_SYMBOL_TABLE);
28
        this.algorithm = algorithm;
29
        this.pixelx = x;
30
        this.pixely = y;
31
        this.pixeldistance = 15;
32
        this.addFunction(new KernelDistanceFunc());
33
        this.addFunction(new PixelDistanceFunc());
34
        this.addFunction(new PixelXFunc());
35
        this.addFunction(new PixelYFunc());
36

  
37
    }
38
    @Override
39
    public KernelSymbolTable clone() throws CloneNotSupportedException {
40
        KernelSymbolTable other = (KernelSymbolTable) super.clone();
41
        return other;
42
    }
43
    
44
    public void setAlgorithm(KernelExpressionAlgorithm algorithm) {
45
        this.algorithm = algorithm;
46
    }
47

  
48
    public void setXY(int x, int y) {
49
        this.pixelx = x;
50
        this.pixely = y;
51
        this.pixeldistance = Math.sqrt(pixelx * pixelx + pixely * pixely);
52
    }
53

  
54
    public class KernelDistanceFunc extends AbstractFunction {
55

  
56
        public KernelDistanceFunc() {
57
            super(
58
                    "Kernel Algorithm",
59
                    "kerneldistance",
60
                    Range.is(0),
61
                    "Return the distance",
62
                    "kerneldistance()",
63
                    null,
64
                    "Integer"
65
            );
66
        }
67

  
68
        @Override
69
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
70
            return algorithm.getDistance();
71
        }
72

  
73
    }
74

  
75
    public class PixelDistanceFunc extends AbstractFunction {
76

  
77
        public PixelDistanceFunc() {
78
            super(
79
                    "Kernel Algorithm",
80
                    "pixeldistance",
81
                    Range.is(0),
82
                    "Return the distance to the pixel",
83
                    "pixeldistance()",
84
                    null,
85
                    "Double"
86
            );
87
        }
88

  
89
        @Override
90
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
91
            return pixeldistance;
92
        }
93

  
94
    }
95

  
96
    public class PixelXFunc extends AbstractFunction {
97

  
98
        public PixelXFunc() {
99
            super(
100
                    "Kernel Algorithm",
101
                    "pixelx",
102
                    Range.is(0),
103
                    "Return the pixel coordinate x",
104
                    "pixelx()",
105
                    null,
106
                    "Double"
107
            );
108
        }
109

  
110
        @Override
111
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
112
            return pixelx;
113
        }
114

  
115
    }
116

  
117
    public class PixelYFunc extends AbstractFunction {
118

  
119
        public PixelYFunc() {
120
            super(
121
                    "Kernel Algorithm",
122
                    "pixely",
123
                    Range.is(0),
124
                    "Return the pixel coordinate y",
125
                    "pixely()",
126
                    null,
127
                    "Double"
128
            );
129
        }
130

  
131
        @Override
132
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
133
            return pixely;
134
        }
135

  
136
    }
137
}
org.gvsig.legend.filteredheatmap/tags/org.gvsig.legend.filteredheatmap-1.0.145/org.gvsig.legend.filteredheatmap.lib/org.gvsig.legend.filteredheatmap.lib.impl/src/main/java/org/gvsig/legend/filteredheatmap/lib/impl/DefaultFilteredHeatmapLegend.java
1
package org.gvsig.legend.filteredheatmap.lib.impl;
2

  
3
import java.awt.Color;
4
import java.awt.Graphics2D;
5
import java.awt.Image;
6
import java.awt.image.BufferedImage;
7
import java.util.ArrayList;
8
import java.util.Map;
9

  
10
import org.apache.commons.lang3.StringUtils;
11
import org.cresques.cts.ICoordTrans;
12
import org.gvsig.compat.print.PrintAttributes;
13
import org.gvsig.expressionevaluator.Expression;
14
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
15
import org.gvsig.expressionevaluator.MutableSymbolTable;
16
import org.gvsig.fmap.dal.DALLocator;
17

  
18
import org.gvsig.fmap.dal.exception.DataException;
19
import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
20
import org.gvsig.fmap.dal.feature.Feature;
21
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
22
import org.gvsig.fmap.dal.feature.FeatureQuery;
23
import org.gvsig.fmap.dal.feature.FeatureSelection;
24
import org.gvsig.fmap.dal.feature.FeatureSet;
25
import org.gvsig.fmap.dal.feature.FeatureStore;
26
import org.gvsig.fmap.dal.feature.FeatureType;
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.fmap.geom.primitive.Point;
29
import org.gvsig.fmap.mapcontext.MapContextException;
30
import org.gvsig.fmap.mapcontext.ViewPort;
31
import org.gvsig.fmap.mapcontext.layers.operations.IHasImageLegend;
32
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
33
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
34
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
35
import org.gvsig.gui.ColorTablePainter;
36
import org.gvsig.gui.DefaultColorTablePainter;
37
import org.gvsig.legend.filteredheatmap.lib.api.FilteredHeatmapLegend;
38
import org.gvsig.legend.filteredheatmap.lib.api.KernelExpressionAlgorithm;
39
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
40
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.DefaultFeatureDrawnNotification;
41
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
42
import org.gvsig.tools.exception.BaseException;
43
import org.gvsig.tools.persistence.PersistentState;
44
import org.gvsig.tools.persistence.exception.PersistenceException;
45
import org.gvsig.tools.task.Cancellable;
46
import org.gvsig.tools.visitor.VisitCanceledException;
47
import org.gvsig.tools.visitor.Visitor;
48

  
49
public class DefaultFilteredHeatmapLegend extends AbstractVectorialLegend implements FilteredHeatmapLegend, IHasImageLegend {
50

  
51
    private ISymbol defaultSymbol;
52
    private KernelExpressionAlgorithm algorithm;
53
    private boolean isRamp;
54
    private Color[] sourceColorTable;
55
    private int colorTableHotColorAlpha;
56
    private int colorTableColdColorAlpha;
57
    private boolean useAlphaInColorTable;
58
    private String fieldName;
59
    private Image imageLegend;
60
    private HeatmapColorTable hmColorTable;
61
    private Color rampColdColor;
62
    private Color rampHotColor;
63
    private int rampNumColors;
64
    private Geometry roi;
65
    private int proportionValue;
66
    private Expression filterExpression;
67
    private boolean useFilterExpression;
68

  
69
    public DefaultFilteredHeatmapLegend() {
70

  
71
        this.defaultSymbol = new SimpleTextSymbol();
72
        Expression kernelPowExp = ExpressionEvaluatorLocator.getExpressionEvaluatorManager().createExpression();
73
        kernelPowExp.setPhrase("power(1-(power(pixeldistance(), 2)/power(kerneldistance(), 2)),2)");
74
        this.algorithm = new DefaultKernelExpressionAlgorithm(30, kernelPowExp);
75
        this.colorTableHotColorAlpha = 255;
76
        this.colorTableColdColorAlpha = 0;
77
        this.useAlphaInColorTable = false;
78
        this.setColorTable(100, new Color(0, 0, 255, 0), new Color(255, 0, 0, 255));
79
        this.imageLegend = null;
80
        this.hmColorTable = null;
81
        this.fieldName = null;
82
        
83
        
84
    }
85

  
86
    @Override
87
    public Expression getKernelExpression() {
88
        return this.algorithm.getKernelExpression();
89
    }
90

  
91
    @Override
92
    public void setKernelExpression(Expression kernelExpression) {
93
        this.algorithm.setKernelExpression(kernelExpression);
94
    }
95

  
96
    @Override
97
    public int getFilterProportionValue() {
98
        return this.proportionValue;
99
    }
100

  
101
    @Override
102
    public void setFilterProportionValue(int proportionValue) {
103
        this.proportionValue = proportionValue;
104
    }
105

  
106
    @Override
107
    public Expression getFilterByExpression() {
108
        return this.filterExpression;
109
    }
110

  
111
    @Override
112
    public void setFilterByExpression(Expression filterExpression) {
113
        this.filterExpression = filterExpression;
114
    }
115

  
116
    @Override
117
    public boolean getUseFilterByExpression() {
118
        return this.useFilterExpression;
119
    }
120

  
121
    @Override
122
    public void setUseFilterByExpression(boolean useFilterExpression) {
123
        this.useFilterExpression = useFilterExpression;
124
    }
125

  
126
    @Override
127
    protected String[] getRequiredFeatureAttributeNames(FeatureStore featureStore) throws DataException {
128
        FeatureType ftype = featureStore.getDefaultFeatureType();
129
//        String[] allAttributes = new String[ftype.getAttributeDescriptors().length];
130
        ArrayList<String> arrayAttributes = new ArrayList<>();
131
        for (FeatureAttributeDescriptor attributeDescriptor : ftype.getAttributeDescriptors()) {
132
            arrayAttributes.add(attributeDescriptor.getName());
133
        }
134
        String[] a = arrayAttributes.toArray(new String[arrayAttributes.size()]);
135
        return a;
136
    }
137

  
138
    @Override
139
    public ISymbol getDefaultSymbol() {
140
        return this.defaultSymbol;
141
    }
142

  
143
    @Override
144
    public void setDefaultSymbol(ISymbol is) {
145
    }
146

  
147
    @Override
148
    public ISymbol getSymbolByFeature(Feature ftr) throws MapContextException {
149
        return this.defaultSymbol;
150
    }
151

  
152
    @Override
153
    public int getShapeType() {
154
        return Geometry.TYPES.GEOMETRY;
155
    }
156

  
157
    @Override
158
    public void setShapeType(int i) {
159
    }
160

  
161
    @Override
162
    public boolean isUseDefaultSymbol() {
163
        return true;
164
    }
165

  
166
    @Override
167
    public void useDefaultSymbol(boolean bln) {
168
    }
169

  
170
    @Override
171
    public boolean isSuitableForShapeType(int shapeType) {
172
        return true;
173
    }
174

  
175
    @Override
176
    protected void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, Map queryParameters, ICoordTrans coordTrans, FeatureStore featureStore, FeatureQuery featureQuery, double dpi) throws LegendException {
177
        int saved_distance = this.algorithm.getDistance();
178
        try {
179
            int distance = (int) (this.algorithm.getDistance() * (dpi / 72));
180
            Geometry theROI = null;
181
            if (this.roi != null) {
182
                theROI = this.roi.cloneGeometry();
183
                theROI.transform(viewPort.getAffineTransform());
184
            }
185
            this.algorithm.init(image.getWidth(), image.getHeight());
186
            this.algorithm.setDistance(distance);
187
            super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans, featureStore, featureQuery, dpi);
188
            if (!cancel.isCanceled()) {
189
                this.algorithm.drawWithOpaqueColors(image, g, this.getHeatMapColorTable().getColorTable(), cancel, theROI, this.getFilterProportionValue());
190
            }
191
        } finally {
192
            this.algorithm.setDistance(saved_distance);
193

  
194
        }
195
    }
196

  
197
    @Override
198
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
199
            double scale, Map queryParameters, ICoordTrans coordTrans,
200
            FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties)
201
            throws LegendException {
202
        int saved_distance = this.algorithm.getDistance();
203
        try {
204
            double dpi = viewPort.getDPI();
205
            // Ver CartographicSupportToolkit.getCartographicLength
206
            int distance = (int) (this.algorithm.getDistance() * (dpi / 72));
207
            Geometry theROI = null;
208
            if (this.roi != null) {
209
                theROI = this.roi.cloneGeometry();
210
                theROI.transform(viewPort.getAffineTransform());
211
            }
212
            this.algorithm.init(viewPort.getImageWidth(), viewPort.getImageHeight());
213
            this.algorithm.setDistance(distance);
214
            BufferedImage image = new BufferedImage(viewPort.getImageWidth(), viewPort.getImageHeight(), BufferedImage.TYPE_INT_ARGB);
215
            super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans, featureStore, featureQuery, dpi);
216
            if (!cancel.isCanceled()) {
217
                this.algorithm.drawWithAlphaColors(image, g, this.getHeatMapColorTable().getColorTable(), cancel, theROI, this.getFilterProportionValue());
218
                g.drawImage(image, 0, 0, null);
219
            }
220
        } finally {
221
            this.algorithm.setDistance(saved_distance);
222

  
223
        }
224
    }
225

  
226
    @Override
227
    protected void drawFeatures(
228
            BufferedImage image,
229
            Graphics2D g,
230
            final ViewPort viewPort,
231
            final Cancellable cancel,
232
            final ICoordTrans coordTrans,
233
            double dpi,
234
            DefaultFeatureDrawnNotification drawnNotification,
235
            FeatureSet featureSet,
236
            FeatureSelection selection
237
    ) throws BaseException {
238
        int x = -1;
239
        if (!StringUtils.isEmpty(this.fieldName)) {
240
            x = featureSet.getDefaultFeatureType().getIndex(this.fieldName);
241
        }
242
        final int n = x;
243

  
244
        MutableSymbolTable symbolTable = ExpressionEvaluatorLocator.getManager().createSymbolTable();
245
        FeatureSymbolTable fst = DALLocator.getDataManager().createFeatureSymbolTable();
246
        symbolTable.addSymbolTable(fst);
247

  
248
        featureSet.accept(new Visitor() {
249
            @Override
250
            public void visit(Object o) throws VisitCanceledException, BaseException {
251
                if (cancel.isCanceled()) {
252
                    throw new VisitCanceledException();
253
                }
254
                Feature feature = (Feature) o;
255
                Geometry geom = feature.getDefaultGeometry();
256
                if (geom != null) {
257
                    Point pointGeo = geom.centroid();
258
                    if (coordTrans != null) {
259
                        pointGeo.reProject(coordTrans);
260
                    }
261
                    Point pointPixels = (Point) pointGeo.cloneGeometry();
262
                    pointPixels.transform(viewPort.getAffineTransform());
263
                    if (getUseFilterByExpression()) {
264
                        fst.setFeature(feature);
265
                        boolean validFeature = checkToFilterFeature(fst, symbolTable);
266
                        if (!validFeature) {
267
                            return;
268
                        }
269
                    }
270
                    if (n >= 0) {
271
                        double value = 0;
272
                        try {
273

  
274
                            value = feature.getDouble(n);
275
                        } catch (Exception ex) {
276
                        }
277
                        if (value > 0) {
278
                            algorithm.add((int) pointPixels.getX(), (int) pointPixels.getY(), value);
279
                        }
280
                    } else {
281
                        algorithm.add((int) pointPixels.getX(), (int) pointPixels.getY());
282
                    }
283
                }
284
            }
285
        });
286
    }
287

  
288
    protected boolean checkToFilterFeature(FeatureSymbolTable fst, MutableSymbolTable symbolTable) {
289
        if (filterExpression!=null && !filterExpression.isEmpty()) {
290
            Object value = filterExpression.execute(symbolTable);
291
            if (value instanceof Boolean) {
292
                return ((Boolean) value);
293
            } else {
294
                return false;
295
            }
296
        } else {
297
            return false;
298
        }
299
        
300
    }
301

  
302
    /**
303
     * @return the distance
304
     */
305
    @Override
306
    public int getDistance() {
307
        return this.algorithm.getDistance();
308
    }
309

  
310
    /**
311
     * @param distance the distance to set
312
     */
313
    @Override
314
    public void setDistance(int distance) {
315
        this.algorithm.setDistance(distance);
316
    }
317

  
318
    @Override
319
    public void setColorTable(Color[] colorTable) {
320
        this.isRamp = false;
321
        this.sourceColorTable = colorTable;
322
        this.imageLegend = null;
323
        this.hmColorTable = null;
324
        this.fireDefaultSymbolChangedEvent(new SymbolLegendEvent(null, null));
325
    }
326

  
327
    @Override
328
    public void setColorTable(int numColors, Color coldColor, Color hotColor) {
329
        this.isRamp = true;
330
        this.rampColdColor = coldColor;
331
        this.rampHotColor = hotColor;
332
        this.rampNumColors = numColors;
333
        this.imageLegend = null;
334
        this.hmColorTable = null;
335
        this.fireDefaultSymbolChangedEvent(new SymbolLegendEvent(null, null));
336
    }
337

  
338
    @Override
339
    public Color[] getSourceColorTable() {
340
        return this.sourceColorTable;
341
    }
342

  
343
    @Override
344
    public Color[] getTargetColorTable() {
345
        return this.getHeatMapColorTable().getColorTable();
346
    }
347

  
348
    private HeatmapColorTable getHeatMapColorTable() {
349
        if (this.hmColorTable == null) {
350
            if (this.useRamp()) {
351
                this.hmColorTable = new HeatmapColorTable(this.rampColdColor, this.rampHotColor, this.rampNumColors);
352
            } else {
353
                if (useAlphaInColorTable) {
354
                    this.hmColorTable = new HeatmapColorTable(this.getSourceColorTable(), colorTableColdColorAlpha, colorTableHotColorAlpha);
355
                } else {
356
                    this.hmColorTable
357
                            = this.hmColorTable = new HeatmapColorTable(this.getSourceColorTable());
358
                }
359
            }
360
        }
361
        return this.hmColorTable;
362
    }
363

  
364
    @Override
365
    public boolean useRamp() {
366
        return this.isRamp;
367
    }
368

  
369
    @Override
370
    public String getFieldName() {
371
        return this.fieldName;
372
    }
373

  
374
    @Override
375
    public void setFieldName(String fieldName) {
376
        this.fieldName = fieldName;
377
    }
378

  
379
    @Override
380
    public int getColorTableHotColorAlpha() {
381
        return colorTableHotColorAlpha;
382
    }
383

  
384
    @Override
385
    public void setColorTableHotColorAlpha(int colorTableHotColorAlpha) {
386
        this.colorTableHotColorAlpha = colorTableHotColorAlpha;
387
        this.imageLegend = null;
388
        this.hmColorTable = null;
389
    }
390

  
391
    @Override
392
    public int getColorTableColdColorAlpha() {
393
        return colorTableColdColorAlpha;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff