// -*- tab-width: 4; -*- %{ // // Vicente Caballero Navarro %} %start Rectangle::FirstPoint %class RectangleCADTool %package com.iver.cit.gvsig.gui.cad.tools.smc %import com.iver.cit.gvsig.gui.cad.tools.RectangleCADTool %import java.awt.event.InputEvent %import com.iver.andami.PluginServices %map Rectangle %% // A task begins life in suspended animation. FirstPoint Entry { setQuestion( PluginServices.getText(this,"insert_first_point_corner")); setDescription(new String[]{"cancel"}); } Exit{ } { addPoint( pointX:double,pointY:double,event:InputEvent) SecondPointOrSquare { setQuestion(PluginServices.getText(this,"insert_point_corner_or_square")); setDescription(new String[]{"square","cancel"}); addPoint( pointX,pointY,event); } } SecondPointOrSquare{ addPoint( pointX:double,pointY:double,event:InputEvent) FirstPoint { addPoint(pointX,pointY,event); end(); } addOption(s:String) [s.equals("c") || s.equals("C") || s.equals(PluginServices.getText(this,"square"))] SecondPointSquare { setQuestion(PluginServices.getText(this,"insert_opposited_corner")); setDescription(new String[]{"cancel"}); addOption(s); } } SecondPointSquare{ addPoint( pointX:double,pointY:double,event:InputEvent) FirstPoint { addPoint( pointX,pointY,event); end(); } } Default { addOption(s:String) [s.equals(PluginServices.getText(this,"cancel"))] FirstPoint{ end(); } addOption(s:String) FirstPoint{ throwOptionException(PluginServices.getText(this,"incorrect_option"),s); } addValue(d:double) FirstPoint{ throwValueException(PluginServices.getText(this,"incorrect_value"),d); } addPoint(pointX:double,pointY:double,event:InputEvent) FirstPoint{ throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); } } %%