/[schmitzm]/trunk/src/skrueger/geotools/XMapPane.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/XMapPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 555 by alfonx, Tue Nov 24 09:17:22 2009 UTC revision 558 by alfonx, Tue Nov 24 13:01:09 2009 UTC
# Line 466  public class XMapPane extends JPanel { Line 466  public class XMapPane extends JPanel {
466          /**          /**
467           * This color is used as the default background color when painting a map.           * This color is used as the default background color when painting a map.
468           */           */
469          private Color mapBackgroundColor = Color.WHITE;          private Color mapBackgroundColor = null;
470    
471          /**          /**
472           * A flag indicating that the shown image is invalid and needs to be           * A flag indicating that the shown image is invalid and needs to be
# Line 616  public class XMapPane extends JPanel { Line 616  public class XMapPane extends JPanel {
616                                                  if (!isWellDefined())                                                  if (!isWellDefined())
617                                                          return;                                                          return;
618    
619                                                  LOGGER.info("resizeTimer performed");                                                  LOGGER.debug("resizeTimer performed");
620    
621                                                  final Rectangle bounds = getVisibleRect();                                                  final Rectangle bounds = getVisibleRect();
622                                                  //                                                  //
# Line 628  public class XMapPane extends JPanel { Line 628  public class XMapPane extends JPanel {
628                                                                  bounds.y + bounds.height);                                                                  bounds.y + bounds.height);
629    
630                                                  if (setMapArea(geoMapArea)) {                                                  if (setMapArea(geoMapArea)) {
631                                                          LOGGER.info("  maparea changed");                                                          LOGGER.debug("  maparea changed");
632                                                          paneResized = true;                                                          paneResized = true;
633                                                  } else                                                  } else
634                                                          LOGGER.info("  maparea NOT changed");                                                          LOGGER.debug("  maparea NOT changed");
635                                          }                                          }
636                                  });                                  });
637                  resizeTimer.setRepeats(false);                  resizeTimer.setRepeats(false);
# Line 643  public class XMapPane extends JPanel { Line 643  public class XMapPane extends JPanel {
643                          @Override                          @Override
644                          public void componentResized(final ComponentEvent e) {                          public void componentResized(final ComponentEvent e) {
645    
646                                  // Seems to be called twice with the same size..                                  // Seems to be called twice with the same size..
647                                  if (oldVisibleRect != null                                  if (oldVisibleRect != null
648                                                  && oldVisibleRect.equals(getVisibleRect())){                                                  && oldVisibleRect.equals(getVisibleRect())) {
649                                          LOGGER.info("skipping resize.");                                          LOGGER.debug("skipping resize.");
650                                          return;                                          return;
651                                  }                                  }
652    
653                                  LOGGER.info("resized: " + getVisibleRect());                                  LOGGER.debug("resized: " + getVisibleRect());
654                                  resizeTimer.restart();                                  resizeTimer.restart();
655                                  oldVisibleRect = getVisibleRect();                                  oldVisibleRect = getVisibleRect();
656                          }                          }
# Line 1146  public class XMapPane extends JPanel { Line 1146  public class XMapPane extends JPanel {
1146          }          }
1147    
1148          /**          /**
1149           * Returns the background {@link Color} of the map pane. Default is white.           * Returns the background {@link Color} of the map pane. If not set, the
1150             * methods looks for a parent component and will use its background color.
1151             * If no parent component is available, WHITE is returned.
1152           **/           **/
1153          public Color getMapBackgroundColor() {          public Color getMapBackgroundColor() {
1154                    if (mapBackgroundColor == null){
1155                            if (getParent() != null) return getParent().getBackground();
1156                            else return Color.WHITE;
1157                    }
1158                  return mapBackgroundColor;                  return mapBackgroundColor;
1159          }          }
1160    
# Line 1418  public class XMapPane extends JPanel { Line 1424  public class XMapPane extends JPanel {
1424           * completed.           * completed.
1425           */           */
1426          public void onRenderingCompleted() {          public void onRenderingCompleted() {
1427                  LOGGER.info("complete");                  LOGGER.debug("complete");
1428    
1429                  repaintTimer.stop();                  repaintTimer.stop();
1430    
# Line 1712  public class XMapPane extends JPanel { Line 1718  public class XMapPane extends JPanel {
1718          }          }
1719    
1720          public boolean setMapArea(final Envelope newMapArea) {          public boolean setMapArea(final Envelope newMapArea) {
1721                    if (newMapArea == null)
1722                            return false;
1723                    if (getMapContext()
1724                                    .getCoordinateReferenceSystem() == null) return false;
1725                  return setMapArea(new ReferencedEnvelope(newMapArea, getMapContext()                  return setMapArea(new ReferencedEnvelope(newMapArea, getMapContext()
1726                                  .getCoordinateReferenceSystem()));                                  .getCoordinateReferenceSystem()));
1727          }          }
# Line 1792  public class XMapPane extends JPanel { Line 1802  public class XMapPane extends JPanel {
1802           * @param if <code>null</code>, white is used.           * @param if <code>null</code>, white is used.
1803           */           */
1804          public void setMapBackgroundColor(Color bgColor) {          public void setMapBackgroundColor(Color bgColor) {
                 if (bgColor == null)  
                         bgColor = Color.WHITE;  
1805                  this.mapBackgroundColor = bgColor;                  this.mapBackgroundColor = bgColor;
1806          }          }
1807    

Legend:
Removed from v.555  
changed lines
  Added in v.558

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26