Revision 1743
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Mon Aug 28 11:32:15 CEST 2017 |
|
2 |
buildNumber=3 |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.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.aggregate.lib.api</include> |
|
44 |
<include>org.gvsig:org.gvsig.legend.aggregate.lib.impl</include> |
|
45 |
<include>org.gvsig:org.gvsig.legend.aggregate.swing.api</include> |
|
46 |
<include>org.gvsig:org.gvsig.legend.aggregate.swing.impl</include> |
|
47 |
</includes> |
|
48 |
</dependencySet> |
|
49 |
</dependencySets> |
|
50 |
|
|
51 |
</assembly> |
|
52 |
|
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/src/main/java/org/gvsig/legend/aggregate/app/AggregateLegendTextExtension.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.legend.aggregate.app; |
|
3 |
|
|
4 |
import org.gvsig.andami.plugins.Extension; |
|
5 |
|
|
6 |
|
|
7 |
public class AggregateLegendTextExtension 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.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.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.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.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.aggregate.app.AggregateLegendTextExtension" |
|
19 |
description="" active="true" priority="1"> |
|
20 |
|
|
21 |
<action |
|
22 |
name="aggregatelegend-set" |
|
23 |
label="_Set_aggregated_legend" |
|
24 |
tooltip="_Set_aggregated_legend" |
|
25 |
position="900700100" |
|
26 |
action-command="aggregatelegend-set" |
|
27 |
accelerator="" |
|
28 |
/> |
|
29 |
|
|
30 |
</extension> |
|
31 |
|
|
32 |
</extensions> |
|
33 |
</plugin-config> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.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.aggregate.app</artifactId> |
|
6 |
<version>1.0.1</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.aggregate.app.mainplugin</artifactId> |
|
10 |
<version>1.0.1</version> |
|
11 |
<name>org.gvsig.legend.aggregate.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: Aggregate text symbols</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.aggregate.swing.api</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.legend.aggregate.lib.api</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.legend.aggregate.lib.impl</artifactId> |
|
44 |
<scope>runtime</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.legend.aggregate.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.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.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.aggregate</artifactId> |
|
6 |
<version>1.0.1</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.aggregate.app</artifactId> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>org.gvsig.legend.aggregate.app</name> |
|
12 |
|
|
13 |
<modules> |
|
14 |
<module>org.gvsig.legend.aggregate.app.mainplugin</module> |
|
15 |
</modules> |
|
16 |
|
|
17 |
</project> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/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.aggregate</artifactId> |
|
5 |
<version>1.0.1</version> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<description>Legend for aggregate text symbols that are near.</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.desktop</artifactId> |
|
12 |
<version>2.0.200</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<url>https://devel.gvsig.org/sites/org.gvsig.legend.aggregate/${project.version}</url> |
|
16 |
<scm> |
|
17 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1</connection> |
|
18 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1</developerConnection> |
|
19 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-base-legends/repository/show/org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1</url> |
|
20 |
</scm> |
|
21 |
<repositories> |
|
22 |
<repository> |
|
23 |
<id>gvsig-public-http-repository</id> |
|
24 |
<name>gvSIG maven public HTTP repository</name> |
|
25 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
26 |
<releases> |
|
27 |
<enabled>true</enabled> |
|
28 |
<updatePolicy>daily</updatePolicy> |
|
29 |
<checksumPolicy>warn</checksumPolicy> |
|
30 |
</releases> |
|
31 |
<snapshots> |
|
32 |
<enabled>true</enabled> |
|
33 |
<updatePolicy>daily</updatePolicy> |
|
34 |
<checksumPolicy>warn</checksumPolicy> |
|
35 |
</snapshots> |
|
36 |
</repository> |
|
37 |
</repositories> |
|
38 |
|
|
39 |
<distributionManagement> |
|
40 |
<site> |
|
41 |
<id>gvsig-repository</id> |
|
42 |
<url>dav:https://devel.gvsig.org/download/projects/gvsig-base-legends/pool/${project.artifactId}/${project.version}</url> |
|
43 |
</site> |
|
44 |
</distributionManagement> |
|
45 |
|
|
46 |
<build> |
|
47 |
<plugins> |
|
48 |
<plugin> |
|
49 |
<groupId>org.apache.maven.plugins</groupId> |
|
50 |
<artifactId>maven-release-plugin</artifactId> |
|
51 |
<configuration> |
|
52 |
<tagBase>https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/tags</tagBase> |
|
53 |
</configuration> |
|
54 |
</plugin> |
|
55 |
</plugins> |
|
56 |
</build> |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
<dependencyManagement> |
|
61 |
<dependencies> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.legend.aggregate.lib.api</artifactId> |
|
65 |
<version>1.0.1</version> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>org.gvsig</groupId> |
|
69 |
<artifactId>org.gvsig.legend.aggregate.lib.impl</artifactId> |
|
70 |
<version>1.0.1</version> |
|
71 |
</dependency> |
|
72 |
<dependency> |
|
73 |
<groupId>org.gvsig</groupId> |
|
74 |
<artifactId>org.gvsig.legend.aggregate.swing.api</artifactId> |
|
75 |
<version>1.0.1</version> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>org.gvsig</groupId> |
|
79 |
<artifactId>org.gvsig.legend.aggregate.swing.impl</artifactId> |
|
80 |
<version>1.0.1</version> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.legend.aggregate.app.mainplugin</artifactId> |
|
85 |
<version>1.0.1</version> |
|
86 |
</dependency> |
|
87 |
</dependencies> |
|
88 |
</dependencyManagement> |
|
89 |
<modules> |
|
90 |
<module>org.gvsig.legend.aggregate.lib</module> |
|
91 |
<module>org.gvsig.legend.aggregate.swing</module> |
|
92 |
<module>org.gvsig.legend.aggregate.app</module> |
|
93 |
</modules> |
|
94 |
</project> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.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.aggregate</artifactId> |
|
6 |
<version>1.0.1</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.aggregate.lib</artifactId> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.legend.aggregate.lib.api</module> |
|
13 |
<module>org.gvsig.legend.aggregate.lib.impl</module> |
|
14 |
</modules> |
|
15 |
</project> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.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.aggregate.lib.impl</artifactId> |
|
4 |
<name>org.gvsig.legend.aggregate.lib.impl</name> |
|
5 |
<parent> |
|
6 |
<groupId>org.gvsig</groupId> |
|
7 |
<artifactId>org.gvsig.legend.aggregate.lib</artifactId> |
|
8 |
<version>1.0.1</version> |
|
9 |
</parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<dependencies> |
|
12 |
<dependency> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.legend.aggregate.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 |
<scope>compile</scope> |
|
26 |
</dependency> |
|
27 |
</dependencies> |
|
28 |
</project> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/AggregateLegendLibraryImpl.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.aggregate.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.aggregate.lib.api.AggregateLegendLibrary; |
|
31 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLocator; |
|
32 |
import org.gvsig.tools.library.AbstractLibrary; |
|
33 |
import org.gvsig.tools.library.LibraryException; |
|
34 |
|
|
35 |
public class AggregateLegendLibraryImpl extends AbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsImplementationOf(AggregateLegendLibrary.class); |
|
40 |
this.require(MapContextLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
AggregateLegendLocator.registerAggregateLegendManager(DefaultAggregateLegendManager.class); |
|
46 |
MapContextManager mcmanager = MapContextLocator.getMapContextManager(); |
|
47 |
mcmanager.registerLegend("AggregateLegend", DefaultAggregateLegend.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
} |
|
53 |
|
|
54 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/DefaultAggregateLegendManager.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.aggregate.lib.impl; |
|
24 |
|
|
25 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
26 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
|
27 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegend; |
|
28 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegendManager; |
|
29 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLabelStyle; |
|
30 |
|
|
31 |
|
|
32 |
public class DefaultAggregateLegendManager implements AggregateLegendManager { |
|
33 |
|
|
34 |
private ILabelStyle defaultLabelStyle = null; |
|
35 |
|
|
36 |
public DefaultAggregateLegendManager() { |
|
37 |
this.defaultLabelStyle = new SimpleLabelStyle(); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public AggregateLegend createAggregateLegend() { |
|
42 |
return new DefaultAggregateLegend(); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public Class<? extends AggregateLegend> getLegendClass() { |
|
47 |
return DefaultAggregateLegend.class; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public ILabelStyle getDefaultLabelStyle() { |
|
52 |
return this.defaultLabelStyle; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public void setDefaultLabelStyle(ILabelStyle defaultLabelStyle) { |
|
57 |
this.defaultLabelStyle = defaultLabelStyle; |
|
58 |
} |
|
59 |
|
|
60 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/DefaultAggregateLegend.java | ||
---|---|---|
1 |
package org.gvsig.legend.aggregate.lib.impl; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.FontMetrics; |
|
6 |
import java.awt.Graphics2D; |
|
7 |
import java.awt.Rectangle; |
|
8 |
import java.awt.Stroke; |
|
9 |
import java.awt.geom.AffineTransform; |
|
10 |
import java.awt.geom.Ellipse2D; |
|
11 |
import java.awt.geom.Point2D; |
|
12 |
import java.awt.geom.Rectangle2D; |
|
13 |
import java.awt.image.BufferedImage; |
|
14 |
import java.util.ArrayList; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
|
|
18 |
import org.cresques.cts.ICoordTrans; |
|
19 |
import org.slf4j.Logger; |
|
20 |
import org.slf4j.LoggerFactory; |
|
21 |
|
|
22 |
import org.gvsig.fmap.dal.exception.DataException; |
|
23 |
import org.gvsig.fmap.dal.feature.Feature; |
|
24 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
25 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
26 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
import org.gvsig.fmap.geom.Geometry; |
|
29 |
import org.gvsig.fmap.geom.primitive.Point; |
|
30 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
31 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
32 |
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException; |
|
33 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
34 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
|
35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
|
36 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegend; |
|
37 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend; |
|
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.DefaultFeatureDrawnNotification; |
|
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
|
40 |
import org.gvsig.tools.exception.BaseException; |
|
41 |
import org.gvsig.tools.logger.FilteredLogger; |
|
42 |
import org.gvsig.tools.task.Cancellable; |
|
43 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
44 |
import org.gvsig.tools.visitor.Visitor; |
|
45 |
|
|
46 |
public class DefaultAggregateLegend extends AbstractVectorialLegend implements AggregateLegend { |
|
47 |
|
|
48 |
private static class Group { |
|
49 |
|
|
50 |
private final Point pointGeo; |
|
51 |
private final Point pointPixels; |
|
52 |
private int count; |
|
53 |
private final Rectangle2D rectangle; |
|
54 |
private final Ellipse2D circle; |
|
55 |
|
|
56 |
public Group(Point pointGeo, Point pointPixels, double distance) { |
|
57 |
this.count = 1; |
|
58 |
this.pointGeo = pointGeo; |
|
59 |
this.pointPixels = pointPixels; |
|
60 |
double d2 = distance * 2; |
|
61 |
this.rectangle = new Rectangle2D.Double(pointPixels.getX() - distance, pointPixels.getY() - distance, d2, d2); |
|
62 |
this.circle = new Ellipse2D.Double(pointPixels.getX() - distance, pointPixels.getY() - distance, d2, d2); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean contains(Point pointPixels) { |
|
66 |
// return this.rectangle.contains(pointPixels.getX(), pointPixels.getY()); |
|
67 |
return this.circle.contains(pointPixels.getX(), pointPixels.getY()); |
|
68 |
} |
|
69 |
|
|
70 |
public void add(Feature feature) { |
|
71 |
this.count++; |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
private static final Logger LOG = LoggerFactory.getLogger(DefaultAggregateLegend.class); |
|
76 |
|
|
77 |
private int distance; // Pixels |
|
78 |
private List<Group> groups; |
|
79 |
private ITextSymbol textSymbol; |
|
80 |
private ILabelStyle labelStyle; |
|
81 |
|
|
82 |
public DefaultAggregateLegend() { |
|
83 |
this.textSymbol = new SimpleTextSymbol(); |
|
84 |
this.labelStyle = null; |
|
85 |
this.groups = null; |
|
86 |
this.distance = 30; |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
protected String[] getRequiredFeatureAttributeNames(FeatureStore featureStore) throws DataException { |
|
91 |
return new String[]{ |
|
92 |
featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}; |
|
93 |
} |
|
94 |
|
|
95 |
@Override |
|
96 |
public ISymbol getDefaultSymbol() { |
|
97 |
return this.textSymbol; |
|
98 |
} |
|
99 |
|
|
100 |
@Override |
|
101 |
public void setDefaultSymbol(ISymbol is) { |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
public ISymbol getSymbolByFeature(Feature ftr) throws MapContextException { |
|
106 |
return this.textSymbol; |
|
107 |
} |
|
108 |
|
|
109 |
@Override |
|
110 |
public int getShapeType() { |
|
111 |
return Geometry.TYPES.GEOMETRY; |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public void setShapeType(int i) { |
|
116 |
} |
|
117 |
|
|
118 |
@Override |
|
119 |
public boolean isUseDefaultSymbol() { |
|
120 |
return true; |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public void useDefaultSymbol(boolean bln) { |
|
125 |
} |
|
126 |
|
|
127 |
@Override |
|
128 |
public boolean isSuitableForShapeType(int shapeType) { |
|
129 |
return true; |
|
130 |
} |
|
131 |
|
|
132 |
@Override |
|
133 |
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 { |
|
134 |
super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans, featureStore, featureQuery, dpi); |
|
135 |
this.drawMarkers(image, g, cancel, viewPort.getAffineTransform()); |
|
136 |
} |
|
137 |
|
|
138 |
@Override |
|
139 |
protected void drawFeatures( |
|
140 |
BufferedImage image, |
|
141 |
Graphics2D g, |
|
142 |
final ViewPort viewPort, |
|
143 |
final Cancellable cancel, |
|
144 |
final ICoordTrans coordTrans, |
|
145 |
double dpi, |
|
146 |
DefaultFeatureDrawnNotification drawnNotification, |
|
147 |
FeatureSet featureSet, |
|
148 |
FeatureSelection selection |
|
149 |
) throws BaseException { |
|
150 |
this.groups = new ArrayList<>(); |
|
151 |
featureSet.accept(new Visitor() { |
|
152 |
@Override |
|
153 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
154 |
if( cancel.isCanceled() ) { |
|
155 |
throw new VisitCanceledException(); |
|
156 |
} |
|
157 |
Feature feature = (Feature) o; |
|
158 |
Geometry geom = feature.getDefaultGeometry(); |
|
159 |
if( geom != null ) { |
|
160 |
Point pointGeo = geom.centroid(); |
|
161 |
if( coordTrans != null ) { |
|
162 |
pointGeo.reProject(coordTrans); |
|
163 |
} |
|
164 |
Point pointPixels = (Point) pointGeo.cloneGeometry(); |
|
165 |
pointPixels.transform(viewPort.getAffineTransform()); |
|
166 |
boolean inGroup = false; |
|
167 |
for( Group group : groups ) { |
|
168 |
if( group.contains(pointPixels) ) { |
|
169 |
group.add(feature); |
|
170 |
inGroup = true; |
|
171 |
break; |
|
172 |
} |
|
173 |
} |
|
174 |
if( !inGroup ) { |
|
175 |
groups.add(new Group(pointGeo, pointPixels, getDistance())); |
|
176 |
} |
|
177 |
} |
|
178 |
} |
|
179 |
}); |
|
180 |
} |
|
181 |
|
|
182 |
private void drawMarkers(BufferedImage image, Graphics2D g1, Cancellable cancel, AffineTransform affineTransform) { |
|
183 |
FilteredLogger logger = new FilteredLogger(LOG, "", 10); |
|
184 |
AffineTransform identity = new AffineTransform(); |
|
185 |
Stroke stroke = g1.getStroke(); |
|
186 |
Color circlebg = new Color(0x80e29ea8, true); |
|
187 |
for( Group group : groups ) { |
|
188 |
if( cancel.isCanceled() ) { |
|
189 |
return; |
|
190 |
} |
|
191 |
final Graphics2D g = (Graphics2D)g1.create(); |
|
192 |
try { |
|
193 |
int x = (int) group.pointPixels.getX(); |
|
194 |
int y = (int) group.pointPixels.getY(); |
|
195 |
this.textSymbol.setDrawWithHalo(false); |
|
196 |
String txt = String.valueOf(group.count); |
|
197 |
this.textSymbol.setText(txt); |
|
198 |
if( this.labelStyle != null ) { |
|
199 |
Dimension size = this.labelStyle.getSize(); |
|
200 |
this.labelStyle.setTextFields(new String[]{ |
|
201 |
txt} |
|
202 |
); |
|
203 |
g.setTransform(identity); |
|
204 |
g.translate(x-size.getWidth()/2, y-size.getHeight()/2); |
|
205 |
Point2D markerPoint = this.labelStyle.getMarkerPoint(); |
|
206 |
Rectangle rect = new Rectangle( |
|
207 |
0, |
|
208 |
0, |
|
209 |
(int)size.getWidth(), |
|
210 |
(int)size.getHeight()); |
|
211 |
this.labelStyle.drawInsideRectangle(g, rect); |
|
212 |
Rectangle2D[] bounds = this.labelStyle.getTextBounds(); |
|
213 |
if(bounds.length>0){ |
|
214 |
Rectangle2D bound = bounds[0]; |
|
215 |
Rectangle2D expandedBound = new Rectangle2D.Double( |
|
216 |
bound.getMinX()*size.getWidth(), |
|
217 |
bound.getMinY()*size.getHeight(), |
|
218 |
bound.getWidth()*size.getWidth(), |
|
219 |
bound.getHeight()*size.getHeight()); |
|
220 |
drawCenteredString(txt, expandedBound, g); |
|
221 |
|
|
222 |
} |
|
223 |
g.translate(-(x-size.getWidth()/2), -(y-size.getHeight()/2)); |
|
224 |
} else { |
|
225 |
int r = distance; //2; |
|
226 |
g.setStroke(stroke); |
|
227 |
g.setColor(circlebg); |
|
228 |
g.fillOval( x-r, y-r, 2*r, 2*r); |
|
229 |
g.setColor(Color.BLACK); |
|
230 |
g.drawOval( x-r, y-r, 2*r, 2*r); |
|
231 |
g.drawRect( x-r, y-r, 2*r, 2*r); |
|
232 |
FontMetrics fm = g.getFontMetrics(); |
|
233 |
int txtX = x - (fm.stringWidth(txt) / 2); |
|
234 |
int txtY = fm.getAscent() + y - ((fm.getAscent() + fm.getDescent())) / 2; |
|
235 |
|
|
236 |
g.drawString(txt, txtX, txtY); |
|
237 |
} |
|
238 |
} catch (Exception ex) { |
|
239 |
logger.warn("Can't draw group",ex); |
|
240 |
} finally { |
|
241 |
g.dispose(); |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
|
|
246 |
private void drawCenteredString(String s, Rectangle2D rect, Graphics2D g) { |
|
247 |
|
|
248 |
double x = rect.getMinX(); |
|
249 |
double y = rect.getMinY(); |
|
250 |
double w = rect.getWidth(); |
|
251 |
double h = rect.getHeight(); |
|
252 |
|
|
253 |
FontMetrics fm = g.getFontMetrics(); |
|
254 |
int auxX = (int)(x+((w - fm.stringWidth(s)) / 2)); |
|
255 |
int auxY = (int)(y+((fm.getAscent() + (h - (fm.getAscent() + fm.getDescent())) / 2))); |
|
256 |
g.setColor(Color.BLACK); |
|
257 |
g.drawString(s, auxX, auxY); |
|
258 |
} |
|
259 |
|
|
260 |
@Override |
|
261 |
public int getDistance() { |
|
262 |
return distance; |
|
263 |
} |
|
264 |
|
|
265 |
@Override |
|
266 |
public void setDistance(int distance) { |
|
267 |
this.distance = distance; |
|
268 |
} |
|
269 |
|
|
270 |
@Override |
|
271 |
public ILabelStyle getLabelStyle() { |
|
272 |
return this.labelStyle; |
|
273 |
} |
|
274 |
|
|
275 |
@Override |
|
276 |
public void setLabelStyle(ILabelStyle labelStyle) { |
|
277 |
this.labelStyle = labelStyle; |
|
278 |
} |
|
279 |
|
|
280 |
@Override |
|
281 |
public ITextSymbol getTextSymbol() { |
|
282 |
return this.textSymbol; |
|
283 |
} |
|
284 |
|
|
285 |
@Override |
|
286 |
public void setTextSymbol(ITextSymbol textSymbol) { |
|
287 |
this.textSymbol = textSymbol; |
|
288 |
} |
|
289 |
|
|
290 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.legend.aggregate.lib.impl.AggregateLegendLibraryImpl |
|
0 | 2 |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.legend.aggregate.lib.api.AggregateLegendLibrary |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendLocator.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.aggregate.lib.api; |
|
24 |
|
|
25 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
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 AggregateLegendLocator extends AbstractLocator { |
|
32 |
|
|
33 |
/** |
|
34 |
* AggregateLegend locator name |
|
35 |
*/ |
|
36 |
private static final String LOCATOR_NAME = "AggregateLegendLocator"; |
|
37 |
|
|
38 |
/** |
|
39 |
* AggregateLegend manager name |
|
40 |
*/ |
|
41 |
public static final String MANAGER_NAME = "AggregateLegendManager"; |
|
42 |
|
|
43 |
/** |
|
44 |
* AggregateLegend manager description |
|
45 |
*/ |
|
46 |
private static final String MANAGER_DESCRIPTION = |
|
47 |
"AggregateLegend Manager of gvSIG"; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance |
|
52 |
*/ |
|
53 |
private static final AggregateLegendLocator instance = new AggregateLegendLocator(); |
|
54 |
|
|
55 |
@Override |
|
56 |
public String getLocatorName() { |
|
57 |
return LOCATOR_NAME; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Registers the Class implementing the AggregateLegendManager interface. |
|
62 |
* |
|
63 |
* @param clazz |
|
64 |
* implementing the AggregateLegendManager interface |
|
65 |
*/ |
|
66 |
public static void registerAggregateLegendManager(Class clazz){ |
|
67 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Registers the default Class implementing the AggregateLegendManager interface |
|
72 |
* |
|
73 |
* @param clazz |
|
74 |
* implementing the AggregateLegendManager interface |
|
75 |
*/ |
|
76 |
public static void registerDefaultAggregateLegendManager(Class clazz){ |
|
77 |
getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Return a reference to AggregateLegendManager. |
|
82 |
* |
|
83 |
* @return a reference to AggregateLegendManager |
|
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 AggregateLegendManager getAggregateLegendManager() throws LocatorException { |
|
90 |
return (AggregateLegendManager) getInstance().get(MANAGER_NAME); |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
public static Locator getInstance() { |
|
97 |
return instance; |
|
98 |
} |
|
99 |
|
|
100 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendLibrary.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.aggregate.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 |
/** |
|
31 |
* @author fdiaz |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class AggregateLegendLibrary extends AbstractLibrary { |
|
35 |
|
|
36 |
/* (non-Javadoc) |
|
37 |
* @see org.gvsig.tools.library.AbstractLibrary#doInitialize() |
|
38 |
*/ |
|
39 |
@Override |
|
40 |
protected void doInitialize() throws LibraryException { |
|
41 |
registerAsAPI(AggregateLegendLibrary.class); |
|
42 |
} |
|
43 |
|
|
44 |
/* (non-Javadoc) |
|
45 |
* @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize() |
|
46 |
*/ |
|
47 |
@Override |
|
48 |
protected void doPostInitialize() throws LibraryException { |
|
49 |
// Validate there is any implementation registered. |
|
50 |
AggregateLegendManager manager = AggregateLegendLocator.getAggregateLegendManager(); |
|
51 |
if (manager == null) { |
|
52 |
throw new ReferenceNotRegisteredException( |
|
53 |
AggregateLegendLocator.MANAGER_NAME, AggregateLegendLocator.getInstance()); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendManager.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.aggregate.lib.api; |
|
24 |
|
|
25 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
|
26 |
|
|
27 |
|
|
28 |
public interface AggregateLegendManager { |
|
29 |
|
|
30 |
/** |
|
31 |
* Creates an aggregate legend |
|
32 |
* |
|
33 |
* @return the aggregate legend |
|
34 |
*/ |
|
35 |
public AggregateLegend createAggregateLegend(); |
|
36 |
|
|
37 |
public Class<? extends AggregateLegend> getLegendClass(); |
|
38 |
|
|
39 |
public ILabelStyle getDefaultLabelStyle(); |
|
40 |
|
|
41 |
public void setDefaultLabelStyle(ILabelStyle defaultLabelStyle); |
|
42 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegend.java | ||
---|---|---|
1 |
package org.gvsig.legend.aggregate.lib.api; |
|
2 |
|
|
3 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
4 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
|
5 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
|
6 |
|
|
7 |
public interface AggregateLegend extends IVectorLegend { |
|
8 |
|
|
9 |
public int getDistance(); |
|
10 |
public void setDistance(int distance); |
|
11 |
|
|
12 |
public ILabelStyle getLabelStyle(); |
|
13 |
public void setLabelStyle(ILabelStyle labelStyle); |
|
14 |
|
|
15 |
public ITextSymbol getTextSymbol(); |
|
16 |
public void setTextSymbol(ITextSymbol textSymbol); |
|
17 |
} |
|
18 |
|
|
19 |
|
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.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.aggregate.lib.api</artifactId> |
|
5 |
<name>org.gvsig.legend.aggregate.lib.api</name> |
|
6 |
<parent> |
|
7 |
<groupId>org.gvsig</groupId> |
|
8 |
<artifactId>org.gvsig.legend.aggregate.lib</artifactId> |
|
9 |
<version>1.0.1</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> |
|
0 | 44 |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.swing/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.aggregate</artifactId> |
|
6 |
<version>1.0.1</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.aggregate.swing</artifactId> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>org.gvsig.legend.aggregate.swing</name> |
|
12 |
<modules> |
|
13 |
<module>org.gvsig.legend.aggregate.swing.api</module> |
|
14 |
<module>org.gvsig.legend.aggregate.swing.impl</module> |
|
15 |
</modules> |
|
16 |
</project> |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendSwingManager.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.aggregate.swing.impl; |
|
24 |
|
|
25 |
import org.gvsig.legend.aggregate.swing.api.AggregateLegendSwingManager; |
|
26 |
import org.gvsig.legend.aggregate.swing.api.AggregateLegendEditor; |
|
27 |
|
|
28 |
public class DefaultAggregateLegendSwingManager implements AggregateLegendSwingManager { |
|
29 |
|
|
30 |
@Override |
|
31 |
public AggregateLegendEditor createAggregatedLegendEditor() { |
|
32 |
return new DefaultAggregateLegendEditor(); |
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditor.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.legend.aggregate.swing.impl; |
|
3 |
|
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import javax.swing.ImageIcon; |
|
7 |
import javax.swing.JPanel; |
|
8 |
import org.gvsig.app.gui.styling.StyleSelector; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
11 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
12 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
|
13 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegend; |
|
14 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLocator; |
|
15 |
import org.gvsig.legend.aggregate.swing.api.AggregateLegendEditor; |
|
16 |
import org.gvsig.tools.ToolsLocator; |
|
17 |
import org.gvsig.tools.i18n.I18nManager; |
|
18 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
19 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
20 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
21 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
22 |
|
|
23 |
|
|
24 |
public class DefaultAggregateLegendEditor extends DefaultAggregateLegendEditorView implements AggregateLegendEditor { |
|
25 |
|
|
26 |
private static final long serialVersionUID = 4307714097793669675L; |
|
27 |
|
|
28 |
private final Class<? extends AggregateLegend> legendClass; |
|
29 |
private AggregateLegend legend; |
|
30 |
private FLayer layer; |
|
31 |
private ILabelStyle style; |
|
32 |
|
|
33 |
public DefaultAggregateLegendEditor() { |
|
34 |
this.legendClass = AggregateLegendLocator.getAggregateLegendManager().getLegendClass(); |
|
35 |
this.btnStyle.addActionListener(new ActionListener() { |
|
36 |
@Override |
|
37 |
public void actionPerformed(ActionEvent e) { |
|
38 |
doSelectLabelStyle(); |
|
39 |
} |
|
40 |
}); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public void setData(FLayer layer, ILegend legend) { |
|
45 |
this.layer = layer; |
|
46 |
if( this.getLegendClass().isInstance(legend) ) { |
|
47 |
this.legend = (AggregateLegend) legend; |
|
48 |
} else { |
|
49 |
this.legend = AggregateLegendLocator.getAggregateLegendManager().createAggregateLegend(); |
|
50 |
} |
|
51 |
this.txtDistance.setText(String.valueOf(this.legend.getDistance())); |
|
52 |
if( this.legend.getLabelStyle()!=null ) { |
|
53 |
this.txtStyle.setText(this.legend.getLabelStyle().getDescription()); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public ILegend getLegend() { |
|
59 |
|
|
60 |
int d; |
|
61 |
try { |
|
62 |
d = Integer.parseInt(this.txtDistance.getText()); |
|
63 |
} catch(Throwable th) { |
|
64 |
d = 30; |
|
65 |
} |
|
66 |
if( d<10 ) { |
|
67 |
d = 10; |
|
68 |
} |
|
69 |
legend.setDistance(d); |
|
70 |
legend.setLabelStyle(this.style); |
|
71 |
return legend; |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
public String getDescription() { |
|
76 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
77 |
return i18n.getTranslation( "_Aggregate_legend"); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public ImageIcon getIcon() { |
|
82 |
// TODO: |
|
83 |
return null; |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public Class getParentClass() { |
|
88 |
return null; |
|
89 |
} |
|
90 |
|
|
91 |
@Override |
|
92 |
public String getTitle() { |
|
93 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
94 |
return i18n.getTranslation( "_Aggregate_legend"); |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public JPanel getPanel() { |
|
99 |
return this; |
|
100 |
} |
|
101 |
|
|
102 |
@Override |
|
103 |
public Class getLegendClass() { |
|
104 |
return this.legendClass; |
|
105 |
} |
|
106 |
|
|
107 |
@Override |
|
108 |
public boolean isSuitableFor(FLayer layer) { |
|
109 |
return true; |
|
110 |
} |
|
111 |
|
|
112 |
private void doSelectLabelStyle() { |
|
113 |
WindowManager_v2 winmanager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
114 |
final StyleSelector styleSelector = new StyleSelector(this.style, Geometry.TYPES.POINT); |
|
115 |
winmanager.showWindow( |
|
116 |
styleSelector, |
|
117 |
"Select style", |
|
118 |
WindowManager.MODE.DIALOG |
|
119 |
); |
|
120 |
ILabelStyle x = (ILabelStyle) styleSelector.getSelectedObject(); |
|
121 |
if( x != null ) { |
|
122 |
this.style = x; |
|
123 |
} |
|
124 |
} |
|
125 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendSwingLibrary.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.aggregate.swing.impl; |
|
26 |
|
|
27 |
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLibrary; |
|
28 |
import org.gvsig.legend.aggregate.swing.api.AggregateLegendSwingLibrary; |
|
29 |
import org.gvsig.legend.aggregate.swing.api.AggregateLegendSwingLocator; |
|
30 |
import org.gvsig.symbology.swing.SymbologySwingLibrary; |
|
31 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
32 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
|
33 |
import org.gvsig.tools.library.AbstractLibrary; |
|
34 |
import org.gvsig.tools.library.LibraryException; |
|
35 |
|
|
36 |
|
|
37 |
public class DefaultAggregateLegendSwingLibrary extends AbstractLibrary { |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
@Override |
|
42 |
public void doRegistration() { |
|
43 |
registerAsImplementationOf(AggregateLegendSwingLibrary.class); |
|
44 |
require(SymbologySwingLibrary.class); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void doInitialize() throws LibraryException { |
|
49 |
AggregateLegendSwingLocator.registerAggregateLegendSwingManager(DefaultAggregateLegendSwingManager.class); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected void doPostInitialize() throws LibraryException { |
|
54 |
SymbologySwingManager symmnager = SymbologySwingLocator.getSwingManager(); |
|
55 |
symmnager.registerLegendEditor(DefaultAggregateLegendEditor.class); |
|
56 |
} |
|
57 |
|
|
58 |
} |
org.gvsig.legend.aggregate/tags/org.gvsig.legend.aggregate-1.0.1/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.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,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,FILL:DEFAULT:NONE,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"> |
Also available in: Unified diff