Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 43294)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 43295)
@@ -101,7 +101,7 @@
  * registered.
  * </ul>
  * </p>
- * 
+ *
  * @author Vicente Caballero Navarro
  */
 public class ViewPort implements Persistent, Cloneable {
@@ -155,7 +155,7 @@
    * {@linkplain #getAdjustedExtent()} method which returns the extent that
    * contains this one but regarding the current view's aspect ratio.
    * </p>
-   * 
+   *
    * @see #getExtent()
    * @see #setEnvelope(Envelope)
    */
@@ -167,7 +167,7 @@
    * <p>
    * Location and dimensions of the extent adjusted to the image size.
    * </p>
-   * 
+   *
    * @see #getAdjustedExtent()
    */
   protected Rectangle2D adjustedExtent;
@@ -175,7 +175,7 @@
   /**
    * Draw version of the context. It's used for know when de componend has
    * changed any visualization property
-   * 
+   *
    * @see getDrawVersion
    * @see updateDrawVersion
    */
@@ -185,7 +185,7 @@
    * <p>
    * History with the last extents of the view.
    * </p>
-   * 
+   *
    * @see #setPreviousExtent()
    * @see #getExtents()
    */
@@ -208,7 +208,7 @@
    * {@link #dist3pixel dist3pixel}) .
    * </ul>
    * </p>
-   * 
+   *
    * @see #getImageSize()
    * @see #getImageHeight()
    * @see #getImageWidth()
@@ -222,7 +222,7 @@
    * coordinates</i> to the image area in the screen, in <i>screen 2D
    * coordinates</i> (pixels).
    * </p>
-   * 
+   *
    * @see AffineTransform
    * @see #getAffineTransform()
    * @see #setAffineTransform(AffineTransform)
@@ -234,7 +234,7 @@
    * <p>
    * Measurement unit used for measuring distances and displaying information.
    * </p>
-   * 
+   *
    * @see #getDistanceUnits()
    * @see #setDistanceUnits(int)
    */
@@ -244,7 +244,7 @@
    * <p>
    * Measurement unit used for measuring areas and displaying information.
    * </p>
-   * 
+   *
    * @see #getDistanceArea()
    * @see #setDistanceArea(int)
    */
@@ -254,7 +254,7 @@
    * <p>
    * Measurement unit used by this view port for the map.
    * </p>
-   * 
+   *
    * @see #getMapUnits()
    * @see #setMapUnits(int)
    */
@@ -265,7 +265,7 @@
    * Array with the {@link ViewPortListener ViewPortListener}s registered to
    * this view port.
    * </p>
-   * 
+   *
    * @see #addViewPortListener(ViewPortListener)
    * @see #removeViewPortListener(ViewPortListener)
    */
@@ -281,7 +281,7 @@
    * But in a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s <i>Layout</i> it's
    * up to the place where the <code>FFrameView</code> is located.
    * </p>
-   * 
+   *
    * @see #getOffset()
    * @see #setOffset(Point2D)
    */
@@ -298,7 +298,7 @@
    * <p>
    * Background color of this view.
    * </p>
-   * 
+   *
    * @see #getBackColor()
    * @see #setBackColor(Color)
    */
@@ -308,7 +308,7 @@
    * <p>
    * Information about the map projection used in this view.
    * </p>
-   * 
+   *
    * @see #getProjection()
    * @see #setProjection(IProjection)
    */
@@ -319,7 +319,7 @@
    * Represents the distance in <i>world coordinates</i> equivalent to 1 pixel
    * in the view with the current extent.
    * </p>
-   * 
+   *
    * @see #getDist1pixel()
    * @see #setDist1pixel(double)
    */
@@ -330,7 +330,7 @@
    * Represents the distance in <i>world coordinates</i> equivalent to 3 pixels
    * in the view with the current extent.
    * </p>
-   * 
+   *
    * @see #getDist3pixel()
    * @see #setDist3pixel(double)
    */
@@ -340,11 +340,11 @@
    * <p>
    * Ratio between the size of <code>imageSize</code> and <code>extent</code>: <br>
    * <i>
-   * 
+   *
    * <pre>
    * min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())}
    * </pre>
-   * 
+   *
    * </i>
    * </p>
    */
@@ -354,7 +354,7 @@
    * <p>
    * Clipping area.
    * </p>
-   * 
+   *
    * @see #setClipRect(Rectangle2D)
    */
   private Rectangle2D cliprect;
@@ -370,7 +370,7 @@
    * Y) coordinates of the <code>extent</code> and an area that will be an scale
    * of the image size. That area will have different height or width (not both)
    * of the extent according the least ratio (height or width) in
-   * 
+   *
    * <pre>
    * image.size/extent.size&quot;
    * </pre>.
@@ -378,7 +378,7 @@
    * <code>extent</code>.
    * </ul>
    * </p>
-   * 
+   *
    * @see #setAdjustable(boolean)
    */
   private boolean adjustableExtent = true;
@@ -388,7 +388,7 @@
    * ViewPort resolution in <i>dots-per-inch</i>. Useful to calculate the
    * geographic scale of the view.
    * </p>
-   * 
+   *
    * @see Toolkit#getScreenResolution()
    * @see MapContext#getScaleView()
    */
@@ -411,7 +411,7 @@
    * <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code>
    * </ul>
    * </p>
-   * 
+   *
    * @param proj information of the projection for this view port
    */
   public ViewPort(IProjection proj) {
@@ -430,7 +430,7 @@
    * original map in real coordinates. (Won't scale the image to adapt it to the
    * available rectangular area).
    * </p>
-   * 
+   *
    * @param boolean the boolean to be set
    */
   public void setAdjustable(boolean adjustable) {
@@ -446,7 +446,7 @@
    * Appends the specified {@link ViewPortListener ViewPortListener} listener if
    * weren't.
    * </p>
-   * 
+   *
    * @param arg0 the listener to add
    * @return <code>true</code> if has been added successfully
    * @see #removeViewPortListener(ViewPortListener)
@@ -463,7 +463,7 @@
    * Removes the specified {@link ViewPortListener ViewPortListener} listener,
    * if existed.
    * </p>
-   * 
+   *
    * @param arg0 the listener to remove
    * @return <code>true</code> if the contained the specified listener.
    * @see #addViewPortListener(ViewPortListener)
@@ -479,7 +479,7 @@
    * with the transformation affine information in the {@link #trans #trans}
    * attribute.
    * </p>
-   * 
+   *
    * @param d distance in <i>map coordinates</i>
    * @return distance equivalent in <i>screen coordinates</i>
    * @see #toMapDistance(int)
@@ -505,7 +505,7 @@
    * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
    * transformation in the {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param x the <code>x</code> <i>map coordinate</i> of a 2D point
    * @param y the <code>y</code> <i>map coordinate</i> of a 2D point
    * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
@@ -532,7 +532,7 @@
    * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
    * transformation in the {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param point the 2D point in <i>map coordinates</i>
    * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
    * @see #toMapPoint(Point2D)
@@ -548,7 +548,7 @@
    * coordinates</i> (pixels) to <i>map coordinates</i> using the affine
    * transformation in the {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param x the <code>x</code> <i>screen coordinate</i> of a 2D point
    * @param y the <code>y</code> <i>screen coordinate</i> of a 2D point
    * @return 2D point equivalent in <i>map coordinates</i>
@@ -568,7 +568,7 @@
    * <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using
    * {@linkplain #toMapDistance(int)}, and {@linkplain #toMapPoint(int, int)}.
    * </p>
-   * 
+   *
    * @param r the 2D rectangle in <i>screen coordinates</i> (pixels)
    * @return 2D rectangle equivalent in <i>map coordinates</i>
    * @see #fromMapRectangle(Rectangle2D)
@@ -589,7 +589,7 @@
    * coordinates</i> to <i>map coordinates</i> using the transformation affine
    * information in the {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param d distance in pixels
    * @return distance equivalent in <i>map coordinates</i>
    * @see #fromMapDistance(double)
@@ -607,7 +607,7 @@
    * coordinates</i> (pixels) to <i>map coordinates</i> using the inverse affine
    * transformation of the {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param pScreen the 2D point in <i>screen coordinates</i> (pixels)
    * @return 2D point equivalent in <i>map coordinates</i>
    * @see #toMapPoint(int, int)
@@ -657,7 +657,7 @@
    * <p>
    * If the projection of this view is UTM, considers the Earth curvature.
    * </p>
-   * 
+   *
    * @param pt1 a 2D point in <i>map coordinates</i>
    * @param pt2 another 2D point in <i>map coordinates</i>
    * @return the distance in meters between the two points 2D
@@ -682,7 +682,7 @@
    * Sets as extent and adjusted extent of this view port, the previous.
    * Recalculating its parameters.
    * </p>
-   * 
+   *
    * @see #getExtents()
    * @see #calculateAffineTransform()
    * @deprecated use {@link ViewPort#setPreviousEnvelope()}
@@ -697,13 +697,13 @@
    * Recalculating its parameters.
    * Stores the current extent in the next extents of the history.
    * </p>
-   * 
+   *
    * @see #getExtents()
    * @see #calculateAffineTransform()
    */
   public void setPreviousEnvelope() {
     this.updateDrawVersion();
-    
+
 //    extentsHistory.putNext(extent);
 //    extent = extentsHistory.removePrev();
     extent = extentsHistory.setPreviousExtent();
@@ -721,15 +721,15 @@
    * Recalculating its parameters.
    * Stores the current extent in the previous extents of the history.
    * </p>
-   * 
+   *
    * @see #getExtents()
    * @see #calculateAffineTransform()
    */
   public void setNextEnvelope() {
     this.updateDrawVersion();
-    
+
     extent = extentsHistory.setNextExtent();
-    
+
     // Calcula la transformaci�n af�n
     calculateAffineTransform();
 
@@ -753,7 +753,7 @@
    * If you are looking for the complete extent currently shown, you must use
    * the {@linkplain #getAdjustedExtent()} method.
    * </p>
-   * 
+   *
    * @return the current extent
    * @see #setEnvelope(Envelope)
    * @see #getAdjustedExtent()
@@ -781,7 +781,7 @@
    * If you are looking for the complete extent currently shown, you must use
    * the {@linkplain #getAdjustedEnvelope()} method.
    * </p>
-   * 
+   *
    * @return the current envelope
    * @see #setEnvelope(Envelope)
    * @see #getAdjustedEnvelope()
@@ -810,7 +810,7 @@
    * <ul>
    * <li>Stores the previous extent.
    * <li>Calculates the new extent using <code>r</code>:
-   * 
+   *
    * <pre>
    * extent = new Rectangle2D.Double(r.getMinX() - 0.1, r.getMinY() - 0.1,
    *     r.getWidth() + 0.2, r.getHeight() + 0.2);
@@ -823,7 +823,7 @@
    * the extent has changed.
    * </ul>
    * </p>
-   * 
+   *
    * @param r the new extent
    * @see #getExtent()
    * @see #getExtents()
@@ -859,8 +859,8 @@
 
     // Calcula la transformaci�n af�n
     calculateAffineTransform();
-   
 
+
     // Lanzamos los eventos de extent cambiado
     callExtentChanged(getAdjustedExtent());
   }
@@ -877,7 +877,7 @@
    * that the extent has changed.
    * </ul>
    * </p>
-   * 
+   *
    * @see #setEnvelope(Envelope)
    * @see #calculateAffineTransform()
    */
@@ -902,7 +902,7 @@
    * scale that is the extent in <i>screen coordinates</i> from the image in
    * <i>map coordinates</i>.
    * </p>
-   * 
+   *
    * @return the scale <i>extent / image size</i> projected by this view port
    * @deprecated since 07/09/07, use {@linkplain MapContext#getScaleView()}
    */
@@ -932,7 +932,7 @@
    * coordinates</i> (pixels), preserving the "straightness" and "parallelism"
    * of the lines.
    * </p>
-   * 
+   *
    * @return the affine transformation
    * @see #setAffineTransform(AffineTransform)
    * @see #calculateAffineTransform()
@@ -945,7 +945,7 @@
    * <p>
    * Returns the size of the image projected.
    * </p>
-   * 
+   *
    * @return the image size
    * @see #setImageSize(Dimension)
    * @see #getImageHeight()
@@ -960,7 +960,7 @@
    * Sets the size of the image projected, recalculating the parameters of this
    * view port.
    * </p>
-   * 
+   *
    * @param imageSize the image size
    * @see #getImageSize()
    * @see #calculateAffineTransform()
@@ -979,7 +979,7 @@
    * Notifies to all view port listeners registered, that the adjusted extent of
    * this view port has changed.
    * </p>
-   * 
+   *
    * @param newRect the new adjusted extend
    * @see #refreshExtent()
    * @see #setEnvelope(Envelope)
@@ -1001,7 +1001,7 @@
    * Notifies to all view port listeners registered, that the time of this view
    * port has changed.
    * </p>
-   * 
+   *
    * @param newTime the new time
    * @see #refreshExtent()
    * @see #setTime(Time)
@@ -1022,7 +1022,7 @@
    * Notifies to all view port listeners registered, that the background color
    * of this view port has changed.
    * </p>
-   * 
+   *
    * @param c the new background color
    * @see #setBackColor(Color)
    * @see ColorEvent
@@ -1042,7 +1042,7 @@
    * Notifies to all view port listeners registered, that the projection of this
    * view port has changed.
    * </p>
-   * 
+   *
    * @param projection the new projection
    * @see #setProjection(IProjection)
    * @see ProjectionEvent
@@ -1075,7 +1075,7 @@
    * {@link #dist3pixel dist3pixel}) .
    * </ul>
    * </p>
-   * 
+   *
    * @see #getAffineTransform()
    * @see #setAffineTransform(AffineTransform)
    * @see #refreshExtent()
@@ -1175,7 +1175,7 @@
    * <p>
    * The offset is the position where start drawing the map.
    * </p>
-   * 
+   *
    * @param p 2D point that represents the offset in pixels
    * @see #getOffset()
    */
@@ -1193,7 +1193,7 @@
    * <p>
    * The offset is the position where start drawing the map.
    * </p>
-   * 
+   *
    * @return 2D point that represents the offset in pixels
    * @see #setOffset(Point2D)
    */
@@ -1205,7 +1205,7 @@
    * <p>
    * Sets the background color.
    * </p>
-   * 
+   *
    * @param c the new background color
    * @see #getBackColor()
    */
@@ -1221,7 +1221,7 @@
    * <p>
    * Gets the background color.
    * </p>
-   * 
+   *
    * @return the background color of the view
    * @see #setBackColor(Color)
    */
@@ -1234,7 +1234,7 @@
    * Returns the extent currently covered by the view adjusted (scaled) to the
    * image size aspect.
    * </p>
-   * 
+   *
    * @return extent of the view adjusted to the image size aspect
    * @see #setAdjustable(boolean)
    * @deprecated use {@link ViewPort#getAdjustedEnvelope()} instead
@@ -1248,42 +1248,41 @@
    * Returns the envelope currently covered by the view adjusted (scaled) to the
    * image size aspect.
    * </p>
-   * 
+   *
    * @return envelope of the view adjusted to the image size aspect
    * @see #setAdjustable(boolean)
    */
-  public Envelope getAdjustedEnvelope() {
-    if (cliprect != null) {
-      Rectangle2D r = adjustedExtent.createIntersection(cliprect);
-      try {
-        return geomManager.createEnvelope(r.getX(), r.getY(), r.getMaxX(),
-            r.getMaxY(), SUBTYPES.GEOM2D);
-      }
-      catch (CreateEnvelopeException e) {
-        e.printStackTrace();
-        logger.error("Error adjusting the extent", e);
-      }
+    public Envelope getAdjustedEnvelope() {
+        if (adjustedExtent == null) {
+            calculateAffineTransform();
+        }
+        if (cliprect != null) {
+            Rectangle2D r = adjustedExtent.createIntersection(cliprect);
+            try {
+                return geomManager.createEnvelope(r.getX(), r.getY(), r.getMaxX(), r.getMaxY(), SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        if (adjustedExtent != null) {
+            try {
+                return geomManager.createEnvelope(adjustedExtent.getX(), adjustedExtent.getY(),
+                    adjustedExtent.getMaxX(), adjustedExtent.getMaxY(), SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        return null;
     }
-    if (adjustedExtent != null) {
-      try {
-        return geomManager.createEnvelope(adjustedExtent.getX(),
-            adjustedExtent.getY(), adjustedExtent.getMaxX(),
-            adjustedExtent.getMaxY(), SUBTYPES.GEOM2D);
-      }
-      catch (CreateEnvelopeException e) {
-        e.printStackTrace();
-        logger.error("Error adjusting the extent", e);
-      }
-    }
-    return null;
-  }
 
   /**
    * <p>
    * Returns the measurement unit of this view port used for measuring distances
    * and displaying information.
    * </p>
-   * 
+   *
    * @return the measurement unit of this view used for measuring distances and
    *         displaying information
    * @see #setDistanceUnits(int)
@@ -1297,7 +1296,7 @@
    * Returns the measurement unit of this view port used for measuring areas and
    * displaying information.
    * </p>
-   * 
+   *
    * @return the measurement unit of this view used for measuring areas and
    *         displaying information
    * @see #setDistanceUnits(int)
@@ -1311,7 +1310,7 @@
    * Sets the measurement unit of this view port used for measuring distances
    * and displaying information.
    * </p>
-   * 
+   *
    * @param distanceUnits the measurement unit of this view used for measuring
    *          distances and displaying information
    * @see #getDistanceUnits()
@@ -1325,7 +1324,7 @@
    * Sets the measurement unit of this view port used for measuring areas and
    * displaying information.
    * </p>
-   * 
+   *
    * @param distanceUnits the measurement unit of this view used for measuring
    *          areas and displaying information
    * @see #getDistanceUnits()
@@ -1338,7 +1337,7 @@
    * <p>
    * Gets the measurement unit used by this view port for the map.
    * </p>
-   * 
+   *
    * @return Returns the current map measure unit
    * @see #setMapUnits(int)
    */
@@ -1350,7 +1349,7 @@
    * <p>
    * Sets the measurement unit used by this view port for the map.
    * </p>
-   * 
+   *
    * @param mapUnits the new map measure unit
    * @see #getMapUnits()
    */
@@ -1375,7 +1374,7 @@
    * {@link #dist3pixel dist3pixel}) .
    * </ul>
    * </p>
-   * 
+   *
    * @see #getImageHeight()
    * @see #getImageSize()
    * @see #setImageSize(Dimension)
@@ -1401,7 +1400,7 @@
    * {@link #dist3pixel dist3pixel}) .
    * </ul>
    * </p>
-   * 
+   *
    * @see #getImageWidth()
    * @see #getImageSize()
    * @see #setImageSize(Dimension)
@@ -1415,7 +1414,7 @@
    * Gets the distance in <i>world coordinates</i> equivalent to 1 pixel in the
    * view with the current extent.
    * </p>
-   * 
+   *
    * @return the distance
    * @see #setDist1pixel(double)
    */
@@ -1428,7 +1427,7 @@
    * Sets the distance in <i>world coordinates</i> equivalent to 1 pixel in the
    * view with the current extent.
    * </p>
-   * 
+   *
    * @param dist1pixel the distance
    * @see #getDist1pixel()
    */
@@ -1445,7 +1444,7 @@
    * Gets the distance in <i>world coordinates</i> equivalent to 3 pixels in the
    * view with the current extent.
    * </p>
-   * 
+   *
    * @return the distance
    * @see #setDist3pixel(double)
    */
@@ -1458,7 +1457,7 @@
    * Sets the distance in <i>world coordinates</i> equivalent to 3 pixels in the
    * view with the current extent.
    * </p>
-   * 
+   *
    * @param dist3pixel the distance
    * @see #getDist3pixel()
    */
@@ -1474,7 +1473,7 @@
    * <p>
    * Returns the last previous extents of this view port.
    * </p>
-   * 
+   *
    * @return the last previous extents of this view port
    * @see #setPreviousExtent()
    * @deprecated use {@link ViewPort#getEnvelopes()}
@@ -1487,7 +1486,7 @@
    * <p>
    * Returns the last previous extents of this view port.
    * </p>
-   * 
+   *
    * @return the last previous extents of this view port
    * @see #setPreviousExtent()
    */
@@ -1499,7 +1498,7 @@
    * <p>
    * Gets the projection used in this view port.
    * </p>
-   * 
+   *
    * @return projection used in this view port
    * @see #setProjection(IProjection)
    */
@@ -1511,7 +1510,7 @@
    * <p>
    * Sets the projection to this view port.
    * </p>
-   * 
+   *
    * @param proj the new projection
    * @see #getProjection()
    */
@@ -1540,7 +1539,7 @@
    * <p>
    * <b><i>This method could be problematic!</i></b>
    * </p>
-   * 
+   *
    * @param at the affine transform to set
    * @see #getAffineTransform()
    * @see #calculateAffineTransform()
@@ -1604,7 +1603,7 @@
    * <li>XML entity of the internal {@link ExtentHistory ExtentHistory} .
    * </ul>
    * </ul>
-   * 
+   *
    * @return the XML entity
    * @see #createFromXML(XMLEntity)
    */
@@ -1697,7 +1696,7 @@
 
   /**
    * Clone the view port without clone the listeners nor the extent history.
-   * 
+   *
    * @return the cloned view port
    */
   public Object clone() throws CloneNotSupportedException {
@@ -1741,7 +1740,7 @@
    * <code>{@linkplain #imageSize}</code>, <code>{@linkplain #scale}</code>, and
    * <code>{@linkplain #trans}</code>.
    * </p>
-   * 
+   *
    * @return a <code>string</code> representation of the main values of this
    *         view port
    */
@@ -1759,7 +1758,7 @@
    * <p>
    * Sets the position and size of the clipping rectangle.
    * </p>
-   * 
+   *
    * @param rectView the clipping rectangle to set
    */
   public void setClipRect(Rectangle2D rectView) {
@@ -1774,7 +1773,7 @@
    * transform</i> with the transformation affine information in the
    * {@link #trans #trans} attribute.
    * </p>
-   * 
+   *
    * @param r the 2D rectangle in <i>map coordinates</i>
    * @return 2D rectangle equivalent in <i>screen coordinates</i> (pixels)
    * @see #toMapRectangle(Rectangle2D)
@@ -1794,7 +1793,7 @@
    * Recalculates the current <code>{@linkplain #extent}</code> using an scale.
    * It's necessary execute {@linkplain #refreshExtent()} after.
    * </p>
-   * 
+   *
    * @param s the scale to set
    * @deprecated since 07/09/07, use {@linkplain MapContext#setScaleView(long)}
    */
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java	(revision 43294)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java	(revision 43295)
@@ -212,8 +212,8 @@
 
                 if (use_intersection_cond) {
                     Evaluator iee = SpatialEvaluatorsFactory.getInstance().intersects(
-                            vp_env_in_store_crs, 
-                            store_crs, 
+                            vp_env_in_store_crs,
+                            store_crs,
                             featureStore
                     );
                     if (feat_query == null) {
@@ -414,7 +414,7 @@
 		// decide if the data must be drawn or not
 		// Checks if the viewport envelope intersects with the data envelope
 		// This condition may seem redundant, but sometimes the transformations may fail and cause false negatives.
-		if (!viewPortEnvelope.intersects(reprojectedDataEnvelope) && !(reprojectedViewPortEnvelope!=null && reprojectedViewPortEnvelope.intersects(dataEnvelope))) {
+		if ((viewPortEnvelope==null || !viewPortEnvelope.intersects(reprojectedDataEnvelope)) && !(reprojectedViewPortEnvelope!=null && reprojectedViewPortEnvelope.intersects(dataEnvelope))) {
 			// The data is not visible in the current viewport, do nothing.
 			return;
 		}
@@ -501,8 +501,8 @@
             }
 
             Evaluator iee = SpatialEvaluatorsFactory.getInstance().intersects(
-                    viewPortEnvelopeInMyProj, 
-                    dataProjection, 
+                    viewPortEnvelopeInMyProj,
+                    dataProjection,
                     featureStore
             );
             featureQuery.addFilter(iee);
