Revision 9497

View differences:

org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.236/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.236/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.236/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.236/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.236/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.236/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.236</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.236/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 extends org.gvsig.tools.lang.Cloneable{
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.236/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
        
18
        public boolean getAllowOverlap();
19
        public void setAllowOverlap(boolean allowOverlap);
20
}
0 21

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.236/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.236/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.236/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.236/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.236/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.236/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.236/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.236</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.236/org.gvsig.complexlegend/org.gvsig.complexlegend.lib/org.gvsig.complexlegend.lib.impl/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.impl</artifactId>
5
	<packaging>jar</packaging>
6
	<name>org.gvsig.complexlegend.lib.impl</name>
7
	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.complexlegend.lib</artifactId>
10
		<version>1.0.236</version>
11
	</parent>
12

  
13
	<dependencies>
14
		<dependency>
15
			<groupId>org.gvsig</groupId>
16
			<artifactId>org.gvsig.complexlegend.lib.api</artifactId>
17
			<scope>compile</scope>
18
		</dependency>
19
		 <dependency>
20
            <groupId>org.gvsig</groupId>
21
            <artifactId>org.gvsig.symbology.lib.api</artifactId>
22
            <scope>compile</scope>
23
        </dependency>
24
        <dependency>
25
            <groupId>org.gvsig</groupId>
26
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>
27
            <scope>compile</scope>
28
        </dependency>
29
        <dependency>
30
            <groupId>org.gvsig</groupId>
31
            <artifactId>org.gvsig.symbology.swing.api</artifactId>
32
            <scope>compile</scope>
33
        </dependency>
34
        <dependency>
35
            <groupId>org.gvsig</groupId>
36
            <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
37
            <scope>compile</scope>
38
        </dependency>
39
        <dependency>
40
			<groupId>org.gvsig</groupId>
41
			<artifactId> org.gvsig.app.mainplugin</artifactId>
42
			<scope>compile</scope>
43
		</dependency>
44
	</dependencies>
45
</project>
0 46

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.236/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.236/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.236/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.236/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.236/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.236/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.236/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
    public void loadFromState(PersistentState state)
77
            throws PersistenceException {
78
        // Set own properties
79
        setLegend((ILegend) state.get("legend"));
80
        setMinScale(state.getDouble("minScale"));
81
        setMaxScale(state.getDouble("maxScale"));
82
    }
83

  
84
    public void saveToState(PersistentState state) throws PersistenceException {
85
        // Save own properties
86
        state.set("legend", getLegend());
87
        state.set("minScale", getMinScale());
88
        state.set("maxScale", getMaxScale());
89
    }
90

  
91
    public static class RegisterPersistence implements Callable {
92

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

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

  
114
    }
115

  
116
    @Override
117
    public Object clone() throws CloneNotSupportedException {
118
        DefaultComplexLegendItem cloned = (DefaultComplexLegendItem) super.clone(); //To change body of generated methods, choose Tools | Templates.
119
        cloned.legend = (ILegend) this.legend.clone();
120
        return cloned;
121
    }
122
}
0 123

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.236/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.geom.AffineTransform;
5
import java.awt.image.BufferedImage;
6
import java.util.ArrayList;
7
import java.util.Collections;
8
import java.util.Comparator;
9
import java.util.Iterator;
10
import java.util.List;
11
import java.util.Map;
12

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

  
46
public class DefaultVectorComplexLegend extends AbstractVectorialLegend implements VectorComplexLegend, Persistent {
47

  
48
    public static final String COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME = "ComplexLegendPersistence";
49
    public static final String COMPLEX_LEGEND_NAME = "ComplexLegend";
50
    public static final String COMPLEX_LEGEND_FIELD = "Legends";
51
    private List<ComplexLegendItem> legends;
52
    private boolean useDefault;
53
    private int shapeType;
54
    private ISymbol defaultSymbol;
55
    private int currentLegend;
56

  
57
    private LegendContentsChangedListener changeListener;
58

  
59
    private boolean allowOverlap;
60

  
61
    public DefaultVectorComplexLegend() {
62
        super();
63
        SymbolManager manager = MapContextLocator.getSymbolManager();
64
        this.defaultSymbol = manager.createSymbol(Geometry.TYPES.SURFACE);
65
        this.allowOverlap = true;
66
        this.currentLegend = -1;
67
        this.changeListener = new LegendContentsChangedListener() {
68
            @Override
69
            public boolean symbolChanged(SymbolLegendEvent e) {
70
                fireDefaultSymbolChangedEvent(e);
71
                return true;
72
            }
73

  
74
            @Override
75
            public void legendCleared(LegendClearEvent event) {
76
                fireDefaultSymbolChangedEvent(new ComplexLegendChangedEvent());
77
            }
78
        };
79
    }
80

  
81
    public List<ComplexLegendItem> getLegends() {
82
        if (legends == null) {
83
            legends = new ArrayList<ComplexLegendItem>();
84
        }
85
        return Collections.unmodifiableList(legends);
86
    }
87

  
88
    public List<ComplexLegendItem> getEditedLegends() {
89
        if (legends == null) {
90
            legends = new ArrayList<ComplexLegendItem>();
91
        }
92
        return legends;
93
    }
94

  
95
    public boolean isOverlapped(ComplexLegendItem legend) {
96
        Iterator it = getLegends().iterator();
97
        while (it.hasNext()) {
98
            ComplexLegendItem aux = (ComplexLegendItem) it.next();
99
            if ((aux.getMinScale() == -1
100
                    && aux.getMaxScale() > legend.getMinScale())) {
101
                return true;
102
            }
103
            if ((aux.getMaxScale() == -1
104
                    && aux.getMinScale() < legend.getMaxScale())) {
105
                return true;
106
            }
107
            if (!(aux.getMinScale() >= legend.getMaxScale()
108
                    || aux.getMaxScale() <= legend.getMinScale())) {
109
                return true;
110
            }
111
        }
112
        return false;
113
    }
114

  
115
    @Override
116
    public Object clone() throws CloneNotSupportedException {
117
        DefaultVectorComplexLegend cloned = (DefaultVectorComplexLegend) super.clone(); //To change body of generated methods, choose Tools | Templates.
118
        cloned.defaultSymbol = (ISymbol) this.defaultSymbol.clone();
119

  
120
        cloned.legends = new ArrayList<>();
121
        if (legends != null) {
122
            for (ComplexLegendItem legend : legends) {
123
                cloned.add((ComplexLegendItem) legend.clone());
124
            }
125
        }
126
        return cloned;
127
    }
128

  
129
    public boolean add(ComplexLegendItem legend) {
130
        if (legends == null) {
131
            getLegends();
132
        }
133

  
134
        boolean result = legends.add(legend);
135
        Collections.sort(legends, new Comparator<ComplexLegendItem>() {
136
            public int compare(ComplexLegendItem o1, ComplexLegendItem o2) {
137
                if (o1.getMinScale() == o2.getMinScale()) {
138
                    return 0;
139
                }
140
                return o1.getMinScale() < o2.getMinScale() ? -1 : 1;
141
            }
142
        });
143

  
144
        legend.getLegend().addLegendListener(this.changeListener);
145
        fireDefaultSymbolChangedEvent(new ComplexLegendChangedEvent());
146
        return result;
147
    }
148

  
149
    public boolean remove(ComplexLegendItem legend) {
150
        if (legends == null) {
151
            getLegends();
152
        }
153

  
154
        boolean result = legends.remove(legend);
155
        legend.getLegend().removeLegendListener(changeListener);
156
        fireDefaultSymbolChangedEvent(new ComplexLegendChangedEvent());
157
        return result;
158
    }
159

  
160
    public ComplexLegendItem getLegend(double scale) {
161
        Iterator<ComplexLegendItem> it = getLegends().iterator();
162
        while (it.hasNext()) {
163
            ComplexLegendItem cleg = (ComplexLegendItem) it.next();
164
            if (cleg.getMinScale() == -1
165
                    && cleg.getMaxScale() >= scale) {
166
                return cleg;
167
            }
168
            if (cleg.getMinScale() <= scale
169
                    && cleg.getMaxScale() >= scale) {
170
                return cleg;
171
            }
172
            if (cleg.getMinScale() <= scale
173
                    && cleg.getMaxScale() == -1) {
174
                return cleg;
175
            }
176
        }
177
        return null;
178
    }
179

  
180
    public List<ComplexLegendItem> getLegendsInScale(double scale) {
181
        Iterator<ComplexLegendItem> it = getLegends().iterator();
182
        ArrayList<ComplexLegendItem> legendsInScale = new ArrayList<ComplexLegendItem>();
183
        while (it.hasNext()) {
184
            ComplexLegendItem cleg = (ComplexLegendItem) it.next();
185
            if (cleg.getMinScale() == -1
186
                    && cleg.getMaxScale() >= scale) {
187
                legendsInScale.add(cleg);
188
            }
189
            if (cleg.getMinScale() <= scale
190
                    && cleg.getMaxScale() >= scale) {
191
                legendsInScale.add(cleg);
192
            }
193
            if (cleg.getMinScale() <= scale
194
                    && cleg.getMaxScale() == -1) {
195
                legendsInScale.add(cleg);
196
            }
197
        }
198
        return legendsInScale;
199
    }
200

  
201
    @Override
202
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
203
            double scale, Map queryParameters, ICoordTrans coordTrans,
204
            FeatureStore featureStore, FeatureQuery fquery,
205
            PrintAttributes properties) throws LegendException {
206
        List<ComplexLegendItem> legendsToDraw;
207
        if (this.getAllowOverlap()) {
208
            legendsToDraw = this.getLegendsInScale(scale);
209
        } else {
210
            legendsToDraw = new ArrayList<>();
211
            ComplexLegendItem legendInScale = getLegend(scale);
212
            legendsToDraw.add(legendInScale);
213
        }
214

  
215
        int n = 0;
216
        for (ComplexLegendItem legend : legendsToDraw) {
217
            if (legend != null) {
218
                if (legend.getLegend() != null) {
219
                    setCurrentLegend(n);
220
                    if (legend.getLegend() instanceof AbstractVectorialLegend) {
221
                        ((AbstractVectorialLegend) legend.getLegend()).print(g, viewPort, cancel, scale, queryParameters, coordTrans,
222
                                featureStore, fquery, properties);
223
                    }
224
                }
225
            }
226
        }
227
    }
