Revision 3384

View differences:

org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.100/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.100/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.100/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.100/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.100/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.100/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.100/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.100/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.100/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
    private boolean allowOverlap;
52

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

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

  
117
	public ComplexLegendItem getLegend(double scale) {
118
		Iterator<ComplexLegendItem> it = getLegends().iterator();
119
		while(it.hasNext()){
120
			ComplexLegendItem cleg = (ComplexLegendItem) it.next();
121
			if(cleg.getMinScale() == -1 &&
122
					cleg.getMaxScale() >= scale){
123
				return cleg;
124
			}
125
			if(cleg.getMinScale() <= scale &&
126
					cleg.getMaxScale() >= scale){
127
				return cleg;
128
			}
129
			if(cleg.getMinScale() <= scale &&
130
					cleg.getMaxScale() == -1){
131
				return cleg;
132
			}
133
		}
134
		return null;
135
	}
136
        
137
	public List<ComplexLegendItem> getLegendsInScale(double scale) {
138
		Iterator<ComplexLegendItem> it = getLegends().iterator();
139
            ArrayList<ComplexLegendItem> legendsInScale = new ArrayList<ComplexLegendItem>();
140
		while(it.hasNext()){
141
			ComplexLegendItem cleg = (ComplexLegendItem) it.next();
142
			if(cleg.getMinScale() == -1 &&
143
					cleg.getMaxScale() >= scale){
144
				legendsInScale.add(cleg);
145
			}
146
			if(cleg.getMinScale() <= scale &&
147
					cleg.getMaxScale() >= scale){
148
				legendsInScale.add(cleg);
149
			}
150
			if(cleg.getMinScale() <= scale &&
151
					cleg.getMaxScale() == -1){
152
				legendsInScale.add(cleg);
153
			}
154
		}
155
		return legendsInScale;
156
	}
157

  
158

  
159
	@Override
160
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
161
            double scale, Map queryParameters, ICoordTrans coordTrans,
162
            FeatureStore featureStore, FeatureQuery fquery,
163
            PrintAttributes properties) throws LegendException {
164
        List<ComplexLegendItem> legendsToDraw;
165
        if (this.getAllowOverlap()) {
166
            legendsToDraw = this.getLegendsInScale(scale);
167
        } else {
168
            legendsToDraw = new ArrayList<>();
169
            ComplexLegendItem legendInScale = getLegend(scale);
170
            legendsToDraw.add(legendInScale);
171
        }
172
        if (legendsToDraw.size() > 0 && legendsToDraw.get(0) != null) {
173
            setCurrentLegend((IVectorLegend) legendsToDraw.get(0).getLegend());
174
        }
175
        for (ComplexLegendItem legend : legendsToDraw) {
176
            if (legend != null) {
177
                if (legend.getLegend() != null
178
                        && legend.getLegend() instanceof AbstractVectorialLegend) {
179
                    ((AbstractVectorialLegend) legend.getLegend()).print(g, viewPort, cancel, scale, queryParameters, coordTrans,
180
                            featureStore, fquery, properties);
181
                }
182
            }
183
        }
184
    }
185

  
186
	@Override
187
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
188
			double scale, Map queryParameters, ICoordTrans coordTrans,
189
			FeatureStore featureStore, PrintAttributes properties)
190
					throws LegendException {
191
		print(g, viewPort, cancel, scale, queryParameters, coordTrans,
192
				featureStore, null, properties);
193
	}
194

  
195
    @Override
196
    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
197
            Cancellable cancel, double scale, Map queryParameters,
198
            ICoordTrans coordTrans, FeatureStore featureStore)
199
            throws LegendException {
200
        List<ComplexLegendItem> legendsToDraw;
201
        if (this.getAllowOverlap()) {
202
            legendsToDraw = this.getLegendsInScale(scale);
203
        } else {
204
            legendsToDraw = new ArrayList<>();
205
            ComplexLegendItem legendInScale = getLegend(scale);
206
            legendsToDraw.add(legendInScale);
207
        }
208
        if (legendsToDraw.size()>0 && legendsToDraw.get(0)!=null) {
209
            setCurrentLegend((IVectorLegend) legendsToDraw.get(0).getLegend());
210
        }
211
        for (ComplexLegendItem legend : legendsToDraw) {
212
            if (legend != null) {
213
                if (legend.getLegend() != null
214
                        && legend.getLegend() instanceof AbstractVectorialLegend) {
215
                    ((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
216
                            featureStore);
217
                }
218
            }
219
        }
220
    }
221

  
222
    @Override
223
    protected void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
224
            Cancellable cancel, double scale, Map queryParameters,
225
            ICoordTrans coordTrans, FeatureStore featureStore,
226
            FeatureQuery featureQuery, double dpi) throws LegendException {
227

  
228
        List<ComplexLegendItem> legendsToDraw;
229
        if (this.getAllowOverlap()) {
230
            legendsToDraw = this.getLegendsInScale(scale);
231
        } else {
232
            legendsToDraw = new ArrayList<>();
233
            ComplexLegendItem legendInScale = getLegend(scale);
234
            legendsToDraw.add(legendInScale);
235
        }
236
        if (legendsToDraw.size()>0 && legendsToDraw.get(0)!=null) {
237
            setCurrentLegend((IVectorLegend) legendsToDraw.get(0).getLegend());
238
        }
239
        for (ComplexLegendItem legend : legendsToDraw) {
240
            if (legend != null) {
241
                if (legend.getLegend() != null
242
                        && legend.getLegend() instanceof AbstractVectorialLegend) {
243
                    
244
                    ((AbstractVectorialLegend) legend.getLegend()).draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
245
                            featureStore, featureQuery);
246
                }
247
            }
248
        }
