[TeamTalk 110]: [647] TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder: 1) removed some unnecessary casts

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Fri Jul 6 21:54:18 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070706/9906ea20/attachment.html
-------------- next part --------------
Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -306,7 +306,7 @@
       placedUncertaintyRing = move.createTransformedShape(uncertaintyRing);
 
       //set transparency of the bot and label based on the placement confidence
-      alpha = distance_uncertainty > 1000? 0: 1F-(float)distance_uncertainty/1000F;
+      alpha = distance_uncertainty > 1000? 0: 1F-distance_uncertainty/1000F;
       composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);
     }
   }

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -12,8 +12,7 @@
  * @author tkharris
  */
 
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGImageDecoder;
+import javax.imageio.ImageIO;
 import edu.cmu.ravenclaw.pendecoder.scribble3.MapBufferedImage;
 import java.io.*;
 import java.util.*;
@@ -224,11 +223,12 @@
   
   public GFrame serverOpImage(GFrame f) {
     GBinary gb = f.getBinary(":jpeg");
-    JPEGImageDecoder codec = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(gb.getBytes()));
     try {
-      frame.image(codec.decodeAsBufferedImage());
+      frame.image(ImageIO.read(new ByteArrayInputStream(gb.getBytes())));
     } catch(java.io.IOException e) {
       System.err.println("problem decoding jpeg image");
+    } catch(IllegalArgumentException e) {
+      System.err.println("problem decoding jpeg image");
     }
     return (GFrame)null;
   }

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -44,7 +44,6 @@
   public void draw(Graphics2D g) {
     //System.err.println("drawing polyline");
     if(vertecies.isEmpty()) return;
-    Graphics2D g2 = (Graphics2D)g;
     if (color != null) {
       g.setColor(color);
     }
@@ -72,7 +71,6 @@
   
   public void draw(Graphics2D g, Point last) {
     if(vertecies.isEmpty()) return;
-    Graphics2D g2 = (Graphics2D)g;
     if (color != null) {
       g.setColor(color);
     }

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -16,7 +16,6 @@
   }
   
   public void draw(Graphics2D g) {
-    Graphics2D g2 = (Graphics2D)g;
     if (color != null) {
       g.setColor(color);
     }
@@ -31,7 +30,6 @@
   }
   
   public void draw(Graphics2D g, Point last) {
-    Graphics2D g2 = (Graphics2D)g;
     if (color != null) {
       g.setColor(color);
     }

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -5,7 +5,6 @@
 public class RectangleShape extends TwoEndsShape {
   
   public void draw(Graphics2D g) {
-    Graphics2D g2 = (Graphics2D)g;
     int x = (int) Math.min(start.getX(), end.getX());
     int y = (int) Math.min(start.getY(), end.getY());
     int w = (int) Math.abs(start.getX() - end.getX());

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java	2007-07-05 03:21:10 UTC (rev 646)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java	2007-07-07 01:54:16 UTC (rev 647)
@@ -32,7 +32,7 @@
   public AbstractDecoderTool getTool(int i) { 
     if (i >= 0 &&
 	i < tools.size()) { 
-      return (AbstractDecoderTool) tools.get(i); 
+      return tools.get(i); 
     }
     return null;
   }
@@ -40,7 +40,7 @@
   public AbstractDecoderTool findTool(String name) { 
     if (name != null) {
       for (int i = 0; i < tools.size(); i++) { 
-	AbstractDecoderTool tool = (AbstractDecoderTool) tools.get(i); 
+	AbstractDecoderTool tool = tools.get(i); 
 	if (name.equals(tool.getName())) {
 	  return tool;
 	}


More information about the TeamTalk-developers mailing list