Revision 43391
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/TocItemLeaf.java | ||
---|---|---|
33 | 33 |
import java.awt.geom.AffineTransform; |
34 | 34 |
import java.awt.image.BufferedImage; |
35 | 35 |
import java.io.IOException; |
36 |
import java.util.logging.Level; |
|
36 | 37 |
|
37 | 38 |
import javax.swing.Icon; |
38 | 39 |
import javax.swing.ImageIcon; |
... | ... | |
44 | 45 |
import org.gvsig.app.project.documents.view.IContextMenuAction; |
45 | 46 |
import org.gvsig.app.project.documents.view.toc.actions.ChangeSymbolTocMenuEntry; |
46 | 47 |
import org.gvsig.fmap.geom.Geometry; |
48 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
49 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
50 |
import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException; |
|
51 |
import org.gvsig.fmap.geom.type.GeometryTypeNotValidException; |
|
47 | 52 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
48 | 53 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
49 | 54 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
... | ... | |
129 | 134 |
Graphics2D g2 = null; |
130 | 135 |
Rectangle r = null; |
131 | 136 |
|
132 |
switch (layerType) |
|
133 |
{ |
|
134 |
case Geometry.TYPES.POINT: |
|
135 |
case Geometry.TYPES.CURVE: |
|
136 |
case Geometry.TYPES.SURFACE: |
|
137 |
case Geometry.TYPES.MULTICURVE: |
|
138 |
case Geometry.TYPES.MULTISURFACE: |
|
139 |
case Geometry.TYPES.MULTIPOINT: |
|
140 |
img = new BufferedImage(w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB); |
|
141 |
g2 = img.createGraphics(); |
|
142 |
r = new Rectangle(w_1symbol, h_1symbol); |
|
143 |
|
|
144 |
// // TODO: CAMBIAR PARA QUE NO DEPENDA DE FSYMBOL |
|
145 |
// if (symbol instanceof FSymbol) |
|
146 |
// FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, (FSymbol) symbol); |
|
147 |
// // Por ahora, los que no sean FSymbol no se renderizan en el TOC. |
|
148 |
break; |
|
149 |
case Geometry.TYPES.GEOMETRY: |
|
137 |
switch (layerType) { |
|
138 |
case Geometry.TYPES.GEOMETRY: |
|
150 | 139 |
img = new BufferedImage(3*w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB); |
151 | 140 |
g2 = img.createGraphics(); |
152 | 141 |
r = new Rectangle(3*w_1symbol, h_1symbol); |
153 |
// if (symbol instanceof FSymbol) |
|
154 |
// FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, (FSymbol) symbol); |
|
155 | 142 |
break; |
156 | 143 |
|
144 |
case Geometry.TYPES.NULL: |
|
145 |
break; |
|
146 |
|
|
147 |
default: |
|
148 |
img = new BufferedImage(w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB); |
|
149 |
g2 = img.createGraphics(); |
|
150 |
r = new Rectangle(w_1symbol, h_1symbol); |
|
151 |
break; |
|
152 |
|
|
157 | 153 |
} |
158 | 154 |
|
159 | 155 |
if (g2 == null) { |
160 |
return null;//TODO tipo de shape no soportado.
|
|
156 |
return null; |
|
161 | 157 |
} |
162 | 158 |
try { |
163 | 159 |
ISymbol clonesym = (ISymbol) symbol.clone(); |
... | ... | |
176 | 172 |
// IMPOSSIBLE TO REACH THIS |
177 | 173 |
} |
178 | 174 |
} else { |
179 |
// should be unreachable code |
|
180 |
logger.error("Symbol type mismatch", e); |
|
175 |
logger.warn("Symbol type mismatch", e); |
|
181 | 176 |
return null; |
182 | 177 |
} |
183 | 178 |
} catch (CloneNotSupportedException e) { |
184 |
// should be unreachable code |
|
185 |
logger.error("Symbol cannot be cloned (?)", e); |
|
179 |
logger.warn("Symbol cannot be cloned (?)", e); |
|
186 | 180 |
return null; |
187 | 181 |
} |
188 | 182 |
return new ImageIcon(img); |
Also available in: Unified diff