Back to index

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

List of all members.

Public Member Functions

void mousePressed (MouseEvent e, ZirkelCanvas zc)
boolean waitForLastPoint ()
void finishConstruction (MouseEvent e, ZirkelCanvas zc)
void mouseDragged (MouseEvent e, ZirkelCanvas zc)
void mouseReleased (MouseEvent e, ZirkelCanvas zc)
boolean isFixed ()
void setFixed (ZirkelCanvas zc, ConstructionObject o)
PointObject select (int x, int y, ZirkelCanvas zc)
ConstructionObject create (Construction c, PointObject p1, PointObject p2)
void reset (ZirkelCanvas zc)
String getPrompt ()
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 mouseMoved (MouseEvent e, ZirkelCanvas zc, boolean simple)
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 ()

Protected Attributes

boolean Dragging = false

Package Attributes

PointObject P1 = null
PointObject P2 = null
ConstructionObject O
boolean Fix
boolean ShowsValue
boolean ShowsName
boolean Moved

Detailed Description

Definition at line 14 of file LineConstructor.java.


Member Function Documentation

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Reimplemented in rene.zirkel.constructors.SegmentConstructor, rene.zirkel.constructors.MidpointConstructor, and rene.zirkel.constructors.RayConstructor.

Definition at line 134 of file LineConstructor.java.

       {      if (!testTree(tree,"Line")) return false;
              XmlTag tag=tree.getTag();
              if (!tag.hasParam("from") || !tag.hasParam("to"))
              {      if (!(c instanceof Macro))
                            throw new ConstructionException("Line points missing!");
                     PrimitiveLineObject o=new PrimitiveLineObject(c);
                     setName(tag,o);
                     set(tree,o);
                     c.add(o);
                     setConditionals(tree,c,o);
              }
              else try
              {      PointObject p1=(PointObject)c.find(tag.getValue("from")); 
                     PointObject p2=(PointObject)c.find(tag.getValue("to"));
                     LineObject o=new LineObject(c,p1,p2);
                     if (tag.hasParam("partial")) o.setPartial(true);
                     setName(tag,o);
                     set(tree,o);
                     c.add(o);
                     setConditionals(tree,c,o);
              }
              catch (ConstructionException e)
              {      throw e;
              }
              catch (Exception e)
              {      throw new ConstructionException("Line points illegal!");
              }
              return true;
       }

Here is the call graph for this function:

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

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Reimplemented in rene.zirkel.constructors.SegmentConstructor, rene.zirkel.constructors.MidpointConstructor, and rene.zirkel.constructors.RayConstructor.

Definition at line 167 of file LineConstructor.java.

       {      if (nparams!=2)
                     throw new ConstructionException(Zirkel.name("exception.nparams"));
              ConstructionObject
                     P1=c.find(params[0]);
              if (P1==null)
                     throw new ConstructionException(Zirkel.name("exception.notfound")+" "+
                            params[0]);
              ConstructionObject
                     P2=c.find(params[1]);
              if (P2==null)
                     throw new ConstructionException(Zirkel.name("exception.notfound")+" "+
                            params[1]);
              if (!(P1 instanceof PointObject))
                     throw new ConstructionException(Zirkel.name("exception.type")+" "+
                            params[0]);
              if (!(P2 instanceof PointObject))
                     throw new ConstructionException(Zirkel.name("exception.type")+" "+
                            params[1]);
              LineObject s=new LineObject(c,(PointObject)P1,(PointObject)P2);
              c.add(s);
              s.setDefaults();
              if (!name.equals("")) s.setNameCheck(name);
       }

Here is the call graph for this function:

Reimplemented in rene.zirkel.constructors.SegmentConstructor, rene.zirkel.constructors.MidpointConstructor, and rene.zirkel.constructors.RayConstructor.

Definition at line 110 of file LineConstructor.java.

       {      return new LineObject(c,p1,p2);
       }

Here is the caller graph for this function:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 68 of file LineConstructor.java.

       {      P2=select(e.getX(),e.getY(),zc);
              if (P2!=null)
              {      ConstructionObject o=create(zc.getConstruction(),P1,P2);
                     zc.addObject(o);
                     o.setDefaults();
                     zc.validate();
                     zc.repaint();
                     P2=null;
              }      
       }