249

  
250
    }
251

  
252

  
253
	private void setCurrentLegend(IVectorLegend legend) {
254
		boolean changed = this.currentLegend != legend;
255
		this.currentLegend = legend;
256

  
257
		if(changed){
258
			fireDefaultSymbolChangedEvent(new ComplexLegendChangedEvent());
259
		}
260
		//this.currentLegend.setShapeType(this.getShapeType());
261
	}
262

  
263
    @Override
264
    public boolean getAllowOverlap() {
265
        return this.allowOverlap;
266
    }
267

  
268
    @Override
269
    public void setAllowOverlap(boolean allowOverlap) {
270
        this.allowOverlap = allowOverlap;
271
    }
272

  
273

  
274
	public static class RegisterPersistence implements Callable {
275

  
276
		public Object call() throws Exception {
277
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
278
			if (manager.getDefinition(
279
					COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) {
280
				DynStruct definition = manager
281
						.addDefinition(DefaultVectorComplexLegend.class,
282
								COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME,
283
								COMPLEX_LEGEND_PERSISTENCE_DEFINITION_NAME
284
								+ " Persistence definition", null, null);
285

  
286
				definition.extend(manager.getDefinition(
287
						AbstractVectorialLegend.VECTORIAL_LEGEND_PERSISTENCE_DEFINITION_NAME));
288

  
289
				definition.addDynFieldList(COMPLEX_LEGEND_FIELD).setClassOfItems(DefaultComplexLegendItem.class);
290
				definition.addDynFieldBoolean("allowOverlay");
291
			}
292
			return Boolean.TRUE;
293
		}
294

  
295
	}
296

  
297
    public void loadFromState(PersistentState state)
298
            throws PersistenceException {
299
        super.loadFromState(state);
300
        try {
301
            this.allowOverlap = state.getBoolean("allowOverlay");
302
        } catch (Exception e) {
303
            this.allowOverlap = false;
304
        }
305

  
306
        setLegends(state.getList(COMPLEX_LEGEND_FIELD));
307
    }
308

  
309
	private void setLegends(List list) {
310
		this.legends = list;
311
	}
312

  
313
	public void saveToState(PersistentState state) throws PersistenceException {
314
		super.saveToState(state);
315
                state.set("allowOverlay", this.allowOverlap);
316
		state.set(COMPLEX_LEGEND_FIELD, getEditedLegends());
317
	}
318

  
319
	public static class RegisterLegend implements Callable {
320

  
321
		public Object call() throws Exception {
322
			MapContextManager manager =	MapContextLocator.getMapContextManager();
323

  
324
			manager.registerLegend(
325
					COMPLEX_LEGEND_NAME,
326
					DefaultVectorComplexLegend.class);
327

  
328
			return Boolean.TRUE;
329
		}
330

  
331
	}
332

  
333
	public ISymbol getSymbolByFeature(Feature feat) throws MapContextException {
334
		if(this.currentLegend != null 
335
				&& this.currentLegend instanceof IVectorLegend){
336
			return ((IVectorLegend)this.currentLegend).getSymbolByFeature(feat);
337
		}
338
		return null;
339
	}
340

  
341
	public int getShapeType() {
342
		return this.shapeType;
343
	}
344

  
345
	public void setShapeType(int shapeType) {
346
		this.shapeType = shapeType;
347
		SymbolManager manager = MapContextLocator.getSymbolManager();
348
		this.defaultSymbol = manager.createSymbol(shapeType);
349
	}
350

  
351
	public void setDefaultSymbol(ISymbol s) {
352
		this.defaultSymbol = s;
353
	}
354

  
355
	public boolean isUseDefaultSymbol() {
356
		return useDefault;
357
	}
358

  
359
	public void useDefaultSymbol(boolean b) {
360
		this.useDefault = b;
361
	}
362

  
363
	public boolean isSuitableForShapeType(int shapeType) {
364
		return true;
365
	}
366

  
367
	public ISymbol getDefaultSymbol() {
368
		return defaultSymbol;
369
	}
370

  
371
	@Override
372
	protected String[] getRequiredFeatureAttributeNames(
373
			FeatureStore featureStore) throws DataException {
374
		// TODO Auto-generated method stub
375
		return null;
376
	}
377

  
378
	public String[] getDescriptions() {
379
		if(currentLegend instanceof IClassifiedLegend){
380
			return ((IClassifiedLegend) currentLegend).getDescriptions();
381
		}
382
		return new String[]{""};
383
	}
384

  
385
	public ISymbol[] getSymbols() {
386
		if(currentLegend instanceof IClassifiedLegend){
387
			return ((IClassifiedLegend) currentLegend).getSymbols();
388
		}
389
		if(currentLegend == null){
390
			if(getDefaultSymbol() != null){
391
				return new ISymbol[]{getDefaultSymbol()};
392
			}
393
			SymbolManager manager = MapContextLocator.getSymbolManager();
394
			return new ISymbol[]{manager.createSymbol(shapeType)};
395
		}
396
		return new ISymbol[]{currentLegend.getDefaultSymbol()};
397
	}
398

  
399
	public Object[] getValues() {
400
		if(currentLegend instanceof IClassifiedLegend){
401
			return ((IClassifiedLegend) currentLegend).getValues();
402
		}
403
		return new String[]{""};
404
	}
405

  
406
	private static class ComplexLegendChangedEvent extends SymbolLegendEvent{
407

  
408
	public ComplexLegendChangedEvent() {
409
		super(null, null);
410
	}
411

  
412
	@Override
413
	public int getEventType() {
414
		return SymbolLegendEvent.LEGEND_VALUE_CHANGED;
415
	}
416
	}
417
	
418
}
0 419

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.100/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.100/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;
9
import org.gvsig.tools.persistence.PersistentState;
10
import org.gvsig.tools.persistence.exception.PersistenceException;
11
import org.gvsig.tools.util.Callable;
12

  
13
public class DefaultComplexLabelClass extends LabelClass implements Persistent{
14

  
15
	public static final String COMPLEXLABELCLASS_PERSISTENCE_DEFINITION_NAME = "Complex.label.class";
16
	
17
	private double minScale;
18
	private double maxScale;
19
	
20
	public double getMinScale() {
21
		return minScale;
22
	}
23
	
24
	public void setMinScale(double minScale) {
25
		this.minScale = minScale;
26
	}
27
	
28
	public double getMaxScale() {
29
		return maxScale;
30
	}
31
	
32
	public void setMaxScale(double maxScale) {
33
		this.maxScale = maxScale;
34
	}
35
	
36
	@Override
37
	public boolean isVisible() {
38
		return super.isVisible();
39
	}
40
	
41
	@Override
42
	public boolean isVisible(double scale) {
43
		if(getMaxScale() > scale && getMinScale() < scale){
44
			return true;
45
		}
46
		return false;
47
	}
48
	
49
	@Override
50
	public void loadFromState(PersistentState state)
51
			throws PersistenceException {
52
		super.loadFromState(state);
53
		setMinScale(state.getDouble("MinScale"));
54
		setMaxScale(state.getDouble("MaxScale"));
55
	}
56
	
57
	@Override
58
	public void saveToState(PersistentState state) throws PersistenceException {
59
		super.saveToState(state);
60
		state.set("MinScale", getMinScale());
61
		state.set("MaxScale", getMaxScale());
62
	}
63
	
64
	@Override
65
	public Object clone() throws CloneNotSupportedException {
66
		DefaultComplexLabelClass cloned = (DefaultComplexLabelClass) super.clone();
67
		cloned.setMaxScale(this.getMaxScale());
68
		cloned.setMinScale(this.getMinScale());
69
		return cloned;
70
	}
71
	
72
	public static class RegisterPersistence implements Callable {
73

  
74
		public Object call() throws Exception {
75
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
76
			if( manager.getDefinition(COMPLEXLABELCLASS_PERSISTENCE_DEFINITION_NAME)==null ) {
77
				DynStruct definition = manager.addDefinition(
78
						DefaultComplexLabelClass.class,
79
						COMPLEXLABELCLASS_PERSISTENCE_DEFINITION_NAME,
80
						COMPLEXLABELCLASS_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
81
						null, 
82
						null
83
				);
84

  
85
				definition.extend(manager.getDefinition(
86
						"LabelClass"));
87
				
88
				definition.addDynFieldDouble("MaxScale").setMandatory(true);
89
				definition.addDynFieldDouble("MinScale").setMandatory(true);
90
			}
91
			return Boolean.TRUE;
92
		}
93
		
94
	}
95
}
0 96

  
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.100/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.100/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.100/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.100/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.100/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.100</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.100/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.100/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.100/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.100/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.100/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;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff