| 99 | | if (Math.abs( closesttime - this.currentDateTime ) > // our best result so far is worse |
|---|
| 100 | | Math.min( // than the result to the closer point in time |
|---|
| 101 | | Math.abs( this.features[i].dateTime - this.currentDateTime ), |
|---|
| 102 | | Math.abs( OpenLayers.Date.getEndDate(this.features[i].dateTime) - this.currentDateTime ) |
|---|
| | 97 | if (Math.abs( closesttime - this.currentDateTime ) > // our best result so far is worse |
|---|
| | 98 | Math.min( // than the result to the closer point in time |
|---|
| | 99 | Math.abs( this.features[i].dateTime - this.currentDateTime ), // of either the beginning |
|---|
| | 100 | Math.abs( OpenLayers.Date.getEndDate(this.features[i].dateTime) - this.currentDateTime ) // or the end of the interval of this feature |
|---|
| 112 | | var closestgeom = closestfeature.geometry; |
|---|
| 113 | | if (this.interpolatePoints && closestgeom && closestfeature.dateTime && closestgeom.CLASS_NAME == "OpenLayers.Geometry.LineString" && closestgeom.components.length == 2) { |
|---|
| 114 | | // this is good for a two point {OpenLayers.LineString} only, but that's what our superclass uses |
|---|
| 115 | | // if PointTrack was to work with something else, this would have to be adapted, too |
|---|
| 116 | | closestpoint = new OpenLayers.Geometry.Point( |
|---|
| 117 | | closestgeom.components[0].x + (closestgeom.components[1].x - closestgeom.components[0].x) * OpenLayers.Date.getPlaceInInterval(closestfeature.dateTime,this.currentDateTime), |
|---|
| 118 | | closestgeom.components[0].y + (closestgeom.components[1].y - closestgeom.components[0].y) * OpenLayers.Date.getPlaceInInterval(closestfeature.dateTime,this.currentDateTime) |
|---|
| 119 | | ); |
|---|
| | 112 | var closestgeom = closestfeature.geometry; // set the closest point as default |
|---|
| | 113 | if (this.interpolatePoints && closestgeom && closestfeature.dateTime) { // sanity check to see if we have all the required parameters for interpolation |
|---|
| | 114 | if (closestgeom.CLASS_NAME == "OpenLayers.Geometry.LineString" && closestgeom.components.length == 2) { |
|---|
| | 115 | // this is ATM good for a two point {OpenLayers.LineString} only, but that's what our superclass uses |
|---|
| | 116 | // if PointTrack was to work with something else, additional cases will have to be written to accomodate |
|---|
| | 117 | // interpolation for other geometries |
|---|
| | 118 | closestpoint = new OpenLayers.Geometry.Point( |
|---|
| | 119 | closestgeom.components[0].x + (closestgeom.components[1].x - closestgeom.components[0].x) * OpenLayers.Date.getPlaceInInterval(closestfeature.dateTime,this.currentDateTime), |
|---|
| | 120 | closestgeom.components[0].y + (closestgeom.components[1].y - closestgeom.components[0].y) * OpenLayers.Date.getPlaceInInterval(closestfeature.dateTime,this.currentDateTime) |
|---|
| | 121 | ); |
|---|
| | 122 | } |
|---|
| 129 | | * APIMethod: setDateTime |
|---|
| 130 | | * Adds point features that will be used to create lines from, using point |
|---|
| 131 | | * pairs. The first point of a pair will be the source node, the second |
|---|
| 132 | | * will be the target node. |
|---|
| | 132 | * APIMethod: dateTimeFromFeatures |
|---|
| | 133 | * Generates the datetimeIntervals property of the Layer object from a |
|---|
| | 134 | * property of each feature so that the new datetimeIntervals |
|---|
| | 135 | * begins with the date found on the earliest feature, and ends with the |
|---|
| | 136 | * date found on the latest feature. The property name to use for the dates |
|---|
| | 137 | * is specified in the attrname parameter and is "pubdate" by default |
|---|