Elongation Component
 elongationComponent006view, link (67.1 KB, 1000800) source (624 KB)Tue, 30 Jan 07, 6:03pm CST 
 

Documentation for the component:

Methods

  • addPlanet(name, defObj, linkageName) - This function adds a planet movieclip to the component. name should be a valid actionscript identifier since it will be the name given to the movieclip. Properties of the defObj will be defined on the newly attached movielip (it is used as the initObject). See the section on defining planet locations below, as well as the section on the default planet movieclip, to see what properties this object should have. linkageName is an optional argument to specify which movieclip to use for the planet disc. If left undefined the default, "EC Planet Disc", will be used.
  • addAngle(name, defObj, linkageName) - This function adds an angle movieclip to the component. name should be a valid actionscript identifier since it will be the name given to the movieclip. Properties of the defObj will be defined on the newly attached movielip (it is used as the initObject). See the section on defining angles below, as well as the section on the default angle movieclip to see what properties this object should have. linkageName is an optional argument to specify which movieclip to use for the angle. If left undefined the default, "EC Angle", will be used.
  • update() - Call this function after making changes.
  • reset() - This function removes all planet and angle movieclips.
  • setOrbitRadii(r1, r2) - Sets the orbit radii (it does not matter in which order they are given). There is no need to call an update function after calling this function. The defaults are 75 and 150.
  • getGreatestElongation() - This function returns the greatest elongation, in degrees, possible for the given configuration. This value depends on the relative sizes of the orbits. Note that this function always assumes the inferior planet configuration, even when in superior planet mode (since greatest elongation has no meaning in that case).
  • addSun(linkageName) - Call this if you want to use a different sun icon. The default linkageName is "EC Sun Disc".

Properties

  • mode - This property determines whether the observed planet is inferior or superior to the observer's planet. The value should be "inferior" or "superior". The default is "inferior".
  • orbitThickness, orbitColor, orbitAlpha - The orbit style. Defaults are 2, 0x505050, and 100. Call updateOrbits after changing these properties.
  • minOrbitSeparation - The minimum difference between inner and outer orbits, as well as the minimum size of the inner orbit. The default is 20.

Defining a Planet Location

The properties that can be used to define the planet's location are type, pAngle, eAngle, eString, wrt, and useFarSide. The following describes their use.

There are two types of planets: observer and observed. By default planets are assumed to be observed planets, so you will have to set type to "observer" if it is supposed to be an observer's planet.

There are essentially two ways that the location of the planet can be specified: either by the position angle (the angle with the sun at the vertex) or the elongation angle (the angle with the observer planet at the vertex). Defining by position angle is simplest and can be accomplished with the pAngle property, which specifies planet's position in degrees CCW from the +x axis (or degrees CCW from another object, see the comments for the wrt property below).

For elongation the eAngle property is used. This should be in degrees, where eastern elongations are positive and western elongations are negative. Alternately, elongation configurations can be defined descriptively with a string, eString. This string can be the full description or an abbreviation (e.g. "western greatest elongation" or "wge").

The wrt ("with respect to") property specifies which other planet the position is relative to. For planets defined by the position angle this property is optional, but for planets defined by an elongation angle or elongation description there must always be another planet (even if only implied). In the elongation cases the wrt planet must be of the opposite type. Note that when a planet has an elongation definition but lacks the wrt property the component uses the first object it finds of the opposite type, so in cases where there is only one such object it can be OK to leave the property undefined. Still, be aware of the ordering issue (see the ordering section below).

When in the inferior planet mode if an elongation is greater than the greatest elongation the component will reduce it down to the greatest elongation. For elongation angles less than the greatest elongation there are two points on the orbit that can have that value, so the component will assume the near position unless the useFarSide property is true.

Comment on the Order in which Planets are Added

The order planets are added is important since the component will process them sequentially. Planet positions defined by elongation need to be defined with respect to a planet of the opposite type whose position is defined by position angle. Therefore the first planet added to the component needs to be defined by position angle and not with respect to any other planet.

Defining an Angle

An angle needs to have planet1 and planet2 properties, which are the names of the objects the elongation angle is to be drawn for. Naturally one of these objects should be an observer planet and the other an observed planet, although it does not matter which is assigned to planet1 or planet2.

Default Angle Movieclip Options

The following properties can be set via the defObj when adding the angle movieclip. Call the update function on the angle movieclip if any of these properties have changed after it has been attached.

  • lineMargin - This the number of pixels beyond the outer orbit that the lines should extend. The default is 30.
  • lineThickness, lineColor, lineAlpha - These control the style for the lines, arcs and arrowheads. The defaults are 2, 0xffc050, and 100.
  • labelColor - The color for the elongation angle text. The default is 0xffc050.
  • labelBackgroundColor, labelBackgroundAlpha - These specify the color and transparency of the fill behind the angle text. The defaults are 0x000000 and 60.
  • labelDistance - This is the extra distance from the arc where the label is placed. The default is 12.
  • arcRadius - This is the radius of the arc. The default is 30.

Default Planet Movieclip Options

The following properties can be set via the defObj when adding the planet movieclip. Call the update function on the planet movieclip if any of these properties have changed after it has been attached.

  • label - The text for the label. The default is undefined.
  • labelAngle - If this property is defined then the label will always be placed at the given angle, which is measured in degrees CCW from right. The default is undefined.
  • labelDistance - The position of the label from the disc center. The default is 20.
  • discRadius - The radius of the planet disc. The default is 8.
  • outlineThickness, outlineColor, outlineAlpha - These control the disc outline style. The defaults are 1, 0x909090, and 0.
  • discColor - If this is defined the disc will be this color. If the property is undefined then the disc will have color 0x9090ff (blue) when the disc is for an observer planet and 0x909090 (gray) for an observed planet. The default is undefined.
  • labelColor - The label color. The default is 0xffffff.