Revision 10679 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/PictureMarkerSymbol.java

View differences:

PictureMarkerSymbol.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.2  2007-03-06 17:08:54  caballero
47
* Exceptions
46
* Revision 1.3  2007-03-09 11:20:57  jaume
47
* Advanced symbology (start committing)
48 48
*
49
* Revision 1.1.2.4  2007/02/21 07:34:09  jaume
50
* labeling starts working
51
*
52
* Revision 1.1.2.3  2007/02/16 10:54:12  jaume
53
* multilayer splitted to multilayerline, multilayermarker,and  multilayerfill
54
*
55
* Revision 1.1.2.2  2007/02/15 16:23:44  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.1.2.1  2007/02/09 07:47:05  jaume
59
* Isymbol moved
60
*
49 61
* Revision 1.1  2007/01/24 17:58:22  jaume
50 62
* new features and architecture error fixes
51 63
*
......
70 82
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
71 83
import com.iver.utiles.XMLEntity;
72 84

  
73
public class PictureMarkerSymbol extends AbstractMarkerSymbol {
85
/**
86
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
87
 */
88
public class PictureMarkerSymbol extends CartographicMarkerSymbol {
74 89
	private static final float SELECTION_OPACITY_FACTOR = .3F;
75
	private BufferedImage img;
76
	private MultiLayerSymbol selectionSymbol;
90
	transient private BufferedImage img;
91
	private String imagePath;
92
//	private MultiLayerSymbol selectionSymbol;
77 93

  
94
	public PictureMarkerSymbol() {
95
		super();
96
	}
97

  
78 98
	public PictureMarkerSymbol(File imageFile) throws IOException {
79 99
		img = ImageIO.read(imageFile);
100
		imagePath = imageFile.getAbsolutePath();
80 101
	}
81 102

  
82 103
	public PictureMarkerSymbol(URL imageURL) throws IOException {
......
84 105
	}
85 106

  
86 107
	public ISymbol getSymbolForSelection() {
87
		if (selectionSymbol == null) {
88
			selectionSymbol = new MultiLayerSymbol();
89
			selectionSymbol.setMultiLayerSymbolType(getSymbolType());
90
			Color selColor = FSymbol.getSelectionColor();
91
			selColor = new Color(
92
					selColor.getRed(),     // R
93
					selColor.getGreen(),   // G
94
					selColor.getBlue(),	   // B
95
					(int)(255*SELECTION_OPACITY_FACTOR) // Alpha
96
					);
97
			SimpleFillSymbol overSymbol = new SimpleFillSymbol();
98
			overSymbol.setFillColor(selColor);
99
			overSymbol.setOutlineColor(selColor);
100

  
101
			selectionSymbol.addLayer(this);
102
			selectionSymbol.addLayer(overSymbol);
103
		}
104
		return selectionSymbol;
108
		throw new Error("not yet implemented");
109
//		if (selectionSymbol == null) {
110
//			selectionSymbol = new MultiLayerMarkerSymbol();
111
//			selectionSymbol.setMultiLayerSymbolType(getSymbolType());
112
//			Color selColor = FSymbol.getSelectionColor();
113
//			selColor = new Color(
114
//					selColor.getRed(),     // R
115
//					selColor.getGreen(),   // G
116
//					selColor.getBlue(),	   // B
117
//					(int)(255*SELECTION_OPACITY_FACTOR) // Alpha
118
//					);
119
//			SimpleFillSymbol overSymbol = new SimpleFillSymbol();
120
//			overSymbol.setFillColor(selColor);
121
//
122
//			selectionSymbol.addLayer(this);
123
//			selectionSymbol.addLayer(overSymbol);
124
//		}
125
//		return selectionSymbol;
105 126
	}
106 127

  
107 128
	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
......
118 139

  
119 140
	public XMLEntity getXMLEntity() {
120 141
		// TODO Implement it
121
		throw new Error("Not yet implemented!");
122

  
142
		XMLEntity xml = new XMLEntity();
143
		xml.putProperty("className", getClassName());
144
		xml.putProperty("desc", getDescription());
145
		xml.putProperty("imagePath", imagePath);
146
		return xml;
123 147
	}
124 148

  
125 149
	public int getSymbolType() {
......
137 161
	}
138 162

  
139 163
	public void setXMLEntity(XMLEntity xml) {
140
		// TODO Implement it
141
		throw new Error("Not yet implemented!");
142

  
164
		imagePath = xml.getStringProperty("imagePath");
143 165
	}
144 166

  
145 167
	public void print(Graphics2D g, AffineTransform at, FShape shape)

Also available in: Unified diff