Revision 8658 trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/SymbolTest.java

View differences:

SymbolTest.java
53 53
import com.iver.cit.gvsig.fmap.core.FShape;
54 54
import com.iver.cit.gvsig.fmap.core.IGeometry;
55 55
import com.iver.cit.gvsig.fmap.core.ISymbol;
56
import com.iver.cit.gvsig.fmap.core.symbols.DotDensityFillSymbol;
56 57
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
57 58
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
58 59
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
......
72 73
	}
73 74

  
74 75
	public void execute(String actionCommand) {
75
		FLayer lyr = null;
76 76
		IWindow w = PluginServices.getMDIManager().getActiveWindow();
77

  
77 78
		View v = (View) w;
78
		
79
		SymbolSelector symSel = new SymbolSelector(null, FShape.POLYGON);
80
		PluginServices.getMDIManager().addWindow(symSel);
81
		ISymbol sym = symSel.getSymbol();
82
		
83
		
84 79
		MapControl mCtrl = v.getMapControl();
85 80
		MapContext mc = mCtrl.getMapContext();
86
		FLayer[] actives = mc.getLayers().getActives();
87
		for (int i = 0; i < actives.length; i++) {
88
			if (actives[i] instanceof FLyrVect)
89
				lyr = actives[i];
90
		}
91
		if (lyr == null) {
92
			System.err.println("no hay capas");
93
			return;
94
		}
95
		FLyrVect l = (FLyrVect) lyr;
81

  
96 82
		GraphicLayer graphicLayer = mc.getGraphicsLayer();
97
		int idSymbol = graphicLayer.addSymbol(sym);
98
		graphicLayer.clearAllGraphics();
99
		try {
100
			SelectableDataSource sds = l.getRecordset();
101
			long rows = sds.getRowCount();
102
			for (int i = 0; i < rows; i++) {
103
				IGeometry geom = l.getSource().getShape(i);
104
				System.err.println(i+") "+geom.toString());
105
				FGraphic gra = new FGraphic(geom, idSymbol);
106
				graphicLayer.addGraphic(gra);
83

  
84

  
85
		if (actionCommand.equals("DALE!")) {
86
			FLayer lyr = null;
87

  
88
//			SymbolSelector symSel = new SymbolSelector(null, FShape.POLYGON);
89
//			PluginServices.getMDIManager().addWindow(symSel);
90
//			ISymbol sym = symSel.getSymbol();
91
			DotDensityFillSymbol sym = new DotDensityFillSymbol();
92
			sym.setDotColor(Color.RED);
93
			sym.setDotCount(20);
94
			sym.setDotSize(2);
95

  
96
			FLayer[] actives = mc.getLayers().getActives();
97
			for (int i = 0; i < actives.length; i++) {
98
				if (actives[i] instanceof FLyrVect)
99
					lyr = actives[i];
107 100
			}
108
			
109
			
110
		} catch (DriverException e) {
111
			// TODO Auto-generated catch block
112
			e.printStackTrace();
113
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
114
			// TODO Auto-generated catch block
115
			e.printStackTrace();
116
		} catch (DriverIOException e) {
117
			// TODO Auto-generated catch block
118
			e.printStackTrace();
101
			if (lyr == null) {
102
				System.err.println("no hay capas");
103
				return;
104
			}
105
			FLyrVect l = (FLyrVect) lyr;
106
			int idSymbol = graphicLayer.addSymbol(sym);
107
			graphicLayer.clearAllGraphics();
108
			try {
109
				SelectableDataSource sds = l.getRecordset();
110
				long rows = sds.getRowCount();
111
				for (int i = 0; i < rows; i++) {
112
					IGeometry geom = l.getSource().getShape(i);
113
					System.err.println(i+") "+geom.toString());
114
					FGraphic gra = new FGraphic(geom, idSymbol);
115
					graphicLayer.addGraphic(gra);
116
				}
117

  
118

  
119
			} catch (DriverException e) {
120
				// TODO Auto-generated catch block
121
				e.printStackTrace();
122
			} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
123
				// TODO Auto-generated catch block
124
				e.printStackTrace();
125
			} catch (DriverIOException e) {
126
				// TODO Auto-generated catch block
127
				e.printStackTrace();
128
			}
129
			mCtrl.drawGraphics();
130
		} else if (actionCommand.equals("CLEAN_GRAPHICS")) {
131
			graphicLayer.clearAllGraphics();
119 132
		}
120
		mCtrl.drawGraphics();
121
		
122 133
	}
123 134

  
124 135
	public boolean isEnabled() {

Also available in: Unified diff