Revision 2493

View differences:

org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.main/src/main/resources/README.txt
1
Put into this folder the resources needed by your classes.
2

  
3
This folder is added to the classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your classes.
0 9

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.main/src/main/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.construc">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.main/src/main/java/org/gvsig/complexlegend/main/Main.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.complexlegend.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26

  
27
import javax.swing.JFrame;
28
import javax.swing.JPanel;
29
import javax.swing.UIManager;
30
import javax.swing.UnsupportedLookAndFeelException;
31
import javax.swing.WindowConstants;
32

  
33
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
34
import org.gvsig.fmap.mapcontrol.MapControlCreationException;
35
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
36
import org.gvsig.tools.locator.LocatorException;
37
import org.slf4j.Logger;
38
import org.slf4j.LoggerFactory;
39

  
40
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
41
import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
42

  
43
/**
44
 * Main executable class for testing the Chart library.
45
 * 
46
 * @author gvSIG Team
47
 * @version $Id$
48
 */
49
public class Main {
50

  
51
	private static final Logger LOG = LoggerFactory.getLogger(Main.class);
52

  
53
	public static void main(String args[]) throws MapControlCreationException,
54
			LocatorException, LoadLayerException, UnsupportedLookAndFeelException {
55
		new DefaultLibrariesInitializer().fullInitialize();
56
		
57
		PlasticLookAndFeel laf = new PlasticXPLookAndFeel();
58
		UIManager.setLookAndFeel(laf);
59
		
60
		Main main = new Main();
61
		main.show();
62
	}
63

  
64

  
65
	@SuppressWarnings("serial")
66
    public void show() throws MapControlCreationException, LocatorException, LoadLayerException {
67
        JFrame frame = new JFrame("Example APP");
68
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
69
        
70
        JPanel content = new JPanel();
71
        content.setLayout(new BorderLayout());
72
        
73
        frame.add(content);
74
        frame.setPreferredSize(new Dimension(510, 560));
75

  
76
        // Display the window.
77
        frame.pack();
78
        frame.setVisible(true);
79
    }
80

  
81
}
0 82

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.main/src/main/java/org/gvsig/complexlegend/main/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.construc package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Construc library testing and demo application.</p>
11

  
12
</body>
13
</html>
0 14

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.main/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<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/maven-v4_0_0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<artifactId>org.gvsig.complexlegend.main</artifactId>
5
	<packaging>jar</packaging>
6
	<name>org.gvsig.complexlegend.main</name>
7
	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.complexlegend</artifactId>
10
		<version>1.0.14-SNAPSHOT</version>
11
	</parent>
12

  
13

  
14
	<dependencies>
15
		<dependency>
16
			<groupId>org.gvsig</groupId>
17
			<artifactId>org.gvsig.complexlegend.lib.api</artifactId>
18
			<scope>compile</scope>
19
		</dependency>
20
		<dependency>
21
			<groupId>org.gvsig</groupId>
22
			<artifactId>org.gvsig.complexlegend.lib.impl</artifactId>
23
			<scope>runtime</scope>
24
		</dependency>
25
		<dependency>
26
			<groupId>org.gvsig</groupId>
27
			<artifactId>org.gvsig.complexlegend.swing.api</artifactId>
28
			<scope>compile</scope>
29
		</dependency>
30
		<dependency>
31
			<groupId>org.gvsig</groupId>
32
			<artifactId>org.gvsig.complexlegend.swing.impl</artifactId>
33
			<scope>runtime</scope>
34
		</dependency>
35
		<dependency>
36
			<groupId>org.gvsig</groupId>
37
			<artifactId>org.gvsig.tools.lib</artifactId>
38
			<scope>compile</scope>
39
		</dependency>
40
		<dependency>
41
			<groupId>org.gvsig</groupId>
42
			<artifactId>org.gvsig.tools.dynform.api</artifactId>
43
			<scope>compile</scope>
44
		</dependency>
45
		<dependency>
46
			<groupId>org.gvsig</groupId>
47
			<artifactId>org.gvsig.tools.dynform.impl</artifactId>
48
			<scope>runtime</scope>
49
		</dependency>
50

  
51
		<dependency>
52
			<groupId>org.gvsig</groupId>
53
			<artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
54
			<scope>compile</scope>
55
		</dependency>
56
		<dependency>
57
			<groupId>org.gvsig</groupId>
58
			<artifactId>org.gvsig.tools.swing.api</artifactId>
59
			<type>jar</type>
60
			<scope>compile</scope>
61
		</dependency>
62
		<dependency>
63
			<groupId>org.gvsig</groupId>
64
			<artifactId>org.gvsig.fmap.control</artifactId>
65
			<scope>compile</scope>
66
		</dependency>
67
		<dependency>
68
			<groupId>org.gvsig</groupId>
69
			<artifactId>org.gvsig.fmap.dal.api</artifactId>
70
			<scope>compile</scope>
71
		</dependency>
72
		<dependency>
73
			<groupId>org.gvsig</groupId>
74
			<artifactId>org.gvsig.fmap.dal.spi</artifactId>
75
			<scope>compile</scope>
76
		</dependency>
77
		<dependency>
78
			<groupId>org.gvsig</groupId>
79
			<artifactId>org.gvsig.fmap.geometry.api</artifactId>
80
			<scope>compile</scope>
81
		</dependency>
82
		<dependency>
83
			<groupId>org.gvsig</groupId>
84
			<artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
85
			<scope>compile</scope>
86
		</dependency>
87

  
88

  
89
		<dependency>
90
			<groupId>org.gvsig</groupId>
91
			<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId>
92
			<scope>runtime</scope>
93
		</dependency>
94
        <dependency>
95
            <groupId>org.gvsig</groupId>
96
            <artifactId>org.gvsig.fmap.geometry.operation.jts</artifactId>
97
			<scope>runtime</scope>
98
        </dependency>
99
		<dependency>
100
			<groupId>org.gvsig</groupId>
101
			<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
102
			<scope>runtime</scope>
103
		</dependency>
104
        <dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>
107
			<scope>runtime</scope>
108
        </dependency>
109
		<dependency>
110
			<groupId>org.gvsig</groupId>
111
			<artifactId>org.gvsig.fmap.dal.impl</artifactId>
112
			<scope>runtime</scope>
113
		</dependency>
114
		<dependency>
115
			<groupId>org.gvsig</groupId>
116
			<artifactId>org.gvsig.fmap.dal.spi</artifactId>
117
			<scope>runtime</scope>
118
		</dependency>
119
        <dependency>
120
            <groupId>org.gvsig</groupId>
121
            <artifactId>org.gvsig.fmap.dal.file.shp</artifactId>
122
			<scope>runtime</scope>
123
        </dependency>
124
        <dependency>
125
            <groupId>org.gvsig</groupId>
126
            <artifactId>org.gvsig.fmap.dal.file.dbf</artifactId>
127
			<scope>runtime</scope>
128
        </dependency>
129
        <dependency>
130
            <groupId>org.gvsig</groupId>
131
            <artifactId>org.gvsig.fmap.dal.file.lib</artifactId>
132
			<scope>runtime</scope>
133
        </dependency>
134
        <dependency>
135
             <groupId>org.gvsig</groupId>
136
             <artifactId>org.gvsig.timesupport.lib.api</artifactId>
137
			<scope>runtime</scope>
138
         </dependency>
139
         <dependency>
140
             <groupId>org.gvsig</groupId>
141
             <artifactId>org.gvsig.timesupport.lib.impl</artifactId>
142
			<scope>runtime</scope>
143
         </dependency>
144
         <dependency>
145
             <groupId>org.gvsig</groupId>
146
             <artifactId>org.gvsig.tools.evaluator.sqljep</artifactId>
147
			<scope>runtime</scope>
148
         </dependency>
149
         <dependency>
150
             <groupId>org.gvsig</groupId>
151
             <artifactId>org.gvsig.proj.lib.proj4j</artifactId>
152
			<scope>runtime</scope>
153
		</dependency>
154
	</dependencies>
155
</project>
0 156

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<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/maven-v4_0_0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<artifactId>org.gvsig.complexlegend.lib.api</artifactId>
5
	<packaging>jar</packaging>
6
	<name>org.gvsig.complexlegend.lib.api</name>
7
	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.complexlegend.lib</artifactId>
10
		<version>1.0.77</version>
11
	</parent>
12
	<dependencies>
13
		<dependency>
14
			<groupId>org.gvsig</groupId>
15
			<artifactId>org.gvsig.fmap.geometry.api</artifactId>
16
			<scope>compile</scope>
17
		</dependency>
18
		<dependency>
19
			<groupId>org.gvsig</groupId>
20
			<artifactId>org.gvsig.fmap.dal.api</artifactId>
21
			<scope>compile</scope>
22
		</dependency>
23
		<dependency>
24
			<groupId>org.gvsig</groupId>
25
			<artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
26
            <scope>compile</scope>
27
		</dependency>
28
		<dependency>
29
			<groupId>org.gvsig</groupId>
30
			<artifactId>org.gvsig.symbology.lib.api</artifactId>
31
            <scope>compile</scope>
32
		</dependency>
33
	</dependencies>
34
	<build>
35
		<plugins>
36
			<plugin>
37
				<groupId>org.apache.maven.plugins</groupId>
38
				<artifactId>maven-jar-plugin</artifactId>
39
				<configuration>
40
				</configuration>
41
				<executions>
42
					<!-- Generates a jar file only with the test classes -->
43
					<execution>
44
						<goals>
45
							<goal>test-jar</goal>
46
						</goals>
47
					</execution>
48
				</executions>
49
			</plugin>
50
		</plugins>
51
	</build>
52

  
53
</project>
0 54

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/test/resources/README.txt
1
Put into this folder the resources needed by your classes.
2

  
3
This folder is added to the classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your classes.
0 9

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.construc">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.complexlegend.ComplexLegendLibrary
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/java/org/gvsig/complexlegend/ComplexLegendItem.java
1
package org.gvsig.complexlegend;
2

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

  
5
public interface ComplexLegendItem {
6
	
7
	public ILegend getLegend();
8
	public void setLegend(ILegend legend);
9
	
10
	public double getMaxScale();
11
	public void setMaxScale(double maxScale);
12
	
13
	public double getMinScale();
14
	public void setMinScale(double maxScale);
15
	
16
	public String toString();
17
}
0 18

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/java/org/gvsig/complexlegend/VectorComplexLegend.java
1
package org.gvsig.complexlegend;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
6
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
7

  
8
public interface VectorComplexLegend extends IVectorLegend, IClassifiedLegend{
9

  
10
	public List<ComplexLegendItem> getLegends();
11
	
12
	public boolean add(ComplexLegendItem legend);
13
	public boolean remove(ComplexLegendItem legend);
14
	
15
	public boolean isOverlapped(ComplexLegendItem legend);
16
	public ComplexLegendItem getLegend(double scale);
17
}
0 18

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/java/org/gvsig/complexlegend/ComplexLegendLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.complexlegend;
23

  
24
import org.gvsig.fmap.dal.DALLibrary;
25
import org.gvsig.fmap.geom.GeometryLibrary;
26
import org.gvsig.symbology.SymbologyLibrary;
27
import org.gvsig.tools.ToolsLibrary;
28
import org.gvsig.tools.library.AbstractLibrary;
29
import org.gvsig.tools.library.LibraryException;
30

  
31

  
32
/**
33
 * Library for API initialization and configuration.
34
 * 
35
 * @author gvSIG team
36
 * @version $Id$
37
 */
38
public class ComplexLegendLibrary extends AbstractLibrary {
39

  
40
    @Override
41
	public void doRegistration() {
42
		registerAsAPI(ComplexLegendLibrary.class);
43
		this.require(ToolsLibrary.class);
44
	    this.require(GeometryLibrary.class);
45
	    this.require(SymbologyLibrary.class);
46
	}
47
	
48
	
49
    @Override
50
    protected void doInitialize() throws LibraryException {
51
        // Do nothing
52
    }
53

  
54
    @Override
55
    protected void doPostInitialize() throws LibraryException {
56
    	 
57
    }
58

  
59
}
0 60

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/java/org/gvsig/complexlabel/ComplexLabelClass.java
1
package org.gvsig.complexlabel;
2

  
3
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
4

  
5
public interface ComplexLabelClass extends ILabelClass{
6

  
7
	public double getMinScale();
8
	
9
	public double getMaxScale();
10
	
11
	public void setMinScale(double scale);
12
	
13
	public void setMaxScale(double scale);
14
	
15
}
0 16

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.api/src/main/java/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>LandRegistryViewer library API.</p>
11
	
12
	<p>
13
	It allows to get new LandRegistryViewer and get their text.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<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">
3

  
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.complexlegend.lib</artifactId>
6
	<packaging>pom</packaging>
7
	<name>org.gvsig.complexlegend.lib</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.complexlegend</artifactId>
11
		<version>1.0.77</version>
12
	</parent>
13
	<dependencies>
14
	</dependencies>
15
	<modules>
16
		<module>org.gvsig.complexlegend.lib.api</module>
17
		<module>org.gvsig.complexlegend.lib.impl</module>
18
	</modules>
19
</project>
0 20

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.chart">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="DEBUG" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.complexlegend.impl.DefaultComplexLegendLibrary
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>LandRegistryViewer library API default implementation.</p>
11

  
12
</body>
13
</html>
0 14

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlegend/impl/ComplexLegendUtils.java
1
package org.gvsig.complexlegend.impl;
2

  
3
import java.util.Iterator;
4
import java.util.List;
5

  
6
import org.gvsig.app.project.documents.view.legend.gui.AbstractParentPanel;
7
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel;
8
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
9
import org.gvsig.symbology.swing.SymbologySwingLocator;
10

  
11
public class ComplexLegendUtils {
12
	
13
	public static ILegendPanel getLegendPanel(ILegend legend){
14
		List panels = SymbologySwingLocator.getSwingManager().getLegendEditorClasses();
15
		Iterator it = panels.iterator();
16
		while(it.hasNext()){
17
			Class panelClass = (Class) it.next();
18
			ILegendPanel panel;
19
			try {
20
				panel = (ILegendPanel) panelClass.newInstance();
21
				if(!(panel instanceof AbstractParentPanel)){
22
					if(panel.getLegendClass().equals(legend.getClass())){
23
						return panel;
24
					}
25
				}
26
			} catch (Exception e) {
27
				return null;
28
			}
29
		}
30
		return null;
31
	}
32
	
33
}
0 34

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlegend/impl/DefaultComplexLegendItem.java
1
package org.gvsig.complexlegend.impl;
2

  
3
import java.text.NumberFormat;
4

  
5
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel;
6
import org.gvsig.complexlegend.ComplexLegendItem;
7
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
8
import org.gvsig.tools.ToolsLocator;
9
import org.gvsig.tools.dynobject.DynStruct;
10
import org.gvsig.tools.persistence.PersistenceManager;
11
import org.gvsig.tools.persistence.Persistent;
12
import org.gvsig.tools.persistence.PersistentState;
13
import org.gvsig.tools.persistence.exception.PersistenceException;
14
import org.gvsig.tools.util.Callable;
15
import org.slf4j.Logger;
16
import org.slf4j.LoggerFactory;
17

  
18
public class DefaultComplexLegendItem implements ComplexLegendItem, Persistent{
19

  
20
	public static final Logger logger = LoggerFactory.getLogger(DefaultComplexLegendItem.class);
21
	public static final String COMPLEX_LEGEND_ITEM_PERSISTENCE_DEFINITION_NAME = "ComplexLegendItem";
22
	private ILegend legend;
23
	private double maxScale;
24
	private double minScale;
25

  
26
	public ILegend getLegend() {
27
		return legend;
28
	}
29

  
30
	public void setLegend(ILegend legend) {
31
		this.legend = legend;		
32
	}
33

  
34
	public double getMaxScale() {
35
		return maxScale;
36
	}
37

  
38
	public void setMaxScale(double maxScale) {
39
		this.maxScale = maxScale;
40
	}
41

  
42
	public double getMinScale() {
43
		return minScale;
44
	}
45

  
46
	public void setMinScale(double minScale) {
47
		this.minScale = minScale;
48
	}
49
	
50
	public String toString(){
51
		
52
		String panel = "";
53
		if(legend != null){
54
			ILegendPanel legPanel = ComplexLegendUtils.getLegendPanel(legend);
55
			if(legPanel != null){
56
				panel = " "+ legPanel.getTitle();
57
			}
58
		}
59
		
60
		Double mind = (Double) getMinScale();
61
		String min = "0";
62
		if(mind >= 0){
63
			int mini = mind.intValue();
64
			min = NumberFormat.getIntegerInstance().format(mini);
65
		}
66
		
67
		Double maxd = (Double) getMaxScale();
68
		String max = "inf";
69
		if(maxd >= 0){
70
			int maxi = maxd.intValue();
71
			max = NumberFormat.getIntegerInstance().format(maxi);
72
		}
73
		return "[1:"+min+" - 1:"+max+"]"+ panel;
74
	}
75

  
76
	
77
	public void loadFromState(PersistentState state)
78
			throws PersistenceException {
79
		// Set own properties
80
		setLegend((ILegend) state.get("legend"));
81
		setMinScale(state.getDouble("minScale"));
82
		setMaxScale(state.getDouble("maxScale"));
83
	}
84

  
85
	public void saveToState(PersistentState state) throws PersistenceException {
86
		// Save own properties
87
		state.set("legend", getLegend());
88
		state.set("minScale", getMinScale());
89
		state.set("maxScale", getMaxScale());
90
	}
91
	
92
	
93
	public static class RegisterPersistence implements Callable {
94

  
95
		public Object call() throws Exception {
96
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
97
			if( manager.getDefinition(
98
					COMPLEX_LEGEND_ITEM_PERSISTENCE_DEFINITION_NAME)==null ) {
99
				DynStruct definition = manager.addDefinition(
100
						DefaultComplexLegendItem.class,
101
						COMPLEX_LEGEND_ITEM_PERSISTENCE_DEFINITION_NAME,
102
						COMPLEX_LEGEND_ITEM_PERSISTENCE_DEFINITION_NAME +
103
						" Persistence definition",
104
						null, 
105
						null
106
						);
107

  
108
				definition.addDynFieldObject("legend").setMandatory(true)
109
				.setClassOfValue(ILegend.class);
110
				definition.addDynFieldDouble("minScale").setMandatory(true);
111
				definition.addDynFieldDouble("maxScale").setMandatory(true);
112
			}
113
			return Boolean.TRUE;
114
		}
115

  
116
	}
117

  
118
}
0 119

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlegend/impl/DefaultVectorComplexLegend.java
1
package org.gvsig.complexlegend.impl;
2

  
3
import java.awt.Graphics2D;
4
import java.awt.image.BufferedImage;
5
import java.util.ArrayList;
6
import java.util.Collections;
7
import java.util.Comparator;
8
import java.util.Iterator;
9
import java.util.List;
10
import java.util.Map;
11

  
12
import org.cresques.cts.ICoordTrans;
13
import org.gvsig.compat.print.PrintAttributes;
14
import org.gvsig.complexlegend.ComplexLegendItem;
15
import org.gvsig.complexlegend.VectorComplexLegend;
16
import org.gvsig.fmap.dal.exception.DataException;
17
import org.gvsig.fmap.dal.feature.Feature;
18
import org.gvsig.fmap.dal.feature.FeatureQuery;
19
import org.gvsig.fmap.dal.feature.FeatureStore;
20
import org.gvsig.fmap.geom.Geometry;
21
import org.gvsig.fmap.mapcontext.MapContextException;
22
import org.gvsig.fmap.mapcontext.MapContextLocator;
23
import org.gvsig.fmap.mapcontext.MapContextManager;
24
import org.gvsig.fmap.mapcontext.ViewPort;
25
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
26
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
27
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
28
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
29
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
30
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
31
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.dynobject.DynStruct;
34
import org.gvsig.tools.persistence.PersistenceManager;
35
import org.gvsig.tools.persistence.Persistent;
36
import org.gvsig.tools.persistence.PersistentState;
37
import org.gvsig.tools.persistence.exception.PersistenceException;
38
import org.gvsig.tools.task.Cancellable;
39
import org.gvsig.tools.util.Callable;
40

  
41
public class DefaultVectorComplexLegend extends AbstractVectorialLegend implements VectorComplexLegend, Persistent{
42

  
43
	public static final String COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME = "ComplexLegendPersistence";
44
	public static final String COMPLEX_LEGEND_NAME = "ComplexLegend";
45
	public static final String COMPLEX_LEGEND_FIELD = "Legends";
46
	private List<ComplexLegendItem> legends;
47
	private boolean useDefault;
48
	private int shapeType;
49
	private ISymbol defaultSymbol;
50
	private IVectorLegend currentLegend;
51

  
52
	public DefaultVectorComplexLegend() {
53
		super();
54
		SymbolManager manager = MapContextLocator.getSymbolManager();
55
		this.defaultSymbol = manager.createSymbol( Geometry.TYPES.SURFACE);
56
	}
57
	
58
	public List<ComplexLegendItem> getLegends() {
59
		if(legends == null){
60
			legends = new ArrayList<ComplexLegendItem>();
61
		}
62
		return Collections.unmodifiableList(legends);
63
	}
64
	
65
	public List<ComplexLegendItem> getEditedLegends() {
66
		if(legends == null){
67
			legends = new ArrayList<ComplexLegendItem>();
68
		}
69
		return legends;
70
	}
71
	
72
	public boolean isOverlapped(ComplexLegendItem legend) {
73
		Iterator it = getLegends().iterator();
74
		while(it.hasNext()){
75
			ComplexLegendItem aux = (ComplexLegendItem) it.next();
76
			if((aux.getMinScale()==-1 && 
77
					aux.getMaxScale()>legend.getMinScale())){
78
				return true;
79
			}
80
			if((aux.getMaxScale()==-1 && 
81
					aux.getMinScale()<legend.getMaxScale())){
82
				return true;
83
			}
84
			if(!(aux.getMinScale()>=legend.getMaxScale() || 
85
					aux.getMaxScale()<=legend.getMinScale())){
86
				return true;
87
			}
88
		}
89
		return false;
90
	}
91

  
92
	public boolean add(ComplexLegendItem legend) {
93
		if(legends == null){
94
			getLegends();
95
		}
96
		
97
		boolean result = legends.add(legend);
98
		Collections.sort(legends, new Comparator<ComplexLegendItem>(){
99
		     public int compare(ComplexLegendItem o1, ComplexLegendItem o2){
100
		         if(o1.getMinScale() == o2.getMinScale())
101
		             return 0;
102
		         return o1.getMinScale() < o2.getMinScale() ? -1 : 1;
103
		     }
104
		});
105
		return result;
106
	}
107
	
108
	public boolean remove(ComplexLegendItem legend) {
109
		if(legends == null){
110
			getLegends();
111
		}
112
		return legends.remove(legend);
113
	}
114

  
115
	public ComplexLegendItem getLegend(double scale) {
116
		Iterator<ComplexLegendItem> it = getLegends().iterator();
117
		while(it.hasNext()){
118
			ComplexLegendItem cleg = (ComplexLegendItem) it.next();
119
			if(cleg.getMinScale() == -1 &&
120
					cleg.getMaxScale() >= scale){
121
				return cleg;
122
			}
123
			if(cleg.getMinScale() <= scale &&
124
					cleg.getMaxScale() >= scale){
125
				return cleg;
126
			}
127
			if(cleg.getMinScale() <= scale &&
128
					cleg.getMaxScale() == -1){
129
				return cleg;
130
			}
131
		}
132
		return null;
133
	}
134

  
135

  
136
	@Override
137
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
138
			double scale, Map queryParameters, ICoordTrans coordTrans,
139
			FeatureStore featureStore, FeatureQuery fquery,
140
			PrintAttributes properties) throws LegendException {
141
		ComplexLegendItem legend = getLegend(scale);
142
		if(legend != null){
143
			if(legend.getLegend() != null &&
144
					legend.getLegend() instanceof AbstractVectorialLegend){
145
				setCurrentLegend((IVectorLegend)legend.getLegend());
146
				((AbstractVectorialLegend) legend.getLegend()).print(g, viewPort, cancel, scale, queryParameters, coordTrans,
147
						featureStore, fquery, properties);
148
			}
149
		}
150
	}
