Revision 17394

View differences:

trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/scatterplot/chart/ScatterPlotDiagram.java
26 26
import java.io.IOException;
27 27
import java.io.Serializable;
28 28
import java.util.EventListener;
29
import java.util.Iterator;
29 30
import java.util.ResourceBundle;
30 31

  
31 32
import javax.swing.JFileChooser;
......
37 38
import javax.swing.SwingUtilities;
38 39
import javax.swing.ToolTipManager;
39 40
import javax.swing.event.EventListenerList;
41

  
40 42
import org.jfree.chart.ChartMouseEvent;
41 43
import org.jfree.chart.ChartMouseListener;
42 44
import org.jfree.chart.ChartRenderingInfo;
......
53 55
import org.jfree.chart.plot.PlotRenderingInfo;
54 56
import org.jfree.chart.plot.Zoomable;
55 57
import org.jfree.data.Range;
58
import org.jfree.data.general.DatasetGroup;
56 59
import org.jfree.ui.ExtensionFileFilter;
57 60

  
58 61
import com.iver.andami.PluginServices;
59 62

  
60
/**
61
 * A Swing GUI component for displaying a {@link JFreeChart} object.
62
 * <P>
63
 * The panel registers with the chart to receive notification of changes to any
64
 * component of the chart.  The chart is redrawn automatically whenever this 
65
 * notification is received.
66
 */
63

  
67 64
public class ScatterPlotDiagram extends JPanel implements ChartChangeListener,
68 65
        ChartProgressListener, ActionListener, MouseListener, 
69 66
        MouseMotionListener, Printable, Serializable {
......
139 136
    /** Borrado de las Rois sobre el grafico **/
140 137
    public static final String CLEAR_CHART ="CLEAR_CHART";
141 138
    
139
 
142 140
    
143 141
    /**Contador de Rois definidas para el diagrama*/
144 142
    int contador= 0;
......
1179 1177
            this.chart.draw(g2, chartArea, this.anchor, this.info);
1180 1178
            g2.drawImage(this.chartBuffer, insets.left, insets.top, this);
1181 1179
         
1180
            // Se pintan las Roi activa
1182 1181
            drawsROIs(g2);
1183
           /* if(activeROI.shapeList.size()>0)
1184
            	   for(int i=0; i<activeROI.shapeList.size(); i++){
1185
            		   g2.setPaint(activeROI.getColor());
1186
            		   g2.fill((Shape)activeROI.shapeList.get(i));
1187
            	   }*/
1188 1182
            g2.setTransform(saved);
1189 1183

  
1190 1184
        }
......
1284 1278
        }
1285 1279
        else if (command.equals(NEW_CLASS_COMMAND)) {
1286 1280
            // Definicion de nueba clase
1287
        	if (activeROI!=null)
1288
        		roiList.add(activeROI);
1281
        //	if (activeROI!=null)
1282
        	roiList.add(activeROI);
1289 1283
        	// se genera una nueva ROI
1290 1284
        	activeROI= new ROIChart(new Color((float)Math.random(),(float)Math.random(),(float)Math.random()), "ROIChart"+contador);
1285
        	
1291 1286
        }
1292 1287

  
1293 1288
        // Acciones para el borrado de la visualizacion de las rois
1294
        else if (command.equals(NEW_CLASS_COMMAND)) {
1289
        else if (command.equals(CLEAR_CHART)) {
1295 1290
            // Definicion de nueba clase
1296
        	if (activeROI!=null)
1297
        		roiList.add(activeROI);
1298
        	// se genera una nueva ROI
1299
        	activeROI= new ROIChart(new Color((float)Math.random(),(float)Math.random(),(float)Math.random()), "ROIChart"+contador);
1291
        
1292
        	
1293
        	
1300 1294
        }
1301 1295

  
1302 1296
    }
......
1516 1510
                    	Rectangle2D rectangleArea = new Rectangle2D.Double(x, y, w, h);
1517 1511
                    	g2 = (Graphics2D)getGraphics();
1518 1512
                    	g2.setPaint(activeROI.getColor());
1519
                    	
1520
                    	g2.fillRect((int) x, (int)y, (int)w, (int)h);
1521
                    
1522
                    	
1513
           
1523 1514
                    	g2.draw(rectangleArea);
1524 1515
                    	activeROI.add(rectangleArea, getRange(rectangleArea));
1525 1516
           
1526
                    	Plot p = this.chart.getPlot();
1527
                    	 //Range r[] =getRange(rectangleArea);
1528
                    	//System.out.print("Rango del cuadrado:" +r.getLowerBound()+"a"+r.getUpperBound());
1529 1517
                    	Range r[]=getRange(rectangleArea);
1530 1518
                    	System.out.print("\n"+r[0]);
1531 1519
                    	System.out.print("\n");
......
1603 1591
     */
1604 1592
    public void mouseMoved(MouseEvent e) {
1605 1593
      
1606
    	g2 = (Graphics2D) getGraphics();
1594
    /*	g2 = (Graphics2D) getGraphics();
1607 1595
        if (this.horizontalAxisTrace) {
1608 1596
            drawHorizontalAxisTrace(g2, e.getX());
1609 1597
        }
......
1636 1624
            for (int i = listeners.length - 1; i >= 0; i -= 1) {
1637 1625
                ((ChartMouseListener) listeners[i]).chartMouseMoved(event);
1638 1626
            }
1639
        }
1627
        }*/
1640 1628

  
1641 1629
    }
1642 1630

  
......
2422 2410
    
2423 2411
    /**Pinta la lista de ROis Visibles sobre el grafico*/
2424 2412
    public void drawsROIs(Graphics2D g2){
2425
    	 if(activeROI.shapeList.size()>0)
2426
      	   for(int i=0; i<activeROI.shapeList.size(); i++){
2427
      		   g2.setPaint(activeROI.getColor());
2428
      		   g2.fill((Shape)activeROI.shapeList.get(i));
2413
    	
2414
    	Iterator iterator= roiList.getListRois().iterator();
2415
    	ROIChart roiDraw=null;
2416
    	while(iterator.hasNext()){
2417
    		roiDraw= (ROIChart)iterator.next();
2418
    		if(roiDraw.shapeList.size()>0)
2419
    			g2.setPaint(roiDraw.getColor());
2420
    			for(int i=0; i<roiDraw.shapeList.size(); i++){
2421
    				g2.draw((Shape)roiDraw.shapeList.get(i));
2429 2422
      	   }
2423
    	}
2430 2424
    //  g2.setTransform(saved);
2431 2425
    	
2432 2426
    }

Also available in: Unified diff