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 / operation / GeometryOperationException.java @ 40559
History | View | Annotate | Download (4.09 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 |
package org.gvsig.fmap.geom.operation; |
25 |
|
26 |
import java.util.HashMap; |
27 |
import java.util.Map; |
28 |
|
29 |
import org.gvsig.tools.exception.BaseException; |
30 |
|
31 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
32 |
*
|
33 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
34 |
*
|
35 |
* This program is free software; you can redistribute it and/or
|
36 |
* modify it under the terms of the GNU General Public License
|
37 |
* as published by the Free Software Foundation; either version 2
|
38 |
* of the License, or (at your option) any later version.
|
39 |
*
|
40 |
* This program is distributed in the hope that it will be useful,
|
41 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
42 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
43 |
* GNU General Public License for more details.
|
44 |
*
|
45 |
* You should have received a copy of the GNU General Public License
|
46 |
* along with this program; if not, write to the Free Software
|
47 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
48 |
*
|
49 |
* For more information, contact:
|
50 |
*
|
51 |
* Generalitat Valenciana
|
52 |
* Conselleria d'Infraestructures i Transport
|
53 |
* Av. Blasco Ib??ez, 50
|
54 |
* 46010 VALENCIA
|
55 |
* SPAIN
|
56 |
*
|
57 |
* +34 963862235
|
58 |
* gvsig@gva.es
|
59 |
* www.gvsig.gva.es
|
60 |
*
|
61 |
* or
|
62 |
*
|
63 |
* IVER T.I. S.A
|
64 |
* Salamanca 50
|
65 |
* 46005 Valencia
|
66 |
* Spain
|
67 |
*
|
68 |
* +34 963163400
|
69 |
* dac@iver.es
|
70 |
*/
|
71 |
/* CVS MESSAGES:
|
72 |
*
|
73 |
* $Id: GeometryOperationException.java,v 1.1 2008/03/12 08:46:21 cvs Exp $
|
74 |
* $Log: GeometryOperationException.java,v $
|
75 |
* Revision 1.1 2008/03/12 08:46:21 cvs
|
76 |
* *** empty log message ***
|
77 |
*
|
78 |
*
|
79 |
*/
|
80 |
/**
|
81 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es)
|
82 |
*/
|
83 |
public class GeometryOperationException extends BaseException { |
84 |
|
85 |
/**
|
86 |
* Generated serial version UID
|
87 |
*/
|
88 |
private static final long serialVersionUID = 8230919748601156772L; |
89 |
private static final String MESSAGE_KEY = "geometry_operation_exception"; |
90 |
private static final String FORMAT_STRING = |
91 |
"Exception executing the operation with code %(operationCode) for the geometry with type %(geometryType).";
|
92 |
|
93 |
private int geometryType = -1; |
94 |
private int operationCode = -1; |
95 |
|
96 |
/**
|
97 |
* Constructor with some context data for cases in which the root cause of
|
98 |
* <code>this</code> is internal (usually an unsatisfied logic rule).
|
99 |
* @param geometryType
|
100 |
* @param operationCode
|
101 |
*/
|
102 |
public GeometryOperationException(int geometryType, int operationCode){ |
103 |
this(geometryType, operationCode, null); |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Constructor to use when <code>this</code> is caused by another Exception
|
108 |
* but there is not further context data available.
|
109 |
* @param e
|
110 |
*/
|
111 |
public GeometryOperationException(Exception e) { |
112 |
this(-1, -1, e); |
113 |
} |
114 |
|
115 |
/**
|
116 |
* Main constructor that provides both context data and a cause Exception
|
117 |
* @param geometryType
|
118 |
* @param operationCode
|
119 |
* @param exp
|
120 |
*/
|
121 |
public GeometryOperationException(int geometryType, int operationCode, Exception e) { |
122 |
super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
|
123 |
|
124 |
this.geometryType = geometryType;
|
125 |
this.operationCode = operationCode;
|
126 |
} |
127 |
|
128 |
protected Map values() { |
129 |
HashMap map = new HashMap(); |
130 |
map.put("geometryType", String.valueOf(geometryType)); |
131 |
map.put("operationCode", String.valueOf(operationCode)); |
132 |
return map;
|
133 |
} |
134 |
} |
135 |
|