root / trunk / extensions / extDerivedGeometries / src / es / iver / derivedGeom / utils / GeomInfoFactory.java @ 27865
History | View | Annotate | Download (2.38 KB)
1 |
package es.iver.derivedGeom.utils; |
---|---|
2 |
|
3 |
/* gvSIG. Geographic Information System of the Valencian Government
|
4 |
*
|
5 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
6 |
* of the Valencian Government (CIT)
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
21 |
* MA 02110-1301, USA.
|
22 |
*
|
23 |
*/
|
24 |
|
25 |
import java.sql.Types; |
26 |
|
27 |
import javax.swing.ImageIcon; |
28 |
|
29 |
import com.iver.andami.PluginServices; |
30 |
import com.iver.cit.gvsig.fmap.core.FShape; |
31 |
|
32 |
/**
|
33 |
* <p>Creates the particular {@link GeomInfo GeomInfo} by its name and type.</p>
|
34 |
*
|
35 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
36 |
*/
|
37 |
public class GeomInfoFactory { |
38 |
/**
|
39 |
* <p>Creates a <code>JLabel</code> that represents a geometric information,
|
40 |
* and stores the configuration parameters.</p>
|
41 |
*
|
42 |
* @param text the text of the label
|
43 |
* @param name the name of the label
|
44 |
* @param type the type of the geometry
|
45 |
*
|
46 |
* @return the new object
|
47 |
*
|
48 |
* @see Types
|
49 |
*/
|
50 |
public static GeomInfo createGeomInfo(String text, String name, int type) { |
51 |
ImageIcon icon = null; |
52 |
|
53 |
switch (type) {
|
54 |
case FShape.POLYGON:
|
55 |
icon = PluginServices.getIconTheme().get("Polygon");
|
56 |
return new GeomInfo(icon, text, name, type); |
57 |
case FShape.LINE:
|
58 |
icon = PluginServices.getIconTheme().get("Rect");
|
59 |
return new GeomInfo(icon, text, name, type); |
60 |
case FShape.MULTIPOINT:
|
61 |
icon = PluginServices.getIconTheme().get("MultiPoint");
|
62 |
return new GeomInfo(icon, text, name, type); |
63 |
case FShape.POINT:
|
64 |
icon = PluginServices.getIconTheme().get("Point");
|
65 |
return new GeomInfo(icon, text, name, type); |
66 |
case FShape.MULTI: // Don't used |
67 |
icon = PluginServices.getIconTheme().get("multi-icon");
|
68 |
return new GeomInfo(icon, text, name, type); |
69 |
default:
|
70 |
throw new IllegalArgumentException(); |
71 |
} |
72 |
} |
73 |
} |