Here is the call graph for this function:

Reimplemented in rene.zirkel.constructors.SegmentConstructor, rene.zirkel.constructors.MidpointConstructor, and rene.zirkel.constructors.RayConstructor.

Definition at line 124 of file LineConstructor.java.

       {      return Zirkel.name("prompt.line");
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in rene.zirkel.constructors.SegmentConstructor.

Definition at line 101 of file LineConstructor.java.

       {      return false;
       }

Here is the caller graph for this function:

void rene.zirkel.constructors.LineConstructor.mouseDragged ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 80 of file LineConstructor.java.

       {      if (!Dragging) return;
              else
              {      Moved=true;
                     P2.move(zc.x(e.getX()),zc.y(e.getY()));
                     zc.validate();
                     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.LineConstructor.mousePressed ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 20 of file LineConstructor.java.

       {      if (!zc.Visual) return;
              if (P1==null)
              {      P1=select(e.getX(),e.getY(),zc);
                     if (P1!=null)
                     {      P1.setSelected(true);
                            zc.repaint();
                     }
                     showStatus(zc);
              }
              else
              {      P2=select(e.getX(),e.getY(),zc);
                     if (P2!=null)
                     {      if (P2==P1)
                            {      P2=null; return;
                            }
                            ConstructionObject o=create(zc.getConstruction(),P1,P2);
                            zc.addObject(o);
                            o.setDefaults();
                            Fix=e.isShiftDown() || isFixed();
                            if (P2.moveable() && !P2.isPointOn() && zc.isNewPoint()) 
                            {      Dragging=true; Moved=false;
                                   O=o;
                                   ShowsValue=o.showValue();
                                   ShowsName=o.showName();
                                   if ((Fix && Global.getParameter("options.movefixname",true))
                                          ||
                                          (!Fix && Global.getParameter("options.movename",false)))
                                   {      o.setShowValue(true);
                                          o.setShowName(true);
                                   }
                            }
                            else
                            {      Dragging=false;
                                   if (Fix) setFixed(zc,o);
                                   P1=P2=null;
                                   zc.clearSelected();
                                   showStatus(zc);
                            }
                     }
                     else Dragging=false;
              }
       }

Here is the call graph for this function:

void rene.zirkel.constructors.LineConstructor.mouseReleased ( MouseEvent  e,
ZirkelCanvas  zc 
) [inline]

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 90 of file LineConstructor.java.

       {      if (!Dragging) return;
              Dragging=false;
              O.setShowValue(ShowsValue);
              O.setShowName(ShowsName);
              if (Fix) O.round();
              zc.repaint();
              if (Fix && !Moved) setFixed(zc,O);
              reset(zc);
       }

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 114 of file LineConstructor.java.

       {      if (!zc.Visual)
              {      zc.setPrompt(getPrompt());
              }
              else
              {      zc.clearSelected();
                     P1=P2=null;
                     showStatus(zc);
              }
       }

Here is the call graph for this function:

Here is the caller 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 107 of file LineConstructor.java.

       {      return zc.selectCreatePoint(x,y);
       }

Here is the call graph for this function:

Here is the caller 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:

Reimplemented in rene.zirkel.constructors.SegmentConstructor.

Definition at line 104 of file LineConstructor.java.

       {
       }

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:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Reimplemented in rene.zirkel.constructors.SegmentConstructor, rene.zirkel.constructors.MidpointConstructor, and rene.zirkel.constructors.RayConstructor.

Definition at line 127 of file LineConstructor.java.

       {      if (P1==null) zc.showStatus(
                     Zirkel.name("message.line.first","Line: Set the first point!"));
              else zc.showStatus(
                     Zirkel.name("message.line.second","Line: Set the second point!"));
       }

Here is the call graph for this function:

Here is the caller 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:

Reimplemented from rene.zirkel.constructors.ObjectConstructor.

Definition at line 64 of file LineConstructor.java.

       {      return P1!=null && P2==null;
       }

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 17 of file LineConstructor.java.

Definition at line 18 of file LineConstructor.java.

Definition at line 16 of file LineConstructor.java.

Definition at line 15 of file LineConstructor.java.

Definition at line 15 of file LineConstructor.java.

Definition at line 18 of file LineConstructor.java.

Definition at line 18 of file LineConstructor.java.


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