Class JXG.GeometryElement
This is the basic class for geometry elements like points, circles and lines.
Defined in: GeometryElement.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a new GeometryElement object.
|
Field Attributes | Field Name and Description |
---|---|
Elements on which this elements depends on are stored here.
|
|
Reference to board where the element is drawn
|
|
Stores all dependent objects to be updated when this point is moved.
|
|
Determines the elements border-style.
|
|
Elements depending on this element are stored here.
|
|
If true the element will be drawn in grey scale colors to visualize that it's only a draft.
|
|
The fill color of this geometry element.
|
|
Opacity for fill color.
|
|
If true the element is fixed and can not be dragged around.
|
|
If element has a label subelement then this property will be set to true.
|
|
The fill color of the given geometry element when the mouse is pointed over it.
|
|
Opacity for fill color when the object is highlighted.
|
|
The stroke color of the given geometry element when the user moves the mouse over it.
|
|
Opacity for stroke color when the object is highlighted.
|
|
Width of the element's stroke when the mouse is pointed over it.
|
|
Unique identifier for the element.
|
|
If element is in two dimensional real space this is true, else false.
|
|
display layer which will conting the element.
|
|
Not necessarily unique name for the element.
|
|
If this is set to true, the element is updated in every update
call of the board.
|
|
Controls if updates are necessary
|
|
Stores all Intersection Objects which in this moment are not real and
so hide this element.
|
|
Counts the number of objects drawn as part of the trace of the element.
|
|
Quadratic form representation of circles (and conics)
|
|
If true the element will get a shadow.
|
|
[c,b0,b1,a,k,r,q0,q1]
See
A.E.
|
|
The stroke color of the given geometry element.
|
|
Opacity for element's stroke color.
|
|
Width of the element's stroke.
|
|
Stores variables for symbolic computations
|
|
If true the element will be traced, i.e.
|
|
Keeps track of all objects drawn as part of the trace of the element.
|
|
Stores the transformations which are applied during update in an array
|
|
If false the element won't be visible on the board, otherwise it is shown.
|
|
An associative array containing all visual properties.
|
Method Attributes | Method Name and Description |
---|---|
addChild(obj)
Add an element as a child to the current element.
|
|
Adds a label to the element.
|
|
animate(hash, time)
Animates properties for that object like stroke or fill color, opacity and maybe
even more later.
|
|
Removes all objects generated by the trace function.
|
|
Hide the element.
|
|
Highlights the element.
|
|
labelColor(lColor)
Set the labelColor of an element
|
|
Uses the "normal" properties of the element.
|
|
remove()
Removes the element from the construction.
|
|
setArrow(firstArrow, lastArrow)
Determines whether the arc has arrows at start or end of the arc.
|
|
setProperty(%)
Sets an arbitrary number of properties.
|
|
Make the element visible.
|
|
update()
General update method.
|
Field Detail
{Object}
ancestors
Elements on which this elements depends on are stored here.
{JXG.Board}
board
Reference to board where the element is drawn
- See:
- JXG.Board
- Default Value:
- null
{Object}
childElements
Stores all dependent objects to be updated when this point is moved.
{Number}
dash
Determines the elements border-style.
Possible values are:
- 0 for a solid line
- 1 for a dotted line
- 2 for a line with small dashes
- 3 for a line with medium dashes
- 4 for a line with big dashes
- 5 for a line with alternating medium and big dashes and large gaps
- 6 for a line with alternating medium and big dashes and small gaps
- Default Value:
- 0
{Object}
descendants
Elements depending on this element are stored here.
{boolean}
draft
If true the element will be drawn in grey scale colors to visualize that it's only a draft.
{string}
fillColor
The fill color of this geometry element.
{number}
fillOpacity
Opacity for fill color.
{Boolean}
fixed
If true the element is fixed and can not be dragged around. The element
will be repositioned on zoom and moveOrigin events.
- Default Value:
- false
{Boolean}
hasLabel
If element has a label subelement then this property will be set to true.
- Default Value:
- false
{string}
highlightFillColor
The fill color of the given geometry element when the mouse is pointed over it.
{number}
highlightFillOpacity
Opacity for fill color when the object is highlighted.
{string}
highlightStrokeColor
The stroke color of the given geometry element when the user moves the mouse over it.
- See:
- #sstrokeColor
- #strokeWidth
- #strokeOpacity
- #highlightStrokeOpacity
{number}
highlightStrokeOpacity
Opacity for stroke color when the object is highlighted.
{number}
highlightStrokeWidth
Width of the element's stroke when the mouse is pointed over it.
{String}
id
Unique identifier for the element. Equivalent to id-attribute of renderer element.
- Default Value:
- empty string
{Boolean}
isReal
If element is in two dimensional real space this is true, else false.
- Default Value:
- true
layer
display layer which will conting the element.
Controlled in JXG.Options.
{String}
name
Not necessarily unique name for the element.
- Default Value:
- Name generated by JXG.Board#generateName.
{Boolean}
needsRegularUpdate
If this is set to true, the element is updated in every update
call of the board. If set to false, the element is updated only after
zoom events or more generally, when the bounding box has been changed.
Examples for the latter behaviour should be axes.
- Default Value:
- true
{Boolean}
needsUpdate
Controls if updates are necessary
- Default Value:
- true
{Object}
notExistingParents
Stores all Intersection Objects which in this moment are not real and
so hide this element.
{Number}
numTraces
Counts the number of objects drawn as part of the trace of the element.
- See:
- JXG.GeometryElement#traced
- JXG.GeometryElement#clearTrace
- JXG.GeometryElement#traces
{Array}
quadraticform
Quadratic form representation of circles (and conics)
- Default Value:
- [[1,0,0],[0,1,0],[0,0,1]]
{boolean}
shadow
If true the element will get a shadow.
- Default Value:
- false
{Array}
stdform
[c,b0,b1,a,k,r,q0,q1]
See
A.E. Middleditch, T.W. Stacey, and S.B. Tor:
"Intersection Algorithms for Lines and Circles",
ACM Transactions on Graphics, Vol. 8, 1, 1989, pp 25-40.
The meaning of the parameters is:
Circle: points p=[p0,p1] on the circle fulfill
a<p,p> + <b,p> + c = 0
For convenience we also store
r: radius
k: discriminant = sqrt(<b,b>-4ac)
q=[q0,q1] center
Points have radius = 0.
Lines have radius = infinity.
b: normalized vector, representing the direction of the line.
Should be put into Coords, when all elements possess Coords.
- Default Value:
- [1, 0, 0, 0, 1, 1, 0, 0]
{string}
strokeColor
The stroke color of the given geometry element.
{number}
strokeOpacity
Opacity for element's stroke color.
{number}
strokeWidth
Width of the element's stroke.
{Object}
symbolic
Stores variables for symbolic computations
{Boolean}
trace
If true the element will be traced, i.e. on every movement the element will be copied
to the background. Use JXG.GeometryElement#clearTrace to delete the trace elements.
- Default Value:
- false
{Object}
traces
Keeps track of all objects drawn as part of the trace of the element.
- See:
- JXG.GeometryElement#traced
- JXG.GeometryElement#clearTrace
- JXG.GeometryElement#numTraces
{Array}
transformations
Stores the transformations which are applied during update in an array
- See:
- JXG.Transformation
{boolean}
visible
If false the element won't be visible on the board, otherwise it is shown.
- See:
- #hideElement
- #showElement
- Default Value:
- true
{Object}
visProp
An associative array containing all visual properties.
- Default Value:
- empty object
Method Detail
addChild(obj)
Add an element as a child to the current element. Can be used to model dependencies between geometry elements.
- Parameters:
- {JXG.GeometryElement} obj
- The dependent object.
addLabelToElement()
Adds a label to the element.
{JXG.GeometryElement}
animate(hash, time)
Animates properties for that object like stroke or fill color, opacity and maybe
even more later.
- Parameters:
- {Object} hash
- Object containing propiertes with target values for the animation.
- {number} time
- Number of milliseconds to complete the animation.
- Returns:
- A reference to the object
clearTrace()
Removes all objects generated by the trace function.
hideElement()
Hide the element. It will still exist but not visible on the board.
highlight()
Highlights the element.
labelColor(lColor)
Set the labelColor of an element
- Parameters:
- {String} lColor
- String which determines the text color of an object's label.
noHighlight()
Uses the "normal" properties of the element.
remove()
Removes the element from the construction.
setArrow(firstArrow, lastArrow)
Determines whether the arc has arrows at start or end of the arc.
- Parameters:
- {bool} firstArrow
- True if there is an arrow at the start of the arc, false otherwise.
- {bool} lastArrow
- True if there is an arrow at the end of the arc, false otherwise. Is stored at visProp['firstArrow'] and visProp['lastArrow']
setProperty(%)
Sets an arbitrary number of properties.
// Set property directly on creation of an element using the attributes object parameter var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 5, 5, 1]}; var p = board.create('point', [2, 2], {visible: false}); // Now make this point visible and fixed: p.setProperty('fixed:true', 'visible:true'); // Alternatively you can use #hideElement resp. #showElement: p.hideElement();
- Parameters:
- %
- Arbitrary number of strings, containing "key:value" pairs. The possible key values are the element and class fields in this documentation.
showElement()
Make the element visible.
update()
General update method. Should be overwritten by the element itself.
Can be used sometimes to commit changes to the object.