Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Protected Attributes | Package Attributes
rene.zirkel.constructors.PointConstructor Class Reference
Inheritance diagram for rene.zirkel.constructors.PointConstructor:
Inheritance graph
[legend]
Collaboration diagram for rene.zirkel.constructors.PointConstructor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void mousePressed (MouseEvent e, ZirkelCanvas zc)
void mouseDragged (MouseEvent e, ZirkelCanvas zc)
void mouseReleased (MouseEvent e, ZirkelCanvas zc)
void showStatus (ZirkelCanvas zc)
boolean construct (XmlTree tree, Construction c) throws ConstructionException
String getTag ()
void construct (Construction c, String name, String params[], int nparams) throws ConstructionException
void reset (ZirkelCanvas zc)
void mouseMoved (MouseEvent e, ZirkelCanvas zc, boolean simple)
void finishConstruction (MouseEvent e, ZirkelCanvas zc)
boolean waitForLastPoint ()
boolean waitForPoint ()
void resetFirstTime (ZirkelCanvas zc)
void invalidate (ZirkelCanvas zc)
boolean testTree (XmlTree t, String tag)
void setName (XmlTag tag, ConstructionObject o)
void set (XmlTree tree, ConstructionObject o) throws ConstructionException
void setConditionals (XmlTree tree, Construction c, ConstructionObject o)
void pause (boolean flag)
boolean useSmartBoard ()

Static Public Member Functions

static void setType (XmlTag tag, PointObject p)

Protected Attributes

boolean Dragging = false

Package Attributes

boolean Fix
PointObject P
boolean ShowsValue
boolean ShowsName

Detailed Description

Definition at line 14 of file PointConstructor.java.


Member Function Documentation

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 93 of file PointConstructor.java.

       {      if (!testTree(tree,"Point")) return false;
              XmlTag tag=tree.getTag();
              if (!tag.hasParam("x") || !tag.hasParam("y"))
                     throw new ConstructionException("Point coordinates missing!");
              double x=0,y=0;
              try
              {      if (tag.hasParam("actx"))
                            x=new Double(tag.getValue("actx")).doubleValue();
                     if (tag.hasParam("acty"))
                            y=new Double(tag.getValue("acty")).doubleValue();
              }
              catch (Exception e) {}
              PointObject p=new PointObject(c,x,y);
              try
              {      x=new Expression(tag.getValue("x"),c,p).getValue();
                     y=new Expression(tag.getValue("y"),c,p).getValue();
                     p.move(x,y);
              }
              catch (Exception e) {}
              setType(tag,p);
              setName(tag,p);
              set(tree,p);
              c.add(p);
              setConditionals(tree,c,p);
              if (tag.hasParam("fixed"))
              {      p.setFixed(tag.getValue("x"),tag.getValue("y"));
              }
              if (tag.hasParam("increment"))
              {      try
                     {      p.setIncrement(new Double(tag.getValue("increment")).doubleValue());
                     }
                     catch (Exception e) {}
              }
              return true;
       }

Here is the call graph for this function:

void rene.zirkel.constructors.PointConstructor.construct ( Construction  c,
String  name,
String  params[],
int  nparams 
) throws ConstructionException [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 144 of file PointConstructor.java.

       {      if (nparams==0)
              {      PointObject p=new PointObject(c,
                            c.getX()+(Math.random()-0.5)*c.getW(),
                            c.getY()+(Math.random()-0.5)*c.getW());
                     if (!name.equals("")) p.setNameCheck(name);
                     c.add(p);
                     p.setDefaults();
                     return;
              }
              if (nparams==1)
              {      ConstructionObject o=c.find(params[0]);
                     if (o==null)
                            throw new ConstructionException(Zirkel.name("exception.notfound")+" "+
                                   params[0]);
                     if (!(o instanceof PrimitiveLineObject) && 
                            !(o instanceof PrimitiveCircleObject))
                            throw new ConstructionException(Zirkel.name("exception.type")+" "+
                                   params[0]);
                     PointObject p=new PointObject(c,
                            c.getX()+(Math.random()-0.5)*c.getW(),
                            c.getY()+(Math.random()-0.5)*c.getW(),
                            o);
                     if (!name.equals("")) p.setNameCheck(name);
                     c.add(p);
                     p.setDefaults();
                     return;
              }
              if (nparams!=2)
                     throw new ConstructionException(Zirkel.name("exception.nparams"));
              Expression e1=new Expression(params[0],c,null);
              Expression e2=new Expression(params[1],c,null);
              if (!e1.isValid() || !e2.isValid())
                     throw new ConstructionException(Zirkel.name("exception.expression"));
              PointObject p=new PointObject(c,0,0);
              try
              {      double x=new Double(params[0]).doubleValue();
                     double y=new Double(params[1]).doubleValue();
                     p.move(x,y);
              }
              catch (Exception e)
              {      p.setFixed(params[0],params[1]);
              }
              c.add(p);
              p.validate();
              p.setDefaults();
              if (!name.equals("")) p.setNameCheck(name);
       }

Here is the call graph for this function:

void rene.zirkel.constructors.ObjectConstructor.finishConstruction ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline, inherited]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 143 of file PointConstructor.java.

