Revision 1739

View differences:

org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.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.heatmap</artifactId>
6
    <version>1.0.0</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.heatmap.app</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.legend.heatmap.app</name>
12

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

  
17
</project>
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.aggregatelegend.app.mainplugin
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.legend.aggregate.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.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.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.heatmap.app.HeatmapLegendExtension"
19
      description="" active="true" priority="1">
20

  
21
    </extension>
22

  
23
  </extensions>
24
</plugin-config>
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.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.heatmap.lib.api</include>
44
        <include>org.gvsig:org.gvsig.legend.heatmap.lib.impl</include>
45
        <include>org.gvsig:org.gvsig.legend.heatmap.swing.api</include>
46
        <include>org.gvsig:org.gvsig.legend.heatmap.swing.impl</include>
47
      </includes>
48
    </dependencySet>
49
  </dependencySets>
50

  
51
</assembly>
52

  
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.app.mainplugin/src/main/java/org/gvsig/legend/heatmap/app/HeatmapLegendExtension.java
1

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

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

  
6

  
7
public class HeatmapLegendExtension extends Extension {
8

  
9
    @Override
10
    public void initialize() {
11
    }
12

  
13
    @Override
14
    public void execute(String string) {
15
    }
16

  
17
    @Override
18
    public boolean isEnabled() {
19
        return true;
20
    }
21

  
22
    @Override
23
    public boolean isVisible() {
24
        return true;
25
    }
26
    
27
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.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.heatmap.app</artifactId>
6
    <version>1.0.0</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.heatmap.app.mainplugin</artifactId>
10
  <version>1.0.0</version>
11
  <name>org.gvsig.legend.heatmap.app.mainplugin</name>
12

  
13
    <properties>
14
    <!-- Package info property values -->
15
    <gvsig.package.info.state>devel</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: 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.heatmap.swing.api</artifactId>
34
      <scope>compile</scope>
35
    </dependency>
36
    <dependency>
37
      <groupId>org.gvsig</groupId>
38
      <artifactId>org.gvsig.legend.heatmap.lib.api</artifactId>
39
      <scope>compile</scope>
40
    </dependency>
41
    <dependency>
42
      <groupId>org.gvsig</groupId>
43
      <artifactId>org.gvsig.legend.heatmap.lib.impl</artifactId>
44
      <scope>runtime</scope>
45
    </dependency>
46
    <dependency>
47
      <groupId>org.gvsig</groupId>
48
      <artifactId>org.gvsig.legend.heatmap.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.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.app/org.gvsig.legend.heatmap.app.mainplugin/buildNumber.properties
1
#Mon Aug 28 11:30:03 CEST 2017
2
buildNumber=2
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.impl/src/main/java/org/gvsig/legend/heatmap/lib/impl/HeatmapLegendLibraryImpl.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.legend.heatmap.lib.impl;
26

  
27
import org.gvsig.fmap.mapcontext.MapContextLibrary;
28
import org.gvsig.fmap.mapcontext.MapContextLocator;
29
import org.gvsig.fmap.mapcontext.MapContextManager;
30
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendLibrary;
31
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendLocator;
32
import org.gvsig.tools.library.AbstractLibrary;
33
import org.gvsig.tools.library.LibraryException;
34

  
35
public class HeatmapLegendLibraryImpl extends AbstractLibrary {
36

  
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(HeatmapLegendLibrary.class);
40
        this.require(MapContextLibrary.class);
41
    }
42

  
43
    @Override
44
    protected void doInitialize() throws LibraryException {
45
        HeatmapLegendLocator.registerHeatmapLegendManager(DefaultHeatmapLegendManager.class);
46
        MapContextManager mcmanager = MapContextLocator.getMapContextManager();
47
        mcmanager.registerLegend("HeatmapLegend", DefaultHeatmapLegend.class);
48
    }
49

  
50
    @Override
51
    protected void doPostInitialize() throws LibraryException {
52
    }
53

  
54
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.impl/src/main/java/org/gvsig/legend/heatmap/lib/impl/DefaultHeatmapLegendManager.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.heatmap.lib.impl;
24

  
25
import org.gvsig.legend.heatmap.lib.api.HeatmapLegend;
26
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendManager;
27

  
28

  
29
public class DefaultHeatmapLegendManager implements HeatmapLegendManager {
30

  
31
    @Override
32
    public HeatmapLegend create() {
33
        return new DefaultHeatmapLegend();
34
    }
35

  
36
    @Override
37
    public Class<? extends HeatmapLegend> getLegendClass() {
38
        return DefaultHeatmapLegend.class;
39
    }
40

  
41
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.impl/src/main/java/org/gvsig/legend/heatmap/lib/impl/DefaultHeatmapLegend.java
1
package org.gvsig.legend.heatmap.lib.impl;
2

  
3
import java.awt.Color;
4
import java.awt.Graphics2D;
5
import java.awt.image.BufferedImage;
6
import java.util.Map;
7
import org.cresques.cts.ICoordTrans;
8
import org.gvsig.fmap.dal.exception.DataException;
9
import org.gvsig.fmap.dal.feature.Feature;
10
import org.gvsig.fmap.dal.feature.FeatureQuery;
11
import org.gvsig.fmap.dal.feature.FeatureSelection;
12
import org.gvsig.fmap.dal.feature.FeatureSet;
13
import org.gvsig.fmap.dal.feature.FeatureStore;
14
import org.gvsig.fmap.geom.Geometry;
15
import org.gvsig.fmap.geom.primitive.Point;
16
import org.gvsig.fmap.mapcontext.MapContextException;
17
import org.gvsig.fmap.mapcontext.ViewPort;
18
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
19
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
20
import org.gvsig.legend.heatmap.lib.api.HeatmapLegend;
21
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
22
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.DefaultFeatureDrawnNotification;
23
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
24
import org.gvsig.tools.exception.BaseException;
25
import org.gvsig.tools.task.Cancellable;
26
import org.gvsig.tools.visitor.VisitCanceledException;
27
import org.gvsig.tools.visitor.Visitor;
28
import org.slf4j.Logger;
29
import org.slf4j.LoggerFactory;
30

  
31
public class DefaultHeatmapLegend extends AbstractVectorialLegend implements HeatmapLegend {
32

  
33
    protected static final Logger LOG = LoggerFactory.getLogger(DefaultHeatmapLegend.class);
34

  
35
    private class DensityAlgorithm {
36

  
37
        private double[][] grid;
38
        private double[][] kernel;
39
        private int distance;
40
        private int height;
41
        private int with;
42
        private double maxValue;
43
        private double minValue;
44

  
45
        public DensityAlgorithm(int distance) {
46
            this.setDistance(distance);
47
        }
48

  
49
        public void setDistance(int distance) {
50
            this.distance = distance;
51
            this.kernel = new double[2 * this.distance + 1][2 * this.distance + 1];
52
            for( int y = -this.distance; y < this.distance + 1; y++ ) {
53
                for( int x = -this.distance; x < this.distance + 1; x++ ) {
54
                    final double dDist = Math.sqrt(x * x + y * y);
55
                    if( dDist < this.distance ) {
56
                        this.kernel[x + this.distance][y + this.distance] = Math.pow(1 - (dDist * dDist) / (this.distance * this.distance), 2);
57
                    } else {
58
                        this.kernel[x + this.distance][y + this.distance] = 0;
59
                    }
60
                }
61
            }
62
        }
63

  
64
        public int getDistance() {
65
            return this.distance;
66
        }
67

  
68
        public void init(int with, int height) {
69
            this.with = with;
70
            this.height = height;
71
            this.grid = new double[with][height];
72
            this.maxValue = 0;
73
            this.minValue = 0;
74
        }
75

  
76
        public void add(int px, int py) {
77
            add(px, py, 1);
78
        }
79

  
80
        public void add(int px, int py, double value) {
81
            for( int y = -this.distance; y < this.distance + 1; y++ ) {
82
                for( int x = -this.distance; x < this.distance + 1; x++ ) {
83
                    if( this.kernel[x + this.distance][y + this.distance] != 0 ) {
84
                        addValue(px + x, py + y, value * this.kernel[x + this.distance][y + this.distance]);
85
                    }
86
                }
87
            }
88
        }
89

  
90
        private void addValue(int px, int py, double value) {
91
            if( px<0 || py<0 || px>=with || py>=height ) {
92
                return;
93
            }
94
            value += this.grid[px][py];
95
            this.grid[px][py] = value;
96
            if( value > this.maxValue ) {
97
                this.maxValue = value;
98
            }
99
            if( value < this.minValue ) {
100
                this.minValue = value;
101
            }
102
        }
103

  
104
        public void draw(BufferedImage img, Color[] colorTable, Cancellable cancel) {
105
            try {
106
                int maxColors = colorTable.length;
107
                for( int x = 0; x < with; x++ ) {
108
                    for( int y = 0; y < height; y++ ) {
109
                        if( cancel.isCanceled() ) {
110
                            return;
111
                        }
112
                        double value = this.grid[x][y];
113
                        if( value > 0 ) {
114
                            int icolor = (int) (value * maxColors / maxValue);
115
                            icolor = icolor<0? 0: icolor>=maxColors?maxColors-1:icolor;
116
                            Color c = colorTable[icolor];
117
                            img.setRGB(x, y, c.getRGB());
118
                        }
119
                    }
120
                }
121
            } catch (Exception ex) {
122
                LOG.warn("Problems drawing heatmap", ex);
123
            }
124
        }
125
    }
126

  
127
    private final ISymbol defaultSymbol;
128
    private final DensityAlgorithm algorithm;
129
//    private int distance; // Pixels
130
    private Color[] colorTable;
131
    private int opacity;
132

  
133
    public DefaultHeatmapLegend() {
134
        this.defaultSymbol = new SimpleTextSymbol();
135
        this.algorithm = new DensityAlgorithm(30);
136
        this.opacity = 100;
137
        this.colorTable = createColorTable(100, Color.BLUE, Color.RED);
138
    }
139

  
140
    @Override
141
    protected String[] getRequiredFeatureAttributeNames(FeatureStore featureStore) throws DataException {
142
        return new String[]{
143
            featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()};
144
    }
145

  
146
    @Override
147
    public ISymbol getDefaultSymbol() {
148
        return this.defaultSymbol;
149
    }
150

  
151
    @Override
152
    public void setDefaultSymbol(ISymbol is) {
153
    }
154

  
155
    @Override
156
    public ISymbol getSymbolByFeature(Feature ftr) throws MapContextException {
157
        return this.defaultSymbol;
158
    }
159

  
160
    @Override
161
    public int getShapeType() {
162
        return Geometry.TYPES.GEOMETRY;
163
    }
164

  
165
    @Override
166
    public void setShapeType(int i) {
167
    }
168

  
169
    @Override
170
    public boolean isUseDefaultSymbol() {
171
        return true;
172
    }
173

  
174
    @Override
175
    public void useDefaultSymbol(boolean bln) {
176
    }
177

  
178
    @Override
179
    public boolean isSuitableForShapeType(int shapeType) {
180
        return true;
181
    }
182

  
183
    @Override
184
    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 {
185
        this.algorithm.init(image.getWidth(), image.getHeight());
186
        super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans, featureStore, featureQuery, dpi);
187
        if( !cancel.isCanceled() ) {
188
            this.algorithm.draw(image, this.colorTable, cancel);
189
        }
190
    }
191

  
192
    @Override
193
    protected void drawFeatures(
194
        BufferedImage image,
195
        Graphics2D g,
196
        final ViewPort viewPort,
197
        final Cancellable cancel,
198
        final ICoordTrans coordTrans,
199
        double dpi,
200
        DefaultFeatureDrawnNotification drawnNotification,
201
        FeatureSet featureSet,
202
        FeatureSelection selection
203
    ) throws BaseException {
204
        featureSet.accept(new Visitor() {
205
            @Override
206
            public void visit(Object o) throws VisitCanceledException, BaseException {
207
                if( cancel.isCanceled() ) {
208
                    throw new VisitCanceledException();
209
                }
210
                Feature feature = (Feature) o;
211
                Geometry geom = feature.getDefaultGeometry();
212
                if( geom != null ) {
213
                    Point pointGeo = geom.centroid();
214
                    if( coordTrans != null ) {
215
                        pointGeo.reProject(coordTrans);
216
                    }
217
                    Point pointPixels = (Point) pointGeo.cloneGeometry();
218
                    pointPixels.transform(viewPort.getAffineTransform());
219
                    algorithm.add((int) pointPixels.getX(), (int) pointPixels.getY());
220
                }
221
            }
222
        });
223
    }
224

  
225
    private Color[] createColorTable(int elements, Color first, Color last) {
226
        Color[] table = new Color[elements];
227

  
228
        double deltaRed=(last.getRed()-first.getRed())/elements;
229
        double deltaGreen=(last.getGreen()-first.getGreen())/elements;
230
        double deltaBlue=(last.getBlue()-first.getBlue())/elements;
231
//        double deltaAlpha=(last.getAlpha()-first.getAlpha())/elements;
232
        double deltaAlpha=(255-0)/elements;
233

  
234

  
235
        for( int i = 0; i < elements; i++ ) {
236
            //Lo tuyo a pi??n fijo
237
//            table[i] = new Color(i, 0, 0, i); //, this.opacity);
238

  
239
            //Lo m?o
240
            //FIXME: Entiendo que la opacity es la opacidad general de la capa.
241
            table[i] = new Color(
242
                (int) (first.getRed() + i * deltaRed),
243
                (int) (first.getGreen() + i * deltaGreen),
244
                (int) (first.getBlue() + i * deltaBlue),
245
//                (int) ((first.getAlpha() + i * deltaAlpha)*opacity/100)
246
                (int) (i * deltaAlpha)
247
            );
248

  
249

  
250
        }
251
        return table;
252
    }
253

  
254
    /**
255
     * @return the distance
256
     */
257
    @Override
258
    public int getDistance() {
259
        return this.algorithm.getDistance();
260
    }
261

  
262
    /**
263
     * @param distance the distance to set
264
     */
265
    @Override
266
    public void setDistance(int distance) {
267
        this.algorithm.setDistance(distance);
268
    }
269

  
270
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.heatmap.lib.impl.HeatmapLegendLibraryImpl
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.impl/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
  <artifactId>org.gvsig.legend.heatmap.lib.impl</artifactId>
4
  <name>org.gvsig.legend.heatmap.lib.impl</name>
5
  <parent>
6
    <groupId>org.gvsig</groupId>
7
    <artifactId>org.gvsig.legend.heatmap.lib</artifactId>
8
    <version>1.0.0</version>
9
  </parent>
10
  <groupId>org.gvsig</groupId>
11
  <dependencies>
12
    <dependency>
13
      <groupId>org.gvsig</groupId>
14
      <artifactId>org.gvsig.legend.heatmap.lib.api</artifactId>
15
      <scope>compile</scope>
16
    </dependency>
17
    <dependency>
18
      <groupId>org.gvsig</groupId>
19
      <artifactId>org.gvsig.fmap.dal.api</artifactId>
20
      <scope>compile</scope>
21
    </dependency>
22
    <dependency>
23
      <groupId>org.gvsig</groupId>
24
      <artifactId>org.gvsig.symbology.lib.impl</artifactId>
25
      <version>2.0.199</version>
26
      <type>jar</type>
27
    </dependency>
28
  </dependencies>
29
</project>
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.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.heatmap</artifactId>
6
    <version>1.0.0</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.heatmap.lib</artifactId>
10
  <packaging>pom</packaging>
11
  <modules>
12
    <module>org.gvsig.legend.heatmap.lib.api</module>
13
    <module>org.gvsig.legend.heatmap.lib.impl</module>
14
  </modules>
15
</project>
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.heatmap.lib.api.HeatmapLegendLibrary
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.api/src/main/java/org/gvsig/legend/heatmap/lib/api/HeatmapLegend.java
1
package org.gvsig.legend.heatmap.lib.api;
2

  
3
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
4

  
5
public interface HeatmapLegend extends IVectorLegend {
6

  
7
    public int getDistance();
8
    public void setDistance(int distance);
9
}
10

  
11

  
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.api/src/main/java/org/gvsig/legend/heatmap/lib/api/HeatmapLegendLocator.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.heatmap.lib.api;
24

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

  
29

  
30
public class HeatmapLegendLocator extends AbstractLocator {
31

  
32
    /**
33
     * HeatmapLegend locator name
34
     */
35
    private static final String LOCATOR_NAME = "HeatmapLegendLocator";
36

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

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

  
48

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

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

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

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

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

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

  
99
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.api/src/main/java/org/gvsig/legend/heatmap/lib/api/HeatmapLegendLibrary.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.heatmap.lib.api;
24

  
25
import org.gvsig.tools.library.AbstractLibrary;
26
import org.gvsig.tools.library.LibraryException;
27
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
28

  
29

  
30
public class HeatmapLegendLibrary extends AbstractLibrary {
31

  
32
    @Override
33
    protected void doInitialize() throws LibraryException {
34
        registerAsAPI(HeatmapLegendLibrary.class);
35
    }
36

  
37
    @Override
38
    protected void doPostInitialize() throws LibraryException {
39
        // Validate there is any implementation registered.
40
        HeatmapLegendManager manager = HeatmapLegendLocator.getHeatmapLegendManager();
41
        if (manager == null) {
42
            throw new ReferenceNotRegisteredException(
43
                HeatmapLegendLocator.MANAGER_NAME, HeatmapLegendLocator.getInstance());
44
        }
45
    }
46

  
47
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.lib.api/src/main/java/org/gvsig/legend/heatmap/lib/api/HeatmapLegendManager.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.heatmap.lib.api;
24

  
25

  
26
public interface HeatmapLegendManager {
27

  
28
    /**
29
     * Creates an aggregate legend
30
     *
31
     * @return the aggregate legend
32
     */
33
    public HeatmapLegend create();
34

  
35
    public Class<? extends HeatmapLegend> getLegendClass();
36
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.lib/org.gvsig.legend.heatmap.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.heatmap.lib.api</artifactId>
5
  <name>org.gvsig.legend.heatmap.lib.api</name>
6
  <parent>
7
    <groupId>org.gvsig</groupId>
8
    <artifactId>org.gvsig.legend.heatmap.lib</artifactId>
9
    <version>1.0.0</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
  </dependencies>
43
</project>
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditorView.java
1
package org.gvsig.legend.heatmap.swing.impl;
2

  
3
import com.jeta.open.i18n.I18NUtils;
4
import com.jgoodies.forms.layout.CellConstraints;
5
import com.jgoodies.forms.layout.FormLayout;
6
import java.awt.BorderLayout;
7
import java.awt.ComponentOrientation;
8
import java.awt.Container;
9
import java.awt.Dimension;
10
import javax.swing.Box;
11
import javax.swing.ImageIcon;
12
import javax.swing.JFrame;
13
import javax.swing.JLabel;
14
import javax.swing.JPanel;
15
import javax.swing.JTextField;
16

  
17

  
18
public class DefaultHeatmapLegendEditorView extends JPanel
19
{
20
   JLabel lblDistance = new JLabel();
21
   JTextField txtDistance = new JTextField();
22

  
23
   /**
24
    * Default constructor
25
    */
26
   public DefaultHeatmapLegendEditorView()
27
   {
28
      initializePanel();
29
   }
30

  
31
   /**
32
    * Adds fill components to empty cells in the first row and first column of the grid.
33
    * This ensures that the grid spacing will be the same as shown in the designer.
34
    * @param cols an array of column indices in the first row where fill components should be added.
35
    * @param rows an array of row indices in the first column where fill components should be added.
36
    */
37
   void addFillComponents( Container panel, int[] cols, int[] rows )
38
   {
39
      Dimension filler = new Dimension(10,10);
40

  
41
      boolean filled_cell_11 = false;
42
      CellConstraints cc = new CellConstraints();
43
      if ( cols.length > 0 && rows.length > 0 )
44
      {
45
         if ( cols[0] == 1 && rows[0] == 1 )
46
         {
47
            /** add a rigid area  */
48
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
49
            filled_cell_11 = true;
50
         }
51
      }
52

  
53
      for( int index = 0; index < cols.length; index++ )
54
      {
55
         if ( cols[index] == 1 && filled_cell_11 )
56
         {
57
            continue;
58
         }
59
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
60
      }
61

  
62
      for( int index = 0; index < rows.length; index++ )
63
      {
64
         if ( rows[index] == 1 && filled_cell_11 )
65
         {
66
            continue;
67
         }
68
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
69
      }
70

  
71
   }
72

  
73
   /**
74
    * Helper method to load an image file from the CLASSPATH
75
    * @param imageName the package and name of the file to load relative to the CLASSPATH
76
    * @return an ImageIcon instance with the specified image file
77
    * @throws IllegalArgumentException if the image resource cannot be loaded.
78
    */
79
   public ImageIcon loadImage( String imageName )
80
   {
81
      try
82
      {
83
         ClassLoader classloader = getClass().getClassLoader();
84
         java.net.URL url = classloader.getResource( imageName );
85
         if ( url != null )
86
         {
87
            ImageIcon icon = new ImageIcon( url );
88
            return icon;
89
         }
90
      }
91
      catch( Exception e )
92
      {
93
         e.printStackTrace();
94
      }
95
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
96
   }
97

  
98
   /**
99
    * Method for recalculating the component orientation for 
100
    * right-to-left Locales.
101
    * @param orientation the component orientation to be applied
102
    */
103
   public void applyComponentOrientation( ComponentOrientation orientation )
104
   {
105
      // Not yet implemented...
106
      // I18NUtils.applyComponentOrientation(this, orientation);
107
      super.applyComponentOrientation(orientation);
108
   }
109

  
110
   public JPanel createPanel()
111
   {
112
      JPanel jpanel1 = new JPanel();
113
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
114
      CellConstraints cc = new CellConstraints();
115
      jpanel1.setLayout(formlayout1);
116

  
117
      lblDistance.setName("lblDistance");
118
      lblDistance.setText("Distance");
119
      jpanel1.add(lblDistance,cc.xy(2,2));
120

  
121
      txtDistance.setName("txtDistance");
122
      jpanel1.add(txtDistance,cc.xy(4,2));
123

  
124
      addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 });
125
      return jpanel1;
126
   }
127

  
128
   /**
129
    * Initializer
130
    */
131
   protected void initializePanel()
132
   {
133
      setLayout(new BorderLayout());
134
      add(createPanel(), BorderLayout.CENTER);
135
   }
136

  
137

  
138
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendSwingManager.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.heatmap.swing.impl;
24

  
25
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendEditor;
26
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendSwingManager;
27

  
28

  
29

  
30
public class DefaultHeatmapLegendSwingManager implements HeatmapLegendSwingManager {
31

  
32
    @Override
33
    public HeatmapLegendEditor createHeatmapdLegendEditor() {
34
        return new DefaultHeatmapLegendEditor();
35
    }
36

  
37

  
38
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditor.java
1

  
2
package org.gvsig.legend.heatmap.swing.impl;
3

  
4
import javax.swing.ImageIcon;
5
import javax.swing.JPanel;
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
8
import org.gvsig.legend.heatmap.lib.api.HeatmapLegend;
9
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendLocator;
10
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendEditor;
11
import org.gvsig.tools.ToolsLocator;
12
import org.gvsig.tools.i18n.I18nManager;
13

  
14

  
15
public class DefaultHeatmapLegendEditor extends DefaultHeatmapLegendEditorView implements HeatmapLegendEditor {
16

  
17
    private static final long serialVersionUID = 4307714097793669675L;
18

  
19
    private HeatmapLegend legend;
20
    private FLayer layer;
21
    private final Class<? extends HeatmapLegend> legendClass;
22
    
23
    public DefaultHeatmapLegendEditor() {
24
        this.legendClass = HeatmapLegendLocator.getHeatmapLegendManager().getLegendClass();
25
    }
26
    
27
    @Override
28
    public void setData(FLayer layer, ILegend legend) {
29
        this.layer = layer;
30
        if( this.getLegendClass().isInstance(legend) ) {
31
            this.legend = (HeatmapLegend) legend;
32
        } else {
33
            this.legend = HeatmapLegendLocator.getHeatmapLegendManager().create();
34
        }
35
        this.txtDistance.setText(String.valueOf(this.legend.getDistance()));
36
    }
37

  
38
    @Override
39
    public ILegend getLegend() {
40
        
41
        int d;
42
        try {
43
            d = Integer.parseUnsignedInt(this.txtDistance.getText());
44
        } catch(Throwable th) {
45
            d = 20;
46
        }
47
        if( d<10 ) {
48
            d = 10;
49
        }
50
        legend.setDistance(d);
51
        return legend;
52
    }
53

  
54
    @Override
55
    public String getDescription() {
56
        I18nManager i18n = ToolsLocator.getI18nManager();
57
        return i18n.getTranslation( "_Heatmap_legend");
58
    }
59

  
60
    @Override
61
    public ImageIcon getIcon() {
62
        // TODO:
63
        return null;
64
    }
65

  
66
    @Override
67
    public Class getParentClass() {
68
        return null;
69
    }
70

  
71
    @Override
72
    public String getTitle() {
73
        I18nManager i18n = ToolsLocator.getI18nManager();
74
        return i18n.getTranslation( "_Heatmap_legend");
75
    }
76

  
77
    @Override
78
    public JPanel getPanel() {
79
        return this;
80
    }
81

  
82
    @Override
83
    public Class getLegendClass() {
84
        return this.legendClass;
85
    }
86

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

  
25
package org.gvsig.legend.heatmap.swing.impl;
26

  
27
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendSwingLocator;
28
import org.gvsig.symbology.swing.SymbologySwingLibrary;
29
import org.gvsig.symbology.swing.SymbologySwingLocator;
30
import org.gvsig.symbology.swing.SymbologySwingManager;
31
import org.gvsig.tools.library.AbstractLibrary;
32
import org.gvsig.tools.library.LibraryException;
33

  
34

  
35
public class HeatmapLegendSwingLibrary extends AbstractLibrary {
36

  
37

  
38

  
39
	@Override
40
    public void doRegistration() {
41
        registerAsImplementationOf(HeatmapLegendSwingLibrary.class);
42
        require(SymbologySwingLibrary.class);
43
    }
44

  
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
        HeatmapLegendSwingLocator.registerHeatmapLegendSwingManager(DefaultHeatmapLegendSwingManager.class);
48
    }
49

  
50
    @Override
51
    protected void doPostInitialize() throws LibraryException {
52
        SymbologySwingManager symmnager = SymbologySwingLocator.getSwingManager();
53
        symmnager.registerLegendEditor(DefaultHeatmapLegendEditor.class);
54
	}
55

  
56
}
org.gvsig.legend.heatmap/tags/org.gvsig.legend.heatmap-1.0.0/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditorView.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<object classname="com.jeta.forms.store.memento.FormPackage">
4
 <at name="fileversion">
5
  <object classname="com.jeta.forms.store.memento.FormsVersion2">
6
   <at name="major">2</at>
7
   <at name="minor">0</at>
8
   <at name="sub">0</at>
9
  </object>
10
 </at>
11
 <at name="form">
12
  <object classname="com.jeta.forms.store.memento.FormMemento">
13
   <super classname="com.jeta.forms.store.memento.ComponentMemento">
14
    <at name="cellconstraints">
15
     <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
16
      <at name="column">1</at>
17
      <at name="row">1</at>
18
      <at name="colspan">1</at>
19
      <at name="rowspan">1</at>
20
      <at name="halign">default</at>
21
      <at name="valign">default</at>
22
      <at name="insets" object="insets">0,0,0,0</at>
23
     </object>
24
    </at>
25
    <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
26
   </super>
27
   <at name="id">/home/jjdelcerro/datos/devel/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.xml</at>
28
   <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
29
   <at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE</at>
30
   <at name="components">
31
    <object classname="java.util.LinkedList">
32
     <item >
33
      <at name="value">
34
       <object classname="com.jeta.forms.store.memento.BeanMemento">
35
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
36
         <at name="cellconstraints">
37
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
38
           <at name="column">2</at>
39
           <at name="row">2</at>
40
           <at name="colspan">1</at>
41
           <at name="rowspan">1</at>
42
           <at name="halign">default</at>
43
           <at name="valign">default</at>
44
           <at name="insets" object="insets">0,0,0,0</at>
45
          </object>
46
         </at>
47
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
48
        </super>
49
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
50
        <at name="beanclass">com.jeta.forms.components.label.JETALabel</at>
51
        <at name="beanproperties">
52
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
53
          <at name="classname">com.jeta.forms.components.label.JETALabel</at>
54
          <at name="properties">
55
           <object classname="com.jeta.forms.store.support.PropertyMap">
56
            <at name="border">
57
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
58
              <super classname="com.jeta.forms.store.properties.BorderProperty">
59
               <at name="name">border</at>
60
              </super>
61
              <at name="borders">
62
               <object classname="java.util.LinkedList">
63
                <item >
64
                 <at name="value">
65
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
66
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
67
                    <at name="name">border</at>
68
                   </super>
69
                  </object>
70
                 </at>
71
                </item>
72
               </object>
73
              </at>
74
             </object>
75
            </at>
76
            <at name="name">lblDistance</at>
77
            <at name="width">49</at>
78
            <at name="text">Distance</at>
79
            <at name="fill">
80
             <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
81
              <at name="name">fill</at>
82
             </object>
83
            </at>
84
            <at name="height">14</at>
85
           </object>
86
          </at>
87
         </object>
88
        </at>
89
       </object>
90
      </at>
91
     </item>
92
     <item >
93
      <at name="value">
94
       <object classname="com.jeta.forms.store.memento.BeanMemento">
95
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
96
         <at name="cellconstraints">
97
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
98
           <at name="column">4</at>
99
           <at name="row">2</at>
100
           <at name="colspan">1</at>
101
           <at name="rowspan">1</at>
102
           <at name="halign">default</at>
103
           <at name="valign">default</at>
104
           <at name="insets" object="insets">0,0,0,0</at>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff