Skip to content
danbim edited this page Jul 20, 2011 · 2 revisions

A MapPainter instance draws a map on the specified sector of the drawing area. This sector must be defined by setting its lower left point, and its horizontal and vertical comprehensiveness on the preference page (see the image below). The granularity defines the resolution of the map, i.e. the number of independently computed values (rectangles on the map). The two parameters per dimension for comprehensiveness and resolution can be associated to each other, i.e. set to the same value automatically, by using the appropriate button with the chain.

The other parameters define the range of data, that is contained in the packets payload. Concerning this payload, two things must be clarified at the beginning. The MapPainter always uses only the first element of the payload. If the payload contains for example an int16List, only the first two bytes of the payload are read and used as an int16 value. The rest of the payload will be ignored. The other thing is, that generally all packets from nodes, whose position is outside of the maps area will be ignored as well.

The MapPainter associates a color with all possible values. If a value is less than the minimum value from the preference page it gets the same color as the minimum value. It is the same with values grater than the maximum value from the preference page. They will be associated with the same color as the maximum value. All values in between will be associated with a mixed color between the defined colors for minimum and maximum value.

Assume the maximum value is associated with black and the minimum value is associated with white. Then a value close to but lower than the maximum value will be associated with a dark grey, while a value close to but higher than the minimum value will be associated with a bright grey.

For each rectangle of the map, the appropriate value is computed by identifying the k nearest neighbors, i.e. the k nearest positions, where a measured value is known and calculate the mean of these k values.

Each map has frame points. Frame points are invisible points on the maps border, that behave like nodes with a fixed position and measured data. The positions of the frame points are uniformly distributed on the frame, thus per dimension the distance between neighbored frame points is equal. Each frame point provides the default value. The update frequency defines how often the map is being recomputed per second. As the algorithm to recalculate all the values is computational expensive, the actual update frequency could be slower than the configured.

The image below shows an example for a MapPainter instance together with an active and visible SimpleNodePainter instance. So one can see, where the nodes are located in the maps sector.

The MapPainter supports metric, since the whole map bases on the distance of the nodes in the real world. Thus an instance can not be active while a SpringEmbedderPositioner instance is active, too.

Clone this wiki locally