Template:Digitalisierung - Module - Geometrie
From MapbenderWiki
Contents |
[edit]
geometries
the geometry module (mod_geometryArray.js) contains the following classes:
[edit]
geometryArray
[edit]
variables
- m: an array of members (a member represents a collection of geometries. A geometry is either a point, a line or a polygon).
[edit]
functions
The following public functions are available:
- getMemberCount(): returns the number of members
- getMember(i): returns the i-th member (if it doesn't exists, an exception will be thrown).
- getGeometry(i,j): returns the j-th geometry of the i-th member (if it doesn't exists, an exception will be thrown).
- getVertex(i,j,k): returns the k-th vertex of the j-th geometry of the i-th member (if it doesn't exists, an exception will be thrown).
- getCurrentGeometry(): returns the geometry that is currently being built.
- getCurrentMember(): returns the member whose geometry is currently being built.
- isValidMemberIndex(anIndex): returns true if the member m[anIndex] exists; otherwise false.
- updateAllPointsLike(oldPoint, newPoint): replaces all points like oldPoint by newPoint in all members.
- delAllPointsLike(aPoint): deletes all points with the same coordinates as aPoint.
- delMember(i): deletes the i-th member.
- delGeometry(i,j): deletes the j-th geometry of the i-th member. If all the geometries of a member have been deleted, the member will be deleted as well.
- delPoint(i,j,k): deletes the k-th vertex of the j-th geometry of the i-th member. If all vertices of a geometry have been deleted, the geometry will be deleted as well. If all geometries of a member have been deleted, the member will be deleted as well.
- closeCurrentGeometry(): finishes a geometry by labelling it complete. If no coordinates have been added, the geometry is discarded. When a polygon is built and the polygon button is clicked again, the polygon will be closed by connecting the last to the first point. Actually, the first point is stored twice at index 0 and index length
all other functions are private and shall not be used.
[edit]
member
[edit]
variables
- g: an array that contains the geometries of this member.
- geomType: the geometry type is either point, line or polygon. The actual value must be equal to the id of the corresponding button (given in element vars: button_point, button_line, button_polygon).
[edit]
functions
The following public functions are available:
- getGeometryAtIndex(i): returns the i-th geometry of this member (if it doesn't exist, an exception will be thrown).
- getGeometryCount(): returns the number of geometries of this member.
all other functions are private and shall not be used.
[edit]
geometry
[edit]
variables
- geomType: the geometry type is either point, line or polygon. The actual value must be equal to the id of the corresponding button (given in element vars: button_point, button_line, button_polygon).
- complete: true if the geometry is complete (in a polygon, the first and the last vertex must be the same).
- v: an array of vertices.
[edit]
functions
The following public functions are available:
- getVertexCount(): returns the number of vertices of this geometry (a polygon of n basepoints corresponds to a vertex array of n+1 vertices).
- getVertexAtIndex(i): returns the i-th vertex of this geometry. If it doesn't exist, an exception will be thrown.
all other functions are private and shall not be used.
[edit]
vertex
[edit]
variables
- x: the x-coordinate of the vertex.
- y: the y-coordinate of the vertex.
[edit]
functions
The following public functions are available:
- equals(aVertex): returns true if this vertex and aVertex have the same coordinates.
- dist(aVertex): returns the euclidean distance between this vertex and aVertex.
all other functions are private and shall not be used.

