Revision 8931

View differences:

trunk/extensions/extCAD/src/com/iver/cit/gvsig/LayerPropertiesExtension.java
1
package com.iver.cit.gvsig;
2

  
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.plugins.Extension;
5
import com.iver.cit.gvsig.fmap.MapContext;
6
import com.iver.cit.gvsig.fmap.MapControl;
7
import com.iver.cit.gvsig.fmap.layers.FLayer;
8
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
9
import com.iver.cit.gvsig.project.documents.view.IProjectView;
10
import com.iver.cit.gvsig.project.documents.view.gui.View;
11
import com.iver.cit.gvsig.project.documents.view.legend.gui.LayerProperties;
12

  
13
public class LayerPropertiesExtension extends Extension{
14

  
15
	public void initialize() {
16
		// TODO Auto-generated method stub
17

  
18
	}
19

  
20
	public void execute(String actionCommand) {
21
		com.iver.andami.ui.mdiManager.IWindow view = PluginServices.getMDIManager().getActiveWindow();
22
		if (!(view instanceof View))
23
			return;
24
		View vista=(View)view;
25
		IProjectView model = vista.getModel();
26
		MapContext mapa = model.getMapContext();
27
		MapControl mapCtrl = vista.getMapControl();
28
		FLayer[] layers=mapa.getLayers().getActives();
29
		//layers[0].
30
		LayerProperties layerProperties=new LayerProperties(layers[0],((FLyrVect)layers[0]).getLegend());
31
		PluginServices.getMDIManager().addWindow(layerProperties);
32
	}
33

  
34
	public boolean isEnabled() {
35
		return true;
36
	}
37

  
38
	public boolean isVisible() {
39
		return true;
40
	}
41

  
42
}
0 43

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/fmap/rendering/EditionManagerLegend.java
1
package com.iver.cit.gvsig.fmap.rendering;
2

  
3
import java.util.ArrayList;
4

  
5
import com.hardcode.gdbms.engine.values.Value;
6
import com.hardcode.gdbms.engine.values.ValueFactory;
7
import com.iver.andami.PluginServices;
8
import com.iver.cit.gvsig.fmap.DriverException;
9
import com.iver.cit.gvsig.fmap.core.ISymbol;
10
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
11
import com.iver.cit.gvsig.fmap.layers.XMLException;
12

  
13
public class EditionManagerLegend implements EditionLegend{
14
	private ArrayList rules=new ArrayList();
15
	private VectorialLegend vectorialLegend;
16
	private VectorialLegend originalVectorialLegend;
17
	public EditionManagerLegend(VectorialLegend vl) {
18
		originalVectorialLegend=vl;
19
		vectorialLegend=vl;//(VectorialLegend)vl.cloneLegend();
20
	}
21
	public Value getValue(int i) {
22
		Value value=null;
23
		if (vectorialLegend instanceof VectorialUniqueValueLegend) {
24
			value=(Value)((VectorialUniqueValueLegend)vectorialLegend).getValues()[i];
25
		}else if (vectorialLegend instanceof VectorialIntervalLegend) {
26
			value=(Value)((VectorialIntervalLegend)vectorialLegend).getValues()[i];
27
		}else {
28
			value=ValueFactory.createValue(PluginServices.getText(this,"todos_los_valores"));
29
		}
30
		return value;
31
	}
32
	public ISymbol getSymbol(int i) {
33
		ISymbol symbol=null;
34
			symbol=((UniqueValueLegend)vectorialLegend).getSymbolByValue(getValue(i));
35
		return symbol;
36
	}
37
	public boolean isActived(int i) {
38
		return true;
39
	}
40
	public boolean isBlocked(int i) {
41
		return false;
42
	}
43
	public boolean isDisable(int i) {
44
		return false;
45
	}
46
	public boolean isFilled(int i) {
47
		return true;
48
	}
49
	public boolean isPresent(int i) {
50
		return true;
51
	}
52
	public void setActived(int i,boolean b) {
53
	}
54
	public void setBlocked(int i,boolean b) {
55
	}
56
	public void setDisable(int i, boolean b) {
57
	}
58
	public void setFilled(int i,boolean b) {
59
	}
60
	public void setPresent(int i, boolean b) {
61
	}
62
	public int getRowCount() {
63
		if (vectorialLegend instanceof VectorialUniqueValueLegend || vectorialLegend instanceof VectorialIntervalLegend) {
64
    		VectorialUniqueValueLegend vuvl=(VectorialUniqueValueLegend)vectorialLegend;
65
    		return vuvl.getValues().length;
66
    	}
67
        return 1;
68
	}
69
	public void setValue(int i, Object value) {
70
		Value previousValue=getValue(i);
71
		ISymbol previousSymbol=getSymbol(i);
72
		Value clave;
73
	    ISymbol theSymbol=null;
74
	    int numRow=getRowCount();
75
	    // Borramos las anteriores listas:
76
	    //((UniqueValueLegend)vectorialLegend).clear();
77

  
78
	    boolean bRestoValores = false; // PONERLO EN UN CHECKBOX
79
	    int hasta;
80
	    hasta = getRowCount();
81
//	    for (int row = 0; row < numRow; row++) {
82
//	        clave = getValue(row);
83
//	    	if (row==i)
84
	    if (!value.equals(previousValue)) {
85
	    	((UniqueValueLegend)vectorialLegend).delSymbol(previousValue);
86
	    	clave=(Value)value;
87
	        ((UniqueValueLegend)vectorialLegend).addSymbol(value, previousSymbol);
88
	        System.out.println(value);
89
//	    }
90
	    }
91
	    if (bRestoValores) {
92
	      	theSymbol = getSymbol(hasta);
93
	       	vectorialLegend.setDefaultSymbol(theSymbol);
94
	    }
95
	}
96
	public void setSymbol(int row, Object value) {
97
	}
98
}
0 99

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/fmap/rendering/EditionLegend.java
1
package com.iver.cit.gvsig.fmap.rendering;
2

  
3
public interface EditionLegend {
4

  
5
}
0 6

  

Also available in: Unified diff