{ return "Point"; }
void rene.zirkel.constructors.PointConstructor.mouseDragged ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 60 of file PointConstructor.java.

       {      if (!Dragging) return;
              if (Global.getParameter("options.movename",false))
              {      P.setShowValue(true);
                     P.setShowName(true);
              }
              P.move(zc.x(e.getX()),zc.y(e.getY()));
              zc.repaint();
       }

Here is the call graph for this function:

void rene.zirkel.constructors.ObjectConstructor.mouseMoved ( MouseEvent  e,
ZirkelCanvas  zc,
boolean  simple 
) [inline, inherited]
void rene.zirkel.constructors.PointConstructor.mousePressed ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 19 of file PointConstructor.java.

       {      double x=zc.x(e.getX()),y=zc.y(e.getY());
              PointObject o=zc.selectCreatePoint(e.getX(),e.getY(),false,true);
              Dragging=false;
              if (o==null) return;
              else if (o.isPointOn())
                     // cerate a point on an object
              {      if (e.isShiftDown() && zc.isNewPoint())
                            o.setUseAlpha(true);
              }
              else if (o.moveable() && zc.isNewPoint() && !zc.showGrid())
                     // create a new point and let it be dragged
              {      P=o;
                     P.setDefaults();
                     Fix=e.isShiftDown();
                     ShowsValue=P.showValue();
                     ShowsName=P.showName();
                     Dragging=true;
                     zc.repaint();               
              }
              else if (o.moveable() && zc.isNewPoint() && zc.showGrid() && e.isShiftDown())
              {      P=o;
                     P.setDefaults();
                     try
                     {      P.setFixed(""+P.round(P.getX(),ZirkelCanvas.LengthsFactor),
                                   ""+P.round(P.getY(),ZirkelCanvas.LengthsFactor));
                            P.edit(zc);
                            P.validate();
                     }
                     catch (Exception ex) {}
              }
              else if (e.isShiftDown() && !zc.isNewPoint())
                     // create a fixed point at the position of a selected point
              {      PointObject p=
                            new PointObject(zc.getConstruction(),o.getX(),o.getY());
                     zc.addObject(p);
                     p.setDefaults();
                     p.setFixed(true);
              }
       }

Here is the call graph for this function:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 70 of file PointConstructor.java.

       {      if (!Dragging) return;
              Dragging=false;
              P.setShowValue(ShowsValue);
              P.setShowName(ShowsName);
              P.updateText();
              zc.repaint();
              if (Fix)
              {      try
                     {      P.setFixed(""+P.round(P.getX(),ZirkelCanvas.LengthsFactor),
                                   ""+P.round(P.getY(),ZirkelCanvas.LengthsFactor));
                            P.edit(zc);
                            P.validate();
                     }
                     catch (Exception ex) {}
              }
       }

Here is the call graph for this function:

void rene.zirkel.constructors.ObjectConstructor.pause ( boolean  flag) [inline, inherited]

Reimplemented in rene.zirkel.tools.ObjectTracker.

Definition at line 216 of file ObjectConstructor.java.

       {
       }

Here is the caller graph for this function:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 195 of file PointConstructor.java.

       {      super.reset(zc);
              zc.setPrompt(Zirkel.name("prompt.point"));
       }

Here is the call graph for this function:

Reimplemented in rene.zirkel.tools.MoverTool.

Definition at line 56 of file ObjectConstructor.java.

       {      reset(zc);
       }

Here is the call graph for this function:

