/* */ }
/* */
/* 689 */ invalidRegion = gp == null ? null : new Area(gp);
/* */ }
/* */
/* 693 */ TileCache oldCache = oldPISP.getTileCache();
/* 694 */ this.theImage = null;
/* */
/* 698 */ if ((oldCache != null) && ((saveAllTiles) || (validTiles != null)))
/* */ {
/* 702 */ newEventRendering(this.protocolName, oldPISP, (PropertyChangeEventJAI)evt);
/* */
/* 708 */ if (((this.theImage instanceof PlanarImageServerProxy)) && (((PlanarImageServerProxy)this.theImage).getTileCache() != null))
/* */ {
/* 711 */ PlanarImageServerProxy newPISP = (PlanarImageServerProxy)this.theImage;
/* */
/* 713 */ TileCache newCache = newPISP.getTileCache();
/* */
/* 715 */ Object tileCacheMetric = newPISP.getTileCacheMetric();
/* */
/* 718 */ if (saveAllTiles) {
/* 719 */ Raster[] tiles = oldCache.getTiles(oldPISP);
/* 720 */ int numTiles = tiles == null ? 0 : tiles.length;
/* */
/* 722 */ for (int i = 0; i < numTiles; i++) {
/* 723 */ Raster tile = tiles[i];
/* 724 */ int tx = newPISP.XToTileX(tile.getMinX());
/* 725 */ int ty = newPISP.YToTileY(tile.getMinY());
/* 726 */ newCache.add(newPISP, tx, ty, tile, tileCacheMetric);
/* */ }
/* */ }
/* */ else
/* */ {
/* 731 */ int numValidTiles = validTiles.size();
/* 732 */ for (int i = 0; i < numValidTiles; i++) {
/* 733 */ Point tileIndex = (Point)validTiles.get(i);
/* 734 */ Raster tile = oldCache.getTile(oldPISP, tileIndex.x, tileIndex.y);
/* */
/* 738 */ if (tile != null) {
/* 739 */ newCache.add(newPISP, tileIndex.x, tileIndex.y, tile, tileCacheMetric);
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */ }
/* */
/* */ }
/* */ else
/* */ {
/* 751 */ ParameterBlock oldPB = null;
/* 752 */ ParameterBlock newPB = null;
/* 753 */ String oldServerName = this.serverName;
/* 754 */ String newServerName = this.serverName;
/* */
/* 756 */ boolean checkInvalidRegion = false;
/* */
/* 758 */ if (propName.equals("operationname"))
/* */ {
/* 760 */ if ((this.theImage instanceof PlanarImageServerProxy)) {
/* 761 */ newEventRendering(this.protocolName, (PlanarImageServerProxy)this.theImage, (PropertyChangeEventJAI)evt);
/* */ }
/* */ else
/* */ {
/* 765 */ this.theImage = null;
/* 766 */ createRendering();
/* */ }
/* */
/* 772 */ shouldFireEvent = true;
/* */ }
/* 777 */ else if (propName.equals("parameterblock")) {
/* 778 */ oldPB = (ParameterBlock)evt.getOldValue();
/* 779 */ newPB = (ParameterBlock)evt.getNewValue();
/* 780 */ checkInvalidRegion = true;
/* 781 */ } else if (propName.equals("sources"))
/* */ {
/* 783 */ Vector params = this.nodeSupport.getParameterBlock().getParameters();
/* */
/* 785 */ oldPB = new ParameterBlock((Vector)evt.getOldValue(), params);
/* */
/* 787 */ newPB = new ParameterBlock((Vector)evt.getNewValue(), params);
/* */
/* 789 */ checkInvalidRegion = true;
/* 790 */ } else if (propName.equals("parameters"))
/* */ {
/* 792 */ oldPB = new ParameterBlock(nodeSources, (Vector)evt.getOldValue());
/* */
/* 794 */ newPB = new ParameterBlock(nodeSources, (Vector)evt.getNewValue());
/* */
/* 796 */ checkInvalidRegion = true;
/* 797 */ } else if (propName.equals("renderinghints")) {
/* 798 */ oldPB = newPB = this.nodeSupport.getParameterBlock();
/* 799 */ checkInvalidRegion = true;
/* 800 */ } else if (propName.equals("servername")) {
/* 801 */ oldPB = newPB = this.nodeSupport.getParameterBlock();
/* 802 */ oldServerName = (String)evt.getOldValue();
/* 803 */ newServerName = (String)evt.getNewValue();
/* 804 */ checkInvalidRegion = true;
/* 805 */ } else if ((evt instanceof CollectionChangeEvent))
/* */ {
/* 808 */ int collectionIndex = nodeSources.indexOf(evtSrc);
/* 809 */ Vector oldSources = (Vector)nodeSources.clone();
/* 810 */ Vector newSources = (Vector)nodeSources.clone();
/* 811 */ oldSources.set(collectionIndex, evt.getOldValue());
/* 812 */ newSources.set(collectionIndex, evt.getNewValue());
/* */
/* 814 */ Vector params = this.nodeSupport.getParameterBlock().getParameters();
/* */
/* 817 */ oldPB = new ParameterBlock(oldSources, params);
/* 818 */ newPB = new ParameterBlock(newSources, params);
/* */
/* 820 */ checkInvalidRegion = true;
/* */ }
/* */
/* 823 */ if (checkInvalidRegion)
/* */ {
/* 825 */ shouldFireEvent = true;
/* */
/* 828 */ OperationRegistry registry = this.nodeSupport.getRegistry();
/* 829 */ RemoteDescriptor odesc = (RemoteDescriptor)registry.getDescriptor(RemoteDescriptor.class, this.protocolName);
/* */
/* 835 */ oldPB = ImageUtil.evaluateParameters(oldPB);
/* 836 */ newPB = ImageUtil.evaluateParameters(newPB);
/* */
/* 839 */ invalidRegion = (Shape)odesc.getInvalidRegion("rendered", oldServerName, oldPB, this.oldHints, newServerName, newPB, this.nodeSupport.getRenderingHints(), this);
/* */
/* 849 */ if ((invalidRegion == null) || (!(this.theImage instanceof PlanarImageServerProxy)))
/* */ {
/* 852 */ this.theImage = null;
/* */ }
/* */ else
/* */ {
/* 857 */ PlanarImageServerProxy oldRendering = (PlanarImageServerProxy)this.theImage;
/* */
/* 860 */ newEventRendering(this.protocolName, oldRendering, (PropertyChangeEventJAI)evt);
/* */
/* 865 */ if (((this.theImage instanceof PlanarImageServerProxy)) && (oldRendering.getTileCache() != null) && (((PlanarImageServerProxy)this.theImage).getTileCache() != null))
/* */ {
/* 869 */ PlanarImageServerProxy newRendering = (PlanarImageServerProxy)this.theImage;
/* */
/* 872 */ TileCache oldCache = oldRendering.getTileCache();
/* 873 */ TileCache newCache = newRendering.getTileCache();
/* */
/* 875 */ Object tileCacheMetric = newRendering.getTileCacheMetric();
/* */
/* 881 */ if (invalidRegion.getBounds().isEmpty()) {
/* 882 */ int x = oldRendering.tileXToX(oldRendering.getMinTileX());
/* */
/* 884 */ int y = oldRendering.tileYToY(oldRendering.getMinTileY());
/* */
/* 886 */ int w = oldRendering.getNumXTiles() * oldRendering.getTileWidth();
/* */
/* 888 */ int h = oldRendering.getNumYTiles() * oldRendering.getTileHeight();
/* */
/* 890 */ Rectangle tileBounds = new Rectangle(x, y, w, h);
/* */
/* 892 */ Rectangle imageBounds = oldRendering.getBounds();
/* */
/* 894 */ if (!tileBounds.equals(imageBounds)) {
/* 895 */ Area tmpArea = new Area(tileBounds);
/* 896 */ tmpArea.subtract(new Area(imageBounds));
/* 897 */ invalidRegion = tmpArea;
/* */ }
/* */ }
/* */
/* 901 */ if (invalidRegion.getBounds().isEmpty())
/* */ {
/* 904 */ Raster[] tiles = oldCache.getTiles(oldRendering);
/* */
/* 906 */ int numTiles = tiles == null ? 0 : tiles.length;
/* */
/* 908 */ for (int i = 0; i < numTiles; i++) {
/* 909 */ Raster tile = tiles[i];
/* 910 */ int tx = newRendering.XToTileX(tile.getMinX());
/* */
/* 912 */ int ty = newRendering.YToTileY(tile.getMinY());
/* */
/* 914 */ newCache.add(newRendering, tx, ty, tile, tileCacheMetric);
/* */ }
/* */
/* */ }
/* */ else
/* */ {
/* 921 */ Raster[] tiles = oldCache.getTiles(oldRendering);
/* */
/* 923 */ int numTiles = tiles == null ? 0 : tiles.length;
/* */
/* 925 */ for (int i = 0; i < numTiles; i++) {
/* 926 */ Raster tile = tiles[i];
/* 927 */ Rectangle bounds = tile.getBounds();
/* 928 */ if (!invalidRegion.intersects(bounds)) {
/* 929 */ newCache.add(newRendering, newRendering.XToTileX(bounds.x), newRendering.YToTileY(bounds.y), tile, tileCacheMetric);
/* */ }
/* */
/* */ }
/* */
/* */ }