2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2010 - DIGITEO - Manuel JULIACHS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
13 package org.scilab.modules.graphic_objects.imageplot;
15 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MATPLOT_SCALE__;
16 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MATPLOT_TRANSLATE__;
18 import org.scilab.modules.graphic_objects.contouredObject.ClippableContouredObject;
22 * @author Manuel JULIACHS
24 public abstract class Imageplot extends ClippableContouredObject {
27 /** Grayplot properties names */
28 private enum ImageplotProperty { SCALE, TRANSLATE };
29 // Methods: to be done
31 private Double[] scale = {1.0, 1.0};
32 private Double[] translate = {0.5, 0.5};
40 * Returns the enum associated to a property name
41 * @param propertyName the property name
42 * @return the property enum
44 public Object getPropertyFromName(int propertyName) {
45 switch (propertyName) {
46 case __GO_MATPLOT_SCALE__ :
47 return ImageplotProperty.SCALE;
48 case __GO_MATPLOT_TRANSLATE__ :
49 return ImageplotProperty.TRANSLATE;
51 return super.getPropertyFromName(propertyName);
56 * Fast property get method
57 * @param property the property to get
58 * @return the property value
60 public Object getProperty(Object property) {
61 if (property == ImageplotProperty.TRANSLATE) {
62 return getTranslate();
63 } else if (property == ImageplotProperty.SCALE) {
66 return super.getProperty(property);
71 * Fast property set method
72 * @param property the property to set
73 * @param value the property value
74 * @return true if the property has been set, false otherwise
76 public UpdateStatus setProperty(Object property, Object value) {
77 if (property == ImageplotProperty.TRANSLATE) {
78 setTranslate((Double[]) value);
79 } else if (property == ImageplotProperty.SCALE) {
80 setScale((Double[]) value);
82 return super.setProperty(property, value);
85 return UpdateStatus.Success;
88 public Double[] getScale() {
89 return new Double[] {scale[0], scale[1]};
92 public void setScale(Double[] scale) {
96 public Double[] getTranslate() {
97 return new Double[] {translate[0], translate[1]};
100 public void setTranslate(Double[] translate) {
101 this.translate = translate;