View Javadoc
1 /* ------------------------------------------------------------------- 2 GeoVISTA Center (Penn State, Dept. of Geography) 3 Java source file for the class LayerRaster 4 Copyright (c), 2002, GeoVISTA Center 5 All Rights Reserved. 6 Original Author: Frank Hardisty 7 $Author: hardisty $ 8 $Id: LayerRaster.java,v 1.2 2003/04/25 17:23:47 hardisty Exp $ 9 $Date: 2003/04/25 17:23:47 $ 10 Reference: Document no: 11 ___ ___ 12 ------------------------------------------------------------------- * 13 */ 14 15 16 package edu.psu.geovista.app.map; 17 18 import java.awt.image.*; 19 import java.awt.*; 20 21 22 /*** 23 * put your documentation comment here 24 */ 25 public class LayerRaster 26 implements ImageObserver { 27 //private GeoReference gvGeoReference; 28 private transient BufferedImage bufferedImage; 29 private transient Raster originalImage; 30 private Image img; 31 32 /*** 33 * This always returns true. This method is here to allow this class to 34 * implement the interface "ImageObserver". 35 * @param img 36 * @param infoflags 37 * @param x 38 * @param y 39 * @param width 40 * @param height 41 * @return 42 */ 43 public boolean imageUpdate (Image img, int infoflags, int x, int y, int width, 44 int height) { 45 return true; 46 } 47 48 /* 49 * selectionX1 is expected to be less than selectionX2, same with Y1 and y2 50 */ 51 public void findSelection (int selectionX1, int selectionX2, int selectionY1, 52 int selectionY2) { 53 //replace old selection 54 //LayerSelection oldLayerSelection = new LayerSelection(gvLayerSelection); 55 //int x1 = oldLayerSelection.selectionX1; 56 //int y1 = oldLayerSelection.selectionY1; 57 //bufferedImage.set 58 //gvLayerSelection.setSelection(selectionX1, selectionX2, selectionY1, 59 // selectionY2); 60 //copy section to be colored differently 61 //originalSection = new Raster(); 62 bufferedImage.setData(originalImage); 63 //set selection pixels to selection color 64 int intAlpha, intRed, intBlue, intGreen, intARGB; 65 intAlpha = 255; // 66 intRed = 0; 67 intBlue = 255; 68 intGreen = 255; 69 intARGB = (intAlpha << 24) | (intRed << 16) | (intGreen << 8) | (intBlue << 0); 70 for (int pixelX = selectionX1; pixelX < selectionX2; pixelX++) { 71 for (int pixelY = selectionY1; pixelY < selectionY2; pixelY++) { 72 bufferedImage.setRGB(pixelX, pixelY, intARGB); 73 } 74 } 75 } 76 /* 77 * selectionX1 is expected to be less than selectionX2, same with Y1 and y2 78 */ 79 public void findSelectionShift (int selectionX1, int selectionX2, int selectionY1, 80 int selectionY2) { 81 82 } 83 84 /*** 85 * put your documentation comment here 86 * @param g2 87 */ 88 public void render (Graphics2D g2) { 89 //g2.setTransform(this.gvGeoReference.mapAffineTransform); 90 //it would be really nice to specify the pixels to be drawn here, using 91 //the affineTransform. 92 //g2.drawImage(bufferedImage, BufferedImag); 93 g2.drawImage((Image)bufferedImage, 0, 0, this); 94 } 95 96 }

This page was automatically generated by Maven