svn-gvsig-desktop / tags / v1_1_Build_1001 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / impl / buffer / fmap / ConstantDistanceBufferVisitor.java @ 11984
History | View | Annotate | Download (4.26 KB)
1 |
/*
|
---|---|
2 |
* Created on 02-feb-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id: ConstantDistanceBufferVisitor.java 11984 2007-06-04 14:53:03Z $
|
47 |
* $Log$
|
48 |
* Revision 1.3.2.1 2006-11-15 00:08:17 jjdelcerro
|
49 |
* *** empty log message ***
|
50 |
*
|
51 |
* Revision 1.4 2006/09/15 10:42:54 caballero
|
52 |
* extensibilidad de documentos
|
53 |
*
|
54 |
* Revision 1.3 2006/08/29 07:21:09 cesar
|
55 |
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
|
56 |
*
|
57 |
* Revision 1.2 2006/06/29 17:31:47 azabala
|
58 |
* Uses UnitUtils
|
59 |
*
|
60 |
* Revision 1.1 2006/06/20 18:20:45 azabala
|
61 |
* first version in cvs
|
62 |
*
|
63 |
* Revision 1.2 2006/06/02 18:20:33 azabala
|
64 |
* limpieza de imports
|
65 |
*
|
66 |
* Revision 1.1 2006/05/24 21:14:41 azabala
|
67 |
* primera version en cvs despues de refactoring orientado a crear un framework extensible de geoprocessing
|
68 |
*
|
69 |
* Revision 1.8 2006/05/01 19:18:09 azabala
|
70 |
* revisi?n general del buffer (a?adidos anillos concentricos, buffers interiores y exteriores, etc)
|
71 |
*
|
72 |
* Revision 1.7 2006/03/28 16:27:16 azabala
|
73 |
* *** empty log message ***
|
74 |
*
|
75 |
* Revision 1.6 2006/03/07 21:01:33 azabala
|
76 |
* *** empty log message ***
|
77 |
*
|
78 |
* Revision 1.5 2006/03/06 19:48:39 azabala
|
79 |
* *** empty log message ***
|
80 |
*
|
81 |
* Revision 1.3 2006/03/05 19:57:05 azabala
|
82 |
* *** empty log message ***
|
83 |
*
|
84 |
* Revision 1.2 2006/02/20 19:44:21 azabala
|
85 |
* *** empty log message ***
|
86 |
*
|
87 |
* Revision 1.1 2006/02/17 16:31:38 azabala
|
88 |
* *** empty log message ***
|
89 |
*
|
90 |
* Revision 1.3 2006/02/12 21:02:58 azabala
|
91 |
* *** empty log message ***
|
92 |
*
|
93 |
* Revision 1.2 2006/02/09 16:01:06 azabala
|
94 |
* First version in CVS
|
95 |
*
|
96 |
* Revision 1.1 2006/02/02 19:46:51 azabala
|
97 |
* First version in CVS
|
98 |
*
|
99 |
*
|
100 |
*/
|
101 |
package com.iver.cit.gvsig.geoprocess.impl.buffer.fmap; |
102 |
|
103 |
import org.cresques.cts.IProjection; |
104 |
import org.cresques.cts.gt2.CSUTM; |
105 |
|
106 |
import com.iver.andami.PluginServices; |
107 |
import com.iver.cit.gvsig.fmap.MapContext; |
108 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
109 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
110 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
111 |
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException; |
112 |
import com.iver.cit.gvsig.geoprocess.core.util.UnitUtils; |
113 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
114 |
|
115 |
/**
|
116 |
* This FeatureVisitor computes buffers and saves
|
117 |
* it to a new FLayer.
|
118 |
* All IFeature of this Layer will have the same buffer
|
119 |
* distance.
|
120 |
*
|
121 |
* @author azabala
|
122 |
*
|
123 |
*/
|
124 |
public class ConstantDistanceBufferVisitor extends BufferVisitor { |
125 |
/**
|
126 |
* buffer distance to use
|
127 |
*/
|
128 |
private double distance; |
129 |
|
130 |
/**
|
131 |
* Constructor
|
132 |
* @param distance buffer distance to use
|
133 |
* @throws GeoprocessException
|
134 |
*/
|
135 |
public ConstantDistanceBufferVisitor(double distance) throws GeoprocessException{ |
136 |
this.distance = distance;
|
137 |
} |
138 |
|
139 |
public void stop(FLayer layer) { |
140 |
//we must flush JTS processors
|
141 |
resultsProcessor.finish(); |
142 |
} |
143 |
/**
|
144 |
* This FeatureVisitor only work with Vectorial
|
145 |
* Layers
|
146 |
*/
|
147 |
public boolean start(FLayer layer) { |
148 |
if(layer instanceof FLyrVect){ |
149 |
return true; |
150 |
}else
|
151 |
return false; |
152 |
} |
153 |
|
154 |
public double getBufferDistance(IGeometry g, int index) { |
155 |
//first: pass the user entry to internal units
|
156 |
return UnitUtils.getInInternalUnits(distance);
|
157 |
} |
158 |
|
159 |
|
160 |
|
161 |
public String getProcessDescription() { |
162 |
return "Computing buffers with constant distances"; |
163 |
} |
164 |
|
165 |
} |
166 |
|
167 |
|