Back to index

wims  3.65+svn20090927
MacroRunner.java
Go to the documentation of this file.
00001 package rene.zirkel.macro;
00002 
00007 import java.awt.BorderLayout;
00008 import java.awt.Frame;
00009 import java.awt.GridLayout;
00010 import java.awt.Panel;
00011 import java.awt.TextField;
00012 import java.awt.event.MouseEvent;
00013 import java.util.Enumeration;
00014 import java.util.StringTokenizer;
00015 
00016 import rene.gui.ButtonAction;
00017 import rene.gui.CloseDialog;
00018 import rene.gui.MyLabel;
00019 import rene.gui.MyPanel;
00020 import rene.gui.Panel3D;
00021 import rene.gui.TextFieldAction;
00022 import rene.zirkel.Zirkel;
00023 import rene.zirkel.ZirkelCanvas;
00024 import rene.zirkel.construction.Construction;
00025 import rene.zirkel.construction.ConstructionException;
00026 import rene.zirkel.construction.DepList;
00027 import rene.zirkel.construction.Selector;
00028 import rene.zirkel.constructors.*;
00029 import rene.zirkel.objects.*;
00030 
00031 class MacroPrompt extends CloseDialog
00032 {      boolean Valid;
00033        TextField T;
00034        String S="";
00035 
00036        public MacroPrompt (Frame f, String o)
00037        {      super(f,Zirkel.name("macro.prompt.title"),true);
00038               setLayout(new BorderLayout());
00039               
00040               Panel p=new MyPanel();
00041               p.setLayout(new BorderLayout());
00042               p.add("North",new MyLabel(Zirkel.name("macro.prompt.prompt")));
00043               Panel h=new MyPanel();
00044               h.setLayout(new GridLayout(1,0));
00045               h.add(new MyLabel(o));
00046               h.add(T=new TextFieldAction(this,"OK","",20));
00047               p.add("South",h);
00048               add("Center",new Panel3D(p));
00049               
00050               Panel s=new MyPanel();
00051               s.add(new ButtonAction(this,Zirkel.name("ok"),"OK"));
00052               s.add(new ButtonAction(this,Zirkel.name("abort"),"Close"));
00053               add("South",new Panel3D(s));
00054               
00055               Valid=false;
00056               
00057               pack();
00058               center(f);
00059               pack();
00060        }
00061        
00062        public void doAction (String o)
00063        {      if (o.equals("OK"))
00064               {      S=T.getText();
00065                      Valid=true;
00066                      doclose();
00067               }
00068               else super.doAction(o);
00069        }
00070        
00071        public boolean isValid () { return Valid; }
00072        public String getValue () { return S; }
00073 }
00074 
00075 public class MacroRunner extends ObjectConstructor
00076        implements Selector
00077 {      String S[];
00078        int Param;
00079        Macro M;
00080        ConstructionObject Params[]; // array of parameters.
00081        boolean NewPoint[]; // are the parameters new points?
00082        boolean Fixed[];
00083 
00089        public void setMacro (Macro m, ZirkelCanvas zc)
00090        {      S=m.getPrompts(); Param=0; M=m;
00091               Params=new ConstructionObject[S.length];
00092               Fixed=new boolean[S.length];
00093               NewPoint=new boolean[S.length];
00094               for (int i=0; i<S.length; i++) Fixed[i]=false;
00095        }
00096 
00103        public void mousePressed (MouseEvent e, ZirkelCanvas zc)
00104        {      if (!zc.Visual) return;
00105               ConstructionObject o=null;
00106               ConstructionObject p[]=M.getParams();
00107               if (p[Param] instanceof PointObject)
00108                      o=zc.selectCreatePoint(e.getX(),e.getY());
00109               else
00110                      o=zc.selectWithSelector(e.getX(),e.getY(),this);
00111               if (o==null) return;
00112               int ip=Param;
00113               if (!setNextParameter(o,zc,e.isShiftDown())) return;
00114               NewPoint[ip]=(o instanceof PointObject && zc.isNewPoint());
00115               if (Param>=S.length)
00116               {      doMacro(zc);
00117                      reset(zc);
00118               }
00119               else getFixed(zc);
00120        }
00121        
00122        public boolean isAdmissible (ZirkelCanvas zc, ConstructionObject o)
00123        {      ConstructionObject p[]=M.getParams();
00124               if (p[Param] instanceof PointObject)
00125                      return (o instanceof PointObject);
00126               else if (p[Param] instanceof FixedAngleObject)
00127                      return (o instanceof FixedAngleObject);
00128               else if (p[Param] instanceof SegmentObject)
00129                      return (o instanceof SegmentObject);
00130               else if (p[Param] instanceof RayObject)
00131                      return (o instanceof RayObject);
00132               else if (p[Param] instanceof TwoPointLineObject)
00133                      return (o instanceof TwoPointLineObject);
00134               else if (p[Param] instanceof PrimitiveLineObject)
00135                      return (o instanceof PrimitiveLineObject);
00136               else if (p[Param] instanceof PrimitiveCircleObject)
00137                      return (o instanceof PrimitiveCircleObject);
00138               else if (p[Param] instanceof FunctionObject)
00139                      return (o instanceof FunctionObject);
00140               else if (p[Param] instanceof UserFunctionObject)
00141                      return (o instanceof UserFunctionObject);
00142               else if (p[Param] instanceof AngleObject)
00143                      return (o instanceof AngleObject);
00144               else if (p[Param] instanceof ExpressionObject)
00145                      return (o instanceof ExpressionObject || 
00146                                    o instanceof AngleObject ||
00147                                    o instanceof FixedAngleObject ||
00148                                    o instanceof AreaObject);
00149               else if (p[Param] instanceof AreaObject)
00150                      return (o instanceof AreaObject);         
00151               else return false;
00152        }
00153        
00154        public void mouseMoved (MouseEvent e, ZirkelCanvas zc, boolean simple)
00155        {      ConstructionObject p[]=M.getParams();
00156               if (!(p[Param] instanceof PointObject) && Param==p.length-1)
00157               {      zc.clearPreview();
00158                      zc.repaint();
00159                      ConstructionObject o=zc.selectWithSelector(e.getX(),e.getY(),this,false);
00160                      if (o!=null)
00161                      {      zc.prepareForPreview(e);
00162                             Params[Param]=o;
00163                             runMacroPreview(zc);
00164                             zc.indicateWithSelector(e.getX(),e.getY(),this);
00165                             return;
00166                      }
00167               }
00168               if (!simple && waitForLastPoint())
00169               {      if (zc.isPreview())
00170                      {      zc.movePreview(e);
00171                      }
00172                      else
00173                      {      zc.prepareForPreview(e);
00174                             finishConstruction(e,zc);
00175                             return;
00176                      }
00177               }
00178               if (p[Param] instanceof PointObject)
00179                      zc.indicateCreatePoint(e.getX(),e.getY(),true);
00180               else
00181                      zc.indicateWithSelector(e.getX(),e.getY(),this);
00182        }
00183        
00184        public boolean waitForLastPoint ()
00185        {      if (M.countPrompts()>0) return false;
00186               ConstructionObject p[]=M.getParams();
00187               return (p[Param] instanceof PointObject) && Param==p.length-1;
00188        }
00189        
00190        public void finishConstruction (MouseEvent e, ZirkelCanvas zc)
00191        {      ConstructionObject p[]=M.getParams();
00192               ConstructionObject o;
00193               if (p[Param] instanceof PointObject)
00194                      o=zc.selectCreatePoint(e.getX(),e.getY());
00195               else return;
00196               NewPoint[Param]=true;
00197               Params[Param]=o;
00198               runMacroPreview(zc);
00199        }
00200 
00201        public void reset (ZirkelCanvas zc)
00202        {      if (zc.Visual)
00203               {      super.reset(zc);
00204                      Param=0;
00205                      if (M!=null && M.hasFixed()) getFixed(zc);
00206                      showStatus(zc);
00207               }
00208               else if (M!=null) // show the input pattern
00209               {      StringBuffer b=new StringBuffer();
00210                      b.append('=');
00211                      String name=M.getName();
00212                      if (name.indexOf("(")>0) b.append("\""+M.getName()+"\""); 
00213                      else b.append(M.getName());
00214                      b.append('(');
00215                      for (int i=0; i<M.getParams().length-1; i++)
00216                      {      b.append(',');
00217                      }
00218                      b.append(')');
00219                      zc.setPrompt(b.toString());
00220               }
00221        }
00222        
00223        public void getFixed (ZirkelCanvas zc)
00224        {      if (M==null || !zc.Visual) return;
00225               boolean start=(Param==0);
00226               while ((M.isFixed(Param) || M.getPrompts()[Param].startsWith("="))
00227                      && Param<(start?S.length-1:S.length))
00228               {      String name;
00229                      if (M.isFixed(Param)) name=M.getLast(Param);
00230                      else name=M.getPrompts()[Param].substring(1);
00231                      if (name.equals(""))
00232                      {      M.setFixed(Param,false);
00233                             break;
00234                      }
00235                      ConstructionObject o=zc.getConstruction().find(name);
00236                      if (o==null)
00237                      {      M.setFixed(Param,false);
00238                             break;
00239                      }
00240                      if (!setNextParameter(o,zc,false)) return;
00241                      if (Param>=S.length)
00242                      {      doMacro(zc);
00243                             reset(zc);
00244                             break;
00245                      }
00246               }
00247               showStatus(zc);
00248        }
00249 
00250        public void returnPressed (ZirkelCanvas zc)
00251        {      if (M==null || !zc.Visual) return;
00252               String name=M.getLast(Param);
00253               if (name.equals("")) return;
00254               ConstructionObject o=zc.getConstruction().find(name);
00255               if (!setNextParameter(o,zc,false)) return;
00256               if (Param>=S.length)
00257               {      doMacro(zc);
00258                      reset(zc);
00259               }
00260               else getFixed(zc);
00261        }
00262 
00263        public boolean setNextParameter (ConstructionObject o,
00264               ZirkelCanvas zc, boolean fix)
00265        {      if (!isAdmissible(zc,o)) return false;
00266               Params[Param]=o;
00267               o.setSelected(true);
00268               if (fix) Fixed[Param]=true;
00269               zc.getConstruction().addParameter(o);
00270               zc.repaint();
00271               Param++;
00272               return true;
00273        }
00274        
00275        public void doMacro (ZirkelCanvas zc)
00276        {      String value[]=new String[0];
00277               runMacro(zc,value);
00278        }
00279 
00280        static DepList DL=new DepList();
00281        
00282        public void showStatus (ZirkelCanvas zc)
00283        {      if (M!=null)
00284               {      ConstructionObject p[]=M.getParams();
00285                      String type="???";
00286                      // Determine the expected type and display in status line
00287                      if (p[Param] instanceof PointObject)
00288                             type=Zirkel.name("name.Point");
00289                      else if (p[Param] instanceof FixedAngleObject)
00290                             type=Zirkel.name("name.FixedAngle");
00291                      else if (p[Param] instanceof SegmentObject)
00292                             type=Zirkel.name("name.Segment");
00293                      else if (p[Param] instanceof LineObject)
00294                             type=Zirkel.name("name.TwoPointLine");
00295                      else if (p[Param] instanceof RayObject)
00296                             type=Zirkel.name("name.Ray");
00297                      else if (p[Param] instanceof PrimitiveLineObject)
00298                             type=Zirkel.name("name.Line");
00299                      else if (p[Param] instanceof PrimitiveCircleObject)
00300                             type=Zirkel.name("name.Circle");
00301                      else if (p[Param] instanceof ExpressionObject)
00302                             type=Zirkel.name("name.Expression");
00303                      else if (p[Param] instanceof AreaObject)
00304                             type=Zirkel.name("name.Polygon");
00305                      else if (p[Param] instanceof AngleObject)
00306                             type=Zirkel.name("name.Angle");
00307                      String s=M.getLast(Param);
00308                      String prompt;
00309                      if (s.equals(""))
00310                             prompt=ConstructionObject.text4(
00311                                    Zirkel.name("message.runmacro"),
00312                                    M.getName(),""+(Param+1),type,S[Param]);
00313                      else
00314                             prompt=ConstructionObject.text4(
00315                                    Zirkel.name("message.runmacro"),
00316                                    M.getName(),""+(Param+1),type,S[Param])+" "+
00317                                    ConstructionObject.text1(
00318                                    Zirkel.name("message.runmacro.return"),M.getLast(Param));
00319                      zc.showStatus(prompt);
00320               }
00321        }
00322 
00327        public void runMacro (ZirkelCanvas zc, Construction c, String value[])
00328        {      M.setTranslation(c);
00329               ConstructionObject LastBefore=c.last();
00330               int N=Params.length;
00331               // First clear all parameter flags. This makes it possible to
00332               // check for proper translation of secondary parameters later.
00333               // Secondary parameters without a translation will be
00334               // constructed.
00335               Enumeration e=M.elements();
00336               while (e.hasMoreElements())
00337               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00338                      o.clearParameter(); o.setTranslation(null);
00339               }
00340               M.clearTranslations();
00341               c.clearTranslators();
00342               ConstructionObject p[]=M.getParams();
00343               // For all macro paramters, determine the translation to the
00344               // real construction, and do the same for the secondary
00345               // parameters, which belong to the parameter. The secondary
00346               // parameters are stored in the macro at its definition, as
00347               // the primary ones. Also the parameters in the macros are marked
00348               // as such to make sure and prevent construction.
00349               M.initLast(); // Macros remember the parameters for next call
00350               for (int i=0; i<N; i++)
00351               {      M.setLast(Params[i].getName(),i);
00352                      p[i].setTranslation(Params[i]);
00353                      p[i].setMainParameter();
00354                      if (NewPoint[i] && p[i].isHidden())
00355                             Params[i].setHidden(true);
00356                      if (Params[i] instanceof PointObject 
00357                                    && p[i] instanceof PointObject
00358                                    && NewPoint[i])
00359                      {      PointObject pa=(PointObject)Params[i],pp=(PointObject)p[i];
00360                             pa.setIncrement(pp.getIncrement());
00361                             if (pp.getBound()!=null)
00362                             {      pa.setBound(pp.getBound());
00363                                    pa.setInside(pp.isInside());
00364                                    pa.translate();
00365                             }
00366                      }
00367                      // translate parameters that depend on themself only
00368                      if (Params[i] instanceof PointObject 
00369                                    && p[i] instanceof PointObject
00370                                    && ((PointObject)p[i]).dependsOnItselfOnly())
00371                      {      PointObject P=(PointObject)Params[i];
00372                             // Do not transfer self reference to objects that depend on something!
00373                             // This might crash the construction.
00374                             if (!P.depending().hasMoreElements())
00375                             {      P.setConstruction(M);
00376                                    P.setFixed(((PointObject)p[i]).getEX(),((PointObject)p[i]).getEY());
00377                                    P.translateConditionals();
00378                                    P.translate();
00379                                    P.setConstruction(c);
00380                             }
00381                      }
00382                      if (p[i].isMainParameter())
00383                      {      // System.out.println("Main Parameter "+p[i].getName());
00384                             e=p[i].secondaryParams();
00385                             // Copy the list of secondary parameters in the macro,
00386                             // which depend from p[i] to DL.
00387                             DL.reset();
00388                             while (e.hasMoreElements())
00389                             {      ConstructionObject o=(ConstructionObject)e.nextElement();
00390                                    // System.out.println("Secondary Parameter "+o.getName()+" of "+p[i].getName());
00391                                    DL.add(o);
00392                                    o.setParameter();
00393                             }
00394                             e=DL.elements();
00395                             // Get a list of actual secondary params in the
00396                             // construction. Then translate the scecondary params
00397                             // in the macro definition to the true construction objects.
00398                             Enumeration ep=Params[i].secondaryParams();
00399                             while (ep.hasMoreElements() && e.hasMoreElements())
00400                             {      ConstructionObject o=
00401                                           (ConstructionObject)e.nextElement();
00402                                    ConstructionObject op=
00403                                           (ConstructionObject)ep.nextElement();
00404                                    if (o.getTranslation()!=op && o.getTranslation()!=null)
00405                                    {      zc.warning(Zirkel.name("macro.usage"));
00406                                           return;
00407                                    }
00408                                    o.setTranslation(op);
00409                             }
00410                      }
00411               }
00412               // Now we generate the objects.
00413               e=M.elements();
00414               while (e.hasMoreElements())
00415               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00416                      // System.out.println(o.getName()+" "+o.isParameter());
00417                      if (!o.isParameter())
00418                             // else do not construct!
00419                      {      // Copy the object and add to construction. Then
00420                             // translate the dependencies properly
00421                             ConstructionObject oc=(ConstructionObject)o.copy();
00422                             oc.setKeep(false); // necessary for jobs
00423                             oc.setTarget(false); // necessary for descriptive constructions
00424                             c.addNoCheck(oc);
00425                             o.setTranslation(oc);
00426                             oc.validate();
00427                             c.added(oc);
00428                             // For the target objects, use default values instead
00429                             // of values stored in the macro (point style etc.)
00430                             if (o.isTarget()) oc.setTargetDefaults();
00431                             //else if (o.isHidden()) oc.setHidden(true);
00432                             // For black objects, use the default color.
00433                             if (oc.getColorIndex()==0)
00434                                    oc.setColor(c.DefaultColor);
00435                             // Handle objects to prompt for:
00436                             if ((oc instanceof FixedCircleObject ||
00437                                    oc instanceof FixedAngleObject ||
00438                                    oc instanceof ExpressionObject) &&
00439                                    M.promptFor(o.getName()))
00440                             {      c.updateCircleDep();
00441                                    c.dovalidate();
00442                                    zc.repaint();
00443                                    int index=M.getPromptFor(o.getName());
00444                                    String v="";
00445                                    if (index>=value.length || value[index].equals(""))
00446                                    {      MacroPrompt pr=new MacroPrompt(zc.getFrame(),
00447                                                  M.getPromptName(o.getName()));
00448                                           pr.setVisible(true);
00449                                           if (pr.isValid()) v=pr.getValue();
00450                                    }
00451                                    else v=value[index];
00452                                    if (!v.equals(""))
00453                                    {      oc.setFixed(v);
00454                                           zc.check();
00455                                    }
00456                                    else
00457                                    {      zc.warning(Zirkel.name("macro.prompt.illegal"));
00458                                    }
00459                             }
00460                      }
00461               }
00462               // Now fix the objects, which depend on later objects
00463               e=M.elements();
00464               while (e.hasMoreElements())
00465               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00466                      if (!o.isParameter()) o.laterTranslate(M);
00467               }
00468               c.updateCircleDep();
00469               c.runTranslators(M);
00470               c.dovalidate();
00471               zc.repaint();
00472               int fixed=0;
00473               for (int i=0; i<Fixed.length; i++)
00474                      if (Fixed[i]) fixed++;
00475               if (fixed>0 && fixed<Fixed.length && !M.hasFixed())
00476               {      String name=M.getName()+" -";
00477                      for (int i=0; i<Fixed.length; i++)
00478                      {      if (Fixed[i])
00479                                    name=name+" "+M.LastParams[i];
00480                      }
00481                      M=zc.copyMacro(M,name,Fixed);
00482                      for (int i=0; i<Fixed.length; i++) Fixed[i]=false;
00483                      reset(zc);
00484               }
00485               if (LastBefore!=null && M.hideDuplicates())
00486                      zc.hideDuplicates(LastBefore);
00487        }
00488        
00489        public void runMacro (ZirkelCanvas zc, String value[])
00490        {      runMacro(zc,zc.getConstruction(),value);
00491        }
00492 
00493        public void runMacroPreview (ZirkelCanvas zc)
00494        {      Construction c=zc.getConstruction();
00495               M.setTranslation(c);
00496               int N=Params.length;
00497               // First clear all parameter flags. This makes it possible to
00498               // check for proper translation of secondary parameters later.
00499               // Secondary parameters without a translation will be
00500               // constructed.
00501               Enumeration e=M.elements();
00502               while (e.hasMoreElements())
00503               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00504                      o.clearParameter(); o.setTranslation(null);
00505               }
00506               M.clearTranslations();
00507               c.clearTranslators();
00508               ConstructionObject p[]=M.getParams();
00509               // For all macro paramters, determine the translation to the
00510               // real construction, and do the same for the secondary
00511               // parameters, which belong to the parameter. The secondary
00512               // parameters are stored in the macro at its definition, as
00513               // the primary ones. Also the parameters in the macros are marked
00514               // as such to make sure and prevent construction.
00515               for (int i=0; i<N; i++)
00516               {      M.setLast(Params[i].getName(),i);
00517                      p[i].setTranslation(Params[i]);
00518                      p[i].setMainParameter();
00519                      if (NewPoint[i] && p[i].isHidden())
00520                             Params[i].setHidden(true);
00521                      if (p[i].isMainParameter())
00522                      {      e=p[i].secondaryParams();
00523                             // Copy the list of secondary parameters in the macro,
00524                             // which depend from p[i] to DL.
00525                             DL.reset();
00526                             while (e.hasMoreElements())
00527                             {      ConstructionObject o=(ConstructionObject)e.nextElement();
00528                                    DL.add(o);
00529                                    o.setParameter();
00530                             }
00531                             e=DL.elements();
00532                             // Get a list of actual secondary params in the
00533                             // construction. Then translate the scecondary params
00534                             // in the macro definition to the true construction objects.
00535                             Enumeration ep=Params[i].secondaryParams();
00536                             while (ep.hasMoreElements() && e.hasMoreElements())
00537                             {      ConstructionObject o=
00538                                           (ConstructionObject)e.nextElement();
00539                                    ConstructionObject op=
00540                                           (ConstructionObject)ep.nextElement();
00541                                    if (o.getTranslation()!=op && o.getTranslation()!=null)
00542                                    {      //zc.warning(Zirkel.name("macro.usage"));
00543                                           return;
00544                                    }
00545                                    if (o!=null) o.setTranslation(op);
00546                             }
00547                      }
00548               }
00549               // Now we generate the objects.
00550               e=M.elements();
00551               while (e.hasMoreElements())
00552               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00553                      if (!o.isParameter())
00554                             // else do not construct!
00555                      {      // Copy the object and add to construction. Then
00556                             // translate the dependencies properly
00557                             ConstructionObject oc=(ConstructionObject)o.copy();
00558                             oc.setKeep(false); // necessary for jobs
00559                             oc.setTarget(false); // necessary for descriptive constructions
00560                             oc.setSelectable(false);
00561                             oc.setIndicated(true);
00562                             c.addNoCheck(oc);
00563                             o.setTranslation(oc);
00564                             oc.validate();
00565                             c.added(oc);
00566                             // For the target objects, use default values instead
00567                             // of values stored in the macro (point style etc.)
00568                             if (o.isTarget()) oc.setTargetDefaults();
00569                             if (o.isHidden()) oc.setHidden(true);
00570                             // For black objects, use the default color.
00571                             if (oc.getColorIndex()==0)
00572                                    oc.setColor(c.DefaultColor);
00573                      }
00574               }
00575               // All objects have the chance to translate anything
00576               // (used by start and end points of arcs)
00577               e=M.elements();
00578               while (e.hasMoreElements())
00579               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00580                      if (!o.isParameter()) o.laterTranslate(M);
00581               }
00582               c.updateCircleDep();
00583               // Run the translations of forward references of type @...
00584               c.runTranslators(M);
00585               c.dovalidate();
00586               zc.repaint();
00587        }
00588        
00594        public void run (ZirkelCanvas zc, Construction c,
00595               String name, String params[], int nparams)
00596               throws ConstructionException
00597        {      ConstructionObject p[]=M.getParams();
00598               if (nparams!=p.length+M.countPrompts())
00599                      throw new ConstructionException(Zirkel.name("exception.nparams"));
00600               String value[]=new String[M.countPrompts()];
00601               for (int i=0; i<M.countPrompts(); i++)
00602                      value[i]=params[p.length+i];
00603               for (int i=0; i<p.length; i++)
00604               {      ConstructionObject o=c.find(params[i]);
00605                      if (o==null)
00606                             throw new ConstructionException(
00607                                    Zirkel.name("exception.notfound"));
00608                      if (p[Param] instanceof PointObject)
00609                             if (!(o instanceof PointObject))
00610                                    throw new ConstructionException(
00611                                           Zirkel.name("exception.type"));
00612                      else if (p[Param] instanceof SegmentObject)
00613                             if (!(o instanceof SegmentObject))
00614                                    throw new ConstructionException(
00615                                           Zirkel.name("exception.type"));
00616                      else if (p[Param] instanceof LineObject)
00617                             if (!(o instanceof LineObject))
00618                                    throw new ConstructionException(
00619                                           Zirkel.name("exception.type"));
00620                      else if (p[Param] instanceof RayObject)
00621                             if (!(o instanceof RayObject))
00622                                    throw new ConstructionException(
00623                                           Zirkel.name("exception.type"));
00624                      else if (p[Param] instanceof PrimitiveLineObject)
00625                             if (!(o instanceof PrimitiveLineObject))
00626                                    throw new ConstructionException(
00627                                           Zirkel.name("exception.type"));
00628                      else if (p[Param] instanceof PrimitiveCircleObject)
00629                             if (!(o instanceof PrimitiveCircleObject))
00630                                    throw new ConstructionException(
00631                                           Zirkel.name("exception.type"));
00632                      else
00633                             throw new ConstructionException(
00634                                    Zirkel.name("exception.type"));
00635                      Params[i]=o;
00636               }
00637               runMacro(zc,c,value);
00638               StringTokenizer t=new StringTokenizer(name,",");
00639               Enumeration e=M.getTargets().elements();
00640               while (e.hasMoreElements() && t.hasMoreTokens())
00641               {      ConstructionObject o=(ConstructionObject)e.nextElement();
00642                      o.getTranslation().setName(t.nextToken().trim());
00643               }
00644               zc.repaint();
00645        }
00646 
00647 }