carmetal.objects
Class PointObject

java.lang.Object
  extended by carmetal.objects.ConstructionObject
      extended by carmetal.objects.PointObject
All Implemented Interfaces:
DriverObject, MoveableObject, carmetal.rene.lister.Element, carmetal.rene.util.sort.SortObject, Cloneable
Direct Known Subclasses:
IntersectionObject, MidpointObject

public class PointObject
extends ConstructionObject
implements MoveableObject, DriverObject

An object representing a single point


Field Summary
protected  double Alpha
           
protected  boolean AlphaValid
           
protected  boolean BarycentricCoordsInitialzed
           
static int CIRCLE
           
static int CROSS
           
static int DCROSS
           
static int DIAMOND
           
static int DOT
           
protected  carmetal.rene.zirkel.expression.Expression EX
           
protected  carmetal.rene.zirkel.expression.Expression EY
           
protected  boolean Fixed
           
protected  double Gx
           
protected  double Gy
           
static int MaxType
           
protected  boolean Moveable
           
protected  ConstructionObject MovedBy
           
static int SQUARE
           
protected  int Type
           
protected  boolean UseAlpha
           
 ConstructionObject VirtualBound
           
protected  double X
           
protected  double Y
           
 
Fields inherited from class carmetal.objects.ConstructionObject
Back, Bold, Break, BreakHide, C, Cn, ColorIndex, ColorType, Conditionals, Count, DescriptionState, DisplaysText, DL, Flag, FormulaState, gotNCount, HasZ, Hidden, HideBreak, inConstruction, Indicated, INVISIBLE, IsDrawn, JobTarget, Keep, KeepClose, LabelSelected, Large, MainParameter, Name, NCount, NeedsRecompute, NORMAL, Obtuse, Parameter, RekFlag, RekValidating, Scratch, Selectable, Selected, ShowIndicatedName, ShowName, ShowValue, SizeState, Solid, SpecialColor, SpecialParameter, StrongSelected, SuperHidden, Target, Text, THICK, THIN, Tracked, Translation, TX1, TX2, TY1, TY2, Unit, Valid, Value, VRek, XcOffset, YcOffset
 
Constructor Summary
PointObject(carmetal.construction.Construction c, double x, double y)
          Draw a point
PointObject(carmetal.construction.Construction c, double x, double y, ConstructionObject bound)
           
PointObject(carmetal.construction.Construction c, String name)
           
 
Method Summary
 void addMagnetObject(String s)
          s represents the name of an object, or the string "name:ray" where ray is the specific magnetic attraction
 void alea()
           
 boolean canKeepClose()
           
 double changedBy()
           
 void clearBoundOrder()
           
 void clearChanges()
           
 void clearMagnetObjects()
           
 void computeBarycentricCoords()
           
 ConstructionObject copy(double x, double y)
          This clones the object for macro construction.
 Enumeration depending()
          Return an enumeration of objects, that this object depends on.
 boolean dependsOnItselfOnly()
          Check if the point depends on itself and no other object.
 boolean dependsOnParametersOnly()
           
 double distanceTo(int x, int y, carmetal.rene.zirkel.ZirkelCanvas zc)
           
 boolean dontUpdate()
           
 void dontUpdate(boolean flag)
           
 void dragTo(double x, double y)
           
static double drawPoint(carmetal.rene.zirkel.graphics.MyGraphics g, carmetal.rene.zirkel.ZirkelCanvas zc, ConstructionObject o, double X, double Y, int type)
           
 boolean equals(ConstructionObject o)
           
 boolean fixed()
           
 void followMagnetObject()
           
 double getAlpha()
           
 ConstructionObject getBound()
           
 double getBoundOrder()
           
 String getCDPDisplayValue()
           
 ConstructionObject getCurrentMagnetObject()
           
 String getDisplayValue()
          To be overridden by the objects.
 int getDistance(PointObject P)
           
 String getEX()
           
 String getEY()
           
 double getIncrement()
           
 Vector getMagnetObjects()
           
 String getMagnetObjectsString()
           
 int getMagnetRay()
           
 String getMagnetRayExp()
           
 int getN()
           
 double getOldX()
           
 double getOldY()
           
 String getTag()
           
 int getType()
           
 double getX()
           
 double getY()
           
 boolean haveBoundOrder()
           
 boolean insidewindow()
           
 boolean insidewindow(double x, double y)
           
 boolean isDriverObject()
           
 boolean isInside()
           
 boolean isMagnet()
           
 boolean isOn(ConstructionObject o)
           
 boolean isPointOn()
           
 boolean isPointOnOrMagnet()
           
 void laterBind(carmetal.construction.Construction c)
          This is called after the loading of a construction has been finished.
 void magnet()
           
 void move(double x, double y)
           
 boolean moveable()
           
 boolean moveableBy(ConstructionObject o)
           
 boolean moveablePoint()
           
 void movedBy(ConstructionObject o)
           
 boolean nearto(int x, int y, carmetal.rene.zirkel.ZirkelCanvas zc)
          Test, if this object is chosen with coordinates x,y
 boolean nearto(PointObject p)
           
 void paint(carmetal.rene.zirkel.graphics.MyGraphics g, carmetal.rene.zirkel.ZirkelCanvas zc)
           
 void printArgs(carmetal.rene.util.xml.XmlWriter xml)
           
 void printType(carmetal.rene.util.xml.XmlWriter xml)
           
 void project(ConstructionObject o)
           
 void project(ConstructionObject o, double alpha)
           
 void removeMagnetObject(String name)
           
 void round()
           
 void selectMagnetObjects(boolean b)
           
 void setA(double alpha)
           
 void setAlpha(double alpha)
           
 void setBound(ConstructionObject bound)
           
 boolean setBound(String name)
           
 void setBoundOrder(double boundorder)
           
 void setCurrentMagnetObject()
           
 void setDefaults()
           
 void setFixed(boolean flag)
           
 void setFixed(String x, String y)
           
 void setHalfIncrement(carmetal.rene.zirkel.ZirkelCanvas zc)
           
 void setIncrement(double inc)
           
 void setInside(boolean flag)
           
 void setKeepClose(double x, double y)
          For bounded points.
 void setLaterBind(String s)
           
 void setMagnetObjects(String namelist)
           
 void setMagnetRayExp(String s)
           
 void setMoveable(boolean flag)
           
 void setName()
          Sets a unique name for the object.
 void setNameWithNumber(String n)
           
static void setPointLabel(carmetal.eric.JPointName jpl)
           
 void setTargetDefaults()
           
 void setType(int type)
           
 void setUseAlpha(boolean flag)
           
 void setXY(double x, double y)
           
 void setXYaway(double x, double y, int r)
           
 void shake()
           
 void snap(carmetal.rene.zirkel.ZirkelCanvas zc)
           
 boolean somethingChanged()
           
 void startDrag(double x, double y)
          Overwrite setting of default things for macro targets.
 void translate()
          Override in children! This translates the mother items.
 void translateMagnetObjects()
           
 void updateCircleDep()
           
 void updateMagnetObjects()
           
 void updateText()
           
 boolean useAlpha()
           
 void validate()
           
 void validCoordinates()
           
 
Methods inherited from class carmetal.objects.ConstructionObject
addConditional, addDepInExpressions, canDisplayName, canFix, checkConditionals, clearCircleDep, clearConditional, clearConditionals, clearParameter, compare, contains, copyProperties, dependsOn, depset, depset, depset, discardMV, displays, drawCenteredLabel, drawLabel, drawLabel, drawPointLabel, edit, equals, equalsTo, getAlias, getCDPSizeDisplay, getColor, getColorIndex, getColorIndex, getColorType, getColorType, getConditional, getConditionalColor, getConstruction, getDepArray, getDescription, getDisplaySize, getDisplayText, getE, getElementColor, getElementString, getElementString, getEquation, getEXpos, getExpression, getEYpos, getLines, getMax, getMin, getName, getNCount, getObtuse, getPointObject, getPrompt, getR, getSpecialColor, getStringLength, getText, getTranslation, getUnit, getValue, getVector, getZ, hasUnit, haveConditional, haveConditionals, helpDisplayNumber, helpDisplayValue, indicated, isBack, isBack, isBold, isBreak, isBreakHide, isDragable, isFilled, isFilledForSelect, isFixed, isFlag, isGotNCount, isHidden, isHidden, isHideBreak, isInConstruction, isJobTarget, isKeep, isKeepClose, isLarge, isMainParameter, isOwnedByControl, isParameter, isPartial, isRekFlag, isSelectable, isSlider, isSolid, isSolid, isSpecial, isSpecialParameter, isStrongSelected, isSuperHidden, isSuperHidden, isTarget, labelSelected, laterTranslate, locallyLike, maybeTransparent, mustHide, nearto, onlynearto, replaceExpressions, round, round, roundDisplay, save, secondaryParams, selected, setAlias, setBack, setBold, setBreak, setBreakHide, setcOffset, setColor, setColor, setColorType, setConstruction, setDisplaySize, setDragable, setExpression, setFilled, setFixed, setFixed, setFlag, setFont, setGotNCount, setHidden, setHideBreak, setInConstruction, setIndicated, setIndicated, setJobTarget, setKeep, setKeepClose, setLabelSelected, setLarge, setLines, setMainParameter, setName, setNameCheck, setNCount, setObtuse, setOffset, setOwnedByControl, setParameter, setPartial, setPrompt, setRekFlag, setSelectable, setSelected, setShowName, setShowValue, setSlider, setSlider, setSolid, setSpecial, setSpecialColor, setSpecialParameter, setStrongSelected, setSuperHidden, setTarget, setText, setText, setTracked, setTranslation, setUnit, showName, showName, showValue, showValue, testConditional, text1, text2, text3, text4, textAny, textcontains, toggleHidden, tracked, translateConditionals, translateExpressions, translateOffset, valid, visible, xcOffset, ycOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X

protected double X

Y

protected double Y

BarycentricCoordsInitialzed

protected boolean BarycentricCoordsInitialzed

Gx

protected double Gx

Gy

protected double Gy

Alpha

protected double Alpha

AlphaValid

protected boolean AlphaValid

UseAlpha

protected boolean UseAlpha

Moveable

protected boolean Moveable

Fixed

protected boolean Fixed

Type

protected int Type

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

DOT

public static final int DOT
See Also:
Constant Field Values

CROSS

public static final int CROSS
See Also:
Constant Field Values

DCROSS

public static final int DCROSS
See Also:
Constant Field Values

MaxType

public static int MaxType

EX

protected carmetal.rene.zirkel.expression.Expression EX

EY

protected carmetal.rene.zirkel.expression.Expression EY

MovedBy

protected ConstructionObject MovedBy

VirtualBound

public ConstructionObject VirtualBound
Constructor Detail

PointObject

public PointObject(carmetal.construction.Construction c,
                   double x,
                   double y)
Draw a point

Parameters:
c -
x - X position
y - Y position

PointObject

public PointObject(carmetal.construction.Construction c,
                   double x,
                   double y,
                   ConstructionObject bound)

PointObject

public PointObject(carmetal.construction.Construction c,
                   String name)
Method Detail

setPointLabel

public static void setPointLabel(carmetal.eric.JPointName jpl)

setName

public void setName()
Description copied from class: ConstructionObject
Sets a unique name for the object. Should be overriden in all items.

Overrides:
setName in class ConstructionObject

setNameWithNumber

public void setNameWithNumber(String n)
Overrides:
setNameWithNumber in class ConstructionObject

getTag

public String getTag()
Overrides:
getTag in class ConstructionObject

getN

public int getN()
Overrides:
getN in class ConstructionObject

setDefaults

public void setDefaults()
Overrides:
setDefaults in class ConstructionObject

setTargetDefaults

public void setTargetDefaults()
Overrides:
setTargetDefaults in class ConstructionObject

changedBy

public double changedBy()
Overrides:
changedBy in class ConstructionObject
Returns:
The change of the last validation for points bound to lines, which are defined later.

validate

public void validate()
Overrides:
validate in class ConstructionObject

updateText

public void updateText()
Overrides:
updateText in class ConstructionObject

paint

public void paint(carmetal.rene.zirkel.graphics.MyGraphics g,
                  carmetal.rene.zirkel.ZirkelCanvas zc)
Overrides:
paint in class ConstructionObject

drawPoint

public static double drawPoint(carmetal.rene.zirkel.graphics.MyGraphics g,
                               carmetal.rene.zirkel.ZirkelCanvas zc,
                               ConstructionObject o,
                               double X,
                               double Y,
                               int type)

getDisplayValue

public String getDisplayValue()
Description copied from class: ConstructionObject
To be overridden by the objects.

Overrides:
getDisplayValue in class ConstructionObject
Returns:
The string to display the value (length, coordinates) of the object.

getCDPDisplayValue

public String getCDPDisplayValue()
Overrides:
getCDPDisplayValue in class ConstructionObject

nearto

public boolean nearto(int x,
                      int y,
                      carmetal.rene.zirkel.ZirkelCanvas zc)
Description copied from class: ConstructionObject
Test, if this object is chosen with coordinates x,y

Overrides:
nearto in class ConstructionObject

nearto

public boolean nearto(PointObject p)

distanceTo

public double distanceTo(int x,
                         int y,
                         carmetal.rene.zirkel.ZirkelCanvas zc)

getX

public double getX()
Overrides:
getX in class ConstructionObject

getY

public double getY()
Overrides:
getY in class ConstructionObject

moveable

public boolean moveable()
Specified by:
moveable in interface MoveableObject

dependsOnItselfOnly

public boolean dependsOnItselfOnly()
Check if the point depends on itself and no other object. Such points are moveable, even if they are fixed.

Returns:

dependsOnParametersOnly

public boolean dependsOnParametersOnly()

moveableBy

public boolean moveableBy(ConstructionObject o)
Returns:
o can move this point (moveable and not moved by something else)

moveablePoint

public boolean moveablePoint()

setBound

public boolean setBound(String name)

setBound

public void setBound(ConstructionObject bound)

haveBoundOrder

public boolean haveBoundOrder()

setBoundOrder

public void setBoundOrder(double boundorder)

clearBoundOrder

public void clearBoundOrder()

getBound

public ConstructionObject getBound()

getBoundOrder

public double getBoundOrder()

setMoveable

public void setMoveable(boolean flag)

fixed

public boolean fixed()
Overrides:
fixed in class ConstructionObject

setFixed

public void setFixed(boolean flag)
Overrides:
setFixed in class ConstructionObject

setFixed

public void setFixed(String x,
                     String y)
Overrides:
setFixed in class ConstructionObject

validCoordinates

public void validCoordinates()
                      throws Exception
Throws:
Exception

insidewindow

public boolean insidewindow()

insidewindow

public boolean insidewindow(double x,
                            double y)

shake

public void shake()

alea

public void alea()

move

public void move(double x,
                 double y)
Specified by:
move in interface MoveableObject
Overrides:
move in class ConstructionObject

setXY

public void setXY(double x,
                  double y)

setXYaway

public void setXYaway(double x,
                      double y,
                      int r)

setA

public void setA(double alpha)

setMagnetRayExp

public void setMagnetRayExp(String s)

getMagnetRayExp

public String getMagnetRayExp()

getMagnetRay

public int getMagnetRay()

isMagnet

public boolean isMagnet()

removeMagnetObject

public void removeMagnetObject(String name)

addMagnetObject

public void addMagnetObject(String s)
s represents the name of an object, or the string "name:ray" where ray is the specific magnetic attraction

Parameters:
s -

setMagnetObjects

public void setMagnetObjects(String namelist)

selectMagnetObjects

public void selectMagnetObjects(boolean b)

updateMagnetObjects

public void updateMagnetObjects()

clearMagnetObjects

public void clearMagnetObjects()

translateMagnetObjects

public void translateMagnetObjects()

getMagnetObjects

public Vector getMagnetObjects()

getMagnetObjectsString

public String getMagnetObjectsString()

magnet

public void magnet()

setCurrentMagnetObject

public void setCurrentMagnetObject()

getCurrentMagnetObject

public ConstructionObject getCurrentMagnetObject()

followMagnetObject

public void followMagnetObject()

getDistance

public int getDistance(PointObject P)
Overrides:
getDistance in class ConstructionObject

project

public void project(ConstructionObject o)

project

public void project(ConstructionObject o,
                    double alpha)

printArgs

public void printArgs(carmetal.rene.util.xml.XmlWriter xml)
Overrides:
printArgs in class ConstructionObject

printType

public void printType(carmetal.rene.util.xml.XmlWriter xml)

getType

public int getType()
Overrides:
getType in class ConstructionObject

setType

public void setType(int type)
Overrides:
setType in class ConstructionObject

movedBy

public void movedBy(ConstructionObject o)

equals

public boolean equals(ConstructionObject o)
Overrides:
equals in class ConstructionObject

getEX

public String getEX()
Overrides:
getEX in class ConstructionObject

getEY

public String getEY()
Overrides:
getEY in class ConstructionObject

isOn

public boolean isOn(ConstructionObject o)

translate

public void translate()
Description copied from class: ConstructionObject
Override in children! This translates the mother items.

Overrides:
translate in class ConstructionObject

depending

public Enumeration depending()
Description copied from class: ConstructionObject
Return an enumeration of objects, that this object depends on. This should usually called from children via super.

Overrides:
depending in class ConstructionObject

snap

public void snap(carmetal.rene.zirkel.ZirkelCanvas zc)
Overrides:
snap in class ConstructionObject

setHalfIncrement

public void setHalfIncrement(carmetal.rene.zirkel.ZirkelCanvas zc)

updateCircleDep

public void updateCircleDep()
Overrides:
updateCircleDep in class ConstructionObject

isPointOn

public boolean isPointOn()

isPointOnOrMagnet

public boolean isPointOnOrMagnet()

setLaterBind

public void setLaterBind(String s)

copy

public ConstructionObject copy(double x,
                               double y)
Description copied from class: ConstructionObject
This clones the object for macro construction. NOTE: This must be overriden in all items to translate the mother objects.

Overrides:
copy in class ConstructionObject

computeBarycentricCoords

public void computeBarycentricCoords()

setInside

public void setInside(boolean flag)
Overrides:
setInside in class ConstructionObject

isInside

public boolean isInside()
Overrides:
isInside in class ConstructionObject

laterBind

public void laterBind(carmetal.construction.Construction c)
Description copied from class: ConstructionObject
This is called after the loading of a construction has been finished. PointObject uses this to bind to a line or circle, which is defined AFTER it.

Overrides:
laterBind in class ConstructionObject
Parameters:
c - The construction this object is in.

setAlpha

public void setAlpha(double alpha)

setUseAlpha

public void setUseAlpha(boolean flag)

useAlpha

public boolean useAlpha()

getAlpha

public double getAlpha()

round

public void round()
Overrides:
round in class ConstructionObject

setKeepClose

public void setKeepClose(double x,
                         double y)
For bounded points.

Overrides:
setKeepClose in class ConstructionObject

canKeepClose

public boolean canKeepClose()
Overrides:
canKeepClose in class ConstructionObject

dontUpdate

public boolean dontUpdate()

dontUpdate

public void dontUpdate(boolean flag)

startDrag

public void startDrag(double x,
                      double y)
Overwrite setting of default things for macro targets.

Specified by:
startDrag in interface MoveableObject

dragTo

public void dragTo(double x,
                   double y)
Specified by:
dragTo in interface MoveableObject

getOldX

public double getOldX()
Specified by:
getOldX in interface MoveableObject

getOldY

public double getOldY()
Specified by:
getOldY in interface MoveableObject

setIncrement

public void setIncrement(double inc)
Overrides:
setIncrement in class ConstructionObject

getIncrement

public double getIncrement()
Overrides:
getIncrement in class ConstructionObject

isDriverObject

public boolean isDriverObject()
Specified by:
isDriverObject in interface DriverObject
Overrides:
isDriverObject in class ConstructionObject

somethingChanged

public boolean somethingChanged()
Specified by:
somethingChanged in interface DriverObject

clearChanges

public void clearChanges()
Specified by:
clearChanges in interface DriverObject


© Copyright 2005 S.Chekanov. All Rights Reserved.
jHPlot package, a part of jHepWork: is a full-featured multiplatform data-analysis framework