Revision 1720

View differences:

org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/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-SNAPSHOT</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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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(255, Color.RED, Color.WHITE);
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
        for( int i = 0; i < elements; i++ ) {
229
            table[i] = new Color(i, 0, 0, i); //, this.opacity);
230
//            double p = (i * 255.0 ) / elements;
231
//            int r = (int) (first.getRed() * p + last.getRed() * (1 - p));
232
//            int g = (int) (first.getGreen()* p + last.getGreen() * (1 - p));
233
//            int b = (int) (first.getBlue()* p + last.getBlue()* (1 - p));
234
//            
235
//            r = r>255?255:r<0?0:r;
236
//            g = g>255?255:g<0?0:g;
237
//            b = b>255?255:b<0?0:0;
238
//            table[i] = new Color(r,g,b, this.opacity);
239
        }
240
        return table;
241
    }
242

  
243
    /**
244
     * @return the distance
245
     */
246
    @Override
247
    public int getDistance() {
248
        return this.algorithm.getDistance();
249
    }
250

  
251
    /**
252
     * @param distance the distance to set
253
     */
254
    @Override
255
    public void setDistance(int distance) {
256
        this.algorithm.setDistance(distance);
257
    }
258

  
259
}
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/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/trunk/org.gvsig.legend.heatmap/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-SNAPSHOT</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.197-SNAPSHOT</version>
26
      <type>jar</type>
27
    </dependency>
28
  </dependencies>
29
</project>
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/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-SNAPSHOT</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>

Also available in: Unified diff