Definition at line 76 of file ObjectConstructor.java.

       {      XmlTag tag=tree.getTag();
              if (tag.hasParam("n"))
              {      try
                     {      o.setNCount(new Integer(tag.getValue("n")).intValue());
                            o.setGotNCount(true);
                     }
                     catch (Exception ex)
                     {      throw new ConstructionException("Illegal count!");
                     }
              }
              if (tag.hasParam("hidden"))
              {      if (tag.getValue("hidden").equals("super")) o.setSuperHidden(true);
                     else o.setHidden(true);
              }
              if (tag.hasTrueParam("showvalue"))
              {      o.setShowValue(true);
              }
              if (tag.hasTrueParam("showname"))
              {      o.setShowName(true);
              }
              if (tag.hasTrueParam("background"))
              {      o.setBack(true);
              }
              else o.setBack(false);
              if (tag.hasTrueParam("parameter"))
              {      o.setParameter();
              }
              if (tag.hasTrueParam("mainparameter"))
              {      o.setMainParameter();
              }
              if (tag.hasTrueParam("target"))
              {      o.setTarget(true);
              }
              if (tag.hasTrueParam("break"))
              {      o.setBreak(true);
              }
              if (tag.hasTrueParam("hidebreak"))
              {      o.setHideBreak(true);
              }
              if (tag.hasTrueParam("solid"))
              {      o.setSolid(true);
              }
              if (tag.hasTrueParam("bold"))
              {      o.setBold(true);
              }
              if (tag.hasTrueParam("large"))
              {      o.setLarge(true);
              }
              if (tag.hasParam("xoffset") || tag.hasParam("yoffset"))
              {      int x=0,y=0;
                     try
                     {      if (tag.hasParam("xoffset"))
                                   x=Integer.parseInt(tag.getValue("xoffset"));
                            if (tag.hasParam("yoffset"))
                                   y=Integer.parseInt(tag.getValue("yoffset"));
                            o.setOffset(x,y);
                     }
                     catch (Exception e)
                     {      throw new ConstructionException("Illegal offset value");
                     }
              }
              if (tag.hasTrueParam("keepclose"))
              {      o.setKeepClose(true);
              }
              if (tag.hasParam("xcoffset") || tag.hasParam("ycoffset"))
              {      double x=0,y=0;
                     try
                     {      if (tag.hasParam("xcoffset"))
                                   x=new Double(tag.getValue("xcoffset")).doubleValue();
                            if (tag.hasParam("ycoffset"))
                                   y=new Double(tag.getValue("ycoffset")).doubleValue();
                            o.setcOffset(x,y);
                     }
                     catch (Exception e)
                     {      throw new ConstructionException("Illegal offset value");
                     }
              }
              if (tag.hasParam("color"))
              {      try
                     {      String s=tag.getValue("color");
                            int n=-1;
                            for (int i=0; i<ZirkelFrame.ColorStrings.length; i++)
                            {      if (s.equals(ZirkelFrame.ColorStrings[i]))
                                   {      o.setColor(i); n=i; break;
                                   }
                            }
                            if (n<0)
                            {      n=Integer.parseInt(s);
                                   if (n<0 || n>=ZirkelFrame.Colors.length)
                                          throw new Exception("");
                                   o.setColor(n);
                            }
                     }
                     catch (Exception ex)
                     {      throw new ConstructionException("Illegal color index (1-"+
                                   (ZirkelFrame.Colors.length-1)+")");
                     }
              }
              if (tag.hasParam("type"))
              {      String type=tag.getValue("type");
                     if (type.equals("thick")) o.setColorType(ConstructionObject.THICK);
                     if (type.equals("thin")) o.setColorType(ConstructionObject.THIN);
                     if (type.equals("invisible")) o.setColorType(ConstructionObject.INVISIBLE);
              }
              if (tag.hasParam("unit"))
                     o.setUnit(tag.getValue("unit"));
              else
                     o.setUnit("");
              Enumeration e=tree.getContent();
              while (e.hasMoreElements())
              {      tree=(XmlTree)e.nextElement();
                     if (tree.getTag() instanceof XmlTagText)
                     {      o.setText(((XmlTagText)tree.getTag()).getContent(),true);
                     }
              }
       }

Here is the call graph for this function:

Definition at line 194 of file ObjectConstructor.java.

       {      o.clearConditionals();
              int i=0;
              XmlTag tag=tree.getTag();
              while (tag.hasParam("ctag"+i) && tag.hasParam("cexpr"+i))
              {      String t=tag.getValue("ctag"+i);
                     String e=tag.getValue("cexpr"+i);
                     Expression ex=new Expression(e,c,o);
                     o.addConditional(t,ex);
                     i++;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 68 of file ObjectConstructor.java.

       {      if (tag.hasParam("name"))
              {      o.setName(tag.getValue("name"));
              }
              if (tag.hasParam("alias"))
              {      o.setAlias(tag.getValue("alias"));
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void rene.zirkel.constructors.PointConstructor.setType ( XmlTag  tag,
PointObject  p 
) [inline, static]

Definition at line 131 of file PointConstructor.java.

       {      if (tag.hasParam("shape"))
              {      String s=tag.getValue("shape");
                     if (s.equals("square")) p.setType(0);
                     if (s.equals("diamond")) p.setType(1);
                     if (s.equals("circle")) p.setType(2);
                     if (s.equals("dot")) p.setType(3);
                     if (s.equals("cross")) p.setType(4);
                     if (s.equals("dcross")) p.setType(5);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 88 of file PointConstructor.java.

       {      zc.showStatus(
                     Zirkel.name("message.point","Point: Set a point!"));
       }

Here is the call graph for this function:

boolean rene.zirkel.constructors.ObjectConstructor.testTree ( XmlTree  t,
String  tag 
) [inline, inherited]

Definition at line 65 of file ObjectConstructor.java.

       {      return t.getTag().name().equals(tag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in rene.zirkel.tools.ZoomerTool, and rene.zirkel.tools.DrawerTool.

Definition at line 15 of file ObjectConstructor.java.

Definition at line 15 of file PointConstructor.java.

Definition at line 16 of file PointConstructor.java.

Definition at line 17 of file PointConstructor.java.

Definition at line 17 of file PointConstructor.java.


The documentation for this class was generated from the following file: