root / trunk / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / buffer / fmap / ConstantDistanceBufferVisitor.java @ 5626
History | View | Annotate | Download (3.59 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 5626 2006-06-02 18:20:33Z azabala $
|
47 |
* $Log$
|
48 |
* Revision 1.2 2006-06-02 18:20:33 azabala
|
49 |
* limpieza de imports
|
50 |
*
|
51 |
* Revision 1.1 2006/05/24 21:14:41 azabala
|
52 |
* primera version en cvs despues de refactoring orientado a crear un framework extensible de geoprocessing
|
53 |
*
|
54 |
* Revision 1.8 2006/05/01 19:18:09 azabala
|
55 |
* revisi?n general del buffer (a?adidos anillos concentricos, buffers interiores y exteriores, etc)
|
56 |
*
|
57 |
* Revision 1.7 2006/03/28 16:27:16 azabala
|
58 |
* *** empty log message ***
|
59 |
*
|
60 |
* Revision 1.6 2006/03/07 21:01:33 azabala
|
61 |
* *** empty log message ***
|
62 |
*
|
63 |
* Revision 1.5 2006/03/06 19:48:39 azabala
|
64 |
* *** empty log message ***
|
65 |
*
|
66 |
* Revision 1.3 2006/03/05 19:57:05 azabala
|
67 |
* *** empty log message ***
|
68 |
*
|
69 |
* Revision 1.2 2006/02/20 19:44:21 azabala
|
70 |
* *** empty log message ***
|
71 |
*
|
72 |
* Revision 1.1 2006/02/17 16:31:38 azabala
|
73 |
* *** empty log message ***
|
74 |
*
|
75 |
* Revision 1.3 2006/02/12 21:02:58 azabala
|
76 |
* *** empty log message ***
|
77 |
*
|
78 |
* Revision 1.2 2006/02/09 16:01:06 azabala
|
79 |
* First version in CVS
|
80 |
*
|
81 |
* Revision 1.1 2006/02/02 19:46:51 azabala
|
82 |
* First version in CVS
|
83 |
*
|
84 |
*
|
85 |
*/
|
86 |
package com.iver.cit.gvsig.geoprocess.buffer.fmap; |
87 |
|
88 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
89 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
90 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.SingleLayer; |
91 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData; |
92 |
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException; |
93 |
|
94 |
/**
|
95 |
* This FeatureVisitor computes buffers and saves
|
96 |
* it to a new FLayer.
|
97 |
* All IFeature of this Layer will have the same buffer
|
98 |
* distance.
|
99 |
*
|
100 |
* @author azabala
|
101 |
*
|
102 |
*/
|
103 |
public class ConstantDistanceBufferVisitor extends BufferVisitor { |
104 |
/**
|
105 |
* buffer distance to use
|
106 |
*/
|
107 |
private double distance; |
108 |
/**
|
109 |
* Constructor
|
110 |
* @param distance buffer distance to use
|
111 |
* @throws GeoprocessException
|
112 |
*/
|
113 |
public ConstantDistanceBufferVisitor(double distance) throws GeoprocessException{ |
114 |
this.distance = distance;
|
115 |
} |
116 |
|
117 |
public void stop(FLayer layer) { |
118 |
//we must flush JTS processors
|
119 |
resultsProcessor.finish(); |
120 |
} |
121 |
/**
|
122 |
* This FeatureVisitor only work with Vectorial
|
123 |
* Layers
|
124 |
*/
|
125 |
public boolean start(FLayer layer) { |
126 |
return (layer instanceof SingleLayer) && (layer instanceof VectorialData); |
127 |
} |
128 |
|
129 |
public double getBufferDistance(IGeometry g, int index) { |
130 |
return distance;
|
131 |
} |
132 |
|
133 |
public String getProcessDescription() { |
134 |
return "Computing buffers with constant distances"; |
135 |
} |
136 |
|
137 |
} |
138 |
|