Help - CoordSystem
CoordSystem is a graphical object that can be used to define a coordinate system in a graphic medium. Coordinates can be transform between the defined and the standard coordinate system of the graphic (with one pixel as a unit and (0|0) in to top left corner, with coordinates increasing from left to right and from top to bottom).
Contents
- 1 Drawing
- 2 Hierarchy
- 3 Properties
- 4 Methods
- 5 Objects inherited from PointSet
- 6 See also
Drawing
This object cannot be drawn with the mouse directly, instead you have to draw the subobjects origin
and the referenceLine
(see below).
Hierarchy
CoordSystem
Properties
Point origin
The origin of the coordinate system.
Line referenceLine
This line should be used to drawn along an objects in the graphic of which the length is known. Together with equivalenceInUnits
this defines the coordinate transformation.
Decimal equivalenceInUnits
Defines how long the reference line is in units.
Decimal xIncrease
Defines if the x values of this coordinate system are increasing. Set 1 here to get x-values that increase from left to right and -1 to get x-values that increase from right to left.
Decimal yIncrease
Defines if the y values of this coordinate system are increasing. Set 1 here to get y-values that increase from bottom to top and -1 to get y-values that increase from top to bottom.
Methods
Decimal unitsToPixels(Decimal units)
Converts a length value in units of this coordinate system to pixels.
Parameters
- Decimal units - the value in units to be converted.
Returns
The value in pixels.
Decimal pixelsToUnits(Decimal pixels)
Converts a length value in pixels to units of this coordinate system.
Parameters
- Decimal pixels - the value in pixels to be converted.
Returns
The value in units of the coordinate system.
Decimal xInUnits(Decimal pixels)
Converts a x-coordinate in pixels to a x-coordinate in units of this coordinate system. This method is different from pixelsToUnits
because it also regards the origin of the coordinate system and the increasing direction of the x-axes.
Parameters
- Decimal pixels - the value in pixels to be converted.
Returns
The value in units of the coordinate system.
Decimal yInUnits(Decimal pixels)
Converts a y-coordinate in pixels to a y-coordinate in units of this coordinate system. This method is different from pixelsToUnits
because it also regards the origin of the coordinate system and the increasing direction of the y-axes.
Parameters
- Decimal pixels - the value in pixels to be converted.
Returns
The value in units of the coordinate system.
Decimal pixelCountToArea(Decimal pixelCount)
Calculates the area in units which the specified number of pixels fill out. This method can e.g. be used to calculate the area covered by a PointSet.
A call of pixelCountToArea(pixelCount)
is equivalent to pixelsCount * pow(pixelsToUnits(1); 2)
.
Parameters
- Decimal pixelCount - the number of pixels which make up the area
Returns
The area in units of the coordinate system.
Examples
Expression | Result |
---|---|
pow<code>A.I[0].aCoordSystem.pixelCountToArea(1) |
The area one pixel takes up in units of aCoordSystem (contained in the analysis A ).
|
A.I[0].aCoordSystem.pixelCountToArea(A.I[0].aPointSet.count()) |
The area in the units of CoordSystem aCoordSystem (contained in the analysis A ) wich is covered by the PointSet aPointSet (contained in the analysis A ).
|
Decimal areaToPixelCount(Decimal area)
Calculates the number of pixels which make up the specified area-size in units. This method is the inverse function of pixelCountToArea
(see above). Note that this method could also return non-integer values depending on the specified area value.
A call of areaToPixelCount(pixelCount)
is equivalent to pixelsCount / pow(pixelsToUnits(1); 2)
.
Parameters
- Decimal area - the area in units of this CoordSystem
Returns
The number of pixels which would make up the specified area.
Objects inherited from PointSet
none