Revision 2608

View differences:

org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.api/pom.xml
8 8
	<parent>
9 9
		<groupId>org.gvsig</groupId>
10 10
		<artifactId>org.gvsig.raster.wmts.swing</artifactId>
11
		<version>2.2.0-SNAPSHOT</version>
11
		<version>2.2.1-SNAPSHOT</version>
12 12
	</parent>
13 13
	<dependencies>
14 14
		<dependency>
......
16 16
            <artifactId>org.gvsig.tools.lib</artifactId>      
17 17
            <scope>compile</scope>
18 18
        </dependency> 
19
        <dependency>
20
            <groupId>org.gvsig</groupId>
21
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
22
            <scope>compile</scope>
23
        </dependency>
24 19
	</dependencies>
25 20
	<build>
26 21
		<plugins>
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/wizard/WMTSParametersListModel.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
 
23
package org.gvsig.raster.wmts.swing.impl.wizard;
24

  
25
import java.util.ArrayList;
26
import java.util.Collection;
27
import java.util.List;
28
import java.util.TreeSet;
29

  
30
import javax.swing.AbstractListModel;
31

  
32

  
33
/**
34
 * Data model for a list of SRSs
35
 */
36
public class WMTSParametersListModel extends AbstractListModel {
37
	private static final long serialVersionUID = 1L;
38
	
39
	ArrayList<Object> srs = new ArrayList<Object>();
40
	
41
	public WMTSParametersListModel(ArrayList<Object> obj) {
42
		srs = obj;
43
	}
44
	
45
	public WMTSParametersListModel(List<String> obj) {
46
		for (int i = 0; i < obj.size(); i++) 
47
			srs.add(obj.get(i));
48
	}
49
	
50
	public WMTSParametersListModel() {
51
	}
52
	
53
	public int getSize() {
54
		return srs.size();
55
	}
56

  
57
	public Object getElementAt(int index) {
58
		if(srs.size() > 0 && index >= 0 && index < srs.size())
59
			return srs.get(index);
60
		return null;
61
	}
62
	
63
	public void removeAllItems() {
64
		srs.clear();
65
	}
66
	
67
	public void setAll(Collection<Object> c) {
68
		srs.clear();
69
		srs.addAll(c);
70
	}
71
	
72
	public Collection<Object> intersect(Collection<Object> c) {
73
		TreeSet<Object> resul = new TreeSet<Object>();
74
    	for (int i = 0; i < srs.size(); i++) {
75
			if (c.contains(srs.get(i)))
76
				resul.add(srs.get(i));
77
		}
78
    	return resul;	
79
	}
80
}
0 81

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/main/java/org/gvsig/raster/wmts/swing/impl/wizard/LayerTreeModel.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
 
23
package org.gvsig.raster.wmts.swing.impl.wizard;
24

  
25
import java.util.List;
26

  
27
import javax.swing.event.TreeModelListener;
28
import javax.swing.tree.TreeModel;
29
import javax.swing.tree.TreePath;
30

  
31
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
32
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme;
33
import org.gvsig.raster.wmts.ogc.struct.WMTSThemes;
34

  
35
/**
36
 * Model for the layer three 
37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38
 */
39
public class LayerTreeModel implements TreeModel {
40

  
41
	private WMTSThemes root      = null;
42

  
43
	public LayerTreeModel(WMTSThemes root){
44
		this.root = root;
45
	}
46

  
47
	public Object getRoot() {
48
		return root;
49
	}
50

  
51
	public int getChildCount(Object parent) {
52
		if(parent instanceof WMTSTheme)
53
			return ((WMTSTheme)parent).getChildCount();
54
		if(parent instanceof WMTSThemes)
55
			return ((WMTSThemes)parent).getChildCount();
56
		return 0;
57
	}
58

  
59
    public boolean isLeaf(Object node) {
60
		return (getChildCount(node) <= 0);
61
	}
62

  
63
	public void addTreeModelListener(TreeModelListener l) {
64
	}
65

  
66
	public void removeTreeModelListener(TreeModelListener l) {
67
	}
68

  
69
	public Object getChild(Object parent, int index) {
70
		if(parent instanceof WMTSTheme)
71
			return ((WMTSTheme)parent).getChildren(index);
72
		if(parent instanceof WMTSThemes)
73
			return ((WMTSThemes)parent).getChildren(index);
74
		return null;
75
	}
76

  
77
	public int getIndexOfChild(Object parent, Object child) {
78
		if(parent instanceof WMTSTheme)
79
			return ((WMTSTheme)parent).getIndexOfChild((WMTSTheme)parent);
80
		if(parent instanceof WMTSThemes)
81
			return ((WMTSThemes)parent).getIndexOfChild((WMTSTheme)parent);
82
		return -1;
83
	}
84

  
85
	public void valueForPathChanged(TreePath path, Object newValue) {
86
	}
87

  
88
    /**
89
     * @param node, the tree's desired node.
90
     * @return Returns the name of the node.
91
     */
92
    public String getName(Object node) {
93
        return ((WMTSTheme) node).getLayer().getTitle();
94
    }
95
    
96
    /**
97
     * @param node, the tree's desired node.
98
     * @return Returns the namedStyles.
99
     */
100
	public List<WMTSStyle> getStyles(Object node) {
101
        return ((WMTSTheme) node).getLayer().getStyle();
102
    }
103
   
104
    /**
105
     * @param node, the tree's desired node.
106
     * @return Returns the title.
107
     */
108
    public String getTitle(Object node) {
109
        return ((WMTSTheme) node).getTitle();
110
    }
111
    
112
    public String toString(){
113
        return getTitle(this);
114
    }
115
    
116
    /**
117
     * Searches in the tree for the first (and must be the unique) RemoteLayerNode with
118
     * the name specified by name.
119
     * @param name
120
     * @return
121
     */
122
    public Object getNodeByName(String name) {
123
    	return root.getNodeByName(name);
124
    }
125
    
126
}
0 127

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/src/test/java/org/gvsig/raster/wmts/swing/impl/panel/format/TestFormatsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.wmts.swing.impl.panel.format;
20

  
21
import javax.swing.JFrame;
22

  
23
public class TestFormatsPanel {
24
	private int               w        = 510;
25
	private int               h        = 610;
26
	private JFrame            frame    = new JFrame();
27
	private IFormatsPanel      desc     = null;
28

  
29
	public TestFormatsPanel() {
30
		desc = new IFormatsPanel();
31
		frame.getContentPane().add(desc);
32
		frame.setSize(w, h);
33
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
34
		frame.setVisible(true);
35
	}
36

  
37
	public static void main(String[] args) {
38
		new TestFormatsPanel();
39
	}
40
}
0 41

  
org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.swing/org.gvsig.raster.wmts.swing.impl/pom.xml
8 8
	<parent>
9 9
		<groupId>org.gvsig</groupId>
10 10
		<artifactId>org.gvsig.raster.wmts.swing</artifactId>
11
		<version>2.2.0-SNAPSHOT</version>
11
		<version>2.2.1-SNAPSHOT</version>
12 12
	</parent>
13 13
	<dependencies>
14 14
		<dependency>
......
19 19
		<dependency>
20 20
			<groupId>org.gvsig</groupId>
21 21
			<artifactId>org.gvsig.raster.wmts.swing.api</artifactId>
22
			<scope>compile</scope>
22 23
		</dependency>
23 24
		<dependency>
25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.raster.wmts.ogc.api</artifactId>
27
			<scope>compile</scope>
28
		</dependency>
29
		<dependency>
30
			<groupId>org.gvsig</groupId>
31
			<artifactId>org.gvsig.raster.wmts.ogc.impl</artifactId>
32
			<scope>runtime</scope>
33
		</dependency>
34
        <dependency>
24 35
            <groupId>org.gvsig</groupId>
25
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
36
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
26 37
            <scope>compile</scope>
27 38
        </dependency>
28 39
        <dependency>
29 40
            <groupId>org.gvsig</groupId>
30
            <artifactId>org.gvsig.fmap.dal</artifactId>
41
            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
31 42
            <scope>compile</scope>
32 43
        </dependency>
33
         <dependency>
34
            <groupId>org.gvsig</groupId>
35
            <artifactId>org.gvsig.fmap.geometry</artifactId>
36
            <scope>compile</scope>
37
        </dependency>
38 44
        <dependency>
39 45
            <groupId>org.gvsig</groupId>
40
            <artifactId>org.gvsig.fmap.dal</artifactId>
46
            <artifactId>org.gvsig.fmap.geometry.api</artifactId>
41 47
            <scope>compile</scope>
42 48
        </dependency>
43 49
        <dependency>
44 50
            <groupId>org.gvsig</groupId>
45
            <artifactId>org.gvsig.fmap.dal</artifactId>
46
            <classifier>spi</classifier>
47
            <scope>compile</scope>
51
            <artifactId>org.gvsig.fmap.geometry.impl</artifactId>
52
            <scope>runtime</scope>
48 53
        </dependency>
49 54
		<dependency>
50 55
            <groupId>org.gvsig</groupId>

Also available in: Unified diff