151

  
152
	@Override
153
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
154
			double scale, Map queryParameters, ICoordTrans coordTrans,
155
			FeatureStore featureStore, PrintAttributes properties)
156
					throws LegendException {
157
		print(g, viewPort, cancel, scale, queryParameters, coordTrans,
158
				featureStore, null, properties);
159
	}
160

  
161
	@Override
162
	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
163
			Cancellable cancel, double scale, Map queryParameters,
164
			ICoordTrans coordTrans, FeatureStore featureStore)
165
					throws LegendException {
166
		ComplexLegendItem legend = getLegend(scale);
167
		if(legend != null){
168
			if(legend.getLegend() != null &&
169
					legend.getLegend() instanceof AbstractVectorialLegend){
170
				setCurrentLegend((IVectorLegend)legend.getLegend());
171
				((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
172
						featureStore);
173
			}
174
		}
175
	}
176

  
177
	@Override
178
	protected void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
179
			Cancellable cancel, double scale, Map queryParameters,
180
			ICoordTrans coordTrans, FeatureStore featureStore,
181
			FeatureQuery featureQuery, double dpi) throws LegendException {
182
		ComplexLegendItem legend = getLegend(scale);
183
		if(legend != null){
184
			if(legend.getLegend() != null &&
185
					legend.getLegend() instanceof AbstractVectorialLegend){
186
				setCurrentLegend((IVectorLegend)legend.getLegend());
187
				((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
188
						featureStore, featureQuery);
189
			}
190
		}
191
	}
192

  
193

  
194
	private void setCurrentLegend(IVectorLegend legend) {
195
		boolean changed = this.currentLegend != legend;
196
		this.currentLegend = legend;
197

  
198
		if(changed){
199
			fireDefaultSymbolChangedEvent(new ComplexLegendChangedEvent());
200
		}
201
		//this.currentLegend.setShapeType(this.getShapeType());
202
	}
203

  
204

  
205
	public static class RegisterPersistence implements Callable {
206

  
207
		public Object call() throws Exception {
208
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
209
			if (manager.getDefinition(
210
					COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) {
211
				DynStruct definition = manager
212
						.addDefinition(DefaultVectorComplexLegend.class,
213
								COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME,
214
								COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME
215
								+ " Persistence definition", null, null);
216

  
217
				definition.extend(manager.getDefinition(
218
						AbstractVectorialLegend.VECTORIAL_LEGEND_PERSISTENCE_DEFINITION_NAME));
219

  
220
				definition.addDynFieldList(COMPLEX_LEGEND_FIELD).setClassOfItems(DefaultComplexLegendItem.class);
221
			}
222
			return Boolean.TRUE;
223
		}
224

  
225
	}
226

  
227
	public void loadFromState(PersistentState state)
228
			throws PersistenceException {
229
		super.loadFromState(state);
230
		setLegends(state.getList(COMPLEX_LEGEND_FIELD));
231
	}
232

  
233
	private void setLegends(List list) {
234
		this.legends = list;
235
	}
236

  
237
	public void saveToState(PersistentState state) throws PersistenceException {
238
		super.saveToState(state);
239
		state.set(COMPLEX_LEGEND_FIELD, getEditedLegends());
240
	}
241

  
242
	public static class RegisterLegend implements Callable {
243

  
244
		public Object call() throws Exception {
245
			MapContextManager manager =	MapContextLocator.getMapContextManager();
246

  
247
			manager.registerLegend(
248
					COMPLEX_LEGEND_NAME,
249
					DefaultVectorComplexLegend.class);
250

  
251
			return Boolean.TRUE;
252
		}
253

  
254
	}
255

  
256
	public ISymbol getSymbolByFeature(Feature feat) throws MapContextException {
257
		if(this.currentLegend != null 
258
				&& this.currentLegend instanceof IVectorLegend){
259
			return ((IVectorLegend)this.currentLegend).getSymbolByFeature(feat);
260
		}
261
		return null;
262
	}
263

  
264
	public int getShapeType() {
265
		return this.shapeType;
266
	}
267

  
268
	public void setShapeType(int shapeType) {
269
		this.shapeType = shapeType;
270
		SymbolManager manager = MapContextLocator.getSymbolManager();
271
		this.defaultSymbol = manager.createSymbol(shapeType);
272
	}
273

  
274
	public void setDefaultSymbol(ISymbol s) {
275
		this.defaultSymbol = s;
276
	}
277

  
278
	public boolean isUseDefaultSymbol() {
279
		return useDefault;
280
	}
281

  
282
	public void useDefaultSymbol(boolean b) {
283
		this.useDefault = b;
284
	}
285

  
286
	public boolean isSuitableForShapeType(int shapeType) {
287
		return true;
288
	}
289

  
290
	public ISymbol getDefaultSymbol() {
291
		return defaultSymbol;
292
	}
293

  
294
	@Override
295
	protected String[] getRequiredFeatureAttributeNames(
296
			FeatureStore featureStore) throws DataException {
297
		// TODO Auto-generated method stub
298
		return null;
299
	}
300

  
301
	public String[] getDescriptions() {
302
		if(currentLegend instanceof IClassifiedLegend){
303
			return ((IClassifiedLegend) currentLegend).getDescriptions();
304
		}
305
		return new String[]{""};
306
	}
307

  
308
	public ISymbol[] getSymbols() {
309
		if(currentLegend instanceof IClassifiedLegend){
310
			return ((IClassifiedLegend) currentLegend).getSymbols();
311
		}
312
		if(currentLegend == null){
313
			if(getDefaultSymbol() != null){
314
				return new ISymbol[]{getDefaultSymbol()};
315
			}
316
			SymbolManager manager = MapContextLocator.getSymbolManager();
317
			return new ISymbol[]{manager.createSymbol(shapeType)};
318
		}
319
		return new ISymbol[]{currentLegend.getDefaultSymbol()};
320
	}
321

  
322
	public Object[] getValues() {
323
		if(currentLegend instanceof IClassifiedLegend){
324
			return ((IClassifiedLegend) currentLegend).getValues();
325
		}
326
		return new String[]{""};
327
	}
328

  
329
	private static class ComplexLegendChangedEvent extends SymbolLegendEvent{
330

  
331
	public ComplexLegendChangedEvent() {
332
		super(null, null);
333
	}
334

  
335
	@Override
336
	public int getEventType() {
337
		return SymbolLegendEvent.LEGEND_VALUE_CHANGED;
338
	}
339
	}
340
	
341
}
0 342

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlegend/impl/DefaultComplexLegendLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.complexlegend.impl;
23

  
24

  
25
import org.gvsig.complexlabel.impl.ComplexLabelClassFactory;
26
import org.gvsig.complexlabel.impl.DefaultComplexLabelClass;
27
import org.gvsig.complexlegend.ComplexLegendLibrary;
28
import org.gvsig.complexlegend.VectorComplexLegend;
29
import org.gvsig.fmap.mapcontext.MapContextLocator;
30
import org.gvsig.fmap.mapcontext.MapContextManager;
31
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
32
import org.gvsig.symbology.SymbologyLocator;
33
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendWriter;
34
import org.gvsig.tools.library.AbstractLibrary;
35
import org.gvsig.tools.library.LibraryException;
36
import org.gvsig.tools.util.Caller;
37
import org.gvsig.tools.util.impl.DefaultCaller;
38

  
39
/**
40
 * Library for default implementation initialization and configuration.
41
 * This default implementation will be based in JFreeChart library.
42
 * 
43
 * @author gvSIG team
44
 * @version $Id$
45
 */
46
public class DefaultComplexLegendLibrary extends AbstractLibrary {
47

  
48
	@Override
49
	public void doRegistration() {
50
		registerAsImplementationOf(ComplexLegendLibrary.class);
51
	}
52
    
53
    
54
    @Override
55
    protected void doInitialize() throws LibraryException {
56
    }
57

  
58
    @Override
59
    protected void doPostInitialize() throws LibraryException {
60
        Caller caller = new DefaultCaller();
61
        caller.add(new DefaultVectorComplexLegend.RegisterLegend());
62
        caller.add(new DefaultVectorComplexLegend.RegisterPersistence());
63
        caller.add(new DefaultComplexLegendItem.RegisterPersistence());
64
        caller.add(new DefaultComplexLabelClass.RegisterPersistence());
65
        
66
        if( !caller.call() ) {
67
        	throw new LibraryException(DefaultComplexLegendLibrary.class, caller.getExceptions());
68
        }
69
        
70
        MapContextManager mcoman = MapContextLocator.getMapContextManager();
71
        mcoman.registerLegendWriter(
72
        	VectorComplexLegend.class,
73
            SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
74
            PersistenceBasedLegendWriter.class);
75
        
76
        SymbologyLocator.getSymbologyManager().registerLabelClass(new ComplexLabelClassFactory());
77
        
78
    }
79

  
80
}
0 81

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlabel/impl/ComplexLabelClassFactory.java
1
package org.gvsig.complexlabel.impl;
2

  
3
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
4
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClassFactory;
5
import org.gvsig.tools.ToolsLocator;
6
import org.gvsig.tools.i18n.I18nManager;
7

  
8
public class ComplexLabelClassFactory implements ILabelClassFactory {
9

  
10
	public static final String FACTORY_ID = "MultipleLabelByScale";
11
	I18nManager i18nManager = ToolsLocator.getI18nManager();
12

  
13
	
14
	public ILabelClass create() {
15
		return new DefaultComplexLabelClass();
16
	}
17

  
18
	public String getID() {
19
		return FACTORY_ID;
20
	}
21

  
22
	public String getName() {
23
		return i18nManager.getTranslation("multiple_label_by_scale");
24
	}
25

  
26
	public String toString() {
27
		return this.getName();
28
	}
29
}
0 30

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.77/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/src/main/java/org/gvsig/complexlabel/impl/DefaultComplexLabelClass.java
1
package org.gvsig.complexlabel.impl;
2

  
3

  
4
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelClass;
5
import org.gvsig.tools.ToolsLocator;
6
import org.gvsig.tools.dynobject.DynStruct;
7
import org.gvsig.tools.persistence.PersistenceManager;
8
import org.gvsig.tools.persistence.Persistent;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff