Revision 20302 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/listener/DrawMouseProfileListener.java
DrawMouseProfileListener.java | ||
---|---|---|
54 | 54 |
import org.gvsig.remotesensing.profiles.gui.ProfilePanel; |
55 | 55 |
|
56 | 56 |
import com.iver.andami.PluginServices; |
57 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
57 | 58 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
58 | 59 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
59 | 60 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
... | ... | |
61 | 62 |
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol; |
62 | 63 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol; |
63 | 64 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
64 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol; |
|
65 | 65 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
66 | 66 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
67 | 67 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
... | ... | |
96 | 96 |
* Eventos tras el dibujado de una linea. |
97 | 97 |
* */ |
98 | 98 |
public void polylineFinished(MeasureEvent event) throws BehaviorException { |
99 |
|
|
99 | 100 |
GeneralPathX gp = event.getGP(); |
100 | 101 |
IGeometry geometry = null; |
101 | 102 |
geometry = ShapeFactory.createPolyline2D(gp); |
102 | 103 |
String roiName = ""; |
103 | 104 |
VectorialROI lineRoi= null; |
104 | 105 |
int selectedRow; |
106 |
|
|
105 | 107 |
try { |
106 | 108 |
selectedRow = panel.getLineOptionsPanel().getTable().getSelectedRow(); |
107 | 109 |
roiName = (String)panel.getLineOptionsPanel().getTable().getModel().getValueAt(selectedRow,0); |
108 | 110 |
lineRoi = (VectorialROI)panel.getLineOptionsPanel().getROI(roiName); |
109 |
lineRoi.clear(); |
|
110 |
// Antes de a?adir la geometria se borra la anterior si la hay |
|
111 |
|
|
111 | 112 |
if(lineRoi.getGeometries().size()>0) |
112 |
lineRoi.deleteGeometry(0); |
|
113 |
lineRoi.addGeometry(geometry); |
|
114 |
panel.getLineOptionsPanel().addROI(lineRoi); |
|
115 |
ISymbol sym = null; |
|
116 |
Color geometryColor = (Color)panel.getLineOptionsPanel().getTable().getModel().getValueAt(selectedRow, 1); |
|
117 |
sym =SymbologyFactory.createDefaultLineSymbol(); |
|
118 |
((ILineSymbol)sym).setLineColor(geometryColor); |
|
113 |
return; |
|
114 |
|
|
115 |
else { |
|
116 |
lineRoi.addGeometry(geometry); |
|
117 |
panel.getLineOptionsPanel().addROI(lineRoi); |
|
118 |
ISymbol sym = null; |
|
119 |
Color geometryColor = (Color)panel.getLineOptionsPanel().getTable().getModel().getValueAt(selectedRow, 1); |
|
120 |
sym =SymbologyFactory.createDefaultLineSymbol(); |
|
121 |
((ILineSymbol)sym).setLineColor(geometryColor); |
|
119 | 122 |
|
120 |
GraphicLayer graphicLayer = panel.getLineOptionsPanel().getMapControl().getMapContext().getGraphicsLayer(); |
|
121 |
FGraphic fGraphic = new FGraphic(geometry,graphicLayer.addSymbol(sym)); |
|
122 |
panel.getLineOptionsPanel().getMapControl().getMapContext().getGraphicsLayer().addGraphic(fGraphic); |
|
123 |
panel.getLineOptionsPanel().getRoiGraphics(roiName).add(fGraphic); |
|
124 |
panel.getLineOptionsPanel().getMapControl().drawGraphics(); |
|
125 |
panel.getLineOptionsPanel().getNewButton().setSelected(false); |
|
126 |
panel.getMapControl().setTool(panel.getLineOptionsPanel().getPreviousTool()); |
|
127 |
// Se pinta el grafico asociado |
|
128 |
drawChartRoi(lineRoi,panel.getLineOptionsPanel().getComboBands().getSelectedIndex()); |
|
129 |
|
|
123 |
GraphicLayer graphicLayer = panel.getLineOptionsPanel().getMapControl().getMapContext().getGraphicsLayer();
|
|
124 |
FGraphic fGraphic = new FGraphic(geometry,graphicLayer.addSymbol(sym));
|
|
125 |
panel.getLineOptionsPanel().getMapControl().getMapContext().getGraphicsLayer().addGraphic(fGraphic);
|
|
126 |
panel.getLineOptionsPanel().getRoiGraphics(roiName).add(fGraphic);
|
|
127 |
panel.getLineOptionsPanel().getMapControl().drawGraphics();
|
|
128 |
panel.getLineOptionsPanel().getNewButton().setSelected(false);
|
|
129 |
panel.getMapControl().setTool(panel.getLineOptionsPanel().getPreviousTool());
|
|
130 |
// Se pinta el grafico asociado
|
|
131 |
drawChartRoi(lineRoi,panel.getLineOptionsPanel().getComboBands().getSelectedIndex());
|
|
132 |
} |
|
130 | 133 |
} catch (NotInitializeException e) { |
131 | 134 |
e.printStackTrace(); |
132 | 135 |
} |
... | ... | |
149 | 152 |
* Eventos tras el dibujado de un punto. |
150 | 153 |
* */ |
151 | 154 |
public void point(PointEvent event) throws BehaviorException { |
155 |
|
|
152 | 156 |
Point2D point = event.getPoint(); |
153 | 157 |
Point2D p= panel.getPointOptionsPanel().getMapControl().getViewPort().toMapPoint(point); |
154 | 158 |
IGeometry geometry = ShapeFactory.createPoint2D(p.getX(),p.getY()); |
... | ... | |
166 | 170 |
pointRoi.addGeometry(geometry); |
167 | 171 |
panel.getPointOptionsPanel().addROI(pointRoi); |
168 | 172 |
|
169 |
// Hacer un repintado de todas las rois del panel de opciones |
|
170 |
ArrayList listRois= panel.getPointOptionsPanel().getROIs(); |
|
173 |
ISymbol symbol = null; |
|
171 | 174 |
FGraphic fGraphic = null; |
175 |
ArrayList roisArray =panel.getPointOptionsPanel().getROIs(); |
|
172 | 176 |
GraphicLayer graphicLayer = panel.getPointOptionsPanel().getMapControl().getMapContext().getGraphicsLayer(); |
173 |
graphicLayer.clearAllGraphics(); |
|
174 |
graphicLayer.clearSymbolsGraphics(); |
|
175 | 177 |
|
176 |
for (Iterator iter = listRois.iterator(); iter.hasNext();) { |
|
177 |
VectorialROI roi = (VectorialROI)iter.next(); |
|
178 |
Color geometryColor = (Color)panel.getPointOptionsPanel().getTable().getModel().getValueAt(selectedRow, 1); |
|
179 |
ISymbol sym = SymbologyFactory.createDefaultMarkerSymbol(); |
|
180 |
((IMarkerSymbol)sym).setColor(geometryColor); |
|
181 |
((SimpleMarkerSymbol)sym).setStyle(SimpleMarkerSymbol.CIRCLE_STYLE); |
|
178 |
for (Iterator iter = roisArray.iterator(); iter.hasNext();) { |
|
179 |
VectorialROI vectorialROI = (VectorialROI)iter.next();; |
|
180 |
for (Iterator iterator = vectorialROI.getGeometries() |
|
181 |
.iterator(); iterator.hasNext();) { |
|
182 |
geometry = (IGeometry) iterator.next(); |
|
183 |
switch (geometry.getGeometryType()) { |
|
184 |
case FShape.POINT: |
|
185 |
symbol = SymbologyFactory.createDefaultMarkerSymbol(); |
|
186 |
((IMarkerSymbol) symbol).setColor(vectorialROI.getColor()); |
|
187 |
break; |
|
188 |
} |
|
189 |
fGraphic = new FGraphic(geometry, graphicLayer |
|
190 |
.addSymbol(symbol)); |
|
191 |
graphicLayer.addGraphic(fGraphic); |
|
192 |
panel.getPointOptionsPanel().getRoiGraphics(vectorialROI.getName()).add(fGraphic); |
|
193 |
} |
|
182 | 194 |
|
183 |
fGraphic = new FGraphic(geometry,graphicLayer.addSymbol(sym)); |
|
184 |
panel.getPointOptionsPanel().getMapControl().getMapContext().getGraphicsLayer().addGraphic(fGraphic); |
|
185 |
panel.getPointOptionsPanel().getRoiGraphics(roi.getName()).add(fGraphic); |
|
186 | 195 |
} |
196 |
panel.getPointOptionsPanel().getMapControl().drawGraphics(); |
|
187 | 197 |
|
188 |
panel.getPointOptionsPanel().getMapControl().drawGraphics(); |
|
189 |
panel.getPointOptionsPanel().getNewButton().setSelected(false); |
|
190 |
panel.getPointOptionsPanel().getMapControl().rePaintDirtyLayers(); |
|
191 |
|
|
192 | 198 |
int nSeries = panel.getPointOptionsPanel().getROIs().size(); |
193 | 199 |
int[][] series = new int[nSeries][pointRoi.getBandCount()+1]; |
194 | 200 |
String[] names = new String[nSeries]; |
... | ... | |
206 | 212 |
// Actualizacion del grafico |
207 | 213 |
panel.getPointOptionsPanel().UpdateChart(); |
208 | 214 |
panel.getPointOptionsPanel().getJPanelChart().setNewChart(series, names); |
209 |
|
|
215 |
panel.getPointOptionsPanel().getNewButton().setSelected(false); |
|
216 |
panel.getMapControl().setTool(panel.getPointOptionsPanel().getPreviousTool()); |
|
210 | 217 |
} catch (NotInitializeException e) { |
211 | 218 |
e.printStackTrace(); |
212 | 219 |
} catch (GridException e) { |
Also available in: Unified diff