Revision 10626 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/fmap/AbstractGeoprocessFeatureVisitor.java
AbstractGeoprocessFeatureVisitor.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.1 2006-07-21 09:08:15 azabala |
|
48 |
* Revision 1.2 2007-03-06 16:47:58 caballero |
|
49 |
* Exceptions |
|
50 |
* |
|
51 |
* Revision 1.1 2006/07/21 09:08:15 azabala |
|
49 | 52 |
* first version in cvs |
50 | 53 |
* |
51 | 54 |
* |
52 | 55 |
*/ |
53 | 56 |
package com.iver.cit.gvsig.geoprocess.core.fmap; |
54 | 57 |
|
58 |
import com.iver.cit.gvsig.exceptions.visitors.ProcessVisitorException; |
|
59 |
import com.iver.cit.gvsig.exceptions.visitors.StartVisitorException; |
|
60 |
import com.iver.cit.gvsig.exceptions.visitors.VisitorException; |
|
55 | 61 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
56 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
|
57 | 62 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
58 | 63 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
59 | 64 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData; |
60 | 65 |
import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor; |
61 |
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException; |
|
62 | 66 |
|
63 | 67 |
/** |
64 | 68 |
* Abstract base class to all feature visitor created |
... | ... | |
72 | 76 |
* processes visited features. |
73 | 77 |
*/ |
74 | 78 |
FeatureProcessor featureProcessor; |
75 |
|
|
79 |
|
|
76 | 80 |
/** |
77 | 81 |
* Constructor. |
78 | 82 |
* It receives a FeatureProcessor to process visited features |
... | ... | |
82 | 86 |
public AbstractGeoprocessFeatureVisitor(FeatureProcessor processor){ |
83 | 87 |
this.featureProcessor = processor; |
84 | 88 |
} |
85 |
|
|
86 |
|
|
87 |
public abstract void visit(IGeometry g, int index) throws VisitException; |
|
88 | 89 |
|
90 |
|
|
91 |
public abstract void visit(IGeometry g, int index) throws VisitorException, ProcessVisitorException; |
|
92 |
|
|
89 | 93 |
public abstract String getProcessDescription(); |
90 | 94 |
|
91 | 95 |
/** |
92 | 96 |
* finishes visitation by closing result layer writing. |
93 | 97 |
*/ |
94 |
public void stop(FLayer layer) { |
|
98 |
public void stop(FLayer layer) throws VisitorException {
|
|
95 | 99 |
featureProcessor.finish(); |
96 | 100 |
} |
97 | 101 |
|
98 | 102 |
/** |
99 | 103 |
* to start the visit process, prepares result layer. |
100 | 104 |
*/ |
101 |
public boolean start(FLayer layer) { |
|
102 |
if (layer instanceof AlphanumericData &&
|
|
105 |
public boolean start(FLayer layer) throws StartVisitorException {
|
|
106 |
if (layer instanceof AlphanumericData && |
|
103 | 107 |
layer instanceof VectorialData) { |
104 |
try { |
|
105 | 108 |
this.featureProcessor.start(); |
106 |
}catch (EditionException e) { |
|
107 |
return false; |
|
108 |
} |
|
109 | 109 |
return true; |
110 | 110 |
} |
111 | 111 |
return false; |
112 | 112 |
} |
113 |
|
|
114 |
|
|
113 |
|
|
114 |
|
|
115 | 115 |
} |
116 | 116 |
|
Also available in: Unified diff