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 / type / GeometryTypeNotValidException.java @ 40435
History | View | Annotate | Download (2.69 KB)
1 | 40435 | jjdelcerro | /* 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 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 {Iver T.I.} {Task}
|
||
26 | */
|
||
27 | |||
28 | package org.gvsig.fmap.geom.type; |
||
29 | |||
30 | import java.util.HashMap; |
||
31 | import java.util.Map; |
||
32 | |||
33 | import org.gvsig.fmap.geom.GeometryException; |
||
34 | |||
35 | /**
|
||
36 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
37 | */
|
||
38 | public class GeometryTypeNotValidException extends GeometryException { |
||
39 | private static final long serialVersionUID = 2588983103873322295L; |
||
40 | |||
41 | /**
|
||
42 | * Key to retrieve this exception's message
|
||
43 | */
|
||
44 | private static final String MESSAGE_KEY = "geometry_type_not_valid_exception"; |
||
45 | /**
|
||
46 | * This exception's message. Substitution fields follow the format %(fieldName) and
|
||
47 | * must be stored in the Map returned by the values() method.
|
||
48 | */
|
||
49 | private static final String FORMAT_STRING = |
||
50 | "The geometry with type %(type) and subType %(subType) is not supported.";
|
||
51 | |||
52 | /**
|
||
53 | * Class name of the geometry type. Should never be null in this exception
|
||
54 | */
|
||
55 | private int type; |
||
56 | private int subType; |
||
57 | |||
58 | /**
|
||
59 | * Main constructor that provides both context data and a cause Exception
|
||
60 | * @param geomClass geometry class
|
||
61 | * @param e cause exception
|
||
62 | */
|
||
63 | public GeometryTypeNotValidException(int type, int subType, Exception e) { |
||
64 | super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
|
||
65 | // messageKey = MESSAGE_KEY;
|
||
66 | // formatString = FORMAT_STRING;
|
||
67 | // code = serialVersionUID;
|
||
68 | //
|
||
69 | // if (e != null) {
|
||
70 | // initCause(e);
|
||
71 | // }
|
||
72 | |||
73 | this.type = type;
|
||
74 | this.subType = subType;
|
||
75 | } |
||
76 | |||
77 | /**
|
||
78 | * Main constructor that provides both context data and a cause Exception
|
||
79 | * @param geomClass geometry class
|
||
80 | * @param e cause exception
|
||
81 | */
|
||
82 | public GeometryTypeNotValidException(int type, int subType) { |
||
83 | this(type, subType, null); |
||
84 | } |
||
85 | |||
86 | protected Map values() { |
||
87 | HashMap map = new HashMap(); |
||
88 | map.put("type", new Integer(type)); |
||
89 | map.put("subType", new Integer(subType)); |
||
90 | return map;
|
||
91 | } |
||
92 | } |
||
93 |