228

  
229
    @Override
230
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
231
            double scale, Map queryParameters, ICoordTrans coordTrans,
232
            FeatureStore featureStore, PrintAttributes properties)
233
            throws LegendException {
234
        print(g, viewPort, cancel, scale, queryParameters, coordTrans,
235
                featureStore, null, properties);
236
    }
237

  
238
    @Override
239
    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
240
            Cancellable cancel, double scale, Map queryParameters,
241
            ICoordTrans coordTrans, FeatureStore featureStore)
242
            throws LegendException {
243
        List<ComplexLegendItem> legendsToDraw;
244
        if (this.getAllowOverlap()) {
245
            legendsToDraw = this.getLegendsInScale(scale);
246
        } else {
247
            legendsToDraw = new ArrayList<>();
248
            ComplexLegendItem legendInScale = getLegend(scale);
249
            legendsToDraw.add(legendInScale);
250
        }
251

  
252
        int n = 0;
253
        for (ComplexLegendItem legend : legendsToDraw) {
254
            if (legend != null) {
255
                if (legend.getLegend() != null) {
256
                    setCurrentLegend(n);
257
                    if (legend.getLegend() instanceof AbstractVectorialLegend) {
258
                        ((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
259
                                featureStore);
260
                    }
261
                }
262
            }
263
        }
264
    }
265

  
266
    @Override
267
    protected void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
268
            Cancellable cancel, double scale, Map queryParameters,
269
            ICoordTrans coordTrans, FeatureStore featureStore,
270
            FeatureQuery featureQuery, double dpi) throws LegendException {
271

  
272
        List<ComplexLegendItem> legendsToDraw;
273
        if (this.getAllowOverlap()) {
274
            legendsToDraw = this.getLegendsInScale(scale);
275
        } else {
276
            legendsToDraw = new ArrayList<>();
277
            ComplexLegendItem legendInScale = getLegend(scale);
278
            legendsToDraw.add(legendInScale);
279
        }
280
        int n = 0;
281
        for (ComplexLegendItem legend : legendsToDraw) {
282
            if (legend != null) {
283
                if (legend.getLegend() != null) {
284
                    setCurrentLegend(n);
285
                    if (legend.getLegend() instanceof AbstractVectorialLegend) {
286

  
287
                        ((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
288
                                featureStore, featureQuery);
289
                    }
290
                }
291
            }
292
            n++;
293
        }
294

  
295
    }
296

  
297
    private IVectorLegend getCurrentLegend() {
298
        if (this.currentLegend >= 0 && getLegends() != null && !getLegends().isEmpty()) {
299
            return (IVectorLegend) getLegends().get(this.currentLegend).getLegend();
300
        }
301
        return null;
302
    }
303

  
304
    private void setCurrentLegend(int legend) {
305
        this.currentLegend = legend;
306
    }
307

  
308
    @Override
309
    public boolean getAllowOverlap() {
310
        return this.allowOverlap;
311
    }
312

  
313
    @Override
314
    public void setAllowOverlap(boolean allowOverlap) {
315
        this.allowOverlap = allowOverlap;
316
    }
317

  
318
    public static class RegisterPersistence implements Callable {
319

  
320
        public Object call() throws Exception {
321
            PersistenceManager manager = ToolsLocator.getPersistenceManager();
322
            if (manager.getDefinition(
323
                    COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) {
324
                DynStruct definition = manager
325
                        .addDefinition(DefaultVectorComplexLegend.class,
326
                                COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME,
327
                                COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME
328
                                + " Persistence definition", null, null);
329

  
330
                definition.extend(manager.getDefinition(
331
                        AbstractVectorialLegend.VECTORIAL_LEGEND_PERSISTENCE_DEFINITION_NAME));
332

  
333
                definition.addDynFieldList(COMPLEX_LEGEND_FIELD).setClassOfItems(DefaultComplexLegendItem.class);
334
                definition.addDynFieldBoolean("allowOverlay");
335
            }
336
            return Boolean.TRUE;
337
        }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff