svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / GeometryLocator.java @ 40767
History | View | Annotate | Download (2.75 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.fmap.geom; |
26 |
|
27 |
import org.gvsig.tools.locator.AbstractLocator; |
28 |
import org.gvsig.tools.locator.Locator; |
29 |
import org.gvsig.tools.locator.LocatorException; |
30 |
|
31 |
/**
|
32 |
* This Locator provides the entry point for the gvSIG
|
33 |
* {@link GeometryManager}.
|
34 |
* @see {@link Locator}
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
36 |
*/
|
37 |
public class GeometryLocator extends AbstractLocator { |
38 |
|
39 |
private static final String LOCATOR_NAME = "GeometryLocator"; |
40 |
|
41 |
/**
|
42 |
* GeometryManager name used by the locator to access the instance
|
43 |
*/
|
44 |
public static final String GEOMETRY_MANAGER_NAME = "GeometryManager"; |
45 |
|
46 |
private static final String GEOMETRY_MANAGER_DESCRIPTION = "GeometryManager of gvSIG"; |
47 |
|
48 |
/**
|
49 |
* Unique instance.
|
50 |
*/
|
51 |
private static final GeometryLocator instance = new GeometryLocator(); |
52 |
|
53 |
/**
|
54 |
* Return the singleton instance.
|
55 |
*
|
56 |
* @return the singleton instance
|
57 |
*/
|
58 |
public static GeometryLocator getInstance() { |
59 |
return instance;
|
60 |
} |
61 |
|
62 |
/* (non-Javadoc)
|
63 |
* @see org.gvsig.tools.locator.Locator#getLocatorName()
|
64 |
*/
|
65 |
public String getLocatorName() { |
66 |
return LOCATOR_NAME;
|
67 |
} |
68 |
|
69 |
/**
|
70 |
* Return a reference to {@link GeometryManager}.
|
71 |
*
|
72 |
* @return a reference to GeometryManager
|
73 |
* @throws LocatorException
|
74 |
* if there is no access to the class or the class cannot be
|
75 |
* instantiated
|
76 |
* @see Locator#get(String)
|
77 |
*/
|
78 |
public static GeometryManager getGeometryManager() throws LocatorException { |
79 |
return (GeometryManager) getInstance().get(GEOMETRY_MANAGER_NAME);
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* Registers the Class implementing the {@link GeometryManager} interface.
|
84 |
*
|
85 |
* @param clazz
|
86 |
* implementing the GeometryManager interface
|
87 |
*/
|
88 |
public static void registerGeometryManager(Class clazz) { |
89 |
getInstance().register(GEOMETRY_MANAGER_NAME, GEOMETRY_MANAGER_DESCRIPTION, |
90 |
clazz); |
91 |
} |
92 |
} |
93 |
|