00001 package org.ros.android.view.visualization.shape; 00002 00003 import com.google.common.base.Preconditions; 00004 00005 import org.ros.android.view.visualization.Color; 00006 import org.ros.android.view.visualization.OpenGlTransform; 00007 import org.ros.rosjava_geometry.Transform; 00008 00009 import javax.microedition.khronos.opengles.GL10; 00010 00017 abstract class BaseShape implements Shape { 00018 00019 private Color color; 00020 private Transform transform; 00021 00022 @Override 00023 public void draw(GL10 gl) { 00024 OpenGlTransform.apply(gl, getTransform()); 00025 scale(gl); 00026 } 00027 00036 protected void scale(GL10 gl) { 00037 // The default scale is in metric space. 00038 } 00039 00040 @Override 00041 public Color getColor() { 00042 Preconditions.checkNotNull(color); 00043 return color; 00044 } 00045 00046 @Override 00047 public void setColor(Color color) { 00048 this.color = color; 00049 } 00050 00051 @Override 00052 public Transform getTransform() { 00053 Preconditions.checkNotNull(transform); 00054 return transform; 00055 } 00056 00057 @Override 00058 public void setTransform(Transform pose) { 00059 this.transform = pose; 00060 } 00061 }